mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +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
|
|
@ -64,6 +64,7 @@ static FactionTeamMap sFactionTeamMap;
|
|||
DBCStorage <FactionEntry> sFactionStore(FactionEntryfmt);
|
||||
DBCStorage <FactionTemplateEntry> sFactionTemplateStore(FactionTemplateEntryfmt);
|
||||
|
||||
DBCStorage <GameObjectDisplayInfoEntry> sGameObjectDisplayInfoStore(GameObjectDisplayInfofmt);
|
||||
DBCStorage <GemPropertiesEntry> sGemPropertiesStore(GemPropertiesEntryfmt);
|
||||
DBCStorage <GlyphPropertiesEntry> sGlyphPropertiesStore(GlyphPropertiesfmt);
|
||||
DBCStorage <GlyphSlotEntry> sGlyphSlotStore(GlyphSlotfmt);
|
||||
|
|
@ -258,6 +259,7 @@ void LoadDBCStores(const std::string& dataPath)
|
|||
}
|
||||
|
||||
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sFactionTemplateStore, dbcPath,"FactionTemplate.dbc");
|
||||
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sGameObjectDisplayInfoStore,dbcPath,"GameObjectDisplayInfo.dbc");
|
||||
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sGemPropertiesStore, dbcPath,"GemProperties.dbc");
|
||||
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sGlyphPropertiesStore, dbcPath,"GlyphProperties.dbc");
|
||||
LoadDBC(availableDbcLocales,bar,bad_dbc_files,sGlyphSlotStore, dbcPath,"GlyphSlot.dbc");
|
||||
|
|
|
|||
|
|
@ -82,6 +82,7 @@ extern DBCStorage <EmotesEntry> sEmotesStore;
|
|||
extern DBCStorage <EmotesTextEntry> sEmotesTextStore;
|
||||
extern DBCStorage <FactionEntry> sFactionStore;
|
||||
extern DBCStorage <FactionTemplateEntry> sFactionTemplateStore;
|
||||
extern DBCStorage <GameObjectDisplayInfoEntry> sGameObjectDisplayInfoStore;
|
||||
extern DBCStorage <GemPropertiesEntry> sGemPropertiesStore;
|
||||
extern DBCStorage <GlyphPropertiesEntry> sGlyphPropertiesStore;
|
||||
extern DBCStorage <GlyphSlotEntry> sGlyphSlotStore;
|
||||
|
|
|
|||
|
|
@ -834,6 +834,15 @@ struct FactionTemplateEntry
|
|||
bool IsContestedGuardFaction() const { return (factionFlags & FACTION_TEMPLATE_FLAG_CONTESTED_GUARD)!=0; }
|
||||
};
|
||||
|
||||
struct GameObjectDisplayInfoEntry
|
||||
{
|
||||
uint32 Displayid; // 0 m_ID
|
||||
// char* filename; // 1
|
||||
// uint32 unknown2[10]; // 2-11 unknown data
|
||||
// float unknown12[6]; // 12-17 unknown data
|
||||
// uint32 unknown18; // 18 unknown data
|
||||
};
|
||||
|
||||
struct GemPropertiesEntry
|
||||
{
|
||||
uint32 ID;
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ const char EmotesEntryfmt[]="nxxiiix";
|
|||
const char EmotesTextEntryfmt[]="nxixxxxxxxxxxxxxxxx";
|
||||
const char FactionEntryfmt[]="niiiiiiiiiiiiiiiiiissssssssssssssssxxxxxxxxxxxxxxxxxx";
|
||||
const char FactionTemplateEntryfmt[]="niiiiiiiiiiiii";
|
||||
const char GameObjectDisplayInfofmt[]="nxxxxxxxxxxxxxxxxxx";
|
||||
const char GemPropertiesEntryfmt[]="nixxi";
|
||||
const char GlyphPropertiesfmt[]="niii";
|
||||
const char GlyphSlotfmt[]="nii";
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "7994"
|
||||
#define REVISION_NR "7995"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue