diff options
Diffstat (limited to 'src/game/ObjectMgr.cpp')
-rw-r--r-- | src/game/ObjectMgr.cpp | 54 |
1 files changed, 48 insertions, 6 deletions
diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 39220b87f75..9203436f527 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -1129,8 +1129,8 @@ void ObjectMgr::LoadCreatures() QueryResult *result = WorldDatabase.Query("SELECT creature.guid, id, map, modelid," // 4 5 6 7 8 9 10 11 "equipment_id, position_x, position_y, position_z, orientation, spawntimesecs, spawndist, currentwaypoint," - // 12 13 14 15 16 17 - "curhealth, curmana, DeathState, MovementType, spawnMask, event " + // 12 13 14 15 16 17 18 + "curhealth, curmana, DeathState, MovementType, spawnMask, phaseMask, event " "FROM creature LEFT OUTER JOIN game_event_creature ON creature.guid = game_event_creature.guid"); if(!result) @@ -1178,7 +1178,8 @@ void ObjectMgr::LoadCreatures() data.is_dead = fields[14].GetBool(); data.movementType = fields[15].GetUInt8(); data.spawnMask = fields[16].GetUInt8(); - int16 gameEvent = fields[17].GetInt16(); + data.phaseMask = fields[17].GetUInt16(); + int16 gameEvent = fields[18].GetInt16(); CreatureInfo const* cInfo = GetCreatureTemplate(data.id); if(!cInfo) @@ -1236,6 +1237,40 @@ void ObjectMgr::LoadCreatures() } } + if(data.phaseMask==0) + { + sLog.outErrorDb("Table `creature` have creature (GUID: %u Entry: %u) with `phaseMask`=0 (not visible for anyone), set to 1.",guid,data.id ); + data.phaseMask = 1; + } + else + { + int count = 0; + for(int i=0; i < sizeof(data.phaseMask)*8; ++i) + if(data.phaseMask & (1 << i)) + ++count; + + if(count > 1) + { + uint32 phaseMask = data.phaseMask & ~PHASEMASK_NORMAL; + count = 0; + for(int i=0; i < sizeof(phaseMask)*8; ++i) + if(phaseMask & (1 << i)) + ++count; + + if(count > 1) + { + sLog.outErrorDb("Table `creature` have creature (GUID: %u Entry: %u) with more single bit set in `phaseMask` (not visible for anyone), set to 1.",guid,data.id ); + data.phaseMask = phaseMask; + } + else + { + sLog.outErrorDb("Table `creature` have creature (GUID: %u Entry: %u) with more single bit set in `phaseMask` (not visible for anyone), set to %u (possible expected).",guid,data.id,phaseMask); + data.phaseMask = 1; + } + + } + } + if (gameEvent==0) // if not this is to be managed by GameEvent System AddCreatureToGrid(guid, &data); ++count; @@ -1286,8 +1321,8 @@ void ObjectMgr::LoadGameobjects() // 0 1 2 3 4 5 6 QueryResult *result = WorldDatabase.Query("SELECT gameobject.guid, id, map, position_x, position_y, position_z, orientation," - // 7 8 9 10 11 12 13 14 15 - "rotation0, rotation1, rotation2, rotation3, spawntimesecs, animprogress, state, spawnMask, event " + // 7 8 9 10 11 12 13 14 15 16 + "rotation0, rotation1, rotation2, rotation3, spawntimesecs, animprogress, state, spawnMask, phaseMask, event " "FROM gameobject LEFT OUTER JOIN game_event_gameobject ON gameobject.guid = game_event_gameobject.guid"); if(!result) @@ -1327,7 +1362,8 @@ void ObjectMgr::LoadGameobjects() data.go_state = fields[13].GetUInt32(); data.ArtKit = 0; data.spawnMask = fields[14].GetUInt8(); - int16 gameEvent = fields[15].GetInt16(); + data.phaseMask = fields[15].GetUInt16(); + int16 gameEvent = fields[16].GetInt16(); GameObjectInfo const* gInfo = GetGameObjectInfo(data.id); if(!gInfo) @@ -1336,6 +1372,12 @@ void ObjectMgr::LoadGameobjects() continue; } + if(data.phaseMask==0) + { + sLog.outErrorDb("Table `gameobject` have gameobject (GUID: %u Entry: %u) with `phaseMask`=0 (not visible for anyone), set to 1.",guid,data.id ); + data.phaseMask = 1; + } + if (gameEvent==0) // if not this is to be managed by GameEvent System AddGameobjectToGrid(guid, &data); ++count; |