Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- From 096d26eadf805868e129f3b19b6b4f7dd106f060 Mon Sep 17 00:00:00 2001
- From: unknown <cristi@cristis-PC.(none)>
- Date: Fri, 20 Jul 2012 14:23:15 +0300
- Subject: [PATCH] Fix quest Don't. Stop. Moving
- ---
- src/server/scripts/Maelstrom/deepholm.cpp | 147 +++++++++++++++++++++++++++++
- 1 file changed, 147 insertions(+)
- diff --git a/src/server/scripts/Maelstrom/deepholm.cpp b/src/server/scripts/Maelstrom/deepholm.cpp
- index 0449e04..a4dbbac 100644
- --- a/src/server/scripts/Maelstrom/deepholm.cpp
- +++ b/src/server/scripts/Maelstrom/deepholm.cpp
- @@ -16,6 +16,7 @@
- */
- #include "ScriptPCH.h"
- +#include "ScriptedFollowerAI.h"
- class npc_lodestone : public CreatureScript
- {
- @@ -475,6 +476,150 @@ class npc_red_mist : public CreatureScript
- }
- };
- +/*###
- +## Support for quest Don't Stop Moving
- +########*/
- +
- +enum eTerrathTheSteadyEntries
- +{
- + QUEST_DONT_STOP_MOVING = 26656,
- + NPC_OPALESCENT_GUARDIAN = 43591,
- + SPEAK_TO_TERRATH_CREDIT = 46139,
- + NPC_OPAL_STONETHROWER = 43586,
- + NPC_OPALESCENT_GUARD_CREDIT = 43597,
- +
- +};
- +
- +class npc_opalescent_guardian : public CreatureScript
- +{
- + public:
- + npc_opalescent_guardian() : CreatureScript("npc_opalescent_guardian") { }
- +
- + struct npc_opalescent_guardianAI : public FollowerAI
- + {
- + npc_opalescent_guardianAI(Creature* creature) : FollowerAI(creature) { }
- +
- + void Reset() { }
- +
- + void MoveInLineOfSight(Unit* who)
- + {
- + FollowerAI::MoveInLineOfSight(who);
- +
- + if (!me->getVictim() && !HasFollowState(STATE_FOLLOW_COMPLETE) && who->GetEntry() == NPC_OPAL_STONETHROWER)
- + {
- + if (me->IsWithinDistInMap(who, 15.0f))
- + {
- + DoComplete();
- + }
- + }
- + }
- +
- + void DoComplete()
- + {
- + if (Player* player = GetLeaderForFollower())
- + {
- + if (player->GetQuestStatus(QUEST_DONT_STOP_MOVING) == QUEST_STATUS_INCOMPLETE)
- + player->KilledMonsterCredit(NPC_OPALESCENT_GUARD_CREDIT,0);
- + }
- +
- + SetFollowComplete();
- + }
- +
- + void UpdateFollowerAI(const uint32 uiDiff)
- + {
- + if (!UpdateVictim())
- + return;
- +
- + if(Player* player = GetLeaderForFollower())
- + {
- + if(me->GetDistance(player) > 75.0f)
- + {
- + me->RemoveFromWorld();
- + return;
- + }
- + }
- +
- + DoMeleeAttackIfReady();
- + }
- + };
- +
- + CreatureAI* GetAI(Creature* creature) const
- + {
- + return new npc_opalescent_guardianAI(creature);
- + }
- +};
- +
- +#define GOSSIP_TERRATH_THE_STEADY "I'm ready to escort a group of elementals across the open."
- +#define TERRATH_TEXT_EMOTE_01 "Speak with Terrath the Steady when you are ready to begin."
- +
- +
- +class npc_terrath_the_steady: public CreatureScript
- +{
- + public:
- + npc_terrath_the_steady() : CreatureScript("npc_terrath_the_steady") { }
- +
- + bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest)
- + {
- + if (quest->GetQuestId() == QUEST_DONT_STOP_MOVING)
- + {
- + creature->MonsterTextEmote(TERRATH_TEXT_EMOTE_01,player->GetGUID(),true);
- + }
- + return true;
- + }
- +
- + bool OnGossipHello(Player* player, Creature* creature)
- + {
- + if (creature->isQuestGiver())
- + player->PrepareQuestMenu(creature->GetGUID());
- +
- + if(player->GetQuestStatus(QUEST_DONT_STOP_MOVING)==QUEST_STATUS_INCOMPLETE)
- + {
- + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TERRATH_THE_STEADY, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
- + }
- +
- + player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
- +
- + return true;
- + }
- +
- + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action)
- + {
- + player->KilledMonsterCredit(SPEAK_TO_TERRATH_CREDIT,0);
- + player->PlayerTalkClass->ClearMenus();
- +
- + for(uint32 i = 0 ; i < 5 ; i++)
- + {
- + Creature* pGuardian = creature->SummonCreature(NPC_OPALESCENT_GUARDIAN,creature->GetPositionX(),creature->GetPositionY(),creature->GetPositionZ(),creature->GetOrientation());
- + if(pGuardian)
- + {
- +
- + if (npc_opalescent_guardian::npc_opalescent_guardianAI* psGuardian = CAST_AI(npc_opalescent_guardian::npc_opalescent_guardianAI, pGuardian->AI()))
- + psGuardian->StartFollow(player);
- + }
- + }
- +
- + player->CLOSE_GOSSIP_MENU();
- +
- + return true;
- + }
- +
- + struct npc_terrath_the_steadyAI : public ScriptedAI
- + {
- + npc_terrath_the_steadyAI(Creature* creature) : ScriptedAI(creature) { }
- +
- + void Reset()
- + {
- + me->SetFlag(UNIT_NPC_FLAGS,UNIT_NPC_FLAG_GOSSIP+UNIT_NPC_FLAG_QUESTGIVER);
- + }
- +
- + };
- +
- + CreatureAI* GetAI(Creature *creature) const
- + {
- + return new npc_terrath_the_steadyAI(creature);
- + }
- +};
- +
- void AddSC_deepholm()
- {
- new npc_lodestone();
- @@ -486,4 +631,6 @@ void AddSC_deepholm()
- new npc_kor_the_immovable();
- new npc_pebble();
- new npc_red_mist();
- + new npc_terrath_the_steady();
- + new npc_opalescent_guardian();
- }
- --
- 1.7.10.msysgit.1
Advertisement
Add Comment
Please, Sign In to add comment