diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index 6f0012f8b..3e4551835 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -1943,19 +1943,19 @@ bool Creature::LoadCreatureAddon(bool reload) 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) { - 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; } - if (HasAura(cAura->spell_id)) + if (HasAura(*cAura)) { - if(!reload) - sLog.outErrorDb("Creature (GUIDLow: %u Entry: %u) has duplicate spell %u in `auras` field.", GetGUIDLow(), GetEntry(), cAura->spell_id); + if (!reload) + sLog.outErrorDb("Creature (GUIDLow: %u Entry: %u) has duplicate spell %u in `auras` field.", GetGUIDLow(), GetEntry(), *cAura); continue; } diff --git a/src/game/Creature.h b/src/game/Creature.h index bf290d10c..f8c8c568b 100644 --- a/src/game/Creature.h +++ b/src/game/Creature.h @@ -205,11 +205,6 @@ struct CreatureData ObjectGuid GetObjectGuid(uint32 lowguid) const { return ObjectGuid(GetHighGuid(), id, lowguid); } }; -struct CreatureDataAddonAura -{ - uint32 spell_id; -}; - // from `creature_addon` and `creature_template_addon`tables struct CreatureDataAddon { @@ -220,7 +215,7 @@ struct CreatureDataAddon uint8 pvp_state; // UnitPVPStateFlags uint32 emote; uint32 splineFlags; - CreatureDataAddonAura const* auras; // loaded as char* "spell1 spell2 ... " + uint32 const* auras; // loaded as char* "spell1 spell2 ... " }; struct CreatureModelInfo diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 2b3d472a5..1c34f0012 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -783,18 +783,24 @@ void ObjectMgr::ConvertCreatureAddonAuras(CreatureDataAddon* addon, char const* } // replace by new structures array - const_cast(addon->auras) = new CreatureDataAddonAura[val.size()+1]; + const_cast(addon->auras) = new uint32[val.size()+1]; uint32 i = 0; for(uint32 j = 0; j < val.size(); ++j) { - CreatureDataAddonAura& cAura = const_cast(addon->auras[i]); - cAura.spell_id = uint32(val[j]); + uint32& cAura = const_cast(addon->auras[i]); + cAura = uint32(val[j]); - SpellEntry const *AdditionalSpellInfo = sSpellStore.LookupEntry(cAura.spell_id); + SpellEntry const *AdditionalSpellInfo = sSpellStore.LookupEntry(cAura); 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; } @@ -802,8 +808,7 @@ void ObjectMgr::ConvertCreatureAddonAuras(CreatureDataAddon* addon, char const* } // fill terminator element (after last added) - CreatureDataAddonAura& endAura = const_cast(addon->auras[i]); - endAura.spell_id = 0; + const_cast(addon->auras[i]) = 0; } void ObjectMgr::LoadCreatureAddons(SQLStorage& creatureaddons, char const* entryName, char const* comment) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index e0d9fce6c..f1dc8b17c 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "11342" + #define REVISION_NR "11343" #endif // __REVISION_NR_H__