Core/Objects: Added new error log for bad phaseId/phaseGroup in creature/gameobject table

This commit is contained in:
Vincent-Michael
2015-05-02 18:01:40 +02:00
parent fc7014628a
commit b56ab5d438

View File

@@ -1746,8 +1746,8 @@ void ObjectMgr::LoadCreatures()
data.npcflag = fields[18].GetUInt32();
data.unit_flags = fields[19].GetUInt32();
data.dynamicflags = fields[20].GetUInt32();
data.phaseid = fields[21].GetUInt32();
data.phaseGroup = fields[22].GetUInt32();
data.phaseid = fields[21].GetUInt32();
data.phaseGroup = fields[22].GetUInt32();
MapEntry const* mapEntry = sMapStore.LookupEntry(data.mapid);
if (!mapEntry)
@@ -1825,6 +1825,25 @@ void ObjectMgr::LoadCreatures()
data.phaseGroup = 0;
}
if (data.phaseid)
{
PhaseEntry const* phase = sPhaseStore.LookupEntry(data.phaseid);
if (!phase)
{
TC_LOG_ERROR("sql.sql", "Table `creature` have creature (GUID: " UI64FMTD " Entry: %u) with `phaseid` %u does not exist, set to 0", guid, data.id, data.phaseid);
data.phaseid = 0;
}
}
if (data.phaseGroup)
{
if (sDB2Manager.GetPhasesForGroup(data.phaseGroup).empty())
{
TC_LOG_ERROR("sql.sql", "Table `creature` have creature (GUID: " UI64FMTD " Entry: %u) with `phasegroup` %u does not exist, set to 0", guid, data.id, data.phaseGroup);
data.phaseGroup = 0;
}
}
if (sWorld->getBoolConfig(CONFIG_CALCULATE_CREATURE_ZONE_AREA_DATA))
{
uint32 zoneId = 0;
@@ -2084,8 +2103,8 @@ void ObjectMgr::LoadGameobjects()
int16 gameEvent = fields[15].GetInt8();
uint32 PoolId = fields[16].GetUInt32();
data.phaseid = fields[17].GetUInt32();
data.phaseGroup = fields[18].GetUInt32();
data.phaseid = fields[17].GetUInt32();
data.phaseGroup = fields[18].GetUInt32();
if (data.phaseGroup && data.phaseid)
{
@@ -2093,6 +2112,25 @@ void ObjectMgr::LoadGameobjects()
data.phaseGroup = 0;
}
if (data.phaseid)
{
PhaseEntry const* phase = sPhaseStore.LookupEntry(data.phaseid);
if (!phase)
{
TC_LOG_ERROR("sql.sql", "Table `gameobject` have gameobject (GUID: " UI64FMTD " Entry: %u) with `phaseid` %u does not exist, set to 0", guid, data.id, data.phaseid);
data.phaseid = 0;
}
}
if (data.phaseGroup)
{
if (sDB2Manager.GetPhasesForGroup(data.phaseGroup).empty())
{
TC_LOG_ERROR("sql.sql", "Table `gameobject` have gameobject (GUID: " UI64FMTD " Entry: %u) with `phaseGroup` %u does not exist, set to 0", guid, data.id, data.phaseGroup);
data.phaseGroup = 0;
}
}
if (std::abs(data.orientation) > 2 * float(M_PI))
{
TC_LOG_ERROR("sql.sql", "Table `gameobject` has gameobject (GUID: " UI64FMTD " Entry: %u) with abs(`orientation`) > 2*PI (orientation is expressed in radians), normalized.", guid, data.id);