fix(Core/Spells): Eye of Grillok improvements (#19148)

* fix(Core/Spells): Eye of Grillok improvements

* my eyes

* discovery of RegisterSpellAndAuraScriptPair

* comment
This commit is contained in:
avarishd
2024-06-29 13:33:23 +03:00
committed by GitHub
parent 01f063e242
commit 63c8c6480e
4 changed files with 72 additions and 17 deletions

View File

@@ -3938,6 +3938,58 @@ class spell_item_scroll_of_retribution : public SpellScript
}
};
// 38554 - Absorb Eye of Grillok (Zezzak's Shard)
enum EyeofGrillok
{
SPELL_EYE_OF_GRILLOK = 38495,
NPC_EYE_OF_GRILLOK = 19440
};
class spell_item_eye_of_grillok : public SpellScript
{
PrepareSpellScript(spell_item_eye_of_grillok)
SpellCastResult CheckCast()
{
if (Unit* target = GetExplTargetUnit())
if (target->GetEntry() == NPC_EYE_OF_GRILLOK && !target->isDead())
return SPELL_CAST_OK;
return SPELL_FAILED_BAD_TARGETS;
}
void Register() override
{
OnCheckCast += SpellCheckCastFn(spell_item_eye_of_grillok::CheckCast);
}
};
class spell_item_eye_of_grillok_aura : public AuraScript
{
PrepareAuraScript(spell_item_eye_of_grillok_aura)
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_EYE_OF_GRILLOK });
}
void OnPeriodic(AuraEffect const* aurEff)
{
Unit* caster = GetCaster();
if (!caster || !GetTarget())
return;
caster->CastSpell(caster, SPELL_EYE_OF_GRILLOK, true);
GetTarget()->ToCreature()->DespawnOrUnsummon();
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_item_eye_of_grillok_aura::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
void AddSC_item_spell_scripts()
{
RegisterSpellScript(spell_item_massive_seaforium_charge);
@@ -4059,5 +4111,6 @@ void AddSC_item_spell_scripts()
RegisterSpellScript(spell_item_worn_troll_dice);
RegisterSpellScript(spell_item_venomhide_feed);
RegisterSpellScript(spell_item_scroll_of_retribution);
RegisterSpellAndAuraScriptPair(spell_item_eye_of_grillok, spell_item_eye_of_grillok_aura);
}