mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 19:37:03 +00:00
[11217] Drop effect indexes from *_addon.auras field
This commit is contained in:
parent
5a3f557b19
commit
02c1bc6557
7 changed files with 83 additions and 47 deletions
|
|
@ -753,7 +753,7 @@ void ObjectMgr::LoadCreatureTemplates()
|
|||
|
||||
void ObjectMgr::ConvertCreatureAddonAuras(CreatureDataAddon* addon, char const* table, char const* guidEntryStr)
|
||||
{
|
||||
// Now add the auras, format "spellid effectindex spellid effectindex..."
|
||||
// Now add the auras, format "spell1 spell2 ..."
|
||||
char *p,*s;
|
||||
std::vector<int> val;
|
||||
s=p=(char*)reinterpret_cast<char const*>(addon->auras);
|
||||
|
|
@ -773,14 +773,6 @@ void ObjectMgr::ConvertCreatureAddonAuras(CreatureDataAddon* addon, char const*
|
|||
|
||||
// free char* loaded memory
|
||||
delete[] (char*)reinterpret_cast<char const*>(addon->auras);
|
||||
|
||||
// wrong list
|
||||
if (val.size()%2)
|
||||
{
|
||||
addon->auras = NULL;
|
||||
sLog.outErrorDb("Creature (%s: %u) has wrong `auras` data in `%s`.",guidEntryStr,addon->guidOrEntry,table);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// empty list
|
||||
|
|
@ -791,19 +783,14 @@ void ObjectMgr::ConvertCreatureAddonAuras(CreatureDataAddon* addon, char const*
|
|||
}
|
||||
|
||||
// replace by new structures array
|
||||
const_cast<CreatureDataAddonAura*&>(addon->auras) = new CreatureDataAddonAura[val.size()/2+1];
|
||||
const_cast<CreatureDataAddonAura*&>(addon->auras) = new CreatureDataAddonAura[val.size()+1];
|
||||
|
||||
uint32 i=0;
|
||||
for(uint32 j = 0; j < val.size()/2; ++j)
|
||||
uint32 i = 0;
|
||||
for(uint32 j = 0; j < val.size(); ++j)
|
||||
{
|
||||
CreatureDataAddonAura& cAura = const_cast<CreatureDataAddonAura&>(addon->auras[i]);
|
||||
cAura.spell_id = uint32(val[2*j+0]);
|
||||
cAura.effect_idx = SpellEffectIndex(val[2*j+1]);
|
||||
if (cAura.effect_idx >= MAX_EFFECT_INDEX)
|
||||
{
|
||||
sLog.outErrorDb("Creature (%s: %u) has wrong effect %u for spell %u in `auras` field in `%s`.",guidEntryStr,addon->guidOrEntry,cAura.effect_idx,cAura.spell_id,table);
|
||||
continue;
|
||||
}
|
||||
cAura.spell_id = uint32(val[j]);
|
||||
|
||||
SpellEntry const *AdditionalSpellInfo = sSpellStore.LookupEntry(cAura.spell_id);
|
||||
if (!AdditionalSpellInfo)
|
||||
{
|
||||
|
|
@ -811,9 +798,9 @@ void ObjectMgr::ConvertCreatureAddonAuras(CreatureDataAddon* addon, char const*
|
|||
continue;
|
||||
}
|
||||
|
||||
if (!AdditionalSpellInfo->Effect[cAura.effect_idx] || !AdditionalSpellInfo->EffectApplyAuraName[cAura.effect_idx])
|
||||
if (!IsSpellAppliesAura(AdditionalSpellInfo))
|
||||
{
|
||||
sLog.outErrorDb("Creature (%s: %u) has not aura effect %u of spell %u defined in `auras` field in `%s`.",guidEntryStr,addon->guidOrEntry,cAura.effect_idx,cAura.spell_id,table);
|
||||
sLog.outErrorDb("Creature (%s: %u) has spell %u defined in `auras` field in `%s` but spell doesn't apply any auras.", guidEntryStr, addon->guidOrEntry, cAura.spell_id, table);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -822,8 +809,7 @@ void ObjectMgr::ConvertCreatureAddonAuras(CreatureDataAddon* addon, char const*
|
|||
|
||||
// fill terminator element (after last added)
|
||||
CreatureDataAddonAura& endAura = const_cast<CreatureDataAddonAura&>(addon->auras[i]);
|
||||
endAura.spell_id = 0;
|
||||
endAura.effect_idx = EFFECT_INDEX_0;
|
||||
endAura.spell_id = 0;
|
||||
}
|
||||
|
||||
void ObjectMgr::LoadCreatureAddons(SQLStorage& creatureaddons, char const* entryName, char const* comment)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue