Scripts/Spells: Converted remaining spell scripts to use ValidateSpellEffect

Port From (https://github.com/TrinityCore/TrinityCore/commit/622eed752bc69fc4c34bb568d96d51913258f852)
This commit is contained in:
hondacrx
2023-06-13 04:48:55 -04:00
parent 533e1162f2
commit 160849fec1
9 changed files with 14 additions and 16 deletions
@@ -551,7 +551,7 @@ namespace Scripts.Argus.AntorusTheBurningThrone.GarothiWorldbreaker
{ {
public override bool Validate(SpellInfo spellInfo) 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) void HandlePeriodic(AuraEffect aurEff)
@@ -697,7 +697,7 @@ namespace Scripts.Argus.AntorusTheBurningThrone.GarothiWorldbreaker
{ {
public override bool Validate(SpellInfo spellInfo) 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) void HandleHit(uint effIndex)
@@ -195,7 +195,7 @@ namespace Scripts.EasternKingdoms.BaradinHold.Occuthar
{ {
public override bool Validate(SpellInfo spellInfo) 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() public override bool Load()
+1 -3
View File
@@ -132,9 +132,7 @@ namespace Scripts.Events.PilgrimsBounty
{ {
public override bool Validate(SpellInfo spellInfo) public override bool Validate(SpellInfo spellInfo)
{ {
return !spellInfo.GetEffects().Empty() return ValidateSpellEffect(spellInfo.Id, 0) && ValidateSpellEffect((uint)spellInfo.GetEffect(0).CalcValue(), 0);
&& ValidateSpellInfo((uint)spellInfo.GetEffect(0).CalcValue())
&& !Global.SpellMgr.GetSpellInfo((uint)spellInfo.GetEffect(0).CalcValue(), Difficulty.None).GetEffects().Empty();
} }
void HandleDummy(uint effIndex) void HandleDummy(uint effIndex)
+4 -4
View File
@@ -639,7 +639,7 @@ namespace Scripts.Spells.Generic
public override bool Validate(SpellInfo spellInfo) 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"); Log.outError(LogFilter.Spells, "Aura {GetId()} structure has been changed - first aura is no longer SPELL_AURA_MOD_POWER_REGEN");
return false; return false;
@@ -718,7 +718,7 @@ namespace Scripts.Spells.Generic
{ {
public override bool Validate(SpellInfo spellInfo) 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) void PeriodicTick(AuraEffect aurEff)
@@ -3808,7 +3808,7 @@ namespace Scripts.Spells.Generic
{ {
public override bool Validate(SpellInfo spellInfo) public override bool Validate(SpellInfo spellInfo)
{ {
if (spellInfo.GetEffects().Empty()) if (!ValidateSpellEffect(spellInfo.Id, 0))
return false; return false;
if (spellInfo.GetEffect(0).CalcValue() < 1) if (spellInfo.GetEffect(0).CalcValue() < 1)
@@ -4033,7 +4033,7 @@ namespace Scripts.Spells.Generic
public override bool Validate(SpellInfo spellInfo) 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() public override bool Load()
+1 -1
View File
@@ -183,7 +183,7 @@ namespace Scripts.Spells.Hunter
{ {
public override bool Validate(SpellInfo spellInfo) 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() public override bool Load()
+2 -2
View File
@@ -1055,7 +1055,7 @@ namespace Scripts.Spells.Mage
{ {
public override bool Validate(SpellInfo spellInfo) 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) void HandleEffectPeriodic(AuraEffect aurEff)
@@ -1111,7 +1111,7 @@ namespace Scripts.Spells.Mage
{ {
public override bool Validate(SpellInfo spellInfo) 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<WorldObject> targets) void FilterTargets(List<WorldObject> targets)
+1 -1
View File
@@ -401,7 +401,7 @@ namespace Scripts.Spells.Monk
public override bool Validate(SpellInfo spellInfo) public override bool Validate(SpellInfo spellInfo)
{ {
return ValidateSpellInfo(SpellIds.StaggerDamageAura) return ValidateSpellInfo(SpellIds.StaggerDamageAura)
&& !Global.SpellMgr.GetSpellInfo(SpellIds.StaggerDamageAura, Difficulty.None).GetEffects().Empty(); && ValidateSpellEffect(SpellIds.StaggerDamageAura, 0);
} }
public override bool Load() public override bool Load()
+1 -1
View File
@@ -1134,7 +1134,7 @@ namespace Scripts.Spells.Priest
public override bool Validate(SpellInfo spellInfo) public override bool Validate(SpellInfo spellInfo)
{ {
return ValidateSpellInfo(SpellIds.PrayerOfMendingHeal, SpellIds.PrayerOfMendingAura) return ValidateSpellInfo(SpellIds.PrayerOfMendingHeal, SpellIds.PrayerOfMendingAura)
&& !Global.SpellMgr.GetSpellInfo(SpellIds.PrayerOfMendingHeal, Difficulty.None).GetEffects().Empty(); && ValidateSpellEffect(SpellIds.PrayerOfMendingHeal, 0);
} }
public override bool Load() public override bool Load()
+1 -1
View File
@@ -1053,7 +1053,7 @@ namespace Scripts.Spells.Quest
{ {
public override bool Validate(SpellInfo spellInfo) 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) void HandleEffectDummy(uint effIndex)