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

This commit is contained in:
Shauren
2021-08-28 19:51:29 +02:00
parent bc2c76a5b8
commit 3dd75a49b1
7 changed files with 349 additions and 353 deletions

View File

@@ -5116,7 +5116,7 @@ void Spell::HandleEffects(Unit* pUnitTarget, Item* pItemTarget, GameObject* pGOT
bool preventDefault = CallScriptEffectHandlers(effIndex, mode);
if (!preventDefault)
(this->*SpellEffectHandlers[effect].Value)(effIndex);
(this->*SpellEffectHandlers[effect].Value)();
}
/*static*/ Spell const* Spell::ExtractSpellFromEvent(BasicEvent* event)
@@ -5759,7 +5759,7 @@ SpellCastResult Spell::CheckCast(bool strict, uint32* param1 /*= nullptr*/, uint
int32 skillValue = 0;
// check lock compatibility
SpellCastResult res = CanOpenLock(effect->EffectIndex, lockId, skillId, reqSkillValue, skillValue);
SpellCastResult res = CanOpenLock(*effect, lockId, skillId, reqSkillValue, skillValue);
if (res != SPELL_CAST_OK)
return res;
break;
@@ -7730,7 +7730,7 @@ void Spell::DoEffectOnLaunchTarget(TargetInfo& targetInfo, float multiplier, Spe
targetInfo.IsCrit = roll_chance_f(critChance);
}
SpellCastResult Spell::CanOpenLock(uint32 effIndex, uint32 lockId, SkillType& skillId, int32& reqSkillValue, int32& skillValue)
SpellCastResult Spell::CanOpenLock(SpellEffectInfo const& effect, uint32 lockId, SkillType& skillId, int32& reqSkillValue, int32& skillValue)
{
if (!lockId) // possible case for GO and maybe for items.
return SPELL_CAST_OK;
@@ -7745,10 +7745,6 @@ SpellCastResult Spell::CanOpenLock(uint32 effIndex, uint32 lockId, SkillType& sk
if (!lockInfo)
return SPELL_FAILED_BAD_TARGETS;
SpellEffectInfo const* effect = m_spellInfo->GetEffect(effIndex);
if (!effect)
return SPELL_FAILED_BAD_TARGETS; // no idea about correct error
bool reqKey = false; // some locks not have reqs
for (int j = 0; j < MAX_LOCK_CASE; ++j)
@@ -7767,7 +7763,7 @@ SpellCastResult Spell::CanOpenLock(uint32 effIndex, uint32 lockId, SkillType& sk
reqKey = true;
// wrong locktype, skip
if (effect->MiscValue != lockInfo->Index[j])
if (effect.MiscValue != lockInfo->Index[j])
continue;
skillId = SkillByLockType(LockType(lockInfo->Index[j]));
@@ -7785,8 +7781,8 @@ SpellCastResult Spell::CanOpenLock(uint32 effIndex, uint32 lockId, SkillType& sk
// skill bonus provided by casting spell (mostly item spells)
// add the effect base points modifier from the spell cast (cheat lock / skeleton key etc.)
if (effect->TargetA.GetTarget() == TARGET_GAMEOBJECT_ITEM_TARGET || effect->TargetB.GetTarget() == TARGET_GAMEOBJECT_ITEM_TARGET)
skillValue += effect->CalcValue();
if (effect.TargetA.GetTarget() == TARGET_GAMEOBJECT_ITEM_TARGET || effect.TargetB.GetTarget() == TARGET_GAMEOBJECT_ITEM_TARGET)
skillValue += effect.CalcValue();
if (skillValue < reqSkillValue)
return SPELL_FAILED_LOW_CASTLEVEL;