diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index 3f3a320a1d..62835ae903 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -2738,8 +2738,11 @@ void WorldObject::SetInPhase(uint32 id, bool update, bool apply) _phases.erase(id); // Remove the terrain swaps that were applied by this phase // Iterator pointing to the start of the sequence of elements that we're going to delete - std::set::iterator endRange = std::set_difference(_terrainSwaps.begin(), _terrainSwaps.end(), terrainSwaps.begin(), terrainSwaps.end(), _terrainSwaps.begin()); - terrainSwaps.erase(endRange, _terrainSwaps.end()); + + // other phases could use the same terrain swaps too, check for them before remove!!! + + //std::set::iterator endRange = std::set_difference(_terrainSwaps.begin(), _terrainSwaps.end(), terrainSwaps.begin(), terrainSwaps.end(), _terrainSwaps.begin()); + //terrainSwaps.erase(endRange, _terrainSwaps.end()); } if (update && IsInWorld()) diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h index b2464b5e6c..1acca131f8 100644 --- a/src/server/game/Entities/Object/Object.h +++ b/src/server/game/Entities/Object/Object.h @@ -599,6 +599,7 @@ class WorldObject : public Object, public WorldLocation bool IsInPhase(uint32 phase) const { return _phases.find(phase) != _phases.end(); } bool IsInPhase(WorldObject const* obj) const; std::set const& GetPhases() const { return _phases; } + std::set const& GetTerrainSwaps() const { return _terrainSwaps; } uint32 GetZoneId() const; uint32 GetAreaId() const; diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 386f52f1b1..03981a222b 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -27990,7 +27990,7 @@ void Player::SendUpdatePhasing() return; std::set worldAreaSwaps; // @ToDo - GetSession()->SendSetPhaseShift(GetPhases(), _terrainSwaps, worldAreaSwaps); + GetSession()->SendSetPhaseShift(GetPhases(), GetTerrainSwaps(), worldAreaSwaps); } void Player::SendSupercededSpell(uint32 oldSpell, uint32 newSpell) diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index a43baed9ae..286d157141 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -1474,9 +1474,6 @@ void World::SetInitialWorldSettings() TC_LOG_INFO("server.loading", "Loading Spell Group Stack Rules..."); sSpellMgr->LoadSpellGroupStackRules(); - TC_LOG_INFO("server.loading", "Loading Spell Phase Dbc Info..."); - sObjectMgr->LoadPhaseInfo(); - TC_LOG_INFO("server.loading", "Loading NPC Texts..."); sObjectMgr->LoadGossipText(); @@ -1729,8 +1726,8 @@ void World::SetInitialWorldSettings() TC_LOG_INFO("server.loading", "Loading World States..."); // must be loaded before battleground, outdoor PvP and conditions LoadWorldStates(); - TC_LOG_INFO("server.loading", "Loading Phase definitions..."); - sObjectMgr->LoadPhaseDefinitions(); + TC_LOG_INFO("server.loading", "Loading Terrain Phase definitions..."); + sObjectMgr->LoadTerrainPhaseInfo(); TC_LOG_INFO("server.loading", "Loading Conditions..."); sConditionMgr->LoadConditions(); diff --git a/src/server/scripts/Commands/cs_reload.cpp b/src/server/scripts/Commands/cs_reload.cpp index 987f6c479e..106ef41ada 100644 --- a/src/server/scripts/Commands/cs_reload.cpp +++ b/src/server/scripts/Commands/cs_reload.cpp @@ -1129,10 +1129,10 @@ public: static bool HandleReloadPhaseDefinitionsCommand(ChatHandler* handler, const char* /*args*/) { - TC_LOG_INFO("misc", "Reloading phase_definitions table..."); - sObjectMgr->LoadPhaseDefinitions(); + TC_LOG_INFO("misc", "Reloading terrain_phase_info table..."); + sObjectMgr->LoadTerrainPhaseInfo(); sWorld->UpdatePhaseDefinitions(); - handler->SendGlobalGMSysMessage("Phase Definitions reloaded."); + handler->SendGlobalGMSysMessage("Terrain phase infos reloaded."); return true; }