casucristy

qqq

Jul 20th, 2012
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 4.86 KB | None | 0 0
  1. From 096d26eadf805868e129f3b19b6b4f7dd106f060 Mon Sep 17 00:00:00 2001
  2. From: unknown <cristi@cristis-PC.(none)>
  3. Date: Fri, 20 Jul 2012 14:23:15 +0300
  4. Subject: [PATCH] Fix quest Don't. Stop. Moving
  5.  
  6. ---
  7. src/server/scripts/Maelstrom/deepholm.cpp |  147 +++++++++++++++++++++++++++++
  8. 1 file changed, 147 insertions(+)
  9.  
  10. diff --git a/src/server/scripts/Maelstrom/deepholm.cpp b/src/server/scripts/Maelstrom/deepholm.cpp
  11. index 0449e04..a4dbbac 100644
  12. --- a/src/server/scripts/Maelstrom/deepholm.cpp
  13. +++ b/src/server/scripts/Maelstrom/deepholm.cpp
  14. @@ -16,6 +16,7 @@
  15. */
  16.  
  17. #include "ScriptPCH.h"
  18. +#include "ScriptedFollowerAI.h"
  19.  
  20. class npc_lodestone : public CreatureScript
  21. {
  22. @@ -475,6 +476,150 @@ class npc_red_mist : public CreatureScript
  23.         }
  24. };
  25.  
  26. +/*###
  27. +## Support for quest Don't Stop Moving
  28. +########*/
  29. +
  30. +enum eTerrathTheSteadyEntries
  31. +{
  32. +   QUEST_DONT_STOP_MOVING      =   26656,
  33. +   NPC_OPALESCENT_GUARDIAN     =   43591,
  34. +   SPEAK_TO_TERRATH_CREDIT     =   46139,
  35. +   NPC_OPAL_STONETHROWER       =   43586,
  36. +   NPC_OPALESCENT_GUARD_CREDIT =   43597,
  37. +
  38. +};
  39. +
  40. +class npc_opalescent_guardian : public CreatureScript
  41. +{
  42. +    public:
  43. +        npc_opalescent_guardian() : CreatureScript("npc_opalescent_guardian") { }
  44. +
  45. +       struct npc_opalescent_guardianAI : public FollowerAI
  46. +       {
  47. +           npc_opalescent_guardianAI(Creature* creature) : FollowerAI(creature) { }
  48. +
  49. +           void Reset() { }
  50. +
  51. +           void MoveInLineOfSight(Unit* who)
  52. +           {
  53. +               FollowerAI::MoveInLineOfSight(who);
  54. +
  55. +               if (!me->getVictim() && !HasFollowState(STATE_FOLLOW_COMPLETE) && who->GetEntry() == NPC_OPAL_STONETHROWER)
  56. +               {
  57. +                   if (me->IsWithinDistInMap(who, 15.0f))
  58. +                   {
  59. +                       DoComplete();
  60. +                   }
  61. +               }
  62. +           }
  63. +
  64. +           void DoComplete()
  65. +           {
  66. +               if (Player* player = GetLeaderForFollower())
  67. +               {
  68. +                   if (player->GetQuestStatus(QUEST_DONT_STOP_MOVING) == QUEST_STATUS_INCOMPLETE)
  69. +                       player->KilledMonsterCredit(NPC_OPALESCENT_GUARD_CREDIT,0);
  70. +               }
  71. +
  72. +               SetFollowComplete();
  73. +           }
  74. +
  75. +           void UpdateFollowerAI(const uint32 uiDiff)
  76. +           {
  77. +               if (!UpdateVictim())
  78. +                   return;
  79. +
  80. +               if(Player* player = GetLeaderForFollower())
  81. +               {
  82. +                   if(me->GetDistance(player) > 75.0f)
  83. +                   {
  84. +                       me->RemoveFromWorld();
  85. +                       return;
  86. +                   }
  87. +               }
  88. +
  89. +               DoMeleeAttackIfReady();
  90. +           }
  91. +       };
  92. +
  93. +       CreatureAI* GetAI(Creature* creature) const
  94. +       {
  95. +           return new npc_opalescent_guardianAI(creature);
  96. +       }
  97. +};
  98. +
  99. +#define GOSSIP_TERRATH_THE_STEADY  "I'm ready to escort a group of elementals across the open."
  100. +#define TERRATH_TEXT_EMOTE_01      "Speak with Terrath the Steady when you are ready to begin."
  101. +
  102. +
  103. +class npc_terrath_the_steady: public CreatureScript
  104. +{
  105. +    public:
  106. +        npc_terrath_the_steady() : CreatureScript("npc_terrath_the_steady") { }
  107. +
  108. +       bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest)
  109. +       {
  110. +           if (quest->GetQuestId() == QUEST_DONT_STOP_MOVING)
  111. +           {
  112. +               creature->MonsterTextEmote(TERRATH_TEXT_EMOTE_01,player->GetGUID(),true);
  113. +           }
  114. +           return true;
  115. +       }
  116. +
  117. +       bool OnGossipHello(Player* player, Creature* creature)
  118. +       {
  119. +           if (creature->isQuestGiver())
  120. +               player->PrepareQuestMenu(creature->GetGUID());
  121. +
  122. +           if(player->GetQuestStatus(QUEST_DONT_STOP_MOVING)==QUEST_STATUS_INCOMPLETE)
  123. +           {
  124. +               player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_TERRATH_THE_STEADY, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
  125. +           }
  126. +
  127. +           player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
  128. +
  129. +           return true;
  130. +       }
  131. +
  132. +       bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action)
  133. +       {
  134. +           player->KilledMonsterCredit(SPEAK_TO_TERRATH_CREDIT,0);
  135. +           player->PlayerTalkClass->ClearMenus();
  136. +        
  137. +           for(uint32 i = 0 ; i < 5 ; i++)
  138. +           {
  139. +               Creature* pGuardian = creature->SummonCreature(NPC_OPALESCENT_GUARDIAN,creature->GetPositionX(),creature->GetPositionY(),creature->GetPositionZ(),creature->GetOrientation());
  140. +               if(pGuardian)
  141. +               {
  142. +                  
  143. +                   if (npc_opalescent_guardian::npc_opalescent_guardianAI* psGuardian = CAST_AI(npc_opalescent_guardian::npc_opalescent_guardianAI, pGuardian->AI()))
  144. +                       psGuardian->StartFollow(player);
  145. +               }
  146. +           }
  147. +
  148. +           player->CLOSE_GOSSIP_MENU();
  149. +
  150. +           return true;
  151. +       }
  152. +
  153. +       struct npc_terrath_the_steadyAI : public ScriptedAI
  154. +       {
  155. +           npc_terrath_the_steadyAI(Creature* creature) : ScriptedAI(creature) { }
  156. +
  157. +           void Reset()
  158. +           {
  159. +               me->SetFlag(UNIT_NPC_FLAGS,UNIT_NPC_FLAG_GOSSIP+UNIT_NPC_FLAG_QUESTGIVER);
  160. +           }
  161. +
  162. +       };
  163. +
  164. +       CreatureAI* GetAI(Creature *creature) const
  165. +       {
  166. +           return new npc_terrath_the_steadyAI(creature);
  167. +       }
  168. +};
  169. +
  170.  void AddSC_deepholm()
  171.  {
  172.      new npc_lodestone();
  173. @@ -486,4 +631,6 @@ void AddSC_deepholm()
  174.     new npc_kor_the_immovable();
  175.     new npc_pebble();
  176.     new npc_red_mist();
  177. +   new npc_terrath_the_steady();
  178. +   new npc_opalescent_guardian();
  179.  }
  180. --
  181. 1.7.10.msysgit.1
Advertisement
Add Comment
Please, Sign In to add comment