Core/Spells: Removed SpellEffIndex effIndex argument from spell effect handlers, it was commented out in almost every handler

Port From (https://github.com/TrinityCore/TrinityCore/commit/3dd75a49b190098010803014072c0c8bee2996bd)
This commit is contained in:
hondacrx
2021-08-30 15:55:48 -04:00
parent 6e9451082d
commit 02f1211445
6 changed files with 187 additions and 191 deletions
+1 -1
View File
@@ -821,7 +821,7 @@ namespace Game.Scripting
public Item GetCastItem() { return m_spell.m_CastItem; }
// Creates item. Calls Spell.DoCreateItem method.
public void CreateItem(uint effIndex, uint itemId, ItemContext context) { m_spell.DoCreateItem(effIndex, itemId, context); }
public void CreateItem(uint itemId, ItemContext context) { m_spell.DoCreateItem(itemId, context); }
// Returns SpellInfo from the spell that triggered the current one
public SpellInfo GetTriggeringSpell() { return m_spell.m_triggeredByAuraSpell; }
+3 -7
View File
@@ -4358,7 +4358,7 @@ namespace Game.Spells
bool preventDefault = CallScriptEffectHandlers(i, mode);
if (!preventDefault)
Global.SpellMgr.GetSpellEffectHandler(effect).Invoke(this, i);
Global.SpellMgr.GetSpellEffectHandler(effect).Invoke(this);
}
public static Spell ExtractSpellFromEvent(BasicEvent basicEvent)
@@ -5026,7 +5026,7 @@ namespace Game.Spells
int skillValue = 0;
// check lock compatibility
SpellCastResult res = CanOpenLock(effect.EffectIndex, lockId, ref skillId, ref reqSkillValue, ref skillValue);
SpellCastResult res = CanOpenLock(effect, lockId, ref skillId, ref reqSkillValue, ref skillValue);
if (res != SpellCastResult.SpellCastOk)
return res;
break;
@@ -6852,7 +6852,7 @@ namespace Game.Spells
targetInfo.IsCrit = RandomHelper.randChance(critChance);
}
SpellCastResult CanOpenLock(uint effIndex, uint lockId, ref SkillType skillId, ref int reqSkillValue, ref int skillValue)
SpellCastResult CanOpenLock(SpellEffectInfo effect, uint lockId, ref SkillType skillId, ref int reqSkillValue, ref int skillValue)
{
if (lockId == 0) // possible case for GO and maybe for items.
return SpellCastResult.SpellCastOk;
@@ -6867,10 +6867,6 @@ namespace Game.Spells
if (lockInfo == null)
return SpellCastResult.BadTargets;
SpellEffectInfo effect = m_spellInfo.GetEffect(effIndex);
if (effect == null)
return SpellCastResult.BadTargets; // no idea about correct error
bool reqKey = false; // some locks not have reqs
for (int j = 0; j < SharedConst.MaxLockCase; ++j)
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -4017,7 +4017,7 @@ namespace Game.Entities
public delegate void AuraEffectHandler(AuraEffect effect, AuraApplication aurApp, AuraEffectHandleModes mode, bool apply);
Dictionary<AuraType, AuraEffectHandler> AuraEffectHandlers = new();
public delegate void SpellEffectHandler(Spell spell, uint effectIndex);
public delegate void SpellEffectHandler(Spell spell);
Dictionary<SpellEffectName, SpellEffectHandler> SpellEffectsHandlers = new();
public MultiMap<uint, uint> PetFamilySpellsStorage = new();
+1 -1
View File
@@ -2888,7 +2888,7 @@ namespace Scripts.Spells.Generic
return;
}
CreateItem(effIndex, itemId[RandomHelper.URand(0, 4)], ItemContext.None);
CreateItem(itemId[RandomHelper.URand(0, 4)], ItemContext.None);
}
}
+1 -1
View File
@@ -1429,7 +1429,7 @@ namespace Scripts.Spells.Items
return;
}
CreateItem(effIndex, newitemid, ItemContext.None);
CreateItem(newitemid, ItemContext.None);
}
public override void Register()