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)
This commit is contained in:
hondacrx
2021-12-07 17:14:30 -05:00
parent ab828b2cb6
commit 7e09c70f80
+8
View File
@@ -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)