diff options
author | Shauren <shauren.trinity@gmail.com> | 2021-09-04 14:21:02 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2021-09-04 14:21:02 +0200 |
commit | 325bdc0ab0707895abb1effa7044c3f168513344 (patch) | |
tree | f52f46e6992d696aeb1260f0fff67f1b4c8ce990 | |
parent | 0e12e23f7784b4a80d3515cb094342cb677e35b2 (diff) |
Core/Spells: Remove remaining direct accesses to SpellInfo::Effects
62 files changed, 277 insertions, 281 deletions
diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index abf92924757..fd9479d68b7 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -841,7 +841,7 @@ SpellInfo::SpellInfo(SpellEntry const* spellEntry) AreaGroupId = spellEntry->RequiredAreasID; SchoolMask = spellEntry->SchoolMask; for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) - Effects[i] = SpellEffectInfo(spellEntry, this, i); + _effects[i] = SpellEffectInfo(spellEntry, this, i); ChainEntry = nullptr; ExplicitTargetMask = 0; @@ -3898,9 +3898,9 @@ void SpellInfo::_UnloadImplicitTargetConditionLists() if (!cur) continue; - for (size_t j = effect.EffectIndex; j < Effects.size(); ++j) - if (Effects[j].ImplicitTargetConditions == cur) - Effects[j].ImplicitTargetConditions = nullptr; + for (size_t j = effect.EffectIndex; j < GetEffects().size(); ++j) + if (GetEffect(SpellEffIndex(j)).ImplicitTargetConditions == cur) + _GetEffect(SpellEffIndex(j)).ImplicitTargetConditions = nullptr; delete cur; } diff --git a/src/server/game/Spells/SpellInfo.h b/src/server/game/Spells/SpellInfo.h index 3d662c445e2..0ad1810853c 100644 --- a/src/server/game/Spells/SpellInfo.h +++ b/src/server/game/Spells/SpellInfo.h @@ -399,7 +399,7 @@ class TC_GAME_API SpellInfo uint32 PreventionType; int32 AreaGroupId; uint32 SchoolMask; - std::array<SpellEffectInfo, MAX_SPELL_EFFECTS> Effects; + std::array<SpellEffectInfo, MAX_SPELL_EFFECTS> _effects; uint32 ExplicitTargetMask; SpellChainNode const* ChainEntry; @@ -520,8 +520,8 @@ class TC_GAME_API SpellInfo bool IsDifferentRankOf(SpellInfo const* spellInfo) const; bool IsHighRankOf(SpellInfo const* spellInfo) const; - std::array<SpellEffectInfo, MAX_SPELL_EFFECTS> const& GetEffects() const { return Effects; } - SpellEffectInfo const& GetEffect(SpellEffIndex index) const { ASSERT(index < Effects.size()); return Effects[index]; } + std::array<SpellEffectInfo, MAX_SPELL_EFFECTS> const& GetEffects() const { return _effects; } + SpellEffectInfo const& GetEffect(SpellEffIndex index) const { ASSERT(index < _effects.size()); return _effects[index]; } // spell diminishing returns DiminishingGroup GetDiminishingReturnsGroupForSpell(bool triggered) const; @@ -547,8 +547,8 @@ class TC_GAME_API SpellInfo void _LoadSpellDiminishInfo(); void _LoadImmunityInfo(); - std::array<SpellEffectInfo, MAX_SPELL_EFFECTS>& _GetEffects() { return Effects; } - SpellEffectInfo& _GetEffect(SpellEffIndex index) { ASSERT(index < Effects.size()); return Effects[index]; } + std::array<SpellEffectInfo, MAX_SPELL_EFFECTS>& _GetEffects() { return _effects; } + SpellEffectInfo& _GetEffect(SpellEffIndex index) { ASSERT(index < _effects.size()); return _effects[index]; } // unloading helpers void _UnloadImplicitTargetConditionLists(); diff --git a/src/server/game/Spells/SpellScript.cpp b/src/server/game/Spells/SpellScript.cpp index 13d21323ce3..a822e3a0147 100644 --- a/src/server/game/Spells/SpellScript.cpp +++ b/src/server/game/Spells/SpellScript.cpp @@ -131,11 +131,12 @@ std::string _SpellScript::EffectHook::EffIndexToString() bool _SpellScript::EffectNameCheck::Check(SpellInfo const* spellEntry, uint8 effIndex) { - if (!spellEntry->Effects[effIndex].Effect && !effName) + SpellEffectInfo const& spellEffectInfo = spellEntry->GetEffect(SpellEffIndex(effIndex)); + if (!spellEffectInfo.Effect && !effName) return true; - if (!spellEntry->Effects[effIndex].Effect) + if (!spellEffectInfo.Effect) return false; - return (effName == SPELL_EFFECT_ANY) || (spellEntry->Effects[effIndex].Effect == effName); + return (effName == SPELL_EFFECT_ANY) || (spellEffectInfo.Effect == effName); } std::string _SpellScript::EffectNameCheck::ToString() @@ -153,11 +154,12 @@ std::string _SpellScript::EffectNameCheck::ToString() bool _SpellScript::EffectAuraNameCheck::Check(SpellInfo const* spellEntry, uint8 effIndex) { - if (!spellEntry->Effects[effIndex].ApplyAuraName && !effAurName) + SpellEffectInfo const& spellEffectInfo = spellEntry->GetEffect(SpellEffIndex(effIndex)); + if (!spellEffectInfo.ApplyAuraName && !effAurName) return true; - if (!spellEntry->Effects[effIndex].ApplyAuraName) + if (!spellEffectInfo.ApplyAuraName) return false; - return (effAurName == SPELL_AURA_ANY) || (spellEntry->Effects[effIndex].ApplyAuraName == effAurName); + return (effAurName == SPELL_AURA_ANY) || (spellEffectInfo.ApplyAuraName == effAurName); } std::string _SpellScript::EffectAuraNameCheck::ToString() @@ -259,8 +261,9 @@ bool SpellScript::TargetHook::CheckEffect(SpellInfo const* spellEntry, uint8 eff if (!targetType) return false; - if (spellEntry->Effects[effIndexToCheck].TargetA.GetTarget() != targetType && - spellEntry->Effects[effIndexToCheck].TargetB.GetTarget() != targetType) + SpellEffectInfo const& spellEffectInfo = spellEntry->GetEffect(SpellEffIndex(effIndexToCheck)); + if (spellEffectInfo.TargetA.GetTarget() != targetType && + spellEffectInfo.TargetB.GetTarget() != targetType) return false; SpellImplicitTargetInfo targetInfo(targetType); diff --git a/src/server/scripts/Commands/cs_lookup.cpp b/src/server/scripts/Commands/cs_lookup.cpp index 8876eb961b0..b14bc9661c9 100644 --- a/src/server/scripts/Commands/cs_lookup.cpp +++ b/src/server/scripts/Commands/cs_lookup.cpp @@ -966,9 +966,11 @@ public: } bool known = target && target->HasSpell(id); - bool learn = (spellInfo->Effects[0].Effect == SPELL_EFFECT_LEARN_SPELL); - SpellInfo const* learnSpellInfo = sSpellMgr->GetSpellInfo(spellInfo->Effects[0].TriggerSpell); + SpellEffectInfo const& spellEffectInfo = spellInfo->GetEffect(EFFECT_0); + bool learn = spellEffectInfo.IsEffect(SPELL_EFFECT_LEARN_SPELL); + + SpellInfo const* learnSpellInfo = sSpellMgr->GetSpellInfo(spellEffectInfo.TriggerSpell); uint32 talentCost = GetTalentSpellCost(id); @@ -1041,9 +1043,11 @@ public: } bool known = target && target->HasSpell(id); - bool learn = (spellInfo->Effects[0].Effect == SPELL_EFFECT_LEARN_SPELL); - SpellInfo const* learnSpellInfo = sSpellMgr->GetSpellInfo(spellInfo->Effects[0].TriggerSpell); + SpellEffectInfo const& spellEffectInfo = spellInfo->GetEffect(EFFECT_0); + bool learn = spellEffectInfo.IsEffect(SPELL_EFFECT_LEARN_SPELL); + + SpellInfo const* learnSpellInfo = sSpellMgr->GetSpellInfo(spellEffectInfo.TriggerSpell); uint32 talentCost = GetTalentSpellCost(id); diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_the_beast.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_the_beast.cpp index 0099406adee..0b4894fc81a 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_the_beast.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/boss_the_beast.cpp @@ -87,10 +87,9 @@ struct boss_the_beast : public BossAI void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override { - for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) - if (spellInfo->Effects[i].IsEffect(SPELL_EFFECT_SKINNING)) - if (!me->IsAlive()) // can that even happen? - DoCastAOE(SPELL_FINKLE_IS_EINHORN, true); + if (spellInfo->HasEffect(SPELL_EFFECT_SKINNING)) + if (!me->IsAlive()) // can that even happen? + DoCastAOE(SPELL_FINKLE_IS_EINHORN, true); } void SetData(uint32 type, uint32 /*data*/) override diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp index db17129cf09..40f82077314 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp @@ -481,9 +481,7 @@ public: void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override { //We only care about interrupt effects and only if they are durring a spell currently being cast - if ((spellInfo->Effects[0].Effect != SPELL_EFFECT_INTERRUPT_CAST && - spellInfo->Effects[1].Effect != SPELL_EFFECT_INTERRUPT_CAST && - spellInfo->Effects[2].Effect != SPELL_EFFECT_INTERRUPT_CAST) || !me->IsNonMeleeSpellCast(false)) + if (!spellInfo->HasEffect(SPELL_EFFECT_INTERRUPT_CAST) || !me->IsNonMeleeSpellCast(false)) return; //Interrupt effect diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp index 4c2d0d51ea5..8cd57d90c79 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp @@ -1683,8 +1683,8 @@ class spell_teleport_leaders_blessing : public SpellScript if (!target) return; - uint32 spellID = GetSpellInfo()->Effects[EFFECT_0].CalcValue(); - uint32 questID = GetSpellInfo()->Effects[EFFECT_1].CalcValue(); + uint32 spellID = GetEffectInfo().CalcValue(); + uint32 questID = GetEffectInfo(EFFECT_1).CalcValue(); if (target->GetQuestStatus(questID) == QUEST_STATUS_COMPLETE) target->CastSpell(target, spellID, true); diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp index bdcd268526f..aed2154129f 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp @@ -297,7 +297,7 @@ class spell_shadow_portal_rooms : public SpellScriptLoader return InstanceHasScript(GetCaster(), ScholomanceScriptName); } - void HandleSendEvent(SpellEffIndex effIndex) + void HandleSendEvent(SpellEffIndex /*effIndex*/) { // If only one player in threat list fail spell @@ -307,7 +307,7 @@ class spell_shadow_portal_rooms : public SpellScriptLoader int8 phase_to_set = 0; int32 gate_to_close = 0; - switch (GetSpellInfo()->Effects[effIndex].MiscValue) + switch (GetEffectInfo().MiscValue) { case SPELL_EVENT_HALLOFSECRETS: pos_to_summon = 0; // Not yet spawned diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp index 1dd52b11315..e3efcd0cb04 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp @@ -608,12 +608,12 @@ class spell_kalecgos_tap_check : public SpellScript bool Validate(SpellInfo const* spellInfo) override { - return ValidateSpellInfo({ uint32(spellInfo->Effects[EFFECT_0].CalcValue()) }); + return ValidateSpellInfo({ uint32(spellInfo->GetEffect(EFFECT_0).CalcValue()) }); } void HandleDummy(SpellEffIndex /*effIndex*/) { - GetHitUnit()->CastSpell(GetCaster(), (uint32)GetSpellInfo()->Effects[EFFECT_0].CalcValue(), true); + GetHitUnit()->CastSpell(GetCaster(), GetEffectInfo().CalcValue(), true); } void Register() override diff --git a/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp b/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp index dcefe5622af..1039d4df2d8 100644 --- a/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp +++ b/src/server/scripts/Kalimdor/zone_dustwallow_marsh.cpp @@ -32,7 +32,7 @@ class spell_ooze_zap : public SpellScript SpellCastResult CheckRequirement() { - if (!GetCaster()->HasAura(GetSpellInfo()->Effects[EFFECT_1].CalcValue())) + if (!GetCaster()->HasAura(GetEffectInfo(EFFECT_1).CalcValue())) return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; // This is actually correct if (!GetExplTargetUnit()) @@ -88,7 +88,7 @@ class spell_energize_aoe : public SpellScript { for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end();) { - if ((*itr)->GetTypeId() == TYPEID_PLAYER && (*itr)->ToPlayer()->GetQuestStatus(GetSpellInfo()->Effects[EFFECT_1].CalcValue()) == QUEST_STATUS_INCOMPLETE) + if ((*itr)->GetTypeId() == TYPEID_PLAYER && (*itr)->ToPlayer()->GetQuestStatus(GetEffectInfo(EFFECT_1).CalcValue()) == QUEST_STATUS_INCOMPLETE) ++itr; else targets.erase(itr++); diff --git a/src/server/scripts/Kalimdor/zone_silithus.cpp b/src/server/scripts/Kalimdor/zone_silithus.cpp index d9ef38f3fce..cf0aad15676 100644 --- a/src/server/scripts/Kalimdor/zone_silithus.cpp +++ b/src/server/scripts/Kalimdor/zone_silithus.cpp @@ -1413,7 +1413,7 @@ class spell_silithus_summon_cultist_periodic : public AuraScript bool Validate(SpellInfo const* spellInfo) override { - return ValidateSpellInfo({ spellInfo->Effects[EFFECT_0].TriggerSpell }); + return ValidateSpellInfo({ spellInfo->GetEffect(EFFECT_0).TriggerSpell }); } void PeriodicTick(AuraEffect const* aurEff) @@ -1423,7 +1423,7 @@ class spell_silithus_summon_cultist_periodic : public AuraScript // All these spells trigger a spell that requires reagents; if the // triggered spell is cast as "triggered", reagents are not consumed if (Unit* caster = GetCaster()) - caster->CastSpell(nullptr, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, CastSpellExtraArgs(TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_IGNORE_POWER_AND_REAGENT_COST)).SetTriggeringAura(aurEff)); + caster->CastSpell(nullptr, aurEff->GetSpellEffectInfo().TriggerSpell, CastSpellExtraArgs(TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_IGNORE_POWER_AND_REAGENT_COST)).SetTriggeringAura(aurEff)); } void Register() override diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp index 46029b03d9d..7de7b3144a6 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp @@ -176,13 +176,13 @@ class spell_shadow_blast : public SpellScript { PrepareSpellScript(spell_shadow_blast); - void HandleDamageCalc(SpellEffIndex effIndex) + void HandleDamageCalc(SpellEffIndex /*effIndex*/) { Unit* target = GetHitUnit(); if (!target) return; - SetHitDamage(target->GetMaxHealth() * GetSpellInfo()->Effects[effIndex].BasePoints / 100); + SetHitDamage(target->GetMaxHealth() * GetEffectInfo().BasePoints / 100); } void Register() override diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp index d9aad694b23..6c2be938adf 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp @@ -1500,7 +1500,7 @@ class spell_halion_combustion_consumption_periodic : public SpellScriptLoader bool Validate(SpellInfo const* spellInfo) override { - return ValidateSpellInfo({ spellInfo->Effects[EFFECT_0].TriggerSpell }); + return ValidateSpellInfo({ spellInfo->GetEffect(EFFECT_0).TriggerSpell }); } void HandleTick(AuraEffect const* aurEff) @@ -1510,7 +1510,7 @@ class spell_halion_combustion_consumption_periodic : public SpellScriptLoader if (!caster) return; - uint32 triggerSpell = GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell; + uint32 triggerSpell = aurEff->GetSpellEffectInfo().TriggerSpell; int32 radius = caster->GetObjectScale() * M_PI * 10000 / 3; CastSpellExtraArgs args(aurEff); @@ -1608,8 +1608,8 @@ class spell_halion_damage_aoe_summon : public SpellScriptLoader { PreventHitDefaultEffect(effIndex); Unit* caster = GetCaster(); - uint32 entry = uint32(GetSpellInfo()->Effects[effIndex].MiscValue); - SummonPropertiesEntry const* properties = sSummonPropertiesStore.LookupEntry(uint32(GetSpellInfo()->Effects[effIndex].MiscValueB)); + uint32 entry = uint32(GetEffectInfo().MiscValue); + SummonPropertiesEntry const* properties = sSummonPropertiesStore.LookupEntry(uint32(GetEffectInfo().MiscValueB)); uint32 duration = uint32(GetSpellInfo()->GetDuration()); Position pos = caster->GetPosition(); @@ -1710,10 +1710,10 @@ class spell_halion_clear_debuffs : public SpellScriptLoader return ValidateSpellInfo({ SPELL_CLEAR_DEBUFFS, SPELL_TWILIGHT_REALM }); } - void HandleScript(SpellEffIndex effIndex) + void HandleScript(SpellEffIndex /*effIndex*/) { - if (GetHitUnit()->HasAura(GetSpellInfo()->Effects[effIndex].CalcValue())) - GetHitUnit()->RemoveAurasDueToSpell(GetSpellInfo()->Effects[effIndex].CalcValue()); + if (GetHitUnit()->HasAura(GetEffectInfo().CalcValue())) + GetHitUnit()->RemoveAurasDueToSpell(GetEffectInfo().CalcValue()); } void Register() override @@ -1897,7 +1897,7 @@ class spell_halion_blazing_aura : public SpellScriptLoader void HandleScript(SpellEffIndex effIndex) { PreventHitDefaultEffect(effIndex); - GetHitUnit()->CastSpell(GetHitUnit(), GetSpellInfo()->Effects[EFFECT_1].TriggerSpell); + GetHitUnit()->CastSpell(GetHitUnit(), GetEffectInfo().TriggerSpell); } void Register() override diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp index 392522de2a9..fcc025349f2 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp @@ -499,7 +499,7 @@ class spell_mistress_kiss_area : public SpellScript bool Validate(SpellInfo const* spellInfo) override { - return ValidateSpellInfo({ static_cast<uint32>(spellInfo->Effects[EFFECT_0].CalcValue()) }); + return ValidateSpellInfo({ static_cast<uint32>(spellInfo->GetEffect(EFFECT_0).CalcValue()) }); } void FilterTargets(std::list<WorldObject*>& targets) @@ -537,7 +537,7 @@ class spell_fel_streak_visual : public SpellScript bool Validate(SpellInfo const* spellInfo) override { - return ValidateSpellInfo({ static_cast<uint32>(spellInfo->Effects[EFFECT_0].CalcValue()) }); + return ValidateSpellInfo({ static_cast<uint32>(spellInfo->GetEffect(EFFECT_0).CalcValue()) }); } void HandleScript(SpellEffIndex /*effIndex*/) diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp index cbdce6a2e06..6a3380099ad 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp @@ -1215,7 +1215,7 @@ class spell_jormungars_slime_pool : public AuraScript bool Validate(SpellInfo const* spellInfo) override { - return ValidateSpellInfo({ spellInfo->Effects[EFFECT_0].TriggerSpell }); + return ValidateSpellInfo({ spellInfo->GetEffect(EFFECT_0).TriggerSpell }); } void PeriodicTick(AuraEffect const* aurEff) @@ -1225,7 +1225,7 @@ class spell_jormungars_slime_pool : public AuraScript int32 const radius = static_cast<int32>(((aurEff->GetTickNumber() / 60.f) * 0.9f + 0.1f) * 10000.f * 2.f / 3.f); CastSpellExtraArgs args(aurEff); args.AddSpellMod(SPELLVALUE_RADIUS_MOD, radius); - GetTarget()->CastSpell(nullptr, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, args); + GetTarget()->CastSpell(nullptr, aurEff->GetSpellEffectInfo().TriggerSpell, args); } void Register() override @@ -1290,12 +1290,12 @@ class spell_icehowl_arctic_breath : public SpellScript bool Validate(SpellInfo const* spellInfo) override { - return ValidateSpellInfo({ static_cast<uint32>(spellInfo->Effects[EFFECT_0].CalcValue()) }); + return ValidateSpellInfo({ static_cast<uint32>(spellInfo->GetEffect(EFFECT_0).CalcValue()) }); } - void HandleScriptEffect(SpellEffIndex effIndex) + void HandleScriptEffect(SpellEffIndex /*effIndex*/) { - uint32 spellId = GetSpellInfo()->Effects[effIndex].CalcValue(); + uint32 spellId = GetEffectInfo().CalcValue(); GetCaster()->CastSpell(GetHitUnit(), spellId, true); } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp index 38443b5309f..b67723cfb09 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp @@ -759,7 +759,7 @@ private: // Twin Vortex part uint32 lightVortex = sSpellMgr->GetSpellIdForDifficulty(SPELL_LIGHT_VORTEX_DAMAGE, owner); uint32 darkVortex = sSpellMgr->GetSpellIdForDifficulty(SPELL_DARK_VORTEX_DAMAGE, owner); - int32 stacksCount = dmgInfo.GetSpellInfo()->Effects[EFFECT_0].CalcValue() / 1000 - 1; + int32 stacksCount = dmgInfo.GetSpellInfo()->GetEffect(EFFECT_0).CalcValue() / 1000 - 1; if (lightVortex && darkVortex && stacksCount) { diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp index 0f9fc145a06..e90e23b2cf0 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp @@ -262,7 +262,7 @@ class spell_trollgore_invader_taunt : public SpellScript bool Validate(SpellInfo const* spellInfo) override { - return ValidateSpellInfo({ static_cast<uint32>(spellInfo->Effects[EFFECT_0].CalcValue()) }); + return ValidateSpellInfo({ static_cast<uint32>(spellInfo->GetEffect(EFFECT_0).CalcValue()) }); } void HandleTaunt(SpellEffIndex /*effIndex*/) diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp index 1d12f21578c..f690a3137dd 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp @@ -2811,7 +2811,7 @@ class spell_hor_evasion : public SpellScriptLoader return; float angle = pos.GetAbsoluteAngle(&home); - float dist = GetSpellInfo()->Effects[EFFECT_0].CalcRadius(GetCaster()); + float dist = GetEffectInfo().CalcRadius(GetCaster()); target->MovePosition(pos, dist, angle); dest.Relocate(pos); @@ -2869,7 +2869,7 @@ class spell_hor_quel_delars_will : public SpellScript bool Validate(SpellInfo const* spellInfo) override { - return ValidateSpellInfo({ spellInfo->Effects[EFFECT_0].TriggerSpell }); + return ValidateSpellInfo({ spellInfo->GetEffect(EFFECT_0).TriggerSpell }); } void HandleReagent(SpellEffIndex effIndex) @@ -2877,7 +2877,7 @@ class spell_hor_quel_delars_will : public SpellScript PreventHitDefaultEffect(effIndex); // dummy spell consumes reagent, don't ignore it - GetHitUnit()->CastSpell(GetCaster(), GetSpellInfo()->Effects[effIndex].TriggerSpell, TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_IGNORE_POWER_AND_REAGENT_COST)); + GetHitUnit()->CastSpell(GetCaster(), GetEffectInfo().TriggerSpell, TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_IGNORE_POWER_AND_REAGENT_COST)); } void Register() override diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp index e608805e53c..fc29c58ee81 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp @@ -743,7 +743,7 @@ class spell_blood_queen_pact_of_the_darkfallen_dmg : public AuraScript void PeriodicTick(AuraEffect const* aurEff) { SpellInfo const* damageSpell = sSpellMgr->AssertSpellInfo(SPELL_PACT_OF_THE_DARKFALLEN_DAMAGE); - int32 damage = damageSpell->Effects[EFFECT_0].CalcValue(); + int32 damage = damageSpell->GetEffect(EFFECT_0).CalcValue(); float multiplier = 0.3375f + 0.1f * uint32(aurEff->GetTickNumber()/10); // do not convert to 0.01f - we need tick number/10 as INT (damage increases every 10 ticks) damage = int32(damage * multiplier); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp index b1a2f719376..a0a927651f2 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_icecrown_gunship_battle.cpp @@ -1735,7 +1735,7 @@ class spell_igb_rocket_pack : public AuraScript { SpellInfo const* damageInfo = sSpellMgr->AssertSpellInfo(SPELL_ROCKET_PACK_DAMAGE); CastSpellExtraArgs args(TRIGGERED_FULL_MASK); - args.AddSpellBP0(2 * (damageInfo->Effects[EFFECT_0].CalcValue() + aurEff->GetTickNumber() * aurEff->GetAmplitude())); + args.AddSpellBP0(2 * (damageInfo->GetEffect(EFFECT_0).CalcValue() + aurEff->GetTickNumber() * aurEff->GetAmplitude())); GetTarget()->CastSpell(nullptr, SPELL_ROCKET_PACK_DAMAGE, args); GetTarget()->CastSpell(nullptr, SPELL_ROCKET_BURST, TRIGGERED_FULL_MASK); } @@ -1835,10 +1835,10 @@ class spell_igb_periodic_trigger_with_power_cost : public AuraScript { PrepareAuraScript(spell_igb_periodic_trigger_with_power_cost); - void HandlePeriodicTick(AuraEffect const* /*aurEff*/) + void HandlePeriodicTick(AuraEffect const* aurEff) { PreventDefaultAction(); - GetTarget()->CastSpell(GetTarget(), GetSpellInfo()->Effects[EFFECT_0].TriggerSpell, TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_IGNORE_POWER_AND_REAGENT_COST)); + GetTarget()->CastSpell(GetTarget(), aurEff->GetSpellEffectInfo().TriggerSpell, TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_IGNORE_POWER_AND_REAGENT_COST)); } void Register() override diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp index 11d0b8760dd..eebd9bf6440 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp @@ -538,7 +538,7 @@ class spell_marrowgar_coldflame_damage : public AuraScript if (target->HasAura(SPELL_IMPALED)) return false; - if (target->GetExactDist2d(GetOwner()) > GetSpellInfo()->Effects[EFFECT_0].CalcRadius()) + if (target->GetExactDist2d(GetOwner()) > GetEffectInfo(EFFECT_0).CalcRadius()) return false; if (Aura* aur = target->GetAura(GetId())) diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp index 4fbadc4a596..1c987bb06fb 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp @@ -990,7 +990,7 @@ class spell_putricide_unstable_experiment : public SpellScript break; } - GetCaster()->CastSpell(target, uint32(GetSpellInfo()->Effects[stage].CalcValue()), true); + GetCaster()->CastSpell(target, uint32(GetEffectInfo(SpellEffIndex(stage)).CalcValue()), true); } void Register() override @@ -1027,7 +1027,7 @@ class spell_putricide_ooze_tank_protection : public AuraScript bool Validate(SpellInfo const* spellInfo) override { - return ValidateSpellInfo({ spellInfo->Effects[EFFECT_0].TriggerSpell, spellInfo->Effects[EFFECT_1].TriggerSpell }); + return ValidateSpellInfo({ spellInfo->GetEffect(EFFECT_0).TriggerSpell, spellInfo->GetEffect(EFFECT_1).TriggerSpell }); } void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) @@ -1035,7 +1035,7 @@ class spell_putricide_ooze_tank_protection : public AuraScript PreventDefaultAction(); Unit* actionTarget = eventInfo.GetActionTarget(); - actionTarget->CastSpell(nullptr, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, aurEff); + actionTarget->CastSpell(nullptr, aurEff->GetSpellEffectInfo().TriggerSpell, aurEff); } void Register() override @@ -1053,12 +1053,12 @@ class spell_putricide_choking_gas_bomb : public SpellScript void HandleScript(SpellEffIndex /*effIndex*/) { uint32 skipIndex = urand(0, 2); - for (uint32 i = 0; i < 3; ++i) + for (SpellEffectInfo const& spellEffectInfo : GetSpellInfo()->GetEffects()) { - if (i == skipIndex) + if (spellEffectInfo.EffectIndex == skipIndex) continue; - uint32 spellId = uint32(GetSpellInfo()->Effects[i].CalcValue()); + uint32 spellId = uint32(spellEffectInfo.CalcValue()); GetCaster()->CastSpell(GetCaster(), spellId, GetCaster()->GetGUID()); } } @@ -1187,11 +1187,11 @@ class spell_putricide_mutated_plague : public AuraScript if (!caster) return; - uint32 triggerSpell = GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell; + uint32 triggerSpell = aurEff->GetSpellEffectInfo().TriggerSpell; SpellInfo const* spell = sSpellMgr->AssertSpellInfo(triggerSpell); spell = sSpellMgr->GetSpellForDifficultyFromSpell(spell, caster); - int32 damage = spell->Effects[EFFECT_0].CalcValue(caster); + int32 damage = spell->GetEffect(EFFECT_0).CalcValue(caster); float multiplier = 2.0f; if (GetTarget()->GetMap()->GetSpawnMode() & 1) multiplier = 3.0f; @@ -1205,15 +1205,15 @@ class spell_putricide_mutated_plague : public AuraScript GetTarget()->CastSpell(GetTarget(), triggerSpell, args); } - void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) { - uint32 healSpell = uint32(GetSpellInfo()->Effects[EFFECT_0].CalcValue()); + uint32 healSpell = uint32(aurEff->GetSpellEffectInfo().CalcValue()); SpellInfo const* healSpellInfo = sSpellMgr->GetSpellInfo(healSpell); if (!healSpellInfo) return; - int32 heal = healSpellInfo->Effects[0].CalcValue() * GetStackAmount(); + int32 heal = healSpellInfo->GetEffect(EFFECT_0).CalcValue() * GetStackAmount(); CastSpellExtraArgs args(GetCasterGUID()); args.AddSpellBP0(heal); GetTarget()->CastSpell(GetTarget(), healSpell, args); @@ -1344,8 +1344,8 @@ class spell_putricide_mutated_transformation : public SpellScript return; } - uint32 entry = uint32(GetSpellInfo()->Effects[effIndex].MiscValue); - SummonPropertiesEntry const* properties = sSummonPropertiesStore.LookupEntry(uint32(GetSpellInfo()->Effects[effIndex].MiscValueB)); + uint32 entry = uint32(GetEffectInfo().MiscValue); + SummonPropertiesEntry const* properties = sSummonPropertiesStore.LookupEntry(uint32(GetEffectInfo().MiscValueB)); uint32 duration = uint32(GetSpellInfo()->GetDuration()); Position pos = caster->GetPosition(); @@ -1416,11 +1416,8 @@ class spell_putricide_clear_aura_effect_value : public SpellScript Unit* target = GetHitUnit(); uint32 auraId = sSpellMgr->GetSpellIdForDifficulty(uint32(GetEffectValue()), GetCaster()); target->RemoveAurasDueToSpell(auraId); - if (m_scriptSpellId == SPELL_TEAR_GAS_CANCEL) - { - uint32 auraId2 = GetSpellInfo()->Effects[EFFECT_1].CalcValue(); - target->RemoveAurasDueToSpell(auraId2); - } + uint32 auraId2 = GetEffectInfo(EFFECT_1).CalcValue(); + target->RemoveAurasDueToSpell(auraId2); } void Register() override diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp index a9b44eb1474..6b2ea29b217 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp @@ -490,13 +490,13 @@ class spell_rotface_mutated_infection_aura : public AuraScript bool Validate(SpellInfo const* spellInfo) override { - return ValidateSpellInfo({ static_cast<uint32>(spellInfo->Effects[EFFECT_2].CalcValue()) }); + return ValidateSpellInfo({ static_cast<uint32>(spellInfo->GetEffect(EFFECT_2).CalcValue()) }); } void HandleEffectRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) { Unit* target = GetTarget(); - target->CastSpell(target, uint32(GetSpellInfo()->Effects[EFFECT_2].CalcValue()), { aurEff, GetCasterGUID() }); + target->CastSpell(target, uint32(GetEffectInfo(EFFECT_2).CalcValue()), { aurEff, GetCasterGUID() }); } void Register() override @@ -676,11 +676,11 @@ class spell_rotface_unstable_ooze_explosion : public SpellScript void CheckTarget(SpellEffIndex effIndex) { - PreventHitDefaultEffect(EFFECT_0); + PreventHitDefaultEffect(effIndex); if (!GetExplTargetDest()) return; - uint32 triggered_spell_id = GetSpellInfo()->Effects[effIndex].TriggerSpell; + uint32 triggered_spell_id = GetEffectInfo().TriggerSpell; float x, y, z; GetExplTargetDest()->GetPosition(x, y, z); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp index 0c0000fc920..0eb1b7c3227 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp @@ -1455,7 +1455,7 @@ class spell_frostwarden_handler_focus_fire_aura : public AuraScript PreventDefaultAction(); if (Unit* caster = GetCaster()) { - caster->GetThreatManager().AddThreat(GetTarget(), -float(GetSpellInfo()->Effects[EFFECT_1].CalcValue()), GetSpellInfo(), true, true); + caster->GetThreatManager().AddThreat(GetTarget(), -float(GetEffectInfo(EFFECT_1).CalcValue()), GetSpellInfo(), true, true); caster->GetAI()->SetData(DATA_WHELP_MARKER, 0); } } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp index 80306d254cd..38b9f1fb696 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp @@ -2301,14 +2301,14 @@ class spell_the_lich_king_summon_into_air : public SpellScript { PrepareSpellScript(spell_the_lich_king_summon_into_air); - void ModDestHeight(SpellEffIndex effIndex) + void ModDestHeight(SpellEffIndex /*effIndex*/) { static Position const offset = {0.0f, 0.0f, 15.0f, 0.0f}; WorldLocation* dest = const_cast<WorldLocation*>(GetExplTargetDest()); dest->RelocateOffset(offset); GetHitDest()->RelocateOffset(offset); // spirit bombs get higher - if (GetSpellInfo()->Effects[effIndex].MiscValue == NPC_SPIRIT_BOMB) + if (GetEffectInfo().MiscValue == NPC_SPIRIT_BOMB) { static Position const offsetExtra = { 0.0f, 0.0f, 5.0f, 0.0f }; dest->RelocateOffset(offsetExtra); @@ -2453,7 +2453,7 @@ private: void OnPeriodic(AuraEffect const* aurEff) { if (_is25Man || ((aurEff->GetTickNumber() - 1) % 5)) - GetTarget()->CastSpell(nullptr, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, { aurEff, GetCasterGUID() }); + GetTarget()->CastSpell(nullptr, aurEff->GetSpellEffectInfo().TriggerSpell, { aurEff, GetCasterGUID() }); } void Register() override diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp index 0602f3a9a72..e4603aa5d08 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp @@ -1070,7 +1070,7 @@ class spell_dreamwalker_summoner : public SpellScript if (!GetHitUnit()) return; - GetHitUnit()->CastSpell(GetCaster(), GetSpellInfo()->Effects[effIndex].TriggerSpell, GetCaster()->GetInstanceScript()->GetGuidData(DATA_VALITHRIA_LICH_KING)); + GetHitUnit()->CastSpell(GetCaster(), GetEffectInfo().TriggerSpell, GetCaster()->GetInstanceScript()->GetGuidData(DATA_VALITHRIA_LICH_KING)); } void Register() override @@ -1141,7 +1141,7 @@ class spell_dreamwalker_summon_suppresser_effect : public SpellScript if (!GetHitUnit()) return; - GetHitUnit()->CastSpell(GetCaster(), GetSpellInfo()->Effects[effIndex].TriggerSpell, GetCaster()->GetInstanceScript()->GetGuidData(DATA_VALITHRIA_LICH_KING)); + GetHitUnit()->CastSpell(GetCaster(), GetEffectInfo().TriggerSpell, GetCaster()->GetInstanceScript()->GetGuidData(DATA_VALITHRIA_LICH_KING)); } void Register() override @@ -1234,7 +1234,7 @@ class spell_dreamwalker_twisted_nightmares : public SpellScript PreventHitDefaultEffect(effIndex); if (InstanceScript* instance = GetHitUnit()->GetInstanceScript()) - GetHitUnit()->CastSpell(nullptr, GetSpellInfo()->Effects[effIndex].TriggerSpell, instance->GetGuidData(DATA_VALITHRIA_DREAMWALKER)); + GetHitUnit()->CastSpell(nullptr, GetEffectInfo().TriggerSpell, instance->GetGuidData(DATA_VALITHRIA_DREAMWALKER)); } void Register() override diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp index dd70bc05592..b6b54b73c29 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp @@ -1346,7 +1346,7 @@ class spell_icc_sprit_alarm : public SpellScript { PreventHitDefaultEffect(effIndex); uint32 trapId = 0; - switch (GetSpellInfo()->Effects[effIndex].MiscValue) + switch (GetEffectInfo().MiscValue) { case EVENT_AWAKEN_WARD_1: trapId = GO_SPIRIT_ALARM_1; diff --git a/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp b/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp index ba107d08a46..ecc0a56937e 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp @@ -217,7 +217,7 @@ class spell_grobbulus_poison_cloud : public AuraScript bool Validate(SpellInfo const* spellInfo) override { - return ValidateSpellInfo({ spellInfo->Effects[EFFECT_0].TriggerSpell }); + return ValidateSpellInfo({ spellInfo->GetEffect(EFFECT_0).TriggerSpell }); } void PeriodicTick(AuraEffect const* aurEff) @@ -226,7 +226,7 @@ class spell_grobbulus_poison_cloud : public AuraScript if (!aurEff->GetTotalTicks()) return; - uint32 triggerSpell = GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell; + uint32 triggerSpell = aurEff->GetSpellEffectInfo().TriggerSpell; int32 mod = int32(((float(aurEff->GetTickNumber()) / aurEff->GetTotalTicks()) * 0.9f + 0.1f) * 10000 * 2 / 3); CastSpellExtraArgs args(aurEff); diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp index d98fd3ca3ff..aaee3fa7a94 100644 --- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp +++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp @@ -1707,7 +1707,7 @@ class spell_arcane_overload : public SpellScript { Creature* arcaneOverload = GetCaster()->ToCreature(); targets.remove_if(ExactDistanceCheck(arcaneOverload, - GetSpellInfo()->Effects[EFFECT_0].CalcRadius(arcaneOverload) * arcaneOverload->GetObjectScale())); + GetEffectInfo(EFFECT_0).CalcRadius(arcaneOverload) * arcaneOverload->GetObjectScale())); } void Register() override diff --git a/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp b/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp index 477c9343c3f..5a09a369d79 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/oculus.cpp @@ -405,7 +405,7 @@ class spell_oculus_ride_ruby_emerald_amber_drake_que : public AuraScript // caster of the triggered spell is wrong for an unknown reason, handle it here correctly PreventDefaultAction(); if (Unit* caster = GetCaster()) - GetTarget()->CastSpell(caster, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, true); + GetTarget()->CastSpell(caster, aurEff->GetSpellEffectInfo().TriggerSpell, true); } void Register() override diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp index d84083e7921..9927b90ea7c 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/boss_krystallus.cpp @@ -161,7 +161,7 @@ class spell_krystallus_shatter_effect : public SpellScript if (!GetHitUnit()) return; - float radius = GetSpellInfo()->Effects[EFFECT_0].CalcRadius(GetCaster()); + float radius = GetEffectInfo(EFFECT_0).CalcRadius(GetCaster()); if (!radius) return; diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp index dcdf84a21f2..740df69b8f5 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp @@ -27,6 +27,7 @@ #include "Player.h" #include "ScriptedCreature.h" #include "Spell.h" +#include "SpellAuraEffects.h" #include "SpellInfo.h" #include "SpellScript.h" #include "TemporarySummon.h" @@ -1072,7 +1073,7 @@ class spell_algalon_phase_constellation : public AuraScript bool Validate(SpellInfo const* spellInfo) override { - return ValidateSpellInfo({ spellInfo->Effects[EFFECT_0].TriggerSpell }); + return ValidateSpellInfo({ spellInfo->GetEffect(EFFECT_0).TriggerSpell }); } void HandlePeriodic(AuraEffect const* aurEff) @@ -1081,7 +1082,7 @@ class spell_algalon_phase_constellation : public AuraScript CastSpellExtraArgs args(aurEff); args.AddSpellMod(SPELLVALUE_MAX_TARGETS, 1); // Phase Effect should only 1 target. Avoid 1 black hole despawn multiple Living Constellation - GetTarget()->CastSpell(nullptr, GetSpellInfo()->Effects[EFFECT_0].TriggerSpell, args); + GetTarget()->CastSpell(nullptr, aurEff->GetSpellEffectInfo().TriggerSpell, args); } void Register() override diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp index 94d2f1b7a44..496528f0727 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp @@ -1528,13 +1528,13 @@ class spell_tar_blaze : public AuraScript bool Validate(SpellInfo const* spellInfo) override { - return ValidateSpellInfo({ spellInfo->Effects[EFFECT_0].TriggerSpell }); + return ValidateSpellInfo({ spellInfo->GetEffect(EFFECT_0).TriggerSpell }); } void PeriodicTick(AuraEffect const* aurEff) { // should we use custom damage? - GetTarget()->CastSpell(nullptr, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, true); + GetTarget()->CastSpell(nullptr, aurEff->GetSpellEffectInfo().TriggerSpell, true); } void Register() override @@ -1799,7 +1799,7 @@ class spell_vehicle_throw_passenger : public SpellScriptLoader class spell_vehicle_throw_passenger_SpellScript : public SpellScript { PrepareSpellScript(spell_vehicle_throw_passenger_SpellScript); - void HandleScript(SpellEffIndex effIndex) + void HandleScript(SpellEffIndex /*effIndex*/) { Spell* baseSpell = GetSpell(); SpellCastTargets targets = baseSpell->m_targets; @@ -1832,7 +1832,7 @@ class spell_vehicle_throw_passenger : public SpellScriptLoader } } } - if (target && target->IsWithinDist2d(targets.GetDstPos(), GetSpellInfo()->Effects[effIndex].CalcRadius() * 2)) // now we use *2 because the location of the seat is not correct + if (target && target->IsWithinDist2d(targets.GetDstPos(), GetEffectInfo().CalcRadius() * 2)) // now we use *2 because the location of the seat is not correct passenger->EnterVehicle(target, 0); else { diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp index eeb4a7bc9fc..24928e7a854 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp @@ -1594,7 +1594,7 @@ class spell_freya_iron_roots : public SpellScriptLoader void HandleSummon(SpellEffIndex effIndex) { PreventHitDefaultEffect(effIndex); - uint32 entry = uint32(GetSpellInfo()->Effects[effIndex].MiscValue); + uint32 entry = uint32(GetEffectInfo().MiscValue); Position pos = GetCaster()->GetPosition(); // Not good at all, but this prevents having roots in a different position then player diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp index 830c692d1f4..d832efe0bb6 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp @@ -458,17 +458,11 @@ class spell_ulduar_cancel_stone_grip : public SpellScriptLoader if (!target || !target->GetVehicle()) return; - switch (target->GetMap()->GetDifficulty()) - { - case RAID_DIFFICULTY_10MAN_NORMAL: - target->RemoveAura(GetSpellInfo()->Effects[EFFECT_0].CalcValue()); - break; - case RAID_DIFFICULTY_25MAN_NORMAL: - target->RemoveAura(GetSpellInfo()->Effects[EFFECT_1].CalcValue()); - break; - default: - break; - } + SpellEffIndex effectIndexToCancel = EFFECT_0; + if (target->GetMap()->Is25ManRaid()) + effectIndexToCancel = EFFECT_1; + + target->RemoveAura(GetEffectInfo(effectIndexToCancel).CalcValue()); } void Register() override @@ -663,7 +657,7 @@ class spell_kologarn_summon_focused_eyebeam : public SpellScriptLoader void HandleForceCast(SpellEffIndex effIndex) { PreventHitDefaultEffect(effIndex); - GetCaster()->CastSpell(GetCaster(), GetSpellInfo()->Effects[effIndex].TriggerSpell, true); + GetCaster()->CastSpell(GetCaster(), GetEffectInfo().TriggerSpell, true); } void Register() override diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp index d9b940cb3f2..531f6ae44b0 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_thorim.cpp @@ -976,13 +976,13 @@ struct npc_thorim_trashAI : public ScriptedAI static uint32 GetTotalHeal(SpellInfo const* spellInfo, Unit const* caster) { uint32 heal = 0; - for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) + for (SpellEffectInfo const& spellEffectInfo : spellInfo->GetEffects()) { - if (spellInfo->Effects[i].IsEffect(SPELL_EFFECT_HEAL)) - heal += spellInfo->Effects[i].CalcValue(caster); + if (spellEffectInfo.IsEffect(SPELL_EFFECT_HEAL)) + heal += spellEffectInfo.CalcValue(caster); - if (spellInfo->Effects[i].IsEffect(SPELL_EFFECT_APPLY_AURA) && spellInfo->Effects[i].IsAura(SPELL_AURA_PERIODIC_HEAL)) - heal += spellInfo->GetMaxTicks() * spellInfo->Effects[i].CalcValue(caster); + if (spellEffectInfo.IsEffect(SPELL_EFFECT_APPLY_AURA) && spellEffectInfo.IsAura(SPELL_AURA_PERIODIC_HEAL)) + heal += spellInfo->GetMaxTicks() * spellEffectInfo.CalcValue(caster); } return heal; } diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp index 66cbc107e88..564576aa4e1 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_xt002.cpp @@ -662,7 +662,7 @@ struct npc_xt_void_zone : public PassiveAI { int32 bp = 0; if (SpellInfo const* createdBySpell = sSpellMgr->GetSpellInfo(me->GetUInt32Value(UNIT_CREATED_BY_SPELL))) - bp = createdBySpell->Effects[EFFECT_1].CalcValue(); + bp = createdBySpell->GetEffect(EFFECT_1).CalcValue(); _scheduler.Schedule(1s, [this, bp](TaskContext consumption) { diff --git a/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp b/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp index ba3146570ec..0f77eea9b33 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_moragg.cpp @@ -100,7 +100,7 @@ class spell_moragg_ray : public AuraScript if (UnitAI* AI = GetTarget()->GetAI()) if (Unit* target = AI->SelectTarget(SelectTargetMethod::Random, 0, 45.0f, true)) { - uint32 triggerSpell = GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell; + uint32 triggerSpell = aurEff->GetSpellEffectInfo().TriggerSpell; GetTarget()->CastSpell(target, triggerSpell, aurEff); } } diff --git a/src/server/scripts/Northrend/zone_borean_tundra.cpp b/src/server/scripts/Northrend/zone_borean_tundra.cpp index dc82b457806..e203f87720f 100644 --- a/src/server/scripts/Northrend/zone_borean_tundra.cpp +++ b/src/server/scripts/Northrend/zone_borean_tundra.cpp @@ -1845,12 +1845,12 @@ class spell_nerubar_web_random_unit_not_on_quest : public SpellScript bool Validate(SpellInfo const* spellInfo) override { - return ValidateSpellInfo({ uint32(spellInfo->Effects[EFFECT_0].CalcValue()) }); + return ValidateSpellInfo({ uint32(spellInfo->GetEffect(EFFECT_0).CalcValue()) }); } void HandleScript(SpellEffIndex /*effIndex*/) { - GetHitUnit()->CastSpell(GetHitUnit(), (uint32)GetSpellInfo()->Effects[EFFECT_0].CalcValue(), true); + GetHitUnit()->CastSpell(GetHitUnit(), GetEffectInfo().CalcValue(), true); } void Register() override @@ -1920,12 +1920,12 @@ class spell_dispel_freed_soldier_debuff : public SpellScript bool Validate(SpellInfo const* spellInfo) override { - return ValidateSpellInfo({ uint32(spellInfo->Effects[EFFECT_0].CalcValue()) }); + return ValidateSpellInfo({ uint32(spellInfo->GetEffect(EFFECT_0).CalcValue()) }); } void HandleScript(SpellEffIndex /*effIndex*/) { - if (Aura* aura = GetHitUnit()->GetAura((uint32)GetSpellInfo()->Effects[EFFECT_0].CalcValue())) + if (Aura* aura = GetHitUnit()->GetAura(GetEffectInfo().CalcValue())) aura->ModStackAmount(-1); } diff --git a/src/server/scripts/Northrend/zone_storm_peaks.cpp b/src/server/scripts/Northrend/zone_storm_peaks.cpp index 7ece021d56e..0421465002f 100644 --- a/src/server/scripts/Northrend/zone_storm_peaks.cpp +++ b/src/server/scripts/Northrend/zone_storm_peaks.cpp @@ -1127,7 +1127,7 @@ class spell_low_health_trigger : public SpellScriptLoader bool Validate(SpellInfo const* spellInfo) override { - return ValidateSpellInfo({ static_cast<uint32>(spellInfo->Effects[EFFECT_0].CalcValue()) }); + return ValidateSpellInfo({ static_cast<uint32>(spellInfo->GetEffect(EFFECT_0).CalcValue()) }); } void HandleScript(SpellEffIndex /*effIndex*/) diff --git a/src/server/scripts/Northrend/zone_wintergrasp.cpp b/src/server/scripts/Northrend/zone_wintergrasp.cpp index b79ba8faf03..c483b6aa139 100644 --- a/src/server/scripts/Northrend/zone_wintergrasp.cpp +++ b/src/server/scripts/Northrend/zone_wintergrasp.cpp @@ -376,7 +376,7 @@ class go_wg_vehicle_teleporter : public GameObjectScript return nullptr; } - void UpdateAI(uint32 diff) + void UpdateAI(uint32 diff) override { _checkTimer += diff; if (_checkTimer >= 1000) @@ -570,7 +570,7 @@ class spell_wintergrasp_tenacity_refresh : public AuraScript bool Validate(SpellInfo const* spellInfo) override { - uint32 triggeredSpellId = spellInfo->Effects[EFFECT_2].CalcValue(); + uint32 triggeredSpellId = spellInfo->GetEffect(EFFECT_2).CalcValue(); return !triggeredSpellId || ValidateSpellInfo({ triggeredSpellId }); } @@ -578,7 +578,7 @@ class spell_wintergrasp_tenacity_refresh : public AuraScript { PreventDefaultAction(); - if (uint32 triggeredSpellId = GetSpellInfo()->Effects[aurEff->GetEffIndex()].CalcValue()) + if (uint32 triggeredSpellId = aurEff->GetSpellEffectInfo().CalcValue()) { int32 bp = 0; if (AuraEffect const* healEffect = GetEffect(EFFECT_0)) @@ -596,7 +596,7 @@ class spell_wintergrasp_tenacity_refresh : public AuraScript void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) { - if (uint32 triggeredSpellId = GetSpellInfo()->Effects[aurEff->GetEffIndex()].CalcValue()) + if (uint32 triggeredSpellId = aurEff->GetSpellEffectInfo().CalcValue()) GetTarget()->RemoveAurasDueToSpell(triggeredSpellId); } @@ -612,7 +612,7 @@ class condition_is_wintergrasp_horde : public ConditionScript public: condition_is_wintergrasp_horde() : ConditionScript("condition_is_wintergrasp_horde") { } - bool OnConditionCheck(Condition const* /* condition */, ConditionSourceInfo& /* sourceInfo */) + bool OnConditionCheck(Condition const* /* condition */, ConditionSourceInfo& /* sourceInfo */) override { Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); if (wintergrasp && wintergrasp->IsEnabled() && wintergrasp->GetDefenderTeam() == TEAM_HORDE) @@ -626,7 +626,7 @@ class condition_is_wintergrasp_alliance : public ConditionScript public: condition_is_wintergrasp_alliance() : ConditionScript("condition_is_wintergrasp_alliance") { } - bool OnConditionCheck(Condition const* /* condition */, ConditionSourceInfo& /* sourceInfo */) + bool OnConditionCheck(Condition const* /* condition */, ConditionSourceInfo& /* sourceInfo */) override { Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG); if (wintergrasp && wintergrasp->IsEnabled() && wintergrasp->GetDefenderTeam() == TEAM_ALLIANCE) diff --git a/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp b/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp index 8e1a5bd14d7..b876dc0900e 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp @@ -248,14 +248,14 @@ class spell_mother_shahraz_saber_lash : public AuraScript bool Validate(SpellInfo const* spellInfo) override { - return ValidateSpellInfo({ spellInfo->Effects[EFFECT_1].TriggerSpell }); + return ValidateSpellInfo({ spellInfo->GetEffect(EFFECT_1).TriggerSpell }); } void OnTrigger(AuraEffect const* aurEff) { PreventDefaultAction(); - uint32 triggerSpell = GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell; + uint32 triggerSpell = aurEff->GetSpellEffectInfo().TriggerSpell; if (Unit* target = GetUnitOwner()->GetAI()->SelectTarget(SelectTargetMethod::Random, 0)) GetUnitOwner()->CastSpell(target, triggerSpell, true); } @@ -276,14 +276,14 @@ class spell_mother_shahraz_generic_periodic : public AuraScript bool Validate(SpellInfo const* spellInfo) override { - return ValidateSpellInfo({ spellInfo->Effects[EFFECT_0].TriggerSpell }); + return ValidateSpellInfo({ spellInfo->GetEffect(EFFECT_0).TriggerSpell }); } void OnTrigger(AuraEffect const* aurEff) { PreventDefaultAction(); - uint32 triggerSpell = GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell; + uint32 triggerSpell = aurEff->GetSpellEffectInfo().TriggerSpell; if (Unit* target = GetUnitOwner()->GetAI()->SelectTarget(SelectTargetMethod::Random, 0)) GetUnitOwner()->CastSpell(target, triggerSpell, true); } diff --git a/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp b/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp index 35e7d6fe4ef..3b519ae2bc0 100644 --- a/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp +++ b/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp @@ -316,7 +316,7 @@ class spell_gruul_shatter_effect : public SpellScriptLoader if (!GetHitUnit()) return; - float radius = GetSpellInfo()->Effects[EFFECT_0].CalcRadius(GetCaster()); + float radius = GetEffectInfo(EFFECT_0).CalcRadius(GetCaster()); if (!radius) return; diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp index 3d6220752f0..097704753ba 100644 --- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_broggok.cpp @@ -286,7 +286,7 @@ class spell_broggok_poison_cloud : public SpellScriptLoader bool Validate(SpellInfo const* spellInfo) override { - return ValidateSpellInfo({ spellInfo->Effects[EFFECT_0].TriggerSpell }); + return ValidateSpellInfo({ spellInfo->GetEffect(EFFECT_0).TriggerSpell }); } void PeriodicTick(AuraEffect const* aurEff) @@ -295,7 +295,7 @@ class spell_broggok_poison_cloud : public SpellScriptLoader if (!aurEff->GetTotalTicks()) return; - uint32 triggerSpell = GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell; + uint32 triggerSpell = aurEff->GetSpellEffectInfo().TriggerSpell; int32 mod = int32(((float(aurEff->GetTickNumber()) / aurEff->GetTotalTicks()) * 0.9f + 0.1f) * 10000 * 2 / 3); GetTarget()->CastSpell(nullptr, triggerSpell, CastSpellExtraArgs(aurEff).AddSpellMod(SPELLVALUE_RADIUS_MOD, mod)); } diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp index 606364abd76..42a7522e96e 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp @@ -521,7 +521,7 @@ class spell_astromancer_wrath_of_the_astromancer : public SpellScriptLoader return; Unit* target = GetUnitOwner(); - target->CastSpell(target, GetSpellInfo()->Effects[EFFECT_1].CalcValue(), false); + target->CastSpell(target, GetEffectInfo(EFFECT_1).CalcValue(), false); } void Register() override diff --git a/src/server/scripts/Pet/pet_hunter.cpp b/src/server/scripts/Pet/pet_hunter.cpp index 8c7cb43811f..3557ebb829a 100644 --- a/src/server/scripts/Pet/pet_hunter.cpp +++ b/src/server/scripts/Pet/pet_hunter.cpp @@ -207,7 +207,7 @@ class spell_pet_guard_dog : public AuraScript Unit* target = eventInfo.GetProcTarget(); if (!target->CanHaveThreatList()) return; - float addThreat = CalculatePct(ASSERT_NOTNULL(eventInfo.GetSpellInfo())->Effects[EFFECT_0].CalcValue(caster), aurEff->GetAmount()); + float addThreat = CalculatePct(ASSERT_NOTNULL(eventInfo.GetSpellInfo())->GetEffect(EFFECT_0).CalcValue(caster), aurEff->GetAmount()); target->GetThreatManager().AddThreat(caster, addThreat, GetSpellInfo(), false, true); } diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index b5f0a6de54a..5e134b45f57 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -252,7 +252,7 @@ private: bool Load() override { - absorbPct = GetSpellInfo()->Effects[EFFECT_0].CalcValue(GetCaster()); + absorbPct = GetEffectInfo(EFFECT_0).CalcValue(GetCaster()); return true; } @@ -290,8 +290,8 @@ private: uint32 absorbPct, hpPct; bool Load() override { - absorbPct = GetSpellInfo()->Effects[EFFECT_0].CalcValue(GetCaster()); - hpPct = GetSpellInfo()->Effects[EFFECT_1].CalcValue(GetCaster()); + absorbPct = GetEffectInfo(EFFECT_0).CalcValue(GetCaster()); + hpPct = GetEffectInfo(EFFECT_1).CalcValue(GetCaster()); return true; } @@ -343,7 +343,7 @@ private: bool Load() override { - absorbPct = GetSpellInfo()->Effects[EFFECT_0].CalcValue(GetCaster()); + absorbPct = GetEffectInfo(EFFECT_0).CalcValue(GetCaster()); return true; } @@ -359,7 +359,7 @@ private: if (!owner) return; - amount = talentSpell->Effects[EFFECT_0].CalcValue(owner); + amount = talentSpell->GetEffect(EFFECT_0).CalcValue(owner); if (Player* player = owner->ToPlayer()) amount += int32(2 * player->GetTotalAttackPowerValue(BASE_ATTACK)); } @@ -550,7 +550,7 @@ class spell_dk_corpse_explosion : public SpellScript SPELL_DK_CORPSE_EXPLOSION_TRIGGERED, SPELL_DK_GHOUL_EXPLODE, SPELL_DK_CORPSE_EXPLOSION_VISUAL, - static_cast<uint32>(spellInfo->Effects[EFFECT_1].CalcValue()) + static_cast<uint32>(spellInfo->GetEffect(EFFECT_1).CalcValue()) }); } @@ -587,11 +587,11 @@ class spell_dk_corpse_explosion : public SpellScript if (effIndex == EFFECT_0) { args.AddSpellBP0(GetEffectValue()); - GetCaster()->CastSpell(target, GetSpellInfo()->GetEffect(EFFECT_1).CalcValue(), args); + GetCaster()->CastSpell(target, GetEffectInfo(EFFECT_1).CalcValue(), args); } else if (effIndex == EFFECT_1) { - args.AddSpellBP0(GetSpell()->CalculateDamage(GetSpellInfo()->GetEffect(EFFECT_0))); + args.AddSpellBP0(GetSpell()->CalculateDamage(GetEffectInfo(EFFECT_0))); GetCaster()->CastSpell(target, GetEffectValue(), args); } } @@ -893,7 +893,7 @@ class spell_dk_death_strike : public SpellScript if (Unit* target = GetHitUnit()) { uint32 count = target->GetDiseasesByCaster(caster->GetGUID()); - int32 bp = int32(count * caster->CountPctFromMaxHealth(int32(GetSpellInfo()->Effects[EFFECT_0].DamageMultiplier))); + int32 bp = int32(count * caster->CountPctFromMaxHealth(int32(GetEffectInfo(EFFECT_0).DamageMultiplier))); // Improved Death Strike if (AuraEffect const* aurEff = caster->GetAuraEffect(SPELL_AURA_ADD_PCT_MODIFIER, SPELLFAMILY_DEATHKNIGHT, DK_ICON_ID_IMPROVED_DEATH_STRIKE, 0)) AddPct(bp, caster->CalculateSpellDamage(aurEff->GetSpellInfo()->GetEffect(EFFECT_2))); @@ -919,12 +919,12 @@ class spell_dk_ghoul_explode : public SpellScript bool Validate(SpellInfo const* spellInfo) override { return ValidateSpellInfo({ SPELL_DK_CORPSE_EXPLOSION_TRIGGERED }) && - spellInfo->Effects[EFFECT_2].CalcValue() > 0; + spellInfo->GetEffect(EFFECT_2).CalcValue() > 0; } void HandleDamage(SpellEffIndex /*effIndex*/) { - int32 value = int32(GetCaster()->CountPctFromMaxHealth(GetSpellInfo()->Effects[EFFECT_2].CalcValue(GetCaster()))); + int32 value = int32(GetCaster()->CountPctFromMaxHealth(GetSpellInfo()->GetEffect(EFFECT_2).CalcValue(GetCaster()))); SetEffectValue(value); } @@ -1267,7 +1267,7 @@ class spell_dk_improved_unholy_presence : public AuraScript if (target->HasAura(SPELL_DK_UNHOLY_PRESENCE) && !target->HasAura(SPELL_DK_IMPROVED_UNHOLY_PRESENCE_TRIGGERED)) { // Not listed as any effect, only base points set in dbc - int32 basePoints = GetSpellInfo()->Effects[EFFECT_1].CalcValue(); + int32 basePoints = GetEffectInfo(EFFECT_1).CalcValue(); CastSpellExtraArgs args(aurEff); for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i) args.AddSpellMod(SpellValueMod(SPELLVALUE_BASE_POINT0 + i), basePoints); @@ -1518,7 +1518,7 @@ class spell_dk_presence : public AuraScript if (GetId() == SPELL_DK_UNHOLY_PRESENCE) { // Not listed as any effect, only base points set - int32 bp = impAurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue(); + int32 bp = impAurEff->GetSpellInfo()->GetEffect(EFFECT_1).CalcValue(); CastSpellExtraArgs args(aurEff); for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i) args.AddSpellMod(SpellValueMod(SPELLVALUE_BASE_POINT0 + i), bp); @@ -1583,8 +1583,8 @@ class spell_dk_raise_dead : public SpellScript { return ValidateSpellInfo( { - static_cast<uint32>(spellInfo->Effects[EFFECT_1].CalcValue()), - static_cast<uint32>(spellInfo->Effects[EFFECT_2].CalcValue()), + static_cast<uint32>(spellInfo->GetEffect(EFFECT_1).CalcValue()), + static_cast<uint32>(spellInfo->GetEffect(EFFECT_2).CalcValue()), SPELL_DK_RAISE_DEAD_USE_REAGENT, SPELL_DK_MASTER_OF_GHOULS }); @@ -1665,10 +1665,10 @@ class spell_dk_raise_dead : public SpellScript // Do we have talent Master of Ghouls? if (GetCaster()->HasAura(SPELL_DK_MASTER_OF_GHOULS)) // summon as pet - return GetSpellInfo()->Effects[EFFECT_2].CalcValue(); + return GetSpellInfo()->GetEffect(EFFECT_2).CalcValue(); // or guardian - return GetSpellInfo()->Effects[EFFECT_1].CalcValue(); + return GetSpellInfo()->GetEffect(EFFECT_1).CalcValue(); } void HandleRaiseDead(SpellEffIndex /*effIndex*/) @@ -1776,7 +1776,7 @@ class spell_dk_scent_of_blood_trigger : public AuraScript // or we would be adding stacks to a possibly existing aura void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/) { - GetTarget()->RemoveAurasDueToSpell(GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell); + GetTarget()->RemoveAurasDueToSpell(aurEff->GetSpellEffectInfo().TriggerSpell); } void Register() override @@ -1855,7 +1855,7 @@ private: bool Load() override { - absorbPct = GetSpellInfo()->Effects[EFFECT_0].CalcValue(GetCaster()); + absorbPct = GetEffectInfo(EFFECT_0).CalcValue(GetCaster()); return true; } @@ -2130,7 +2130,7 @@ class spell_dk_will_of_the_necropolis : public AuraScript bool Load() override { - absorbPct = GetSpellInfo()->Effects[EFFECT_0].CalcValue(GetCaster()); + absorbPct = GetEffectInfo(EFFECT_0).CalcValue(GetCaster()); return true; } @@ -2147,7 +2147,7 @@ class spell_dk_will_of_the_necropolis : public AuraScript SpellInfo const* talentProto = sSpellMgr->AssertSpellInfo(sSpellMgr->GetSpellWithRank(SPELL_DK_WILL_OF_THE_NECROPOLIS_TALENT_R1, rank)); int32 remainingHp = int32(GetTarget()->GetHealth() - dmgInfo.GetDamage()); - int32 minHp = int32(GetTarget()->CountPctFromMaxHealth(talentProto->Effects[EFFECT_0].CalcValue(GetCaster()))); + int32 minHp = int32(GetTarget()->CountPctFromMaxHealth(talentProto->GetEffect(EFFECT_0).CalcValue(GetCaster()))); // Damage that would take you below [effect0] health or taken while you are at [effect0] if (remainingHp < minHp) @@ -2221,7 +2221,7 @@ class spell_dk_raise_ally_initial : public SpellScript bool Validate(SpellInfo const* spellInfo) override { - return ValidateSpellInfo({ static_cast<uint32>(spellInfo->Effects[EFFECT_0].CalcValue()) }); + return ValidateSpellInfo({ static_cast<uint32>(spellInfo->GetEffect(EFFECT_0).CalcValue()) }); } bool Load() override @@ -2315,7 +2315,7 @@ public: if (!originalCaster) return; - uint32 entry = uint32(GetSpellInfo()->Effects[effIndex].MiscValue); + uint32 entry = uint32(GetEffectInfo().MiscValue); //! HACK - StatSystem needs further develop to enable update on Puppet stats // Using same summon properties as Raise Dead 46585 (Guardian) - EffectMiscValueB = 829 diff --git a/src/server/scripts/Spells/spell_druid.cpp b/src/server/scripts/Spells/spell_druid.cpp index c3d1eb7a772..5f15fd45cff 100644 --- a/src/server/scripts/Spells/spell_druid.cpp +++ b/src/server/scripts/Spells/spell_druid.cpp @@ -457,7 +457,7 @@ class spell_dru_frenzied_regeneration : public AuraScript return; int32 const mod = std::min(static_cast<int32>(rage), 100); - int32 const regen = CalculatePct(GetTarget()->GetMaxHealth(), GetTarget()->CalculateSpellDamage(GetSpellInfo()->GetEffect(EFFECT_1)) * mod / 100.f); + int32 const regen = CalculatePct(GetTarget()->GetMaxHealth(), GetTarget()->CalculateSpellDamage(GetEffectInfo(EFFECT_1)) * mod / 100.f); CastSpellExtraArgs args(aurEff); args.AddSpellBP0(regen); GetTarget()->CastSpell(nullptr, SPELL_DRUID_FRENZIED_REGENERATION_HEAL, args); @@ -712,7 +712,7 @@ class spell_dru_idol_lifebloom : public AuraScript spellMod->op = SPELLMOD_DOT; spellMod->type = SPELLMOD_FLAT; spellMod->spellId = GetId(); - spellMod->mask = GetSpellInfo()->Effects[aurEff->GetEffIndex()].SpellClassMask; + spellMod->mask = aurEff->GetSpellEffectInfo().SpellClassMask; } spellMod->value = aurEff->GetAmount() / 7; } @@ -810,7 +810,7 @@ class spell_dru_leader_of_the_pack : public AuraScript ASSERT(impLotpMana); CastSpellExtraArgs args2(aurEff); - args2.AddSpellBP0(CalculatePct(caster->GetMaxPower(POWER_MANA), impLotpMana->GetSpellInfo()->Effects[EFFECT_1].CalcValue())); + args2.AddSpellBP0(CalculatePct(caster->GetMaxPower(POWER_MANA), impLotpMana->GetSpellInfo()->GetEffect(EFFECT_1).CalcValue())); caster->CastSpell(nullptr, SPELL_DRUID_IMP_LEADER_OF_THE_PACK_MANA, args2); } @@ -945,7 +945,7 @@ private: bool Load() override { - absorbPct = GetSpellInfo()->Effects[EFFECT_0].CalcValue(GetCaster()); + absorbPct = GetEffectInfo(EFFECT_0).CalcValue(GetCaster()); return true; } @@ -1110,7 +1110,7 @@ private: bool Load() override { - absorbPct = GetSpellInfo()->Effects[EFFECT_1].CalcValue(GetCaster()); + absorbPct = GetEffectInfo(EFFECT_1).CalcValue(GetCaster()); return true; } @@ -1231,7 +1231,7 @@ class spell_dru_savage_defense : public AuraScript bool Validate(SpellInfo const* spellInfo) override { - return ValidateSpellInfo({ spellInfo->Effects[EFFECT_0].TriggerSpell }); + return ValidateSpellInfo({ spellInfo->GetEffect(EFFECT_0).TriggerSpell }); } void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) @@ -1240,7 +1240,7 @@ class spell_dru_savage_defense : public AuraScript Unit* caster = eventInfo.GetActor(); CastSpellExtraArgs args(aurEff); args.AddSpellBP0(CalculatePct(caster->GetTotalAttackPowerValue(BASE_ATTACK), aurEff->GetAmount())); - caster->CastSpell(nullptr, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, args); + caster->CastSpell(nullptr, aurEff->GetSpellEffectInfo().TriggerSpell, args); } void Register() override @@ -1851,7 +1851,7 @@ class spell_dru_wild_growth : public SpellScript bool Validate(SpellInfo const* spellInfo) override { - if (spellInfo->Effects[EFFECT_2].IsEffect() || spellInfo->Effects[EFFECT_2].CalcValue() <= 0) + if (spellInfo->GetEffect(EFFECT_2).IsEffect() || spellInfo->GetEffect(EFFECT_2).CalcValue() <= 0) return false; return true; } @@ -1860,7 +1860,7 @@ class spell_dru_wild_growth : public SpellScript { targets.remove_if(RaidCheck(GetCaster())); - uint32 const maxTargets = uint32(GetSpellInfo()->Effects[EFFECT_2].CalcValue(GetCaster())); + uint32 const maxTargets = uint32(GetEffectInfo(EFFECT_2).CalcValue(GetCaster())); if (targets.size() > maxTargets) { diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index f4b6ae93f29..c6e3232f56e 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -51,7 +51,7 @@ class spell_gen_absorb0_hitlimit1 : public AuraScript bool Load() override { // Max absorb stored in 1 dummy effect - limit = GetSpellInfo()->Effects[EFFECT_1].CalcValue(); + limit = GetEffectInfo(EFFECT_1).CalcValue(); return true; } @@ -271,7 +271,7 @@ class spell_gen_arena_drink : public AuraScript bool Validate(SpellInfo const* spellInfo) override { - if (!spellInfo->Effects[EFFECT_0].IsAura() || spellInfo->Effects[EFFECT_0].ApplyAuraName != SPELL_AURA_MOD_POWER_REGEN) + if (!spellInfo->GetEffect(EFFECT_0).IsAura(SPELL_AURA_MOD_POWER_REGEN)) { TC_LOG_ERROR("spells", "Aura %d structure has been changed - first aura is no longer SPELL_AURA_MOD_POWER_REGEN", GetId()); return false; @@ -370,7 +370,7 @@ class spell_gen_aura_of_fear : public AuraScript bool Validate(SpellInfo const* spellInfo) override { - return ValidateSpellInfo({ spellInfo->Effects[EFFECT_0].TriggerSpell }); + return ValidateSpellInfo({ spellInfo->GetEffect(EFFECT_0).TriggerSpell }); } void PeriodicTick(AuraEffect const* aurEff) @@ -379,7 +379,7 @@ class spell_gen_aura_of_fear : public AuraScript if (!roll_chance_i(GetSpellInfo()->ProcChance)) return; - GetTarget()->CastSpell(nullptr, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, true); + GetTarget()->CastSpell(nullptr, aurEff->GetSpellEffectInfo().TriggerSpell, true); } void Register() override @@ -612,7 +612,7 @@ class spell_gen_blade_warding : public AuraScript int32 bp = 0; for (uint8 i = 0; i < stacks; ++i) - bp += spellInfo->Effects[EFFECT_0].CalcValue(caster); + bp += spellInfo->GetEffect(EFFECT_0).CalcValue(caster); CastSpellExtraArgs args(aurEff); args.AddSpellBP0(bp); @@ -781,18 +781,18 @@ class spell_gen_burning_depths_necrolyte_image : public AuraScript bool Validate(SpellInfo const* spellInfo) override { - return ValidateSpellInfo({ static_cast<uint32>(spellInfo->Effects[EFFECT_2].CalcValue()) }); + return ValidateSpellInfo({ static_cast<uint32>(spellInfo->GetEffect(EFFECT_2).CalcValue()) }); } void HandleApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { if (Unit* caster = GetCaster()) - caster->CastSpell(GetTarget(), uint32(GetSpellInfo()->Effects[EFFECT_2].CalcValue())); + caster->CastSpell(GetTarget(), uint32(GetEffectInfo(EFFECT_2).CalcValue())); } void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - GetTarget()->RemoveAurasDueToSpell(uint32(GetSpellInfo()->Effects[EFFECT_2].CalcValue()), GetCasterGUID()); + GetTarget()->RemoveAurasDueToSpell(uint32(GetEffectInfo(EFFECT_2).CalcValue()), GetCasterGUID()); } void Register() override @@ -1399,18 +1399,18 @@ class spell_gen_defend : public AuraScript SpellInfo const* spell = sSpellMgr->AssertSpellInfo(m_scriptSpellId); // Defend spells cast by NPCs (add visuals) - if (spell->Effects[EFFECT_0].ApplyAuraName == SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN) + if (spell->GetEffect(EFFECT_0).ApplyAuraName == SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN) { AfterEffectApply += AuraEffectApplyFn(spell_gen_defend::RefreshVisualShields, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); OnEffectRemove += AuraEffectRemoveFn(spell_gen_defend::RemoveVisualShields, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK); } // Remove Defend spell from player when he dismounts - if (spell->Effects[EFFECT_2].ApplyAuraName == SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN) + if (spell->GetEffect(EFFECT_2).ApplyAuraName == SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN) OnEffectRemove += AuraEffectRemoveFn(spell_gen_defend::RemoveDummyFromDriver, EFFECT_2, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, AURA_EFFECT_HANDLE_REAL); // Defend spells cast by players (add/remove visuals) - if (spell->Effects[EFFECT_1].ApplyAuraName == SPELL_AURA_DUMMY) + if (spell->GetEffect(EFFECT_1).ApplyAuraName == SPELL_AURA_DUMMY) { AfterEffectApply += AuraEffectApplyFn(spell_gen_defend::RefreshVisualShields, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); OnEffectRemove += AuraEffectRemoveFn(spell_gen_defend::RemoveVisualShields, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK); @@ -1427,9 +1427,9 @@ class spell_gen_despawn_self : public SpellScript return GetCaster()->GetTypeId() == TYPEID_UNIT; } - void HandleDummy(SpellEffIndex effIndex) + void HandleDummy(SpellEffIndex /*effIndex*/) { - if (GetSpellInfo()->Effects[effIndex].Effect == SPELL_EFFECT_DUMMY || GetSpellInfo()->Effects[effIndex].Effect == SPELL_EFFECT_SCRIPT_EFFECT) + if (GetEffectInfo().IsEffect(SPELL_EFFECT_DUMMY) || GetEffectInfo().IsEffect(SPELL_EFFECT_SCRIPT_EFFECT)) GetCaster()->ToCreature()->DespawnOrUnsummon(); } @@ -2366,7 +2366,7 @@ class spell_gen_mounted_charge : public SpellScript if (spell->HasEffect(SPELL_EFFECT_SCRIPT_EFFECT)) OnEffectHitTarget += SpellEffectFn(spell_gen_mounted_charge::HandleScriptEffect, EFFECT_FIRST_FOUND, SPELL_EFFECT_SCRIPT_EFFECT); - if (spell->Effects[EFFECT_0].Effect == SPELL_EFFECT_CHARGE) + if (spell->GetEffect(EFFECT_0).Effect == SPELL_EFFECT_CHARGE) OnEffectHitTarget += SpellEffectFn(spell_gen_mounted_charge::HandleChargeEffect, EFFECT_0, SPELL_EFFECT_CHARGE); } }; @@ -2406,7 +2406,7 @@ class spell_gen_negative_energy_periodic : public AuraScript bool Validate(SpellInfo const* spellInfo) override { - return ValidateSpellInfo({ spellInfo->Effects[EFFECT_0].TriggerSpell }); + return ValidateSpellInfo({ spellInfo->GetEffect(EFFECT_0).TriggerSpell }); } void PeriodicTick(AuraEffect const* aurEff) @@ -2415,7 +2415,7 @@ class spell_gen_negative_energy_periodic : public AuraScript CastSpellExtraArgs args(aurEff); args.AddSpellMod(SPELLVALUE_MAX_TARGETS, aurEff->GetTickNumber() / 10 + 1); - GetTarget()->CastSpell(nullptr, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, args); + GetTarget()->CastSpell(nullptr, aurEff->GetSpellEffectInfo().TriggerSpell, args); } void Register() override @@ -2629,11 +2629,11 @@ class spell_gen_oracle_wolvar_reputation : public SpellScript return GetCaster()->GetTypeId() == TYPEID_PLAYER; } - void HandleDummy(SpellEffIndex effIndex) + void HandleDummy(SpellEffIndex /*effIndex*/) { Player* player = GetCaster()->ToPlayer(); - uint32 factionId = GetSpellInfo()->Effects[effIndex].CalcValue(); - int32 repChange = GetSpellInfo()->Effects[EFFECT_1].CalcValue(); + uint32 factionId = GetEffectInfo().CalcValue(); + int32 repChange = GetEffectInfo(EFFECT_1).CalcValue(); FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionId); if (!factionEntry) @@ -2755,7 +2755,7 @@ class spell_gen_proc_below_pct_damaged : public AuraScript if (!damageInfo || !damageInfo->GetDamage()) return false; - int32 pct = GetSpellInfo()->Effects[EFFECT_0].CalcValue(); + int32 pct = GetEffectInfo(EFFECT_0).CalcValue(); if (eventInfo.GetActionTarget()->HealthBelowPctDamaged(pct, damageInfo->GetDamage())) return true; @@ -3003,7 +3003,7 @@ class spell_gen_remove_on_health_pct : public AuraScript { // they apply damage so no need to check for ticks here - if (GetTarget()->HealthAbovePct(GetSpellInfo()->Effects[EFFECT_1].CalcValue())) + if (GetTarget()->HealthAbovePct(GetEffectInfo(EFFECT_1).CalcValue())) { Remove(AURA_REMOVE_BY_ENEMY_SPELL); PreventDefaultAction(); @@ -3028,7 +3028,7 @@ class spell_gen_remove_on_full_health : public AuraScript void PeriodicTick(AuraEffect const* aurEff) { // if it has only periodic effect, allow 1 tick - bool onlyEffect = !GetSpellInfo()->Effects[EFFECT_1].IsEffect() && !GetSpellInfo()->Effects[EFFECT_2].IsEffect(); + bool onlyEffect = !GetEffectInfo(EFFECT_1).IsEffect() && !GetEffectInfo(EFFECT_2).IsEffect(); if (onlyEffect && aurEff->GetTickNumber() <= 1) return; @@ -3715,7 +3715,7 @@ class spell_gen_eject_passenger : public SpellScript bool Validate(SpellInfo const* spellInfo) override { - if (spellInfo->Effects[EFFECT_0].CalcValue() < 1) + if (spellInfo->GetEffect(EFFECT_0).CalcValue() < 1) return false; return true; } @@ -3950,7 +3950,7 @@ class spell_gen_mixology_bonus : public AuraScript void CalculateAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/) { - if (GetCaster()->HasAura(SPELL_MIXOLOGY) && GetCaster()->HasSpell(GetSpellInfo()->Effects[EFFECT_0].TriggerSpell)) + if (GetCaster()->HasAura(SPELL_MIXOLOGY) && GetCaster()->HasSpell(GetEffectInfo(EFFECT_0).TriggerSpell)) { switch (GetId()) { @@ -4387,7 +4387,7 @@ class spell_freezing_circle : public SpellScript spellId = SPELL_FREEZING_CIRCLE; if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId)) - SetHitDamage(spellInfo->Effects[EFFECT_0].CalcValue()); + SetHitDamage(spellInfo->GetEffect(EFFECT_0).CalcValue()); } void Register() override @@ -4432,9 +4432,9 @@ class spell_gen_cannon_blast : public SpellScript { return ValidateSpellInfo({ SPELL_CANNON_BLAST }); } - void HandleScript(SpellEffIndex effIndex) + void HandleScript(SpellEffIndex /*effIndex*/) { - int32 bp = GetSpellInfo()->Effects[effIndex].CalcValue(); + int32 bp = GetEffectInfo().CalcValue(); Unit* target = GetHitUnit(); CastSpellExtraArgs args(TRIGGERED_FULL_MASK); args.AddSpellBP0(bp); diff --git a/src/server/scripts/Spells/spell_holiday.cpp b/src/server/scripts/Spells/spell_holiday.cpp index fa00722a71b..5d3602735bc 100644 --- a/src/server/scripts/Spells/spell_holiday.cpp +++ b/src/server/scripts/Spells/spell_holiday.cpp @@ -580,7 +580,7 @@ class spell_pilgrims_bounty_feast_on : public SpellScriptLoader if (Aura* aura = caster->GetAura(GetEffectValue())) { if (aura->GetStackAmount() == 1) - caster->RemoveAurasDueToSpell(aura->GetSpellInfo()->Effects[EFFECT_0].CalcValue()); + caster->RemoveAurasDueToSpell(aura->GetSpellInfo()->GetEffect(EFFECT_0).CalcValue()); aura->ModStackAmount(-1); } } @@ -1312,7 +1312,7 @@ class spell_brewfest_relay_race_intro_force_player_to_throw : public SpellScript PreventHitDefaultEffect(effIndex); // All this spells trigger a spell that requires reagents; if the // triggered spell is cast as "triggered", reagents are not consumed - GetHitUnit()->CastSpell(nullptr, GetSpellInfo()->Effects[effIndex].TriggerSpell, TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_IGNORE_POWER_AND_REAGENT_COST)); + GetHitUnit()->CastSpell(nullptr, GetEffectInfo().TriggerSpell, TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_IGNORE_POWER_AND_REAGENT_COST)); } void Register() override diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp index 6cdbca548f3..cc6c58aaee0 100644 --- a/src/server/scripts/Spells/spell_hunter.cpp +++ b/src/server/scripts/Spells/spell_hunter.cpp @@ -289,14 +289,14 @@ class spell_hun_cobra_strikes : public AuraScript bool Validate(SpellInfo const* spellInfo) override { - return ValidateSpellInfo({ spellInfo->Effects[EFFECT_0].TriggerSpell }); + return ValidateSpellInfo({ spellInfo->GetEffect(EFFECT_0).TriggerSpell }); } void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/) { PreventDefaultAction(); - SpellInfo const* triggeredSpellInfo = sSpellMgr->AssertSpellInfo(GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell); + SpellInfo const* triggeredSpellInfo = sSpellMgr->AssertSpellInfo(aurEff->GetSpellEffectInfo().TriggerSpell); CastSpellExtraArgs args(TRIGGERED_FULL_MASK); args.AddSpellMod(SPELLVALUE_AURA_STACK, triggeredSpellInfo->StackAmount); @@ -671,8 +671,8 @@ class spell_hun_masters_call : public SpellScript return ValidateSpellInfo( { SPELL_HUNTER_MASTERS_CALL_TRIGGERED, - static_cast<uint32>(spellInfo->Effects[EFFECT_0].CalcValue()), - static_cast<uint32>(spellInfo->Effects[EFFECT_1].CalcValue()) + static_cast<uint32>(spellInfo->GetEffect(EFFECT_0).CalcValue()), + static_cast<uint32>(spellInfo->GetEffect(EFFECT_1).CalcValue()) }); } @@ -929,7 +929,7 @@ class spell_hun_rapid_recuperation : public AuraScript bool Validate(SpellInfo const* spellInfo) override { - return ValidateSpellInfo({ spellInfo->Effects[EFFECT_0].TriggerSpell }); + return ValidateSpellInfo({ spellInfo->GetEffect(EFFECT_0).TriggerSpell }); } void HandlePeriodic(AuraEffect const* aurEff) diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index 7868a41987e..c2c0321cddc 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -177,10 +177,10 @@ class spell_item_alchemists_stone : public AuraScript return; Unit* caster = eventInfo.GetActionTarget(); - for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) + for (SpellEffectInfo const& spellEffectInfo : spellInfo->GetEffects()) { uint32 spellId; - switch (spellInfo->Effects[i].Effect) + switch (spellEffectInfo.Effect) { case SPELL_EFFECT_HEAL: spellId = SPELL_ALCHEMISTS_STONE_EXTRA_HEAL; @@ -193,7 +193,7 @@ class spell_item_alchemists_stone : public AuraScript } CastSpellExtraArgs args(aurEff); - args.AddSpellBP0(CalculatePct(spellInfo->Effects[i].CalcValue(caster), 40)); + args.AddSpellBP0(CalculatePct(spellEffectInfo.CalcValue(caster), 40)); caster->CastSpell(nullptr, spellId, args); } } @@ -1242,7 +1242,7 @@ class spell_item_crystal_spire_of_karabor : public AuraScript bool CheckProc(ProcEventInfo& eventInfo) { - int32 pct = GetSpellInfo()->Effects[EFFECT_0].BasePoints; + int32 pct = GetEffectInfo(EFFECT_0).BasePoints; if (HealInfo* healInfo = eventInfo.GetHealInfo()) if (Unit* healTarget = healInfo->GetTarget()) if (healTarget->GetHealth() - healInfo->GetEffectiveHeal() <= healTarget->CountPctFromMaxHealth(pct)) @@ -3901,7 +3901,7 @@ class spell_item_charm_witch_doctor : public AuraScript if (Unit* target = eventInfo.GetActionTarget()) { - int32 bp = CalculatePct(target->GetCreateHealth(),aurEff->GetSpellInfo()->Effects[1].CalcValue()); + int32 bp = CalculatePct(target->GetCreateHealth(), aurEff->GetSpellInfo()->GetEffect(EFFECT_1).CalcValue()); CastSpellExtraArgs args(aurEff); args.AddSpellBP0(bp); eventInfo.GetActor()->CastSpell(target, SPELL_CHARM_WITCH_DOCTOR_PROC, args); diff --git a/src/server/scripts/Spells/spell_mage.cpp b/src/server/scripts/Spells/spell_mage.cpp index 1de22db2010..545dc8d08d1 100644 --- a/src/server/scripts/Spells/spell_mage.cpp +++ b/src/server/scripts/Spells/spell_mage.cpp @@ -450,7 +450,7 @@ class spell_mage_empowered_fire : public AuraScript Unit* target = GetTarget(); CastSpellExtraArgs args(aurEff); - uint8 percent = sSpellMgr->AssertSpellInfo(SPELL_MAGE_EMPOWERED_FIRE_PROC)->Effects[EFFECT_0].CalcValue(); + uint8 percent = sSpellMgr->AssertSpellInfo(SPELL_MAGE_EMPOWERED_FIRE_PROC)->GetEffect(EFFECT_0).CalcValue(); args.AddSpellBP0(CalculatePct(target->GetCreateMana(), percent)); target->CastSpell(target, SPELL_MAGE_EMPOWERED_FIRE_PROC, args); } @@ -525,7 +525,7 @@ class spell_mage_fire_frost_ward : public spell_mage_incanters_absorbtion_base_A Unit* target = GetTarget(); if (AuraEffect* talentAurEff = target->GetAuraEffectOfRankedSpell(SPELL_MAGE_FROST_WARDING_R1, EFFECT_0)) { - int32 chance = talentAurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue(); // SPELL_EFFECT_DUMMY with NO_TARGET + int32 chance = talentAurEff->GetSpellInfo()->GetEffect(EFFECT_1).CalcValue(); // SPELL_EFFECT_DUMMY with NO_TARGET if (roll_chance_i(chance)) { @@ -873,7 +873,7 @@ class spell_mage_living_bomb : public AuraScript bool Validate(SpellInfo const* spell) override { - return ValidateSpellInfo({ static_cast<uint32>(spell->Effects[EFFECT_1].CalcValue()) }); + return ValidateSpellInfo({ static_cast<uint32>(spell->GetEffect(EFFECT_1).CalcValue()) }); } void AfterRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) @@ -1007,13 +1007,13 @@ class spell_mage_mirror_image : public AuraScript bool Validate(SpellInfo const* spellInfo) override { - return ValidateSpellInfo({ spellInfo->Effects[EFFECT_2].TriggerSpell }); + return ValidateSpellInfo({ spellInfo->GetEffect(EFFECT_2).TriggerSpell }); } void PeriodicTick(AuraEffect const* aurEff) { // Set name of summons to name of caster - GetTarget()->CastSpell(nullptr, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, true); + GetTarget()->CastSpell(nullptr, aurEff->GetSpellEffectInfo().TriggerSpell, true); } void Register() override diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp index a33ac2139cd..2f893681b7e 100644 --- a/src/server/scripts/Spells/spell_paladin.cpp +++ b/src/server/scripts/Spells/spell_paladin.cpp @@ -162,8 +162,8 @@ class spell_pal_ardent_defender : public AuraScript bool Load() override { - _absorbPct = GetSpellInfo()->Effects[EFFECT_0].CalcValue(); - _healPct = GetSpellInfo()->Effects[EFFECT_1].CalcValue(); + _absorbPct = GetEffectInfo(EFFECT_0).CalcValue(); + _healPct = GetEffectInfo(EFFECT_1).CalcValue(); return GetUnitOwner()->GetTypeId() == TYPEID_PLAYER; } @@ -312,7 +312,7 @@ class spell_pal_beacon_of_light : public AuraScript bool Validate(SpellInfo const* spellInfo) override { - return ValidateSpellInfo({ spellInfo->Effects[EFFECT_0].TriggerSpell }); + return ValidateSpellInfo({ spellInfo->GetEffect(EFFECT_0).TriggerSpell }); } void PeriodicTick(AuraEffect const* aurEff) @@ -320,7 +320,7 @@ class spell_pal_beacon_of_light : public AuraScript PreventDefaultAction(); // area aura owner casts the spell - GetAura()->GetUnitOwner()->CastSpell(GetTarget(), GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, { aurEff, GetAura()->GetUnitOwner()->GetGUID() }); + GetAura()->GetUnitOwner()->CastSpell(GetTarget(), aurEff->GetSpellEffectInfo().TriggerSpell, { aurEff, GetAura()->GetUnitOwner()->GetGUID() }); } void Register() override @@ -468,8 +468,8 @@ class spell_pal_divine_sacrifice : public AuraScript else return false; - remainingAmount = (caster->CountPctFromMaxHealth(GetSpellInfo()->Effects[EFFECT_2].CalcValue(caster)) * groupSize); - minHpPct = GetSpellInfo()->Effects[EFFECT_1].CalcValue(caster); + remainingAmount = (caster->CountPctFromMaxHealth(GetEffectInfo(EFFECT_2).CalcValue(caster)) * groupSize); + minHpPct = GetEffectInfo(EFFECT_1).CalcValue(caster); return true; } return false; @@ -512,7 +512,7 @@ class spell_pal_divine_storm : public SpellScript bool Load() override { - _healPct = GetSpellInfo()->Effects[EFFECT_1].CalcValue(GetCaster()); + _healPct = GetEffectInfo(EFFECT_1).CalcValue(GetCaster()); return true; } @@ -633,7 +633,7 @@ class spell_pal_glyph_of_divinity : public AuraScript { // Lay on Hands (Rank 1) does not have mana effect SpellInfo const* spellInfo = eventInfo.GetSpellInfo(); - if (!spellInfo || spellInfo->Effects[EFFECT_1].Effect != SPELL_EFFECT_ENERGIZE) + if (!spellInfo || !spellInfo->GetEffect(EFFECT_1).IsEffect(SPELL_EFFECT_ENERGIZE)) return; Unit* caster = eventInfo.GetActor(); @@ -641,7 +641,7 @@ class spell_pal_glyph_of_divinity : public AuraScript return; CastSpellExtraArgs args(aurEff); - args.AddSpellMod(SPELLVALUE_BASE_POINT1, spellInfo->Effects[EFFECT_1].CalcValue() * 2); + args.AddSpellMod(SPELLVALUE_BASE_POINT1, GetEffectInfo(EFFECT_1).CalcValue() * 2); caster->CastSpell(nullptr, SPELL_PALADIN_GLYPH_OF_DIVINITY_PROC, args); } @@ -691,7 +691,7 @@ class spell_pal_glyph_of_holy_light_dummy : public AuraScript if (!healInfo || !healInfo->GetHeal()) return; - uint32 basePoints = healInfo->GetSpellInfo()->Effects[EFFECT_0].BasePoints + healInfo->GetSpellInfo()->Effects[EFFECT_0].DieSides; + uint32 basePoints = healInfo->GetSpellInfo()->GetEffect(EFFECT_0).BasePoints + healInfo->GetSpellInfo()->GetEffect(EFFECT_0).DieSides; uint32 healAmount; if (healInfo->GetEffectiveHeal() >= basePoints) healAmount = healInfo->GetEffectiveHeal(); @@ -906,7 +906,7 @@ class spell_pal_illumination : public AuraScript if (originalSpell && aurEff->GetSpellInfo()) { Unit* target = eventInfo.GetActor(); // Paladin is the target of the energize - uint32 bp = CalculatePct(originalSpell->CalcPowerCost(target, originalSpell->GetSchoolMask()), aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue()); + uint32 bp = CalculatePct(originalSpell->CalcPowerCost(target, originalSpell->GetSchoolMask()), aurEff->GetSpellInfo()->GetEffect(EFFECT_1).CalcValue()); CastSpellExtraArgs args(aurEff); args.AddSpellBP0(bp); target->CastSpell(target, SPELL_PALADIN_ILLUMINATION_ENERGIZE, args); @@ -1030,13 +1030,13 @@ class spell_pal_improved_lay_of_hands : public AuraScript bool Validate(SpellInfo const* spellInfo) override { - return ValidateSpellInfo({ spellInfo->Effects[EFFECT_0].TriggerSpell }); + return ValidateSpellInfo({ spellInfo->GetEffect(EFFECT_0).TriggerSpell }); } void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo) { PreventDefaultAction(); - eventInfo.GetActionTarget()->CastSpell(eventInfo.GetActionTarget(), GetSpellInfo()->Effects[EFFECT_0].TriggerSpell, { aurEff, GetTarget()->GetGUID() }); + eventInfo.GetActionTarget()->CastSpell(eventInfo.GetActionTarget(), aurEff->GetSpellEffectInfo().TriggerSpell, { aurEff, GetTarget()->GetGUID() }); } void Register() override @@ -1078,7 +1078,7 @@ class spell_pal_infusion_of_light : public AuraScript { Unit* target = GetTarget(); int32 duration = sSpellMgr->AssertSpellInfo(SPELL_PALADIN_FLASH_OF_LIGHT_PROC)->GetMaxDuration() / 1000; - int32 pct = GetSpellInfo()->Effects[EFFECT_2].CalcValue(); + int32 pct = GetEffectInfo(EFFECT_2).CalcValue(); ASSERT(duration > 0); int32 bp0 = CalculatePct(healInfo->GetHeal() / duration, pct); @@ -1292,7 +1292,7 @@ class spell_pal_judgement_of_wisdom_mana : public AuraScript SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(SPELL_PALADIN_JUDGEMENT_OF_WISDOM_MANA); Unit* caster = eventInfo.GetProcTarget(); - int32 const amount = CalculatePct(static_cast<int32>(caster->GetCreateMana()), spellInfo->Effects[EFFECT_0].CalcValue()); + int32 const amount = CalculatePct(static_cast<int32>(caster->GetCreateMana()), spellInfo->GetEffect(EFFECT_0).CalcValue()); CastSpellExtraArgs args(aurEff); args.OriginalCaster = GetCasterGUID(); args.AddSpellBP0(amount); @@ -1744,7 +1744,7 @@ class spell_pal_seal_of_vengeance : public SpellScriptLoader return; SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(DamageSpell); - int32 amount = spellInfo->Effects[EFFECT_0].CalcValue(); + int32 amount = spellInfo->GetEffect(EFFECT_0).CalcValue(); amount *= stacks; amount /= maxStacks; diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp index b718e40f51c..7ce8d2f58d1 100644 --- a/src/server/scripts/Spells/spell_quest.cpp +++ b/src/server/scripts/Spells/spell_quest.cpp @@ -544,12 +544,12 @@ class spell_q12683_take_sputum_sample : public SpellScript void HandleDummy(SpellEffIndex /*effIndex*/) { - uint32 reqAuraId = GetSpellInfo()->Effects[EFFECT_1].CalcValue(); + uint32 reqAuraId = GetEffectInfo(EFFECT_1).CalcValue(); Unit* caster = GetCaster(); if (caster->HasAuraEffect(reqAuraId, 0)) { - uint32 spellId = GetSpellInfo()->Effects[EFFECT_0].CalcValue(); + uint32 spellId = GetEffectInfo().CalcValue(); caster->CastSpell(caster, spellId, true); } } @@ -1459,7 +1459,7 @@ class spell_q13086_cannons_target : public SpellScript bool Validate(SpellInfo const* spellInfo) override { - return ValidateSpellInfo({ static_cast<uint32>(spellInfo->Effects[EFFECT_0].CalcValue()) }); + return ValidateSpellInfo({ static_cast<uint32>(spellInfo->GetEffect(EFFECT_0).CalcValue()) }); } void HandleEffectDummy(SpellEffIndex /*effIndex*/) @@ -1761,7 +1761,7 @@ class spell_q12308_escape_from_silverbrook_summon_worgen : public SpellScript void ModDest(SpellDestination& dest) { - float dist = GetSpellInfo()->Effects[EFFECT_0].CalcRadius(GetCaster()); + float dist = GetEffectInfo(EFFECT_0).CalcRadius(GetCaster()); float angle = frand(0.75f, 1.25f) * float(M_PI); Position pos = GetCaster()->GetNearPosition(dist, angle); @@ -1920,7 +1920,7 @@ class spell_q12619_emblazon_runeblade : public AuraScript { PreventDefaultAction(); if (Unit* caster = GetCaster()) - caster->CastSpell(caster, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, aurEff); + caster->CastSpell(caster, aurEff->GetSpellEffectInfo().TriggerSpell, aurEff); } void Register() override diff --git a/src/server/scripts/Spells/spell_rogue.cpp b/src/server/scripts/Spells/spell_rogue.cpp index db839492c59..1b31bfe283a 100644 --- a/src/server/scripts/Spells/spell_rogue.cpp +++ b/src/server/scripts/Spells/spell_rogue.cpp @@ -109,7 +109,7 @@ class spell_rog_cheat_death : public AuraScript bool Load() override { - absorbChance = GetSpellInfo()->Effects[EFFECT_0].CalcValue(); + absorbChance = GetEffectInfo(EFFECT_0).CalcValue(); return GetUnitOwner()->GetTypeId() == TYPEID_PLAYER; } @@ -397,7 +397,7 @@ private: bool Load() override { - absorbPct = GetSpellInfo()->Effects[EFFECT_0].CalcValue(GetCaster()); + absorbPct = GetEffectInfo(EFFECT_0).CalcValue(GetCaster()); return true; } @@ -494,7 +494,7 @@ class spell_rog_prey_on_the_weak : public AuraScript return ValidateSpellInfo({ SPELL_ROGUE_PREY_ON_THE_WEAK }); } - void HandleEffectPeriodic(AuraEffect const* /*aurEff*/) + void HandleEffectPeriodic(AuraEffect const* aurEff) { Unit* target = GetTarget(); Unit* victim = target->GetVictim(); @@ -503,7 +503,7 @@ class spell_rog_prey_on_the_weak : public AuraScript if (!target->HasAura(SPELL_ROGUE_PREY_ON_THE_WEAK)) { CastSpellExtraArgs args(TRIGGERED_FULL_MASK); - args.AddSpellBP0(GetSpellInfo()->Effects[EFFECT_0].CalcValue()); + args.AddSpellBP0(aurEff->GetSpellEffectInfo().CalcValue()); target->CastSpell(target, SPELL_ROGUE_PREY_ON_THE_WEAK, args); } } @@ -833,7 +833,7 @@ class spell_rog_honor_among_thieves : public AuraScript return ValidateSpellInfo( { SPELL_ROGUE_HONOR_AMONG_THIEVES_2, - spellInfo->Effects[EFFECT_0].TriggerSpell + spellInfo->GetEffect(EFFECT_0).TriggerSpell }); } @@ -855,7 +855,7 @@ class spell_rog_honor_among_thieves : public AuraScript return; Unit* target = GetTarget(); - target->CastSpell(target, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, { aurEff, caster->GetGUID() }); + target->CastSpell(target, aurEff->GetSpellEffectInfo().TriggerSpell, { aurEff, caster->GetGUID() }); } void Register() override @@ -919,7 +919,7 @@ class spell_rog_turn_the_tables : public AuraScript bool Validate(SpellInfo const* spellInfo) override { - return ValidateSpellInfo({ spellInfo->Effects[EFFECT_0].TriggerSpell }); + return ValidateSpellInfo({ spellInfo->GetEffect(EFFECT_0).TriggerSpell }); } void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/) @@ -930,7 +930,7 @@ class spell_rog_turn_the_tables : public AuraScript if (!caster) return; - caster->CastSpell(nullptr, GetSpellInfo()->Effects[EFFECT_0].TriggerSpell, aurEff); + caster->CastSpell(nullptr, aurEff->GetSpellEffectInfo().TriggerSpell, aurEff); } void Register() override diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp index 160caa9c9b0..a7b6fe71ece 100644 --- a/src/server/scripts/Spells/spell_shaman.cpp +++ b/src/server/scripts/Spells/spell_shaman.cpp @@ -185,7 +185,7 @@ private: bool Load() override { - absorbPct = GetSpellInfo()->Effects[EFFECT_0].CalcValue(GetCaster()); + absorbPct = GetEffectInfo(EFFECT_0).CalcValue(GetCaster()); return true; } @@ -596,7 +596,7 @@ class spell_sha_flametongue_weapon : public AuraScript Item* item = ASSERT_NOTNULL(player->GetWeaponForAttack(attType)); - float basePoints = GetSpellInfo()->Effects[aurEff->GetEffIndex()].CalcValue(); + float basePoints = aurEff->GetSpellEffectInfo().CalcValue(); // Flametongue max damage is normalized based on a 4.0 speed weapon // Tooltip says max damage = BasePoints / 25, so BasePoints / 25 / 4 to get base damage per 1.0s AS @@ -651,7 +651,7 @@ class spell_sha_frozen_power : public AuraScript Unit* caster = eventInfo.GetActor(); SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(SPELL_SHAMAN_FREEZE); - float minDistance(spellInfo->Effects[EFFECT_0].CalcValue(caster)); + float minDistance(spellInfo->GetEffect(EFFECT_0).CalcValue(caster)); Unit* target = eventInfo.GetProcTarget(); if (caster->GetDistance(target) < minDistance) @@ -762,8 +762,8 @@ class spell_sha_glyph_of_totem_of_wrath : public AuraScript if (!totemSpell) return; - int32 bp0 = CalculatePct(totemSpell->Effects[EFFECT_0].CalcValue(caster), aurEff->GetAmount()); - int32 bp1 = CalculatePct(totemSpell->Effects[EFFECT_1].CalcValue(caster), aurEff->GetAmount()); + int32 bp0 = CalculatePct(totemSpell->GetEffect(EFFECT_0).CalcValue(caster), aurEff->GetAmount()); + int32 bp1 = CalculatePct(totemSpell->GetEffect(EFFECT_1).CalcValue(caster), aurEff->GetAmount()); CastSpellExtraArgs args(aurEff); args.AddSpellBP0(bp0); args.AddSpellMod(SPELLVALUE_BASE_POINT1, bp1); @@ -887,7 +887,7 @@ class spell_sha_imp_water_shield : public AuraScript if (!waterShield) return; - uint32 spellId = waterShield->GetSpellInfo()->Effects[waterShield->GetEffIndex()].TriggerSpell; + uint32 spellId = waterShield->GetSpellEffectInfo().TriggerSpell; caster->CastSpell(nullptr, spellId, aurEff); } @@ -931,7 +931,7 @@ class spell_sha_lightning_overload : public AuraScript // Chain lightning has [LightOverload_Proc_Chance] / [Max_Number_of_Targets] chance to proc of each individual target hit. // A maxed LO would have a 33% / 3 = 11% chance to proc of each target. // LO chance was already "accounted" at the proc chance roll, now need to divide the chance by [Max_Number_of_Targets] - float chance = 100.0f / spellInfo->Effects[EFFECT_0].ChainTarget; + float chance = 100.0f / spellInfo->GetEffect(EFFECT_0).ChainTarget; if (!roll_chance_f(chance)) return; @@ -1234,7 +1234,7 @@ class spell_sha_mana_tide : public AuraScript bool Validate(SpellInfo const* spellInfo) override { - return ValidateSpellInfo({ spellInfo->Effects[EFFECT_0].TriggerSpell }); + return ValidateSpellInfo({ spellInfo->GetEffect(EFFECT_0).TriggerSpell }); } void PeriodicTick(AuraEffect const* aurEff) @@ -1243,7 +1243,7 @@ class spell_sha_mana_tide : public AuraScript CastSpellExtraArgs args(aurEff); args.AddSpellBP0(aurEff->GetAmount()); - GetTarget()->CastSpell(nullptr, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, args); + GetTarget()->CastSpell(nullptr, aurEff->GetSpellEffectInfo().TriggerSpell, args); } void Register() override @@ -1310,7 +1310,7 @@ class spell_sha_nature_guardian : public AuraScript if (!damageInfo || !damageInfo->GetDamage()) return false; - int32 healthpct = GetSpellInfo()->Effects[EFFECT_1].CalcValue(); + int32 healthpct = GetEffectInfo(EFFECT_1).CalcValue(); if (Unit* target = eventInfo.GetActionTarget()) if (target->HealthBelowPctDamaged(healthpct, damageInfo->GetDamage())) return true; @@ -1852,9 +1852,9 @@ class spell_sha_windfury_weapon : public AuraScript SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(SPELL_SHAMAN_WINDFURY_WEAPON_R1); while (spellInfo) { - if (spellInfo->Effects[EFFECT_0].MiscValue == enchantId) + if (spellInfo->GetEffect(EFFECT_0).MiscValue == enchantId) { - extraAttackPower = spellInfo->Effects[EFFECT_1].CalcValue(player); + extraAttackPower = spellInfo->GetEffect(EFFECT_1).CalcValue(player); break; } spellInfo = spellInfo->GetNextRankSpell(); diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp index 0536b91b9b6..c34d52109c9 100644 --- a/src/server/scripts/Spells/spell_warlock.cpp +++ b/src/server/scripts/Spells/spell_warlock.cpp @@ -468,7 +468,7 @@ class spell_warl_drain_soul : public AuraScript if (!impDrainSoul) return; - int32 amount = CalculatePct(caster->GetMaxPower(POWER_MANA), impDrainSoul->GetSpellInfo()->Effects[EFFECT_2].CalcValue()); + int32 amount = CalculatePct(caster->GetMaxPower(POWER_MANA), impDrainSoul->GetSpellInfo()->GetEffect(EFFECT_2).CalcValue()); CastSpellExtraArgs args(aurEff); args.AddSpellBP0(amount); caster->CastSpell(nullptr, SPELL_WARLOCK_IMPROVED_DRAIN_SOUL_PROC, args); @@ -757,7 +757,7 @@ class spell_warl_life_tap : public SpellScript SpellCastResult CheckCast() { - if (int32(GetCaster()->GetHealth()) > int32(GetSpellInfo()->Effects[EFFECT_0].CalcValue())) + if (int32(GetCaster()->GetHealth()) > int32(GetEffectInfo(EFFECT_0).CalcValue())) return SPELL_CAST_OK; return SPELL_FAILED_FIZZLE; } diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp index 09b594ffa18..1ea3ca5206d 100644 --- a/src/server/scripts/Spells/spell_warrior.cpp +++ b/src/server/scripts/Spells/spell_warrior.cpp @@ -127,7 +127,7 @@ class spell_warr_bloodthirst_heal : public SpellScript void HandleHeal(SpellEffIndex /*effIndex*/) { SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(SPELL_WARRIOR_BLOODTHIRST_DAMAGE); - int32 const healPct = spellInfo->Effects[EFFECT_1].CalcValue(GetCaster()); + int32 const healPct = spellInfo->GetEffect(EFFECT_1).CalcValue(GetCaster()); SetEffectValue(GetCaster()->CountPctFromMaxHealth(healPct)); } @@ -172,7 +172,7 @@ class spell_warr_concussion_blow : public SpellScript void HandleDummy(SpellEffIndex /*effIndex*/) { - SetEffectValue(CalculatePct(GetCaster()->GetTotalAttackPowerValue(BASE_ATTACK), GetSpellInfo()->Effects[EFFECT_2].CalcValue())); + SetEffectValue(CalculatePct(GetCaster()->GetTotalAttackPowerValue(BASE_ATTACK), GetEffectInfo(EFFECT_2).CalcValue())); } void Register() override @@ -256,7 +256,7 @@ class spell_warr_deep_wounds_aura : public AuraScript bool Validate(SpellInfo const* spellInfo) override { - return ValidateSpellInfo({ spellInfo->Effects[EFFECT_0].TriggerSpell }); + return ValidateSpellInfo({ spellInfo->GetEffect(EFFECT_0).TriggerSpell }); } bool CheckProc(ProcEventInfo& eventInfo) @@ -282,7 +282,7 @@ class spell_warr_deep_wounds_aura : public AuraScript CastSpellExtraArgs args(aurEff); args.AddSpellBP0(damage); - actor->CastSpell(eventInfo.GetProcTarget(), GetSpellInfo()->Effects[EFFECT_0].TriggerSpell, args); + actor->CastSpell(eventInfo.GetProcTarget(), GetEffectInfo(EFFECT_0).TriggerSpell, args); } void Register() override @@ -302,7 +302,7 @@ class spell_warr_execute : public SpellScript return ValidateSpellInfo({ SPELL_WARRIOR_EXECUTE, SPELL_WARRIOR_GLYPH_OF_EXECUTION }); } - void HandleEffect(SpellEffIndex effIndex) + void HandleEffect(SpellEffIndex /*effIndex*/) { Unit* caster = GetCaster(); if (Unit* target = GetHitUnit()) @@ -314,7 +314,7 @@ class spell_warr_execute : public SpellScript // Sudden Death rage save if (AuraEffect* aurEff = caster->GetAuraEffect(SPELL_AURA_PROC_TRIGGER_SPELL, SPELLFAMILY_GENERIC, WARRIOR_ICON_ID_SUDDEN_DEATH, EFFECT_0)) { - int32 ragesave = aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue() * 10; + int32 ragesave = aurEff->GetSpellInfo()->GetEffect(EFFECT_1).CalcValue() * 10; newRage = std::max(newRage, ragesave); } @@ -323,7 +323,7 @@ class spell_warr_execute : public SpellScript if (AuraEffect* aurEff = caster->GetAuraEffect(SPELL_WARRIOR_GLYPH_OF_EXECUTION, EFFECT_0)) rageUsed += aurEff->GetAmount() * 10; - int32 bp = GetEffectValue() + int32(rageUsed * spellInfo->Effects[effIndex].DamageMultiplier + caster->GetTotalAttackPowerValue(BASE_ATTACK) * 0.2f); + int32 bp = GetEffectValue() + int32(rageUsed * GetEffectInfo().DamageMultiplier + caster->GetTotalAttackPowerValue(BASE_ATTACK) * 0.2f); CastSpellExtraArgs args(GetOriginalCaster()->GetGUID()); args.AddSpellBP0(bp); caster->CastSpell(target, SPELL_WARRIOR_EXECUTE, args); @@ -414,7 +414,7 @@ class spell_warr_glyph_of_sunder_armor : public AuraScript spellMod->op = SpellModOp(aurEff->GetMiscValue()); spellMod->type = SPELLMOD_FLAT; spellMod->spellId = GetId(); - spellMod->mask = GetSpellInfo()->Effects[aurEff->GetEffIndex()].SpellClassMask; + spellMod->mask = aurEff->GetSpellEffectInfo().SpellClassMask; } spellMod->value = aurEff->GetAmount(); @@ -505,7 +505,7 @@ class spell_warr_item_t10_prot_4p_bonus : public AuraScript PreventDefaultAction(); Unit* target = eventInfo.GetActionTarget(); - int32 bp0 = CalculatePct(target->GetMaxHealth(), GetSpellInfo()->Effects[EFFECT_1].CalcValue()); + int32 bp0 = CalculatePct(target->GetMaxHealth(), GetEffectInfo(EFFECT_1).CalcValue()); CastSpellExtraArgs args(TRIGGERED_FULL_MASK); args.AddSpellBP0(bp0); target->CastSpell(nullptr, SPELL_WARRIOR_STOICISM, args); @@ -598,7 +598,7 @@ class spell_warr_rend : public AuraScript if (GetSpellInfo()->GetRank() >= 9) { if (GetUnitOwner()->HasAuraState(AURA_STATE_HEALTH_ABOVE_75_PERCENT, GetSpellInfo(), caster)) - AddPct(amount, GetSpellInfo()->Effects[EFFECT_2].CalcValue(caster)); + AddPct(amount, GetEffectInfo(EFFECT_2).CalcValue(caster)); } } } diff --git a/src/server/scripts/World/go_scripts.cpp b/src/server/scripts/World/go_scripts.cpp index 82823ae34f6..09c86e6222a 100644 --- a/src/server/scripts/World/go_scripts.cpp +++ b/src/server/scripts/World/go_scripts.cpp @@ -457,7 +457,7 @@ class go_soulwell : public GameObjectScript if (!spellInfo) return; - _stoneId = spellInfo->Effects[EFFECT_0].ItemType; + _stoneId = spellInfo->GetEffect(EFFECT_0).ItemType; } bool OnGossipHello(Player* player) override @@ -1278,4 +1278,4 @@ void AddSC_go_scripts() new go_darkmoon_faire_music(); new go_pirate_day_music(); new go_bells(); -}
\ No newline at end of file +} diff --git a/src/server/scripts/World/npc_professions.cpp b/src/server/scripts/World/npc_professions.cpp index 48722939fe2..24db82461be 100644 --- a/src/server/scripts/World/npc_professions.cpp +++ b/src/server/scripts/World/npc_professions.cpp @@ -247,9 +247,9 @@ bool EquippedOk(Player* player, uint32 spellId) if (!spell) return false; - for (uint8 i = 0; i < 3; ++i) + for (SpellEffectInfo const& spellEffectInfo : spell->GetEffects()) { - uint32 reqSpell = spell->Effects[i].TriggerSpell; + uint32 reqSpell = spellEffectInfo.TriggerSpell; if (!reqSpell) continue; diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index c2d8e1e2c16..a8db91ca644 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -1934,8 +1934,8 @@ public: SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); - if (spellInfo && spellInfo->Effects[0].Effect == SPELL_EFFECT_SUMMON_OBJECT_WILD) - return spellInfo->Effects[0].MiscValue; + if (spellInfo && spellInfo->GetEffect(EFFECT_0).Effect == SPELL_EFFECT_SUMMON_OBJECT_WILD) + return spellInfo->GetEffect(EFFECT_0).MiscValue; return 0; } |