fix(Core/Spell): Add additional check to LoadSpellScripts() (#7860)

This commit is contained in:
Kitzunu
2021-09-20 12:33:59 +02:00
committed by GitHub
parent e2dd6b2bd8
commit 0a5fbfdfcf

View File

@@ -5132,10 +5132,15 @@ void ObjectMgr::LoadSpellScripts()
continue;
}
uint8 i = (uint8)((uint32(itr->first) >> 24) & 0x000000FF);
SpellEffIndex i = SpellEffIndex((uint32(itr->first) >> 24) & 0x000000FF);
if (uint32(i) >= MAX_SPELL_EFFECTS)
{
LOG_ERROR("sql.sql", "Table `spell_scripts` has too high effect index %u for spell (Id: %u) as script id", uint32(i), spellId);
}
//check for correct spellEffect
if (!spellInfo->Effects[i].Effect || (spellInfo->Effects[i].Effect != SPELL_EFFECT_SCRIPT_EFFECT && spellInfo->Effects[i].Effect != SPELL_EFFECT_DUMMY))
LOG_ERROR("sql.sql", "Table `spell_scripts` - spell %u effect %u is not SPELL_EFFECT_SCRIPT_EFFECT or SPELL_EFFECT_DUMMY", spellId, i);
LOG_ERROR("sql.sql", "Table `spell_scripts` - spell %u effect %u is not SPELL_EFFECT_SCRIPT_EFFECT or SPELL_EFFECT_DUMMY", spellId, uint32(i));
}
}