mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
[7207] Phase system development continue for DB/in_game objects
* Store phase mask for creatures/gameobjects/corpse in DB * Propertly set phase for summoned creatures/gameobjects/pets/corpses/spell related dynobjects * Select proper phase for spawned creature/gameobjects and save it in DB TODO: in game commands.
This commit is contained in:
parent
b5da610388
commit
aa24bd836e
29 changed files with 204 additions and 82 deletions
|
|
@ -1042,8 +1042,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)
|
||||
|
|
@ -1091,7 +1091,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)
|
||||
|
|
@ -1149,6 +1150,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;
|
||||
|
|
@ -1199,8 +1234,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)
|
||||
|
|
@ -1239,7 +1274,8 @@ void ObjectMgr::LoadGameobjects()
|
|||
data.animprogress = fields[12].GetUInt32();
|
||||
data.go_state = fields[13].GetUInt32();
|
||||
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)
|
||||
|
|
@ -1248,6 +1284,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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue