feat(Core/Spell): Implement ValidateSpellInfo (#4323)

* feat(Core/Spell): Implement ValidateSpellInfo

* cherry-pick from 2b5d7eef3a & a0a158b5b8

* sLog->outError

* cleanup

* convert to ValidateSpellInfo

* fix error log

* improve sLog->outError

* remove non related spells stuff from Validate

* remove the last

* build

* build x2
This commit is contained in:
Kitzunu
2021-02-01 18:57:25 +01:00
committed by GitHub
parent b68f469c73
commit 0d52b4ca4a
45 changed files with 544 additions and 841 deletions

View File

@@ -889,11 +889,7 @@ public:
bool Validate(SpellInfo const* /*spellEntry*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_LEECHING_SWARM_DMG))
return false;
if (!sSpellMgr->GetSpellInfo(SPELL_LEECHING_SWARM_HEAL))
return false;
return true;
return ValidateSpellInfo({ SPELL_LEECHING_SWARM_DMG, SPELL_LEECHING_SWARM_HEAL });
}
void HandleEffectPeriodic(AuraEffect const* aurEff)

View File

@@ -2468,9 +2468,7 @@ public:
bool Validate(SpellInfo const* /*spell*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_UNSTABLE_AFFLICTION_DISPEL))
return false;
return true;
return ValidateSpellInfo({ SPELL_UNSTABLE_AFFLICTION_DISPEL });
}
void HandleDispel(DispelInfo* dispelInfo)

View File

@@ -591,9 +591,7 @@ public:
bool Validate(SpellInfo const* /*spell*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_PACT_OF_THE_DARKFALLEN_DAMAGE))
return false;
return true;
return ValidateSpellInfo({ SPELL_PACT_OF_THE_DARKFALLEN_DAMAGE });
}
// this is an additional effect to be executed
@@ -718,9 +716,7 @@ public:
bool Validate(SpellInfo const* /*spell*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_TWILIGHT_BLOODBOLT_FROM_WHIRL))
return false;
return true;
return ValidateSpellInfo({ SPELL_TWILIGHT_BLOODBOLT_FROM_WHIRL });
}
bool Load() override
@@ -814,9 +810,7 @@ public:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_ESSENCE_OF_THE_BLOOD_QUEEN_HEAL))
return false;
return true;
return ValidateSpellInfo({ SPELL_ESSENCE_OF_THE_BLOOD_QUEEN_HEAL });
}
void OnProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -849,13 +843,12 @@ public:
bool Validate(SpellInfo const* /*spell*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_ESSENCE_OF_THE_BLOOD_QUEEN_PLR))
return false;
if (!sSpellMgr->GetSpellInfo(SPELL_FRENZIED_BLOODTHIRST))
return false;
if (!sSpellMgr->GetSpellInfo(SPELL_PRESENCE_OF_THE_DARKFALLEN_DUMMY))
return false;
return true;
return ValidateSpellInfo(
{
SPELL_ESSENCE_OF_THE_BLOOD_QUEEN_PLR,
SPELL_FRENZIED_BLOODTHIRST,
SPELL_PRESENCE_OF_THE_DARKFALLEN_DUMMY
});
}
SpellCastResult CheckTarget()
@@ -1014,4 +1007,4 @@ void AddSC_boss_blood_queen_lana_thel()
new achievement_once_bitten_twice_shy("achievement_once_bitten_twice_shy_v_10", 0, true);
new achievement_once_bitten_twice_shy("achievement_once_bitten_twice_shy_n_25", 1, false);
new achievement_once_bitten_twice_shy("achievement_once_bitten_twice_shy_v_25", 1, true);
}
}

View File

@@ -324,9 +324,7 @@ public:
bool Validate(SpellInfo const* /*spell*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_INOCULATED))
return false;
return true;
return ValidateSpellInfo({ SPELL_INOCULATED });
}
void ExtraEffect(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
@@ -371,9 +369,7 @@ public:
bool Validate(SpellInfo const* /*spell*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_GASTRIC_EXPLOSION))
return false;
return true;
return ValidateSpellInfo({ SPELL_GASTRIC_EXPLOSION });
}
void HandleScript(SpellEffIndex /*effIndex*/)
@@ -491,4 +487,4 @@ void AddSC_boss_festergut()
new achievement_flu_shot_shortage();
new npc_stinky_icc();
}
}

View File

@@ -1938,11 +1938,11 @@ public:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_ROCKET_PACK_DAMAGE) ||
!sSpellMgr->GetSpellInfo(SPELL_ROCKET_BURST))
return false;
return true;
return ValidateSpellInfo(
{
SPELL_ROCKET_PACK_DAMAGE,
SPELL_ROCKET_BURST
});
}
void HandlePeriodic(AuraEffect const* /*aurEff*/)

