mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
[7995] Check display id correctness for creature and gameobjects.
This commit is contained in:
parent
7677a61c6f
commit
7218530489
6 changed files with 62 additions and 3 deletions
|
|
@ -551,6 +551,34 @@ void ObjectMgr::LoadCreatureTemplates()
|
|||
if(!factionTemplate)
|
||||
sLog.outErrorDb("Creature (Entry: %u) has non-existing faction_H template (%u)", cInfo->Entry, cInfo->faction_H);
|
||||
|
||||
// used later for scale
|
||||
CreatureDisplayInfoEntry const* displayEntryA = cInfo->DisplayID_A ? sCreatureDisplayInfoStore.LookupEntry(cInfo->DisplayID_A) : NULL;
|
||||
if(cInfo->DisplayID_A && !displayEntryA)
|
||||
sLog.outErrorDb("Creature (Entry: %u) has non-existing DisplayID_A id (%u), can crash client", cInfo->Entry, cInfo->DisplayID_A);
|
||||
|
||||
if(cInfo->DisplayID_A2)
|
||||
{
|
||||
if(CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(cInfo->DisplayID_A2))
|
||||
{
|
||||
sLog.outErrorDb("Creature (Entry: %u) has non-existing DisplayID_A2 id (%u), can crash client", cInfo->Entry, cInfo->DisplayID_A2);
|
||||
const_cast<CreatureInfo*>(cInfo)->DisplayID_A2 = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// used later for scale
|
||||
CreatureDisplayInfoEntry const* displayEntryH = cInfo->DisplayID_H ? sCreatureDisplayInfoStore.LookupEntry(cInfo->DisplayID_H) : NULL;
|
||||
if(cInfo->DisplayID_H && !displayEntryH)
|
||||
sLog.outErrorDb("Creature (Entry: %u) has non-existing DisplayID_H id (%u), can crash client", cInfo->Entry, cInfo->DisplayID_H);
|
||||
|
||||
if(cInfo->DisplayID_H2)
|
||||
{
|
||||
if(CreatureDisplayInfoEntry const* displayEntry = sCreatureDisplayInfoStore.LookupEntry(cInfo->DisplayID_H2))
|
||||
{
|
||||
sLog.outErrorDb("Creature (Entry: %u) has non-existing DisplayID_H2 id (%u), can crash client", cInfo->Entry, cInfo->DisplayID_H2);
|
||||
const_cast<CreatureInfo*>(cInfo)->DisplayID_H2 = 0;
|
||||
}
|
||||
}
|
||||
|
||||
CreatureModelInfo const* minfo = sCreatureModelStorage.LookupEntry<CreatureModelInfo>(cInfo->DisplayID_A);
|
||||
if (!minfo)
|
||||
sLog.outErrorDb("Creature (Entry: %u) has non-existing modelId_A (%u)", cInfo->Entry, cInfo->DisplayID_A);
|
||||
|
|
@ -629,8 +657,12 @@ void ObjectMgr::LoadCreatureTemplates()
|
|||
/// if not set custom creature scale then load scale from CreatureDisplayInfo.dbc
|
||||
if(cInfo->scale <= 0.0f)
|
||||
{
|
||||
CreatureDisplayInfoEntry const* ScaleEntry = sCreatureDisplayInfoStore.LookupEntry(cInfo->DisplayID_A);
|
||||
const_cast<CreatureInfo*>(cInfo)->scale = ScaleEntry ? ScaleEntry->scale : 1.0f;
|
||||
if(displayEntryA)
|
||||
const_cast<CreatureInfo*>(cInfo)->scale = displayEntryA->scale;
|
||||
else if(displayEntryH)
|
||||
const_cast<CreatureInfo*>(cInfo)->scale = displayEntryH->scale;
|
||||
else
|
||||
const_cast<CreatureInfo*>(cInfo)->scale = 1.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -727,7 +759,10 @@ void ObjectMgr::LoadCreatureAddons()
|
|||
if (addon->mount)
|
||||
{
|
||||
if (!sCreatureDisplayInfoStore.LookupEntry(addon->mount))
|
||||
{
|
||||
sLog.outErrorDb("Creature (Entry %u) have invalid displayInfoId for mount (%u) defined in `creature_template_addon`.",addon->guidOrEntry, addon->mount);
|
||||
const_cast<CreatureDataAddon*>(addon)->mount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!sEmotesStore.LookupEntry(addon->emote))
|
||||
|
|
@ -754,7 +789,10 @@ void ObjectMgr::LoadCreatureAddons()
|
|||
if (addon->mount)
|
||||
{
|
||||
if (!sCreatureDisplayInfoStore.LookupEntry(addon->mount))
|
||||
{
|
||||
sLog.outErrorDb("Creature (GUID %u) have invalid displayInfoId for mount (%u) defined in `creature_addon`.",addon->guidOrEntry, addon->mount);
|
||||
const_cast<CreatureDataAddon*>(addon)->mount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!sEmotesStore.LookupEntry(addon->emote))
|
||||
|
|
@ -1084,6 +1122,12 @@ void ObjectMgr::LoadGameobjects()
|
|||
continue;
|
||||
}
|
||||
|
||||
if(gInfo->displayId && !sGameObjectDisplayInfoStore.LookupEntry(gInfo->displayId))
|
||||
{
|
||||
sLog.outErrorDb("Gameobject (GUID: %u Entry %u GoType: %u) have invalid displayId (%u), not loaded.",guid, entry, gInfo->type, gInfo->displayId);
|
||||
continue;
|
||||
}
|
||||
|
||||
GameObjectData& data = mGameObjectDataMap[guid];
|
||||
|
||||
data.id = entry;
|
||||
|
|
@ -5581,6 +5625,8 @@ void ObjectMgr::LoadGameobjectInfo()
|
|||
if (!goInfo)
|
||||
continue;
|
||||
|
||||
// some GO types have unused go template, check goInfo->displayId at GO spawn data loading or ignore
|
||||
|
||||
switch(goInfo->type)
|
||||
{
|
||||
case GAMEOBJECT_TYPE_DOOR: //0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue