aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSubv <subv2112@gmail.com>2014-06-01 22:27:29 -0500
committerSubv <subv2112@gmail.com>2014-06-01 22:27:29 -0500
commit48ec2df81fa8f88cd32d7a79b587603aedbd89e0 (patch)
tree1a6404c63979ee20a39f8b577db21541b37739c5 /src
parent6bc62d730ed08e6e12d9b57d4914e98019298781 (diff)
Core/Phases: Preliminary work with correctly implementing the phase system in 4.3.4
Put here for peer review.
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Battlefield/Battlefield.cpp1
-rw-r--r--src/server/game/Battlegrounds/Battleground.cpp1
-rw-r--r--src/server/game/Combat/ThreatManager.cpp4
-rw-r--r--src/server/game/Conditions/ConditionMgr.cpp4
-rw-r--r--src/server/game/Entities/Creature/Creature.cpp7
-rw-r--r--src/server/game/Entities/Creature/Creature.h4
-rw-r--r--src/server/game/Entities/GameObject/GameObject.cpp17
-rw-r--r--src/server/game/Entities/GameObject/GameObject.h6
-rw-r--r--src/server/game/Entities/Object/Object.cpp47
-rw-r--r--src/server/game/Entities/Object/Object.h5
-rw-r--r--src/server/game/Entities/Pet/Pet.cpp3
-rw-r--r--src/server/game/Entities/Player/Player.cpp58
-rw-r--r--src/server/game/Entities/Player/Player.h8
-rw-r--r--src/server/game/Entities/Transport/Transport.cpp10
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp60
-rw-r--r--src/server/game/Entities/Unit/Unit.h3
-rw-r--r--src/server/game/Globals/ObjectMgr.cpp58
-rw-r--r--src/server/game/Globals/ObjectMgr.h41
-rw-r--r--src/server/game/Grids/Notifiers/GridNotifiers.cpp6
-rw-r--r--src/server/game/Grids/Notifiers/GridNotifiers.h103
-rw-r--r--src/server/game/Grids/Notifiers/GridNotifiersImpl.h54
-rw-r--r--src/server/game/Handlers/GroupHandler.cpp7
-rw-r--r--src/server/game/Handlers/MiscHandler.cpp8
-rw-r--r--src/server/game/Instances/InstanceScript.cpp6
-rw-r--r--src/server/game/Maps/PhaseMgr.cpp438
-rw-r--r--src/server/game/Maps/PhaseMgr.h179
-rw-r--r--src/server/game/Server/WorldSession.h2
-rw-r--r--src/server/game/Spells/Auras/SpellAuraEffects.cpp52
-rw-r--r--src/server/game/Spells/SpellEffects.cpp18
-rw-r--r--src/server/game/Spells/SpellInfo.cpp1
-rw-r--r--src/server/game/World/World.cpp7
-rw-r--r--src/server/scripts/Commands/cs_debug.cpp8
-rw-r--r--src/server/scripts/Commands/cs_gobject.cpp7
-rw-r--r--src/server/scripts/Commands/cs_modify.cpp9
-rw-r--r--src/server/scripts/Commands/cs_npc.cpp11
-rw-r--r--src/server/scripts/Commands/cs_wp.cpp28
-rw-r--r--src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp4
-rw-r--r--src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp1
-rw-r--r--src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp3
-rw-r--r--src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp6
40 files changed, 434 insertions, 861 deletions
diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp
index a797f6109ca..59633f87058 100644
--- a/src/server/game/Battlefield/Battlefield.cpp
+++ b/src/server/game/Battlefield/Battlefield.cpp
@@ -800,7 +800,6 @@ Creature* Battlefield::SpawnCreature(uint32 entry, float x, float y, float z, fl
delete creature;
return NULL;
}
-
creature->SetHomePosition(x, y, z, o);
CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(entry);
diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp
index dff99280e73..ba207c1ffc3 100644
--- a/src/server/game/Battlegrounds/Battleground.cpp
+++ b/src/server/game/Battlegrounds/Battleground.cpp
@@ -1539,6 +1539,7 @@ bool Battleground::AddObject(uint32 type, uint32 entry, float x, float y, float
delete go;
return false;
}
+
/*
uint32 guid = go->GetGUIDLow();
diff --git a/src/server/game/Combat/ThreatManager.cpp b/src/server/game/Combat/ThreatManager.cpp
index 339ec579b1a..edf15aaf1ff 100644
--- a/src/server/game/Combat/ThreatManager.cpp
+++ b/src/server/game/Combat/ThreatManager.cpp
@@ -75,7 +75,7 @@ bool ThreatCalcHelper::isValidProcess(Unit* hatedUnit, Unit* hatingUnit, SpellIn
return false;
// not in same map or phase
- if (!hatedUnit->IsInMap(hatingUnit) || !hatedUnit->InSamePhase(hatingUnit))
+ if (!hatedUnit->IsInMap(hatingUnit) || !hatedUnit->IsInPhase(hatingUnit))
return false;
// spell not causing threat
@@ -182,7 +182,7 @@ void HostileReference::updateOnlineStatus()
&& (getTarget()->GetTypeId() != TYPEID_PLAYER || !getTarget()->ToPlayer()->IsGameMaster())
&& !getTarget()->HasUnitState(UNIT_STATE_IN_FLIGHT)
&& getTarget()->IsInMap(GetSourceUnit())
- && getTarget()->InSamePhase(GetSourceUnit())
+ && getTarget()->IsInPhase(GetSourceUnit())
)
{
Creature* creature = GetSourceUnit()->ToCreature();
diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp
index 74beed534c6..31f5594188a 100644
--- a/src/server/game/Conditions/ConditionMgr.cpp
+++ b/src/server/game/Conditions/ConditionMgr.cpp
@@ -1512,11 +1512,11 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
}
break;
case CONDITION_SOURCE_TYPE_PHASE_DEFINITION:
- if (!PhaseMgr::IsConditionTypeSupported(cond->ConditionType))
+ /*if (!PhaseMgr::IsConditionTypeSupported(cond->ConditionType))
{
TC_LOG_ERROR("sql.sql", "Condition source type `CONDITION_SOURCE_TYPE_PHASE_DEFINITION` does not support condition type %u, ignoring.", cond->ConditionType);
return false;
- }
+ }*/
break;
case CONDITION_SOURCE_TYPE_NPC_VENDOR:
{
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp
index 517464fef4a..51d2646b1c3 100644
--- a/src/server/game/Entities/Creature/Creature.cpp
+++ b/src/server/game/Entities/Creature/Creature.cpp
@@ -739,6 +739,13 @@ bool Creature::Create(uint32 guidlow, Map* map, uint32 phaseMask, uint32 entry,
ASSERT(map);
SetMap(map);
SetPhaseMask(phaseMask, false);
+
+ if (data && data->phaseid)
+ SetInPhase(data->phaseid, false, true);
+
+ if (data && data->phaseGroup)
+ for (auto ph : GetPhasesForGroup(data->phaseGroup))
+ SetInPhase(ph, false, true);
CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(entry);
if (!cinfo)
diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h
index 8a22ce61f0d..574c10d14f4 100644
--- a/src/server/game/Entities/Creature/Creature.h
+++ b/src/server/game/Entities/Creature/Creature.h
@@ -254,7 +254,7 @@ struct CreatureData
CreatureData() : id(0), mapid(0), phaseMask(0), displayid(0), equipmentId(0),
posX(0.0f), posY(0.0f), posZ(0.0f), orientation(0.0f), spawntimesecs(0),
spawndist(0.0f), currentwaypoint(0), curhealth(0), curmana(0), movementType(0),
- spawnMask(0), npcflag(0), unit_flags(0), dynamicflags(0), dbData(true) { }
+ spawnMask(0), npcflag(0), unit_flags(0), dynamicflags(0), phaseid(0), phaseGroup(0), dbData(true) { }
uint32 id; // entry in creature_template
uint16 mapid;
uint32 phaseMask;
@@ -274,6 +274,8 @@ struct CreatureData
uint32 npcflag;
uint32 unit_flags; // enum UnitFlags mask values
uint32 dynamicflags;
+ uint32 phaseid;
+ uint32 phaseGroup;
bool dbData;
};
diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp
index d6a029d29bf..736c39461cd 100644
--- a/src/server/game/Entities/GameObject/GameObject.cpp
+++ b/src/server/game/Entities/GameObject/GameObject.cpp
@@ -813,6 +813,16 @@ bool GameObject::LoadGameObjectFromDB(uint32 guid, Map* map, bool addToMap)
if (!Create(guid, entry, map, phaseMask, x, y, z, ang, rotation0, rotation1, rotation2, rotation3, animprogress, go_state, artKit))
return false;
+ if (data->phaseid)
+ SetInPhase(data->phaseid, false, true);
+
+ if (data->phaseGroup)
+ {
+ // Set the gameobject in all the phases of the phasegroup
+ for (auto ph : GetPhasesForGroup(data->phaseGroup))
+ SetInPhase(ph, false, true);
+ }
+
if (data->spawntimesecs >= 0)
{
m_spawnedByDefault = true;
@@ -2053,6 +2063,13 @@ void GameObject::SetDisplayId(uint32 displayid)
UpdateModel();
}
+void GameObject::SetInPhase(uint32 id, bool update, bool apply)
+{
+ WorldObject::SetInPhase(id, update, apply);
+ if (m_model && m_model->isEnabled())
+ EnableCollision(true);
+}
+
void GameObject::SetPhaseMask(uint32 newPhaseMask, bool update)
{
WorldObject::SetPhaseMask(newPhaseMask, update);
diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h
index 640d5718186..2b24f29fe69 100644
--- a/src/server/game/Entities/GameObject/GameObject.h
+++ b/src/server/game/Entities/GameObject/GameObject.h
@@ -592,7 +592,7 @@ struct GameObjectData
{
explicit GameObjectData() : id(0), mapid(0), phaseMask(0), posX(0.0f), posY(0.0f), posZ(0.0f), orientation(0.0f),
rotation0(0.0f), rotation1(0.0f), rotation2(0.0f), rotation3(0.0f), spawntimesecs(0),
- animprogress(0), go_state(GO_STATE_ACTIVE), spawnMask(0), artKit(0), dbData(true) { }
+ animprogress(0), go_state(GO_STATE_ACTIVE), spawnMask(0), artKit(0), phaseid(0), phaseGroup(0), dbData(true) { }
uint32 id; // entry in gamobject_template
uint16 mapid;
uint32 phaseMask;
@@ -609,6 +609,8 @@ struct GameObjectData
GOState go_state;
uint8 spawnMask;
uint8 artKit;
+ uint32 phaseid;
+ uint32 phaseGroup;
bool dbData;
};
@@ -725,6 +727,7 @@ class GameObject : public WorldObject, public GridObject<GameObject>, public Map
static void SetGoArtKit(uint8 artkit, GameObject* go, uint32 lowguid = 0);
void SetPhaseMask(uint32 newPhaseMask, bool update);
+ void SetInPhase(uint32 id, bool update, bool apply);
void EnableCollision(bool enable);
void Use(Unit* user);
@@ -876,6 +879,7 @@ class GameObject : public WorldObject, public GridObject<GameObject>, public Map
//! Following check does check 3d distance
return IsInRange(obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), dist2compare);
}
+
GameObjectAI* m_AI;
};
#endif
diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp
index a2fd19c443c..24e4a7b82ce 100644
--- a/src/server/game/Entities/Object/Object.cpp
+++ b/src/server/game/Entities/Object/Object.cpp
@@ -1493,7 +1493,7 @@ bool WorldObject::IsWithinDist(WorldObject const* obj, float dist2compare, bool
bool WorldObject::IsWithinDistInMap(WorldObject const* obj, float dist2compare, bool is3D /*= true*/) const
{
- return obj && IsInMap(obj) && InSamePhase(obj) && _IsWithinDist(obj, dist2compare, is3D);
+ return obj && IsInMap(obj) && IsInPhase(obj) && _IsWithinDist(obj, dist2compare, is3D);
}
bool WorldObject::IsWithinLOS(float ox, float oy, float oz) const
@@ -1932,7 +1932,7 @@ bool WorldObject::CanSeeOrDetect(WorldObject const* obj, bool ignoreStealth, boo
bool WorldObject::CanNeverSee(WorldObject const* obj) const
{
- return GetMap() != obj->GetMap() || !InSamePhase(obj);
+ return GetMap() != obj->GetMap() || !IsInPhase(obj);
}
bool WorldObject::CanDetect(WorldObject const* obj, bool ignoreStealth) const
@@ -2330,8 +2330,12 @@ TempSummon* Map::SummonCreature(uint32 entry, Position const& pos, SummonPropert
}
uint32 phase = PHASEMASK_NORMAL;
+ std::set<uint32> phases;
if (summoner)
+ {
phase = summoner->GetPhaseMask();
+ phases = summoner->GetPhases();
+ }
TempSummon* summon = NULL;
switch (mask)
@@ -2359,6 +2363,10 @@ TempSummon* Map::SummonCreature(uint32 entry, Position const& pos, SummonPropert
return NULL;
}
+ // Set the summon to the summoner's phase
+ for (auto phaseId : phases)
+ summon->SetInPhase(phaseId, false, true);
+
summon->SetUInt32Value(UNIT_CREATED_BY_SPELL, spellId);
summon->SetHomePosition(pos);
@@ -2453,6 +2461,9 @@ GameObject* WorldObject::SummonGameObject(uint32 entry, float x, float y, float
return NULL;
}
+ for (auto phase : GetPhases())
+ go->SetInPhase(phase, false, true);
+
go->SetRespawnTime(respawnTime);
if (GetTypeId() == TYPEID_PLAYER || GetTypeId() == TYPEID_UNIT) //not sure how to handle this
ToUnit()->AddGameObject(go);
@@ -2835,9 +2846,39 @@ void WorldObject::SetPhaseMask(uint32 newPhaseMask, bool update)
UpdateObjectVisibility();
}
+void WorldObject::SetInPhase(uint32 id, bool update, bool apply)
+{
+ if (apply)
+ _phases.insert(id);
+ else
+ _phases.erase(id);
+
+ if (update && IsInWorld())
+ UpdateObjectVisibility();
+}
+
+bool WorldObject::IsInPhase(WorldObject const* obj) const
+{
+ // PhaseId 169 is the default fallback phase
+ if (_phases.empty() && obj->GetPhases().empty())
+ return true;
+
+ if (_phases.empty() && obj->IsInPhase(169))
+ return true;
+
+ if (obj->GetPhases().empty() && IsInPhase(169))
+ return true;
+
+ for (auto phase : _phases)
+ if (obj->IsInPhase(phase))
+ return true;
+ return false;
+}
+
bool WorldObject::InSamePhase(WorldObject const* obj) const
{
- return InSamePhase(obj->GetPhaseMask());
+ return IsInPhase(obj);
+ // return InSamePhase(obj->GetPhaseMask());
}
void WorldObject::PlayDistanceSound(uint32 sound_id, Player* target /*= NULL*/)
diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h
index 5e525f1e0d5..2d7a6f12016 100644
--- a/src/server/game/Entities/Object/Object.h
+++ b/src/server/game/Entities/Object/Object.h
@@ -676,9 +676,13 @@ class WorldObject : public Object, public WorldLocation
uint32 GetInstanceId() const { return m_InstanceId; }
virtual void SetPhaseMask(uint32 newPhaseMask, bool update);
+ virtual void SetInPhase(uint32 id, bool update, bool apply);
uint32 GetPhaseMask() const { return m_phaseMask; }
bool InSamePhase(WorldObject const* obj) const;
bool InSamePhase(uint32 phasemask) const { return (GetPhaseMask() & phasemask); }
+ bool IsInPhase(uint32 phase) const { return _phases.find(phase) != _phases.end(); }
+ bool IsInPhase(WorldObject const* obj) const;
+ std::set<uint32> const& GetPhases() const { return _phases; }
uint32 GetZoneId() const;
uint32 GetAreaId() const;
@@ -861,6 +865,7 @@ class WorldObject : public Object, public WorldLocation
//uint32 m_mapId; // object at map with map_id
uint32 m_InstanceId; // in map copy with instance id
uint32 m_phaseMask; // in area phase state
+ std::set<uint32> _phases;
uint16 m_notifyflags;
uint16 m_executed_notifies;
diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp
index 7f4bead4656..4a2e9968c1a 100644
--- a/src/server/game/Entities/Pet/Pet.cpp
+++ b/src/server/game/Entities/Pet/Pet.cpp
@@ -179,6 +179,9 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petEntry, uint32 petnumber, bool c
if (!Create(guid, map, owner->GetPhaseMask(), petEntry, petId))
return false;
+ for (auto itr : owner->GetPhases())
+ SetInPhase(itr, false, true);
+
setPetType(petType);
setFaction(owner->getFaction());
SetUInt32Value(UNIT_CREATED_BY_SPELL, summonSpellId);
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index f5c6d12a341..672596705d5 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -668,7 +668,7 @@ void KillRewarder::Reward()
}
-Player::Player(WorldSession* session): Unit(true), phaseMgr(this)
+Player::Player(WorldSession* session): Unit(true)
{
m_speakTime = 0;
m_speakCount = 0;
@@ -2921,9 +2921,6 @@ void Player::SetGameMaster(bool on)
getHostileRefManager().setOnlineOfflineState(true);
m_serverSideVisibilityDetect.SetValue(SERVERSIDE_VISIBILITY_GM, SEC_PLAYER);
-
- phaseMgr.AddUpdateFlag(PHASE_UPDATE_FLAG_SERVERSIDE_CHANGED);
- phaseMgr.Update();
}
UpdateObjectVisibility();
@@ -3164,11 +3161,6 @@ void Player::GiveLevel(uint8 level)
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_REACH_LEVEL);
- PhaseUpdateData phaseUpdateData;
- phaseUpdateData.AddConditionType(CONDITION_LEVEL);
-
- phaseMgr.NotifyConditionChanged(phaseUpdateData);
-
// Refer-A-Friend
if (GetSession()->GetRecruiterId())
if (level < sWorld->getIntConfig(CONFIG_MAX_RECRUIT_A_FRIEND_BONUS_PLAYER_LEVEL))
@@ -7785,8 +7777,6 @@ void Player::UpdateArea(uint32 newArea)
// so apply them accordingly
m_areaUpdateId = newArea;
- phaseMgr.AddUpdateFlag(PHASE_UPDATE_FLAG_AREA_UPDATE);
-
AreaTableEntry const* area = GetAreaEntryByAreaID(newArea);
pvpInfo.IsInFFAPvPArea = area && (area->flags & AREA_FLAG_ARENA);
UpdatePvPState(true);
@@ -7816,14 +7806,10 @@ void Player::UpdateArea(uint32 newArea)
RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING);
SetRestType(REST_TYPE_NO);
}
-
- phaseMgr.RemoveUpdateFlag(PHASE_UPDATE_FLAG_AREA_UPDATE);
}
void Player::UpdateZone(uint32 newZone, uint32 newArea)
{
- phaseMgr.AddUpdateFlag(PHASE_UPDATE_FLAG_ZONE_UPDATE);
-
if (m_zoneUpdateId != newZone)
{
sOutdoorPvPMgr->HandlePlayerLeaveZone(this, m_zoneUpdateId);
@@ -7928,8 +7914,6 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea)
UpdateLocalChannels(newZone);
UpdateZoneDependentAuras(newZone);
-
- phaseMgr.RemoveUpdateFlag(PHASE_UPDATE_FLAG_ZONE_UPDATE);
}
//If players are too far away from the duel flag... they lose the duel
@@ -15476,10 +15460,6 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver,
m_RewardedQuests.insert(quest_id);
m_RewardedQuestsSave[quest_id] = true;
- PhaseUpdateData phaseUpdateData;
- phaseUpdateData.AddQuestUpdate(quest_id);
- phaseMgr.NotifyConditionChanged(phaseUpdateData);
-
// StoreNewItem, mail reward, etc. save data directly to the database
// to prevent exploitable data desynchronisation we save the quest status to the database too
// (to prevent rewarding this quest another time while rewards were already given out)
@@ -16129,11 +16109,6 @@ void Player::SetQuestStatus(uint32 questId, QuestStatus status, bool update /*=
m_QuestStatusSave[questId] = true;
}
- PhaseUpdateData phaseUpdateData;
- phaseUpdateData.AddQuestUpdate(questId);
-
- phaseMgr.NotifyConditionChanged(phaseUpdateData);
-
if (update)
SendQuestUpdate(questId);
}
@@ -16145,11 +16120,6 @@ void Player::RemoveActiveQuest(uint32 questId, bool update /*= true*/)
{
m_QuestStatus.erase(itr);
m_QuestStatusSave[questId] = false;
-
- PhaseUpdateData phaseUpdateData;
- phaseUpdateData.AddQuestUpdate(questId);
-
- phaseMgr.NotifyConditionChanged(phaseUpdateData);
}
if (update)
@@ -16163,11 +16133,6 @@ void Player::RemoveRewardedQuest(uint32 questId, bool update /*= true*/)
{
m_RewardedQuests.erase(rewItr);
m_RewardedQuestsSave[questId] = false;
-
- PhaseUpdateData phaseUpdateData;
- phaseUpdateData.AddQuestUpdate(questId);
-
- phaseMgr.NotifyConditionChanged(phaseUpdateData);
}
if (update)
@@ -27532,6 +27497,9 @@ Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetTy
return NULL;
}
+ for (auto itr : GetPhases())
+ pet->SetInPhase(itr, false, true);
+
pet->SetCreatorGUID(GetGUID());
pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, getFaction());
@@ -27899,3 +27867,21 @@ void Player::ReadMovementInfo(WorldPacket& data, MovementInfo* mi, Movement::Ext
#undef REMOVE_VIOLATING_FLAGS
}
+
+void Player::UpdatePhasing()
+{
+ std::set<uint32> phaseIds;
+ std::set<uint32> terrainswaps;
+ std::set<uint32> worldAreaSwaps;
+
+ for (auto phase : GetPhases())
+ {
+ PhaseInfo const* info = sObjectMgr->GetPhaseInfo(phase);
+ if (!info)
+ continue;
+ terrainswaps.insert(info->terrainSwapMap);
+ worldAreaSwaps.insert(info->worldMapAreaSwap);
+ }
+
+ GetSession()->SendSetPhaseShift(GetPhases(), terrainswaps, worldAreaSwaps);
+} \ No newline at end of file
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index dccbc550a1e..d318efc3117 100644
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -25,7 +25,6 @@
#include "Item.h"
#include "PetDefines.h"
-#include "PhaseMgr.h"
#include "QuestDef.h"
#include "SpellMgr.h"
#include "Unit.h"
@@ -56,7 +55,6 @@ class PlayerMenu;
class PlayerSocial;
class SpellCastTargets;
class UpdateMask;
-class PhaseMgr;
typedef std::deque<Mail*> PlayerMails;
@@ -1333,8 +1331,6 @@ class Player : public Unit, public GridObject<Player>
Pet* SummonPet(uint32 entry, float x, float y, float z, float ang, PetType petType, uint32 despwtime);
void RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent = false);
- PhaseMgr& GetPhaseMgr() { return phaseMgr; }
-
/// Handles said message in regular chat based on declared language and in config pre-defined Range.
void Say(std::string const& text, const uint32 language);
/// Handles yelled message in regular chat based on declared language and in config pre-defined Range.
@@ -2361,6 +2357,8 @@ class Player : public Unit, public GridObject<Player>
void UpdateVisibilityOf(WorldObject* target);
void UpdateTriggerVisibility();
+ void UpdatePhasing();
+
template<class T>
void UpdateVisibilityOf(T* target, UpdateData& data, std::set<Unit*>& visibleNow);
@@ -2885,8 +2883,6 @@ class Player : public Unit, public GridObject<Player>
uint32 _activeCheats;
uint32 _maxPersonalArenaRate;
-
- PhaseMgr phaseMgr;
};
void AddItemsSetItem(Player*player, Item* item);
diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp
index 5f0ae6ecdea..05b7c25ecde 100644
--- a/src/server/game/Entities/Transport/Transport.cpp
+++ b/src/server/game/Entities/Transport/Transport.cpp
@@ -388,8 +388,15 @@ TempSummon* Transport::SummonPassenger(uint32 entry, Position const& pos, TempSu
}
uint32 phase = PHASEMASK_NORMAL;
+ std::set<uint32> phases;
if (summoner)
+ {
phase = summoner->GetPhaseMask();
+ phases = summoner->GetPhases();
+ }
+
+ if (phases.empty())
+ phases = GetPhases(); // If there was no summoner, try to use the transport phases
TempSummon* summon = NULL;
switch (mask)
@@ -421,6 +428,9 @@ TempSummon* Transport::SummonPassenger(uint32 entry, Position const& pos, TempSu
return NULL;
}
+ for (auto itr : phases)
+ summon->SetInPhase(itr, false, true);
+
summon->SetUInt32Value(UNIT_CREATED_BY_SPELL, spellId);
summon->SetTransport(this);
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 038db352edd..29c32b7e36c 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -435,7 +435,7 @@ float Unit::GetMeleeReach() const
bool Unit::IsWithinCombatRange(const Unit* obj, float dist2compare) const
{
- if (!obj || !IsInMap(obj) || !InSamePhase(obj))
+ if (!obj || !IsInMap(obj) || !IsInPhase(obj))
return false;
float dx = GetPositionX() - obj->GetPositionX();
@@ -451,7 +451,7 @@ bool Unit::IsWithinCombatRange(const Unit* obj, float dist2compare) const
bool Unit::IsWithinMeleeRange(const Unit* obj, float dist) const
{
- if (!obj || !IsInMap(obj) || !InSamePhase(obj))
+ if (!obj || !IsInMap(obj) || !IsInPhase(obj))
return false;
float dx = GetPositionX() - obj->GetPositionX();
@@ -3623,7 +3623,7 @@ void Unit::RemoveAurasWithAttribute(uint32 flags)
}
}
-void Unit::RemoveNotOwnSingleTargetAuras(uint32 newPhase)
+void Unit::RemoveNotOwnSingleTargetAuras(uint32 newPhase, bool phaseid)
{
// single target auras from other casters
for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end();)
@@ -3633,12 +3633,12 @@ void Unit::RemoveNotOwnSingleTargetAuras(uint32 newPhase)
if (aura->GetCasterGUID() != GetGUID() && aura->GetSpellInfo()->IsSingleTarget())
{
- if (!newPhase)
+ if (!newPhase && !phaseid)
RemoveAura(iter);
else
{
Unit* caster = aura->GetCaster();
- if (!caster || !caster->InSamePhase(newPhase))
+ if (!caster || (newPhase && !caster->InSamePhase(newPhase)) || (!newPhase && !caster->IsInPhase(this)))
RemoveAura(iter);
else
++iter;
@@ -14526,6 +14526,56 @@ float Unit::MeleeSpellMissChance(const Unit* victim, WeaponAttackType attType, u
return missChance;
}
+void Unit::SetInPhase(uint32 id, bool update, bool apply)
+{
+ WorldObject::SetInPhase(id, update, apply);
+
+ if (!IsInWorld())
+ return;
+
+ RemoveNotOwnSingleTargetAuras(0, true);
+
+ if (GetTypeId() == TYPEID_UNIT || (!ToPlayer()->IsGameMaster() && !ToPlayer()->GetSession()->PlayerLogout()))
+ {
+ HostileRefManager& refManager = getHostileRefManager();
+ HostileReference* ref = refManager.getFirst();
+
+ while (ref)
+ {
+ if (Unit* unit = ref->GetSource()->GetOwner())
+ if (Creature* creature = unit->ToCreature())
+ refManager.setOnlineOfflineState(creature, creature->IsInPhase(this));
+
+ ref = ref->next();
+ }
+
+ // modify threat lists for new phasemask
+ if (GetTypeId() != TYPEID_PLAYER)
+ {
+ std::list<HostileReference*> threatList = getThreatManager().getThreatList();
+ std::list<HostileReference*> offlineThreatList = getThreatManager().getOfflineThreatList();
+
+ // merge expects sorted lists
+ threatList.sort();
+ offlineThreatList.sort();
+ threatList.merge(offlineThreatList);
+
+ for (std::list<HostileReference*>::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr)
+ if (Unit* unit = (*itr)->getTarget())
+ unit->getHostileRefManager().setOnlineOfflineState(ToCreature(), unit->IsInPhase(this));
+ }
+ }
+
+ for (ControlList::const_iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr)
+ if ((*itr)->GetTypeId() == TYPEID_UNIT)
+ (*itr)->SetInPhase(id, true, apply);
+
+ for (uint8 i = 0; i < MAX_SUMMON_SLOT; ++i)
+ if (m_SummonSlot[i])
+ if (Creature* summon = GetMap()->GetCreature(m_SummonSlot[i]))
+ summon->SetInPhase(id, true, apply);
+}
+
void Unit::SetPhaseMask(uint32 newPhaseMask, bool update)
{
if (newPhaseMask == GetPhaseMask())
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index 21c55ffe700..9c03809b428 100644
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -1762,7 +1762,7 @@ class Unit : public WorldObject
void RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit* stealer);
void RemoveAurasDueToItemSpell(uint32 spellId, uint64 castItemGuid);
void RemoveAurasByType(AuraType auraType, uint64 casterGUID = 0, Aura* except = NULL, bool negative = true, bool positive = true);
- void RemoveNotOwnSingleTargetAuras(uint32 newPhase = 0x0);
+ void RemoveNotOwnSingleTargetAuras(uint32 newPhase = 0x0, bool phaseid = false);
void RemoveAurasWithInterruptFlags(uint32 flag, uint32 except = 0);
void RemoveAurasWithAttribute(uint32 flags);
void RemoveAurasWithFamily(SpellFamilyNames family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, uint64 casterGUID);
@@ -1929,6 +1929,7 @@ class Unit : public WorldObject
// common function for visibility checks for player/creatures with detection code
void SetPhaseMask(uint32 newPhaseMask, bool update);// overwrite WorldObject::SetPhaseMask
+ void SetInPhase(uint32 id, bool update, bool apply);
void UpdateObjectVisibility(bool forced = true);
SpellImmuneList m_spellImmune[MAX_SPELL_IMMUNITY];
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index 454d79a0ee1..ea2945d9cce 100644
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -1627,8 +1627,8 @@ void ObjectMgr::LoadCreatures()
// 0 1 2 3 4 5 6 7 8 9 10
QueryResult result = WorldDatabase.Query("SELECT creature.guid, id, map, modelid, equipment_id, position_x, position_y, position_z, orientation, spawntimesecs, spawndist, "
- // 11 12 13 14 15 16 17 18 19 20 21
- "currentwaypoint, curhealth, curmana, MovementType, spawnMask, phaseMask, eventEntry, pool_entry, creature.npcflag, creature.unit_flags, creature.dynamicflags "
+ // 11 12 13 14 15 16 17 18 19 20 21 22 23
+ "currentwaypoint, curhealth, curmana, MovementType, spawnMask, phaseMask, eventEntry, pool_entry, creature.npcflag, creature.unit_flags, creature.dynamicflags, creature.phaseid, creature.phasegroup "
"FROM creature "
"LEFT OUTER JOIN game_event_creature ON creature.guid = game_event_creature.guid "
"LEFT OUTER JOIN pool_creature ON creature.guid = pool_creature.guid");
@@ -1685,6 +1685,8 @@ void ObjectMgr::LoadCreatures()
data.npcflag = fields[19].GetUInt32();
data.unit_flags = fields[20].GetUInt32();
data.dynamicflags = fields[21].GetUInt32();
+ data.phaseid = fields[22].GetUInt32();
+ data.phaseGroup = fields[23].GetUInt32();
MapEntry const* mapEntry = sMapStore.LookupEntry(data.mapid);
if (!mapEntry)
@@ -1754,6 +1756,12 @@ void ObjectMgr::LoadCreatures()
data.phaseMask = 1;
}
+ if (data.phaseGroup && data.phaseid)
+ {
+ TC_LOG_ERROR("sql.sql", "Table `creature` have creature (GUID: %u Entry: %u) with both `phaseid` and `phasegroup` set, `phasegroup` set to 0", guid, data.id);
+ data.phaseGroup = 0;
+ }
+
// Add to grid if not managed by the game event or pool system
if (gameEvent == 0 && PoolId == 0)
AddCreatureToGrid(guid, &data);
@@ -1937,8 +1945,8 @@ void ObjectMgr::LoadGameobjects()
// 0 1 2 3 4 5 6
QueryResult result = WorldDatabase.Query("SELECT gameobject.guid, id, map, position_x, position_y, position_z, orientation, "
- // 7 8 9 10 11 12 13 14 15 16 17
- "rotation0, rotation1, rotation2, rotation3, spawntimesecs, animprogress, state, spawnMask, phaseMask, eventEntry, pool_entry "
+ // 7 8 9 10 11 12 13 14 15 16 17 18 19
+ "rotation0, rotation1, rotation2, rotation3, spawntimesecs, animprogress, state, spawnMask, phaseMask, eventEntry, pool_entry, phaseid, phasegroup "
"FROM gameobject LEFT OUTER JOIN game_event_gameobject ON gameobject.guid = game_event_gameobject.guid "
"LEFT OUTER JOIN pool_gameobject ON gameobject.guid = pool_gameobject.guid");
@@ -2035,6 +2043,14 @@ void ObjectMgr::LoadGameobjects()
data.phaseMask = fields[15].GetUInt32();
int16 gameEvent = fields[16].GetInt8();
uint32 PoolId = fields[17].GetUInt32();
+ data.phaseid = fields[18].GetUInt32();
+ data.phaseGroup = fields[19].GetUInt32();
+
+ if (data.phaseGroup && data.phaseid)
+ {
+ TC_LOG_ERROR("sql.sql", "Table `gameobject` have gameobject (GUID: %u Entry: %u) with both `phaseid` and `phasegroup` set, `phasegroup` set to 0", guid, data.id);
+ data.phaseGroup = 0;
+ }
if (data.rotation2 < -1.0f || data.rotation2 > 1.0f)
{
@@ -9189,18 +9205,18 @@ void ObjectMgr::LoadPhaseDefinitions()
TC_LOG_INFO("server.loading", ">> Loaded %u phasing definitions in %u ms.", count, GetMSTimeDiffToNow(oldMSTime));
}
-void ObjectMgr::LoadSpellPhaseInfo()
+void ObjectMgr::LoadPhaseInfo()
{
- _SpellPhaseStore.clear();
+ _PhaseInfoStore.clear();
uint32 oldMSTime = getMSTime();
- // 0 1 2
- QueryResult result = WorldDatabase.Query("SELECT id, phasemask, terrainswapmap FROM `spell_phase`");
+ // 0 1 2
+ QueryResult result = WorldDatabase.Query("SELECT id, worldmapareaswap, terrainswapmap FROM `phase_info`");
if (!result)
{
- TC_LOG_INFO("server.loading", ">> Loaded 0 spell dbc infos. DB table `spell_phase` is empty.");
+ TC_LOG_INFO("server.loading", ">> Loaded 0 phase infos. DB table `phase_info` is empty.");
return;
}
@@ -9209,31 +9225,25 @@ void ObjectMgr::LoadSpellPhaseInfo()
{
Field* fields = result->Fetch();
- SpellPhaseInfo spellPhaseInfo;
- spellPhaseInfo.spellId = fields[0].GetUInt32();
-
- SpellInfo const* spell = sSpellMgr->GetSpellInfo(spellPhaseInfo.spellId);
- if (!spell)
- {
- TC_LOG_ERROR("sql.sql", "Spell %u defined in `spell_phase` does not exists, skipped.", spellPhaseInfo.spellId);
- continue;
- }
+ PhaseInfo phaseInfo;
+ phaseInfo.phaseId = fields[0].GetUInt32();
- if (!spell->HasAura(SPELL_AURA_PHASE))
+ PhaseEntry const* phase = sPhaseStore.LookupEntry(phaseInfo.phaseId);
+ if (!phase)
{
- TC_LOG_ERROR("sql.sql", "Spell %u defined in `spell_phase` does not have aura effect type SPELL_AURA_PHASE, useless value.", spellPhaseInfo.spellId);
+ TC_LOG_ERROR("sql.sql", "Phase %u defined in `phase_info` does not exists, skipped.", phaseInfo.phaseId);
continue;
}
- spellPhaseInfo.phasemask = fields[1].GetUInt32();
- spellPhaseInfo.terrainswapmap = fields[2].GetUInt32();
+ phaseInfo.worldMapAreaSwap = fields[1].GetUInt32();
+ phaseInfo.terrainSwapMap = fields[2].GetUInt32();
- _SpellPhaseStore[spellPhaseInfo.spellId] = spellPhaseInfo;
+ _PhaseInfoStore[phaseInfo.phaseId] = phaseInfo;
++count;
}
while (result->NextRow());
- TC_LOG_INFO("server.loading", ">> Loaded %u spell dbc infos in %u ms.", count, GetMSTimeDiffToNow(oldMSTime));
+ TC_LOG_INFO("server.loading", ">> Loaded %u phase infos in %u ms.", count, GetMSTimeDiffToNow(oldMSTime));
}
GameObjectTemplate const* ObjectMgr::GetGameObjectTemplate(uint32 entry)
diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h
index 9008e7415da..467a56780fb 100644
--- a/src/server/game/Globals/ObjectMgr.h
+++ b/src/server/game/Globals/ObjectMgr.h
@@ -42,11 +42,9 @@
#include <limits>
#include "ConditionMgr.h"
#include <functional>
-#include "PhaseMgr.h"
#include "DB2Stores.h"
class Item;
-class PhaseMgr;
struct AccessRequirement;
struct PlayerInfo;
struct PlayerLevelInfo;
@@ -132,6 +130,36 @@ typedef std::map<uint32, PageText> PageTextContainer;
// Benchmarked: Faster than std::map (insert/find)
typedef std::unordered_map<uint16, InstanceTemplate> InstanceTemplateContainer;
+// Phasing (visibility)
+enum PhasingFlags
+{
+ PHASE_FLAG_OVERWRITE_EXISTING = 0x01, // don't stack with existing phases, overwrites existing phases
+ PHASE_FLAG_NO_MORE_PHASES = 0x02, // stop calculating phases after this phase was applied (no more phases will be applied)
+ PHASE_FLAG_NEGATE_PHASE = 0x04 // negate instead to add the phasemask
+};
+
+struct PhaseInfo
+{
+ uint32 phaseId;
+ uint32 worldMapAreaSwap;
+ uint32 terrainSwapMap;
+};
+
+typedef std::unordered_map<uint32, PhaseInfo> PhaseInfoContainer;
+
+struct PhaseDefinition
+{
+ uint32 zoneId;
+ uint32 entry;
+ uint32 phasemask;
+ uint32 phaseId;
+ uint32 terrainswapmap;
+ uint8 flags;
+};
+
+typedef std::list<PhaseDefinition> PhaseDefinitionContainer;
+typedef std::unordered_map<uint32 /*zoneId*/, PhaseDefinitionContainer> PhaseDefinitionStore;
+
struct GameTele
{
float position_x;
@@ -1018,10 +1046,7 @@ class ObjectMgr
void AddSpellToTrainer(uint32 entry, uint32 spell, uint32 spellCost, uint32 reqSkill, uint32 reqSkillValue, uint32 reqLevel);
void LoadPhaseDefinitions();
- void LoadSpellPhaseInfo();
-
- PhaseDefinitionStore const* GetPhaseDefinitionStore() { return &_PhaseDefinitionStore; }
- SpellPhaseStore const* GetSpellPhaseStore() { return &_SpellPhaseStore; }
+ void LoadPhaseInfo();
std::string GeneratePetName(uint32 entry);
uint32 GetBaseXP(uint8 level);
@@ -1277,6 +1302,8 @@ class ObjectMgr
return _gossipMenuItemsStore.equal_range(uiMenuId);
}
+ PhaseInfo const* GetPhaseInfo(uint32 phase) { return _PhaseInfoStore.find(phase) != _PhaseInfoStore.end() ? &_PhaseInfoStore[phase] : nullptr; }
+
// for wintergrasp only
GraveYardContainer GraveYardStore;
@@ -1389,7 +1416,7 @@ class ObjectMgr
InstanceTemplateContainer _instanceTemplateStore;
PhaseDefinitionStore _PhaseDefinitionStore;
- SpellPhaseStore _SpellPhaseStore;
+ PhaseInfoContainer _PhaseInfoStore;
private:
void LoadScripts(ScriptsType type);
diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.cpp b/src/server/game/Grids/Notifiers/GridNotifiers.cpp
index 5cf1dc4a8ef..76f81a15e50 100644
--- a/src/server/game/Grids/Notifiers/GridNotifiers.cpp
+++ b/src/server/game/Grids/Notifiers/GridNotifiers.cpp
@@ -258,7 +258,7 @@ void MessageDistDeliverer::Visit(PlayerMapType &m)
for (PlayerMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
{
Player* target = iter->GetSource();
- if (!target->InSamePhase(i_phaseMask))
+ if (!target->IsInPhase(i_source))
continue;
if (target->GetExactDist2dSq(i_source) > i_distSq)
@@ -283,7 +283,7 @@ void MessageDistDeliverer::Visit(CreatureMapType &m)
for (CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
{
Creature* target = iter->GetSource();
- if (!target->InSamePhase(i_phaseMask))
+ if (!target->IsInPhase(i_source))
continue;
if (target->GetExactDist2dSq(i_source) > i_distSq)
@@ -305,7 +305,7 @@ void MessageDistDeliverer::Visit(DynamicObjectMapType &m)
for (DynamicObjectMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
{
DynamicObject* target = iter->GetSource();
- if (!target->InSamePhase(i_phaseMask))
+ if (!target->IsInPhase(i_source))
continue;
if (target->GetExactDist2dSq(i_source) > i_distSq)
diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.h b/src/server/game/Grids/Notifiers/GridNotifiers.h
index e229c782f49..e82533b1cb2 100644
--- a/src/server/game/Grids/Notifiers/GridNotifiers.h
+++ b/src/server/game/Grids/Notifiers/GridNotifiers.h
@@ -126,12 +126,11 @@ namespace Trinity
{
WorldObject* i_source;
WorldPacket* i_message;
- uint32 i_phaseMask;
float i_distSq;
uint32 team;
Player const* skipped_receiver;
MessageDistDeliverer(WorldObject* src, WorldPacket* msg, float dist, bool own_team_only = false, Player const* skipped = NULL)
- : i_source(src), i_message(msg), i_phaseMask(src->GetPhaseMask()), i_distSq(dist * dist)
+ : i_source(src), i_message(msg), i_distSq(dist * dist)
, team(0)
, skipped_receiver(skipped)
{
@@ -176,12 +175,12 @@ namespace Trinity
struct WorldObjectSearcher
{
uint32 i_mapTypeMask;
- uint32 i_phaseMask;
- WorldObject* &i_object;
+ WorldObject*& i_object;
+ WorldObject const* _searcher;
Check &i_check;
WorldObjectSearcher(WorldObject const* searcher, WorldObject* & result, Check& check, uint32 mapTypeMask = GRID_MAP_TYPE_MASK_ALL)
- : i_mapTypeMask(mapTypeMask), i_phaseMask(searcher->GetPhaseMask()), i_object(result), i_check(check) { }
+ : i_mapTypeMask(mapTypeMask), _searcher(searcher), i_object(result), i_check(check) { }
void Visit(GameObjectMapType &m);
void Visit(PlayerMapType &m);
@@ -197,12 +196,12 @@ namespace Trinity
struct WorldObjectLastSearcher
{
uint32 i_mapTypeMask;
- uint32 i_phaseMask;
WorldObject* &i_object;
+ WorldObject const* _searcher;
Check &i_check;
WorldObjectLastSearcher(WorldObject const* searcher, WorldObject* & result, Check& check, uint32 mapTypeMask = GRID_MAP_TYPE_MASK_ALL)
- : i_mapTypeMask(mapTypeMask), i_phaseMask(searcher->GetPhaseMask()), i_object(result), i_check(check) { }
+ : i_mapTypeMask(mapTypeMask), _searcher(searcher), i_object(result), i_check(check) { }
void Visit(GameObjectMapType &m);
void Visit(PlayerMapType &m);
@@ -218,12 +217,12 @@ namespace Trinity
struct WorldObjectListSearcher
{
uint32 i_mapTypeMask;
- uint32 i_phaseMask;
+ WorldObject const* _searcher;
std::list<WorldObject*> &i_objects;
Check& i_check;
WorldObjectListSearcher(WorldObject const* searcher, std::list<WorldObject*> &objects, Check & check, uint32 mapTypeMask = GRID_MAP_TYPE_MASK_ALL)
- : i_mapTypeMask(mapTypeMask), i_phaseMask(searcher->GetPhaseMask()), i_objects(objects), i_check(check) { }
+ : i_mapTypeMask(mapTypeMask), _searcher(searcher), i_objects(objects), i_check(check) { }
void Visit(PlayerMapType &m);
void Visit(CreatureMapType &m);
@@ -239,18 +238,18 @@ namespace Trinity
struct WorldObjectWorker
{
uint32 i_mapTypeMask;
- uint32 i_phaseMask;
+ WorldObject const* _searcher;
Do const& i_do;
WorldObjectWorker(WorldObject const* searcher, Do const& _do, uint32 mapTypeMask = GRID_MAP_TYPE_MASK_ALL)
- : i_mapTypeMask(mapTypeMask), i_phaseMask(searcher->GetPhaseMask()), i_do(_do) { }
+ : i_mapTypeMask(mapTypeMask), _searcher(searcher), i_do(_do) { }
void Visit(GameObjectMapType &m)
{
if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_GAMEOBJECT))
return;
for (GameObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
- if (itr->GetSource()->InSamePhase(i_phaseMask))
+ if (itr->GetSource()->IsInPhase(_searcher))
i_do(itr->GetSource());
}
@@ -259,7 +258,7 @@ namespace Trinity
if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_PLAYER))
return;
for (PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
- if (itr->GetSource()->InSamePhase(i_phaseMask))
+ if (itr->GetSource()->IsInPhase(_searcher))
i_do(itr->GetSource());
}
void Visit(CreatureMapType &m)
@@ -267,7 +266,7 @@ namespace Trinity
if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_CREATURE))
return;
for (CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
- if (itr->GetSource()->InSamePhase(i_phaseMask))
+ if (itr->GetSource()->IsInPhase(_searcher))
i_do(itr->GetSource());
}
@@ -276,7 +275,7 @@ namespace Trinity
if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_CORPSE))
return;
for (CorpseMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
- if (itr->GetSource()->InSamePhase(i_phaseMask))
+ if (itr->GetSource()->IsInPhase(_searcher))
i_do(itr->GetSource());
}
@@ -285,7 +284,7 @@ namespace Trinity
if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_DYNAMICOBJECT))
return;
for (DynamicObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
- if (itr->GetSource()->InSamePhase(i_phaseMask))
+ if (itr->GetSource()->IsInPhase(_searcher))
i_do(itr->GetSource());
}
@@ -294,7 +293,7 @@ namespace Trinity
if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_AREATRIGGER))
return;
for (AreaTriggerMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
- if (itr->GetSource()->InSamePhase(i_phaseMask))
+ if (itr->GetSource()->IsInPhase(_searcher))
i_do(itr->GetSource());
}
@@ -306,12 +305,12 @@ namespace Trinity
template<class Check>
struct GameObjectSearcher
{
- uint32 i_phaseMask;
+ WorldObject const* _searcher;
GameObject* &i_object;
Check &i_check;
GameObjectSearcher(WorldObject const* searcher, GameObject* & result, Check& check)
- : i_phaseMask(searcher->GetPhaseMask()), i_object(result), i_check(check) { }
+ : _searcher(searcher), i_object(result), i_check(check) { }
void Visit(GameObjectMapType &m);
@@ -322,12 +321,12 @@ namespace Trinity
template<class Check>
struct GameObjectLastSearcher
{
- uint32 i_phaseMask;
+ WorldObject const* _searcher;
GameObject* &i_object;
Check& i_check;
GameObjectLastSearcher(WorldObject const* searcher, GameObject* & result, Check& check)
- : i_phaseMask(searcher->GetPhaseMask()), i_object(result), i_check(check) { }
+ : _searcher(searcher), i_object(result), i_check(check) { }
void Visit(GameObjectMapType &m);
@@ -337,12 +336,12 @@ namespace Trinity
template<class Check>
struct GameObjectListSearcher
{
- uint32 i_phaseMask;
+ WorldObject const* _searcher;
std::list<GameObject*> &i_objects;
Check& i_check;
GameObjectListSearcher(WorldObject const* searcher, std::list<GameObject*> &objects, Check & check)
- : i_phaseMask(searcher->GetPhaseMask()), i_objects(objects), i_check(check) { }
+ : _searcher(searcher), i_objects(objects), i_check(check) { }
void Visit(GameObjectMapType &m);
@@ -353,12 +352,12 @@ namespace Trinity
struct GameObjectWorker
{
GameObjectWorker(WorldObject const* searcher, Functor& func)
- : _func(func), _phaseMask(searcher->GetPhaseMask()) { }
+ : _func(func), _searcher(searcher) { }
void Visit(GameObjectMapType& m)
{
for (GameObjectMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
- if (itr->GetSource()->InSamePhase(_phaseMask))
+ if (itr->GetSource()->IsInPhase(_searcher))
_func(itr->GetSource());
}
@@ -366,7 +365,7 @@ namespace Trinity
private:
Functor& _func;
- uint32 _phaseMask;
+ WorldObject const* _searcher;
};
// Unit searchers
@@ -375,12 +374,12 @@ namespace Trinity
template<class Check>
struct UnitSearcher
{
- uint32 i_phaseMask;
+ WorldObject const* _searcher;
Unit* &i_object;
Check & i_check;
UnitSearcher(WorldObject const* searcher, Unit* & result, Check & check)
- : i_phaseMask(searcher->GetPhaseMask()), i_object(result), i_check(check) { }
+ : _searcher(searcher), i_object(result), i_check(check) { }
void Visit(CreatureMapType &m);
void Visit(PlayerMapType &m);
@@ -392,12 +391,12 @@ namespace Trinity
template<class Check>
struct UnitLastSearcher
{
- uint32 i_phaseMask;
+ WorldObject const* _searcher;
Unit* &i_object;
Check & i_check;
UnitLastSearcher(WorldObject const* searcher, Unit* & result, Check & check)
- : i_phaseMask(searcher->GetPhaseMask()), i_object(result), i_check(check) { }
+ : _searcher(searcher), i_object(result), i_check(check) { }
void Visit(CreatureMapType &m);
void Visit(PlayerMapType &m);
@@ -409,12 +408,12 @@ namespace Trinity
template<class Check>
struct UnitListSearcher
{
- uint32 i_phaseMask;
+ WorldObject const* _searcher;
std::list<Unit*> &i_objects;
Check& i_check;
UnitListSearcher(WorldObject const* searcher, std::list<Unit*> &objects, Check & check)
- : i_phaseMask(searcher->GetPhaseMask()), i_objects(objects), i_check(check) { }
+ : _searcher(searcher), i_objects(objects), i_check(check) { }
void Visit(PlayerMapType &m);
void Visit(CreatureMapType &m);
@@ -427,12 +426,12 @@ namespace Trinity
template<class Check>
struct CreatureSearcher
{
- uint32 i_phaseMask;
+ WorldObject const* _searcher;
Creature* &i_object;
Check & i_check;
CreatureSearcher(WorldObject const* searcher, Creature* & result, Check & check)
- : i_phaseMask(searcher->GetPhaseMask()), i_object(result), i_check(check) { }
+ : _searcher(searcher), i_object(result), i_check(check) { }
void Visit(CreatureMapType &m);
@@ -443,12 +442,12 @@ namespace Trinity
template<class Check>
struct CreatureLastSearcher
{
- uint32 i_phaseMask;
+ WorldObject const* _searcher;
Creature* &i_object;
Check & i_check;
CreatureLastSearcher(WorldObject const* searcher, Creature* & result, Check & check)
- : i_phaseMask(searcher->GetPhaseMask()), i_object(result), i_check(check) { }
+ : _searcher(searcher), i_object(result), i_check(check) { }
void Visit(CreatureMapType &m);
@@ -458,12 +457,12 @@ namespace Trinity
template<class Check>
struct CreatureListSearcher
{
- uint32 i_phaseMask;
+ WorldObject const* _searcher;
std::list<Creature*> &i_objects;
Check& i_check;
CreatureListSearcher(WorldObject const* searcher, std::list<Creature*> &objects, Check & check)
- : i_phaseMask(searcher->GetPhaseMask()), i_objects(objects), i_check(check) { }
+ : _searcher(searcher), i_objects(objects), i_check(check) { }
void Visit(CreatureMapType &m);
@@ -473,16 +472,16 @@ namespace Trinity
template<class Do>
struct CreatureWorker
{
- uint32 i_phaseMask;
+ WorldObject const* _searcher;
Do& i_do;
CreatureWorker(WorldObject const* searcher, Do& _do)
- : i_phaseMask(searcher->GetPhaseMask()), i_do(_do) { }
+ : _searcher(searcher), i_do(_do) { }
void Visit(CreatureMapType &m)
{
for (CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
- if (itr->GetSource()->InSamePhase(i_phaseMask))
+ if (itr->GetSource()->IsInPhase(_searcher))
i_do(itr->GetSource());
}
@@ -494,12 +493,12 @@ namespace Trinity
template<class Check>
struct PlayerSearcher
{
- uint32 i_phaseMask;
+ WorldObject const* _searcher;
Player* &i_object;
Check & i_check;
PlayerSearcher(WorldObject const* searcher, Player* & result, Check & check)
- : i_phaseMask(searcher->GetPhaseMask()), i_object(result), i_check(check) { }
+ : _searcher(searcher), i_object(result), i_check(check) { }
void Visit(PlayerMapType &m);
@@ -509,12 +508,12 @@ namespace Trinity
template<class Check>
struct PlayerListSearcher
{
- uint32 i_phaseMask;
+ WorldObject const* _searcher;
std::list<Player*> &i_objects;
Check& i_check;
PlayerListSearcher(WorldObject const* searcher, std::list<Player*> &objects, Check & check)
- : i_phaseMask(searcher->GetPhaseMask()), i_objects(objects), i_check(check) { }
+ : _searcher(searcher), i_objects(objects), i_check(check) { }
void Visit(PlayerMapType &m);
@@ -524,11 +523,11 @@ namespace Trinity
template<class Check>
struct PlayerLastSearcher
{
- uint32 i_phaseMask;
+ WorldObject const* _searcher;
Player* &i_object;
Check& i_check;
- PlayerLastSearcher(WorldObject const* searcher, Player*& result, Check& check) : i_phaseMask(searcher->GetPhaseMask()), i_object(result), i_check(check)
+ PlayerLastSearcher(WorldObject const* searcher, Player*& result, Check& check) : _searcher(searcher), i_object(result), i_check(check)
{
}
@@ -540,16 +539,16 @@ namespace Trinity
template<class Do>
struct PlayerWorker
{
- uint32 i_phaseMask;
+ WorldObject const* _searcher;
Do& i_do;
PlayerWorker(WorldObject const* searcher, Do& _do)
- : i_phaseMask(searcher->GetPhaseMask()), i_do(_do) { }
+ : _searcher(searcher), i_do(_do) { }
void Visit(PlayerMapType &m)
{
for (PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
- if (itr->GetSource()->InSamePhase(i_phaseMask))
+ if (itr->GetSource()->IsInPhase(_searcher))
i_do(itr->GetSource());
}
@@ -569,7 +568,7 @@ namespace Trinity
void Visit(PlayerMapType &m)
{
for (PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
- if (itr->GetSource()->InSamePhase(i_searcher) && itr->GetSource()->IsWithinDist(i_searcher, i_dist))
+ if (itr->GetSource()->IsInPhase(i_searcher) && itr->GetSource()->IsWithinDist(i_searcher, i_dist))
i_do(itr->GetSource());
}
@@ -1344,7 +1343,7 @@ namespace Trinity
AllWorldObjectsInRange(const WorldObject* object, float maxRange) : m_pObject(object), m_fRange(maxRange) { }
bool operator() (WorldObject* go)
{
- return m_pObject->IsWithinDist(go, m_fRange, false) && m_pObject->InSamePhase(go);
+ return m_pObject->IsWithinDist(go, m_fRange, false) && m_pObject->IsInPhase(go);
}
private:
const WorldObject* m_pObject;
diff --git a/src/server/game/Grids/Notifiers/GridNotifiersImpl.h b/src/server/game/Grids/Notifiers/GridNotifiersImpl.h
index febc42af25a..e73f18abf90 100644
--- a/src/server/game/Grids/Notifiers/GridNotifiersImpl.h
+++ b/src/server/game/Grids/Notifiers/GridNotifiersImpl.h
@@ -54,7 +54,7 @@ void Trinity::WorldObjectSearcher<Check>::Visit(GameObjectMapType &m)
for (GameObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
{
- if (!itr->GetSource()->InSamePhase(i_phaseMask))
+ if (!itr->GetSource()->IsInPhase(_searcher))
continue;
if (i_check(itr->GetSource()))
@@ -77,7 +77,7 @@ void Trinity::WorldObjectSearcher<Check>::Visit(PlayerMapType &m)
for (PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
{
- if (!itr->GetSource()->InSamePhase(i_phaseMask))
+ if (!itr->GetSource()->IsInPhase(_searcher))
continue;
if (i_check(itr->GetSource()))
@@ -100,7 +100,7 @@ void Trinity::WorldObjectSearcher<Check>::Visit(CreatureMapType &m)
for (CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
{
- if (!itr->GetSource()->InSamePhase(i_phaseMask))
+ if (!itr->GetSource()->IsInPhase(_searcher))
continue;
if (i_check(itr->GetSource()))
@@ -123,7 +123,7 @@ void Trinity::WorldObjectSearcher<Check>::Visit(CorpseMapType &m)
for (CorpseMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
{
- if (!itr->GetSource()->InSamePhase(i_phaseMask))
+ if (!itr->GetSource()->IsInPhase(_searcher))
continue;
if (i_check(itr->GetSource()))
@@ -146,7 +146,7 @@ void Trinity::WorldObjectSearcher<Check>::Visit(DynamicObjectMapType &m)
for (DynamicObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
{
- if (!itr->GetSource()->InSamePhase(i_phaseMask))
+ if (!itr->GetSource()->IsInPhase(_searcher))
continue;
if (i_check(itr->GetSource()))
@@ -169,7 +169,7 @@ void Trinity::WorldObjectSearcher<Check>::Visit(AreaTriggerMapType &m)
for (AreaTriggerMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
{
- if (!itr->GetSource()->InSamePhase(i_phaseMask))
+ if (!itr->GetSource()->IsInPhase(_searcher))
continue;
if (i_check(itr->GetSource()))
@@ -188,7 +188,7 @@ void Trinity::WorldObjectLastSearcher<Check>::Visit(GameObjectMapType &m)
for (GameObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
{
- if (!itr->GetSource()->InSamePhase(i_phaseMask))
+ if (!itr->GetSource()->IsInPhase(_searcher))
continue;
if (i_check(itr->GetSource()))
@@ -204,7 +204,7 @@ void Trinity::WorldObjectLastSearcher<Check>::Visit(PlayerMapType &m)
for (PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
{
- if (!itr->GetSource()->InSamePhase(i_phaseMask))
+ if (!itr->GetSource()->IsInPhase(_searcher))
continue;
if (i_check(itr->GetSource()))
@@ -220,7 +220,7 @@ void Trinity::WorldObjectLastSearcher<Check>::Visit(CreatureMapType &m)
for (CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
{
- if (!itr->GetSource()->InSamePhase(i_phaseMask))
+ if (!itr->GetSource()->IsInPhase(_searcher))
continue;
if (i_check(itr->GetSource()))
@@ -236,7 +236,7 @@ void Trinity::WorldObjectLastSearcher<Check>::Visit(CorpseMapType &m)
for (CorpseMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
{
- if (!itr->GetSource()->InSamePhase(i_phaseMask))
+ if (!itr->GetSource()->IsInPhase(_searcher))
continue;
if (i_check(itr->GetSource()))
@@ -252,7 +252,7 @@ void Trinity::WorldObjectLastSearcher<Check>::Visit(DynamicObjectMapType &m)
for (DynamicObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
{
- if (!itr->GetSource()->InSamePhase(i_phaseMask))
+ if (!itr->GetSource()->IsInPhase(_searcher))
continue;
if (i_check(itr->GetSource()))
@@ -268,7 +268,7 @@ void Trinity::WorldObjectLastSearcher<Check>::Visit(AreaTriggerMapType &m)
for (AreaTriggerMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
{
- if (!itr->GetSource()->InSamePhase(i_phaseMask))
+ if (!itr->GetSource()->IsInPhase(_searcher))
continue;
if (i_check(itr->GetSource()))
@@ -353,7 +353,7 @@ void Trinity::GameObjectSearcher<Check>::Visit(GameObjectMapType &m)
for (GameObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
{
- if (!itr->GetSource()->InSamePhase(i_phaseMask))
+ if (!itr->GetSource()->IsInPhase(_searcher))
continue;
if (i_check(itr->GetSource()))
@@ -369,7 +369,7 @@ void Trinity::GameObjectLastSearcher<Check>::Visit(GameObjectMapType &m)
{
for (GameObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
{
- if (!itr->GetSource()->InSamePhase(i_phaseMask))
+ if (!itr->GetSource()->IsInPhase(_searcher))
continue;
if (i_check(itr->GetSource()))
@@ -381,7 +381,7 @@ template<class Check>
void Trinity::GameObjectListSearcher<Check>::Visit(GameObjectMapType &m)
{
for (GameObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
- if (itr->GetSource()->InSamePhase(i_phaseMask))
+ if (itr->GetSource()->IsInPhase(_searcher))
if (i_check(itr->GetSource()))
i_objects.push_back(itr->GetSource());
}
@@ -397,7 +397,7 @@ void Trinity::UnitSearcher<Check>::Visit(CreatureMapType &m)
for (CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
{
- if (!itr->GetSource()->InSamePhase(i_phaseMask))
+ if (!itr->GetSource()->IsInPhase(_searcher))
continue;
if (i_check(itr->GetSource()))
@@ -417,7 +417,7 @@ void Trinity::UnitSearcher<Check>::Visit(PlayerMapType &m)
for (PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
{
- if (!itr->GetSource()->InSamePhase(i_phaseMask))
+ if (!itr->GetSource()->IsInPhase(_searcher))
continue;
if (i_check(itr->GetSource()))
@@ -433,7 +433,7 @@ void Trinity::UnitLastSearcher<Check>::Visit(CreatureMapType &m)
{
for (CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
{
- if (!itr->GetSource()->InSamePhase(i_phaseMask))
+ if (!itr->GetSource()->IsInPhase(_searcher))
continue;
if (i_check(itr->GetSource()))
@@ -446,7 +446,7 @@ void Trinity::UnitLastSearcher<Check>::Visit(PlayerMapType &m)
{
for (PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
{
- if (!itr->GetSource()->InSamePhase(i_phaseMask))
+ if (!itr->GetSource()->IsInPhase(_searcher))
continue;
if (i_check(itr->GetSource()))
@@ -458,7 +458,7 @@ template<class Check>
void Trinity::UnitListSearcher<Check>::Visit(PlayerMapType &m)
{
for (PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
- if (itr->GetSource()->InSamePhase(i_phaseMask))
+ if (itr->GetSource()->IsInPhase(_searcher))
if (i_check(itr->GetSource()))
i_objects.push_back(itr->GetSource());
}
@@ -467,7 +467,7 @@ template<class Check>
void Trinity::UnitListSearcher<Check>::Visit(CreatureMapType &m)
{
for (CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
- if (itr->GetSource()->InSamePhase(i_phaseMask))
+ if (itr->GetSource()->IsInPhase(_searcher))
if (i_check(itr->GetSource()))
i_objects.push_back(itr->GetSource());
}
@@ -483,7 +483,7 @@ void Trinity::CreatureSearcher<Check>::Visit(CreatureMapType &m)
for (CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
{
- if (!itr->GetSource()->InSamePhase(i_phaseMask))
+ if (!itr->GetSource()->IsInPhase(_searcher))
continue;
if (i_check(itr->GetSource()))
@@ -499,7 +499,7 @@ void Trinity::CreatureLastSearcher<Check>::Visit(CreatureMapType &m)
{
for (CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
{
- if (!itr->GetSource()->InSamePhase(i_phaseMask))
+ if (!itr->GetSource()->IsInPhase(_searcher))
continue;
if (i_check(itr->GetSource()))
@@ -511,7 +511,7 @@ template<class Check>
void Trinity::CreatureListSearcher<Check>::Visit(CreatureMapType &m)
{
for (CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
- if (itr->GetSource()->InSamePhase(i_phaseMask))
+ if (itr->GetSource()->IsInPhase(_searcher))
if (i_check(itr->GetSource()))
i_objects.push_back(itr->GetSource());
}
@@ -520,7 +520,7 @@ template<class Check>
void Trinity::PlayerListSearcher<Check>::Visit(PlayerMapType &m)
{
for (PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
- if (itr->GetSource()->InSamePhase(i_phaseMask))
+ if (itr->GetSource()->IsInPhase(_searcher))
if (i_check(itr->GetSource()))
i_objects.push_back(itr->GetSource());
}
@@ -534,7 +534,7 @@ void Trinity::PlayerSearcher<Check>::Visit(PlayerMapType &m)
for (PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
{
- if (!itr->GetSource()->InSamePhase(i_phaseMask))
+ if (!itr->GetSource()->IsInPhase(_searcher))
continue;
if (i_check(itr->GetSource()))
@@ -550,7 +550,7 @@ void Trinity::PlayerLastSearcher<Check>::Visit(PlayerMapType& m)
{
for (PlayerMapType::iterator itr = m.begin(); itr != m.end(); ++itr)
{
- if (!itr->GetSource()->InSamePhase(i_phaseMask))
+ if (!itr->GetSource()->IsInPhase(_searcher))
continue;
if (i_check(itr->GetSource()))
diff --git a/src/server/game/Handlers/GroupHandler.cpp b/src/server/game/Handlers/GroupHandler.cpp
index dcaa2727b5e..7ef56ff94b4 100644
--- a/src/server/game/Handlers/GroupHandler.cpp
+++ b/src/server/game/Handlers/GroupHandler.cpp
@@ -32,6 +32,7 @@
#include "World.h"
#include "WorldPacket.h"
#include "WorldSession.h"
+#include "SpellAuraEffects.h"
class Aura;
@@ -946,8 +947,7 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player* player, WorldPacke
if (mask == GROUP_UPDATE_FLAG_NONE)
return;
- std::set<uint32> phases;
- player->GetPhaseMgr().GetActivePhases(phases);
+ std::set<uint32> const& phases = player->GetPhases();
if (mask & GROUP_UPDATE_FLAG_POWER_TYPE) // if update power type, update current/max power also
mask |= (GROUP_UPDATE_FLAG_CUR_POWER | GROUP_UPDATE_FLAG_MAX_POWER);
@@ -1199,8 +1199,7 @@ void WorldSession::HandleRequestPartyMemberStatsOpcode(WorldPacket& recvData)
Pet* pet = player->GetPet();
Powers powerType = player->getPowerType();
- std::set<uint32> phases;
- player->GetPhaseMgr().GetActivePhases(phases);
+ std::set<uint32> const& phases = player->GetPhases();
WorldPacket data(SMSG_PARTY_MEMBER_STATS_FULL, 4+2+2+2+1+2*6+8+1+8);
data << uint8(0); // only for SMSG_PARTY_MEMBER_STATS_FULL, probably arena/bg related
diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp
index e57c748b540..85d7b66d8ce 100644
--- a/src/server/game/Handlers/MiscHandler.cpp
+++ b/src/server/game/Handlers/MiscHandler.cpp
@@ -1750,7 +1750,7 @@ void WorldSession::HandleReadyForAccountDataTimes(WorldPacket& /*recvData*/)
SendAccountDataTimes(GLOBAL_CACHE_MASK);
}
-void WorldSession::SendSetPhaseShift(std::set<uint32> const& phaseIds, std::set<uint32> const& terrainswaps)
+void WorldSession::SendSetPhaseShift(std::set<uint32> const& phaseIds, std::set<uint32> const& terrainswaps, std::set<uint32> const& worldMapAreaSwaps)
{
ObjectGuid guid = _player->GetGUID();
@@ -1767,9 +1767,9 @@ void WorldSession::SendSetPhaseShift(std::set<uint32> const& phaseIds, std::set<
data.WriteByteSeq(guid[7]);
data.WriteByteSeq(guid[4]);
- data << uint32(0);
- //for (uint8 i = 0; i < worldMapAreaCount; ++i)
- // data << uint16(0); // WorldMapArea.dbc id (controls map display)
+ data << uint32(worldMapAreaSwaps.size());
+ for (auto mapSwap : worldMapAreaSwaps)
+ data << uint16(mapSwap); // WorldMapArea.dbc id (controls map display)
data.WriteByteSeq(guid[1]);
diff --git a/src/server/game/Instances/InstanceScript.cpp b/src/server/game/Instances/InstanceScript.cpp
index 1b6399fb6fd..a02206695a3 100644
--- a/src/server/game/Instances/InstanceScript.cpp
+++ b/src/server/game/Instances/InstanceScript.cpp
@@ -469,11 +469,9 @@ void InstanceScript::UpdateEncounterState(EncounterCreditType type, uint32 credi
void InstanceScript::UpdatePhasing()
{
- PhaseUpdateData phaseUdateData;
- phaseUdateData.AddConditionType(CONDITION_INSTANCE_INFO);
-
+ /*
Map::PlayerList const& players = instance->GetPlayers();
for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
if (Player* player = itr->GetSource())
- player->GetPhaseMgr().NotifyConditionChanged(phaseUdateData);
+ */
}
diff --git a/src/server/game/Maps/PhaseMgr.cpp b/src/server/game/Maps/PhaseMgr.cpp
deleted file mode 100644
index 13d357702ab..00000000000
--- a/src/server/game/Maps/PhaseMgr.cpp
+++ /dev/null
@@ -1,438 +0,0 @@
-/*
- * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "PhaseMgr.h"
-#include "Chat.h"
-#include "Group.h"
-#include "Language.h"
-#include "ObjectMgr.h"
-#include "Player.h"
-
-//////////////////////////////////////////////////////////////////
-// Updating
-
-PhaseMgr::PhaseMgr(Player* _player) : player(_player), phaseData(_player), _UpdateFlags(0)
-{
- _PhaseDefinitionStore = sObjectMgr->GetPhaseDefinitionStore();
- _SpellPhaseStore = sObjectMgr->GetSpellPhaseStore();
-}
-
-void PhaseMgr::Update()
-{
- if (IsUpdateInProgress())
- return;
-
- if (_UpdateFlags & PHASE_UPDATE_FLAG_CLIENTSIDE_CHANGED)
- {
- phaseData.SendPhaseshiftToPlayer();
- player->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_PHASE);
- }
-
- if (_UpdateFlags & PHASE_UPDATE_FLAG_SERVERSIDE_CHANGED)
- phaseData.SendPhaseMaskToPlayer();
-
- _UpdateFlags = 0;
-}
-
-void PhaseMgr::RemoveUpdateFlag(PhaseUpdateFlag updateFlag)
-{
- _UpdateFlags &= ~updateFlag;
-
- if (updateFlag == PHASE_UPDATE_FLAG_ZONE_UPDATE)
- {
- // Update zone changes
- if (phaseData.HasActiveDefinitions())
- {
- phaseData.ResetDefinitions();
- _UpdateFlags |= (PHASE_UPDATE_FLAG_CLIENTSIDE_CHANGED | PHASE_UPDATE_FLAG_SERVERSIDE_CHANGED);
- }
-
- if (_PhaseDefinitionStore->find(player->GetZoneId()) != _PhaseDefinitionStore->end())
- Recalculate();
- }
-
- Update();
-}
-
-/////////////////////////////////////////////////////////////////
-// Notifier
-
-void PhaseMgr::NotifyConditionChanged(PhaseUpdateData const& updateData)
-{
- if (NeedsPhaseUpdateWithData(updateData))
- {
- Recalculate();
- Update();
- }
-}
-
-//////////////////////////////////////////////////////////////////
-// Phasing Definitions
-
-void PhaseMgr::Recalculate()
-{
- if (phaseData.HasActiveDefinitions())
- {
- phaseData.ResetDefinitions();
- _UpdateFlags |= (PHASE_UPDATE_FLAG_CLIENTSIDE_CHANGED | PHASE_UPDATE_FLAG_SERVERSIDE_CHANGED);
- }
-
- PhaseDefinitionStore::const_iterator itr = _PhaseDefinitionStore->find(player->GetZoneId());
- if (itr != _PhaseDefinitionStore->end())
- {
- for (PhaseDefinitionContainer::const_iterator phase = itr->second.begin(); phase != itr->second.end(); ++phase)
- {
- if (CheckDefinition(&(*phase)))
- {
- phaseData.AddPhaseDefinition(&(*phase));
-
- if (phase->phasemask)
- _UpdateFlags |= PHASE_UPDATE_FLAG_SERVERSIDE_CHANGED;
-
- if (phase->phaseId || phase->terrainswapmap)
- _UpdateFlags |= PHASE_UPDATE_FLAG_CLIENTSIDE_CHANGED;
-
- if (phase->IsLastDefinition())
- break;
- }
- }
- }
-}
-
-inline bool PhaseMgr::CheckDefinition(PhaseDefinition const* phaseDefinition)
-{
- ConditionList const* conditions = sConditionMgr->GetConditionsForPhaseDefinition(phaseDefinition->zoneId, phaseDefinition->entry);
- if (!conditions)
- return true;
-
- ConditionSourceInfo srcInfo(player);
- return sConditionMgr->IsObjectMeetToConditions(srcInfo, *conditions);
-}
-
-bool PhaseMgr::NeedsPhaseUpdateWithData(PhaseUpdateData const& updateData) const
-{
- PhaseDefinitionStore::const_iterator itr = _PhaseDefinitionStore->find(player->GetZoneId());
- if (itr != _PhaseDefinitionStore->end())
- {
- for (PhaseDefinitionContainer::const_iterator phase = itr->second.begin(); phase != itr->second.end(); ++phase)
- {
- ConditionList const* conditionList = sConditionMgr->GetConditionsForPhaseDefinition(phase->zoneId, phase->entry);
- if (!conditionList)
- continue;
-
- for (ConditionList::const_iterator condition = conditionList->begin(); condition != conditionList->end(); ++condition)
- if (updateData.IsConditionRelated(*condition))
- return true;
- }
- }
- return false;
-}
-
-//////////////////////////////////////////////////////////////////
-// Auras
-
-void PhaseMgr::RegisterPhasingAuraEffect(AuraEffect const* auraEffect)
-{
- std::list<PhaseInfo> phases;
-
- if (auraEffect->GetAuraType() == SPELL_AURA_PHASE)
- {
- PhaseInfo phaseInfo;
-
- if (auraEffect->GetMiscValue())
- {
- _UpdateFlags |= PHASE_UPDATE_FLAG_SERVERSIDE_CHANGED;
- phaseInfo.phasemask = auraEffect->GetMiscValue();
- }
- else
- {
- SpellPhaseStore::const_iterator itr = _SpellPhaseStore->find(auraEffect->GetId());
- if (itr != _SpellPhaseStore->end())
- {
- if (itr->second.phasemask)
- {
- _UpdateFlags |= PHASE_UPDATE_FLAG_SERVERSIDE_CHANGED;
- phaseInfo.phasemask = itr->second.phasemask;
- }
-
- if (itr->second.terrainswapmap)
- phaseInfo.terrainswapmap = itr->second.terrainswapmap;
- }
- }
-
- phaseInfo.phaseId = auraEffect->GetMiscValueB();
-
- if (phaseInfo.NeedsClientSideUpdate())
- _UpdateFlags |= PHASE_UPDATE_FLAG_CLIENTSIDE_CHANGED;
-
- phases.push_back(phaseInfo);
- }
- else if (auraEffect->GetAuraType() == SPELL_AURA_PHASE_GROUP)
- {
- uint32 group = auraEffect->GetMiscValueB();
- std::set<uint32> const& groupPhases = GetPhasesForGroup(group);
- for (auto itr = groupPhases.begin(); itr != groupPhases.end(); ++itr)
- {
- PhaseInfo phaseInfo;
- phaseInfo.phaseId = auraEffect->GetMiscValueB();
- if (phaseInfo.NeedsClientSideUpdate())
- _UpdateFlags |= PHASE_UPDATE_FLAG_CLIENTSIDE_CHANGED;
- phases.push_back(phaseInfo);
- }
- }
-
- for (auto itr = phases.begin(); itr != phases.end(); ++itr)
- phaseData.AddAuraInfo(auraEffect->GetId(), *itr);
-
- Update();
-}
-
-void PhaseMgr::UnRegisterPhasingAuraEffect(AuraEffect const* auraEffect)
-{
- _UpdateFlags |= phaseData.RemoveAuraInfo(auraEffect->GetId());
-
- Update();
-}
-
-//////////////////////////////////////////////////////////////////
-// Commands
-
-void PhaseMgr::SendDebugReportToPlayer(Player* const debugger)
-{
- ChatHandler(debugger->GetSession()).PSendSysMessage(LANG_PHASING_REPORT_STATUS, player->GetName().c_str(), player->GetZoneId(), player->getLevel(), player->GetTeamId(), _UpdateFlags);
-
- PhaseDefinitionStore::const_iterator itr = _PhaseDefinitionStore->find(player->GetZoneId());
- if (itr == _PhaseDefinitionStore->end())
- ChatHandler(debugger->GetSession()).PSendSysMessage(LANG_PHASING_NO_DEFINITIONS, player->GetZoneId());
- else
- {
- for (PhaseDefinitionContainer::const_iterator phase = itr->second.begin(); phase != itr->second.end(); ++phase)
- {
- if (CheckDefinition(&(*phase)))
- ChatHandler(debugger->GetSession()).PSendSysMessage(LANG_PHASING_SUCCESS, phase->entry, phase->IsNegatingPhasemask() ? "negated Phase" : "Phase", phase->phasemask);
- else
- ChatHandler(debugger->GetSession()).PSendSysMessage(LANG_PHASING_FAILED, phase->phasemask, phase->entry, phase->zoneId);
-
- if (phase->IsLastDefinition())
- {
- ChatHandler(debugger->GetSession()).PSendSysMessage(LANG_PHASING_LAST_PHASE, phase->phasemask, phase->entry, phase->zoneId);
- break;
- }
- }
- }
-
- ChatHandler(debugger->GetSession()).PSendSysMessage(LANG_PHASING_LIST, phaseData._PhasemaskThroughDefinitions, phaseData._PhasemaskThroughAuras, phaseData._CustomPhasemask);
-
- ChatHandler(debugger->GetSession()).PSendSysMessage(LANG_PHASING_PHASEMASK, phaseData.GetPhaseMaskForSpawn(), player->GetPhaseMask());
-}
-
-void PhaseMgr::SetCustomPhase(uint32 phaseMask)
-{
- phaseData._CustomPhasemask = phaseMask;
-
- _UpdateFlags |= PHASE_UPDATE_FLAG_SERVERSIDE_CHANGED;
-
- Update();
-}
-
-//////////////////////////////////////////////////////////////////
-// Phase Data
-
-uint32 PhaseData::GetCurrentPhasemask() const
-{
- if (player->IsGameMaster())
- return uint32(PHASEMASK_ANYWHERE);
-
- if (_CustomPhasemask)
- return _CustomPhasemask;
-
- return GetPhaseMaskForSpawn();
-}
-
-inline uint32 PhaseData::GetPhaseMaskForSpawn() const
-{
- uint32 const phase = (_PhasemaskThroughDefinitions | _PhasemaskThroughAuras);
- return (phase ? phase : PHASEMASK_NORMAL);
-}
-
-void PhaseData::SendPhaseMaskToPlayer()
-{
- // Server side update
- uint32 const phasemask = GetCurrentPhasemask();
- if (player->GetPhaseMask() == phasemask)
- return;
-
- player->SetPhaseMask(phasemask, false);
-
- if (player->IsVisible())
- player->UpdateObjectVisibility();
-}
-
-void PhaseData::SendPhaseshiftToPlayer()
-{
- // Client side update
- std::set<uint32> phaseIds;
- std::set<uint32> terrainswaps;
-
- for (PhaseInfoContainer::const_iterator itr = spellPhaseInfo.begin(); itr != spellPhaseInfo.end(); ++itr)
- {
- for (auto ph = itr->second.begin(); ph != itr->second.end(); ++ph)
- {
- if (ph->terrainswapmap)
- terrainswaps.insert(ph->terrainswapmap);
-
- if (ph->phaseId)
- phaseIds.insert(ph->phaseId);
- }
- }
-
- // Phase Definitions
- for (std::list<PhaseDefinition const*>::const_iterator itr = activePhaseDefinitions.begin(); itr != activePhaseDefinitions.end(); ++itr)
- {
- if ((*itr)->phaseId)
- phaseIds.insert((*itr)->phaseId);
-
- if ((*itr)->terrainswapmap)
- terrainswaps.insert((*itr)->terrainswapmap);
- }
-
- player->GetSession()->SendSetPhaseShift(phaseIds, terrainswaps);
-}
-
-void PhaseData::GetActivePhases(std::set<uint32>& phases) const
-{
- for (PhaseInfoContainer::const_iterator itr = spellPhaseInfo.begin(); itr != spellPhaseInfo.end(); ++itr)
- for (auto phase = itr->second.begin(); phase != itr->second.end(); ++phase)
- if (phase->phaseId)
- phases.insert(phase->phaseId);
-
- // Phase Definitions
- for (std::list<PhaseDefinition const*>::const_iterator itr = activePhaseDefinitions.begin(); itr != activePhaseDefinitions.end(); ++itr)
- if ((*itr)->phaseId)
- phases.insert((*itr)->phaseId);
-}
-
-void PhaseData::AddPhaseDefinition(PhaseDefinition const* phaseDefinition)
-{
- if (phaseDefinition->IsOverwritingExistingPhases())
- {
- activePhaseDefinitions.clear();
- _PhasemaskThroughDefinitions = phaseDefinition->phasemask;
- }
- else
- {
- if (phaseDefinition->IsNegatingPhasemask())
- _PhasemaskThroughDefinitions &= ~phaseDefinition->phasemask;
- else
- _PhasemaskThroughDefinitions |= phaseDefinition->phasemask;
- }
-
- activePhaseDefinitions.push_back(phaseDefinition);
-}
-
-void PhaseData::AddAuraInfo(uint32 spellId, PhaseInfo const& phaseInfo)
-{
- if (phaseInfo.phasemask)
- _PhasemaskThroughAuras |= phaseInfo.phasemask;
-
- spellPhaseInfo[spellId].push_back(phaseInfo);
-}
-
-uint32 PhaseData::RemoveAuraInfo(uint32 spellId)
-{
- PhaseInfoContainer::const_iterator rAura = spellPhaseInfo.find(spellId);
- if (rAura != spellPhaseInfo.end())
- {
- uint32 updateflag = 0;
-
- for (auto phase = rAura->second.begin(); phase != rAura->second.end(); ++phase)
- {
- if (phase->NeedsClientSideUpdate())
- updateflag |= PHASE_UPDATE_FLAG_CLIENTSIDE_CHANGED;
-
- if (phase->NeedsServerSideUpdate())
- {
- _PhasemaskThroughAuras = 0;
- updateflag |= PHASE_UPDATE_FLAG_SERVERSIDE_CHANGED;
- }
- }
-
- if (updateflag & PHASE_UPDATE_FLAG_SERVERSIDE_CHANGED)
- {
- spellPhaseInfo.erase(rAura);
-
- for (PhaseInfoContainer::const_iterator itr = spellPhaseInfo.begin(); itr != spellPhaseInfo.end(); ++itr)
- for (auto ph = itr->second.begin(); ph != itr->second.end(); ++ph)
- _PhasemaskThroughAuras |= ph->phasemask;
- }
-
- return updateflag;
- }
-
- return 0;
-}
-
-//////////////////////////////////////////////////////////////////
-// Phase Update Data
-
-void PhaseUpdateData::AddQuestUpdate(uint32 questId)
-{
- AddConditionType(CONDITION_QUESTREWARDED);
- AddConditionType(CONDITION_QUESTTAKEN);
- AddConditionType(CONDITION_QUEST_COMPLETE);
- AddConditionType(CONDITION_QUEST_NONE);
-
- _questId = questId;
-}
-
-bool PhaseUpdateData::IsConditionRelated(Condition const* condition) const
-{
- switch (condition->ConditionType)
- {
- case CONDITION_QUESTREWARDED:
- case CONDITION_QUESTTAKEN:
- case CONDITION_QUEST_COMPLETE:
- case CONDITION_QUEST_NONE:
- return condition->ConditionValue1 == _questId && ((1 << condition->ConditionType) & _conditionTypeFlags);
- default:
- return (1 << condition->ConditionType) & _conditionTypeFlags;
- }
-}
-
-bool PhaseMgr::IsConditionTypeSupported(ConditionTypes conditionType)
-{
- switch (conditionType)
- {
- case CONDITION_QUESTREWARDED:
- case CONDITION_QUESTTAKEN:
- case CONDITION_QUEST_COMPLETE:
- case CONDITION_QUEST_NONE:
- case CONDITION_TEAM:
- case CONDITION_CLASS:
- case CONDITION_RACE:
- case CONDITION_INSTANCE_INFO:
- case CONDITION_LEVEL:
- return true;
- default:
- return false;
- }
-}
-
-void PhaseMgr::GetActivePhases(std::set<uint32>& phases) const
-{
- phaseData.GetActivePhases(phases);
-}
diff --git a/src/server/game/Maps/PhaseMgr.h b/src/server/game/Maps/PhaseMgr.h
deleted file mode 100644
index f5226e6468c..00000000000
--- a/src/server/game/Maps/PhaseMgr.h
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef TRINITY_PHASEMGR_H
-#define TRINITY_PHASEMGR_H
-
-#include "SharedDefines.h"
-#include "SpellAuras.h"
-#include "SpellAuraEffects.h"
-#include "ConditionMgr.h"
-
-class ObjectMgr;
-class Player;
-
-// Phasing (visibility)
-enum PhasingFlags
-{
- PHASE_FLAG_OVERWRITE_EXISTING = 0x01, // don't stack with existing phases, overwrites existing phases
- PHASE_FLAG_NO_MORE_PHASES = 0x02, // stop calculating phases after this phase was applied (no more phases will be applied)
- PHASE_FLAG_NEGATE_PHASE = 0x04 // negate instead to add the phasemask
-};
-
-enum PhaseUpdateFlag
-{
- PHASE_UPDATE_FLAG_ZONE_UPDATE = 0x01,
- PHASE_UPDATE_FLAG_AREA_UPDATE = 0x02,
-
- // Internal flags
- PHASE_UPDATE_FLAG_CLIENTSIDE_CHANGED = 0x08,
- PHASE_UPDATE_FLAG_SERVERSIDE_CHANGED = 0x10,
-};
-
-struct PhaseDefinition
-{
- uint32 zoneId;
- uint32 entry;
- uint32 phasemask;
- uint32 phaseId;
- uint32 terrainswapmap;
- uint8 flags;
-
- bool IsOverwritingExistingPhases() const { return flags & PHASE_FLAG_OVERWRITE_EXISTING; }
- bool IsLastDefinition() const { return flags & PHASE_FLAG_NO_MORE_PHASES; }
- bool IsNegatingPhasemask() const { return flags & PHASE_FLAG_NEGATE_PHASE; }
-};
-
-typedef std::list<PhaseDefinition> PhaseDefinitionContainer;
-typedef std::unordered_map<uint32 /*zoneId*/, PhaseDefinitionContainer> PhaseDefinitionStore;
-
-struct SpellPhaseInfo
-{
- uint32 spellId;
- uint32 phasemask;
- uint32 terrainswapmap;
-};
-
-typedef std::unordered_map<uint32 /*spellId*/, SpellPhaseInfo> SpellPhaseStore;
-
-struct PhaseInfo
-{
- PhaseInfo() : phasemask(0), terrainswapmap(0), phaseId(0) {}
-
- uint32 phasemask;
- uint32 terrainswapmap;
- uint32 phaseId;
-
- bool NeedsServerSideUpdate() const { return phasemask; }
- bool NeedsClientSideUpdate() const { return terrainswapmap || phaseId; }
-};
-
-typedef std::unordered_map<uint32 /*spellId*/, std::list<PhaseInfo>> PhaseInfoContainer;
-
-struct PhaseData
-{
- PhaseData(Player* _player) : _PhasemaskThroughDefinitions(0), _PhasemaskThroughAuras(0), _CustomPhasemask(0), player(_player) {}
-
- uint32 _PhasemaskThroughDefinitions;
- uint32 _PhasemaskThroughAuras;
- uint32 _CustomPhasemask;
-
- uint32 GetCurrentPhasemask() const;
- inline uint32 GetPhaseMaskForSpawn() const;
-
- void ResetDefinitions() { _PhasemaskThroughDefinitions = 0; activePhaseDefinitions.clear(); }
- void AddPhaseDefinition(PhaseDefinition const* phaseDefinition);
- bool HasActiveDefinitions() const { return !activePhaseDefinitions.empty(); }
-
- void AddAuraInfo(uint32 spellId, PhaseInfo const& phaseInfo);
- uint32 RemoveAuraInfo(uint32 spellId);
-
- void SendPhaseMaskToPlayer();
- void SendPhaseshiftToPlayer();
-
- void GetActivePhases(std::set<uint32>& phases) const;
-
-private:
- Player* player;
- std::list<PhaseDefinition const*> activePhaseDefinitions;
- PhaseInfoContainer spellPhaseInfo;
-};
-
-struct PhaseUpdateData
-{
- PhaseUpdateData(): _conditionTypeFlags(0), _questId(0) { }
- void AddConditionType(ConditionTypes const conditionType) { _conditionTypeFlags |= (1 << conditionType); }
- void AddQuestUpdate(uint32 const questId);
-
- bool IsConditionRelated(Condition const* condition) const;
-
-private:
- uint32 _conditionTypeFlags;
- uint32 _questId;
-};
-
-class PhaseMgr
-{
-public:
- PhaseMgr(Player* _player);
- ~PhaseMgr() {}
-
- uint32 GetCurrentPhasemask() { return phaseData.GetCurrentPhasemask(); };
- inline uint32 GetPhaseMaskForSpawn() { return phaseData.GetCurrentPhasemask(); }
-
- // Phase definitions update handling
- void NotifyConditionChanged(PhaseUpdateData const& updateData);
- void NotifyStoresReloaded() { Recalculate(); Update(); }
-
- void Update();
-
- // Aura phase effects
- void RegisterPhasingAuraEffect(AuraEffect const* auraEffect);
- void UnRegisterPhasingAuraEffect(AuraEffect const* auraEffect);
-
- // Update flags (delayed phasing)
- void AddUpdateFlag(PhaseUpdateFlag updateFlag) { _UpdateFlags |= updateFlag; }
- void RemoveUpdateFlag(PhaseUpdateFlag updateFlag);
-
- // Needed for modify phase command
- void SetCustomPhase(uint32 phaseMask);
-
- // Debug
- void SendDebugReportToPlayer(Player* const debugger);
-
- static bool IsConditionTypeSupported(ConditionTypes conditionType);
-
- void GetActivePhases(std::set<uint32>& phases) const;
-
-private:
- void Recalculate();
-
- inline bool CheckDefinition(PhaseDefinition const* phaseDefinition);
-
- bool NeedsPhaseUpdateWithData(PhaseUpdateData const& updateData) const;
-
- inline bool IsUpdateInProgress() const { return (_UpdateFlags & PHASE_UPDATE_FLAG_ZONE_UPDATE) || (_UpdateFlags & PHASE_UPDATE_FLAG_AREA_UPDATE); }
-
- PhaseDefinitionStore const* _PhaseDefinitionStore;
- SpellPhaseStore const* _SpellPhaseStore;
-
- Player* player;
- PhaseData phaseData;
- uint8 _UpdateFlags;
-};
-
-#endif
diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h
index 3a3a2730c2d..3511c4b3795 100644
--- a/src/server/game/Server/WorldSession.h
+++ b/src/server/game/Server/WorldSession.h
@@ -232,7 +232,7 @@ class WorldSession
void SendPetNameInvalid(uint32 error, std::string const& name, DeclinedName *declinedName);
void SendPartyResult(PartyOperation operation, std::string const& member, PartyResult res, uint32 val = 0);
void SendAreaTriggerMessage(const char* Text, ...) ATTR_PRINTF(2, 3);
- void SendSetPhaseShift(std::set<uint32> const& phaseIds, std::set<uint32> const& terrainswaps);
+ void SendSetPhaseShift(std::set<uint32> const& phaseIds, std::set<uint32> const& terrainswaps, std::set<uint32> const& worldMapAreaSwaps);
void SendQueryTimeResponse();
void SendAuthResponse(uint8 code, bool queued, uint32 queuePos = 0);
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
index 61a1ea40120..8c80c7687d5 100644
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -1606,31 +1606,23 @@ void AuraEffect::HandlePhase(AuraApplication const* aurApp, uint8 mode, bool app
Unit* target = aurApp->GetTarget();
- if (Player* player = target->ToPlayer())
+ uint32 newPhase = 0;
+ Unit::AuraEffectList const& phases = target->GetAuraEffectsByType(SPELL_AURA_PHASE);
+ if (!phases.empty())
+ for (Unit::AuraEffectList::const_iterator itr = phases.begin(); itr != phases.end(); ++itr)
+ newPhase |= (*itr)->GetMiscValue();
+
+ if (!newPhase)
{
- if (apply)
- player->GetPhaseMgr().RegisterPhasingAuraEffect(this);
- else
- player->GetPhaseMgr().UnRegisterPhasingAuraEffect(this);
+ newPhase = PHASEMASK_NORMAL;
+ if (Creature* creature = target->ToCreature())
+ if (CreatureData const* data = sObjectMgr->GetCreatureData(creature->GetDBTableGUIDLow()))
+ newPhase = data->phaseMask;
}
- else
- {
- uint32 newPhase = 0;
- Unit::AuraEffectList const& phases = target->GetAuraEffectsByType(SPELL_AURA_PHASE);
- if (!phases.empty())
- for (Unit::AuraEffectList::const_iterator itr = phases.begin(); itr != phases.end(); ++itr)
- newPhase |= (*itr)->GetMiscValue();
- if (!newPhase)
- {
- newPhase = PHASEMASK_NORMAL;
- if (Creature* creature = target->ToCreature())
- if (CreatureData const* data = sObjectMgr->GetCreatureData(creature->GetDBTableGUIDLow()))
- newPhase = data->phaseMask;
- }
+ target->SetPhaseMask(newPhase, false);
- target->SetPhaseMask(newPhase, false);
- }
+ target->SetInPhase(GetMiscValueB(), false, apply);
// call functions which may have additional effects after chainging state of unit
// phase auras normally not expected at BG but anyway better check
@@ -1640,6 +1632,8 @@ void AuraEffect::HandlePhase(AuraApplication const* aurApp, uint8 mode, bool app
target->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION);
}
+ if (Player* player = target->ToPlayer())
+ player->UpdatePhasing();
// need triggering visibility update base at phase update of not GM invisible (other GMs anyway see in any phases)
if (target->IsVisible())
target->UpdateObjectVisibility();
@@ -1652,13 +1646,12 @@ void AuraEffect::HandlePhaseGroup(AuraApplication const* aurApp, uint8 mode, boo
Unit* target = aurApp->GetTarget();
- if (Player* player = target->ToPlayer())
- {
- if (apply)
- player->GetPhaseMgr().RegisterPhasingAuraEffect(this);
- else
- player->GetPhaseMgr().UnRegisterPhasingAuraEffect(this);
- }
+ if (target->GetTypeId() != TYPEID_PLAYER)
+ return;
+
+ std::set<uint32> const& phases = GetPhasesForGroup(GetMiscValueB());
+ for (auto phase : phases)
+ target->SetInPhase(phase, false, apply);
// call functions which may have additional effects after chainging state of unit
// phase auras normally not expected at BG but anyway better check
@@ -1668,6 +1661,9 @@ void AuraEffect::HandlePhaseGroup(AuraApplication const* aurApp, uint8 mode, boo
target->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION);
}
+ if (Player* player = target->ToPlayer())
+ player->UpdatePhasing();
+
// need triggering visibility update base at phase update of not GM invisible (other GMs anyway see in any phases)
if (target->IsVisible())
target->UpdateObjectVisibility();
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index 8dfa017467a..ab05cd235eb 100644
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -3200,6 +3200,9 @@ void Spell::EffectSummonObjectWild(SpellEffIndex effIndex)
return;
}
+ for (auto phase : m_caster->GetPhases())
+ pGameObj->SetInPhase(phase, false, true);
+
int32 duration = m_spellInfo->GetDuration();
pGameObj->SetRespawnTime(duration > 0 ? duration/IN_MILLISECONDS : 0);
@@ -3221,6 +3224,9 @@ void Spell::EffectSummonObjectWild(SpellEffIndex effIndex)
if (linkedGO->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), linkedEntry, map,
m_caster->GetPhaseMask(), x, y, z, target->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, GO_STATE_READY))
{
+ for (auto phase : m_caster->GetPhases())
+ linkedGO->SetInPhase(phase, false, true);
+
linkedGO->SetRespawnTime(duration > 0 ? duration/IN_MILLISECONDS : 0);
linkedGO->SetSpellId(m_spellInfo->Id);
@@ -3872,6 +3878,9 @@ void Spell::EffectDuel(SpellEffIndex effIndex)
return;
}
+ for (auto phase : m_caster->GetPhases())
+ pGameObj->SetInPhase(phase, false, true);
+
pGameObj->SetUInt32Value(GAMEOBJECT_FACTION, m_caster->getFaction());
pGameObj->SetUInt32Value(GAMEOBJECT_LEVEL, m_caster->getLevel()+1);
int32 duration = m_spellInfo->GetDuration();
@@ -4228,6 +4237,9 @@ void Spell::EffectSummonObject(SpellEffIndex effIndex)
return;
}
+ for (auto phase : m_caster->GetPhases())
+ go->SetInPhase(phase, false, true);
+
//pGameObj->SetUInt32Value(GAMEOBJECT_LEVEL, m_caster->getLevel());
int32 duration = m_spellInfo->GetDuration();
go->SetRespawnTime(duration > 0 ? duration/IN_MILLISECONDS : 0);
@@ -4857,6 +4869,9 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex)
return;
}
+ for (auto phase : m_caster->GetPhases())
+ pGameObj->SetInPhase(phase, false, true);
+
int32 duration = m_spellInfo->GetDuration();
switch (goinfo->type)
@@ -4919,6 +4934,9 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex)
if (linkedGO->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), linkedEntry, cMap,
m_caster->GetPhaseMask(), fx, fy, fz, m_caster->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, GO_STATE_READY))
{
+ for (auto phase : m_caster->GetPhases())
+ linkedGO->SetInPhase(phase, false, true);
+
linkedGO->SetRespawnTime(duration > 0 ? duration/IN_MILLISECONDS : 0);
//linkedGO->SetUInt32Value(GAMEOBJECT_LEVEL, m_caster->getLevel());
linkedGO->SetSpellId(m_spellInfo->Id);
diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp
index 7491920c36a..03076b003be 100644
--- a/src/server/game/Spells/SpellInfo.cpp
+++ b/src/server/game/Spells/SpellInfo.cpp
@@ -17,6 +17,7 @@
#include "SpellInfo.h"
#include "SpellAuraDefines.h"
+#include "SpellAuraEffects.h"
#include "SpellMgr.h"
#include "Spell.h"
#include "DBCStores.h"
diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp
index a9507b174b6..4375ad09e4c 100644
--- a/src/server/game/World/World.cpp
+++ b/src/server/game/World/World.cpp
@@ -1457,7 +1457,7 @@ void World::SetInitialWorldSettings()
sSpellMgr->LoadSpellGroupStackRules();
TC_LOG_INFO("server.loading", "Loading Spell Phase Dbc Info...");
- sObjectMgr->LoadSpellPhaseInfo();
+ sObjectMgr->LoadPhaseInfo();
TC_LOG_INFO("server.loading", "Loading NPC Texts...");
sObjectMgr->LoadGossipText();
@@ -3284,10 +3284,7 @@ CharacterNameData const* World::GetCharacterNameData(uint32 guid) const
void World::UpdatePhaseDefinitions()
{
- SessionMap::const_iterator itr;
- for (itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
- if (itr->second && itr->second->GetPlayer() && itr->second->GetPlayer()->IsInWorld())
- itr->second->GetPlayer()->GetPhaseMgr().NotifyStoresReloaded();
+
}
void World::ReloadRBAC()
diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp
index d0a005f356e..52886d60c4b 100644
--- a/src/server/scripts/Commands/cs_debug.cpp
+++ b/src/server/scripts/Commands/cs_debug.cpp
@@ -934,6 +934,9 @@ public:
return false;
}
+ for (auto phase : handler->GetSession()->GetPlayer()->GetPhases())
+ v->SetInPhase(phase, false, true);
+
map->AddToMap(v->ToCreature());
return true;
@@ -962,13 +965,14 @@ public:
std::set<uint32> terrainswap;
std::set<uint32> phaseId;
+ std::set<uint32> worldMapSwap;
terrainswap.insert((uint32)atoi(t));
if (p)
phaseId.insert((uint32)atoi(p));
- handler->GetSession()->SendSetPhaseShift(phaseId, terrainswap);
+ handler->GetSession()->SendSetPhaseShift(phaseId, terrainswap, worldMapSwap);
return true;
}
@@ -1393,7 +1397,7 @@ public:
if (unit && unit->GetTypeId() == TYPEID_PLAYER)
player = unit->ToPlayer();
- player->GetPhaseMgr().SendDebugReportToPlayer(handler->GetSession()->GetPlayer());
+
return true;
}
};
diff --git a/src/server/scripts/Commands/cs_gobject.cpp b/src/server/scripts/Commands/cs_gobject.cpp
index e556854c2ab..37961b040b3 100644
--- a/src/server/scripts/Commands/cs_gobject.cpp
+++ b/src/server/scripts/Commands/cs_gobject.cpp
@@ -152,12 +152,15 @@ public:
GameObject* object = new GameObject;
uint32 guidLow = sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT);
- if (!object->Create(guidLow, objectInfo->entry, map, player->GetPhaseMgr().GetPhaseMaskForSpawn(), x, y, z, o, 0.0f, 0.0f, 0.0f, 0.0f, 0, GO_STATE_READY))
+ if (!object->Create(guidLow, objectInfo->entry, map, player->GetPhaseMask(), x, y, z, o, 0.0f, 0.0f, 0.0f, 0.0f, 0, GO_STATE_READY))
{
delete object;
return false;
}
+ for (auto phase : player->GetPhases())
+ object->SetInPhase(phase, false, true);
+
if (spawntimeSecs)
{
uint32 value = atoi((char*)spawntimeSecs);
@@ -165,7 +168,7 @@ public:
}
// fill the gameobject data and save to the db
- object->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), player->GetPhaseMgr().GetPhaseMaskForSpawn());
+ object->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), player->GetPhaseMask());
// delete the old object and do a clean load from DB with a fresh new GameObject instance.
// this is required to avoid weird behavior and memory leaks
delete object;
diff --git a/src/server/scripts/Commands/cs_modify.cpp b/src/server/scripts/Commands/cs_modify.cpp
index d47ee20fac5..83b799f46bb 100644
--- a/src/server/scripts/Commands/cs_modify.cpp
+++ b/src/server/scripts/Commands/cs_modify.cpp
@@ -1277,14 +1277,9 @@ public:
Unit* target = handler->getSelectedUnit();
if (target)
- {
- if (target->GetTypeId() == TYPEID_PLAYER)
- target->ToPlayer()->GetPhaseMgr().SetCustomPhase(phasemask);
- else
- target->SetPhaseMask(phasemask, true);
- }
+ target->SetPhaseMask(phasemask, true);
else
- handler->GetSession()->GetPlayer()->GetPhaseMgr().SetCustomPhase(phasemask);
+ handler->GetSession()->GetPlayer()->SetPhaseMask(phasemask, true);
return true;
}
diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp
index fb465aaca16..a46db80600e 100644
--- a/src/server/scripts/Commands/cs_npc.cpp
+++ b/src/server/scripts/Commands/cs_npc.cpp
@@ -243,7 +243,7 @@ public:
uint32 guid = sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT);
CreatureData& data = sObjectMgr->NewOrExistCreatureData(guid);
data.id = id;
- data.phaseMask = chr->GetPhaseMgr().GetPhaseMaskForSpawn();
+ data.phaseMask = chr->GetPhaseMask();
data.posX = chr->GetTransOffsetX();
data.posY = chr->GetTransOffsetY();
data.posZ = chr->GetTransOffsetZ();
@@ -251,20 +251,23 @@ public:
Creature* creature = trans->CreateNPCPassenger(guid, &data);
- creature->SaveToDB(trans->GetGOInfo()->moTransport.mapID, 1 << map->GetSpawnMode(), chr->GetPhaseMgr().GetPhaseMaskForSpawn());
+ creature->SaveToDB(trans->GetGOInfo()->moTransport.mapID, 1 << map->GetSpawnMode(), chr->GetPhaseMask());
sObjectMgr->AddCreatureToGrid(guid, &data);
return true;
}
Creature* creature = new Creature();
- if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMgr().GetPhaseMaskForSpawn(), id, x, y, z, o))
+ if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMask(), id, x, y, z, o))
{
delete creature;
return false;
}
- creature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMgr().GetPhaseMaskForSpawn());
+ for (auto phase : chr->GetPhases())
+ creature->SetInPhase(phase, false, true);
+
+ creature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMask());
uint32 db_guid = creature->GetDBTableGUIDLow();
diff --git a/src/server/scripts/Commands/cs_wp.cpp b/src/server/scripts/Commands/cs_wp.cpp
index 5306e0e1d9e..210c47a7d3d 100644
--- a/src/server/scripts/Commands/cs_wp.cpp
+++ b/src/server/scripts/Commands/cs_wp.cpp
@@ -694,7 +694,7 @@ public:
}
// re-create
Creature* wpCreature2 = new Creature();
- if (!wpCreature2->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMgr().GetPhaseMaskForSpawn(), VISUAL_WAYPOINT, chr->GetPositionX(), chr->GetPositionY(), chr->GetPositionZ(), chr->GetOrientation()))
+ if (!wpCreature2->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMask(), VISUAL_WAYPOINT, chr->GetPositionX(), chr->GetPositionY(), chr->GetPositionZ(), chr->GetOrientation()))
{
handler->PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, VISUAL_WAYPOINT);
delete wpCreature2;
@@ -702,7 +702,10 @@ public:
return false;
}
- wpCreature2->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMgr().GetPhaseMaskForSpawn());
+ for (auto phase : chr->GetPhases())
+ wpCreature2->SetInPhase(phase, false, true);
+
+ wpCreature2->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMask());
// To call _LoadGoods(); _LoadQuests(); CreateTrainerSpells();
/// @todo Should we first use "Create" then use "LoadFromDB"?
if (!wpCreature2->LoadCreatureFromDB(wpCreature2->GetDBTableGUIDLow(), map))
@@ -918,13 +921,16 @@ public:
float o = chr->GetOrientation();
Creature* wpCreature = new Creature();
- if (!wpCreature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMgr().GetPhaseMaskForSpawn(), id, x, y, z, o))
+ if (!wpCreature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMask(), id, x, y, z, o))
{
handler->PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, id);
delete wpCreature;
return false;
}
+ for (auto phase : chr->GetPhases())
+ wpCreature->SetInPhase(phase, false, true);
+
// Set "wpguid" column to the visual waypoint
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_WAYPOINT_DATA_WPGUID);
@@ -934,7 +940,7 @@ public:
WorldDatabase.Execute(stmt);
- wpCreature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMgr().GetPhaseMaskForSpawn());
+ wpCreature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMask());
// To call _LoadGoods(); _LoadQuests(); CreateTrainerSpells();
if (!wpCreature->LoadCreatureFromDB(wpCreature->GetDBTableGUIDLow(), map))
{
@@ -982,14 +988,17 @@ public:
Map* map = chr->GetMap();
Creature* creature = new Creature();
- if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMgr().GetPhaseMaskForSpawn(), id, x, y, z, o))
+ if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMask(), id, x, y, z, o))
{
handler->PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, id);
delete creature;
return false;
}
- creature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMgr().GetPhaseMaskForSpawn());
+ for (auto phase : chr->GetPhases())
+ creature->SetInPhase(phase, false, true);
+
+ creature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMask());
if (!creature->LoadCreatureFromDB(creature->GetDBTableGUIDLow(), map))
{
handler->PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, id);
@@ -1031,14 +1040,17 @@ public:
Map* map = chr->GetMap();
Creature* creature = new Creature();
- if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMgr().GetPhaseMaskForSpawn(), id, x, y, z, o))
+ if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMask(), id, x, y, z, o))
{
handler->PSendSysMessage(LANG_WAYPOINT_NOTCREATED, id);
delete creature;
return false;
}
- creature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMgr().GetPhaseMaskForSpawn());
+ for (auto phase : chr->GetPhases())
+ creature->SetInPhase(phase, false, true);
+
+ creature->SaveToDB(map->GetId(), (1 << map->GetSpawnMode()), chr->GetPhaseMask());
if (!creature->LoadCreatureFromDB(creature->GetDBTableGUIDLow(), map))
{
handler->PSendSysMessage(LANG_WAYPOINT_NOTCREATED, id);
diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp
index 9404694e706..006ef461cab 100644
--- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp
+++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp
@@ -380,7 +380,7 @@ class boss_halion : public CreatureScript
if (events.IsInPhase(PHASE_THREE))
{
// Don't consider copied damage.
- if (!me->InSamePhase(attacker))
+ if (!me->IsInPhase(attacker))
return;
if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HALION_CONTROLLER)))
@@ -541,7 +541,7 @@ class boss_twilight_halion : public CreatureScript
if (events.IsInPhase(PHASE_THREE))
{
// Don't consider copied damage.
- if (!me->InSamePhase(attacker))
+ if (!me->IsInPhase(attacker))
return;
if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HALION_CONTROLLER)))
diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp
index 8a1fb6a9829..4fa80c7bac2 100644
--- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp
+++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp
@@ -90,7 +90,6 @@ public:
delete go;
return;
}
-
instance->AddToMap(go);
}
diff --git a/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp b/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp
index 7ae1c7840db..753d4ebea01 100644
--- a/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp
+++ b/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp
@@ -190,7 +190,8 @@ public:
{
summon->AI()->AttackStart(me->GetVictim());
summon->CastSpell((Unit*)NULL, SPELL_ZURAMAT_ADD_2);
- summon->SetPhaseMask(17, true);
+ summon->SetInPhase(169, true, true); // Normal phase
+ summon->SetInPhase(173, true, true); // Void phase
}
};
diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp
index a3ef9ce7b5c..b43904f2223 100644
--- a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp
+++ b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp
@@ -170,6 +170,9 @@ bool OutdoorPvPSI::HandleDropFlag(Player* player, uint32 spellId)
return true;
}
+ for (auto phase : player->GetPhases())
+ go->SetInPhase(phase, false, true);
+
go->SetRespawnTime(0);
if (!map->AddToMap(go))
@@ -204,6 +207,9 @@ bool OutdoorPvPSI::HandleDropFlag(Player* player, uint32 spellId)
return true;
}
+ for (auto phase : player->GetPhases())
+ go->SetInPhase(phase, false, true);
+
go->SetRespawnTime(0);
if (!map->AddToMap(go))