diff options
Diffstat (limited to 'src/scripts')
| -rw-r--r-- | src/scripts/Northrend/zone_borean_tundra.cpp | 106 | 
1 files changed, 105 insertions, 1 deletions
diff --git a/src/scripts/Northrend/zone_borean_tundra.cpp b/src/scripts/Northrend/zone_borean_tundra.cpp index a88a56359b..6b28b75bc7 100644 --- a/src/scripts/Northrend/zone_borean_tundra.cpp +++ b/src/scripts/Northrend/zone_borean_tundra.cpp @@ -1264,6 +1264,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 = 0; +        } + +        void SetGUID(uint64 guid, int32 /*action*/) override +        { +            if (_playerGUID) +                return; + +            _playerGUID = guid; + +            if (Player* player = ObjectAccessor::GetPlayer(*me, _playerGUID)) +                me->SetFacingToObject(player); + +            _events.ScheduleEvent(EVENT_TALK, 1000); +        } + +        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 = 0; +                        _events.ScheduleEvent(EVENT_RESET_ORIENTATION, 5000); +                        break; +                    case EVENT_RESET_ORIENTATION: +                        me->SetFacingTo(me->GetHomePosition().GetOrientation()); +                        break; +                } +            } +        } + +        private: +            EventMap _events; +            uint64 _playerGUID; +    }; + +    CreatureAI* GetAI(Creature* creature) const override +    { +        return new npc_bloodmage_laurithAI(creature); +    } +}; +  void AddSC_borean_tundra()  {      // Ours @@ -1283,4 +1385,6 @@ void AddSC_borean_tundra()      new npc_valiance_keep_cannoneer();      new npc_warmage_coldarra();      new npc_hidden_cultist(); -} +    new spell_q11719_bloodspore_ruination_45997(); +    new npc_bloodmage_laurith(); +}
\ No newline at end of file  | 
