diff options
author | kaelima <jeppo_meyer@msn.com> | 2011-06-02 15:03:46 +0200 |
---|---|---|
committer | kaelima <jeppo_meyer@msn.com> | 2011-06-02 15:03:46 +0200 |
commit | 843d4288f8b8e75f6e004d6873d225cac826ef89 (patch) | |
tree | 0ad46a7f6c2e527cdc72303cc3a911e2efc7255e /src | |
parent | 508f14fa6ccb5f674bbfc8f6f48f395ebe27fd2d (diff) |
Scripts/Azuremyst Isle: Fix The Prophecy of Akida.
- Issues with gameobject resetting resolved.
- Will now move more blizz-like.
There are more cage release quests smiliar to this witch could probably be generalized.
Diffstat (limited to 'src')
-rw-r--r-- | src/server/scripts/Kalimdor/azuremyst_isle.cpp | 113 |
1 files changed, 73 insertions, 40 deletions
diff --git a/src/server/scripts/Kalimdor/azuremyst_isle.cpp b/src/server/scripts/Kalimdor/azuremyst_isle.cpp index 02d7852fbc7..fef78351924 100644 --- a/src/server/scripts/Kalimdor/azuremyst_isle.cpp +++ b/src/server/scripts/Kalimdor/azuremyst_isle.cpp @@ -660,70 +660,103 @@ enum BristlelimbCage QUEST_THE_PROPHECY_OF_AKIDA = 9544, NPC_STILLPINE_CAPITIVE = 17375, GO_BRISTELIMB_CAGE = 181714, + CAPITIVE_SAY_1 = -1000474, CAPITIVE_SAY_2 = -1000475, - CAPITIVE_SAY_3 = -1000476 + CAPITIVE_SAY_3 = -1000476, + + POINT_INIT = 1, + EVENT_DESPAWN = 1, }; class npc_stillpine_capitive : public CreatureScript { -public: - npc_stillpine_capitive() : CreatureScript("npc_stillpine_capitive") { } + public: + npc_stillpine_capitive() : CreatureScript("npc_stillpine_capitive") { } - struct npc_stillpine_capitiveAI : public ScriptedAI - { - npc_stillpine_capitiveAI(Creature *c) : ScriptedAI(c){} + struct npc_stillpine_capitiveAI : public ScriptedAI + { + npc_stillpine_capitiveAI(Creature* creature) : ScriptedAI(creature) + { + if (GameObject* cage = me->FindNearestGameObject(GO_BRISTELIMB_CAGE, 5.0f)) + cage->UseDoorOrButton(); // This may seem strange but is actually closing door. + } - uint32 FleeTimer; + void Reset() + { + _events.Reset(); + _player = NULL; + _movementComplete = false; + } - void Reset() - { - FleeTimer = 0; - GameObject* cage = me->FindNearestGameObject(GO_BRISTELIMB_CAGE, 5.0f); - if(cage) - cage->ResetDoorOrButton(); - } + void StartMoving(Player* owner) + { + if (owner) + { + DoScriptText(RAND(CAPITIVE_SAY_1, CAPITIVE_SAY_2, CAPITIVE_SAY_3), me, owner); + _player = owner; + } + Position pos; + me->GetNearPosition(pos, 3.5f, 0.0f); + me->GetMotionMaster()->MovePoint(POINT_INIT, pos); + } - void UpdateAI(const uint32 diff) - { - if(FleeTimer) + void MovementInform(uint32 type, uint32 id) { - if(FleeTimer <= diff) + if (type != POINT_MOTION_TYPE || id != POINT_INIT) + return; + + if (_player) + _player->KilledMonsterCredit(me->GetEntry(), me->GetGUID()); + + if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == POINT_MOTION_TYPE) + me->GetMotionMaster()->MovementExpired(); + + _movementComplete = true; + _events.ScheduleEvent(EVENT_DESPAWN, 3500); + } + + void UpdateAI(uint32 const diff) + { + if (!_movementComplete) + return; + + _events.Update(diff); + + if (_events.ExecuteEvent() == EVENT_DESPAWN) me->DespawnOrUnsummon(); - else FleeTimer -= diff; } - } - }; - CreatureAI* GetAI(Creature* pCreature) const - { - return new npc_stillpine_capitiveAI(pCreature); - } + private: + Player* _player; + EventMap _events; + bool _movementComplete; + }; + CreatureAI* GetAI(Creature* creature) const + { + return new npc_stillpine_capitiveAI(creature); + } }; class go_bristlelimb_cage : public GameObjectScript { -public: - go_bristlelimb_cage() : GameObjectScript("go_bristlelimb_cage") { } + public: + go_bristlelimb_cage() : GameObjectScript("go_bristlelimb_cage") { } - bool OnGossipHello(Player* pPlayer, GameObject* pGo) - { - if(pPlayer->GetQuestStatus(QUEST_THE_PROPHECY_OF_AKIDA) == QUEST_STATUS_INCOMPLETE) + bool OnGossipHello(Player* player, GameObject* go) { - Creature* pCreature = pGo->FindNearestCreature(NPC_STILLPINE_CAPITIVE, 5.0f, true); - if(pCreature) + if (player->GetQuestStatus(QUEST_THE_PROPHECY_OF_AKIDA) == QUEST_STATUS_INCOMPLETE) { - DoScriptText(RAND(CAPITIVE_SAY_1, CAPITIVE_SAY_2, CAPITIVE_SAY_3), pCreature, pPlayer); - pCreature->GetMotionMaster()->MoveFleeing(pPlayer, 3500); - pPlayer->KilledMonsterCredit(pCreature->GetEntry(), pCreature->GetGUID()); - CAST_AI(npc_stillpine_capitive::npc_stillpine_capitiveAI, pCreature->AI())->FleeTimer = 3500; - return false; + if (Creature* capitive = go->FindNearestCreature(NPC_STILLPINE_CAPITIVE, 5.0f, true)) + { + go->ResetDoorOrButton(); + CAST_AI(npc_stillpine_capitive::npc_stillpine_capitiveAI, capitive->AI())->StartMoving(player); + return false; + } } + return true; } - return true; - } - }; void AddSC_azuremyst_isle() |