aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Conditions/ConditionMgr.cpp
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2024-04-13 16:16:22 +0200
committerShauren <shauren.trinity@gmail.com>2024-04-13 16:16:22 +0200
commit325cfd047d7846c68335465acff0c6a86e1493de (patch)
treecb90409ff69d2351bcaab718e82a591c99bbe621 /src/server/game/Conditions/ConditionMgr.cpp
parenta3f760e38338c9ca4159e315ae99ac2f04491e95 (diff)
Core/Conditions: Added startup error log for conditions using invalid effect index on CONDITION_AURA
Diffstat (limited to 'src/server/game/Conditions/ConditionMgr.cpp')
-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;