Advertisement
Guest User

npcs_dm_battle.cpp

a guest
Aug 4th, 2013
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 56.13 KB | None | 0 0
  1. /*******************************************************************************************
  2. * __ __ _ *
  3. * /\ \ \___ _ __ ___ ___ ___ / _| |_ *
  4. * / \/ / _ \| '_ ` _ \/ __|/ _ \| |_| __| *
  5. * / /\ / (_) | | | | | \__ \ (_) | _| |_ *
  6. * \_\ \/ \___/|_| |_| |_|___/\___/|_| \__| - www.Nomsoftware.com - *
  7. * The policy of Nomsoftware states: Releasing our software *
  8. * or any other files are protected. You cannot re-release *
  9. * anywhere unless you were given permission. *
  10. * (C) Nomsoftware 'Nomsoft' 2011-2012. All rights reserved. *
  11. ********************************************************************************************/
  12. /**********************************************************
  13. **********************************************************
  14. * Title: *
  15. * NPC Arena Battle(Dire Maul) *
  16. * *
  17. * Idea by: QQrofl *
  18. * Sub-Ideas by: Foereaper *
  19. * Scripted by: QQrofl *
  20. * Fondled by: Faded *
  21. * Mental Support by: Foereaper *
  22. * *
  23. * (C)Nomsoftware 'Nomsoft' 2012 *
  24. *##################################*/
  25. #include "npcs_dm_battle.h"
  26.  
  27. class npc_dire_arena_commander : public CreatureScript
  28. {
  29.    public:
  30. npc_dire_arena_commander() : CreatureScript("npc_dire_arena_commander") { }
  31.  
  32. bool OnGossipHello(Player * player, Creature * creature)
  33. {
  34. if(player->IsInCombat())
  35. return false;
  36.  
  37. if(isBattleActive)
  38. player->ADD_GOSSIP_ITEM(GOSSIP_ICON_BATTLE, "I'm sorry, but a battle is already active.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3);
  39. else
  40. player->ADD_GOSSIP_ITEM(GOSSIP_ICON_BATTLE, MSG_FIGHT_COMPUTER, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
  41. player->ADD_GOSSIP_ITEM(GOSSIP_ICON_DOT, "Nevermind", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2);
  42. player->PlayerTalkClass->SendGossipMenu(1, creature->GetGUID());
  43. return true;
  44. }
  45.  
  46. bool OnGossipSelect(Player * player, Creature * creature, uint32 sender, uint32 actions)
  47. {
  48. if(sender != GOSSIP_SENDER_MAIN)
  49. return false;
  50. player->PlayerTalkClass->ClearMenus();
  51. switch(actions)
  52. {
  53. case GOSSIP_ACTION_INFO_DEF+1:
  54.  
  55. m_PlayerGUID = player->GetGUID();
  56. playerName = player->GetName();
  57. isBattleActive = true;
  58. player->CastSpell(player, SPELL_TELEPORT_VISUAL);
  59. player->TeleportTo(1, -3739.533447f, 1095.419434f, 131.969559f, 3.029968f);
  60. player->PlayerTalkClass->SendCloseGossip();
  61. break;
  62.  
  63. case GOSSIP_ACTION_INFO_DEF+2:
  64. player->PlayerTalkClass->SendCloseGossip();
  65. break;
  66.  
  67. case GOSSIP_ACTION_INFO_DEF+3:
  68. player->PlayerTalkClass->SendCloseGossip();
  69. break;
  70. }
  71. return true;
  72. }
  73.  
  74. struct npc_dire_arena_commanderAI : public ScriptedAI
  75. {
  76. npc_dire_arena_commanderAI(Creature * c) : ScriptedAI(c), summons(me) { }
  77.  
  78. uint32 checkBattle;
  79. uint32 checkPlayer;
  80. bool checkIsDead;
  81. bool resetOnce;
  82.  
  83. void Reset()
  84. {
  85. events.Reset();
  86. player = NULL;
  87. summons.DespawnAll();
  88. checkIsDead = true;
  89. resetOnce = false;
  90. checkBattle = 2000;
  91. checkPlayer = 1000;
  92. }
  93.  
  94. void UpdateAI(uint32 diff)
  95. {
  96. events.Update(diff);
  97.  
  98. if(checkBattle <= diff)
  99. {
  100. if(!isBattleActive && m_PlayerGUID == 0 && !resetOnce)
  101. {
  102. events.Reset();
  103. resetOnce = true;
  104. }
  105.  
  106. if(isBattleActive && m_PlayerGUID != 0 && resetOnce)
  107. {
  108. player = Unit::GetPlayer(*me, m_PlayerGUID);
  109. events.ScheduleEvent(EVENT_CHECK_ACTIVITY, 1000);
  110. resetOnce = false;
  111. }
  112. if(resetOnce)
  113. checkBattle = 2000;
  114. }
  115. else
  116. checkBattle -= diff;
  117.  
  118. if(checkPlayer <= diff) // Checking battle as well
  119. {
  120. if(m_PlayerGUID == 0)
  121. return;
  122.  
  123. if(hasLogged || !inZone)
  124. {
  125. isBattleActive = false;
  126. summons.DespawnAll();
  127. events.Reset();
  128. isWaveBossDead = 0;
  129. checkIsDead = true;
  130. hasLogged = false;
  131. inZone = true;
  132. resetOnce = false;
  133. player = NULL;
  134. m_PlayerGUID = NULL;
  135. playerName = "";
  136. sWorld->SendGlobalText("A challenger has been scared off and left the Dire Maul Arena Challenge! Who's next?", NULL);
  137. }
  138. checkPlayer = 1000;
  139. }
  140. else
  141. checkPlayer -= diff;
  142.  
  143. if (isWaveBossDead == 1 && checkIsDead)
  144. {
  145. events.ScheduleEvent(EVENT_CHECK_WAVES, 1000);
  146. checkIsDead = false;
  147. }
  148. else if (isWaveBossDead == 2 && !checkIsDead)
  149. {
  150. events.ScheduleEvent(EVENT_CHECK_WAVES, 1000);
  151. checkIsDead = true;
  152. }
  153. else if (isWaveBossDead == 3 && checkIsDead)
  154. {
  155. events.ScheduleEvent(EVENT_CHECK_WAVES, 1000);
  156. checkIsDead = false;
  157. }
  158. else if (isWaveBossDead == 4 && !checkIsDead)
  159. {
  160. events.ScheduleEvent(EVENT_CHECK_WAVES, 1000);
  161. checkIsDead = true;
  162. }
  163. else if (isWaveBossDead == 5 && checkIsDead)
  164. {
  165. events.ScheduleEvent(EVENT_CHECK_WAVES, 1000);
  166. checkIsDead = false;
  167. }
  168. else if (isWaveBossDead == 6 && !checkIsDead)
  169. {
  170. events.ScheduleEvent(EVENT_CHECK_WAVES, 1000);
  171. checkIsDead = true;
  172. }
  173. else if (isWaveBossDead == 7 && checkIsDead)
  174. {
  175. events.ScheduleEvent(EVENT_CHECK_WAVES, 1000);
  176. checkIsDead = false;
  177. }
  178.  
  179. while(uint32 eventIds = events.ExecuteEvent())
  180. {
  181. switch(eventIds)
  182. {
  183. case EVENT_CHECK_ACTIVITY:
  184. {
  185. if(isBattleActive)
  186. {
  187. MessageOnWave(me, EVENT_CHECK_ACTIVITY);
  188. events.ScheduleEvent(EVENT_FIRST_WAVE, 10000);
  189. }
  190. else
  191. events.ScheduleEvent(EVENT_CHECK_ACTIVITY, 1000);
  192. }break;
  193.  
  194. case EVENT_CHECK_WAVES:
  195. {
  196. if(!player)
  197. return;
  198.  
  199. if(!isBattleActive)
  200. {
  201. summons.DespawnAll();
  202. checkIsDead = true;
  203. resetOnce = false;
  204. return;
  205. }
  206.  
  207. int itemCount = player->GetItemCount(ITEM_INTRAVENOUS_HEALING_POTION);
  208. if(itemCount == 0)
  209. player->AddItem(ITEM_INTRAVENOUS_HEALING_POTION, 1);
  210. if(isWaveBossDead == 1) // Red Blood Guard
  211. {
  212. MessageOnWave(me, EVENT_CHECK_WAVES);
  213. player->CastSpell(player, SPELL_TELEPORT_VISUAL);
  214. player->TeleportTo(1, -3739.533447f, 1095.419434f, 131.969559f, 3.029968f);
  215. AddEndRewards(player, 500, PVP_END_TOKEN, 1);
  216. events.ScheduleEvent(EVENT_FIRST_WAVE_TREAT, 25000);
  217. isWaveBossDead = 0;
  218. }
  219.  
  220. if (isWaveBossDead == 2) // Spawn Event
  221. {
  222. MessageOnWave(me, EVENT_CHECK_WAVES);
  223. player->CastSpell(player, SPELL_TELEPORT_VISUAL);
  224. player->TeleportTo(1, -3739.533447f, 1095.419434f, 131.969559f, 3.029968f);
  225. AddEndRewards(player, 1000, PVP_END_TOKEN, 2);
  226. events.ScheduleEvent(EVENT_FIRST_WAVE_ELITE, 35000);
  227. isWaveBossDead = 0;
  228. }
  229.  
  230. if(isWaveBossDead == 3) // Hank the Tank
  231. {
  232. MessageOnWave(me, EVENT_CHECK_WAVES);
  233. AddEndRewards(player, 2000, PVP_END_TOKEN, 5);
  234. player->CastSpell(player, SPELL_TELEPORT_VISUAL);
  235. player->TeleportTo(1, -3739.533447f, 1095.419434f, 131.969559f, 3.029968f);
  236. events.ScheduleEvent(EVENT_SECOND_WAVE, 35000);
  237. isWaveBossDead = 0;
  238. }
  239.  
  240. if(isWaveBossDead == 4) // Rogue Initiates
  241. {
  242. MessageOnWave(me, EVENT_CHECK_WAVES);
  243. AddEndRewards(player, 3000, PVP_END_TOKEN, 10);
  244. player->CastSpell(player, SPELL_TELEPORT_VISUAL);
  245. player->TeleportTo(1, -3739.533447f, 1095.419434f, 131.969559f, 3.029968f);
  246. events.ScheduleEvent(EVENT_SECOND_WAVE_TREAT, 35000);
  247. isWaveBossDead = 0;
  248. }
  249.  
  250. if(isWaveBossDead == 5) // The Unholys
  251. {
  252. MessageOnWave(me, EVENT_CHECK_WAVES);
  253. player->CastSpell(player, SPELL_TELEPORT_VISUAL);
  254. AddEndRewards(player, 4000, PVP_END_TOKEN, 20);
  255. player->TeleportTo(1, -3739.533447f, 1095.419434f, 131.969559f, 3.029968f);
  256. events.ScheduleEvent(EVENT_SECOND_WAVE_ELITE, 40000);
  257. isWaveBossDead = 0;
  258. }
  259.  
  260. if(isWaveBossDead == 6) // The Riders of the Ice
  261. {
  262. MessageOnWave(me, EVENT_CHECK_WAVES);
  263. player->CastSpell(player, SPELL_TELEPORT_VISUAL);
  264. AddEndRewards(player, 5000, PVP_END_TOKEN, 30);
  265. player->TeleportTo(1, -3739.533447f, 1095.419434f, 131.969559f, 3.029968f);
  266. events.ScheduleEvent(EVENT_FINAL_WAVE_BOSS, 35000);
  267. isWaveBossDead = 0;
  268. }
  269.  
  270. if(isWaveBossDead == 7) // Dragon Final Event
  271. {
  272. MessageOnWave(me, EVENT_CHECK_WAVES);
  273. player->CastSpell(player, SPELL_TELEPORT_VISUAL);
  274. AddEndRewards(player, 10000, PVP_END_TOKEN, 50);
  275. events.ScheduleEvent(EVENT_COMPLETED_WAVES, 5000);
  276. isWaveBossDead = 0;
  277. }
  278. }break;
  279.  
  280. case EVENT_FIRST_WAVE:
  281. sLog->outInfo(LOG_FILTER_GENERAL, "[Dire Maul Arena]: Starting First Wave...");
  282. MessageOnWave(me, EVENT_FIRST_WAVE);
  283. player->CastSpell(player, SPELL_TELEPORT_VISUAL);
  284. player->TeleportTo(1, -3739.533447f, 1095.419434f, 131.969559f, 3.029968f); // Making sure you're in the right place
  285. player->PlayDirectSound(SOUND_HORN_WAVE_START);
  286. me->SummonCreature(waveList[0], m_WaveSpawns[0].m_positionX, m_WaveSpawns[0].m_positionY, m_WaveSpawns[0].m_positionZ, m_WaveSpawns[0].m_orientation,
  287. TEMPSUMMON_MANUAL_DESPAWN, 0);
  288. break;
  289.  
  290. case EVENT_FIRST_WAVE_TREAT:
  291. MessageOnWave(me, EVENT_FIRST_WAVE_TREAT);
  292. me->SummonCreature(waveList[1], -3739.533447f, 1095.419434f, 131.969559f, 3.029968f, TEMPSUMMON_MANUAL_DESPAWN, 0);
  293. me->SummonCreature(NPC_PORTAL, m_WaveSpawns[1].m_positionX, m_WaveSpawns[1].m_positionY, m_WaveSpawns[1].m_positionZ, m_WaveSpawns[1].m_orientation,
  294. TEMPSUMMON_MANUAL_DESPAWN, 0);
  295. me->SummonCreature(NPC_PORTAL, m_WaveSpawns[2].m_positionX, m_WaveSpawns[2].m_positionY, m_WaveSpawns[2].m_positionZ, m_WaveSpawns[2].m_orientation,
  296. TEMPSUMMON_MANUAL_DESPAWN, 0);
  297. player->CastSpell(player, SPELL_TELEPORT_VISUAL);
  298. player->TeleportTo(1, -3739.533447f, 1095.419434f, 131.969559f, 3.029968f); // Making sure you're in the right place
  299. player->PlayDirectSound(SOUND_HORN_WAVE_START);
  300. break;
  301.  
  302. case EVENT_FIRST_WAVE_ELITE:
  303. MessageOnWave(me, EVENT_FIRST_WAVE_ELITE);
  304. player->PlayDirectSound(SOUND_HORN_WAVE_START);
  305. player->CastSpell(player, SPELL_TELEPORT_VISUAL);
  306. player->TeleportTo(1, -3739.533447f, 1095.419434f, 131.969559f, 3.029968f); // Making sure you're in the right place
  307. me->SummonCreature(waveList[8], m_WaveSpawns[0].m_positionX, m_WaveSpawns[0].m_positionY, m_WaveSpawns[0].m_positionZ, m_WaveSpawns[0].m_orientation,
  308. TEMPSUMMON_MANUAL_DESPAWN, 0);
  309. break;
  310.  
  311. case EVENT_SECOND_WAVE:
  312. MessageOnWave(me, EVENT_SECOND_WAVE);
  313. player->PlayDirectSound(SOUND_HORN_WAVE_START);
  314. player->CastSpell(player, SPELL_TELEPORT_VISUAL);
  315. player->TeleportTo(1, -3739.533447f, 1095.419434f, 131.969559f, 3.029968f); // Making sure you're in the right place
  316. me->SummonCreature(waveList[10], m_WaveSpawns[0].m_positionX, m_WaveSpawns[0].m_positionY, m_WaveSpawns[0].m_positionZ, m_WaveSpawns[0].m_orientation,
  317. TEMPSUMMON_MANUAL_DESPAWN, 0);
  318. break;
  319.  
  320. case EVENT_SECOND_WAVE_TREAT:
  321. MessageOnWave(me, EVENT_SECOND_WAVE_TREAT);
  322. player->PlayDirectSound(SOUND_HORN_WAVE_START);
  323. player->CastSpell(player, SPELL_TELEPORT_VISUAL);
  324. player->TeleportTo(1, -3739.533447f, 1095.419434f, 131.969559f, 3.029968f); // Making sure you're in the right place
  325. me->SummonCreature(waveList[13], m_WaveSpawns[0].m_positionX, m_WaveSpawns[0].m_positionY, m_WaveSpawns[0].m_positionZ, m_WaveSpawns[0].m_orientation,
  326. TEMPSUMMON_MANUAL_DESPAWN, 0);
  327. break;
  328.  
  329. case EVENT_SECOND_WAVE_ELITE:
  330. MessageOnWave(me, EVENT_SECOND_WAVE_ELITE);
  331. player->PlayDirectSound(SOUND_HORN_WAVE_START);
  332. player->CastSpell(player, SPELL_TELEPORT_VISUAL);
  333. player->TeleportTo(1, -3739.533447f, 1095.419434f, 131.969559f, 3.029968f); // Making sure you're in the right place
  334. me->SummonCreature(waveList[16], m_WaveSpawns[0].m_positionX, m_WaveSpawns[0].m_positionY, m_WaveSpawns[0].m_positionZ, m_WaveSpawns[0].m_orientation,
  335. TEMPSUMMON_MANUAL_DESPAWN, 0);
  336. break;
  337.  
  338. case EVENT_FINAL_WAVE_BOSS:
  339. sLog->outInfo(LOG_FILTER_GENERAL, "[Dire Maul Arena]: Starting Final Wave...");
  340. MessageOnWave(me, EVENT_FINAL_WAVE_BOSS);
  341. player->PlayDirectSound(SOUND_HORN_WAVE_START);
  342. player->CastSpell(player, SPELL_TELEPORT_VISUAL);
  343. player->TeleportTo(1, -3739.533447f, 1095.419434f, 131.969559f, 3.029968f); // Making sure you're in the right place
  344. me->SummonCreature(waveList[19], m_WaveSpawns[0].m_positionX, m_WaveSpawns[0].m_positionY, m_WaveSpawns[0].m_positionZ, m_WaveSpawns[0].m_orientation,
  345. TEMPSUMMON_MANUAL_DESPAWN, 0);
  346. break;
  347.  
  348. case EVENT_COMPLETED_WAVES:
  349. me->MonsterYell("Congratulations to our finest Gladiator that went through a lot to earn our rewards! Who will be our next challenger?",
  350. LANG_UNIVERSAL, me->GetGUID());
  351. DoSendCompleteMessage(player->GetName());
  352. player->TeleportTo(1, sTeleOut[0].m_positionX, sTeleOut[0].m_positionY, sTeleOut[0].m_positionZ, sTeleOut[0].m_orientation);
  353. isBattleActive = false;
  354. m_PlayerGUID = NULL;
  355. playerName = "";
  356. summons.DespawnAll();
  357. events.Reset();
  358. isWaveBossDead = 0;
  359. checkIsDead = true;
  360. break;
  361. }
  362. }
  363. }
  364.  
  365. void JustSummoned(Creature * summoned)
  366. {
  367. summons.Summon(summoned);
  368. }
  369. private:
  370. EventMap events;
  371. Player * player;
  372. SummonList summons;
  373. };
  374.  
  375. CreatureAI * GetAI(Creature * pCreature) const
  376. {
  377. return new npc_dire_arena_commanderAI(pCreature);
  378. }
  379. };
  380.  
  381. class npc_dire_maul_rb_guard : public CreatureScript
  382. {
  383.    public:
  384. npc_dire_maul_rb_guard() : CreatureScript("npc_dire_maul_rb_guard") { }
  385.  
  386. struct npc_dire_maul_rb_guardAI : public ScriptedAI
  387. {
  388. npc_dire_maul_rb_guardAI(Creature * c) : ScriptedAI(c), summons(me) { }
  389.  
  390. uint32 uiCharge;
  391. uint32 uiMortalStrike;
  392. uint32 uiCheckOutOfRange;
  393. bool spawnMinis;
  394.  
  395. void Reset()
  396. {
  397. spawnMinis = true;
  398. uiCharge = 2000;
  399. summons.DespawnAll();
  400. uiMortalStrike = urand(5000, 8000);
  401. me->MonsterYell("You can't defeat me!", LANG_UNIVERSAL, me->GetGUID());
  402. me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, 45233);
  403. }
  404.  
  405. void KilledUnit(Unit * who)
  406. {
  407. if(who && who->GetTypeId() != TYPEID_PLAYER)
  408. return;
  409. DoEndBattle(me, summons);
  410. }
  411.  
  412. void JustDied(Unit * killer)
  413. {
  414. if(killer && killer->GetTypeId() != TYPEID_PLAYER)
  415. return;
  416. me->PlayDirectSound(SOUND_WAVE_COMPLETE, killer->ToPlayer());
  417. isWaveBossDead = 1;
  418. summons.DespawnAll();
  419. }
  420.  
  421. void JustSummoned(Creature * summoned)
  422. {
  423. if(!UpdateVictim())
  424. {
  425. summoned->DespawnOrUnsummon(100);
  426. return;
  427. }
  428. summons.Summon(summoned);
  429. summoned->AddThreat(me->GetVictim(), 100.0f);
  430. summoned->GetMotionMaster()->MoveChase(me->GetVictim(), 100.0f);
  431. }
  432.  
  433. void UpdateAI(uint32 diff)
  434. {
  435. if(!UpdateVictim())
  436. {
  437. summons.DespawnAll();
  438. return;
  439. }
  440.  
  441. ScriptedAI::UpdateAI(diff);
  442. if(!isBattleActive)
  443. {
  444. me->DespawnOrUnsummon(1);
  445. return;
  446. }
  447.  
  448. if(uiCharge <= diff)
  449. {
  450. me->CastSpell(me->GetVictim(), SPELL_BERSERKER_CHARGE);
  451. uiCharge = 12000;
  452. }
  453. else
  454. uiCharge -= diff;
  455.  
  456. if(uiMortalStrike <= diff)
  457. {
  458. me->CastSpell(me->GetVictim(), SPELL_MORTAL_STRIKE);
  459. me->CastSpell(me->GetVictim(), SPELL_DEEP_WOUNDS); // Cast deep wounds after Mortal strike
  460. uiMortalStrike = urand(5000, 120000);
  461. }
  462. else
  463. uiMortalStrike -= diff;
  464.  
  465. if(me->GetHealthPct() <= 45 && spawnMinis)
  466. {
  467. me->MonsterYell("Minions, come to my aid!", LANG_UNIVERSAL, me->GetGUID());
  468. me->SummonCreature(NPC_RED_BLOOD_GUARD_MINI, me->GetPositionX(), me->GetPositionY()+1, me->GetPositionZ(), me->GetOrientation(), TEMPSUMMON_MANUAL_DESPAWN, 0);
  469. me->SummonCreature(NPC_RED_BLOOD_GUARD_MINI2, me->GetPositionX()+2, me->GetPositionY()+1, me->GetPositionZ(), me->GetOrientation(), TEMPSUMMON_MANUAL_DESPAWN, 0);
  470. me->SummonCreature(NPC_RED_BLOOD_GUARD_MINI3, me->GetPositionX()+2, me->GetPositionY()+1, me->GetPositionZ(), me->GetOrientation(), TEMPSUMMON_MANUAL_DESPAWN, 0);
  471. spawnMinis = false;
  472. }
  473. DoMeleeAttackIfReady();
  474. }
  475. private:
  476. SummonList summons;
  477. };
  478.  
  479. CreatureAI * GetAI(Creature * pCreature) const
  480. {
  481. return new npc_dire_maul_rb_guardAI(pCreature);
  482. }
  483. };
  484.  
  485. class npc_red_blood_mini : public CreatureScript
  486. {
  487.    public:
  488. npc_red_blood_mini() : CreatureScript("npc_red_blood_mini") { }
  489.  
  490. struct npc_red_blood_miniAI : public ScriptedAI
  491. {
  492. npc_red_blood_miniAI(Creature * c) : ScriptedAI(c) { me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, 45233); }
  493.  
  494. void KilledUnit(Unit * who)
  495. {
  496. if(who && who->GetTypeId() != TYPEID_PLAYER)
  497. return;
  498. DoEndBattle(me);
  499. }
  500. };
  501.  
  502. CreatureAI * GetAI(Creature * pCreature) const
  503. {
  504. return new npc_red_blood_miniAI(pCreature);
  505. }
  506. };
  507.  
  508. class npc_dm_wave_trigger : public CreatureScript
  509. {
  510.    public:
  511. npc_dm_wave_trigger() : CreatureScript("npc_dm_wave_trigger") { }
  512.  
  513. struct npc_dm_wave_triggerAI : public ScriptedAI
  514. {
  515. npc_dm_wave_triggerAI(Creature * c) : ScriptedAI(c), summons(me) { }
  516.  
  517. uint32 startSpawnWave;
  518. int spawnPhase;
  519.  
  520. void Reset()
  521. {
  522. startSpawnWave = 1000;
  523. spawnPhase = 0;
  524. }
  525.  
  526. void UpdateAI(uint32 diff)
  527. {
  528. if(!isBattleActive)
  529. {
  530. summons.DespawnAll();
  531. me->DespawnOrUnsummon(1);
  532. return;
  533. }
  534.  
  535. if(startSpawnWave <= diff)
  536. {
  537. switch(spawnPhase)
  538. {
  539. case 0:
  540. {
  541. spawnPhase = 1;
  542. DoPortalSpawns();
  543. startSpawnWave = 13000;
  544. }break;
  545.  
  546. case 1:
  547. {
  548. spawnPhase = 2;
  549. DoPortalSpawns();
  550. startSpawnWave = 13000;
  551. }break;
  552.  
  553. case 2:
  554. {
  555. spawnPhase = 3;
  556. DoPortalSpawns();
  557. startSpawnWave = 13000;
  558. }break;
  559.  
  560. case 3:
  561. {
  562. spawnPhase = 4;
  563. for(int i = 0; i < 2; i++)
  564. DoPortalSpawns();
  565. startSpawnWave = 25000;
  566. }break;
  567.  
  568. case 4:
  569. {
  570. spawnPhase = 5;
  571. for(int i = 0; i < 2; i++)
  572. DoPortalSpawns();
  573. startSpawnWave = 25000;
  574. }break;
  575.  
  576. case 5:
  577. {
  578. spawnPhase = 6;
  579. for(int i = 0; i < 4; i++)
  580. DoPortalSpawns();
  581. startSpawnWave = 36000;
  582. }break;
  583.  
  584. case 6:
  585. {
  586. spawnPhase = 7;
  587. for(int i = 0; i < 4; i++)
  588. DoPortalSpawns();
  589. startSpawnWave = 36000;
  590. }break;
  591.  
  592. case 7:
  593. {
  594. spawnPhase = 8;
  595. DoPortalSpawns();
  596. startSpawnWave = 10000;
  597. }break;
  598.  
  599. case 8:
  600. {
  601. spawnPhase = 9;
  602. DoPortalSpawns();
  603. startSpawnWave = 10000;
  604. }break;
  605.  
  606. case 9:
  607. {
  608. spawnPhase = 10;
  609. DoPortalSpawns();
  610. startSpawnWave = 15000;
  611. }break;
  612.  
  613. case 10:
  614. {
  615. spawnPhase = 11;
  616. for(int i = 0; i < 4; i++)
  617. DoPortalSpawns();
  618. startSpawnWave = 60000;
  619. }break;
  620.  
  621. case 11:
  622. {
  623. if(Player * player = Unit::GetPlayer(*me, m_PlayerGUID))
  624. {
  625. if(!player)
  626. return;
  627. me->PlayDirectSound(SOUND_WAVE_COMPLETE, player);
  628. }
  629. isWaveBossDead = 2;
  630. summons.DespawnAll();
  631. spawnPhase = 0;
  632. me->DespawnOrUnsummon(1);
  633. }break;
  634. }
  635. }
  636. else
  637. startSpawnWave -= diff;
  638. }
  639.  
  640. void JustSummoned(Creature * summoned)
  641. {
  642. summons.Summon(summoned);
  643. if(Player * player = Unit::GetPlayer(*me, m_PlayerGUID))
  644. {
  645. if(!player)
  646. return;
  647. summoned->SetInCombatWith(player);
  648. summoned->AI()->AttackStart(player);
  649. summoned->GetMotionMaster()->MoveChase(player, 500.0f);
  650. }
  651. }
  652.  
  653. void DoPortalSpawns() // Spawns Random Npcs
  654. {
  655. int random = urand(0, 4);
  656. switch(random)
  657. {
  658. case 0:
  659. me->SummonCreature(waveList[2], m_WaveSpawns[1].m_positionX, m_WaveSpawns[1].m_positionY, m_WaveSpawns[1].m_positionZ, m_WaveSpawns[1].m_orientation,
  660. TEMPSUMMON_MANUAL_DESPAWN, 0);
  661. break;
  662.  
  663. case 1:
  664. me->SummonCreature(waveList[3], m_WaveSpawns[1].m_positionX, m_WaveSpawns[1].m_positionY, m_WaveSpawns[1].m_positionZ, m_WaveSpawns[1].m_orientation,
  665. TEMPSUMMON_MANUAL_DESPAWN, 0);
  666. break;
  667.  
  668. case 2:
  669. me->SummonCreature(waveList[4], m_WaveSpawns[1].m_positionX, m_WaveSpawns[1].m_positionY, m_WaveSpawns[1].m_positionZ, m_WaveSpawns[1].m_orientation,
  670. TEMPSUMMON_MANUAL_DESPAWN, 0);
  671. break;
  672.  
  673. case 3:
  674. me->SummonCreature(waveList[5], m_WaveSpawns[1].m_positionX, m_WaveSpawns[1].m_positionY, m_WaveSpawns[1].m_positionZ, m_WaveSpawns[1].m_orientation,
  675. TEMPSUMMON_MANUAL_DESPAWN, 0);
  676. break;
  677.  
  678. case 4:
  679. me->SummonCreature(waveList[6], m_WaveSpawns[1].m_positionX, m_WaveSpawns[1].m_positionY, m_WaveSpawns[1].m_positionZ, m_WaveSpawns[1].m_orientation,
  680. TEMPSUMMON_MANUAL_DESPAWN, 0);
  681. break;
  682. }
  683. int random2 = urand(0, 4);
  684. switch(random2)
  685. {
  686. case 0:
  687. me->SummonCreature(waveList[2], m_WaveSpawns[2].m_positionX, m_WaveSpawns[2].m_positionY, m_WaveSpawns[2].m_positionZ, m_WaveSpawns[2].m_orientation,
  688. TEMPSUMMON_MANUAL_DESPAWN, 0);
  689. break;
  690.  
  691. case 1:
  692. me->SummonCreature(waveList[3], m_WaveSpawns[2].m_positionX, m_WaveSpawns[2].m_positionY, m_WaveSpawns[2].m_positionZ, m_WaveSpawns[2].m_orientation,
  693. TEMPSUMMON_MANUAL_DESPAWN, 0);
  694. break;
  695.  
  696. case 2:
  697. me->SummonCreature(waveList[4], m_WaveSpawns[2].m_positionX, m_WaveSpawns[2].m_positionY, m_WaveSpawns[2].m_positionZ, m_WaveSpawns[2].m_orientation,
  698. TEMPSUMMON_MANUAL_DESPAWN, 0);
  699. break;
  700.  
  701. case 3:
  702. me->SummonCreature(waveList[5], m_WaveSpawns[2].m_positionX, m_WaveSpawns[2].m_positionY, m_WaveSpawns[2].m_positionZ, m_WaveSpawns[2].m_orientation,
  703. TEMPSUMMON_MANUAL_DESPAWN, 0);
  704. break;
  705.  
  706. case 4:
  707. me->SummonCreature(waveList[6], m_WaveSpawns[2].m_positionX, m_WaveSpawns[2].m_positionY, m_WaveSpawns[2].m_positionZ, m_WaveSpawns[2].m_orientation,
  708. TEMPSUMMON_MANUAL_DESPAWN, 0);
  709. break;
  710. }
  711. }
  712. private:
  713. SummonList summons;
  714. };
  715.  
  716. CreatureAI * GetAI(Creature * pCreature) const
  717. {
  718. return new npc_dm_wave_triggerAI(pCreature);
  719. }
  720. };
  721.  
  722. class npc_dm_wave_spawns : public CreatureScript
  723. {
  724.    public:
  725. npc_dm_wave_spawns() : CreatureScript("npc_dm_wave_spawns") { }
  726.  
  727. struct npc_dm_wave_spawnsAI : public ScriptedAI
  728. {
  729. npc_dm_wave_spawnsAI(Creature * c) : ScriptedAI(c) { }
  730.  
  731. void KilledUnit(Unit * who)
  732. {
  733. if(who && who->GetTypeId() != TYPEID_PLAYER)
  734. return;
  735. DoEndBattle(me);
  736. }
  737.  
  738. void UpdateAI(uint32 diff)
  739. {
  740. if(!isBattleActive)
  741. me->DespawnOrUnsummon(1);
  742.  
  743. if(isWaveBossDead == 2)
  744. me->DespawnOrUnsummon(1);
  745.  
  746. if(!UpdateVictim())
  747. return;
  748.  
  749. DoMeleeAttackIfReady();
  750. }
  751. };
  752.  
  753. CreatureAI * GetAI(Creature * pCreature) const
  754. {
  755. return new npc_dm_wave_spawnsAI(pCreature);
  756. }
  757. };
  758.  
  759. class npc_dm_wave_portals : public CreatureScript
  760. {
  761.    public:
  762. npc_dm_wave_portals() : CreatureScript("npc_dm_wave_portals") { }
  763.  
  764. struct npc_dm_wave_portalsAI : public ScriptedAI
  765. {
  766. npc_dm_wave_portalsAI(Creature * c) : ScriptedAI(c) { }
  767.  
  768. void UpdateAI(uint32 diff)
  769. {
  770. if(!isBattleActive)
  771. me->DespawnOrUnsummon(1);
  772.  
  773. if(isWaveBossDead == 2)
  774. me->DespawnOrUnsummon(1);
  775. }
  776. };
  777.  
  778. CreatureAI * GetAI(Creature * pCreature) const
  779. {
  780. return new npc_dm_wave_portalsAI(pCreature);
  781. }
  782. };
  783.  
  784. uint32 hankAuras[] = { SPELL_BATTLE_STANCE, SPELL_INCREASE_BLOCK_VALUE, SPELL_INCREASE_DEFENSE_RATING, SPELL_INCREASE_DODGE_RATING };
  785. class npc_dm_hank_the_tank : public CreatureScript
  786. {
  787.    public:
  788. npc_dm_hank_the_tank() : CreatureScript("npc_dm_hank_the_tank") { }
  789.  
  790. struct npc_dm_hank_the_tankAI : public ScriptedAI
  791. {
  792. npc_dm_hank_the_tankAI(Creature * c) : ScriptedAI(c), summons(me) { }
  793.  
  794. uint32 shoutBuff;
  795. uint32 groundStomp;
  796. uint32 uiExecute;
  797. uint32 tankStrike;
  798. uint32 uiRend;
  799. uint32 shieldBlock;
  800. uint32 shieldBash;
  801.  
  802. void Reset()
  803. {
  804. me->MonsterYell("You will succumb to death, young scums!", LANG_UNIVERSAL, me->GetGUID());
  805. summons.DespawnAll();
  806. me->SummonCreature(waveList[9], me->GetPositionX(), me->GetPositionY()+3, me->GetPositionZ(), me->GetOrientation(), TEMPSUMMON_MANUAL_DESPAWN, 0);
  807. shoutBuff = 1000;
  808. groundStomp = 6000;
  809. shieldBash = urand(9000, 13000);
  810. uiExecute = urand(21000, 26000);
  811. shieldBlock = 18000;
  812. tankStrike = urand(4000, 8000);
  813. uiRend = 11000;
  814. me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID+0, 51516);
  815. me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID+1, 51533);
  816. for(int i = 0; i < 4; i++)
  817. me->AddAura(hankAuras[i], me);
  818. }
  819.  
  820. void EnterCombat(Unit * who)
  821. {
  822. if(who && who->GetTypeId() != TYPEID_PLAYER)
  823. return;
  824. DoCast(who, SPELL_TANK_CHARGE);
  825. }
  826.  
  827. void JustDied(Unit * killer)
  828. {
  829. if(killer && killer->GetTypeId() != TYPEID_PLAYER)
  830. return;
  831. me->PlayDirectSound(SOUND_WAVE_COMPLETE, killer->ToPlayer());
  832. summons.DespawnAll();
  833. isWaveBossDead = 3;
  834. }
  835.  
  836. void KilledUnit(Unit * who)
  837. {
  838. if(who && who->GetTypeId() != TYPEID_PLAYER)
  839. return;
  840. DoEndBattle(me, summons);
  841. }
  842.  
  843. void JustSummoned(Creature * summoned)
  844. {
  845. summons.Summon(summoned);
  846. }
  847.  
  848. void UpdateAI(uint32 diff)
  849. {
  850. if(!UpdateVictim())
  851. return;
  852.  
  853. if(!isBattleActive)
  854. {
  855. summons.DespawnAll();
  856. me->DespawnOrUnsummon(1);
  857. return;
  858. }
  859.  
  860. if(shoutBuff <= diff)
  861. {
  862. me->AddAura(SPELL_SHOUT_BUFF, me);
  863. shoutBuff = 120000; // 2 minutes
  864. }
  865. else
  866. shoutBuff -= diff;
  867.  
  868. if(groundStomp <= diff)
  869. {
  870. DoCast(me->GetVictim(), SPELL_GROUND_STOMP, true);
  871. groundStomp = 6000;
  872. }
  873. else
  874. groundStomp -= diff;
  875.  
  876. if(uiExecute <= diff)
  877. {
  878. if(me->GetVictim()->GetHealthPct() <= 20)
  879. DoCast(me->GetVictim(), SPELL_EXECUTE);
  880. uiExecute = urand(21000, 26000);
  881. }
  882. else
  883. uiExecute -= diff;
  884.  
  885. if(shieldBlock <= diff)
  886. {
  887. DoCast(me, SPELL_SHIELD_BLOCK); // Cast on self
  888. shieldBlock = 18000;
  889. }
  890. else
  891. shieldBlock -= diff;
  892.  
  893. if(tankStrike <= diff)
  894. {
  895. DoCast(me->GetVictim(), SPELL_TANK_STRIKE);
  896. tankStrike = urand(4000, 8000);
  897. }
  898. else
  899. tankStrike -= diff;
  900.  
  901. if(uiRend <= diff)
  902. {
  903. DoCast(me->GetVictim(), SPELL_REND, true);
  904. uiRend = 15000;
  905. }
  906. else
  907. uiRend -= diff;
  908. DoMeleeAttackIfReady();
  909. }
  910. private:
  911. SummonList summons;
  912. };
  913.  
  914. CreatureAI * GetAI(Creature * pCreature) const
  915. {
  916. return new npc_dm_hank_the_tankAI(pCreature);
  917. }
  918. };
  919.  
  920. class npc_dm_field_medic : public CreatureScript
  921. {
  922.    public:
  923. npc_dm_field_medic() : CreatureScript("npc_dm_field_medic") { }
  924.  
  925. struct npc_dm_field_medicAI : public ScriptedAI
  926. {
  927. npc_dm_field_medicAI(Creature * c) : ScriptedAI(c) { }
  928.  
  929. uint32 uiRegrowthTimer;
  930. uint32 uiHealingTouchTimer;
  931. uint32 uiHealRejuvTimer;
  932. uint32 uiFlashHealTimer;
  933. uint32 uiPowerShieldTimer;
  934. uint32 uiLifebloomTimer;
  935. int casted;
  936. bool showOnce;
  937. bool canHealMaster;
  938.  
  939. void Reset()
  940. {
  941. uiRegrowthTimer = urand(11000, 13000);
  942. uiHealingTouchTimer = urand(6000, 8000);
  943. uiHealRejuvTimer = 15000;
  944. uiFlashHealTimer = urand(14000, 17000);
  945. uiPowerShieldTimer = 1000;
  946. uiLifebloomTimer = 2000;
  947. canHealMaster = true;
  948. showOnce = false;
  949. int casted = 0;
  950. me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID+0, 51404);
  951. me->AddAura(SPELL_HEAL_AURA_HOTS, me);
  952. hank = NULL;
  953. hank = me->FindNearestCreature(NPC_HANK_THE_TANK, 50.0f, true);
  954. }
  955.  
  956. void UpdateAI(uint32 diff)
  957. {
  958. if(!hank)
  959. return;
  960.  
  961. if(hank && hank->isDead() && !showOnce)
  962. {
  963. me->MonsterYell("Master Dead?!!! I give up!...", LANG_UNIVERSAL, me->GetGUID());
  964. me->setFaction(35);
  965. me->DespawnOrUnsummon(1);
  966. showOnce = true;
  967. return;
  968. }
  969.  
  970. if(hank && !hank->IsInCombat())
  971. return;
  972.  
  973. if(hank && hank->GetHealthPct() >= 100)
  974. canHealMaster = false;
  975. else
  976. canHealMaster = true;
  977.  
  978. if(uiRegrowthTimer <= diff)
  979. {
  980. if(canHealMaster)
  981. DoCast(hank, SPELL_HEAL_REGROWTH, true);
  982. if(me->GetHealthPct() <= 70)
  983. DoCast(me, SPELL_HEAL_REGROWTH, true);
  984. uiRegrowthTimer = urand(10000, 16000);
  985. }
  986. else
  987. uiRegrowthTimer -= diff;
  988.  
  989. if(uiHealingTouchTimer <= diff)
  990. {
  991. if(hank->GetHealthPct() <= 45 && canHealMaster)
  992. DoCast(hank, SPELL_HEAL_NORMAL, true);
  993. if(me->GetHealthPct() <= 30)
  994. DoCast(me, SPELL_HEAL_NORMAL, true);
  995. uiHealingTouchTimer = urand(6000, 8000);
  996. }
  997. else
  998. uiHealingTouchTimer -= diff;
  999.  
  1000. if(uiHealRejuvTimer <= diff)
  1001. {
  1002. if(canHealMaster)
  1003. DoCast(hank, SPELL_HEAL_REJUV, true);
  1004. if(me->GetHealthPct() <= 90)
  1005. DoCast(me, SPELL_HEAL_REJUV, true);
  1006. uiHealRejuvTimer = 15000;
  1007. }
  1008. else
  1009. uiHealRejuvTimer -= diff;
  1010.  
  1011. if(uiFlashHealTimer <= diff)
  1012. {
  1013. if(canHealMaster)
  1014. DoCast(hank, SPELL_FLASH_HEAL, true);
  1015. if(me->GetHealthPct() <= 55)
  1016. DoCast(me, SPELL_FLASH_HEAL, true);
  1017. uiFlashHealTimer = urand(14000, 17000);
  1018. }
  1019. else
  1020. uiFlashHealTimer -= diff;
  1021.  
  1022. if(uiPowerShieldTimer <= diff)
  1023. {
  1024. DoCast(me, SPELL_POWER_WORD_SHIELD);
  1025. uiPowerShieldTimer = 30000;
  1026. }
  1027. else
  1028. uiPowerShieldTimer -= diff;
  1029.  
  1030. if(uiLifebloomTimer <= diff)
  1031. {
  1032. if(canHealMaster)
  1033. {
  1034. DoCast(hank, SPELL_HEAL_LIFEBLOOM, true); // Stacking
  1035. casted++; // Increment the value
  1036. if(casted != 3)
  1037. uiLifebloomTimer = 2000;
  1038. else // Prevents further stacking of this spell
  1039. {
  1040. uiLifebloomTimer = 26000;
  1041. casted = 0;
  1042. }
  1043. }
  1044. }
  1045. else
  1046. uiLifebloomTimer -= diff;
  1047. }
  1048. private:
  1049. Creature * hank;
  1050. };
  1051.  
  1052. CreatureAI * GetAI(Creature * pCreature) const
  1053. {
  1054. return new npc_dm_field_medicAI(pCreature);
  1055. }
  1056. };
  1057.  
  1058. class npc_dm_main_rogue : public CreatureScript
  1059. {
  1060.    public:
  1061. npc_dm_main_rogue() : CreatureScript("npc_dm_main_rogue") { }
  1062.  
  1063. struct npc_dm_main_rogueAI : public ScriptedAI
  1064. {
  1065. npc_dm_main_rogueAI(Creature * c) : ScriptedAI(c), summons(me) { }
  1066.  
  1067. uint32 uiVanishTimer;
  1068. uint32 uiCheapShotTimer;
  1069. uint32 uiStrikeTimer;
  1070. uint32 uiFinisherTimer;
  1071. uint32 uiKickTimer;
  1072. uint32 uiWaitTimer;
  1073. uint32 uiRuptureTimer;
  1074. int comboPoints;
  1075. bool InStealth;
  1076. bool InVanish;
  1077.  
  1078. void Reset()
  1079. {
  1080. me->MonsterYell("We'll teach you a valued lesson.", LANG_UNIVERSAL, me->GetGUID());
  1081. InStealth = true;
  1082. InVanish = false;
  1083. comboPoints = 0;
  1084. uiFinisherTimer = 4000;
  1085. uiStrikeTimer = 6000;
  1086. uiRuptureTimer = 9000;
  1087. uiKickTimer = 10000;
  1088. uiVanishTimer = 17000;
  1089. DoCast(me, SPELL_ROGUE_STEALTH);
  1090. me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID+0, 51517);
  1091. me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID+1, 51441);
  1092. summons.DespawnAll();
  1093. me->SummonCreature(waveList[11], m_WaveSpawns[0].m_positionX, m_WaveSpawns[0].m_positionY+3, m_WaveSpawns[0].m_positionZ, m_WaveSpawns[0].m_orientation, TEMPSUMMON_MANUAL_DESPAWN, 0);
  1094. me->SummonCreature(waveList[12], m_WaveSpawns[0].m_positionX, m_WaveSpawns[0].m_positionY-3, m_WaveSpawns[0].m_positionZ, m_WaveSpawns[0].m_orientation, TEMPSUMMON_MANUAL_DESPAWN, 0);
  1095. }
  1096.  
  1097. void JustDied(Unit * killer)
  1098. {
  1099. if(killer && killer->GetTypeId() != TYPEID_PLAYER)
  1100. return;
  1101. me->PlayDirectSound(SOUND_WAVE_COMPLETE, killer->ToPlayer());
  1102. summons.DespawnAll();
  1103. isWaveBossDead = 4;
  1104. }
  1105.  
  1106. void KilledUnit(Unit * who)
  1107. {
  1108. if(who && who->GetTypeId() != TYPEID_PLAYER)
  1109. return;
  1110. DoEndBattle(me, summons);
  1111. }
  1112.  
  1113. void JustSummoned(Creature * summoned)
  1114. {
  1115. summons.Summon(summoned);
  1116. }
  1117.  
  1118. void UpdateAI(uint32 diff)
  1119. {
  1120. if(!UpdateVictim())
  1121. return;
  1122.  
  1123. if(!isBattleActive)
  1124. {
  1125. summons.DespawnAll();
  1126. me->DespawnOrUnsummon(1);
  1127. return;
  1128. }
  1129.  
  1130. if(InStealth)
  1131. {
  1132. me->CastSpell(me->GetVictim(), SPELL_ROGUE_CHEAP_SHOT, true);
  1133. InStealth = false;
  1134. }
  1135.  
  1136. if(uiStrikeTimer <= diff)
  1137. {
  1138. if(!InVanish)
  1139. {
  1140. DoCast(me->GetVictim(), SPELL_ROGUE_STRIKE);
  1141. comboPoints++;
  1142. }
  1143. uiStrikeTimer = 6000;
  1144. }
  1145. else
  1146. uiStrikeTimer -= diff;
  1147.  
  1148. if(uiFinisherTimer <= diff)
  1149. {
  1150. if(!InVanish && comboPoints >= 2)
  1151. {
  1152. me->CastSpell(me->GetVictim(), SPELL_ROGUE_FINISHER);
  1153. comboPoints = 0;
  1154. }
  1155. uiFinisherTimer = 4000;
  1156. }
  1157. else
  1158. uiFinisherTimer -= diff;
  1159.  
  1160. if(uiKickTimer <= diff)
  1161. {
  1162. if(!InVanish)
  1163. DoCast(me->GetVictim(), SPELL_ROGUE_KICK);
  1164. uiKickTimer = 10000;
  1165. }
  1166. else
  1167. uiKickTimer -= diff;
  1168.  
  1169. if(uiVanishTimer <= diff)
  1170. {
  1171. DoCast(me, SPELL_ROGUE_VANISH);
  1172. InVanish = true;
  1173. uiVanishTimer = 20000;
  1174. uiWaitTimer = 6000;
  1175. }
  1176. else
  1177. uiVanishTimer -= diff;
  1178.  
  1179. if(uiRuptureTimer <= diff)
  1180. {
  1181. if(!InVanish)
  1182. DoCast(me->GetVictim(), SPELL_ROGUE_RUPTURE, true);
  1183. uiRuptureTimer = 9000;
  1184. }
  1185. else
  1186. uiRuptureTimer -= diff;
  1187.  
  1188. if(InVanish)
  1189. {
  1190. if(uiWaitTimer <= diff)
  1191. {
  1192. me->CastSpell(me->GetVictim(), SPELL_ROGUE_CHEAP_SHOT, true);
  1193. me->MonsterYell("Attack!", LANG_UNIVERSAL, me->GetGUID());
  1194. InVanish = false;
  1195. }
  1196. else
  1197. uiWaitTimer -= diff;
  1198. }
  1199. if(!InVanish)
  1200. DoMeleeAttackIfReady();
  1201. }
  1202. private:
  1203. SummonList summons;
  1204. };
  1205.  
  1206. CreatureAI * GetAI(Creature * pCreature) const
  1207. {
  1208. return new npc_dm_main_rogueAI(pCreature);
  1209. }
  1210. };
  1211.  
  1212. class npc_dm_rogue_initiate : public CreatureScript
  1213. {
  1214.    public:
  1215. npc_dm_rogue_initiate() : CreatureScript("npc_dm_rogue_initiate") { }
  1216.  
  1217. struct npc_dm_rogue_initiateAI : public ScriptedAI
  1218. {
  1219. npc_dm_rogue_initiateAI(Creature * c) : ScriptedAI(c) { }
  1220.  
  1221. uint32 uiVanishTimer;
  1222. uint32 uiCheapShotTimer;
  1223. uint32 uiStrikeTimer;
  1224. uint32 uiFinisherTimer;
  1225. uint32 uiKickTimer;
  1226. uint32 uiWaitTimer;
  1227. uint32 uiKidneyShotTimer;
  1228. int comboPoints;
  1229. bool InVanish;
  1230. bool InStealth;
  1231.  
  1232. void Reset()
  1233. {
  1234. InVanish = false;
  1235. InStealth = true;
  1236. comboPoints = 0;
  1237. uiFinisherTimer = 4000;
  1238. uiStrikeTimer = 6000;
  1239. uiKickTimer = 10000;
  1240. uiKidneyShotTimer = 14000;
  1241. uiVanishTimer = 17000; 
  1242. DoCast(me, SPELL_ROGUE_STEALTH);
  1243. me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID+0, 51517);
  1244. me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID+1, 51441);
  1245. }
  1246.  
  1247. void KilledUnit(Unit * who)
  1248. {
  1249. if(who && who->GetTypeId() != TYPEID_PLAYER)
  1250. return;
  1251. DoEndBattle(me);
  1252. }
  1253.  
  1254. void UpdateAI(uint32 diff)
  1255. {
  1256. if(!UpdateVictim())
  1257. return;
  1258.  
  1259. if(InStealth)
  1260. {
  1261. DoCast(me->GetVictim(), SPELL_ROGUE_BACKSTAB);
  1262. InStealth = false;
  1263. }
  1264.  
  1265. if(uiStrikeTimer <= diff)
  1266. {
  1267. if(!InVanish)
  1268. {
  1269. DoCast(me->GetVictim(), SPELL_ROGUE_STRIKE);
  1270. comboPoints++;
  1271. }
  1272. uiStrikeTimer = 6000;
  1273. }
  1274. else
  1275. uiStrikeTimer -= diff;
  1276.  
  1277. if(uiFinisherTimer <= diff)
  1278. {
  1279. if(!InVanish && comboPoints >= 2)
  1280. {
  1281. me->CastSpell(me->GetVictim(), SPELL_ROGUE_FINISHER);
  1282. comboPoints = 0;
  1283. }
  1284. uiFinisherTimer = 4000;
  1285. }
  1286. else
  1287. uiFinisherTimer -= diff;
  1288.  
  1289. if(uiKickTimer <= diff)
  1290. {
  1291. if(!InVanish)
  1292. DoCast(me->GetVictim(), SPELL_ROGUE_KICK);
  1293. uiKickTimer = 10000;
  1294. }
  1295. else
  1296. uiKickTimer -= diff;
  1297.  
  1298. if(uiKidneyShotTimer <= diff)
  1299. {
  1300. if(!InVanish)
  1301. DoCast(me->GetVictim(), SPELL_ROGUE_KIDNEY_SHOT);
  1302. uiKidneyShotTimer = 12000;
  1303. }
  1304. else
  1305. uiKidneyShotTimer -= diff;
  1306.  
  1307. if(uiVanishTimer <= diff)
  1308. {
  1309. DoCast(me, SPELL_ROGUE_VANISH);
  1310. InVanish = true;
  1311. uiVanishTimer = 20000;
  1312. uiWaitTimer = 6000;
  1313. }
  1314. else
  1315. uiVanishTimer -= diff;
  1316.  
  1317. if(InVanish)
  1318. {
  1319. if(uiWaitTimer <= diff)
  1320. {
  1321. DoCast(me->GetVictim(), SPELL_ROGUE_BACKSTAB);
  1322. InVanish = false;
  1323. }
  1324. else
  1325. uiWaitTimer -= diff;
  1326. }
  1327. if(!InVanish)
  1328. DoMeleeAttackIfReady();
  1329. }
  1330. };
  1331.  
  1332. CreatureAI * GetAI(Creature * pCreature) const
  1333. {
  1334. return new npc_dm_rogue_initiateAI(pCreature);
  1335. }
  1336. };
  1337.  
  1338. class npc_dm_main_unholy : public CreatureScript
  1339. {
  1340.    public:
  1341. npc_dm_main_unholy() : CreatureScript("npc_dm_main_unholy") { }
  1342.  
  1343. struct npc_dm_main_unholyAI : public ScriptedAI
  1344. {
  1345. npc_dm_main_unholyAI(Creature * c) : ScriptedAI(c), summons(me) { }
  1346.  
  1347. uint32 uiCinematic;
  1348. uint32 uiAoeTimer;
  1349. uint32 uiPlagueStrikeTimer;
  1350. uint32 uiStangulateTimer;
  1351. uint32 uiDeathStrikeTimer;
  1352. uint32 uiArmyOfTheDeadTimer;
  1353. int cinematicPassed;
  1354. bool checkGuin;
  1355. bool boneArmor;
  1356.  
  1357. void Reset()
  1358. {
  1359. me->MonsterSay("What is this? A trap?", LANG_UNIVERSAL, me->GetGUID());
  1360. uiCinematic = 9000;
  1361. cinematicPassed = 0;
  1362. checkGuin = true;
  1363. boneArmor = true;
  1364. me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_1 | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE);
  1365. me->SetReactState(REACT_PASSIVE);
  1366. me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID+0, 51393);
  1367. summons.DespawnAll();
  1368. twin = me->SummonCreature(waveList[14], m_WaveSpawns[0].m_positionX, m_WaveSpawns[0].m_positionY+3, m_WaveSpawns[0].m_positionZ, m_WaveSpawns[0].m_orientation, TEMPSUMMON_MANUAL_DESPAWN, 0);
  1369. guin = me->SummonCreature(waveList[15], m_WaveSpawns[0].m_positionX, m_WaveSpawns[0].m_positionY-3, m_WaveSpawns[0].m_positionZ, m_WaveSpawns[0].m_orientation, TEMPSUMMON_MANUAL_DESPAWN, 0);
  1370. }
  1371.  
  1372. void KilledUnit(Unit * who)
  1373. {
  1374. if(who && who->GetTypeId() != TYPEID_PLAYER)
  1375. return;
  1376. DoEndBattle(me, summons);
  1377. twin = NULL;
  1378. guin = NULL;
  1379. }
  1380.  
  1381. void JustDied(Unit * killer)
  1382. {
  1383. if(killer && killer->GetTypeId() != TYPEID_PLAYER)
  1384. return;
  1385. me->PlayDirectSound(SOUND_WAVE_COMPLETE, killer->ToPlayer());
  1386. summons.DespawnAll();
  1387. twin = NULL;
  1388. guin = NULL;
  1389. isWaveBossDead = 5;
  1390. }
  1391.  
  1392. void UpdateAI(uint32 diff)
  1393. {
  1394. if(!isBattleActive)
  1395. {
  1396. summons.DespawnAll();
  1397. twin = NULL;
  1398. guin = NULL;
  1399. me->DespawnOrUnsummon(1);
  1400. return;
  1401. }
  1402.  
  1403. if(uiCinematic <= diff)
  1404. {
  1405. switch(cinematicPassed)
  1406. {
  1407. case 0:
  1408. me->MonsterSay("Ahh, so this thing wants to fight, huh?", LANG_UNIVERSAL, me->GetGUID());
  1409. cinematicPassed = 1;
  1410. uiCinematic = 10000;
  1411. break;
  1412.  
  1413. case 1:
  1414. me->MonsterSay("Don't be a fool!", LANG_UNIVERSAL, me->GetGUID());
  1415. cinematicPassed = 2;
  1416. uiCinematic = 9000;
  1417. break;
  1418.  
  1419. case 2:
  1420. me->MonsterSay("Twin, no! Let him go. We can just watch, for now....", LANG_UNIVERSAL, me->GetGUID());
  1421. cinematicPassed = 3;
  1422. break;
  1423. }
  1424. }
  1425. else
  1426. uiCinematic -= diff;
  1427.  
  1428. if(checkGuin)
  1429. {
  1430. if(guin && guin->isDead())
  1431. {
  1432. me->MonsterYell("SO BE IT!", LANG_UNIVERSAL, me->GetGUID());
  1433. me->AddAura(SPELL_UNHOLY_BONE_SHIELD, me);
  1434. me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_1 | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE);
  1435. uiAoeTimer = 25000;
  1436. uiPlagueStrikeTimer = urand(5000, 8000);
  1437. uiDeathStrikeTimer = urand(9000, 12000);
  1438. uiStangulateTimer = 15000;
  1439. uiArmyOfTheDeadTimer = 30000;
  1440. me->SetReactState(REACT_AGGRESSIVE);
  1441. if(twin)
  1442. {
  1443. twin->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_1 | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE);
  1444. twin->SetReactState(REACT_AGGRESSIVE);
  1445. }
  1446. checkGuin = false;
  1447. }
  1448. }
  1449.  
  1450. if(!UpdateVictim())
  1451. return;
  1452.  
  1453. if(HealthBelowPct(25) && boneArmor)
  1454. {
  1455. me->AddAura(SPELL_UNHOLY_BONE_SHIELD, me);
  1456. boneArmor = false;
  1457. }
  1458.  
  1459. if(uiAoeTimer <= diff)
  1460. {
  1461. me->CastSpell(me->GetVictim()->GetPositionX(), me->GetVictim()->GetPositionY(), me->GetVictim()->GetPositionZ(), SPELL_UNHOLY_AOE, true);
  1462. uiAoeTimer = 25000;
  1463. }
  1464. else
  1465. uiAoeTimer -= diff;
  1466.  
  1467. if(uiPlagueStrikeTimer <= diff)
  1468. {
  1469. DoCast(me->GetVictim(), SPELL_UNHOLY_PLAGUE_STRIKE);
  1470. uiPlagueStrikeTimer = urand(5000, 8000);
  1471. }
  1472. else
  1473. uiPlagueStrikeTimer -= diff;
  1474.  
  1475. if(uiStangulateTimer <= diff)
  1476. {
  1477. DoCast(me->GetVictim(), SPELL_UNHOLY_STANGULATE, true);
  1478. uiStangulateTimer = 15000;
  1479. }
  1480. else
  1481. uiStangulateTimer -= diff;
  1482.  
  1483. if(uiDeathStrikeTimer <= diff)
  1484. {
  1485. DoCast(me->GetVictim(), SPELL_UNHOLY_DEATH_STRIKE);
  1486. uiDeathStrikeTimer = urand(9000, 12000);
  1487. }
  1488. else
  1489. uiDeathStrikeTimer -= diff;
  1490.  
  1491. if(uiArmyOfTheDeadTimer <= diff)
  1492. {
  1493. DoCast(me, SPELL_UNHOLY_ARMY, true);
  1494. uiArmyOfTheDeadTimer = 30000;
  1495. }
  1496. else
  1497. uiArmyOfTheDeadTimer -= diff;
  1498. DoMeleeAttackIfReady();
  1499. }
  1500.  
  1501. void JustSummoned(Creature * summoned)
  1502. {
  1503. summons.Summon(summoned);
  1504. }
  1505.  
  1506. private:
  1507. Creature * guin;
  1508. Creature * twin;
  1509. SummonList summons;
  1510. };
  1511.  
  1512. CreatureAI * GetAI(Creature * pCreature) const
  1513. {
  1514. return new npc_dm_main_unholyAI(pCreature);
  1515. }
  1516. };
  1517.  
  1518. class npc_dm_unholy_twin : public CreatureScript
  1519. {
  1520.    public:
  1521. npc_dm_unholy_twin() : CreatureScript("npc_dm_unholy_twin") { }
  1522.  
  1523. struct npc_dm_unholy_twinAI : public ScriptedAI
  1524. {
  1525. npc_dm_unholy_twinAI(Creature * c) : ScriptedAI(c) { }
  1526.  
  1527. uint32 uiCinematic;
  1528. uint32 uiAoeTimer;
  1529. uint32 uiPlagueStrikeTimer;
  1530. uint32 uiStangulateTimer;
  1531. uint32 uiDeathStrikeTimer;
  1532. uint32 uiArmyOfTheDeadTimer;
  1533. int cinematicPassed;
  1534. bool boneArmor;
  1535.  
  1536. void Reset()
  1537. {
  1538. uiCinematic = 6000;
  1539. boneArmor = true;
  1540. cinematicPassed = 0;
  1541. me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_1 | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE);
  1542. me->SetReactState(REACT_PASSIVE);
  1543. me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID+0, 51393);
  1544. }
  1545.  
  1546. void OnCombatStart(Unit * /* who */)
  1547. {
  1548. me->AddAura(SPELL_UNHOLY_BONE_SHIELD, me);
  1549. uiAoeTimer = 25000;
  1550. uiPlagueStrikeTimer = urand(5000, 8000);
  1551. uiDeathStrikeTimer = urand(9000, 12000);
  1552. uiStangulateTimer = 15000;
  1553. uiArmyOfTheDeadTimer = 30000;
  1554. }
  1555.  
  1556. void KilledUnit(Unit * who)
  1557. {
  1558. if(who && who->GetTypeId() != TYPEID_PLAYER)
  1559. return;
  1560. DoEndBattle(me);
  1561. }
  1562.  
  1563. void UpdateAI(uint32 diff)
  1564. {
  1565. if(uiCinematic <= diff)
  1566. {
  1567. switch(cinematicPassed)
  1568. {
  1569. case 0:
  1570. me->MonsterSay("I believe it wants to fight us.", LANG_UNIVERSAL, me->GetGUID());
  1571. cinematicPassed = 1;
  1572. uiCinematic = 7000;
  1573. break;
  1574.  
  1575. case 1:
  1576. me->MonsterSay("Yes. So it seems.", LANG_UNIVERSAL, me->GetGUID());
  1577. cinematicPassed = 2;
  1578. uiCinematic = 6000;
  1579. break;
  1580.  
  1581. case 2:
  1582. me->MonsterSay("What? FIGHT?", LANG_UNIVERSAL, me->GetGUID());
  1583. cinematicPassed = 3;
  1584. uiCinematic = 3000;
  1585. break;
  1586.  
  1587. case 3:
  1588. me->MonsterYell("GUIN! NO!", LANG_UNIVERSAL, me->GetGUID());
  1589. cinematicPassed = 4;
  1590. break;
  1591. }
  1592. }
  1593. else
  1594. uiCinematic -= diff;
  1595.  
  1596. if(!UpdateVictim())
  1597. return;
  1598.  
  1599. if(HealthBelowPct(25) && boneArmor)
  1600. {
  1601. me->AddAura(SPELL_UNHOLY_BONE_SHIELD, me);
  1602. boneArmor = false;
  1603. }
  1604.  
  1605. if(uiAoeTimer <= diff)
  1606. {
  1607. me->CastSpell(me->GetVictim()->GetPositionX(), me->GetVictim()->GetPositionY(), me->GetVictim()->GetPositionZ(), SPELL_UNHOLY_AOE, true);
  1608. uiAoeTimer = 25000;
  1609. }
  1610. else
  1611. uiAoeTimer -= diff;
  1612.  
  1613. if(uiPlagueStrikeTimer <= diff)
  1614. {
  1615. DoCast(me->GetVictim(), SPELL_UNHOLY_PLAGUE_STRIKE);
  1616. uiPlagueStrikeTimer = urand(5000, 8000);
  1617. }
  1618. else
  1619. uiPlagueStrikeTimer -= diff;
  1620.  
  1621. if(uiStangulateTimer <= diff)
  1622. {
  1623. DoCast(me->GetVictim(), SPELL_UNHOLY_STANGULATE, true);
  1624. uiStangulateTimer = 15000;
  1625. }
  1626. else
  1627. uiStangulateTimer -= diff;
  1628.  
  1629. if(uiDeathStrikeTimer <= diff)
  1630. {
  1631. DoCast(me->GetVictim(), SPELL_UNHOLY_DEATH_STRIKE);
  1632. uiDeathStrikeTimer = urand(9000, 12000);
  1633. }
  1634. else
  1635. uiDeathStrikeTimer -= diff;
  1636.  
  1637. if(uiArmyOfTheDeadTimer <= diff)
  1638. {
  1639. DoCast(me, SPELL_UNHOLY_ARMY, true);
  1640. uiArmyOfTheDeadTimer = 30000;
  1641. }
  1642. else
  1643. uiArmyOfTheDeadTimer -= diff;
  1644. DoMeleeAttackIfReady();
  1645. }
  1646.  
  1647. };
  1648.  
  1649. CreatureAI * GetAI(Creature * pCreature) const
  1650. {
  1651. return new npc_dm_unholy_twinAI(pCreature);
  1652. }
  1653. };
  1654.  
  1655. class npc_dm_unholy_pet : public CreatureScript
  1656. {
  1657.    public:
  1658. npc_dm_unholy_pet() : CreatureScript("npc_dm_unholy_pet") { }
  1659.  
  1660. struct npc_dm_unholy_petAI : public ScriptedAI
  1661. {
  1662. npc_dm_unholy_petAI(Creature * c) : ScriptedAI(c) { }
  1663.  
  1664. uint32 uiCinematicTimer;
  1665. uint32 uiPhaseChangeTimer;
  1666. uint32 uiEnrageTimer;
  1667. int phase;
  1668. int cinematicPassed;
  1669.  
  1670. void Reset()
  1671. {
  1672. uiCinematicTimer = 16000;
  1673. uiPhaseChangeTimer = 1000;
  1674. uiEnrageTimer = 5000;
  1675. phase = 1;
  1676. cinematicPassed = 0;
  1677. me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_1 | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE);
  1678. me->SetReactState(REACT_PASSIVE);
  1679. }
  1680.  
  1681. void KilledUnit(Unit * who)
  1682. {
  1683. if(who && who->GetTypeId() != TYPEID_PLAYER)
  1684. return;
  1685. DoEndBattle(me);
  1686. }
  1687.  
  1688. void UpdateAI(uint32 diff)
  1689. {
  1690. if(uiCinematicTimer <= diff)
  1691. {
  1692. switch(cinematicPassed)
  1693. {
  1694. case 0:
  1695. me->MonsterSay("Why can't we fight masters?", LANG_UNIVERSAL, me->GetGUID());
  1696. cinematicPassed = 1;
  1697. uiCinematicTimer = 5000;
  1698. break;
  1699.  
  1700. case 1:
  1701. me->MonsterYell("Well, I'm hungry!", LANG_UNIVERSAL, me->GetGUID());
  1702. me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_1 | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE);
  1703. me->SetReactState(REACT_AGGRESSIVE);
  1704. if(Player * player = me->SelectNearestPlayer(500.0f))
  1705. if(player && player->GetGUID() == m_PlayerGUID)
  1706. {
  1707. me->Attack(player, true);
  1708. me->GetMotionMaster()->MoveChase(player);
  1709. }
  1710. cinematicPassed = 2;
  1711. break;
  1712. }
  1713. }
  1714. else
  1715. uiCinematicTimer -= diff;
  1716.  
  1717. if(!UpdateVictim())
  1718. return;
  1719.  
  1720. if(uiPhaseChangeTimer <= diff)
  1721. {
  1722. switch(phase)
  1723. {
  1724. case 1:
  1725. if(HealthBelowPct(85))
  1726. {
  1727. DoIncreaseHealth(me, 2.0f);
  1728. phase = 2;
  1729. }
  1730. break;
  1731.  
  1732. case 2:
  1733. if(HealthBelowPct(65))
  1734. {
  1735. DoIncreaseHealth(me, 2.5f);
  1736. phase = 3;
  1737. }
  1738. break;
  1739.  
  1740. case 3:
  1741. if(HealthBelowPct(35))
  1742. {
  1743. DoIncreaseHealth(me, 3.0f);
  1744. phase = 4;
  1745. }
  1746. break;
  1747.  
  1748. case 4:
  1749. if(HealthBelowPct(15))
  1750. {
  1751. me->MonsterYell("HUNGER!", LANG_UNIVERSAL, me->GetGUID());
  1752. DoIncreaseHealth(me, 3.5f);
  1753. phase = 5;
  1754. }
  1755. break;
  1756. }
  1757. }
  1758. else
  1759. uiPhaseChangeTimer -= diff;
  1760.  
  1761. if(uiEnrageTimer <= diff)
  1762. {
  1763. DoCast(SPELL_ENRAGE);
  1764. uiEnrageTimer = 5000;
  1765. }
  1766. else
  1767. uiEnrageTimer -= diff;
  1768. DoMeleeAttackIfReady();
  1769. }
  1770. };
  1771.  
  1772. CreatureAI * GetAI(Creature * pCreature) const
  1773. {
  1774. return new npc_dm_unholy_petAI(pCreature);
  1775. }
  1776. };
  1777.  
  1778. class npc_army_ghoul : public CreatureScript
  1779. {
  1780.    public:
  1781. npc_army_ghoul() : CreatureScript("npc_army_ghoul") { }
  1782.  
  1783. struct npc_army_ghoulAI : public ScriptedAI
  1784. {
  1785. npc_army_ghoulAI(Creature * c) : ScriptedAI(c) { }
  1786.  
  1787. void KilledUnit(Unit * who)
  1788. {
  1789. if(who && who->GetTypeId() != TYPEID_PLAYER)
  1790. return;
  1791. DoEndBattle(me);
  1792. }
  1793. };
  1794. CreatureAI * GetAI(Creature * pCreature) const
  1795. {
  1796. return new npc_army_ghoulAI(pCreature);
  1797. }
  1798. };
  1799.  
  1800. class npc_dm_rider_guardian : public CreatureScript
  1801. {
  1802.    public:
  1803. npc_dm_rider_guardian() : CreatureScript("npc_dm_rider_guardian") { }
  1804.  
  1805. struct npc_dm_rider_guardianAI : public ScriptedAI
  1806. {
  1807. npc_dm_rider_guardianAI(Creature * c) : ScriptedAI(c), summons(me) { }
  1808.  
  1809. uint32 uiShieldTimer;
  1810. uint32 uiHealingBoltTimer;
  1811. uint32 uiRenewTimer;
  1812. uint32 uiGreaterHealTimer;
  1813. uint32 uiHealingBoltWaitTimer;
  1814. bool checkBrutes;
  1815. bool giveUp;
  1816. bool InHealingBolt;
  1817.  
  1818. void Reset()
  1819. {
  1820. uiShieldTimer = 25000;
  1821. uiHealingBoltTimer = urand(10000, 14000);
  1822. uiRenewTimer = 5000;
  1823. uiGreaterHealTimer = 8000;
  1824. me->SetReactState(REACT_PASSIVE);
  1825. me->CastSpell(me, SPELL_RIDERS_SHIELD);
  1826. me->CastSpell(me, SPELL_RIDERS_STAM_BUFF);
  1827. me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID+0, 51453);
  1828. checkBrutes = false;
  1829. giveUp = false;
  1830. InHealingBolt = false;
  1831. summons.DespawnAll();
  1832. brute = me->SummonCreature(waveList[17], m_WaveSpawns[0].m_positionX, m_WaveSpawns[0].m_positionY+3, m_WaveSpawns[0].m_positionZ, m_WaveSpawns[0].m_orientation, TEMPSUMMON_MANUAL_DESPAWN, 0);
  1833. brute2 = me->SummonCreature(waveList[18], m_WaveSpawns[0].m_positionX, m_WaveSpawns[0].m_positionY-3, m_WaveSpawns[0].m_positionZ, m_WaveSpawns[0].m_orientation, TEMPSUMMON_MANUAL_DESPAWN, 0);
  1834. }
  1835.  
  1836. void KilledUnit(Unit * who)
  1837. {
  1838. if(who && who->GetTypeId() != TYPEID_PLAYER)
  1839. return;
  1840. DoEndBattle(me, summons);
  1841. }
  1842.  
  1843. void JustSummoned(Creature * summoned)
  1844. {
  1845. summons.Summon(summoned);
  1846. }
  1847.  
  1848. void UpdateAI(uint32 diff)
  1849. {
  1850. if(!isBattleActive)
  1851. {
  1852. summons.DespawnAll();
  1853. brute = NULL;
  1854. brute2 = NULL;
  1855. me->DespawnOrUnsummon(1);
  1856. return;
  1857. }
  1858.  
  1859. if(HealthBelowPct(25) && !giveUp)
  1860. {
  1861. me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_1 | UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_NOT_SELECTABLE);
  1862. me->MonsterYell("I.. I GIVE UP!", LANG_UNIVERSAL, me->GetGUID());
  1863. me->SetHealth(me->GetMaxHealth());
  1864. checkBrutes = true;
  1865. giveUp = true;
  1866. }
  1867.  
  1868. if(checkBrutes && giveUp)
  1869. {
  1870. if(brute && brute->isDead() && brute2 && brute2->isDead())
  1871. {
  1872. if(Player * player = me->SelectNearestPlayer(200.0f))
  1873. if(player && player->GetGUID() == m_PlayerGUID)
  1874. me->PlayDirectSound(SOUND_WAVE_COMPLETE, player);
  1875. summons.DespawnAll();
  1876. me->DespawnOrUnsummon(1);
  1877. isWaveBossDead = 6;
  1878. }
  1879. return;
  1880. }
  1881.  
  1882. if(uiShieldTimer <= diff && !InHealingBolt)
  1883. {
  1884. int target = urand(0, 2);
  1885. switch(target)
  1886. {
  1887. case 0:
  1888. if(brute)
  1889. DoCast(brute, SPELL_RIDERS_SHIELD);
  1890. break;
  1891.  
  1892. case 1:
  1893. if(brute2)
  1894. DoCast(brute2, SPELL_RIDERS_SHIELD);
  1895. break;
  1896.  
  1897. case 2:
  1898. DoCast(me, SPELL_RIDERS_SHIELD);
  1899. break;
  1900. }
  1901. uiShieldTimer = 16000;
  1902. }
  1903. else
  1904. uiShieldTimer -= diff;
  1905.  
  1906. if(uiHealingBoltTimer <= diff)
  1907. {
  1908. int target = urand(0, 1);
  1909. switch(target)
  1910. {
  1911. case 0:
  1912. if(brute && brute->GetHealthPct() <= 85)
  1913. me->CastSpell(brute, SPELL_RIDERS_HEALING_BOLT, true);
  1914. break;
  1915.  
  1916. case 1:
  1917. if(brute2 && brute2->GetHealthPct() <= 65)
  1918. me->CastSpell(brute2, SPELL_RIDERS_HEALING_BOLT, true);
  1919. break;
  1920. }
  1921. InHealingBolt = true;
  1922. uiHealingBoltWaitTimer = 3000;
  1923. uiHealingBoltTimer = urand(10000, 14000);
  1924. }
  1925. else
  1926. uiHealingBoltTimer -= diff;
  1927.  
  1928. if(InHealingBolt)
  1929. {
  1930. if(uiHealingBoltWaitTimer <= diff)
  1931. InHealingBolt = false;
  1932. else
  1933. uiHealingBoltWaitTimer -= diff;
  1934. }
  1935.  
  1936. if(uiRenewTimer <= diff && !InHealingBolt)
  1937. {
  1938. int target = urand(0, 2);
  1939. switch(target)
  1940. {
  1941. case 0:
  1942. if(brute)
  1943. DoCast(brute, SPELL_RIDERS_RENEW);
  1944. break;
  1945.  
  1946. case 1:
  1947. if(brute2)
  1948. DoCast(brute2, SPELL_RIDERS_RENEW);
  1949. break;
  1950.  
  1951. case 2:
  1952. if(HealthBelowPct(80))
  1953. DoCast(me, SPELL_RIDERS_RENEW);
  1954. break;
  1955. }
  1956. uiRenewTimer = 5000;
  1957. }
  1958. else
  1959. uiRenewTimer -= diff;
  1960.  
  1961. if(uiGreaterHealTimer <= diff && !InHealingBolt)
  1962. {
  1963. int target = urand(0, 2);
  1964. switch(target)
  1965. {
  1966. case 0:
  1967. if(brute && brute->GetHealthPct() <= 30)
  1968. me->CastSpell(brute, SPELL_RIDERS_GREATER_HEAL, true);
  1969. break;
  1970.  
  1971. case 1:
  1972. if(brute2 && brute2->GetHealthPct() <= 20)
  1973. me->CastSpell(brute2, SPELL_RIDERS_GREATER_HEAL, true);
  1974. break;
  1975.  
  1976. case 2:
  1977. if(HealthBelowPct(40))
  1978. me->CastSpell(me, SPELL_RIDERS_GREATER_HEAL, true);
  1979. break;
  1980. }
  1981. uiGreaterHealTimer = 6000;
  1982. }
  1983. else
  1984. uiGreaterHealTimer -= diff;
  1985. }
  1986. private:
  1987. Creature * brute;
  1988. Creature * brute2;
  1989. SummonList summons;
  1990. };
  1991.  
  1992. CreatureAI * GetAI(Creature * pCreature) const
  1993. {
  1994. return new npc_dm_rider_guardianAI(pCreature);
  1995. }
  1996. };
  1997.  
  1998. class npc_dm_rider_brute : public CreatureScript
  1999. {
  2000.    public:
  2001. npc_dm_rider_brute() : CreatureScript("npc_dm_rider_brute") { }
  2002.  
  2003. struct npc_dm_rider_bruteAI : public ScriptedAI
  2004. {
  2005. npc_dm_rider_bruteAI(Creature * c) : ScriptedAI(c) { }
  2006.  
  2007. uint32 uiLightningTimer;
  2008. uint32 uiChainLightningTimer;
  2009. uint32 uiMoonfireTimer;
  2010. uint32 uiLightningStormTimer;
  2011. uint32 uiLightningWaitTimer;
  2012. bool InLightningChannel;
  2013.  
  2014. void Reset()
  2015. {
  2016. uiLightningTimer = 13000;
  2017. uiChainLightningTimer = urand(6000, 9000);
  2018. uiMoonfireTimer = 5000;
  2019. uiLightningStormTimer = urand(20000, 26000);
  2020. InLightningChannel = false;
  2021. me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID+0, 51517);
  2022. me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID+1, 51447);
  2023. }
  2024.  
  2025. void KilledUnit(Unit * who)
  2026. {
  2027. if(who && who->GetTypeId() != TYPEID_PLAYER)
  2028. return;
  2029. DoEndBattle(me);
  2030. }
  2031.  
  2032. void UpdateAI(uint32 diff)
  2033. {
  2034. if(!UpdateVictim())
  2035. return;
  2036.  
  2037. if(!isBattleActive)
  2038. {
  2039. me->DespawnOrUnsummon(1);
  2040. return;
  2041. }
  2042.  
  2043. if(uiLightningTimer <= diff)
  2044. {
  2045. if(!InLightningChannel)
  2046. DoCast(me->GetVictim(), SPELL_RIDERS_LIGHTNING);
  2047. uiLightningTimer = 13000;
  2048. }
  2049. else
  2050. uiLightningTimer -= diff;
  2051.  
  2052. if(uiChainLightningTimer <= diff)
  2053. {
  2054. if(!InLightningChannel)
  2055. DoCast(me->GetVictim(), SPELL_RIDERS_CHAIN_LIGHTNING, true);
  2056. uiChainLightningTimer = urand(6000, 9000);
  2057. }
  2058. else
  2059. uiChainLightningTimer -= diff;
  2060.  
  2061. if(uiMoonfireTimer <= diff)
  2062. {
  2063. if(!InLightningChannel)
  2064. DoCast(me->GetVictim(), SPELL_RIDERS_MOONFIRE);
  2065. uiMoonfireTimer = 5000;
  2066. }
  2067. else
  2068. uiMoonfireTimer -= diff;
  2069.  
  2070. if(uiLightningStormTimer <= diff)
  2071. {
  2072. if(!InLightningChannel)
  2073. {
  2074. me->CastSpell(me->GetVictim(), SPELL_RIDERS_STORM, true);
  2075. InLightningChannel = true;
  2076. uiLightningWaitTimer = 10000;
  2077. }
  2078. uiLightningStormTimer = urand(20000, 26000);
  2079. }
  2080. else
  2081. uiLightningStormTimer -= diff;
  2082.  
  2083. if(InLightningChannel)
  2084. {
  2085. if(uiLightningWaitTimer <= diff)
  2086. {
  2087. InLightningChannel = false;
  2088. }
  2089. else
  2090. uiLightningWaitTimer -= diff;
  2091. }
  2092.  
  2093. if(!InLightningChannel)
  2094. DoMeleeAttackIfReady();
  2095. }
  2096. };
  2097.  
  2098. CreatureAI * GetAI(Creature * pCreature) const
  2099. {
  2100. return new npc_dm_rider_bruteAI(pCreature);
  2101. }
  2102. };
  2103.  
  2104. class npc_dm_dragon_final : public CreatureScript
  2105. {
  2106.    public:
  2107. npc_dm_dragon_final() : CreatureScript("npc_dm_dragon_final") { }
  2108.  
  2109. struct npc_dm_dragon_finalAI : public ScriptedAI
  2110. {
  2111. npc_dm_dragon_finalAI(Creature * c) : ScriptedAI(c), summons(me) { }
  2112.  
  2113. uint32 uiBerserkTimer;
  2114. uint32 uiBreathTimer;
  2115. uint32 uiTailWhipTimer;
  2116. uint32 uiClawTimer;
  2117. uint32 uiFlameStrikeTimer;
  2118. uint32 uiFlightTimer;
  2119. uint32 uiFlightWaitTimer;
  2120. uint32 uiLandTimer;
  2121.  
  2122. uint32 m_Phase;
  2123. int FlameStrikeData;
  2124. bool IsInFlight;
  2125. bool FireShield;
  2126. bool canLand;
  2127.  
  2128. void Reset()
  2129. {
  2130. if(!IsCombatMovementAllowed())
  2131. SetCombatMovement(true);
  2132.  
  2133. uiFlightTimer = 10000; // 10s
  2134. uiClawTimer = urand(3000, 5000);
  2135. uiTailWhipTimer = urand(12000, 16000);
  2136. uiBreathTimer = urand(18000, 22000);
  2137.  
  2138. FlameStrikeData = 0;
  2139.  
  2140. summons.DespawnAll();
  2141. IsInFlight = false;
  2142. FireShield = true;
  2143. canLand = false;
  2144. }
  2145.  
  2146. void EnterCombat(Unit * /* who */)
  2147. {
  2148. m_Phase = PHASE_START_COMBAT;
  2149. uiBerserkTimer = 420000; // 7 Mins
  2150. }
  2151.  
  2152. void KilledUnit(Unit * who)
  2153. {
  2154. if(who && who->GetTypeId() != TYPEID_PLAYER)
  2155. return;
  2156. DoEndBattle(me, summons);
  2157. }
  2158.  
  2159. void JustDied(Unit * killer)
  2160. {
  2161. if(killer && killer->GetTypeId() != TYPEID_PLAYER &&
  2162. killer->GetGUID() != m_PlayerGUID)
  2163. return;
  2164. me->PlayDirectSound(SOUND_WAVE_COMPLETE, killer->ToPlayer());
  2165. m_Phase = PHASE_END;
  2166. isWaveBossDead = 7;
  2167. }
  2168.  
  2169. void MovementInform(uint32 type, uint32 id)
  2170. {
  2171. if(type == POINT_MOTION_TYPE)
  2172. {
  2173. switch(id)
  2174. {
  2175. case 1:
  2176. me->SetFacingTo(sMoveData[0].o);
  2177. me->SetDisableGravity(true);
  2178. break;
  2179. }
  2180. }
  2181. }
  2182.  
  2183. void JustSummoned(Creature * summoned)
  2184. {
  2185. summons.Summon(summoned);
  2186. }
  2187.  
  2188. void UpdateAI(uint32 diff)
  2189. {
  2190. if(!UpdateVictim() || m_Phase == PHASE_END)
  2191. return;
  2192.  
  2193. if(!isBattleActive)
  2194. {
  2195. summons.DespawnAll();
  2196. m_Phase = PHASE_END;
  2197. me->DespawnOrUnsummon(1);  
  2198. return;
  2199. }
  2200.  
  2201. if(m_Phase == PHASE_START_COMBAT)
  2202. {
  2203. if(HealthBelowPct(15) && FireShield) // Doesn't matter if you're flying
  2204. {
  2205. DoCast(me, SPELL_DRAGON_FIRE_SHIELD, true);
  2206. FireShield = false;
  2207. }
  2208.  
  2209. if(uiClawTimer <= diff)
  2210. {
  2211. if(!IsInFlight)
  2212. DoCast(me->GetVictim(), SPELL_DRAGON_CLAW);
  2213. uiClawTimer = urand(3000, 5000);
  2214. }
  2215. else
  2216. uiClawTimer -= diff;
  2217.  
  2218. if(uiBreathTimer <= diff)
  2219. {
  2220. if(!IsInFlight)
  2221. me->CastSpell(me->GetVictim(), SPELL_DRAGON_BREATH, true);
  2222. uiBreathTimer = urand(18000, 24000);
  2223. }
  2224. else
  2225. uiBreathTimer -= diff;
  2226.  
  2227. if(uiTailWhipTimer <= diff)
  2228. {
  2229. if(!IsInFlight)
  2230. DoCastAOE(SPELL_DRAGON_TAIL_WHIP, false);
  2231. uiTailWhipTimer = urand(12000, 16000);
  2232. }
  2233. else
  2234. uiTailWhipTimer -= diff;
  2235.  
  2236. if(uiBerserkTimer <= diff)
  2237. {
  2238. DoCast(me, SPELL_DRAGON_BERSERK);
  2239. uiBerserkTimer = 420000;
  2240. }
  2241. else
  2242. uiBerserkTimer -= diff;
  2243.  
  2244. if(uiFlightTimer <= diff && !IsInFlight)
  2245. {
  2246. me->SetCanFly(true);
  2247. me->SetSpeed(MOVE_FLIGHT, 1.3f);   
  2248. me->GetMotionMaster()->MovePoint(1, -3786.241943f, 1096.538452f, 153.903366f); 
  2249. FlameStrikeData = 0;
  2250. uiFlameStrikeTimer = 6000;
  2251. uiFlightWaitTimer = 30000;
  2252. IsInFlight = true;
  2253. uiFlightTimer = 50000;
  2254. }
  2255. else
  2256. uiFlightTimer -= diff;
  2257.  
  2258. if(IsInFlight)
  2259. {
  2260. if(uiFlameStrikeTimer <= diff)
  2261. {
  2262. switch(FlameStrikeData)
  2263. {
  2264. case 0:
  2265. me->MonsterTextEmote("The Arena Dragon has a lot of fire inside!", 0, true);
  2266. groundTarget = me->SummonGameObject(sMoveData[0].gobject, me->GetVictim()->GetPositionX()-3, me->GetVictim()->GetPositionY()+6, me->GetVictim()->GetPositionZ(),
  2267. me->GetOrientation(), 0, 0, 0, 0, 0);
  2268. uiFlameStrikeTimer = 2000;
  2269. FlameStrikeData = 1;
  2270. break;
  2271.  
  2272. case 1:
  2273. trigger = me->SummonCreature(NPC_DRAGON_BOSS_TRIGGER, groundTarget->GetPositionX(), groundTarget->GetPositionY(), groundTarget->GetPositionZ(), 0.0f,
  2274. TEMPSUMMON_TIMED_DESPAWN, 3000);
  2275. me->CastSpell(trigger->GetPositionX(), trigger->GetPositionY(), trigger->GetPositionZ(), sMoveData[0].spellId, true);
  2276. uiFlameStrikeTimer = 2000;
  2277. FlameStrikeData = 2;
  2278. break;
  2279.  
  2280. case 2:
  2281. if(groundTarget)
  2282. groundTarget->Delete();
  2283. me->MonsterTextEmote("The Arena Dragon has a lot of fire inside!", 0, true);
  2284. groundTarget = me->SummonGameObject(sMoveData[0].gobject, me->GetVictim()->GetPositionX()-3, me->GetVictim()->GetPositionY()-6, me->GetVictim()->GetPositionZ(),
  2285. me->GetOrientation(), 0, 0, 0, 0, 0);
  2286. uiFlameStrikeTimer = 2000;
  2287. FlameStrikeData = 3;
  2288. break;
  2289.  
  2290. case 3:
  2291. trigger = me->SummonCreature(NPC_DRAGON_BOSS_TRIGGER, groundTarget->GetPositionX(), groundTarget->GetPositionY(), groundTarget->GetPositionZ(), 0.0f,
  2292. TEMPSUMMON_TIMED_DESPAWN, 3000);
  2293. me->CastSpell(trigger->GetPositionX(), trigger->GetPositionY(), trigger->GetPositionZ(), sMoveData[0].spellId, true);
  2294. uiFlameStrikeTimer = 2000;
  2295. FlameStrikeData = 4;
  2296. break;
  2297.  
  2298. case 4:
  2299. if(groundTarget)
  2300. groundTarget->Delete();
  2301. me->MonsterTextEmote("The Arena Dragon has a lot of fire inside!", 0, true);
  2302. groundTarget = me->SummonGameObject(sMoveData[0].gobject, me->GetVictim()->GetPositionX()-3, me->GetVictim()->GetPositionY()-6, me->GetVictim()->GetPositionZ(),
  2303. me->GetOrientation(), 0, 0, 0, 0, 0);
  2304. uiFlameStrikeTimer = 2000;
  2305. FlameStrikeData = 5;
  2306. break;
  2307.  
  2308. case 5:
  2309. trigger = me->SummonCreature(NPC_DRAGON_BOSS_TRIGGER, groundTarget->GetPositionX(), groundTarget->GetPositionY(), groundTarget->GetPositionZ(), 0.0f,
  2310. TEMPSUMMON_TIMED_DESPAWN, 3000);
  2311. me->CastSpell(trigger->GetPositionX(), trigger->GetPositionY(), trigger->GetPositionZ(), sMoveData[0].spellId, true);
  2312. uiFlameStrikeTimer = 2000;
  2313. FlameStrikeData = 6;
  2314. break;
  2315.  
  2316. case 6:
  2317. if(groundTarget)
  2318. groundTarget->Delete();
  2319. me->MonsterTextEmote("The Arena Dragon has a lot of fire inside!", 0, true);
  2320. groundTarget = me->SummonGameObject(sMoveData[0].gobject, me->GetVictim()->GetPositionX()-3, me->GetVictim()->GetPositionY()+6, me->GetVictim()->GetPositionZ(),
  2321. me->GetOrientation(), 0, 0, 0, 0, 0);
  2322. uiFlameStrikeTimer = 2000;
  2323. FlameStrikeData = 7;
  2324. break;
  2325.  
  2326. case 7:
  2327. trigger = me->SummonCreature(NPC_DRAGON_BOSS_TRIGGER, groundTarget->GetPositionX(), groundTarget->GetPositionY(), groundTarget->GetPositionZ(), 0.0f,
  2328. TEMPSUMMON_TIMED_DESPAWN, 3000);
  2329. me->CastSpell(trigger->GetPositionX(), trigger->GetPositionY(), trigger->GetPositionZ(), sMoveData[0].spellId, true);
  2330. uiFlameStrikeTimer = 2000;
  2331. FlameStrikeData = 8;
  2332. break;
  2333.  
  2334. case 8:
  2335. if(groundTarget)
  2336. groundTarget->Delete();
  2337. me->MonsterTextEmote("The Arena Dragon has a lot of fire inside!", 0, true);
  2338. groundTarget = me->SummonGameObject(sMoveData[0].gobject, me->GetVictim()->GetPositionX()-3, me->GetVictim()->GetPositionY()+6, me->GetVictim()->GetPositionZ(),
  2339. me->GetOrientation(), 0, 0, 0, 0, 0);
  2340. uiFlameStrikeTimer = 2000;
  2341. FlameStrikeData = 9;
  2342. break;
  2343.  
  2344. case 9:
  2345. trigger = me->SummonCreature(NPC_DRAGON_BOSS_TRIGGER, groundTarget->GetPositionX(), groundTarget->GetPositionY(), groundTarget->GetPositionZ(), 0.0f,
  2346. TEMPSUMMON_TIMED_DESPAWN, 3000);
  2347. me->CastSpell(trigger->GetPositionX(), trigger->GetPositionY(), trigger->GetPositionZ(), sMoveData[0].spellId, true);
  2348. uiFlameStrikeTimer = 1000;
  2349. FlameStrikeData = 10;
  2350. break;
  2351.  
  2352. case 10:
  2353. if(groundTarget)
  2354. groundTarget->Delete();
  2355. FlameStrikeData = 11;
  2356. break;
  2357. }
  2358. }
  2359. else
  2360. uiFlameStrikeTimer -= diff;
  2361.  
  2362. if(uiFlightWaitTimer <= diff && !canLand)
  2363. {
  2364. me->GetMotionMaster()->MovePoint(2, me->GetHomePosition()); // Back Home
  2365. canLand = true;
  2366. uiLandTimer = 5000;
  2367. }
  2368. else
  2369. uiFlightWaitTimer -= diff;
  2370.  
  2371. if(uiLandTimer <= diff && canLand)
  2372. {
  2373. me->SetCanFly(false);
  2374. me->SetDisableGravity(false);
  2375. SetCombatMovement(true);
  2376. me->GetMotionMaster()->Clear(false);
  2377. me->GetMotionMaster()->MoveChase(me->GetVictim());
  2378. IsInFlight = false;
  2379. canLand = false;
  2380. }
  2381. else
  2382. uiLandTimer -= diff;
  2383. }
  2384. }
  2385. if(!IsInFlight)
  2386. DoMeleeAttackIfReady();
  2387. }
  2388. private:
  2389. GameObject * groundTarget;
  2390. Creature * trigger;
  2391. SummonList summons;
  2392. };
  2393.  
  2394. CreatureAI * GetAI(Creature * pCreature) const
  2395. {
  2396. return new npc_dm_dragon_finalAI(pCreature);
  2397. }
  2398. };
  2399.  
  2400. class remove_non_battle_player : public PlayerScript
  2401. {
  2402.    public:
  2403. remove_non_battle_player() : PlayerScript("remove_non_battle_player") { }
  2404.  
  2405. void OnUpdateZone(Player * player, uint32 zone, uint32 area)
  2406. {
  2407. if(m_PlayerGUID == 0)
  2408. return;
  2409.  
  2410. if(player->GetZoneId() != DIRE_MAUL_ZONE && player->GetAreaId() != DIRE_MAUL_AREA && player->GetGUID() == m_PlayerGUID)
  2411. {
  2412. inZone = false;
  2413. return;
  2414. }
  2415.  
  2416. if(player->GetAreaId() != DIRE_MAUL_AREA || player->GetSession()->GetSecurity() > 1)
  2417. return;
  2418.  
  2419. if(isBattleActive && player->GetGUID() != m_PlayerGUID)
  2420. {
  2421. player->TeleportTo(player->GetStartPosition().GetMapId(), player->GetStartPosition().GetPositionX(), player->GetStartPosition().GetPositionY(),
  2422. player->GetStartPosition().GetPositionZ(), player->GetStartPosition().GetOrientation());
  2423. ChatHandler(player->GetSession()).SendSysMessage("You cannot be in the Dire Maul Arena while the event is going on!");
  2424. }
  2425. }
  2426.  
  2427. void OnLogout(Player * player)
  2428. {
  2429. if(m_PlayerGUID == 0)
  2430. return;
  2431.  
  2432. if(player->GetGUID() == m_PlayerGUID)
  2433. hasLogged = true;
  2434. }
  2435. };
  2436.  
  2437. void AddSC_arena_link_battle()
  2438. {
  2439. /* Npc Classes */
  2440. new npc_dire_arena_commander;
  2441. new npc_dire_maul_rb_guard;
  2442. new npc_red_blood_mini;
  2443. new npc_dm_wave_trigger;
  2444. new npc_dm_wave_spawns;
  2445. new npc_dm_hank_the_tank;
  2446. new npc_dm_field_medic;
  2447. new npc_dm_main_rogue;
  2448. new npc_dm_rogue_initiate;
  2449. new npc_dm_main_unholy;
  2450. new npc_dm_unholy_twin;
  2451. new npc_dm_unholy_pet;
  2452. new npc_army_ghoul;
  2453. new npc_dm_rider_guardian;
  2454. new npc_dm_rider_brute;
  2455. new npc_dm_dragon_final;
  2456. new npc_dm_wave_portals;
  2457. /* Player Classes */
  2458. new remove_non_battle_player;
  2459. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement