diff options
-rw-r--r-- | sql/updates/world/3.3.5/2020_05_10_00_world.sql | 6 | ||||
-rw-r--r-- | src/server/scripts/Pet/pet_generic.cpp | 26 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_generic.cpp | 77 |
3 files changed, 109 insertions, 0 deletions
diff --git a/sql/updates/world/3.3.5/2020_05_10_00_world.sql b/sql/updates/world/3.3.5/2020_05_10_00_world.sql new file mode 100644 index 00000000000..32f29b22737 --- /dev/null +++ b/sql/updates/world/3.3.5/2020_05_10_00_world.sql @@ -0,0 +1,6 @@ +UPDATE creature_template SET `AIName`='',`ScriptName`='npc_pet_lich' WHERE entry=36979; +DELETE FROM `spell_script_names` WHERE `ScriptName` IN ('spell_gen_lich_pet_aura', 'spell_gen_lich_pet_onsummon', 'spell_gen_lich_pet_aura_remove'); +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(69732,'spell_gen_lich_pet_aura'), +(69735,'spell_gen_lich_pet_onsummon'), +(69736,'spell_gen_lich_pet_aura_remove'); diff --git a/src/server/scripts/Pet/pet_generic.cpp b/src/server/scripts/Pet/pet_generic.cpp index 2e26fe30ae6..63c2b4bbb29 100644 --- a/src/server/scripts/Pet/pet_generic.cpp +++ b/src/server/scripts/Pet/pet_generic.cpp @@ -150,8 +150,34 @@ struct npc_pet_gen_soul_trader : public ScriptedAI } }; +enum LichPet +{ + SPELL_LICH_ONSUMMON = 69735, + SPELL_LICH_REMOVE_AURA = 69736 +}; + +struct npc_pet_lich : public ScriptedAI +{ + npc_pet_lich(Creature* creature) : ScriptedAI(creature) { } + + void LeavingWorld() override + { + if (Unit* owner = me->GetOwner()) + DoCast(owner, SPELL_LICH_REMOVE_AURA); + } + + void JustAppeared() override + { + if (Unit* owner = me->GetOwner()) + DoCast(owner, SPELL_LICH_ONSUMMON); + + CreatureAI::JustAppeared(); + } +}; + void AddSC_generic_pet_scripts() { new npc_pet_gen_pandaren_monk(); RegisterCreatureAI(npc_pet_gen_soul_trader); + RegisterCreatureAI(npc_pet_lich); } diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 743c445dff3..3f0a4dfce5c 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -1934,6 +1934,80 @@ class spell_gen_gnomish_transporter : public SpellScript } }; +enum LichPet +{ + NPC_LICH_PET = 36979, + + SPELL_LICH_PET_AURA = 69732, + SPELL_LICH_PET_AURA_ONKILL = 69731 +}; + +// 69732 - Lich Pet Aura +class spell_gen_lich_pet_aura : public AuraScript +{ + PrepareAuraScript(spell_gen_lich_pet_aura); + + bool CheckProc(ProcEventInfo& eventInfo) + { + return (eventInfo.GetProcTarget()->GetTypeId() == TYPEID_PLAYER); + } + + void HandleProc(AuraEffect const* /* aurEff */, ProcEventInfo& /* eventInfo */) + { + PreventDefaultAction(); + + std::list<Creature*> minionList; + GetUnitOwner()->GetAllMinionsByEntry(minionList, NPC_LICH_PET); + for (Creature* minion : minionList) + if (minion->IsAIEnabled()) + minion->AI()->DoCastSelf(SPELL_LICH_PET_AURA_ONKILL); + } + + void Register() override + { + DoCheckProc += AuraCheckProcFn(spell_gen_lich_pet_aura::CheckProc); + OnEffectProc += AuraEffectProcFn(spell_gen_lich_pet_aura::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL); + } +}; + +// 69735 - Lich Pet OnSummon +class spell_gen_lich_pet_onsummon : public SpellScript +{ + PrepareSpellScript(spell_gen_lich_pet_onsummon); + + bool Validate(SpellInfo const* /* spellInfo */) override + { + return ValidateSpellInfo({ SPELL_LICH_PET_AURA }); + } + + void HandleScriptEffect(SpellEffIndex /* effIndex */) + { + Unit* target = GetHitUnit(); + target->CastSpell(target, SPELL_LICH_PET_AURA, true); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_gen_lich_pet_onsummon::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } +}; + +// 69736 - Lich Pet Aura Remove +class spell_gen_lich_pet_aura_remove : public SpellScript +{ + PrepareSpellScript(spell_gen_lich_pet_aura_remove); + + void HandleScriptEffect(SpellEffIndex /* effIndex */) + { + GetHitUnit()->RemoveAurasDueToSpell(SPELL_LICH_PET_AURA); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_gen_lich_pet_aura_remove::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } +}; + class spell_gen_lifeblood : public AuraScript { PrepareAuraScript(spell_gen_lifeblood); @@ -4450,6 +4524,9 @@ void AddSC_generic_spell_scripts() RegisterSpellScript(spell_gen_gadgetzan_transporter_backfire); RegisterAuraScript(spell_gen_gift_of_naaru); RegisterSpellScript(spell_gen_gnomish_transporter); + RegisterAuraScript(spell_gen_lich_pet_aura); + RegisterSpellScript(spell_gen_lich_pet_onsummon); + RegisterSpellScript(spell_gen_lich_pet_aura_remove); RegisterAuraScript(spell_gen_lifeblood); new spell_gen_lifebloom("spell_hexlord_lifebloom", SPELL_HEXLORD_MALACRASS_LIFEBLOOM_FINAL_HEAL); new spell_gen_lifebloom("spell_tur_ragepaw_lifebloom", SPELL_TUR_RAGEPAW_LIFEBLOOM_FINAL_HEAL); |