mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 10:37:02 +00:00
[11343] Check creature*_addon.auras duplicates at loading.
This already checked at apply to creature but startup check more helpful for DB devs. Also remove use single field structure use for store addon.auras data
This commit is contained in:
parent
695ad4d54e
commit
6c8efb4458
4 changed files with 20 additions and 20 deletions
|
|
@ -1943,19 +1943,19 @@ bool Creature::LoadCreatureAddon(bool reload)
|
||||||
|
|
||||||
if(cainfo->auras)
|
if(cainfo->auras)
|
||||||
{
|
{
|
||||||
for (CreatureDataAddonAura const* cAura = cainfo->auras; cAura->spell_id; ++cAura)
|
for (uint32 const* cAura = cainfo->auras; *cAura; ++cAura)
|
||||||
{
|
{
|
||||||
SpellEntry const *AdditionalSpellInfo = sSpellStore.LookupEntry(cAura->spell_id);
|
SpellEntry const *AdditionalSpellInfo = sSpellStore.LookupEntry(*cAura);
|
||||||
if (!AdditionalSpellInfo)
|
if (!AdditionalSpellInfo)
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Creature (GUIDLow: %u Entry: %u ) has wrong spell %u defined in `auras` field.",GetGUIDLow(),GetEntry(),cAura->spell_id);
|
sLog.outErrorDb("Creature (GUIDLow: %u Entry: %u ) has wrong spell %u defined in `auras` field.",GetGUIDLow(),GetEntry(), *cAura);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HasAura(cAura->spell_id))
|
if (HasAura(*cAura))
|
||||||
{
|
{
|
||||||
if(!reload)
|
if (!reload)
|
||||||
sLog.outErrorDb("Creature (GUIDLow: %u Entry: %u) has duplicate spell %u in `auras` field.", GetGUIDLow(), GetEntry(), cAura->spell_id);
|
sLog.outErrorDb("Creature (GUIDLow: %u Entry: %u) has duplicate spell %u in `auras` field.", GetGUIDLow(), GetEntry(), *cAura);
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -205,11 +205,6 @@ struct CreatureData
|
||||||
ObjectGuid GetObjectGuid(uint32 lowguid) const { return ObjectGuid(GetHighGuid(), id, lowguid); }
|
ObjectGuid GetObjectGuid(uint32 lowguid) const { return ObjectGuid(GetHighGuid(), id, lowguid); }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CreatureDataAddonAura
|
|
||||||
{
|
|
||||||
uint32 spell_id;
|
|
||||||
};
|
|
||||||
|
|
||||||
// from `creature_addon` and `creature_template_addon`tables
|
// from `creature_addon` and `creature_template_addon`tables
|
||||||
struct CreatureDataAddon
|
struct CreatureDataAddon
|
||||||
{
|
{
|
||||||
|
|
@ -220,7 +215,7 @@ struct CreatureDataAddon
|
||||||
uint8 pvp_state; // UnitPVPStateFlags
|
uint8 pvp_state; // UnitPVPStateFlags
|
||||||
uint32 emote;
|
uint32 emote;
|
||||||
uint32 splineFlags;
|
uint32 splineFlags;
|
||||||
CreatureDataAddonAura const* auras; // loaded as char* "spell1 spell2 ... "
|
uint32 const* auras; // loaded as char* "spell1 spell2 ... "
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CreatureModelInfo
|
struct CreatureModelInfo
|
||||||
|
|
|
||||||
|
|
@ -783,18 +783,24 @@ void ObjectMgr::ConvertCreatureAddonAuras(CreatureDataAddon* addon, char const*
|
||||||
}
|
}
|
||||||
|
|
||||||
// replace by new structures array
|
// replace by new structures array
|
||||||
const_cast<CreatureDataAddonAura*&>(addon->auras) = new CreatureDataAddonAura[val.size()+1];
|
const_cast<uint32*&>(addon->auras) = new uint32[val.size()+1];
|
||||||
|
|
||||||
uint32 i = 0;
|
uint32 i = 0;
|
||||||
for(uint32 j = 0; j < val.size(); ++j)
|
for(uint32 j = 0; j < val.size(); ++j)
|
||||||
{
|
{
|
||||||
CreatureDataAddonAura& cAura = const_cast<CreatureDataAddonAura&>(addon->auras[i]);
|
uint32& cAura = const_cast<uint32&>(addon->auras[i]);
|
||||||
cAura.spell_id = uint32(val[j]);
|
cAura = uint32(val[j]);
|
||||||
|
|
||||||
SpellEntry const *AdditionalSpellInfo = sSpellStore.LookupEntry(cAura.spell_id);
|
SpellEntry const *AdditionalSpellInfo = sSpellStore.LookupEntry(cAura);
|
||||||
if (!AdditionalSpellInfo)
|
if (!AdditionalSpellInfo)
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Creature (%s: %u) has wrong spell %u defined in `auras` field in `%s`.",guidEntryStr,addon->guidOrEntry,cAura.spell_id,table);
|
sLog.outErrorDb("Creature (%s: %u) has wrong spell %u defined in `auras` field in `%s`.", guidEntryStr, addon->guidOrEntry, cAura,table);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (std::find(&addon->auras[0], &addon->auras[i], cAura) != &addon->auras[i])
|
||||||
|
{
|
||||||
|
sLog.outErrorDb("Creature (%s: %u) has duplicate spell %u defined in `auras` field in `%s`.", guidEntryStr, addon->guidOrEntry, cAura, table);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -802,8 +808,7 @@ void ObjectMgr::ConvertCreatureAddonAuras(CreatureDataAddon* addon, char const*
|
||||||
}
|
}
|
||||||
|
|
||||||
// fill terminator element (after last added)
|
// fill terminator element (after last added)
|
||||||
CreatureDataAddonAura& endAura = const_cast<CreatureDataAddonAura&>(addon->auras[i]);
|
const_cast<uint32&>(addon->auras[i]) = 0;
|
||||||
endAura.spell_id = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectMgr::LoadCreatureAddons(SQLStorage& creatureaddons, char const* entryName, char const* comment)
|
void ObjectMgr::LoadCreatureAddons(SQLStorage& creatureaddons, char const* entryName, char const* comment)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "11342"
|
#define REVISION_NR "11343"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue