Advertisement
Guest User

Untitled

a guest
Dec 31st, 2013
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.30 KB | None | 0 0
  1. /*
  2. * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/>
  3. * Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of the GNU General Public License as published by the
  7. * Free Software Foundation; either version 2 of the License, or (at your
  8. * option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful, but WITHOUT
  11. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  13. * more details.
  14. *
  15. * You should have received a copy of the GNU General Public License along
  16. * with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18.  
  19. /* ScriptData
  20. SDName: Hyjal
  21. SD%Complete: 80
  22. SDComment: gossip text id's unknown
  23. SDCategory: Caverns of Time, Mount Hyjal
  24. EndScriptData */
  25.  
  26. /* ContentData
  27. npc_jaina_proudmoore
  28. npc_thrall
  29. npc_tyrande_whisperwind
  30. EndContentData */
  31.  
  32. #include "ScriptMgr.h"
  33. #include "ScriptedCreature.h"
  34. #include "ScriptedGossip.h"
  35. #include "hyjalAI.h"
  36. #include "Player.h"
  37.  
  38. #define GOSSIP_ITEM_BEGIN_ALLY "My companions and I are with you, Lady Proudmoore."
  39. #define GOSSIP_ITEM_ANETHERON "We are ready for whatever Archimonde might send our way, Lady Proudmoore."
  40.  
  41. #define GOSSIP_ITEM_BEGIN_HORDE "I am with you, Thrall."
  42. #define GOSSIP_ITEM_AZGALOR "We have nothing to fear."
  43.  
  44. #define GOSSIP_ITEM_RETREAT "We can't keep this up. Let's retreat!"
  45.  
  46. #define GOSSIP_ITEM_TYRANDE "Aid us in defending Nordrassil"
  47. #define ITEM_TEAR_OF_GODDESS 24494
  48.  
  49. #define GOSSIP_ITEM_GM1 "[GM] Toggle Debug Timers"
  50.  
  51. class npc_jaina_proudmoore : public CreatureScript
  52. {
  53. public:
  54. npc_jaina_proudmoore() : CreatureScript("npc_jaina_proudmoore") { }
  55.  
  56. bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) OVERRIDE
  57. {
  58. player->PlayerTalkClass->ClearMenus();
  59. hyjalAI* ai = CAST_AI(hyjalAI, creature->AI());
  60. switch (action)
  61. {
  62. case GOSSIP_ACTION_INFO_DEF + 1:
  63. ai->StartEvent(player);
  64. break;
  65. case GOSSIP_ACTION_INFO_DEF + 2:
  66. ai->FirstBossDead = true;
  67. ai->WaveCount = 9;
  68. ai->StartEvent(player);
  69. break;
  70. case GOSSIP_ACTION_INFO_DEF + 3:
  71. ai->Retreat();
  72. break;
  73. case GOSSIP_ACTION_INFO_DEF:
  74. ai->Debug = !ai->Debug;
  75. TC_LOG_DEBUG("scripts", "HyjalAI - Debug mode has been toggled");
  76. break;
  77. }
  78. return true;
  79. }
  80.  
  81. bool OnGossipHello(Player* player, Creature* creature) OVERRIDE
  82. {
  83. hyjalAI* ai = CAST_AI(hyjalAI, creature->AI());
  84. if (ai->EventBegun)
  85. return false;
  86.  
  87.  
  88. uint32 RageEncounter = ai->GetInstanceData(DATA_RAGEWINTERCHILLEVENT);
  89. uint32 AnetheronEncounter = ai->GetInstanceData(DATA_ANETHERONEVENT);
  90. if (RageEncounter == NOT_STARTED)
  91. player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, player->GetOptionTextWithEntry(15479, 0), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
  92. else if (RageEncounter == DONE && AnetheronEncounter == NOT_STARTED)
  93. player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, player->GetOptionTextWithEntry(15479, 1), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2);
  94. else if (RageEncounter == DONE && AnetheronEncounter == DONE)
  95. player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, player->GetOptionTextWithEntry(15479, 4), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3);
  96.  
  97. if (player->IsGameMaster())
  98. player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, GOSSIP_ITEM_GM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
  99.  
  100. player->SEND_GOSSIP_MENU(907, creature->GetGUID());
  101. return true;
  102. }
  103.  
  104. CreatureAI* GetAI(Creature* creature) const OVERRIDE
  105. {
  106. hyjalAI* ai = new hyjalAI(creature);
  107.  
  108. ai->Reset();
  109. ai->EnterEvadeMode();
  110.  
  111. ai->Spells[0].SpellId = SPELL_BLIZZARD;
  112. ai->Spells[0].Cooldown = urand(15000, 35000);
  113. ai->Spells[0].TargetType = TARGETTYPE_RANDOM;
  114.  
  115. ai->Spells[1].SpellId = SPELL_PYROBLAST;
  116. ai->Spells[1].Cooldown = urand(5500, 9500);
  117. ai->Spells[1].TargetType = TARGETTYPE_RANDOM;
  118.  
  119. ai->Spells[2].SpellId = SPELL_SUMMON_ELEMENTALS;
  120. ai->Spells[2].Cooldown = urand(15000, 45000);
  121. ai->Spells[2].TargetType = TARGETTYPE_SELF;
  122.  
  123. return ai;
  124. }
  125.  
  126. };
  127.  
  128. class npc_thrall : public CreatureScript
  129. {
  130. public:
  131. npc_thrall() : CreatureScript("npc_thrall") { }
  132.  
  133. bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) OVERRIDE
  134. {
  135. player->PlayerTalkClass->ClearMenus();
  136. hyjalAI* ai = CAST_AI(hyjalAI, creature->AI());
  137. ai->DeSpawnVeins();//despawn the alliance veins
  138. switch (action)
  139. {
  140. case GOSSIP_ACTION_INFO_DEF + 1:
  141. ai->StartEvent(player);
  142. break;
  143. case GOSSIP_ACTION_INFO_DEF + 2:
  144. ai->FirstBossDead = true;
  145. ai->WaveCount = 9;
  146. ai->StartEvent(player);
  147. break;
  148. case GOSSIP_ACTION_INFO_DEF + 3:
  149. ai->Retreat();
  150. break;
  151. case GOSSIP_ACTION_INFO_DEF:
  152. ai->Debug = !ai->Debug;
  153. TC_LOG_DEBUG("scripts", "HyjalAI - Debug mode has been toggled");
  154. break;
  155. }
  156. return true;
  157. }
  158.  
  159. bool OnGossipHello(Player* player, Creature* creature) OVERRIDE
  160. {
  161. hyjalAI* ai = CAST_AI(hyjalAI, creature->AI());
  162. if (ai->EventBegun)
  163. return false;
  164.  
  165. uint32 AnetheronEvent = ai->GetInstanceData(DATA_ANETHERONEVENT);
  166. // Only let them start the Horde phases if Anetheron is dead.
  167. if (AnetheronEvent == DONE && ai->GetInstanceData(DATA_ALLIANCE_RETREAT))
  168. {
  169. uint32 KazrogalEvent = ai->GetInstanceData(DATA_KAZROGALEVENT);
  170. uint32 AzgalorEvent = ai->GetInstanceData(DATA_AZGALOREVENT);
  171. if (KazrogalEvent == NOT_STARTED)
  172. player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, player->GetOptionTextWithEntry(15479, 2), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
  173. else if (KazrogalEvent == DONE && AzgalorEvent == NOT_STARTED)
  174. player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, player->GetOptionTextWithEntry(15479, 3), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2);
  175. else if (AzgalorEvent == DONE)
  176. player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, player->GetOptionTextWithEntry(15479, 4), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3);
  177. }
  178.  
  179. if (player->IsGameMaster())
  180. player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, GOSSIP_ITEM_GM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
  181.  
  182. player->SEND_GOSSIP_MENU(907, creature->GetGUID());
  183. return true;
  184. }
  185.  
  186. CreatureAI* GetAI(Creature* creature) const OVERRIDE
  187. {
  188. hyjalAI* ai = new hyjalAI(creature);
  189.  
  190. ai->Reset();
  191. ai->EnterEvadeMode();
  192.  
  193. ai->Spells[0].SpellId = SPELL_CHAIN_LIGHTNING;
  194. ai->Spells[0].Cooldown = urand(3000, 8000);
  195. ai->Spells[0].TargetType = TARGETTYPE_VICTIM;
  196.  
  197. ai->Spells[1].SpellId = SPELL_SUMMON_DIRE_WOLF;
  198. ai->Spells[1].Cooldown = urand(6000, 41000);
  199. ai->Spells[1].TargetType = TARGETTYPE_RANDOM;
  200.  
  201. return ai;
  202. }
  203.  
  204. };
  205.  
  206. class npc_tyrande_whisperwind : public CreatureScript
  207. {
  208. public:
  209. npc_tyrande_whisperwind() : CreatureScript("npc_tyrande_whisperwind") { }
  210.  
  211. CreatureAI* GetAI(Creature* creature) const OVERRIDE
  212. {
  213. hyjalAI* ai = new hyjalAI(creature);
  214. ai->Reset();
  215. ai->EnterEvadeMode();
  216. return ai;
  217. }
  218.  
  219. bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) OVERRIDE
  220. {
  221. player->PlayerTalkClass->ClearMenus();
  222. if (action == GOSSIP_ACTION_INFO_DEF)
  223. {
  224. ItemPosCountVec dest;
  225. uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, ITEM_TEAR_OF_GODDESS, 1);
  226. if (msg == EQUIP_ERR_OK)
  227. if (Item* item = player->StoreNewItem(dest, ITEM_TEAR_OF_GODDESS, true))
  228. player->SendNewItem(item, 1, true, false, true);
  229.  
  230. player->SEND_GOSSIP_MENU(907, creature->GetGUID());
  231. }
  232. return true;
  233. }
  234.  
  235. bool OnGossipHello(Player* player, Creature* creature) OVERRIDE
  236. {
  237. hyjalAI* ai = CAST_AI(hyjalAI, creature->AI());
  238. uint32 AzgalorEvent = ai->GetInstanceData(DATA_AZGALOREVENT);
  239.  
  240. // Only let them get item if Azgalor is dead.
  241. if (AzgalorEvent == DONE && !player->HasItemCount(ITEM_TEAR_OF_GODDESS))
  242. player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, player->GetOptionTextWithEntry(15479, 5), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
  243. player->SEND_GOSSIP_MENU(907, creature->GetGUID());
  244. return true;
  245. }
  246.  
  247. };
  248.  
  249. void AddSC_hyjal()
  250. {
  251. new npc_jaina_proudmoore();
  252. new npc_thrall();
  253. new npc_tyrande_whisperwind();
  254. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement