aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Globals/ObjectMgr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/Globals/ObjectMgr.cpp')
-rw-r--r--src/server/game/Globals/ObjectMgr.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index 49049356fe0..c00a8ce4083 100644
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -1782,6 +1782,21 @@ void ObjectMgr::LoadCreatures()
data.phaseGroup = 0;
}
+ if (sWorld->getBoolConfig(CONFIG_CALCULATE_CREATURE_ZONE_AREA_DATA))
+ {
+ uint32 zoneId = 0;
+ uint32 areaId = 0;
+ sMapMgr->GetZoneAndAreaId(zoneId, areaId, 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);
@@ -2105,6 +2120,21 @@ void ObjectMgr::LoadGameobjects()
data.phaseMask = 1;
}
+ if (sWorld->getBoolConfig(CONFIG_CALCULATE_GAMEOBJECT_ZONE_AREA_DATA))
+ {
+ uint32 zoneId = 0;
+ uint32 areaId = 0;
+ sMapMgr->GetZoneAndAreaId(zoneId, areaId, 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;