diff options
| author | Vincent-Michael <Vincent_Michael@gmx.de> | 2014-08-28 20:16:16 +0200 |
|---|---|---|
| committer | Vincent-Michael <Vincent_Michael@gmx.de> | 2014-08-28 20:17:43 +0200 |
| commit | eccb0ed3dac67a7463cc5c1ff5cf2cd3919e7a25 (patch) | |
| tree | fd869ca5890eb8819c8cfe85102fdc1fcfb7f33c /src/server/scripts/EasternKingdoms | |
| parent | 51418b76ae7e60de3e458dbfab7a59d91610e06f (diff) | |
Scripts/Quest: Fix some movement stuff for Quest "Death Comes From On High"
Diffstat (limited to 'src/server/scripts/EasternKingdoms')
| -rw-r--r-- | src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp | 113 |
1 files changed, 113 insertions, 0 deletions
diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp index ae6aaef9999..95990f18829 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp @@ -26,6 +26,7 @@ #include "Player.h" #include "SpellInfo.h" #include "CreatureTextMgr.h" +#include "MoveSplineInit.h" /*###### ##Quest 12848 @@ -322,6 +323,117 @@ public: }; + /*###### +## npc_eye_of_acherus +######*/ + +enum EyeOfAcherus +{ + SPELL_EYE_VISUAL = 51892, + SPELL_EYE_FLIGHT_BOOST = 51923, + SPELL_EYE_FLIGHT = 51890, + + EVENT_MOVE_START = 1, + + TALK_MOVE_START = 0, + TALK_CONTROL = 1, + + POINT_EYE_FALL = 1, + POINT_EYE_MOVE_END = 3 +}; + +Position const EyeOFAcherusFallPoint = { 2361.21f, -5660.45f, 496.7444f, 0.0f }; + +class npc_eye_of_acherus : public CreatureScript +{ + public: + npc_eye_of_acherus() : CreatureScript("npc_eye_of_acherus") { } + + struct npc_eye_of_acherusAI : public ScriptedAI + { + npc_eye_of_acherusAI(Creature* creature) : ScriptedAI(creature) + { + me->SetDisplayId(me->GetCreatureTemplate()->Modelid1); + if (Player* owner = me->GetCharmerOrOwner()->ToPlayer()) + owner->SendAutoRepeatCancel(me); + + me->SetReactState(REACT_PASSIVE); + + me->GetMotionMaster()->MovePoint(POINT_EYE_FALL, EyeOFAcherusFallPoint, false); + + Movement::MoveSplineInit init(me); + init.MoveTo(EyeOFAcherusFallPoint.GetPositionX(), EyeOFAcherusFallPoint.GetPositionY(), EyeOFAcherusFallPoint.GetPositionZ(), false); + init.SetFall(); + init.Launch(); + } + + void OnCharmed(bool /*apply*/) override { } + + void UpdateAI(uint32 diff) override + { + _events.Update(diff); + + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_MOVE_START: + { + DoCast(me, SPELL_EYE_FLIGHT_BOOST); + + me->SetControlled(false, UNIT_STATE_ROOT); + if (Player* owner = me->GetCharmerOrOwner()->ToPlayer()) + { + for (uint8 i = 0; i < MAX_MOVE_TYPE; ++i) + me->SetSpeed(UnitMoveType(i), owner->GetSpeedRate(UnitMoveType(i)), true); + Talk(TALK_MOVE_START, owner); + } + me->GetMotionMaster()->MovePath(me->GetEntry() * 100, false); + break; + } + default: + break; + } + } + } + + void MovementInform(uint32 movementType, uint32 pointId) override + { + if (movementType == WAYPOINT_MOTION_TYPE && pointId == POINT_EYE_MOVE_END - 1) + { + me->SetByteValue(UNIT_FIELD_BYTES_2, 0, SHEATH_STATE_MELEE); + me->RemoveAllAuras(); + + if (Player* owner = me->GetCharmerOrOwner()->ToPlayer()) + { + owner->RemoveAura(SPELL_EYE_FLIGHT_BOOST); + for (uint8 i = 0; i < MAX_MOVE_TYPE; ++i) + me->SetSpeed(UnitMoveType(i), owner->GetSpeedRate(UnitMoveType(i)), true); + + TalkToMap(TALK_CONTROL, owner); + } + me->SetDisableGravity(false); + DoCast(me, SPELL_EYE_FLIGHT); + } + + if (movementType == POINT_MOTION_TYPE && pointId == POINT_EYE_FALL) + { + me->SetDisableGravity(true); + me->SetControlled(true, UNIT_STATE_ROOT); + _events.ScheduleEvent(EVENT_MOVE_START, 5000); + } + } + + private: + EventMap _events; + }; + + CreatureAI* GetAI(Creature* creature) const override + { + return new npc_eye_of_acherusAI(creature); + } +}; + /*###### ## npc_death_knight_initiate ######*/ @@ -1079,6 +1191,7 @@ void AddSC_the_scarlet_enclave_c1() new npc_unworthy_initiate(); new npc_unworthy_initiate_anchor(); new go_acherus_soul_prison(); + new npc_eye_of_acherus(); new npc_death_knight_initiate(); new npc_salanar_the_horseman(); new npc_dark_rider_of_acherus(); |
