diff options
Diffstat (limited to 'src')
29 files changed, 133 insertions, 102 deletions
diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp index 95eb5ed19ec..aa3161ebfcd 100644 --- a/src/server/game/Battlefield/Battlefield.cpp +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -808,7 +808,7 @@ Creature* Battlefield::SpawnCreature(uint32 entry, Position const& pos) pos.GetPosition(x, y, z, o); Creature* creature = new Creature(); - if (!creature->Create(map->GenerateLowGuid<HighGuid::Creature>(), map, PHASEMASK_NORMAL, entry, x, y, z, o)) + if (!creature->Create(map->GenerateLowGuid<HighGuid::Creature>(), map, entry, x, y, z, o)) { TC_LOG_ERROR("bg.battlefield", "Battlefield::SpawnCreature: Can't create creature entry: %u", entry); delete creature; @@ -843,8 +843,8 @@ GameObject* Battlefield::SpawnGameObject(uint32 entry, Position const& pos, Quat } // Create gameobject - GameObject* go = new GameObject; - if (!go->Create(entry, map, PHASEMASK_NORMAL, pos, rot, 255, GO_STATE_READY)) + GameObject* go = new GameObject(); + if (!go->Create(entry, map, pos, rot, 255, GO_STATE_READY)) { TC_LOG_ERROR("bg.battlefield", "Battlefield::SpawnGameObject: Could not create gameobject template %u! Battlefield has not been created!", entry); delete go; diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp index 307af3883ca..c3742885268 100644 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.cpp @@ -1449,8 +1449,8 @@ bool Battleground::AddObject(uint32 type, uint32 entry, float x, float y, float // Must be created this way, adding to godatamap would add it to the base map of the instance // and when loading it (in go::LoadFromDB()), a new guid would be assigned to the object, and a new object would be created // So we must create it specific for this instance - GameObject* go = new GameObject; - if (!go->Create(entry, GetBgMap(), PHASEMASK_NORMAL, Position(x, y, z, o), rot, 255, goState)) + GameObject* go = new GameObject(); + if (!go->Create(entry, GetBgMap(), Position(x, y, z, o), rot, 255, goState)) { TC_LOG_ERROR("bg.battleground", "Battleground::AddObject: cannot create gameobject (entry: %u) for BG (map: %u, instance id: %u)!", entry, m_MapId, m_InstanceID); @@ -1593,7 +1593,7 @@ Creature* Battleground::AddCreature(uint32 entry, uint32 type, float x, float y, Creature* creature = new Creature(); - if (!creature->Create(map->GenerateLowGuid<HighGuid::Creature>(), map, PHASEMASK_NORMAL, entry, x, y, z, o)) + if (!creature->Create(map->GenerateLowGuid<HighGuid::Creature>(), map, entry, x, y, z, o)) { TC_LOG_ERROR("bg.battleground", "Battleground::AddCreature: cannot create creature (entry: %u) for BG (map: %u, instance id: %u)!", entry, m_MapId, m_InstanceID); diff --git a/src/server/game/Entities/AreaTrigger/AreaTrigger.cpp b/src/server/game/Entities/AreaTrigger/AreaTrigger.cpp index 0204297fed6..b5240737bfd 100644 --- a/src/server/game/Entities/AreaTrigger/AreaTrigger.cpp +++ b/src/server/game/Entities/AreaTrigger/AreaTrigger.cpp @@ -107,7 +107,6 @@ bool AreaTrigger::CreateAreaTrigger(uint32 spellMiscId, Unit* caster, Unit* targ } Object::_Create(ObjectGuid::Create<HighGuid::AreaTrigger>(GetMapId(), GetTemplate()->Id, caster->GetMap()->GenerateLowGuid<HighGuid::AreaTrigger>())); - SetPhaseMask(caster->GetPhaseMask(), false); SetEntry(GetTemplate()->Id); SetDuration(duration); diff --git a/src/server/game/Entities/Conversation/Conversation.cpp b/src/server/game/Entities/Conversation/Conversation.cpp index ccb8e274c83..1d7d5a6cfae 100644 --- a/src/server/game/Entities/Conversation/Conversation.cpp +++ b/src/server/game/Entities/Conversation/Conversation.cpp @@ -115,7 +115,6 @@ bool Conversation::Create(ObjectGuid::LowType lowGuid, uint32 conversationEntry, Relocate(pos); Object::_Create(ObjectGuid::Create<HighGuid::Conversation>(GetMapId(), conversationEntry, lowGuid)); - SetPhaseMask(creator->GetPhaseMask(), false); CopyPhaseFrom(creator); SetEntry(conversationEntry); diff --git a/src/server/game/Entities/Corpse/Corpse.cpp b/src/server/game/Entities/Corpse/Corpse.cpp index b92397ee227..436032b89fe 100644 --- a/src/server/game/Entities/Corpse/Corpse.cpp +++ b/src/server/game/Entities/Corpse/Corpse.cpp @@ -83,7 +83,6 @@ bool Corpse::Create(ObjectGuid::LowType guidlow, Player* owner) } Object::_Create(ObjectGuid::Create<HighGuid::Corpse>(owner->GetMapId(), 0, guidlow)); - SetPhaseMask(owner->GetPhaseMask(), false); SetObjectScale(1.0f); SetGuidValue(CORPSE_FIELD_OWNER, owner->GetGUID()); diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 22ae6fa5e5e..c18b89a6840 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -849,7 +849,7 @@ void Creature::Motion_Initialize() GetMotionMaster()->Initialize(); } -bool Creature::Create(ObjectGuid::LowType guidlow, Map* map, uint32 /*phaseMask*/, uint32 entry, float x, float y, float z, float ang, CreatureData const* data /*= nullptr*/, uint32 vehId /*= 0*/) +bool Creature::Create(ObjectGuid::LowType guidlow, Map* map, uint32 entry, float x, float y, float z, float ang, CreatureData const* data /*= nullptr*/, uint32 vehId /*= 0*/) { ASSERT(map); SetMap(map); @@ -1140,8 +1140,8 @@ void Creature::SaveToDB(uint32 mapid, uint64 spawnMask) data.unit_flags3 = unitFlags3; data.dynamicflags = dynamicflags; - data.phaseId = GetDBPhase() > 0 ? GetDBPhase() : 0; - data.phaseGroup = GetDBPhase() < 0 ? std::abs(GetDBPhase()) : 0; + data.phaseId = GetDBPhase() > 0 ? GetDBPhase() : data.phaseId; + data.phaseGroup = GetDBPhase() < 0 ? -GetDBPhase() : data.phaseGroup; // update in DB SQLTransaction trans = WorldDatabase.BeginTransaction(); @@ -1413,7 +1413,7 @@ bool Creature::LoadCreatureFromDB(ObjectGuid::LowType spawnId, Map* map, bool ad m_spawnId = spawnId; m_creatureData = data; - if (!Create(map->GenerateLowGuid<HighGuid::Creature>(), map, PHASEMASK_NORMAL, data->id, data->posX, data->posY, data->posZ, data->orientation, data)) + if (!Create(map->GenerateLowGuid<HighGuid::Creature>(), map, data->id, data->posX, data->posY, data->posZ, data->orientation, data)) return false; //We should set first home position, because then AI calls home movement diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index 0e5261293a4..1630a745575 100644 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -74,7 +74,7 @@ class TC_GAME_API Creature : public Unit, public GridObject<Creature>, public Ma void DisappearAndDie(); - bool Create(ObjectGuid::LowType guidlow, Map* map, uint32 phaseMask, uint32 entry, float x, float y, float z, float ang, CreatureData const* data = nullptr, uint32 vehId = 0); + bool Create(ObjectGuid::LowType guidlow, Map* map, uint32 entry, float x, float y, float z, float ang, CreatureData const* data = nullptr, uint32 vehId = 0); bool LoadCreaturesAddon(); void SelectLevel(); void UpdateLevelDependantStats(); diff --git a/src/server/game/Entities/DynamicObject/DynamicObject.cpp b/src/server/game/Entities/DynamicObject/DynamicObject.cpp index 312422ca408..663b7c5b682 100644 --- a/src/server/game/Entities/DynamicObject/DynamicObject.cpp +++ b/src/server/game/Entities/DynamicObject/DynamicObject.cpp @@ -96,7 +96,6 @@ bool DynamicObject::CreateDynamicObject(ObjectGuid::LowType guidlow, Unit* caste } WorldObject::_Create(ObjectGuid::Create<HighGuid::DynamicObject>(GetMapId(), spell->Id, guidlow)); - SetPhaseMask(caster->GetPhaseMask(), false); SetEntry(spell->Id); SetObjectScale(1.0f); diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index 7c0a9216b85..8fd83003876 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -197,7 +197,7 @@ void GameObject::RemoveFromWorld() } } -bool GameObject::Create(uint32 name_id, Map* map, uint32 phaseMask, Position const& pos, QuaternionData const& rotation, uint32 animprogress, GOState go_state, uint32 artKit /*= 0*/) +bool GameObject::Create(uint32 name_id, Map* map, Position const& pos, QuaternionData const& rotation, uint32 animprogress, GOState go_state, uint32 artKit /*= 0*/) { ASSERT(map); SetMap(map); @@ -381,7 +381,7 @@ bool GameObject::Create(uint32 name_id, Map* map, uint32 phaseMask, Position con if (uint32 linkedEntry = GetGOInfo()->GetLinkedGameObjectEntry()) { GameObject* linkedGO = new GameObject(); - if (linkedGO->Create(linkedEntry, map, phaseMask, pos, rotation, 255, GO_STATE_READY)) + if (linkedGO->Create(linkedEntry, map, pos, rotation, 255, GO_STATE_READY)) { SetLinkedTrap(linkedGO); map->AddToMap(linkedGO); @@ -906,8 +906,8 @@ void GameObject::SaveToDB(uint32 mapid, uint64 spawnMask) data.spawnMask = spawnMask; data.artKit = GetGoArtKit(); - data.phaseId = GetDBPhase() > 0 ? GetDBPhase() : 0; - data.phaseGroup = GetDBPhase() < 0 ? std::abs(GetDBPhase()) : 0; + data.phaseId = GetDBPhase() > 0 ? GetDBPhase() : data.phaseId; + data.phaseGroup = GetDBPhase() < 0 ? -GetDBPhase() : data.phaseGroup; // Update in DB SQLTransaction trans = WorldDatabase.BeginTransaction(); @@ -959,7 +959,7 @@ bool GameObject::LoadGameObjectFromDB(ObjectGuid::LowType spawnId, Map* map, boo uint32 artKit = data->artKit; m_spawnId = spawnId; - if (!Create(entry, map, PHASEMASK_NORMAL, pos, data->rotation, animprogress, go_state, artKit)) + if (!Create(entry, map, pos, data->rotation, animprogress, go_state, artKit)) return false; if (data->phaseId) diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h index 6822d5207cf..73730efd58a 100644 --- a/src/server/game/Entities/GameObject/GameObject.h +++ b/src/server/game/Entities/GameObject/GameObject.h @@ -91,7 +91,7 @@ class TC_GAME_API GameObject : public WorldObject, public GridObject<GameObject> void RemoveFromWorld() override; void CleanupsBeforeDelete(bool finalCleanup = true) override; - bool Create(uint32 name_id, Map* map, uint32 phaseMask, Position const& pos, QuaternionData const& rotation, uint32 animprogress, GOState go_state, uint32 artKit = 0); + bool Create(uint32 name_id, Map* map, Position const& pos, QuaternionData const& rotation, uint32 animprogress, GOState go_state, uint32 artKit = 0); void Update(uint32 p_time) override; GameObjectTemplate const* GetGOInfo() const { return m_goInfo; } GameObjectTemplateAddon const* GetTemplateAddon() const { return m_goTemplateAddon; } diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index 46db4f0d390..fd2b2ff6dfc 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -1542,7 +1542,7 @@ void MovementInfo::OutDebug() WorldObject::WorldObject(bool isWorldObject) : WorldLocation(), LastUsedScriptID(0), m_name(""), m_isActive(false), m_isWorldObject(isWorldObject), m_zoneScript(NULL), m_transport(NULL), m_currMap(NULL), m_InstanceId(0), -m_phaseMask(PHASEMASK_NORMAL), _dbPhase(0), m_notifyflags(0), m_executed_notifies(0) +_dbPhase(0), m_notifyflags(0), m_executed_notifies(0) { m_serverSideVisibility.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_ALIVE | GHOST_VISIBILITY_GHOST); m_serverSideVisibilityDetect.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_ALIVE); @@ -2421,7 +2421,7 @@ TempSummon* Map::SummonCreature(uint32 entry, Position const& pos, SummonPropert break; } - if (!summon->Create(GenerateLowGuid<HighGuid::Creature>(), this, 0, entry, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), nullptr, vehId)) + if (!summon->Create(GenerateLowGuid<HighGuid::Creature>(), this, entry, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), nullptr, vehId)) { delete summon; return NULL; @@ -2530,7 +2530,7 @@ GameObject* WorldObject::SummonGameObject(uint32 entry, Position const& pos, Qua Map* map = GetMap(); GameObject* go = new GameObject(); - if (!go->Create(entry, map, GetPhaseMask(), pos, rot, 255, GO_STATE_READY)) + if (!go->Create(entry, map, pos, rot, 255, GO_STATE_READY)) { delete go; return nullptr; @@ -2870,14 +2870,6 @@ void WorldObject::MovePositionToFirstCollision(Position &pos, float dist, float pos.SetOrientation(GetOrientation()); } -void WorldObject::SetPhaseMask(uint32 newPhaseMask, bool update) -{ - m_phaseMask = newPhaseMask; - - if (update && IsInWorld()) - UpdateObjectVisibility(); -} - bool WorldObject::HasInPhaseList(uint32 phase) { return _phases.find(phase) != _phases.end(); @@ -2920,20 +2912,15 @@ void WorldObject::UpdateAreaAndZonePhase() for (Unit::AuraEffectList::const_iterator itr = auraPhaseList.begin(); itr != auraPhaseList.end(); ++itr) { uint32 phase = uint32((*itr)->GetMiscValueB()); - bool up = SetInPhase(phase, false, true); - if (!updateNeeded && up) - updateNeeded = true; + updateNeeded = SetInPhase(phase, false, true) || updateNeeded; } Unit::AuraEffectList const& auraPhaseGroupList = unit->GetAuraEffectsByType(SPELL_AURA_PHASE_GROUP); for (Unit::AuraEffectList::const_iterator itr = auraPhaseGroupList.begin(); itr != auraPhaseGroupList.end(); ++itr) { - bool up = false; uint32 phaseGroup = uint32((*itr)->GetMiscValueB()); - std::set<uint32> const& phaseIDs = sDB2Manager.GetPhasesForGroup(phaseGroup); + std::set<uint32> phaseIDs = sDB2Manager.GetPhasesForGroup(phaseGroup); for (uint32 phase : phaseIDs) - up = SetInPhase(phase, false, true); - if (!updateNeeded && up) - updateNeeded = true; + updateNeeded = SetInPhase(phase, false, true) || updateNeeded; } } @@ -2952,13 +2939,16 @@ bool WorldObject::SetInPhase(uint32 id, bool update, bool apply) { if (apply) { - if (HasInPhaseList(id)) // do not run the updates if we are already in this phase + // do not run the updates if we are already in this phase + if (!_phases.insert(id).second) return false; - - _phases.insert(id); } else { + auto phaseItr = _phases.find(id); + if (phaseItr == _phases.end()) + return false; + // if area phase passes the condition we should not remove it (ie: if remove called from aura remove) // this however breaks the .mod phase command, you wont be able to remove any area based phases with it if (std::vector<PhaseInfoStruct> const* phases = sObjectMgr->GetPhasesForArea(GetAreaId())) @@ -2967,10 +2957,7 @@ bool WorldObject::SetInPhase(uint32 id, bool update, bool apply) if (sConditionMgr->IsObjectMeetToConditions(this, phase.Conditions)) return false; - if (!HasInPhaseList(id)) // do not run the updates if we are not in this phase - return false; - - _phases.erase(id); + _phases.erase(phaseItr); } } diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h index c2b454f4460..db8e40a45e7 100644 --- a/src/server/game/Entities/Object/Object.h +++ b/src/server/game/Entities/Object/Object.h @@ -408,7 +408,6 @@ class TC_GAME_API WorldObject : public Object, public WorldLocation uint32 GetInstanceId() const { return m_InstanceId; } - virtual void SetPhaseMask(uint32 newPhaseMask, bool update); virtual bool SetInPhase(uint32 id, bool update, bool apply); void CopyPhaseFrom(WorldObject* obj, bool update = false); void UpdateAreaAndZonePhase(); @@ -416,7 +415,6 @@ class TC_GAME_API WorldObject : public Object, public WorldLocation void RebuildTerrainSwaps(); void RebuildWorldMapAreaSwaps(); bool HasInPhaseList(uint32 phase); - uint32 GetPhaseMask() const { return m_phaseMask; } bool IsInPhase(uint32 phase) const { return _phases.find(phase) != _phases.end(); } bool IsInPhase(std::set<uint32> const& phases) const; bool IsInPhase(WorldObject const* obj) const; @@ -608,7 +606,6 @@ class TC_GAME_API 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; std::set<uint32> _terrainSwaps; std::set<uint32> _worldMapAreaSwaps; diff --git a/src/server/game/Entities/Object/PhaseShift.cpp b/src/server/game/Entities/Object/PhaseShift.cpp new file mode 100644 index 00000000000..7bbf5dfe667 --- /dev/null +++ b/src/server/game/Entities/Object/PhaseShift.cpp @@ -0,0 +1,18 @@ +/* + * Copyright (C) 2008-2018 TrinityCore <https://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 "PhaseShift.h" diff --git a/src/server/game/Entities/Object/PhaseShift.h b/src/server/game/Entities/Object/PhaseShift.h new file mode 100644 index 00000000000..e830938f41e --- /dev/null +++ b/src/server/game/Entities/Object/PhaseShift.h @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2008-2018 TrinityCore <https://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 PhaseShift_h__ +#define PhaseShift_h__ + +#include "Define.h" +#include <set> + +class PhaseShift +{ +private: + std::set<uint32> _phases; + std::set<uint32> _terrainSwaps; + std::set<uint32> _worldMapAreaSwaps; +}; + +#endif // PhaseShift_h__ diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp index 07db65f7620..2290a1e9962 100644 --- a/src/server/game/Entities/Transport/Transport.cpp +++ b/src/server/game/Entities/Transport/Transport.cpp @@ -475,7 +475,7 @@ TempSummon* Transport::SummonPassenger(uint32 entry, Position const& pos, TempSu pos.GetPosition(x, y, z, o); CalculatePassengerPosition(x, y, z, &o); - if (!summon->Create(map->GenerateLowGuid<HighGuid::Creature>(), map, 0, entry, x, y, z, o, nullptr, vehId)) + if (!summon->Create(map->GenerateLowGuid<HighGuid::Creature>(), map, entry, x, y, z, o, nullptr, vehId)) { delete summon; return NULL; diff --git a/src/server/game/Garrison/Garrison.cpp b/src/server/game/Garrison/Garrison.cpp index 2c6ea3e8732..22ac16d443f 100644 --- a/src/server/game/Garrison/Garrison.cpp +++ b/src/server/game/Garrison/Garrison.cpp @@ -731,7 +731,7 @@ GameObject* Garrison::Plot::CreateGameObject(Map* map, GarrisonFactionIndex fact } GameObject* building = new GameObject(); - if (!building->Create(entry, map, 0, PacketInfo.PlotPos.Pos, QuaternionData(), 255, GO_STATE_READY)) + if (!building->Create(entry, map, PacketInfo.PlotPos.Pos, QuaternionData(), 255, GO_STATE_READY)) { delete building; return nullptr; @@ -743,7 +743,7 @@ GameObject* Garrison::Plot::CreateGameObject(Map* map, GarrisonFactionIndex fact { Position const& pos2 = finalizeInfo->FactionInfo[faction].Pos; GameObject* finalizer = new GameObject(); - if (finalizer->Create(finalizeInfo->FactionInfo[faction].GameObjectId, map, 0, pos2, QuaternionData(), 255, GO_STATE_READY)) + if (finalizer->Create(finalizeInfo->FactionInfo[faction].GameObjectId, map, pos2, QuaternionData(), 255, GO_STATE_READY)) { // set some spell id to make the object delete itself after use finalizer->SetSpellId(finalizer->GetGOInfo()->goober.spell); diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 845de8f534c..e92f2c9a814 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -3082,7 +3082,7 @@ void Spell::EffectSummonObjectWild(SpellEffIndex effIndex) Map* map = target->GetMap(); QuaternionData rot = QuaternionData::fromEulerAnglesZYX(target->GetOrientation(), 0.f, 0.f); - if (!pGameObj->Create(gameobject_id, map, m_caster->GetPhaseMask(), Position(x, y, z, target->GetOrientation()), rot, 255, GO_STATE_READY)) + if (!pGameObj->Create(gameobject_id, map, Position(x, y, z, target->GetOrientation()), rot, 255, GO_STATE_READY)) { delete pGameObj; return; @@ -3629,7 +3629,7 @@ void Spell::EffectDuel(SpellEffIndex effIndex) } //CREATE DUEL FLAG OBJECT - GameObject* pGameObj = new GameObject; + GameObject* pGameObj = new GameObject(); uint32 gameobject_id = effectInfo->MiscValue; @@ -3642,7 +3642,7 @@ void Spell::EffectDuel(SpellEffIndex effIndex) }; Map* map = m_caster->GetMap(); - if (!pGameObj->Create(gameobject_id, map, m_caster->GetPhaseMask(), pos, QuaternionData::fromEulerAnglesZYX(pos.GetOrientation(), 0.f, 0.f), 0, GO_STATE_READY)) + if (!pGameObj->Create(gameobject_id, map, pos, QuaternionData::fromEulerAnglesZYX(pos.GetOrientation(), 0.f, 0.f), 0, GO_STATE_READY)) { delete pGameObj; return; @@ -3977,7 +3977,7 @@ void Spell::EffectSummonObject(SpellEffIndex effIndex) m_caster->GetClosePoint(x, y, z, DEFAULT_WORLD_OBJECT_SIZE); Map* map = m_caster->GetMap(); - if (!go->Create(go_id, map, m_caster->GetPhaseMask(), Position(x, y, z, m_caster->GetOrientation()), QuaternionData::fromEulerAnglesZYX(m_caster->GetOrientation(), 0.f, 0.f), 255, GO_STATE_READY)) + if (!go->Create(go_id, map, Position(x, y, z, m_caster->GetOrientation()), QuaternionData::fromEulerAnglesZYX(m_caster->GetOrientation(), 0.f, 0.f), 255, GO_STATE_READY)) { delete go; return; @@ -4664,7 +4664,7 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex) Position pos = { fx, fy, fz, m_caster->GetOrientation() }; QuaternionData rot = QuaternionData::fromEulerAnglesZYX(m_caster->GetOrientation(), 0.f, 0.f); - if (!pGameObj->Create(name_id, cMap, m_caster->GetPhaseMask(), pos, rot, 255, GO_STATE_READY)) + if (!pGameObj->Create(name_id, cMap, pos, rot, 255, GO_STATE_READY)) { delete pGameObj; return; diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp index 417e8aeb7bd..a04ad5630f0 100644 --- a/src/server/scripts/Commands/cs_debug.cpp +++ b/src/server/scripts/Commands/cs_debug.cpp @@ -942,7 +942,7 @@ public: Map* map = handler->GetSession()->GetPlayer()->GetMap(); - if (!v->Create(map->GenerateLowGuid<HighGuid::Vehicle>(), map, handler->GetSession()->GetPlayer()->GetPhaseMask(), entry, x, y, z, o, nullptr, id)) + if (!v->Create(map->GenerateLowGuid<HighGuid::Vehicle>(), map, entry, x, y, z, o, nullptr, id)) { delete v; return false; diff --git a/src/server/scripts/Commands/cs_gobject.cpp b/src/server/scripts/Commands/cs_gobject.cpp index c7611d7e3f4..bc77d56e8a9 100644 --- a/src/server/scripts/Commands/cs_gobject.cpp +++ b/src/server/scripts/Commands/cs_gobject.cpp @@ -144,7 +144,7 @@ public: GameObject* object = new GameObject(); - if (!object->Create(objectInfo->entry, map, 0, *player, QuaternionData::fromEulerAnglesZYX(player->GetOrientation(), 0.0f, 0.0f), 255, GO_STATE_READY)) + if (!object->Create(objectInfo->entry, map, *player, QuaternionData::fromEulerAnglesZYX(player->GetOrientation(), 0.0f, 0.0f), 255, GO_STATE_READY)) { delete object; return false; diff --git a/src/server/scripts/Commands/cs_group.cpp b/src/server/scripts/Commands/cs_group.cpp index 555c688ed17..2628ec3ba7a 100644 --- a/src/server/scripts/Commands/cs_group.cpp +++ b/src/server/scripts/Commands/cs_group.cpp @@ -348,11 +348,12 @@ public: // Check if iterator is online. If is... Player* p = ObjectAccessor::FindPlayer((*itr).guid); + std::string phases; if (p) { // ... than, it prints information like "is online", where he is, etc... onlineState = "online"; - phase = (!p->IsGameMaster() ? p->GetPhaseMask() : -1); + phases = StringJoin(p->GetPhases(), ", "); AreaTableEntry const* area = sAreaTableStore.LookupEntry(p->GetAreaId()); if (area) @@ -367,12 +368,11 @@ public: // ... else, everything is set to offline or neutral values. zoneName = "<ERROR>"; onlineState = "Offline"; - phase = 0; } // Now we can print those informations for every single member of each group! handler->PSendSysMessage(LANG_GROUP_PLAYER_NAME_GUID, slot.name.c_str(), onlineState, - zoneName.c_str(), phase, slot.guid.ToString().c_str(), flags.c_str(), + zoneName.c_str(), phases.c_str(), slot.guid.ToString().c_str(), flags.c_str(), lfg::GetRolesString(slot.roles).c_str()); } diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp index a14ddcf1be8..4ab585546f7 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -286,7 +286,7 @@ public: mapId, (mapEntry ? mapEntry->MapName->Str[handler->GetSessionDbcLocale()] : unknown), zoneId, (zoneEntry ? zoneEntry->AreaName->Str[handler->GetSessionDbcLocale()] : unknown), areaId, (areaEntry ? areaEntry->AreaName->Str[handler->GetSessionDbcLocale()] : unknown), - object->GetPhaseMask(), StringJoin(object->GetPhases(), ", ").c_str(), + StringJoin(object->GetPhases(), ", ").c_str(), object->GetPositionX(), object->GetPositionY(), object->GetPositionZ(), object->GetOrientation()); if (Transport* transport = object->GetTransport()) handler->PSendSysMessage(LANG_TRANSPORT_POSITION, diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp index 719fd6a5992..9cf62049b0d 100644 --- a/src/server/scripts/Commands/cs_npc.cpp +++ b/src/server/scripts/Commands/cs_npc.cpp @@ -311,7 +311,7 @@ public: } Creature* creature = new Creature(); - if (!creature->Create(map->GenerateLowGuid<HighGuid::Creature>(), map, chr->GetPhaseMask(), id, x, y, z, o)) + if (!creature->Create(map->GenerateLowGuid<HighGuid::Creature>(), map, id, x, y, z, o)) { delete creature; return false; diff --git a/src/server/scripts/Commands/cs_wp.cpp b/src/server/scripts/Commands/cs_wp.cpp index e58b15ece40..4e4fa0289ce 100644 --- a/src/server/scripts/Commands/cs_wp.cpp +++ b/src/server/scripts/Commands/cs_wp.cpp @@ -666,7 +666,7 @@ public: // re-create Creature* wpCreature = new Creature(); - if (!wpCreature->Create(map->GenerateLowGuid<HighGuid::Creature>(), map, chr->GetPhaseMask(), VISUAL_WAYPOINT, chr->GetPositionX(), chr->GetPositionY(), chr->GetPositionZ(), chr->GetOrientation())) + if (!wpCreature->Create(map->GenerateLowGuid<HighGuid::Creature>(), map, VISUAL_WAYPOINT, chr->GetPositionX(), chr->GetPositionY(), chr->GetPositionZ(), chr->GetOrientation())) { handler->PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, VISUAL_WAYPOINT); delete wpCreature; @@ -879,7 +879,7 @@ public: float o = chr->GetOrientation(); Creature* wpCreature = new Creature(); - if (!wpCreature->Create(map->GenerateLowGuid<HighGuid::Creature>(), map, chr->GetPhaseMask(), id, x, y, z, o)) + if (!wpCreature->Create(map->GenerateLowGuid<HighGuid::Creature>(), map, id, x, y, z, o)) { handler->PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, id); delete wpCreature; @@ -943,7 +943,7 @@ public: Map* map = chr->GetMap(); Creature* creature = new Creature(); - if (!creature->Create(map->GenerateLowGuid<HighGuid::Creature>(), map, chr->GetPhaseMask(), id, x, y, z, o)) + if (!creature->Create(map->GenerateLowGuid<HighGuid::Creature>(), map, id, x, y, z, o)) { handler->PSendSysMessage(LANG_WAYPOINT_VP_NOTCREATED, id); delete creature; @@ -994,7 +994,7 @@ public: Map* map = chr->GetMap(); Creature* creature = new Creature(); - if (!creature->Create(map->GenerateLowGuid<HighGuid::Creature>(), map, chr->GetPhaseMask(), id, x, y, z, o)) + if (!creature->Create(map->GenerateLowGuid<HighGuid::Creature>(), map, id, x, y, z, o)) { handler->PSendSysMessage(LANG_WAYPOINT_NOTCREATED, id); delete creature; diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/instance_blackwing_lair.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/instance_blackwing_lair.cpp index dcee4a8dce7..6f08d91ce10 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/instance_blackwing_lair.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackwingLair/instance_blackwing_lair.cpp @@ -102,17 +102,19 @@ public: } } + uint32 GetGameObjectEntry(ObjectGuid::LowType /*spawnId*/, uint32 entry) + { + if (entry == GO_BLACK_DRAGON_EGG && GetBossState(DATA_FIREMAW) == DONE) + return 0; + return entry; + } + void OnGameObjectCreate(GameObject* go) override { InstanceScript::OnGameObjectCreate(go); if (go->GetEntry() == GO_BLACK_DRAGON_EGG) - { - if (GetBossState(DATA_FIREMAW) == DONE) - go->SetPhaseMask(2, true); - else - EggList.push_back(go->GetGUID()); - } + EggList.push_back(go->GetGUID()); } void OnGameObjectRemove(GameObject* go) override @@ -255,7 +257,6 @@ public: case EVENT_RESPAWN_NEFARIUS: if (Creature* nefarius = GetCreature(DATA_LORD_VICTOR_NEFARIUS)) { - nefarius->SetPhaseMask(1, true); nefarius->setActive(true); nefarius->Respawn(); nefarius->GetMotionMaster()->MoveTargetedHome(); diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp index c70cd2fe588..c8964c55d72 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp @@ -406,7 +406,7 @@ class boss_twilight_halion : public CreatureScript DoCast(me, SPELL_DUSK_SHROUD, true); me->SetHealth(halion->GetHealth()); - me->SetPhaseMask(0x20, true); + me->SetInPhase(174, false, true); me->SetReactState(REACT_DEFENSIVE); me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); events.ScheduleEvent(EVENT_TAIL_LASH, Seconds(12)); @@ -1193,12 +1193,16 @@ class npc_combustion_consumption : public CreatureScript case NPC_COMBUSTION: _explosionSpell = SPELL_FIERY_COMBUSTION_EXPLOSION; _damageSpell = SPELL_COMBUSTION_DAMAGE_AURA; - creature->SetPhaseMask(IsHeroic() ? 0x21 : 0x01, true); + creature->SetInPhase(DEFAULT_PHASE, false, true); + if (IsHeroic()) + creature->SetInPhase(174, false, true); break; case NPC_CONSUMPTION: _explosionSpell = SPELL_SOUL_CONSUMPTION_EXPLOSION; _damageSpell = SPELL_CONSUMPTION_DAMAGE_AURA; - creature->SetPhaseMask(IsHeroic() ? 0x21 : 0x20, true); + creature->SetInPhase(174, false, true); + if (IsHeroic()) + creature->SetInPhase(DEFAULT_PHASE, false, true); break; default: // Should never happen _explosionSpell = 0; @@ -1335,12 +1339,12 @@ class go_twilight_portal : public GameObjectScript switch (gameobject->GetEntry()) { case GO_HALION_PORTAL_EXIT: - gameobject->SetPhaseMask(0x20, true); + gameobject->SetInPhase(174, false, true); _spellId = gameobject->GetGOInfo()->goober.spell; break; case GO_HALION_PORTAL_1: case GO_HALION_PORTAL_2: - gameobject->SetPhaseMask(0x1, true); + gameobject->SetInPhase(DEFAULT_PHASE, false, true); /// Because WDB template has non-existent spell ID, not seen in sniffs either, meh _spellId = SPELL_TWILIGHT_REALM; break; diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp index 830f897e06e..f829093c5a5 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp @@ -143,8 +143,7 @@ class instance_halls_of_reflection : public InstanceMapScript break; case NPC_FROSTSWORN_GENERAL: FrostswornGeneralGUID = creature->GetGUID(); - if (GetBossState(DATA_MARWYN) == DONE) - creature->SetPhaseMask(1, true); + creature->SetInPhase(170, true, GetBossState(DATA_MARWYN) != DONE); break; case NPC_JAINA_ESCAPE: case NPC_SYLVANAS_ESCAPE: @@ -326,7 +325,7 @@ class instance_halls_of_reflection : public InstanceMapScript HandleGameObject(ImpenetrableDoorGUID, true); DoUpdateWorldState(WORLD_STATE_HOR_WAVES_ENABLED, 0); if (Creature* general = instance->GetCreature(FrostswornGeneralGUID)) - general->SetPhaseMask(1, true); + general->SetInPhase(170, true, false); SpawnGunship(); SpawnEscapeEvent(); 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 38fee2d97bd..7771e0b2781 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,7 @@ public: void SpawnGameObject(uint32 entry, Position const& pos) { GameObject* go = new GameObject(); - if (!go->Create(entry, instance, PHASEMASK_NORMAL, pos, QuaternionData(), 255, GO_STATE_READY)) + if (!go->Create(entry, instance, pos, QuaternionData(), 255, GO_STATE_READY)) { delete go; return; diff --git a/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp b/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp index e666b346d54..16807804090 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp @@ -62,18 +62,15 @@ class instance_oculus : public InstanceMapScript break; case NPC_VAROS: VarosGUID = creature->GetGUID(); - if (GetBossState(DATA_DRAKOS) == DONE) - creature->SetPhaseMask(1, true); + creature->SetInPhase(170, true, GetBossState(DATA_DRAKOS) != DONE); break; case NPC_UROM: UromGUID = creature->GetGUID(); - if (GetBossState(DATA_VAROS) == DONE) - creature->SetPhaseMask(1, true); + creature->SetInPhase(170, true, GetBossState(DATA_VAROS) != DONE); break; case NPC_EREGOS: EregosGUID = creature->GetGUID(); - if (GetBossState(DATA_UROM) == DONE) - creature->SetPhaseMask(1, true); + creature->SetInPhase(170, true, GetBossState(DATA_UROM) != DONE); break; case NPC_CENTRIFUGE_CONSTRUCT: if (creature->IsAlive()) @@ -105,10 +102,10 @@ class instance_oculus : public InstanceMapScript break; case NPC_GREATER_WHELP: if (GetBossState(DATA_UROM) == DONE) - { - creature->SetPhaseMask(1, true); GreaterWhelpList.push_back(creature->GetGUID()); - } + else + creature->SetInPhase(170, true, true); + break; default: break; @@ -197,7 +194,7 @@ class instance_oculus : public InstanceMapScript DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_AMOUNT, CentrifugueConstructCounter); FreeDragons(); if (Creature* varos = instance->GetCreature(VarosGUID)) - varos->SetPhaseMask(1, true); + varos->SetInPhase(170, true, false); events.ScheduleEvent(EVENT_VAROS_INTRO, 15000); } break; @@ -206,7 +203,7 @@ class instance_oculus : public InstanceMapScript { DoUpdateWorldState(WORLD_STATE_CENTRIFUGE_CONSTRUCT_SHOW, 0); if (Creature* urom = instance->GetCreature(UromGUID)) - urom->SetPhaseMask(1, true); + urom->SetInPhase(170, true, false); } break; case DATA_UROM: @@ -214,7 +211,7 @@ class instance_oculus : public InstanceMapScript { if (Creature* eregos = instance->GetCreature(EregosGUID)) { - eregos->SetPhaseMask(1, true); + eregos->SetInPhase(170, true, false); GreaterWhelps(); events.ScheduleEvent(EVENT_EREGOS_INTRO, 5000); } @@ -316,7 +313,7 @@ class instance_oculus : public InstanceMapScript { for (ObjectGuid guid : GreaterWhelpList) if (Creature* gwhelp = instance->GetCreature(guid)) - gwhelp->SetPhaseMask(1, true); + gwhelp->SetInPhase(170, true, false); } protected: diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp index 5dd5ac26cdd..ef24b8a5af1 100644 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp @@ -160,10 +160,10 @@ bool OutdoorPvPSI::HandleDropFlag(Player* player, uint32 spellId) if (player->GetDistance(atEntry->Pos.X, atEntry->Pos.Y, atEntry->Pos.Z) > 5.0f + atEntry->Radius) { // he dropped it further, summon mound - GameObject* go = new GameObject; + GameObject* go = new GameObject(); Map* map = player->GetMap(); - if (!go->Create(SI_SILITHYST_MOUND, map, player->GetPhaseMask(), *player, QuaternionData(), 255, GO_STATE_READY)) + if (!go->Create(SI_SILITHYST_MOUND, map, *player, QuaternionData(), 255, GO_STATE_READY)) { delete go; return true; @@ -191,10 +191,10 @@ bool OutdoorPvPSI::HandleDropFlag(Player* player, uint32 spellId) if (player->GetDistance(atEntry->Pos.X, atEntry->Pos.Y, atEntry->Pos.Z) > 5.0f + atEntry->Radius) { // he dropped it further, summon mound - GameObject* go = new GameObject; + GameObject* go = new GameObject(); Map* map = player->GetMap(); - if (!go->Create(SI_SILITHYST_MOUND, map, player->GetPhaseMask(), *player, QuaternionData(), 255, GO_STATE_READY)) + if (!go->Create(SI_SILITHYST_MOUND, map, *player, QuaternionData(), 255, GO_STATE_READY)) { delete go; return true; |