Core/Phases: implemented usage of default terrain swaps
- added example for Gilneas (from sniff)
This commit is contained in:
1 parent
d25a8c4859
commit
03fed3c7a4
5 files changed
+28
-11
No files matched your search
@@ -0,0 +1,3 @@
|
||||
DELETE FROM `terrain_phase_info` WHERE `Id` = 0;
|
||||
INSERT INTO `terrain_phase_info` (Id, TerrainSwapMap, Comment) VALUES
|
||||
(0, 638, 'Gilneas default terrain swap');
|
||||
@@ -2928,11 +2928,11 @@ void WorldObject::RebuildTerrainSwaps()
|
||||
ConditionList conditions;
|
||||
|
||||
// Check all applied phases for terrain swap and add it only once
|
||||
for (auto phaseId : _phases)
|
||||
for (uint32 phaseId : _phases)
|
||||
{
|
||||
std::list<uint32>& swaps = sObjectMgr->GetPhaseTerrainSwaps(phaseId);
|
||||
|
||||
for (auto swap : swaps)
|
||||
for (uint32 swap : swaps)
|
||||
{
|
||||
conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_TERRAIN_SWAP, swap);
|
||||
|
||||
@@ -2940,4 +2940,15 @@ void WorldObject::RebuildTerrainSwaps()
|
||||
_terrainSwaps.insert(swap);
|
||||
}
|
||||
}
|
||||
|
||||
// get default terrain swaps, id is 0
|
||||
std::list<uint32>& swaps = sObjectMgr->GetPhaseTerrainSwaps(0);
|
||||
|
||||
for (uint32 swap : swaps)
|
||||
{
|
||||
conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_TERRAIN_SWAP, swap);
|
||||
|
||||
if (sConditionMgr->IsObjectMeetToConditions(this, conditions))
|
||||
_terrainSwaps.insert(swap);
|
||||
}
|
||||
}
|
||||
@@ -27993,6 +27993,8 @@ void Player::SendUpdatePhasing()
|
||||
if (!IsInWorld())
|
||||
return;
|
||||
|
||||
RebuildTerrainSwaps(); // to set default maps swaps
|
||||
|
||||
std::set<uint32> worldAreaSwaps;
|
||||
|
||||
for (uint32 terrain : GetTerrainSwaps())
|
||||
|
||||
@@ -9319,13 +9319,16 @@ void ObjectMgr::LoadTerrainPhaseInfo()
|
||||
|
||||
uint32 phaseId = fields[0].GetUInt32();
|
||||
|
||||
PhaseEntry const* phase = sPhaseStore.LookupEntry(phaseId);
|
||||
if (!phase)
|
||||
// 0 is kept for default map swaps
|
||||
if (phaseId)
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "Phase %u defined in `terrain_phase_info` does not exist, skipped.", phaseId);
|
||||
continue;
|
||||
PhaseEntry const* phase = sPhaseStore.LookupEntry(phaseId);
|
||||
if (!phase)
|
||||
{
|
||||
TC_LOG_ERROR("sql.sql", "Phase %u defined in `terrain_phase_info` does not exist, skipped.", phaseId);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
uint32 terrainSwap = fields[1].GetUInt32();
|
||||
|
||||
_terrainPhaseInfoStore[phaseId].push_back(terrainSwap);
|
||||
|
||||
@@ -488,6 +488,8 @@ bool Map::AddPlayerToMap(Player* player)
|
||||
player->m_clientGUIDs.clear();
|
||||
player->UpdateObjectVisibility(false);
|
||||
|
||||
player->SendUpdatePhasing();
|
||||
|
||||
sScriptMgr->OnPlayerEnterMap(this, player);
|
||||
return true;
|
||||
}
|
||||
@@ -548,10 +550,6 @@ bool Map::AddToMap(T* obj)
|
||||
|
||||
obj->RebuildTerrainSwaps();
|
||||
|
||||
// packets are only sent to players
|
||||
if (obj->GetTypeId() == TYPEID_PLAYER)
|
||||
obj->ToPlayer()->SendUpdatePhasing();
|
||||
|
||||
//something, such as vehicle, needs to be update immediately
|
||||
//also, trigger needs to cast spell, if not update, cannot see visual
|
||||
obj->UpdateObjectVisibility(true);
|
||||
|
||||
Reference in new issue
Block a user