mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-15 10:00:28 +00:00
Core/Misc: add support to calculate zoneId/areaId for creatures & gameojects (#1226)
This commit is contained in:
@@ -1780,6 +1780,20 @@ void ObjectMgr::LoadCreatures()
|
||||
data.phaseMask = 1;
|
||||
}
|
||||
|
||||
if (sWorld->getBoolConfig(CONFIG_CALCULATE_CREATURE_ZONE_AREA_DATA))
|
||||
{
|
||||
uint32 zoneId = sMapMgr->GetZoneId(data.mapid, data.posX, data.posY, data.posZ);
|
||||
uint32 areaId = sMapMgr->GetAreaId(data.mapid, data.posX, data.posY, data.posZ);
|
||||
|
||||
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_CREATURE_ZONE_AREA_DATA);
|
||||
|
||||
stmt->setUInt32(0, zoneId);
|
||||
stmt->setUInt32(1, areaId);
|
||||
stmt->setUInt64(2, guid);
|
||||
|
||||
WorldDatabase.Execute(stmt);
|
||||
}
|
||||
|
||||
// Add to grid if not managed by the game event or pool system
|
||||
if (gameEvent == 0 && PoolId == 0)
|
||||
AddCreatureToGrid(guid, &data);
|
||||
@@ -2102,6 +2116,20 @@ void ObjectMgr::LoadGameobjects()
|
||||
data.phaseMask = 1;
|
||||
}
|
||||
|
||||
if (sWorld->getBoolConfig(CONFIG_CALCULATE_GAMEOBJECT_ZONE_AREA_DATA))
|
||||
{
|
||||
uint32 zoneId = sMapMgr->GetZoneId(data.mapid, data.posX, data.posY, data.posZ);
|
||||
uint32 areaId = sMapMgr->GetAreaId(data.mapid, data.posX, data.posY, data.posZ);
|
||||
|
||||
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_GAMEOBJECT_ZONE_AREA_DATA);
|
||||
|
||||
stmt->setUInt32(0, zoneId);
|
||||
stmt->setUInt32(1, areaId);
|
||||
stmt->setUInt64(2, guid);
|
||||
|
||||
WorldDatabase.Execute(stmt);
|
||||
}
|
||||
|
||||
if (gameEvent == 0 && PoolId == 0) // if not this is to be managed by GameEvent System or Pool system
|
||||
AddGameobjectToGrid(guid, &data);
|
||||
++count;
|
||||
|
||||
Reference in New Issue
Block a user