From 63c8c6480ec90d03f62e60c4107d863b3997e2f0 Mon Sep 17 00:00:00 2001 From: avarishd <46330494+avarishd@users.noreply.github.com> Date: Sat, 29 Jun 2024 13:33:23 +0300 Subject: [PATCH] fix(Core/Spells): Eye of Grillok improvements (#19148) * fix(Core/Spells): Eye of Grillok improvements * my eyes * discovery of RegisterSpellAndAuraScriptPair * comment --- .../rev_1719227491089607400.sql | 13 +++++ .../game/Spells/Auras/SpellAuraEffects.cpp | 17 ------ .../game/Spells/SpellInfoCorrections.cpp | 6 +++ src/server/scripts/Spells/spell_item.cpp | 53 +++++++++++++++++++ 4 files changed, 72 insertions(+), 17 deletions(-) create mode 100644 data/sql/updates/pending_db_world/rev_1719227491089607400.sql diff --git a/data/sql/updates/pending_db_world/rev_1719227491089607400.sql b/data/sql/updates/pending_db_world/rev_1719227491089607400.sql new file mode 100644 index 000000000..dbe05f46b --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1719227491089607400.sql @@ -0,0 +1,13 @@ +-- Eye of Grillok +UPDATE `spell_dbc` SET `Effect_1` = 164,`EffectTriggerSpell_1` = 38495 WHERE (`ID` = 38529); + +DELETE FROM `spell_script_names` WHERE `spell_id`=38554; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(38554, 'spell_item_eye_of_grillok'); + +DELETE FROM `conditions` WHERE (`SourceTypeOrReferenceId` = 17) AND (`SourceGroup` = 0) AND (`SourceEntry` = 38554); + +DELETE FROM `smart_scripts` WHERE (`source_type` = 0 AND `entryorguid` = 22177); +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `event_param6`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(22177, 0, 0, 1, 8, 0, 100, 512, 38530, 0, 0, 0, 0, 0, 33, 22177, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 'Eye of Grillok Quest Credit Bunny - On Spellhit \'Quest Credit for Eye of Grillok\' - Quest Credit 10813'), +(22177, 0, 1, 0, 61, 0, 100, 512, 0, 0, 0, 0, 0, 0, 11, 38529, 2, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 'Eye of Grillok Quest Credit Bunny - On Spellhit \'Quest Credit for Eye of Grillok\' - Cast \'Serverside - Cancel Eye of Grillok\''); diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 4fa18baed..3c7f16d7a 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -6394,23 +6394,6 @@ void AuraEffect::HandlePeriodicTriggerSpellAuraTick(Unit* target, Unit* caster) Unit::Kill(target, target); return; } - // Eye of Grillok - case 38495: - triggerSpellId = 38530; - break; - // Absorb Eye of Grillok (Zezzak's Shard) - case 38554: - { - if (!caster || target->GetTypeId() != TYPEID_UNIT) - return; - - caster->CastSpell(caster, 38495, true, nullptr, this); - - Creature* creatureTarget = target->ToCreature(); - - creatureTarget->DespawnOrUnsummon(); - return; - } // Tear of Azzinoth Summon Channel - it's not really supposed to do anything, and this only prevents the console spam case 39857: triggerSpellId = 39856; diff --git a/src/server/game/Spells/SpellInfoCorrections.cpp b/src/server/game/Spells/SpellInfoCorrections.cpp index bac4ba7dc..4fceae1bc 100644 --- a/src/server/game/Spells/SpellInfoCorrections.cpp +++ b/src/server/game/Spells/SpellInfoCorrections.cpp @@ -4804,6 +4804,12 @@ void SpellMgr::LoadSpellInfoCorrections() spellInfo->AttributesEx6 |= SPELL_ATTR6_NO_CATEGORY_COOLDOWN_MODS; }); + // Eye of Grillok + ApplySpellFix({ 38495 }, [](SpellInfo* spellInfo) + { + spellInfo->Effects[EFFECT_0].TriggerSpell = 38530; // Quest Credit for Eye of Grillok + }); + for (uint32 i = 0; i < GetSpellInfoStoreSize(); ++i) { SpellInfo* spellInfo = mSpellInfoMap[i]; diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index d0c6880b5..d8910295c 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -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); }