diff options
Diffstat (limited to 'src/server')
| -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 fae13e92fd1..4b32348ab54 100644 --- a/src/server/scripts/Northrend/zone_borean_tundra.cpp +++ b/src/server/scripts/Northrend/zone_borean_tundra.cpp @@ -2382,6 +2382,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(); @@ -2407,4 +2509,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();  } | 
