diff options
author | Wyreth <32145860+Wyreth@users.noreply.github.com> | 2017-10-29 06:02:39 +0100 |
---|---|---|
committer | funjoker <funjoker109@gmail.com> | 2021-01-21 22:30:40 +0100 |
commit | 45dbce6d78e08a149537d08108408947b0cbca53 (patch) | |
tree | 1e730f9ce36d6f9cfef03f60efb50e00a02ed97e /src | |
parent | 8eaf992f3ecf55feb16d093f0cfaa1828d3b1e7c (diff) |
Scripts/Northrend: talk event for quest A Suitable Test Subject (#20462)
- When using the quest item for A Suitable Test Subject and the spell aura vanishes,
Bloodmage Laurith should turn toward the player and whisper a line.
- This is handled via spell event for Bloodspore Ruination (45997)
(cherry picked from commit fda99b2972aed2b98642f8974e34c5b18f7f3676)
Diffstat (limited to 'src')
-rw-r--r-- | src/server/scripts/Northrend/zone_borean_tundra.cpp | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/src/server/scripts/Northrend/zone_borean_tundra.cpp b/src/server/scripts/Northrend/zone_borean_tundra.cpp index 3cb7d03631b..dd160545a7c 100644 --- a/src/server/scripts/Northrend/zone_borean_tundra.cpp +++ b/src/server/scripts/Northrend/zone_borean_tundra.cpp @@ -2379,6 +2379,108 @@ public: } }; +enum BloodsporeRuination +{ + NPC_BLOODMAGE_LAURITH = 25381, + SAY_BLOODMAGE_LAURITH = 0, + EVENT_TALK = 1, + EVENT_RESET_ORIENTATION +}; + +class spell_q11719_bloodspore_ruination_45997 : public SpellScriptLoader +{ +public: + spell_q11719_bloodspore_ruination_45997() : SpellScriptLoader("spell_q11719_bloodspore_ruination_45997") { } + + class spell_q11719_bloodspore_ruination_45997_SpellScript : public SpellScript + { + PrepareSpellScript(spell_q11719_bloodspore_ruination_45997_SpellScript); + + void HandleEffect(SpellEffIndex /*effIndex*/) + { + if (Unit* caster = GetCaster()) + if (Creature* laurith = caster->FindNearestCreature(NPC_BLOODMAGE_LAURITH, 100.0f)) + laurith->AI()->SetGUID(caster->GetGUID()); + } + + void Register() override + { + OnEffectHit += SpellEffectFn(spell_q11719_bloodspore_ruination_45997_SpellScript::HandleEffect, EFFECT_1, SPELL_EFFECT_SEND_EVENT); + } + }; + + SpellScript* GetSpellScript() const override + { + return new spell_q11719_bloodspore_ruination_45997_SpellScript(); + } +}; + +class npc_bloodmage_laurith : public CreatureScript +{ +public: + npc_bloodmage_laurith() : CreatureScript("npc_bloodmage_laurith") { } + + struct npc_bloodmage_laurithAI : public ScriptedAI + { + npc_bloodmage_laurithAI(Creature* creature) : ScriptedAI(creature) { } + + void Reset() override + { + _events.Reset(); + _playerGUID.Clear(); + } + + void SetGUID(ObjectGuid guid, int32 /*action*/) override + { + if (!_playerGUID.IsEmpty()) + return; + + _playerGUID = guid; + + if (Player* player = ObjectAccessor::GetPlayer(*me, _playerGUID)) + me->SetFacingToObject(player); + + _events.ScheduleEvent(EVENT_TALK, Seconds(1)); + } + + void UpdateAI(uint32 diff) override + { + if (UpdateVictim()) + { + DoMeleeAttackIfReady(); + return; + } + + _events.Update(diff); + + if (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_TALK: + if (Player* player = ObjectAccessor::GetPlayer(*me, _playerGUID)) + Talk(SAY_BLOODMAGE_LAURITH, player); + _playerGUID.Clear(); + _events.ScheduleEvent(EVENT_RESET_ORIENTATION, Seconds(5)); + break; + case EVENT_RESET_ORIENTATION: + me->SetFacingTo(me->GetHomePosition().GetOrientation()); + break; + } + } + } + + private: + EventMap _events; + ObjectGuid _playerGUID; + }; + + CreatureAI* GetAI(Creature* creature) const override + { + return new npc_bloodmage_laurithAI(creature); + } +}; + void AddSC_borean_tundra() { new npc_sinkhole_kill_credit(); @@ -2404,4 +2506,6 @@ void AddSC_borean_tundra() new npc_warmage_coldarra(); new npc_hidden_cultist(); new spell_windsoul_totem_aura(); + new spell_q11719_bloodspore_ruination_45997(); + new npc_bloodmage_laurith(); } |