mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
Implemented gameobjects and creatures grouping (pools of them)
Groups (called pools) can be also member of any game event Signed-off-by: Neo2003 <neo.2003@hotmail.fr> Signed-off-by: freghar <compmancz@gmail.com>
This commit is contained in:
parent
1932ce1ae7
commit
7d8dc0eeef
14 changed files with 879 additions and 39 deletions
|
|
@ -849,9 +849,10 @@ 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 18
|
||||
"curhealth, curmana, DeathState, MovementType, spawnMask, phaseMask, event "
|
||||
"FROM creature LEFT OUTER JOIN game_event_creature ON creature.guid = game_event_creature.guid");
|
||||
// 12 13 14 15 16 17 18 19
|
||||
"curhealth, curmana, DeathState, MovementType, spawnMask, phaseMask, event, pool_entry "
|
||||
"FROM creature LEFT OUTER JOIN game_event_creature ON creature.guid = game_event_creature.guid "
|
||||
"LEFT OUTER JOIN pool_creature ON creature.guid = pool_creature.guid");
|
||||
|
||||
if(!result)
|
||||
{
|
||||
|
|
@ -878,11 +879,19 @@ void ObjectMgr::LoadCreatures()
|
|||
Field *fields = result->Fetch();
|
||||
bar.step();
|
||||
|
||||
uint32 guid = fields[0].GetUInt32();
|
||||
uint32 guid = fields[ 0].GetUInt32();
|
||||
uint32 entry = fields[ 1].GetUInt32();
|
||||
|
||||
CreatureInfo const* cInfo = GetCreatureTemplate(entry);
|
||||
if(!cInfo)
|
||||
{
|
||||
sLog.outErrorDb("Table `creature` has creature (GUID: %u) with non existing creature entry %u, skipped.", guid, entry);
|
||||
continue;
|
||||
}
|
||||
|
||||
CreatureData& data = mCreatureDataMap[guid];
|
||||
|
||||
data.id = fields[ 1].GetUInt32();
|
||||
data.id = entry;
|
||||
data.mapid = fields[ 2].GetUInt32();
|
||||
data.displayid = fields[ 3].GetUInt32();
|
||||
data.equipmentId = fields[ 4].GetUInt32();
|
||||
|
|
@ -900,13 +909,7 @@ void ObjectMgr::LoadCreatures()
|
|||
data.spawnMask = fields[16].GetUInt8();
|
||||
data.phaseMask = fields[17].GetUInt16();
|
||||
int16 gameEvent = fields[18].GetInt16();
|
||||
|
||||
CreatureInfo const* cInfo = GetCreatureTemplate(data.id);
|
||||
if(!cInfo)
|
||||
{
|
||||
sLog.outErrorDb("Table `creature` have creature (GUID: %u) with not existed creature entry %u, skipped.",guid,data.id );
|
||||
continue;
|
||||
}
|
||||
int16 PoolId = fields[19].GetInt16();
|
||||
|
||||
if(heroicCreatures.find(data.id)!=heroicCreatures.end())
|
||||
{
|
||||
|
|
@ -991,7 +994,7 @@ void ObjectMgr::LoadCreatures()
|
|||
}
|
||||
}
|
||||
|
||||
if (gameEvent==0) // if not this is to be managed by GameEvent System
|
||||
if (gameEvent==0 && PoolId==0) // if not this is to be managed by GameEvent System or Pool system
|
||||
AddCreatureToGrid(guid, &data);
|
||||
++count;
|
||||
|
||||
|
|
@ -1041,9 +1044,10 @@ 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 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");
|
||||
// 7 8 9 10 11 12 13 14 15 16 17
|
||||
"rotation0, rotation1, rotation2, rotation3, spawntimesecs, animprogress, state, spawnMask, phaseMask, event, pool_entry "
|
||||
"FROM gameobject LEFT OUTER JOIN game_event_gameobject ON gameobject.guid = game_event_gameobject.guid "
|
||||
"LEFT OUTER JOIN pool_gameobject ON gameobject.guid = pool_gameobject.guid");
|
||||
|
||||
if(!result)
|
||||
{
|
||||
|
|
@ -1063,11 +1067,19 @@ void ObjectMgr::LoadGameobjects()
|
|||
Field *fields = result->Fetch();
|
||||
bar.step();
|
||||
|
||||
uint32 guid = fields[0].GetUInt32();
|
||||
uint32 guid = fields[ 0].GetUInt32();
|
||||
uint32 entry = fields[ 1].GetUInt32();
|
||||
|
||||
GameObjectInfo const* gInfo = GetGameObjectInfo(entry);
|
||||
if(!gInfo)
|
||||
{
|
||||
sLog.outErrorDb("Table `gameobject` has gameobject (GUID: %u) with non existing gameobject entry %u, skipped.", guid, entry);
|
||||
continue;
|
||||
}
|
||||
|
||||
GameObjectData& data = mGameObjectDataMap[guid];
|
||||
|
||||
data.id = fields[ 1].GetUInt32();
|
||||
data.id = entry;
|
||||
data.mapid = fields[ 2].GetUInt32();
|
||||
data.posX = fields[ 3].GetFloat();
|
||||
data.posY = fields[ 4].GetFloat();
|
||||
|
|
@ -1083,13 +1095,7 @@ void ObjectMgr::LoadGameobjects()
|
|||
data.spawnMask = fields[14].GetUInt8();
|
||||
data.phaseMask = fields[15].GetUInt16();
|
||||
int16 gameEvent = fields[16].GetInt16();
|
||||
|
||||
GameObjectInfo const* gInfo = GetGameObjectInfo(data.id);
|
||||
if(!gInfo)
|
||||
{
|
||||
sLog.outErrorDb("Table `gameobject` have gameobject (GUID: %u) with not existed gameobject entry %u, skipped.",guid,data.id );
|
||||
continue;
|
||||
}
|
||||
int16 PoolId = fields[17].GetInt16();
|
||||
|
||||
if(data.phaseMask==0)
|
||||
{
|
||||
|
|
@ -1097,7 +1103,7 @@ void ObjectMgr::LoadGameobjects()
|
|||
data.phaseMask = 1;
|
||||
}
|
||||
|
||||
if (gameEvent==0) // if not this is to be managed by GameEvent System
|
||||
if (gameEvent==0 && PoolId==0) // if not this is to be managed by GameEvent System or Pool system
|
||||
AddGameobjectToGrid(guid, &data);
|
||||
++count;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue