aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/server/game/Conditions/ConditionMgr.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp
index 6274bb04e4f..becbe46aee9 100644
--- a/src/server/game/Conditions/ConditionMgr.cpp
+++ b/src/server/game/Conditions/ConditionMgr.cpp
@@ -2178,15 +2178,24 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) const
{
case CONDITION_AURA:
{
- if (!sSpellMgr->GetSpellInfo(cond->ConditionValue1, DIFFICULTY_NONE))
+ SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(cond->ConditionValue1, DIFFICULTY_NONE);
+ if (!spellInfo)
{
TC_LOG_ERROR("sql.sql", "{} has non existing spell (Id: {}), skipped.", cond->ToString(true), cond->ConditionValue1);
return false;
}
- if (cond->ConditionValue2 >= MAX_SPELL_EFFECTS)
+ if (cond->ConditionValue2 >= spellInfo->GetEffects().size())
+ {
+ TC_LOG_ERROR("sql.sql", "{} spell {} has non existing effect index ({}) (must be 0..{}), skipped.",
+ cond->ToString(true), cond->ConditionValue1, cond->ConditionValue2, spellInfo->GetEffects().size() - 1);
+ return false;
+ }
+
+ if (!spellInfo->GetEffect(SpellEffIndex(cond->ConditionValue2)).IsAura())
{
- TC_LOG_ERROR("sql.sql", "{} has non existing effect index ({}) (must be 0..{}), skipped.", cond->ToString(true), cond->ConditionValue2, MAX_SPELL_EFFECTS - 1);
+ TC_LOG_ERROR("sql.sql", "{} spell {} effect index {} is not an aura, skipped.",
+ cond->ToString(true), cond->ConditionValue1, cond->ConditionValue2);
return false;
}
break;