View File

@@ -1085,11 +1085,7 @@ public:
bool Validate(SpellInfo const* spell) override
{
if (!spell->ExcludeTargetAuraSpell)
return false;
if (!sSpellMgr->GetSpellInfo(spell->ExcludeTargetAuraSpell))
return false;
return true;
return ValidateSpellInfo({ spell->ExcludeTargetAuraSpell });
}
// set up initial variables and check if caster is creature
@@ -1247,11 +1243,7 @@ public:
bool Validate(SpellInfo const* /*spell*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_UNBOUND_PLAGUE))
return false;
if (!sSpellMgr->GetSpellInfo(SPELL_UNBOUND_PLAGUE_SEARCHER))
return false;
return true;
return ValidateSpellInfo({ SPELL_UNBOUND_PLAGUE, SPELL_UNBOUND_PLAGUE_SEARCHER });
}
void FilterTargets(std::list<WorldObject*>& targets)
@@ -1726,4 +1718,4 @@ void AddSC_boss_professor_putricide()
new spell_putricide_mutated_transformation_dmg();
new spell_putricide_eat_ooze();
new spell_putricide_regurgitated_ooze();
}
}

View File

@@ -756,9 +756,7 @@ public:
bool Validate(SpellInfo const* /*spell*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_UNSTABLE_OOZE_EXPLOSION_TRIGGER))
return false;
return true;
return ValidateSpellInfo({ SPELL_UNSTABLE_OOZE_EXPLOSION_TRIGGER });
}
void HandleCast(SpellEffIndex effIndex)
@@ -961,4 +959,4 @@ void AddSC_boss_rotface()
new spell_rotface_unstable_ooze_explosion_suicide();
new npc_precious_icc();
}
}

View File

@@ -1014,9 +1014,7 @@ public:
bool Validate(SpellInfo const* /*spell*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_BACKLASH))
return false;
return true;
return ValidateSpellInfo({ SPELL_BACKLASH });
}
void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
@@ -1048,9 +1046,7 @@ public:
bool Validate(SpellInfo const* /*spell*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_ICY_GRIP_JUMP))
return false;
return true;
return ValidateSpellInfo({ SPELL_ICY_GRIP_JUMP });
}
void HandleScript(SpellEffIndex effIndex)
@@ -1126,9 +1122,7 @@ public:
bool Validate(SpellInfo const* /*spell*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_ICE_TOMB_DAMAGE))
return false;
return true;
return ValidateSpellInfo({ SPELL_ICE_TOMB_DAMAGE });
}
void PeriodicTick(AuraEffect const* /*aurEff*/)
@@ -1713,9 +1707,7 @@ public:
bool Validate(SpellInfo const* /*spell*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_ICY_BLAST_AREA))
return false;
return true;
return ValidateSpellInfo({ SPELL_ICY_BLAST_AREA });
}
void HandleTriggerMissile(SpellEffIndex effIndex)
@@ -1921,9 +1913,7 @@ public:
bool Validate(SpellInfo const* /*spell*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_FOCUS_FIRE))
return false;
return true;
return ValidateSpellInfo({ SPELL_FOCUS_FIRE });
}
void FilterTargets(std::list<WorldObject*>& targets)

View File

@@ -1912,9 +1912,7 @@ public:
bool Validate(SpellInfo const* /*spell*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_NECROTIC_PLAGUE_JUMP))
return false;
return true;
return ValidateSpellInfo({ SPELL_NECROTIC_PLAGUE_JUMP });
}
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -2160,9 +2158,7 @@ public:
bool Validate(SpellInfo const* /*spell*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_ICE_BURST))
return false;
return true;
return ValidateSpellInfo({ SPELL_ICE_BURST });
}
void CheckTargetCount(std::list<WorldObject*>& unitList)
@@ -2476,9 +2472,7 @@ public:
bool Validate(SpellInfo const* /*spell*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_SOUL_REAPER_BUFF))
return false;
return true;
return ValidateSpellInfo({ SPELL_SOUL_REAPER_BUFF });
}
void OnPeriodic(AuraEffect const* /*aurEff*/)
@@ -2897,9 +2891,7 @@ public:
bool Validate(SpellInfo const* /*spell*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_LIFE_SIPHON_HEAL))
return false;
return true;
return ValidateSpellInfo({ SPELL_LIFE_SIPHON_HEAL });
}
void TriggerHeal()
@@ -3524,9 +3516,7 @@ public:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_DARK_HUNGER_HEAL))
return false;
return true;
return ValidateSpellInfo({ SPELL_DARK_HUNGER_HEAL });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)

View File

@@ -581,9 +581,7 @@ public:
bool Validate(SpellInfo const* /*spell*/) override
{
if (!sSpellMgr->GetSpellInfo(_triggerId))
return false;
return true;
return ValidateSpellInfo({ _triggerId });
}
void HandleTrigger()

