From 7e09c70f809b455c846ab056740d8bfa3bfc37ba Mon Sep 17 00:00:00 2001 From: hondacrx Date: Tue, 7 Dec 2021 17:14:30 -0500 Subject: [PATCH] Core/Spells: Initialize EffectIndex of empty effects to their proper values instead of always being 0 Port From (https://github.com/TrinityCore/TrinityCore/commit/759d2fdd862eb86d022e79adcd3a90374fef58e4) --- Source/Game/Spells/SpellInfo.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Source/Game/Spells/SpellInfo.cs b/Source/Game/Spells/SpellInfo.cs index 1b1183202..e2f7fad09 100644 --- a/Source/Game/Spells/SpellInfo.cs +++ b/Source/Game/Spells/SpellInfo.cs @@ -45,6 +45,10 @@ namespace Game.Spells _effects[(int)spellEffect.EffectIndex] = new SpellEffectInfo(this, spellEffect); } + // Correct EffectIndex for blank effects + for (int i = 0; i < _effects.Count; ++i) + _effects[i].EffectIndex = (uint)i; + SpellName = spellName.Name; SpellMiscRecord _misc = data.Misc; @@ -258,6 +262,10 @@ namespace Game.Spells _effects.EnsureWritableListIndex(spellEffect.EffectIndex, new SpellEffectInfo(this)); _effects[(int)spellEffect.EffectIndex] = new SpellEffectInfo(this, spellEffect); } + + // Correct EffectIndex for blank effects + for (int i = 0; i < _effects.Count; ++i) + _effects[i].EffectIndex = (uint)i; } public bool HasEffect(SpellEffectName effect)