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

@@ -1096,9 +1096,7 @@ public:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_DK_RUNIC_POWER_ENERGIZE))
return false;
return true;
return ValidateSpellInfo({ SPELL_DK_RUNIC_POWER_ENERGIZE });
}
void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
@@ -1168,9 +1166,7 @@ public:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_DK_ANTI_MAGIC_SHELL_TALENT))
return false;
return true;
return ValidateSpellInfo({ SPELL_DK_ANTI_MAGIC_SHELL_TALENT });
}
void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& canBeRecalculated)
@@ -1213,9 +1209,7 @@ public:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_DK_BLOOD_BOIL_TRIGGERED))
return false;
return true;
return ValidateSpellInfo({ SPELL_DK_BLOOD_BOIL_TRIGGERED });
}
bool Load() override
@@ -1259,9 +1253,7 @@ public:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_DK_BLOOD_GORGED_HEAL))
return false;
return true;
return ValidateSpellInfo({ SPELL_DK_BLOOD_GORGED_HEAL });
}
bool Load() override
@@ -1332,14 +1324,14 @@ public:
{
PrepareSpellScript(spell_dk_corpse_explosion_SpellScript);
bool Validate(SpellInfo const* spellInfo) override
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_DK_CORPSE_EXPLOSION_TRIGGERED)
|| !sSpellMgr->GetSpellInfo(SPELL_DK_GHOUL_EXPLODE)
|| !sSpellMgr->GetSpellInfo(SPELL_DK_CORPSE_EXPLOSION_VISUAL)
|| !sSpellMgr->GetSpellInfo(spellInfo->Effects[EFFECT_1].CalcValue()))
return false;
return true;
return ValidateSpellInfo(
{
SPELL_DK_CORPSE_EXPLOSION_TRIGGERED,
SPELL_DK_GHOUL_EXPLODE,
SPELL_DK_CORPSE_EXPLOSION_VISUAL,
});
}
bool Load() override
@@ -1438,9 +1430,7 @@ public:
bool Validate(SpellInfo const* /*spell*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_DK_DEATH_COIL_DAMAGE) || !sSpellMgr->GetSpellInfo(SPELL_DK_DEATH_COIL_HEAL))
return false;
return true;
return ValidateSpellInfo({ SPELL_DK_DEATH_COIL_DAMAGE, SPELL_DK_DEATH_COIL_HEAL });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
@@ -1737,9 +1727,7 @@ public:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_DK_DEATH_STRIKE_HEAL))
return false;
return true;
return ValidateSpellInfo({ SPELL_DK_DEATH_STRIKE_HEAL });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
@@ -1778,12 +1766,9 @@ public:
{
PrepareSpellScript(spell_dk_ghoul_explode_SpellScript);
bool Validate(SpellInfo const* spellInfo) override
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_DK_CORPSE_EXPLOSION_TRIGGERED)
|| spellInfo->Effects[EFFECT_2].CalcValue() <= 0)
return false;
return true;
return ValidateSpellInfo({ SPELL_DK_CORPSE_EXPLOSION_TRIGGERED });
}
void HandleDamage(SpellEffIndex /*effIndex*/)
@@ -1877,12 +1862,13 @@ public:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_DK_BLOOD_PRESENCE)
|| !sSpellMgr->GetSpellInfo(SPELL_DK_FROST_PRESENCE)
|| !sSpellMgr->GetSpellInfo(SPELL_DK_UNHOLY_PRESENCE)
|| !sSpellMgr->GetSpellInfo(SPELL_DK_IMPROVED_BLOOD_PRESENCE_TRIGGERED))
return false;
return true;
return ValidateSpellInfo(
{
SPELL_DK_BLOOD_PRESENCE,
SPELL_DK_FROST_PRESENCE,
SPELL_DK_UNHOLY_PRESENCE,
SPELL_DK_IMPROVED_BLOOD_PRESENCE_TRIGGERED
});
}
void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
@@ -1924,12 +1910,13 @@ public:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_DK_BLOOD_PRESENCE)
|| !sSpellMgr->GetSpellInfo(SPELL_DK_FROST_PRESENCE)
|| !sSpellMgr->GetSpellInfo(SPELL_DK_UNHOLY_PRESENCE)
|| !sSpellMgr->GetSpellInfo(SPELL_DK_FROST_PRESENCE_TRIGGERED))
return false;
return true;
return ValidateSpellInfo(
{
SPELL_DK_BLOOD_PRESENCE,
SPELL_DK_FROST_PRESENCE,
SPELL_DK_UNHOLY_PRESENCE,
SPELL_DK_FROST_PRESENCE_TRIGGERED
});
}
void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
@@ -1971,13 +1958,14 @@ public:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_DK_BLOOD_PRESENCE)
|| !sSpellMgr->GetSpellInfo(SPELL_DK_FROST_PRESENCE)
|| !sSpellMgr->GetSpellInfo(SPELL_DK_UNHOLY_PRESENCE)
|| !sSpellMgr->GetSpellInfo(SPELL_DK_IMPROVED_UNHOLY_PRESENCE_TRIGGERED)
|| !sSpellMgr->GetSpellInfo(SPELL_DK_UNHOLY_PRESENCE_TRIGGERED))
return false;
return true;
return ValidateSpellInfo(
{
SPELL_DK_BLOOD_PRESENCE,
SPELL_DK_FROST_PRESENCE,
SPELL_DK_UNHOLY_PRESENCE,
SPELL_DK_IMPROVED_UNHOLY_PRESENCE_TRIGGERED,
SPELL_DK_UNHOLY_PRESENCE_TRIGGERED
});
}
void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
@@ -2077,19 +2065,19 @@ public:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_DK_BLOOD_PRESENCE)
|| !sSpellMgr->GetSpellInfo(SPELL_DK_FROST_PRESENCE)
|| !sSpellMgr->GetSpellInfo(SPELL_DK_UNHOLY_PRESENCE)
|| !sSpellMgr->GetSpellInfo(SPELL_DK_IMPROVED_BLOOD_PRESENCE_R1)
|| !sSpellMgr->GetSpellInfo(SPELL_DK_IMPROVED_FROST_PRESENCE_R1)
|| !sSpellMgr->GetSpellInfo(SPELL_DK_IMPROVED_UNHOLY_PRESENCE_R1)
|| !sSpellMgr->GetSpellInfo(SPELL_DK_IMPROVED_BLOOD_PRESENCE_TRIGGERED)
|| !sSpellMgr->GetSpellInfo(SPELL_DK_IMPROVED_UNHOLY_PRESENCE_TRIGGERED)
|| !sSpellMgr->GetSpellInfo(SPELL_DK_FROST_PRESENCE_TRIGGERED)
|| !sSpellMgr->GetSpellInfo(SPELL_DK_UNHOLY_PRESENCE_TRIGGERED))
return false;
return true;
return ValidateSpellInfo(
{
SPELL_DK_BLOOD_PRESENCE,
SPELL_DK_FROST_PRESENCE,
SPELL_DK_UNHOLY_PRESENCE,
SPELL_DK_IMPROVED_BLOOD_PRESENCE_R1,
SPELL_DK_IMPROVED_FROST_PRESENCE_R1,
SPELL_DK_IMPROVED_UNHOLY_PRESENCE_R1,
SPELL_DK_IMPROVED_BLOOD_PRESENCE_TRIGGERED,
SPELL_DK_IMPROVED_UNHOLY_PRESENCE_TRIGGERED,
SPELL_DK_FROST_PRESENCE_TRIGGERED,
SPELL_DK_UNHOLY_PRESENCE_TRIGGERED
});
}
void HandleImprovedBloodPresence(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
@@ -2191,14 +2179,13 @@ public:
{
PrepareSpellScript(spell_dk_raise_dead_SpellScript);
bool Validate(SpellInfo const* spellInfo) override
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sSpellMgr->GetSpellInfo(spellInfo->Effects[EFFECT_1].CalcValue())
|| !sSpellMgr->GetSpellInfo(spellInfo->Effects[EFFECT_2].CalcValue())
|| !sSpellMgr->GetSpellInfo(SPELL_DK_RAISE_DEAD_USE_REAGENT)
|| !sSpellMgr->GetSpellInfo(SPELL_DK_MASTER_OF_GHOULS))
return false;
return true;
return ValidateSpellInfo(
{
SPELL_DK_RAISE_DEAD_USE_REAGENT,
SPELL_DK_MASTER_OF_GHOULS
});
}
bool Load() override
@@ -2354,9 +2341,7 @@ public:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_DK_SCENT_OF_BLOOD))
return false;
return true;
return ValidateSpellInfo({ SPELL_DK_SCENT_OF_BLOOD });
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/)
@@ -2399,9 +2384,7 @@ public:
bool Validate(SpellInfo const* /*spellInfo*/) override
{
if (!sSpellMgr->GetSpellInfo(SPELL_DK_SCOURGE_STRIKE_TRIGGERED))
return false;
return true;
return ValidateSpellInfo({ SPELL_DK_SCOURGE_STRIKE_TRIGGERED });
}
void HandleDummy(SpellEffIndex /*effIndex*/)