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;

View File

@@ -351,160 +351,160 @@ class TC_GAME_API Spell
friend class SpellScript;
public:
void EffectNULL(SpellEffIndex effIndex);
void EffectUnused(SpellEffIndex effIndex);
void EffectDistract(SpellEffIndex effIndex);
void EffectSchoolDMG(SpellEffIndex effIndex);
void EffectEnvironmentalDMG(SpellEffIndex effIndex);
void EffectInstaKill(SpellEffIndex effIndex);
void EffectDummy(SpellEffIndex effIndex);
void EffectTeleportUnits(SpellEffIndex effIndex);
void EffectApplyAura(SpellEffIndex effIndex);
void EffectSendEvent(SpellEffIndex effIndex);
void EffectPowerBurn(SpellEffIndex effIndex);
void EffectPowerDrain(SpellEffIndex effIndex);
void EffectHeal(SpellEffIndex effIndex);
void EffectBind(SpellEffIndex effIndex);
void EffectTeleportToReturnPoint(SpellEffIndex effIndex);
void EffectHealthLeech(SpellEffIndex effIndex);
void EffectQuestComplete(SpellEffIndex effIndex);
void EffectCreateItem(SpellEffIndex effIndex);
void EffectCreateItem2(SpellEffIndex effIndex);
void EffectCreateRandomItem(SpellEffIndex effIndex);
void EffectPersistentAA(SpellEffIndex effIndex);
void EffectEnergize(SpellEffIndex effIndex);
void EffectOpenLock(SpellEffIndex effIndex);
void EffectSummonChangeItem(SpellEffIndex effIndex);
void EffectProficiency(SpellEffIndex effIndex);
void EffectApplyAreaAura(SpellEffIndex effIndex);
void EffectSummonType(SpellEffIndex effIndex);
void EffectLearnSpell(SpellEffIndex effIndex);
void EffectDispel(SpellEffIndex effIndex);
void EffectDualWield(SpellEffIndex effIndex);
void EffectPickPocket(SpellEffIndex effIndex);
void EffectAddFarsight(SpellEffIndex effIndex);
void EffectUntrainTalents(SpellEffIndex effIndex);
void EffectHealMechanical(SpellEffIndex effIndex);
void EffectJump(SpellEffIndex effIndex);
void EffectJumpDest(SpellEffIndex effIndex);
void EffectLeapBack(SpellEffIndex effIndex);
void EffectQuestClear(SpellEffIndex effIndex);
void EffectTeleUnitsFaceCaster(SpellEffIndex effIndex);
void EffectLearnSkill(SpellEffIndex effIndex);
void EffectPlayMovie(SpellEffIndex effIndex);
void EffectTradeSkill(SpellEffIndex effIndex);
void EffectEnchantItemPerm(SpellEffIndex effIndex);
void EffectEnchantItemTmp(SpellEffIndex effIndex);
void EffectTameCreature(SpellEffIndex effIndex);
void EffectSummonPet(SpellEffIndex effIndex);
void EffectLearnPetSpell(SpellEffIndex effIndex);
void EffectWeaponDmg(SpellEffIndex effIndex);
void EffectForceCast(SpellEffIndex effIndex);
void EffectTriggerSpell(SpellEffIndex effIndex);
void EffectTriggerMissileSpell(SpellEffIndex effIndex);
void EffectThreat(SpellEffIndex effIndex);
void EffectHealMaxHealth(SpellEffIndex effIndex);
void EffectInterruptCast(SpellEffIndex effIndex);
void EffectSummonObjectWild(SpellEffIndex effIndex);
void EffectScriptEffect(SpellEffIndex effIndex);
void EffectSanctuary(SpellEffIndex effIndex);
void EffectDuel(SpellEffIndex effIndex);
void EffectStuck(SpellEffIndex effIndex);
void EffectSummonPlayer(SpellEffIndex effIndex);
void EffectActivateObject(SpellEffIndex effIndex);
void EffectApplyGlyph(SpellEffIndex effIndex);
void EffectEnchantHeldItem(SpellEffIndex effIndex);
void EffectSummonObject(SpellEffIndex effIndex);
void EffectChangeRaidMarker(SpellEffIndex effIndex);
void EffectResurrect(SpellEffIndex effIndex);
void EffectParry(SpellEffIndex effIndex);
void EffectBlock(SpellEffIndex effIndex);
void EffectLeap(SpellEffIndex effIndex);
void EffectTransmitted(SpellEffIndex effIndex);
void EffectDisEnchant(SpellEffIndex effIndex);
void EffectInebriate(SpellEffIndex effIndex);
void EffectFeedPet(SpellEffIndex effIndex);
void EffectDismissPet(SpellEffIndex effIndex);
void EffectReputation(SpellEffIndex effIndex);
void EffectForceDeselect(SpellEffIndex effIndex);
void EffectSelfResurrect(SpellEffIndex effIndex);
void EffectSkinning(SpellEffIndex effIndex);
void EffectCharge(SpellEffIndex effIndex);
void EffectChargeDest(SpellEffIndex effIndex);
void EffectProspecting(SpellEffIndex effIndex);
void EffectMilling(SpellEffIndex effIndex);
void EffectRenamePet(SpellEffIndex effIndex);
void EffectSendTaxi(SpellEffIndex effIndex);
void EffectKnockBack(SpellEffIndex effIndex);
void EffectPullTowards(SpellEffIndex effIndex);
void EffectDispelMechanic(SpellEffIndex effIndex);
void EffectResurrectPet(SpellEffIndex effIndex);
void EffectDestroyAllTotems(SpellEffIndex effIndex);
void EffectDurabilityDamage(SpellEffIndex effIndex);
void EffectSkill(SpellEffIndex effIndex);
void EffectTaunt(SpellEffIndex effIndex);
void EffectDurabilityDamagePCT(SpellEffIndex effIndex);
void EffectModifyThreatPercent(SpellEffIndex effIndex);
void EffectResurrectNew(SpellEffIndex effIndex);
void EffectAddExtraAttacks(SpellEffIndex effIndex);
void EffectSpiritHeal(SpellEffIndex effIndex);
void EffectSkinPlayerCorpse(SpellEffIndex effIndex);
void EffectStealBeneficialBuff(SpellEffIndex effIndex);
void EffectUnlearnSpecialization(SpellEffIndex effIndex);
void EffectHealPct(SpellEffIndex effIndex);
void EffectEnergizePct(SpellEffIndex effIndex);
void EffectTriggerRitualOfSummoning(SpellEffIndex effIndex);
void EffectSummonRaFFriend(SpellEffIndex effIndex);
void EffectUnlockGuildVaultTab(SpellEffIndex effIndex);
void EffectKillCreditPersonal(SpellEffIndex effIndex);
void EffectKillCredit(SpellEffIndex effIndex);
void EffectQuestFail(SpellEffIndex effIndex);
void EffectQuestStart(SpellEffIndex effIndex);
void EffectRedirectThreat(SpellEffIndex effIndex);
void EffectGameObjectDamage(SpellEffIndex effIndex);
void EffectGameObjectRepair(SpellEffIndex effIndex);
void EffectGameObjectSetDestructionState(SpellEffIndex effIndex);
void EffectCreateTamedPet(SpellEffIndex effIndex);
void EffectDiscoverTaxi(SpellEffIndex effIndex);
void EffectTitanGrip(SpellEffIndex effIndex);
void EffectEnchantItemPrismatic(SpellEffIndex effIndex);
void EffectPlayMusic(SpellEffIndex effIndex);
void EffectActivateSpec(SpellEffIndex effIndex);
void EffectPlaySound(SpellEffIndex effIndex);
void EffectRemoveAura(SpellEffIndex effIndex);
void EffectDamageFromMaxHealthPCT(SpellEffIndex effIndex);
void EffectCastButtons(SpellEffIndex effIndex);
void EffectRechargeItem(SpellEffIndex effIndex);
void EffectGiveCurrency(SpellEffIndex effIndex);
void EffectSummonPersonalGameObject(SpellEffIndex effIndex);
void EffectResurrectWithAura(SpellEffIndex effIndex);
void EffectCreateAreaTrigger(SpellEffIndex effIndex);
void EffectRemoveTalent(SpellEffIndex effIndex);
void EffectDestroyItem(SpellEffIndex effIndex);
void EffectLearnGarrisonBuilding(SpellEffIndex effIndex);
void EffectCreateGarrison(SpellEffIndex effIndex);
void EffectCreateConversation(SpellEffIndex effIndex);
void EffectAddGarrisonFollower(SpellEffIndex effIndex);
void EffectActivateGarrisonBuilding(SpellEffIndex effIndex);
void EffectHealBattlePetPct(SpellEffIndex effIndex);
void EffectEnableBattlePets(SpellEffIndex effIndex);
void EffectLaunchQuestChoice(SpellEffIndex effIndex);
void EffectUncageBattlePet(SpellEffIndex effIndex);
void EffectCreateHeirloomItem(SpellEffIndex effIndex);
void EffectUpgradeHeirloom(SpellEffIndex effIndex);
void EffectApplyEnchantIllusion(SpellEffIndex effIndex);
void EffectUpdatePlayerPhase(SpellEffIndex effIndex);
void EffectUpdateZoneAurasAndPhases(SpellEffIndex effIndex);
void EffectGiveArtifactPower(SpellEffIndex effIndex);
void EffectGiveArtifactPowerNoBonus(SpellEffIndex effIndex);
void EffectPlaySceneScriptPackage(SpellEffIndex effIndex);
void EffectPlayScene(SpellEffIndex effIndex);
void EffectGiveHonor(SpellEffIndex effIndex);
void EffectLearnTransmogSet(SpellEffIndex effIndex);
void EffectRespecAzeriteEmpoweredItem(SpellEffIndex effIndex);
void EffectLearnAzeriteEssencePower(SpellEffIndex effIndex);
void EffectCreatePrivateConversation(SpellEffIndex effIndex);
void EffectSendChatMessage(SpellEffIndex effIndex);
void EffectNULL();
void EffectUnused();
void EffectDistract();
void EffectSchoolDMG();
void EffectEnvironmentalDMG();
void EffectInstaKill();
void EffectDummy();
void EffectTeleportUnits();
void EffectApplyAura();
void EffectSendEvent();
void EffectPowerBurn();
void EffectPowerDrain();
void EffectHeal();
void EffectBind();
void EffectTeleportToReturnPoint();
void EffectHealthLeech();
void EffectQuestComplete();
void EffectCreateItem();
void EffectCreateItem2();
void EffectCreateRandomItem();
void EffectPersistentAA();
void EffectEnergize();
void EffectOpenLock();
void EffectSummonChangeItem();
void EffectProficiency();
void EffectApplyAreaAura();
void EffectSummonType();
void EffectLearnSpell();
void EffectDispel();
void EffectDualWield();
void EffectPickPocket();
void EffectAddFarsight();
void EffectUntrainTalents();
void EffectHealMechanical();
void EffectJump();
void EffectJumpDest();
void EffectLeapBack();
void EffectQuestClear();
void EffectTeleUnitsFaceCaster();
void EffectLearnSkill();
void EffectPlayMovie();
void EffectTradeSkill();
void EffectEnchantItemPerm();
void EffectEnchantItemTmp();
void EffectTameCreature();
void EffectSummonPet();
void EffectLearnPetSpell();
void EffectWeaponDmg();
void EffectForceCast();
void EffectTriggerSpell();
void EffectTriggerMissileSpell();
void EffectThreat();
void EffectHealMaxHealth();
void EffectInterruptCast();
void EffectSummonObjectWild();
void EffectScriptEffect();
void EffectSanctuary();
void EffectDuel();
void EffectStuck();
void EffectSummonPlayer();
void EffectActivateObject();
void EffectApplyGlyph();
void EffectEnchantHeldItem();
void EffectSummonObject();
void EffectChangeRaidMarker();
void EffectResurrect();
void EffectParry();
void EffectBlock();
void EffectLeap();
void EffectTransmitted();
void EffectDisEnchant();
void EffectInebriate();
void EffectFeedPet();
void EffectDismissPet();
void EffectReputation();
void EffectForceDeselect();
void EffectSelfResurrect();
void EffectSkinning();
void EffectCharge();
void EffectChargeDest();
void EffectProspecting();
void EffectMilling();
void EffectRenamePet();
void EffectSendTaxi();
void EffectKnockBack();
void EffectPullTowards();
void EffectDispelMechanic();
void EffectResurrectPet();
void EffectDestroyAllTotems();
void EffectDurabilityDamage();
void EffectSkill();
void EffectTaunt();
void EffectDurabilityDamagePCT();
void EffectModifyThreatPercent();
void EffectResurrectNew();
void EffectAddExtraAttacks();
void EffectSpiritHeal();
void EffectSkinPlayerCorpse();
void EffectStealBeneficialBuff();
void EffectUnlearnSpecialization();
void EffectHealPct();
void EffectEnergizePct();
void EffectTriggerRitualOfSummoning();
void EffectSummonRaFFriend();
void EffectUnlockGuildVaultTab();
void EffectKillCreditPersonal();
void EffectKillCredit();
void EffectQuestFail();
void EffectQuestStart();
void EffectRedirectThreat();
void EffectGameObjectDamage();
void EffectGameObjectRepair();
void EffectGameObjectSetDestructionState();
void EffectCreateTamedPet();
void EffectDiscoverTaxi();
void EffectTitanGrip();
void EffectEnchantItemPrismatic();
void EffectPlayMusic();
void EffectActivateSpec();
void EffectPlaySound();
void EffectRemoveAura();
void EffectDamageFromMaxHealthPCT();
void EffectCastButtons();
void EffectRechargeItem();
void EffectGiveCurrency();
void EffectSummonPersonalGameObject();
void EffectResurrectWithAura();
void EffectCreateAreaTrigger();
void EffectRemoveTalent();
void EffectDestroyItem();
void EffectLearnGarrisonBuilding();
void EffectCreateGarrison();
void EffectCreateConversation();
void EffectAddGarrisonFollower();
void EffectActivateGarrisonBuilding();
void EffectHealBattlePetPct();
void EffectEnableBattlePets();
void EffectLaunchQuestChoice();
void EffectUncageBattlePet();
void EffectCreateHeirloomItem();
void EffectUpgradeHeirloom();
void EffectApplyEnchantIllusion();
void EffectUpdatePlayerPhase();
void EffectUpdateZoneAurasAndPhases();
void EffectGiveArtifactPower();
void EffectGiveArtifactPowerNoBonus();
void EffectPlaySceneScriptPackage();
void EffectPlayScene();
void EffectGiveHonor();
void EffectLearnTransmogSet();
void EffectRespecAzeriteEmpoweredItem();
void EffectLearnAzeriteEssencePower();
void EffectCreatePrivateConversation();
void EffectSendChatMessage();
typedef std::unordered_set<Aura*> UsedSpellMods;
@@ -584,7 +584,7 @@ class TC_GAME_API Spell
uint32 getState() const { return m_spellState; }
void setState(uint32 state) { m_spellState = state; }
void DoCreateItem(uint32 i, uint32 itemtype, ItemContext context = ItemContext::NONE, std::vector<int32> const& bonusListIDs = std::vector<int32>());
void DoCreateItem(uint32 itemId, ItemContext context = ItemContext::NONE, std::vector<int32> const& bonusListIDs = std::vector<int32>());
bool CheckEffectTarget(Unit const* target, SpellEffectInfo const* effect, Position const* losPosition) const;
bool CheckEffectTarget(GameObject const* target, SpellEffectInfo const* effect) const;
@@ -939,7 +939,7 @@ class TC_GAME_API Spell
void UpdateSpellCastDataTargets(WorldPackets::Spells::SpellCastData& data);
void UpdateSpellCastDataAmmo(WorldPackets::Spells::SpellAmmo& data);
SpellCastResult CanOpenLock(uint32 effIndex, uint32 lockid, SkillType& skillid, int32& reqSkillValue, int32& skillValue);
SpellCastResult CanOpenLock(SpellEffectInfo const& effect, uint32 lockid, SkillType& skillid, int32& reqSkillValue, int32& skillValue);
// -------------------------------------------
uint32 m_spellState;
@@ -1033,6 +1033,6 @@ namespace Trinity
};
}
typedef void(Spell::*SpellEffectHandlerFn)(SpellEffIndex effIndex);
using SpellEffectHandlerFn = void(Spell::*)();
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -740,9 +740,9 @@ Item* SpellScript::GetCastItem() const
return m_spell->m_CastItem;
}
void SpellScript::CreateItem(uint32 effIndex, uint32 itemId, ItemContext context)
void SpellScript::CreateItem(uint32 itemId, ItemContext context)
{
m_spell->DoCreateItem(effIndex, itemId, context);
m_spell->DoCreateItem(itemId, context);
}
SpellInfo const* SpellScript::GetTriggeringSpell() const

View File

@@ -498,7 +498,7 @@ class TC_GAME_API SpellScript : public _SpellScript
Item* GetCastItem() const;
// Creates item. Calls Spell::DoCreateItem method.
void CreateItem(uint32 effIndex, uint32 itemId, ItemContext context);
void CreateItem(uint32 itemId, ItemContext context);
// Returns SpellInfo from the spell that triggered the current one
SpellInfo const* GetTriggeringSpell() const;

View File

@@ -3198,7 +3198,7 @@ class spell_gen_upper_deck_create_foam_sword : public SpellScript
return;
}
CreateItem(effIndex, itemId[urand(0, 4)], ItemContext::NONE);
CreateItem(itemId[urand(0, 4)], ItemContext::NONE);
}
}

View File

@@ -1263,7 +1263,7 @@ class spell_item_mingos_fortune_generator : public SpellScript
return;
}
CreateItem(effIndex, newitemid, ItemContext::NONE);
CreateItem(newitemid, ItemContext::NONE);
}
void Register() override