From 1c2e62d2f4cf828cac5e48e20abd8876c2725c65 Mon Sep 17 00:00:00 2001 From: megamage Date: Thu, 26 Mar 2009 08:50:51 -0600 Subject: [PATCH 1/4] *Backport a missing function from TC2. --HG-- branch : trunk --- src/game/Object.cpp | 5 +++++ src/game/Object.h | 1 + 2 files changed, 6 insertions(+) diff --git a/src/game/Object.cpp b/src/game/Object.cpp index 7966a79a84..c0196c5a35 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -1556,6 +1556,11 @@ Map* WorldObject::GetMap() const return MapManager::Instance().GetMap(GetMapId(), this); } +Map* WorldObject::FindMap() const +{ + return MapManager::Instance().FindMap(GetMapId(), GetInstanceId()); +} + Map const* WorldObject::GetBaseMap() const { return MapManager::Instance().GetBaseMap(GetMapId()); diff --git a/src/game/Object.h b/src/game/Object.h index 7e18ea4db9..ef8a04c5c0 100644 --- a/src/game/Object.h +++ b/src/game/Object.h @@ -483,6 +483,7 @@ class TRINITY_DLL_SPEC WorldObject : public Object void SendPlaySound(uint32 Sound, bool OnlySelf); Map * GetMap() const; + Map * FindMap() const; Map const* GetBaseMap() const; Creature* SummonCreature(uint32 id, float x, float y, float z, float ang,TempSummonType spwtype,uint32 despwtime); GameObject* SummonGameObject(uint32 entry, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime); From b95f1a2ff4224e55e436fe344ae7edf1db6de57a Mon Sep 17 00:00:00 2001 From: megamage Date: Thu, 26 Mar 2009 11:18:43 -0600 Subject: [PATCH 2/4] *Fix broken single spell immune. --HG-- branch : trunk --- src/game/Unit.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 4e400c509c..bff6d50415 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -4286,7 +4286,7 @@ bool Unit::AddAura(Aura *Aur) 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) - ApplySpellImmune(id, IMMUNITY_ID, *itr, true); + ApplySpellImmune(id, IMMUNITY_ID, -(*itr), true); else if(Unit* caster = Aur->GetCaster()) caster->AddAura(*itr, this); } @@ -4834,7 +4834,7 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode) 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) - ApplySpellImmune(id, IMMUNITY_ID, *itr, false); + ApplySpellImmune(id, IMMUNITY_ID, -(*itr), false); else RemoveAurasDueToSpell(*itr); } From dd5faef0240f871f455a783a99855357fc86b34f Mon Sep 17 00:00:00 2001 From: megamage Date: Thu, 26 Mar 2009 20:32:28 -0600 Subject: [PATCH 3/4] *Do not interrupt channel when persistent aura is removed. --HG-- branch : trunk --- src/game/Unit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index bff6d50415..900f060931 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -4750,7 +4750,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(); From 52a5c5e8e3534d4c5d33076ab321dc654d77fa85 Mon Sep 17 00:00:00 2001 From: megamage Date: Thu, 26 Mar 2009 20:33:01 -0600 Subject: [PATCH 4/4] *Some improvement of update visibility when players leave map. --HG-- branch : trunk --- src/game/Map.cpp | 20 ++++++++++++++++---- src/game/Player.cpp | 11 ----------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/game/Map.cpp b/src/game/Map.cpp index afc9fea0ce..c1cd4da191 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -469,6 +469,8 @@ bool Map::Add(Player *player) SendInitSelf(player); SendInitTransports(player); + player->m_IsInNotifyList = false; + player->m_Notified = false; AddNotifier(player); return true; @@ -614,12 +616,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) @@ -798,9 +812,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 c163026b08..764cb20c88 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -1714,17 +1714,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()) {