View File

@@ -590,7 +590,7 @@ public:
bool Validate(SpellInfo const* /*spell*/) override
{
return sSpellMgr->GetSpellInfo(SPELL_MANA_DETONATION_DAMAGE) != nullptr;
return ValidateSpellInfo({ SPELL_MANA_DETONATION_DAMAGE });
}
void HandleScript(AuraEffect const* aurEff)

View File

@@ -594,9 +594,7 @@ public:
bool Validate(SpellInfo const* /*spell*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_POSITIVE_POLARITY) || !sSpellMgr->GetSpellInfo(SPELL_NEGATIVE_POLARITY))
return false;
return true;
return ValidateSpellInfo({ SPELL_POSITIVE_POLARITY, SPELL_NEGATIVE_POLARITY });
}
void HandleDummy(SpellEffIndex /* effIndex */)

View File

@@ -525,9 +525,7 @@ public:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_AMBER_SHOCK_CHARGE))
return false;
return true;
return ValidateSpellInfo({ SPELL_AMBER_SHOCK_CHARGE });
}
void Apply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -565,9 +563,7 @@ public:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_RUBY_EVASIVE_CHARGES))
return false;
return true;
return ValidateSpellInfo({ SPELL_RUBY_EVASIVE_CHARGES });
}
void HandleProc(AuraEffect const* /*aurEff*/, ProcEventInfo& /*eventInfo*/)
@@ -602,9 +598,7 @@ public:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_AMBER_SHOCK_CHARGE))
return false;
return true;
return ValidateSpellInfo({ SPELL_AMBER_SHOCK_CHARGE });
}
void CalcDamage()
@@ -644,9 +638,7 @@ public:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_AMBER_SHOCK_CHARGE))
return false;
return true;
return ValidateSpellInfo({ SPELL_AMBER_SHOCK_CHARGE });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)

View File

@@ -2887,9 +2887,7 @@ public:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_GRIM_REPRISAL_DAMAGE))
return false;
return true;
return ValidateSpellInfo({ SPELL_GRIM_REPRISAL_DAMAGE });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)

View File

@@ -207,7 +207,7 @@ public:
bool Validate(SpellInfo const* /*spellEntry*/) override
{
return (bool) sSpellMgr->GetSpellInfo(SPELL_TICKING_TIME_BOMB_EXPLODE);
return ValidateSpellInfo({ SPELL_TICKING_TIME_BOMB_EXPLODE });
}
void HandleOnEffectRemove(AuraEffect const* /* aurEff */, AuraEffectHandleModes /* mode */)

View File

@@ -188,9 +188,7 @@ public:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_METEOR_FISTS_DAMAGE))
return false;
return true;
return ValidateSpellInfo({ SPELL_METEOR_FISTS_DAMAGE });
}
void TriggerFists(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -222,9 +220,7 @@ public:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_FW_METEOR_FISTS_DAMAGE))
return false;
return true;
return ValidateSpellInfo({ SPELL_FW_METEOR_FISTS_DAMAGE });
}
void TriggerFists(AuraEffect const* aurEff, ProcEventInfo& eventInfo)

View File

@@ -1012,7 +1012,7 @@ public:
bool Validate(SpellInfo const* /*spell*/) override
{
return sSpellMgr->GetSpellInfo(SPELL_DESPAWN_RIFT);
return ValidateSpellInfo({ SPELL_DESPAWN_RIFT });
}
void HandlePeriodic(AuraEffect const* /* aurEff */)

View File

@@ -809,12 +809,13 @@ public:
bool Validate(SpellInfo const* /*spell*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_BUILD_CATAPULT_FORCE)
|| !sSpellMgr->GetSpellInfo(SPELL_BUILD_DEMOLISHER_FORCE)
|| !sSpellMgr->GetSpellInfo(SPELL_BUILD_SIEGE_VEHICLE_FORCE_HORDE)
|| !sSpellMgr->GetSpellInfo(SPELL_BUILD_SIEGE_VEHICLE_FORCE_ALLIANCE))
return false;
return true;
return ValidateSpellInfo(
{
SPELL_BUILD_CATAPULT_FORCE,
SPELL_BUILD_DEMOLISHER_FORCE,
SPELL_BUILD_SIEGE_VEHICLE_FORCE_HORDE,
SPELL_BUILD_SIEGE_VEHICLE_FORCE_ALLIANCE
});
}
void HandleScript(SpellEffIndex effIndex)