From 160849fec143212a154f98924f63ddba1f0e2566 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Tue, 13 Jun 2023 04:48:55 -0400 Subject: [PATCH] Scripts/Spells: Converted remaining spell scripts to use ValidateSpellEffect Port From (https://github.com/TrinityCore/TrinityCore/commit/622eed752bc69fc4c34bb568d96d51913258f852) --- .../Argus/AntorusTheBurningThrone/GarothiWorldbreaker.cs | 4 ++-- Source/Scripts/EasternKingdoms/BaradinHold/Occuthar.cs | 2 +- Source/Scripts/Events/PilgrimsBounty.cs | 4 +--- Source/Scripts/Spells/Generic.cs | 8 ++++---- Source/Scripts/Spells/Hunter.cs | 2 +- Source/Scripts/Spells/Mage.cs | 4 ++-- Source/Scripts/Spells/Monk.cs | 2 +- Source/Scripts/Spells/Priest.cs | 2 +- Source/Scripts/Spells/Quest.cs | 2 +- 9 files changed, 14 insertions(+), 16 deletions(-) diff --git a/Source/Scripts/Argus/AntorusTheBurningThrone/GarothiWorldbreaker.cs b/Source/Scripts/Argus/AntorusTheBurningThrone/GarothiWorldbreaker.cs index 4188b8110..636304689 100644 --- a/Source/Scripts/Argus/AntorusTheBurningThrone/GarothiWorldbreaker.cs +++ b/Source/Scripts/Argus/AntorusTheBurningThrone/GarothiWorldbreaker.cs @@ -551,7 +551,7 @@ namespace Scripts.Argus.AntorusTheBurningThrone.GarothiWorldbreaker { public override bool Validate(SpellInfo spellInfo) { - return !spellInfo.GetEffects().Empty() && ValidateSpellInfo((uint)spellInfo.GetEffect(0).CalcValue()); + return ValidateSpellEffect(spellInfo.Id, 0) && ValidateSpellInfo((uint)spellInfo.GetEffect(0).CalcValue()); } void HandlePeriodic(AuraEffect aurEff) @@ -697,7 +697,7 @@ namespace Scripts.Argus.AntorusTheBurningThrone.GarothiWorldbreaker { public override bool Validate(SpellInfo spellInfo) { - return !spellInfo.GetEffects().Empty() && ValidateSpellInfo((uint)spellInfo.GetEffect(0).CalcValue()); + return ValidateSpellEffect(spellInfo.Id, 0) && ValidateSpellInfo((uint)spellInfo.GetEffect(0).CalcValue()); } void HandleHit(uint effIndex) diff --git a/Source/Scripts/EasternKingdoms/BaradinHold/Occuthar.cs b/Source/Scripts/EasternKingdoms/BaradinHold/Occuthar.cs index 381a57c91..87e60e405 100644 --- a/Source/Scripts/EasternKingdoms/BaradinHold/Occuthar.cs +++ b/Source/Scripts/EasternKingdoms/BaradinHold/Occuthar.cs @@ -195,7 +195,7 @@ namespace Scripts.EasternKingdoms.BaradinHold.Occuthar { public override bool Validate(SpellInfo spellInfo) { - return !spellInfo.GetEffects().Empty() && ValidateSpellInfo((uint)spellInfo.GetEffect(0).CalcValue()); + return ValidateSpellEffect(spellInfo.Id, 0) && ValidateSpellInfo((uint)spellInfo.GetEffect(0).CalcValue()); } public override bool Load() diff --git a/Source/Scripts/Events/PilgrimsBounty.cs b/Source/Scripts/Events/PilgrimsBounty.cs index d95b8b380..d294854f2 100644 --- a/Source/Scripts/Events/PilgrimsBounty.cs +++ b/Source/Scripts/Events/PilgrimsBounty.cs @@ -132,9 +132,7 @@ namespace Scripts.Events.PilgrimsBounty { public override bool Validate(SpellInfo spellInfo) { - return !spellInfo.GetEffects().Empty() - && ValidateSpellInfo((uint)spellInfo.GetEffect(0).CalcValue()) - && !Global.SpellMgr.GetSpellInfo((uint)spellInfo.GetEffect(0).CalcValue(), Difficulty.None).GetEffects().Empty(); + return ValidateSpellEffect(spellInfo.Id, 0) && ValidateSpellEffect((uint)spellInfo.GetEffect(0).CalcValue(), 0); } void HandleDummy(uint effIndex) diff --git a/Source/Scripts/Spells/Generic.cs b/Source/Scripts/Spells/Generic.cs index 7c2a4154a..1d7edc740 100644 --- a/Source/Scripts/Spells/Generic.cs +++ b/Source/Scripts/Spells/Generic.cs @@ -639,7 +639,7 @@ namespace Scripts.Spells.Generic public override bool Validate(SpellInfo spellInfo) { - if (spellInfo.GetEffects().Empty() || !spellInfo.GetEffect(0).IsAura(AuraType.ModPowerRegen)) + if (!ValidateSpellEffect(spellInfo.Id, 0) || !spellInfo.GetEffect(0).IsAura(AuraType.ModPowerRegen)) { Log.outError(LogFilter.Spells, "Aura {GetId()} structure has been changed - first aura is no longer SPELL_AURA_MOD_POWER_REGEN"); return false; @@ -718,7 +718,7 @@ namespace Scripts.Spells.Generic { public override bool Validate(SpellInfo spellInfo) { - return !spellInfo.GetEffects().Empty() && ValidateSpellInfo(spellInfo.GetEffect(0).TriggerSpell); + return ValidateSpellEffect(spellInfo.Id, 0) && ValidateSpellInfo(spellInfo.GetEffect(0).TriggerSpell); } void PeriodicTick(AuraEffect aurEff) @@ -3808,7 +3808,7 @@ namespace Scripts.Spells.Generic { public override bool Validate(SpellInfo spellInfo) { - if (spellInfo.GetEffects().Empty()) + if (!ValidateSpellEffect(spellInfo.Id, 0)) return false; if (spellInfo.GetEffect(0).CalcValue() < 1) @@ -4033,7 +4033,7 @@ namespace Scripts.Spells.Generic public override bool Validate(SpellInfo spellInfo) { - return ValidateSpellInfo((uint)RequiredMixologySpells.Mixology) && !spellInfo.GetEffects().Empty(); + return ValidateSpellInfo((uint)RequiredMixologySpells.Mixology) && ValidateSpellEffect(spellInfo.Id, 0); } public override bool Load() diff --git a/Source/Scripts/Spells/Hunter.cs b/Source/Scripts/Spells/Hunter.cs index cb18c068b..715dd052e 100644 --- a/Source/Scripts/Spells/Hunter.cs +++ b/Source/Scripts/Spells/Hunter.cs @@ -183,7 +183,7 @@ namespace Scripts.Spells.Hunter { public override bool Validate(SpellInfo spellInfo) { - return !spellInfo.GetEffects().Empty() && ValidateSpellInfo(SpellIds.MastersCallTriggered, (uint)spellInfo.GetEffect(0).CalcValue()); + return ValidateSpellEffect(spellInfo.Id, 0) && ValidateSpellInfo(SpellIds.MastersCallTriggered, (uint)spellInfo.GetEffect(0).CalcValue()); } public override bool Load() diff --git a/Source/Scripts/Spells/Mage.cs b/Source/Scripts/Spells/Mage.cs index d43181467..892639c8d 100644 --- a/Source/Scripts/Spells/Mage.cs +++ b/Source/Scripts/Spells/Mage.cs @@ -1055,7 +1055,7 @@ namespace Scripts.Spells.Mage { public override bool Validate(SpellInfo spellInfo) { - return ValidateSpellInfo(SpellIds.RingOfFrostSummon, SpellIds.RingOfFrostFreeze) && !Global.SpellMgr.GetSpellInfo(SpellIds.RingOfFrostSummon, Difficulty.None).GetEffects().Empty(); + return ValidateSpellInfo(SpellIds.RingOfFrostSummon, SpellIds.RingOfFrostFreeze) && ValidateSpellEffect(SpellIds.RingOfFrostSummon, 0); } void HandleEffectPeriodic(AuraEffect aurEff) @@ -1111,7 +1111,7 @@ namespace Scripts.Spells.Mage { public override bool Validate(SpellInfo spellInfo) { - return ValidateSpellInfo(SpellIds.RingOfFrostSummon, SpellIds.RingOfFrostFreeze) && !Global.SpellMgr.GetSpellInfo(SpellIds.RingOfFrostSummon, Difficulty.None).GetEffects().Empty(); + return ValidateSpellInfo(SpellIds.RingOfFrostSummon, SpellIds.RingOfFrostFreeze) && ValidateSpellEffect(SpellIds.RingOfFrostSummon, 0); } void FilterTargets(List targets) diff --git a/Source/Scripts/Spells/Monk.cs b/Source/Scripts/Spells/Monk.cs index 014c547e5..7edfa4807 100644 --- a/Source/Scripts/Spells/Monk.cs +++ b/Source/Scripts/Spells/Monk.cs @@ -401,7 +401,7 @@ namespace Scripts.Spells.Monk public override bool Validate(SpellInfo spellInfo) { return ValidateSpellInfo(SpellIds.StaggerDamageAura) - && !Global.SpellMgr.GetSpellInfo(SpellIds.StaggerDamageAura, Difficulty.None).GetEffects().Empty(); + && ValidateSpellEffect(SpellIds.StaggerDamageAura, 0); } public override bool Load() diff --git a/Source/Scripts/Spells/Priest.cs b/Source/Scripts/Spells/Priest.cs index 66c5f2c0e..da43c956e 100644 --- a/Source/Scripts/Spells/Priest.cs +++ b/Source/Scripts/Spells/Priest.cs @@ -1134,7 +1134,7 @@ namespace Scripts.Spells.Priest public override bool Validate(SpellInfo spellInfo) { return ValidateSpellInfo(SpellIds.PrayerOfMendingHeal, SpellIds.PrayerOfMendingAura) - && !Global.SpellMgr.GetSpellInfo(SpellIds.PrayerOfMendingHeal, Difficulty.None).GetEffects().Empty(); + && ValidateSpellEffect(SpellIds.PrayerOfMendingHeal, 0); } public override bool Load() diff --git a/Source/Scripts/Spells/Quest.cs b/Source/Scripts/Spells/Quest.cs index 3548c9f76..f8aa5a952 100644 --- a/Source/Scripts/Spells/Quest.cs +++ b/Source/Scripts/Spells/Quest.cs @@ -1053,7 +1053,7 @@ namespace Scripts.Spells.Quest { public override bool Validate(SpellInfo spellInfo) { - return !spellInfo.GetEffects().Empty() && ValidateSpellInfo((uint)spellInfo.GetEffect(0).CalcValue()); + return ValidateSpellEffect(spellInfo.Id, 0) && ValidateSpellInfo((uint)spellInfo.GetEffect(0).CalcValue()); } void HandleEffectDummy(uint effIndex)