diff --git a/src/game/Map.cpp b/src/game/Map.cpp index fb649602c7..b82c4127d9 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -449,6 +449,8 @@ bool Map::Add(Player *player) SendInitSelf(player); SendInitTransports(player); + player->m_IsInNotifyList = false; + player->m_Notified = false; AddNotifier(player); return true; @@ -594,12 +596,24 @@ void Map::RelocationNotify() for(std::vector::iterator iter = i_unitsToNotify.begin(); iter != i_unitsToNotify.end(); ++iter) { Unit *unit = ObjectAccessor::GetObjectInWorld(*iter, (Unit*)NULL); - if(!unit || !unit->IsInWorld() || !unit->GetMapId() == GetId()) + if(!unit || unit->GetMapId() != GetId()) { *iter = 0; continue; } + if(!unit->IsInWorld()) + { + //other objs are done during remove + if(unit->GetTypeId() == TYPEID_PLAYER) + { + Trinity::VisibleChangesNotifier notifier(*unit); + VisitWorld(unit->GetPositionX(), unit->GetPositionY(), World::GetMaxVisibleDistance(), notifier); + } + *iter = 0; + continue; + } + unit->m_Notified = true; if(unit->GetTypeId() == TYPEID_PLAYER) @@ -758,9 +772,7 @@ void Map::Update(const uint32 &t_diff) void Map::Remove(Player *player, bool remove) { - player->DestroyForNearbyPlayers(); - player->m_IsInNotifyList = false; - player->m_Notified = false; + AddUnitToNotify(player); // this may be called during Map::Update // after decrement+unlink, ++m_mapRefIter will continue correctly diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 2f1d21a8b5..20fc71d08b 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -1756,17 +1756,6 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati ResetContestedPvP(); - /*DestroyForNearbyPlayers(); - { - UpdateData data; - for(ClientGUIDs::iterator i = m_clientGUIDs.begin(); i != m_clientGUIDs.end(); ++i) - data.AddOutOfRangeGUID(*i); - WorldPacket packet; - data.BuildPacket(&packet); - GetSession()->SendPacket(&packet); - }*/ - m_clientGUIDs.clear(); - // remove player from battleground on far teleport (when changing maps) if(BattleGround const* bg = GetBattleGround()) { diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 4b1dd4f50a..54c05ce10a 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -902,7 +902,7 @@ void Aura::_AddAura() if(const std::vector *spell_triggered = spellmgr.GetSpellLinked(id + SPELL_LINK_AURA)) for(std::vector::const_iterator itr = spell_triggered->begin(); itr != spell_triggered->end(); ++itr) if(*itr < 0) - m_target->ApplySpellImmune(id, IMMUNITY_ID, *itr, m_target); + m_target->ApplySpellImmune(id, IMMUNITY_ID, -(*itr), m_target); else if(Unit* caster = GetCaster()) m_target->AddAura(*itr, m_target); } @@ -1043,7 +1043,7 @@ void Aura::_RemoveAura() if(const std::vector *spell_triggered = spellmgr.GetSpellLinked(id + SPELL_LINK_AURA)) for(std::vector::const_iterator itr = spell_triggered->begin(); itr != spell_triggered->end(); ++itr) if(*itr < 0) - m_target->ApplySpellImmune(id, IMMUNITY_ID, *itr, false); + m_target->ApplySpellImmune(id, IMMUNITY_ID, -(*itr), false); else m_target->RemoveAurasDueToSpell(*itr); } diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index deece9e386..100fa5231d 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -4393,7 +4393,7 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode) // Statue unsummoned at aura remove Totem* statue = NULL; bool channeled = false; - if(Aur->GetAuraDuration() && IsChanneledSpell(AurSpellInfo)) + if(Aur->GetAuraDuration() && !Aur->IsPersistent() && IsChanneledSpell(AurSpellInfo)) { if(!caster) // can be already located for IsSingleTargetSpell case caster = Aur->GetCaster();