aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2024-04-13 16:16:22 +0200
committerOvahlord <dreadkiller@gmx.de>2024-05-28 16:42:22 +0200
commit998068e8ec64856b1018410f65f16edb7afa2cde (patch)
treebf60e9267cc8631971077a844e6693d40053da41 /src
parent139d80373d4060dda9314a64ad20c263bd69541b (diff)
Core/Conditions: Added startup error log for conditions using invalid effect index on CONDITION_AURA
(cherry picked from commit 325cfd047d7846c68335465acff0c6a86e1493de)
Diffstat (limited to 'src')
-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 236c0f9d269..69e0753b7ab 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;