Advertisement
Guest User

Untitled

a guest
Jun 11th, 2015
314
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 102.17 KB | None | 0 0
  1. /* Copyright (C) 2006 - 2011 ScriptDev2 <http://www.scriptdev2.com/>
  2. * This program is free software; you can redistribute it and/or modify
  3. * it under the terms of the GNU General Public License as published by
  4. * the Free Software Foundation; either version 2 of the License, or
  5. * (at your option) any later version.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. *
  12. * You should have received a copy of the GNU General Public License
  13. * along with this program; if not, write to the Free Software
  14. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  15. */
  16.  
  17. /* ScriptData
  18. SDName: boss_yogg_saron
  19. SD%Complete:
  20. SDComment: TODO: Achievments: Drive Me Crazy, In His House He Waits Dreaming
  21. SDCategory: Ulduar
  22. EndScriptData */
  23.  
  24. #include "precompiled.h"
  25. #include "ulduar.h"
  26. #include "Vehicle.h"
  27.  
  28. enum
  29. {
  30. //yells
  31. //sara
  32. SAY_AGGRO = -1603360,
  33. SAY_HELP1 = -1603361,
  34. SAY_HELP2 = -1603362,
  35. SAY_KILL1 = -1603363,
  36. SAY_KILL2 = -1603364,
  37. SAY_SPECIAL1 = -1603365,
  38. SAY_SPECIAL2 = -1603366,
  39. SAY_INTRO1 = -1603367,
  40. SAY_INTRO2 = -1603368,
  41. SAY_WIPE = -1603369,
  42.  
  43. //yogg
  44. SAY_PHASE2 = -1603370,
  45. SAY_VISION = -1603371,
  46. SAY_PHASE3 = -1603372,
  47. SAY_SLAY1 = -1603373,
  48. SAY_SLAY2 = -1603374,
  49. SAY_DEATH = -1603375,
  50. SAY_INSANITY1 = -1603376,
  51. SAY_INSANITY2 = -1603377,
  52. EMOTE_PORTALS = -1603378,
  53. EMOTE_SHATTER = -1603379,
  54.  
  55. //visions
  56. //stormwind
  57. SAY_GARONA1 = -1603400,
  58. SAY_GARONA2 = -1603401,
  59. SAY_GARONA3 = -1603402,
  60. SAY_YOGG_V1_1 = -1603403,
  61. SAY_YOGG_V1_2 = -1603404,
  62. SAY_ILANE = -1603405,
  63. SAY_GARONA4 = -1603406,
  64. SAY_YOGG_V1_3 = -1603407,
  65.  
  66. //dragons
  67. SAY_NELTHARION1 = -1603390,
  68. SAY_YSERA = -1603391,
  69. SAY_NELTHARION2 = -1603392,
  70. SAY_MALYGOS = -1603393,
  71. SAY_YOGG_V2 = -1603394,
  72.  
  73. //lich king
  74. SAY_LICH_KING1 = -1603380,
  75. SAY_CHAMPION1 = -1603381,
  76. SAY_CHAMPION2 = -1603382,
  77. SAY_LICH_KING2 = -1603383,
  78. SAY_YOGG_V3_1 = -1603384,
  79. SAY_YOGG_V3_2 = -1603385,
  80.  
  81. //keepers yells
  82. SAY_HODIR_ACTIVE = -1603126,
  83. SAY_FREYA_ACTIVE = -1603149,
  84. SAY_THORIM_ACTIVE = -1603207,
  85. SAY_MIMIRON_ACTIVE = -1603239,
  86.  
  87. //vision npc
  88. //stormwind
  89. NPC_GARONA = 33436,
  90. NPC_KING_LLANE = 33437,
  91.  
  92. MOB_SUIT_OF_ARMOR = 33433,
  93.  
  94. //dragons
  95. NPC_NELTHARION = 33523,
  96. NPC_YSERA = 33495,
  97. NPC_MALYGOS = 33535,
  98. NPC_ALEXSTRASZA = 33536,
  99. GO_DRAGON_SOUL = 194462,
  100.  
  101. MOB_RUBY_CONSORT = 33716,
  102. MOB_AZURE_CONSORT = 33717,
  103. MOB_BRONZE_CONSORT = 33718,
  104. MOB_EMERALD_CONSORT = 33719,
  105. MOB_OBSIDIAN_CONSORT = 33720,
  106.  
  107.  
  108. //lich king
  109. NPC_LICH_KING = 33441,
  110. NPC_IMMOLATED_CHAMPION = 33442,
  111.  
  112. NPC_VOICE_OF_YOGG_SARON = 33280,
  113. MOB_VISION_TENTACLE = 33943,
  114. SPELL_GRIM_REPRISAL = 63305,
  115. // npc hp: 15k on 10 man; 40k on 25 man
  116. // npc no: 10
  117.  
  118. //spells
  119. //phase1
  120. SPELL_SARAS_FERVOR = 63138,
  121. SPELL_SARAS_BLESSING = 63134,
  122. SPELL_SARAS_ANGER = 63147,
  123.  
  124. MOB_GUARDIAN_OF_YOGG = 33136,
  125. SPELL_DARK_VOLLEY = 63038,
  126. SPELL_SHADOW_NOVA = 62714, //when dies
  127. SPELL_SHADOW_NOVA_H = 65209,
  128. SPELL_DOMINATE_MIND = 63713,
  129.  
  130. // clouds
  131. SPELL_OMINOUS_CLOUD_VISUAL = 63084,
  132. SPELL_SUMMON_GUARDIAN = 62978, // cast von yogg saron ,with spell Script target at cloud
  133. SPELL_SUMMON_GUARDIAN2 = 63031, // cloud spell (target Self)
  134.  
  135. //phase2
  136. SPELL_SHADOWY_BARRIER = 64775,
  137. SPELL_SHADOWY_BARRIER_YOGG = 63894,
  138. SPELL_SANITY = 63050,
  139. SPELL_PHYCHOSIS = 65301,
  140. SPELL_PHYCHOSIS_H = 63795,
  141. SPELL_MALADY_OF_THE_MIND = 63830, // in core fix
  142. SPELL_BRAIN_LINK = 63802, // in core fix, BUT visual mistake
  143. SPELL_DEATH_RAY_SUMMON = 63891, //summons orb
  144. SPELL_DEATH_RAY_TRIGG = 63883,
  145. SPELL_DEATH_RAY_VISUAL_W = 63882,
  146. SPELL_DEATH_RAY_VISUAL_D = 63886,
  147. SPELL_DEATH_RAY_VISUAL_ORI = 63893,
  148. MOB_DEATH_ORB = 33882,
  149.  
  150. MODEL_SARA_VALKYR = 29182,
  151. MODEL_SARA_HUMAN = 29117,
  152.  
  153. // sanity
  154. SPELL_CLEAR_INSANE = 63122,
  155. SPELL_INSANE = 63120,
  156. SPELL_INSANE_VISUAL = 64464,
  157. SPELL_INSANE_TRIGG = 64554,
  158.  
  159. SPELL_LOW_SANITY_EFFECT = 63752,
  160. SPELL_SANITY_TRIGG = 63786,
  161.  
  162. // portals
  163. MOB_DESCEND_INTO_MADNESS = 34072,
  164. SPELL_LUNATIC_GAZE = 64167, //target fix for targets in core
  165. NPC_LAUGHING_SKULL = 33990,
  166. SKULL_DISPLAY_ID = 25206,
  167.  
  168. // teleports
  169. SPELL_TELEPORT_TO_STORMWIND_ILLUSION= 63989, // Stormwind
  170. SPELL_TELEPORT_TO_CHAMBER_ILLUSION = 63997, // Wyrmruh
  171. SPELL_TELEPORT_TO_ICEECROWN_ILLUSION= 63998, // Lich King
  172. SPELL_TELEPORT_BACK_TO_MAIN_ROOM = 63992, // To Yogg Saron
  173.  
  174. // brain's chamber
  175. MOB_BRAIN_OF_YOGG_SARON = 33890,
  176. SPELL_SHATTERED_ILLUSION = 64173,
  177. SPELL_SHATTERED_ILLUSION2 = 65238,
  178. SPELL_INDUCE_MADNESS = 64059,
  179. SPELL_ILLUSION_ROOM = 63988, // reduce speed
  180. SPELL_ILLUSION_CANCEL = 63993,
  181.  
  182.  
  183. // tentacules
  184. MOB_CRUSHER_TENTACLE = 33966,
  185. SPELL_ERUPT = 64144, //also used by the corruptor and constrictor tentacle
  186. SPELL_DIMINISH_POWER = 64145,
  187. SPELL_FOCUSED_ANGER = 57689,
  188. SPELL_FOCUSED_ANGER_TRIGG = 57688,
  189. SPELL_CRUSH = 64147,
  190. SPELL_SUMMON_CRUSHER = 64139,
  191.  
  192. MOB_CONSTRICTOR_TENTACLE = 33983,
  193. SPELL_SQUEEZE_GRAB = 64123,
  194. SPELL_SQUEEZE = 64125,
  195. SPELL_SQUEEZE_H = 64126,
  196. SPELL_SUMMON_CONSTRICTOR = 64133,
  197.  
  198. MOB_CORRUPTOR_TENTACLE = 33985,
  199. SPELL_APATHY = 64156,
  200. SPELL_BLACK_PLAGUE = 64153,
  201. SPELL_CURSE_OF_DOOM = 64157,
  202. SPELL_DRAINING_POISON = 64152,
  203. SPELL_SUMMON_CORRUPTOR = 64143,
  204.  
  205. // phase 3
  206. SPELL_LUNATIC_GAZE_YOGG = 64163, // target fix in core
  207. SPELL_SHADOW_BEACON = 64465, // with script target a chain of spells
  208. //SPELL_EMPOWERING_SHADOWS = 64468, // in core fix
  209. //SPELL_EMPOWERING_SHADOWS_H = 64486, // in core fix
  210. SPELL_DEAFENING_ROAR = 64189, //only cast on 25 player with 0-3 keepes active
  211.  
  212. MOB_IMMORTAL_GUARDIAN = 33988,
  213. //SPELL_EMPOWERED = 65294, //starts with 9 stacks and loses 1 stak at 10% hp; fix in core
  214. SPELL_EMPOWERED_AURA = 64161, // standard aura, dummy tick for stackhandling of spell 65294
  215. SPELL_RECENTLY_SPAWNED = 64497, // for spell 64465, that this unit is no target
  216. SPELL_DRAIN_LIFE = 64159,
  217. SPELL_DRAIN_LIFE_H = 64160,
  218. //SPELL_WEAKENED = 64162, // mob ready for thorim kill; fix in core
  219.  
  220. SPELL_BERSERK = 64166, //extinguish all life
  221.  
  222. // keepers
  223. // freya
  224. SPELL_RESILIENCE_OF_NATURE = 62670,
  225. MOB_SANITY_WELL = 33991,
  226. SPELL_SANITY_WELL = 64169, // regen sanity
  227. SPELL_SANITY_WELL_VISUAL = 63288,
  228. SPELL_SUMMON_SANITY_WELL = 64170,
  229.  
  230. // hodir
  231. SPELL_FORTITUDE_OF_FROST = 62650,
  232. SPELL_HODIRS_PROTECTIVE_GAZE= 64174, // saves players from killing blows ~25secs cd
  233.  
  234. // mimiron
  235. SPELL_SPEED_OF_INVENTION = 62671,
  236. SPELL_DESTABILIZATION_MATRIX= 65210, // cast in phase 2 on the tentacules
  237.  
  238. // thorim
  239. SPELL_FURY_OF_THE_STORM = 62702,
  240. SPELL_TITANIC_STORM = 64171, // used in phase 3 to kill guardians
  241. SPELL_TITANIC_STORM_DMG = 64172,
  242. };
  243.  
  244. #define LAYERCUT 290.0f
  245.  
  246. enum phases
  247. {
  248. // yogg phases
  249. PHASE_IDLE = 0,
  250. PHASE_SARA = 1,
  251. PHASE_TENTACLES = 2,
  252. PHASE_OLD_GOD = 3,
  253. // vision phases
  254. PHASE_VISION_STORMWIND = 1,
  255. PHASE_VISION_WYRMREST = 2,
  256. PHASE_VISION_ICECROWN = 3,
  257. PHASE_VISION_RETURN = 4, // used to set the portals to return to main chamber = idle
  258. };
  259.  
  260. //Positional defines
  261. struct LocationsXY
  262. {
  263. float x, y, z, o;
  264. uint32 id;
  265. };
  266. static LocationsXY SummonLoc[]=
  267. {
  268. {1951.097412f,-25.42042f, 326.162598f},
  269. {1970.677490f,-0.211162f, 325.478638f},
  270. {2001.049805f,-4.201718f, 325.751831f},
  271. {2009.346924f,-26.001806f,325.603271f},
  272. {1998.081665f,-46.625187f,325.551605f},
  273. {1962.782715f,-51.363148f,325.458160f},
  274. {1988.847778f,-71.143738f,328.647614f},
  275. {2024.004150f,-40.749989f,327.876617f},
  276. {2018.806885f,-3.451158f,327.593933f},
  277. {1978.651001f,18.373478f,328.420532f},
  278. {1940.641602f,1.761525f, 327.921661f},
  279. {1941.203735f,-52.999535f,327.246948f},
  280. };
  281.  
  282. static LocationsXY SanityWellLoc[]=
  283. {
  284. {1901.237915f, -46.305782f, 331.960754f},
  285. {1900.753052f, -2.259287f, 332.061249f},
  286. {1991.020996f, 43.943943f, 331.746979f},
  287. {2044.219482f, -21.878244f, 329.776855f},
  288. {1986.226807f, -95.087761f, 330.253998f},
  289. };
  290.  
  291. static LocationsXY KeepersLoc[]=
  292. {
  293. {2036.859863f, -74.113884f, 338.415222f, 2.488684f}, //thorim
  294. {1938.328247f, -90.742043f, 338.459442f, 0.992500f}, //hodir
  295. {2036.107056f, 25.702380f, 338.415192f, 4.019527f}, // freya
  296. {1939.021240f, 43.221031f, 338.460663f, 5.214388f}, // mimiron
  297. };
  298.  
  299. static LocationsXY TeleportLoc[]=
  300. {
  301. {1941.587402f, 43.526680f, 239.666336f}, // stormwind
  302. {2055.460938f, -25.619570f, 239.721176f}, // dragons
  303. {1941.131226f, -94.654694f, 239.989639f}, // icecrown
  304. {1951.097f, -25.420f, 326.162f}, // yogg
  305. };
  306.  
  307. static LocationsXY YoggPortalLoc[]=
  308. {
  309. {1959.765137f, -20.697853f, 325.352966f},
  310. {1973.407837f, -6.656567f, 324.889526f},
  311. {1990.271851f, -47.992981f, 324.959991f},
  312. {1978.893433f, -49.858326f, 324.777618f},
  313. {1967.471924f, -46.298458f, 324.840759f},
  314. {1959.654297f, -39.954502f, 324.997253f},
  315. {1956.343872f, -25.642859f, 325.188354f},
  316. {1985.072021f, -2.515451f, 325.20010f},
  317. {1993.541626f, -10.527716f, 324.889587f},
  318. {2003.674316f, -23.050785f, 325.384064f},
  319. };
  320.  
  321. static LocationsXY MadnessPortalLoc[]=
  322. {
  323. {2001.015f, 4.185f, 242.747f},
  324. {1999.690f, -54.931f, 242.418f},
  325. {1946.898f, -25.769f, 242.169f},
  326. };
  327. // vison pos
  328. //Positional defines
  329. struct VisionLocXY
  330. {
  331. float x, y, z, o;
  332. uint32 id;
  333. };
  334. // dragons
  335. const float PosYsera[4] = {2114.504f, -16.118f, 242.646f, 3.91f};
  336. const float PosMalygos[4] = {2113.388f, -34.381f, 242.646f, 2.26f};
  337. const float PosNeltharion[4] = {2117.588f, -25.318f, 242.646f, 3.15f};
  338. const float PosAlexstrasza[4] = {2091.679f, -25.289f, 242.646f, 6.282f};
  339. const float PosVoiceDragon[3] = {2104.555f, -25.635f, 242.646f};
  340. const float DisplayDragons[10] = {2718, 2718, 2717, 2717, 12869, 12869, 1687, 1687, 2719, 2719};
  341.  
  342. static VisionLocXY DragonLoc[]=
  343. {
  344. {2071.951660f, 1.881840f, 239.794922f, 5.590341f},
  345. {2093.910156f, 19.939915f, 239.766830f, 4.962034f},
  346. {2114.737061f, 20.441664f, 239.757309f, 4.259104f},
  347. {2136.709473f, 4.874056f, 239.718658f, 3.889961f},
  348. {2147.894287f, -12.416141f, 239.757980f, 3.210588f},
  349. {2148.479004f, -37.655373f, 239.720169f, 3.033874f},
  350. {2136.296631f, -56.800838f, 239.754654f, 2.287745f},
  351. {2114.370117f, -68.110947f, 239.721100f, 1.789017f},
  352. {2093.946289f, -67.447899f, 239.720734f, 1.305995f},
  353. {2071.001709f, -54.414040f, 239.719345f, 0.528450f},
  354. };
  355.  
  356. static VisionLocXY SkullDragonLoc[]=
  357. {
  358. {2075.898193f, -5.637041f, 239.787735f},
  359. {2137.949219f, -26.778023f, 239.717712f},
  360. {2084.131836f, -52.716999f, 239.720703f},
  361. };
  362.  
  363. // stormwind
  364. const float PosGarona[4] = {1935.398926f, 54.017738f, 240.376465f, 2.008213f};
  365. const float PosKing[4] = {1930.465670f, 62.674065f, 242.376373f, 5.196925f};
  366. const float PosVoiceStormwind[3] = {1927.326f, 68.120f, 242.376f};
  367.  
  368. static VisionLocXY KeepLoc[]=
  369. {
  370. {1930.854370f, 39.910034f, 239.666443f, 1.641476f},
  371. {1909.771240f, 45.685230f, 239.666443f, 0.962106f},
  372. {1898.966309f, 64.644989f, 239.666443f, 0.157073f},
  373. {1904.273926f, 85.369118f, 239.666443f, 5.662714f},
  374. {1923.474487f, 96.419815f, 239.666443f, 4.826267f},
  375. {1944.612061f, 91.062439f, 239.666443f, 4.076213f},
  376. {1955.231079f, 71.870926f, 239.666443f, 3.255475f},
  377. {1949.701416f, 51.040390f, 239.666443f, 2.481856f},
  378. };
  379.  
  380. static VisionLocXY SkullKeepLoc[]=
  381. {
  382. {1908.942261f, 58.934380f, 239.666382f},
  383. {1916.902954f, 86.755638f, 239.66662f},
  384. {1944.789307f, 78.614716f, 239.666382f},
  385. };
  386.  
  387. // lich king
  388. const float PosLichKing[4] = {1910.499268f,-147.709961f,239.989639f, 0.943203f};
  389. const float PosChampion[4] = {1915.371094f,-139.934219f,239.989639f, 4.159409f};
  390. const float PosVoiceIcecrown[3] = {1914.332f, -139.317f, 239.989f};
  391.  
  392. static VisionLocXY IcecrownLoc[]=
  393. {
  394. {1952.521606f, -137.052094f, 239.989716f, 2.513270f},
  395. {1946.220337f, -130.236008f, 239.989716f, 5.387829f},
  396. {1942.029541f, -136.833328f, 239.989716f, 0.192416f},
  397. {1896.965210f, -104.922951f, 239.989716f, 5.647007f},
  398. {1904.356079f, -113.879349f, 239.989716f, 2.163766f},
  399. {1907.664795f, -106.186508f, 239.989716f, 2.976653f},
  400. {1919.831421f, -131.184784f, 239.989716f, 4.213656f},
  401. {1919.120728f, -145.960281f, 239.989716f, 1.908511f},
  402. {1907.462891f, -139.149307f, 239.989716f, 0.176708f},
  403. };
  404.  
  405. static VisionLocXY SkullIcecrownLoc[]=
  406. {
  407. {1962.658569f, -111.356392f, 239.98986f},
  408. {1940.515625f, -152.933945f, 239.989868f},
  409. {1889.130371f, -122.932549f, 239.98986f},
  410. {1908.828003f, -88.593613f, 239.98986f},
  411. };
  412.  
  413. // location of the minds eye:
  414. // X: 1981.422974 Y: -22.442831 Z: 236.104813
  415.  
  416. // transfer from brain
  417. // X: 1951.097412 Y: -25.420420 Z: 326.162598 Orientation: 0.131792
  418. // brain room portal loc:
  419. // sara -> type_flags = 108; original
  420.  
  421. // Yogg Saron, main event controller
  422. struct MANGOS_DLL_DECL boss_yogg_saronAI : public ScriptedAI
  423. {
  424. boss_yogg_saronAI(Creature* pCreature) : ScriptedAI(pCreature)
  425. {
  426. m_pInstance = (instance_ulduar*)pCreature->GetInstanceData();
  427. m_bIsRegularMode = pCreature->GetMap()->IsRegularDifficulty();
  428. SetCombatMovement(false);
  429. Reset();
  430. }
  431.  
  432. instance_ulduar* m_pInstance;
  433. bool m_bIsRegularMode;
  434.  
  435. uint32 m_uiBerserkTimer;
  436. uint32 m_uiSanityTimer;
  437. uint32 m_uiKeepersActive;
  438.  
  439. uint32 m_uiSummonGuardianTimer;
  440. uint32 m_uiSummonGuardianCounter;
  441.  
  442. uint32 m_uiLunaticGazaTimer;
  443. uint32 m_uiShadowBeaconTimer;
  444. uint32 m_uiEmpoweringShadowsTimer;
  445. uint32 m_uiSummonTimer;
  446. uint32 m_uiSummonCrusherTentacleTimer; // ~ 40 sek
  447. uint32 m_uiSummonCorruptorTentacleTimer; // ~ 30 sek
  448. uint32 m_uiSummonConstrictorTentacleTimer; // ~ 10 sek
  449. uint32 m_uiDeafeningRoarTimer;
  450.  
  451. GUIDList m_lKeeperGUID;
  452.  
  453. void Reset()
  454. {
  455. DoCast(m_creature, SPELL_CLEAR_INSANE, true);
  456.  
  457. m_uiSanityTimer = 10000;
  458. m_uiKeepersActive = 0;
  459.  
  460. // phase 1
  461. m_uiSummonGuardianTimer = 10000;
  462. m_uiSummonGuardianCounter = 0;
  463. // phase 3
  464. m_uiLunaticGazaTimer = 20000;
  465. m_uiShadowBeaconTimer = 15000;
  466. m_uiEmpoweringShadowsTimer = 60000;
  467. m_uiSummonTimer = 40000;
  468. m_uiSummonCrusherTentacleTimer = urand(35000, 45000);
  469. m_uiSummonCorruptorTentacleTimer = urand(25000, 35000);
  470. m_uiSummonConstrictorTentacleTimer = urand(7000, 13000);
  471.  
  472. m_uiDeafeningRoarTimer = 30000;
  473. m_uiBerserkTimer = 900000; // 15 min
  474.  
  475. m_creature->SetVisibility(VISIBILITY_OFF);
  476.  
  477. if(m_creature->HasAura(SPELL_SHADOWY_BARRIER_YOGG))
  478. m_creature->RemoveAurasDueToSpell(SPELL_SHADOWY_BARRIER_YOGG);
  479.  
  480. m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
  481.  
  482. if(m_pInstance)
  483. {
  484. m_pInstance->SetData(TYPE_YOGG_PHASE, PHASE_IDLE);
  485. m_pInstance->SetData(TYPE_VISION_PHASE, PHASE_VISION_RETURN);
  486. m_pInstance->SetData(TYPE_YOGGSARON, FAIL);
  487. }
  488. for (GUIDList::iterator iter = m_lKeeperGUID.begin(); iter != m_lKeeperGUID.end(); ++iter)
  489. {
  490. if (Creature* pTemp = m_creature->GetMap()->GetCreature(*iter))
  491. {
  492. pTemp->ForcedDespawn();
  493. }
  494. }
  495. m_lKeeperGUID.clear();
  496. }
  497.  
  498. void Aggro(Unit *who)
  499. {
  500. m_creature->SetInCombatWithZone();
  501. m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
  502. DoCast(m_creature, SPELL_SANITY_TRIGG, true);
  503. DoCast(m_creature, SPELL_INSANE_TRIGG, true);
  504.  
  505. if(m_pInstance)
  506. {
  507. m_pInstance->SetData(TYPE_YOGGSARON, IN_PROGRESS);
  508. m_pInstance->SetData(TYPE_YOGG_PHASE, PHASE_SARA);
  509. // summon thorim
  510. if(m_pInstance->GetData(TYPE_KEEPER_THORIM) == DONE)
  511. {
  512. if (Creature* pThorim = m_creature->SummonCreature(KEEPER_THORIM, KeepersLoc[0].x, KeepersLoc[0].y, KeepersLoc[0].z, KeepersLoc[0].o, TEMPSUMMON_MANUAL_DESPAWN, 0))
  513. {
  514. DoScriptText(SAY_THORIM_ACTIVE, pThorim);
  515. m_lKeeperGUID.push_back(pThorim->GetObjectGuid());
  516. m_uiKeepersActive += 1;
  517. }
  518. }
  519. // summon hodir
  520. if(m_pInstance->GetData(TYPE_KEEPER_HODIR) == DONE)
  521. {
  522. if (Creature* pHodir = m_creature->SummonCreature(KEEPER_HODIR, KeepersLoc[1].x, KeepersLoc[1].y, KeepersLoc[1].z, KeepersLoc[1].o, TEMPSUMMON_MANUAL_DESPAWN, 0))
  523. {
  524. DoScriptText(SAY_HODIR_ACTIVE, pHodir);
  525. m_lKeeperGUID.push_back(pHodir->GetObjectGuid());
  526. m_uiKeepersActive += 1;
  527. }
  528. }
  529. // summon freya
  530. if(m_pInstance->GetData(TYPE_KEEPER_FREYA) == DONE)
  531. {
  532. if (Creature* pFreya = m_creature->SummonCreature(KEEPER_FREYA, KeepersLoc[2].x, KeepersLoc[2].y, KeepersLoc[2].z, KeepersLoc[2].o, TEMPSUMMON_MANUAL_DESPAWN, 0))
  533. {
  534. DoScriptText(SAY_FREYA_ACTIVE, pFreya);
  535. m_lKeeperGUID.push_back(pFreya->GetObjectGuid());
  536. m_uiKeepersActive += 1;
  537. }
  538. }
  539. // summon mimiron
  540. if(m_pInstance->GetData(TYPE_KEEPER_MIMIRON) == DONE)
  541. {
  542. if (Creature* pMimiron = m_creature->SummonCreature(KEEPER_MIMIRON, KeepersLoc[3].x, KeepersLoc[3].y, KeepersLoc[3].z, KeepersLoc[3].o, TEMPSUMMON_MANUAL_DESPAWN, 0))
  543. {
  544. DoScriptText(SAY_MIMIRON_ACTIVE, pMimiron);
  545. m_lKeeperGUID.push_back(pMimiron->GetObjectGuid());
  546. m_uiKeepersActive += 1;
  547. }
  548. }
  549. switch (m_uiKeepersActive)
  550. {
  551. case 0:
  552. m_pInstance->SetSpecialAchievementCriteria(TYPE_ACHIEV_ALONE, true);
  553. case 1:
  554. m_pInstance->SetSpecialAchievementCriteria(TYPE_ACHIEV_ONE_LIGHT, true);
  555. case 2:
  556. m_pInstance->SetSpecialAchievementCriteria(TYPE_ACHIEV_TWO_LIGHTS, true);
  557. case 3:
  558. m_pInstance->SetSpecialAchievementCriteria(TYPE_ACHIEV_THREE_LIGHTS, true);
  559. }
  560.  
  561. if(Creature* pSara = m_pInstance->GetSingleCreatureFromStorage(NPC_SARA))
  562. DoScriptText(SAY_AGGRO, pSara);
  563. }
  564. }
  565.  
  566. void JustReachedHome()
  567. {
  568. if (m_pInstance)
  569. m_pInstance->SetData(TYPE_YOGGSARON, FAIL);
  570. }
  571.  
  572. void KilledUnit(Unit* pVictim)
  573. {
  574. DoScriptText(urand(0,1) ? SAY_SLAY1 : SAY_SLAY2, m_creature);
  575. }
  576.  
  577. void JustDied(Unit *killer)
  578. {
  579. DoCast(m_creature, SPELL_CLEAR_INSANE, true);
  580. DoScriptText(SAY_DEATH, m_creature);
  581. if(m_pInstance)
  582. {
  583. m_pInstance->SetData(TYPE_YOGGSARON, DONE);
  584. m_pInstance->SetData(TYPE_YOGGSARON_HARD, FAIL);
  585. m_pInstance->SetData(TYPE_YOGGSARON_HARD_4, FAIL);
  586.  
  587. if(m_uiKeepersActive == 0)
  588. {
  589. m_pInstance->SetData(TYPE_YOGGSARON_HARD_4, DONE);
  590. m_pInstance->SetData(TYPE_YOGGSARON_HARD, DONE);
  591. }
  592. else if (m_uiKeepersActive == 1)
  593. {
  594. m_pInstance->SetData(TYPE_YOGGSARON_HARD, DONE);
  595. }
  596. else if (m_uiKeepersActive == 2)
  597. {
  598. m_pInstance->SetData(TYPE_YOGGSARON_HARD, FAIL);
  599. }
  600. else if (m_uiKeepersActive == 3)
  601. {
  602. m_pInstance->SetData(TYPE_YOGGSARON_HARD, FAIL);
  603. }
  604. }
  605.  
  606. if(Creature* pSara = m_pInstance->GetSingleCreatureFromStorage(NPC_SARA))
  607. {
  608. if(pSara->isAlive())
  609. pSara->DealDamage(pSara, pSara->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
  610. }
  611.  
  612. if (Creature* pYoggBrain = m_pInstance->GetSingleCreatureFromStorage(NPC_YOGG_BRAIN))
  613. {
  614. if(pYoggBrain->isAlive())
  615. pYoggBrain->DealDamage(pYoggBrain, pYoggBrain->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
  616. }
  617. }
  618.  
  619. void StartSecondPhase()
  620. {
  621. m_creature->SetVisibility(VISIBILITY_ON);
  622. DoCast(m_creature, SPELL_SHADOWY_BARRIER_YOGG);
  623. m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
  624.  
  625. if (m_pInstance)
  626. {
  627. //remove Clouds
  628. for(GUIDList::iterator iter = m_pInstance->m_lCLoudGuids.begin(); iter != m_pInstance->m_lCLoudGuids.end(); ++iter)
  629. if (Creature *pTmp = m_pInstance->instance->GetCreature(*iter))
  630. pTmp->ForcedDespawn();
  631. }
  632.  
  633. m_uiSummonTimer = urand(3000, 7000);
  634. }
  635.  
  636. void StartThirdPhase()
  637. {
  638. DoScriptText(SAY_PHASE3, m_creature);
  639. m_creature->RemoveAurasDueToSpell(SPELL_SHADOWY_BARRIER_YOGG);
  640. m_creature->SetHealth(m_creature->GetMaxHealth() * 0.3);
  641.  
  642. m_uiSummonTimer = urand(15000, 20000);
  643.  
  644. if(Creature* pSara = m_pInstance->GetSingleCreatureFromStorage(NPC_SARA))
  645. pSara->ForcedDespawn();
  646.  
  647. if (Creature* pYoggBrain = m_pInstance->GetSingleCreatureFromStorage(NPC_YOGG_BRAIN))
  648. pYoggBrain->DealDamage(pYoggBrain, pYoggBrain->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
  649. }
  650.  
  651. void SummonTentacle(uint32 pEntry)
  652. {
  653. float creatureDist = 0;
  654. creatureDist = urand(20, 45);
  655.  
  656. // set coordonates
  657. float angle = (float) rand()*360/RAND_MAX + 1;
  658. float homeX = m_creature->GetPositionX() + creatureDist*cos(angle*(M_PI/180));
  659. float homeY = m_creature->GetPositionY() + creatureDist*sin(angle*(M_PI/180));
  660. float homeZ = m_creature->GetTerrain()->GetWaterOrGroundLevel(homeX, homeY, m_creature->GetPositionZ());
  661. // summon tentacle
  662. if(Creature *pTemp = m_creature->SummonCreature(pEntry, homeX, homeY, homeZ, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 180000))
  663. pTemp->SetInCombatWithZone();
  664. }
  665.  
  666. void UpdateAI(const uint32 uiDiff)
  667. {
  668. if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
  669. return;
  670.  
  671. switch(m_pInstance->GetData(TYPE_YOGG_PHASE))
  672. {
  673. case PHASE_SARA:
  674. // Friendly Sara phase: see script below
  675. {
  676. if (m_uiSummonGuardianTimer < uiDiff)
  677. {
  678. DoCast(m_creature, SPELL_SUMMON_GUARDIAN); // with Script Target to Cloud
  679. m_uiSummonGuardianTimer = 25000 - (700 * m_uiSummonGuardianCounter++);
  680. if (m_uiSummonGuardianTimer < 3000)
  681. m_uiSummonGuardianTimer = 3000;
  682. }
  683. else
  684. m_uiSummonGuardianTimer -= uiDiff;
  685.  
  686. break;
  687. }
  688. case PHASE_TENTACLES:
  689. {
  690. // Yogg Saron is Stun, no timer change and no summon
  691. if (m_creature->HasAura(64173))
  692. return;
  693.  
  694. // summon tentacles
  695. if (m_uiSummonConstrictorTentacleTimer < uiDiff)
  696. {
  697. if (m_pInstance)
  698. {
  699. if (Player* pPlayer = m_pInstance->GetPlayerInMap(true, false))
  700. {
  701. if (pPlayer->GetPositionZ() > LAYERCUT)
  702. {
  703. pPlayer->CastSpell(pPlayer, SPELL_SUMMON_CONSTRICTOR, true, 0, 0, m_creature->GetObjectGuid());
  704. m_uiSummonConstrictorTentacleTimer = urand(13000, 20000);
  705. }
  706. }
  707. }
  708. }
  709. else m_uiSummonConstrictorTentacleTimer -= uiDiff;
  710.  
  711. if (m_uiSummonCorruptorTentacleTimer < uiDiff)
  712. {
  713. SummonTentacle(MOB_CORRUPTOR_TENTACLE);
  714. //DoCast(m_creature, SPELL_SUMMON_CORRUPTOR, true);
  715. m_uiSummonCorruptorTentacleTimer = urand(20000, 35000);
  716. }
  717. else m_uiSummonCorruptorTentacleTimer -= uiDiff;
  718.  
  719. if (m_uiSummonCrusherTentacleTimer < uiDiff)
  720. {
  721. SummonTentacle(MOB_CRUSHER_TENTACLE);
  722. //DoCast(m_creature, SPELL_SUMMON_CRUSHER, true);
  723. m_uiSummonCrusherTentacleTimer = urand(350000, 45000);
  724. }
  725. else m_uiSummonCrusherTentacleTimer -= uiDiff;
  726.  
  727. break;
  728. }
  729. case PHASE_OLD_GOD:
  730. {
  731. if (m_uiSummonTimer < uiDiff)
  732. {
  733. // spell 64158 radius to high
  734. if(Creature *pTemp = m_creature->SummonCreature(MOB_IMMORTAL_GUARDIAN, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 180000))
  735. pTemp->SetInCombatWithZone();
  736. m_uiSummonTimer = 30000;
  737. }
  738. else m_uiSummonTimer -= uiDiff;
  739.  
  740. if (m_uiLunaticGazaTimer < uiDiff)
  741. {
  742. DoCast(m_creature, SPELL_LUNATIC_GAZE_YOGG, true);
  743. m_uiLunaticGazaTimer = urand(10000, 13000);
  744. }
  745. else m_uiLunaticGazaTimer -= uiDiff;
  746.  
  747. if (m_uiEmpoweringShadowsTimer < uiDiff)
  748. {
  749. DoCast(m_creature, SPELL_SHADOW_BEACON, true); // with script target to guardian
  750. m_uiEmpoweringShadowsTimer = 45000;
  751. }
  752. else m_uiEmpoweringShadowsTimer -= uiDiff;
  753.  
  754. if (m_uiDeafeningRoarTimer < uiDiff && !m_bIsRegularMode && m_uiKeepersActive < 4)
  755. {
  756. DoCast(m_creature, SPELL_DEAFENING_ROAR, true);
  757. m_uiDeafeningRoarTimer = 30000;
  758. }
  759. else m_uiDeafeningRoarTimer -= uiDiff;
  760.  
  761. break;
  762. }
  763. }
  764.  
  765. // extinguish all life
  766. if (m_uiBerserkTimer < uiDiff)
  767. {
  768. DoCast(m_creature, SPELL_BERSERK);
  769. m_uiBerserkTimer = 10000;
  770. }
  771. else m_uiBerserkTimer -= uiDiff;
  772. }
  773. };
  774.  
  775. struct MANGOS_DLL_DECL mob_madness_portalAI : public ScriptedAI
  776. {
  777. mob_madness_portalAI(Creature* pCreature) : ScriptedAI(pCreature)
  778. {
  779. m_pInstance = (instance_ulduar*)pCreature->GetInstanceData();
  780. m_bIsRegularMode = pCreature->GetMap()->IsRegularDifficulty();
  781. SetCombatMovement(false);
  782. Reset();
  783. }
  784.  
  785. instance_ulduar* m_pInstance;
  786. bool m_bIsRegularMode;
  787.  
  788. uint8 m_uiDestination;
  789. uint32 m_uiCheckTimer;
  790. bool m_bHasTeleported;
  791.  
  792. void Reset()
  793. {
  794. m_uiCheckTimer = 500;
  795. m_bHasTeleported = false;
  796. m_creature->SetRespawnDelay(DAY);
  797. }
  798.  
  799. void UpdateAI(const uint32 uiDiff)
  800. {
  801. if(m_creature->GetPositionZ() < LAYERCUT)
  802. m_uiDestination = PHASE_VISION_RETURN;
  803.  
  804. // this uses the Type_vision_phase in order to set vision destination
  805. if(m_uiCheckTimer < uiDiff && !m_bHasTeleported)
  806. {
  807. if (m_bHasTeleported)
  808. {
  809. m_creature->ForcedDespawn();
  810. return;
  811. }
  812. Map *map = m_creature->GetMap();
  813. if (map->IsDungeon())
  814. {
  815. Map::PlayerList const &PlayerList = map->GetPlayers();
  816.  
  817. if (PlayerList.isEmpty())
  818. return;
  819.  
  820. for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
  821. {
  822. if (i->getSource()->isAlive() && m_creature->GetDistance2d(i->getSource()) < 2)
  823. {
  824. if (i->getSource()->HasAura(63988) || m_creature->GetPositionZ() < LAYERCUT) // with Buff Illusion Room always teleport back or if the portal in brain chamber
  825. {
  826. i->getSource()->CastSpell(i->getSource(), SPELL_TELEPORT_BACK_TO_MAIN_ROOM, true);
  827. i->getSource()->RemoveAurasDueToSpell(63988); // remove Illusion Room buff
  828. }
  829. else
  830. {
  831. switch(m_pInstance->GetData(TYPE_VISION_PHASE))
  832. {
  833. case PHASE_VISION_STORMWIND:
  834. i->getSource()->CastSpell(i->getSource(), SPELL_TELEPORT_TO_STORMWIND_ILLUSION, true);
  835. m_bHasTeleported = true;
  836. break;
  837. case PHASE_VISION_WYRMREST:
  838. i->getSource()->CastSpell(i->getSource(), SPELL_TELEPORT_TO_CHAMBER_ILLUSION, true);
  839. m_bHasTeleported = true;
  840. break;
  841. case PHASE_VISION_ICECROWN:
  842. i->getSource()->CastSpell(i->getSource(), SPELL_TELEPORT_TO_ICEECROWN_ILLUSION, true);
  843. m_bHasTeleported = true;
  844. break;
  845. case PHASE_VISION_RETURN: // for save
  846. default:
  847. i->getSource()->CastSpell(i->getSource(), SPELL_TELEPORT_BACK_TO_MAIN_ROOM, true);
  848. i->getSource()->RemoveAurasDueToSpell(63988); // remove Illusion Room buff
  849. break;
  850. }
  851. }
  852. i->getSource()->RemoveAurasDueToSpell(63802); // remove Brain Link
  853. }
  854. }
  855. }
  856. m_uiCheckTimer = 500;
  857. }else m_uiCheckTimer -= uiDiff;
  858. }
  859. };
  860.  
  861. struct MANGOS_DLL_DECL boss_brain_of_yogg_saronAI : public ScriptedAI
  862. {
  863. boss_brain_of_yogg_saronAI(Creature* pCreature) : ScriptedAI(pCreature)
  864. {
  865. m_pInstance = (instance_ulduar*)pCreature->GetInstanceData();
  866. m_bIsRegularMode = pCreature->GetMap()->IsRegularDifficulty();
  867. SetCombatMovement(false);
  868. Reset();
  869. }
  870.  
  871. instance_ulduar* m_pInstance;
  872. bool m_bIsRegularMode;
  873.  
  874. uint32 m_uiVisionPhase;
  875. uint32 m_uiSpeechTimer;
  876. uint32 m_uiMadnessTimer;
  877. uint32 m_uiTentacleCheckTimer;
  878.  
  879. bool m_bIsPhaseFinished;
  880. bool m_bIsVisionFinished;
  881. bool m_bHasShattered;
  882.  
  883. ObjectGuid m_uiLichKingGUID;
  884. ObjectGuid m_uiChampionGUID;
  885. ObjectGuid m_uiGaronaGUID;
  886. ObjectGuid m_uiKingLlaneGUID;
  887. ObjectGuid m_uiNeltharionGUID;
  888. ObjectGuid m_uiMalygosGUID;
  889. ObjectGuid m_uiYseraGUID;
  890. ObjectGuid m_uiVoiceOfYoggGUID;
  891.  
  892. GUIDList m_lVisionTentacle;
  893.  
  894. void Reset()
  895. {
  896. m_bIsPhaseFinished = false;
  897. m_bIsVisionFinished = false;
  898. m_bHasShattered = false;
  899. m_uiLichKingGUID.Clear();
  900. m_uiChampionGUID.Clear();
  901. m_uiGaronaGUID.Clear();
  902. m_uiKingLlaneGUID.Clear();
  903. m_uiNeltharionGUID.Clear();
  904. m_uiMalygosGUID.Clear();
  905. m_uiYseraGUID.Clear();
  906. m_uiVoiceOfYoggGUID.Clear();
  907.  
  908. m_uiVisionPhase = 0;
  909. m_uiSpeechTimer = 1000;
  910. m_creature->SetHealth(m_creature->GetMaxHealth());
  911. m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
  912.  
  913. if(m_pInstance)
  914. m_pInstance->SetData(TYPE_YOGG_BRAIN, NOT_STARTED);
  915.  
  916. if (m_pInstance)
  917. {
  918. // close doors on reset
  919. if(GameObject* pVisionDoor = m_pInstance->GetSingleGameObjectFromStorage(GO_BRAIN_DOOR1))
  920. pVisionDoor->SetGoState(GO_STATE_READY);
  921. if(GameObject* pVisionDoor = m_pInstance->GetSingleGameObjectFromStorage(GO_BRAIN_DOOR2))
  922. pVisionDoor->SetGoState(GO_STATE_READY);
  923. if(GameObject* pVisionDoor = m_pInstance->GetSingleGameObjectFromStorage(GO_BRAIN_DOOR3))
  924. pVisionDoor->SetGoState(GO_STATE_READY);
  925. }
  926. }
  927.  
  928. // for debug
  929. void Aggro(Unit *who)
  930. {
  931. // For vision debug only
  932. //StartVisions();
  933. //m_pInstance->SetData(TYPE_VISION_PHASE, PHASE_VISION_STORMWIND);
  934. //m_creature->GetMotionMaster()->MoveIdle();
  935. //m_creature->GetMap()->CreatureRelocation(m_creature, m_creature->GetPositionX(), m_creature->GetPositionY(), 255.011f, 0.0f);
  936. //m_creature->SendMonsterMove(m_creature->GetPositionX(), m_creature->GetPositionY(), 255.011f, SPLINETYPE_NORMAL, m_creature->GetSplineFlags(), 1);
  937. }
  938.  
  939. void DamageTaken(Unit *done_by, uint32 &uiDamage)
  940. {
  941. if(uiDamage > 0 && !m_bHasShattered)
  942. {
  943. DoCast(m_creature, SPELL_SHATTERED_ILLUSION, true); // script Target auf Yogg Saron und Tentakeln
  944. m_bHasShattered = true;
  945. }
  946. }
  947.  
  948. void SummonPortals()
  949. {
  950. for(uint8 i = 0; i < 3; i++)
  951. m_creature->SummonCreature(MOB_DESCEND_INTO_MADNESS, MadnessPortalLoc[i].x, MadnessPortalLoc[i].y, MadnessPortalLoc[i].z, 0, TEMPSUMMON_TIMED_DESPAWN, 60000);
  952. }
  953.  
  954. void StartVisions()
  955. {
  956. DoCast(m_creature, SPELL_INDUCE_MADNESS);
  957. m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
  958. m_uiVisionPhase = 0;
  959. m_uiSpeechTimer = 1000;
  960. m_uiTentacleCheckTimer = 1000;
  961. m_uiMadnessTimer = 60000;
  962. m_bIsVisionFinished = false;
  963. m_bHasShattered = false;
  964. for(GUIDList::iterator itr = m_lVisionTentacle.begin(); itr != m_lVisionTentacle.end(); itr++)
  965. {
  966. if (Creature* pVisionTentacle = m_creature->GetMap()->GetCreature(*itr))
  967. {
  968. pVisionTentacle->ForcedDespawn();
  969. }
  970. }
  971. m_lVisionTentacle.clear();
  972.  
  973. }
  974.  
  975. // check if all the tentacles are dead
  976. bool IsThereAnyAdd(WorldObject *pSource)
  977. {
  978. for(GUIDList::iterator itr = m_lVisionTentacle.begin(); itr != m_lVisionTentacle.end(); itr++)
  979. {
  980. if (Creature* pVisionTentacle = m_creature->GetMap()->GetCreature(*itr))
  981. {
  982. if (pVisionTentacle->isAlive())
  983. return true;
  984. }
  985. }
  986.  
  987. if(m_pInstance)
  988. {
  989. // open doors
  990. switch(m_pInstance->GetData(TYPE_VISION_PHASE))
  991. {
  992. case PHASE_VISION_STORMWIND:
  993. if(GameObject* pVisionDoor = m_pInstance->GetSingleGameObjectFromStorage(GO_BRAIN_DOOR3))
  994. pVisionDoor->SetGoState(GO_STATE_ACTIVE);
  995. break;
  996. case PHASE_VISION_WYRMREST:
  997. if(GameObject* pVisionDoor = m_pInstance->GetSingleGameObjectFromStorage(GO_BRAIN_DOOR1))
  998. pVisionDoor->SetGoState(GO_STATE_ACTIVE);
  999. break;
  1000. case PHASE_VISION_ICECROWN:
  1001. if(GameObject* pVisionDoor = m_pInstance->GetSingleGameObjectFromStorage(GO_BRAIN_DOOR2))
  1002. pVisionDoor->SetGoState(GO_STATE_ACTIVE);
  1003. break;
  1004. }
  1005. }
  1006. return false;
  1007. }
  1008.  
  1009. void UpdateAI(const uint32 uiDiff)
  1010. {
  1011. switch(m_pInstance->GetData(TYPE_VISION_PHASE))
  1012. {
  1013. case PHASE_VISION_STORMWIND:
  1014. {
  1015. if(m_uiSpeechTimer < uiDiff)
  1016. {
  1017. switch(m_uiVisionPhase)
  1018. {
  1019. case 0:
  1020. if(Creature* Garona = m_creature->SummonCreature(NPC_GARONA, PosGarona[0], PosGarona[1], PosGarona[2], PosGarona[3], TEMPSUMMON_TIMED_DESPAWN, 60000))
  1021. m_uiGaronaGUID = Garona->GetObjectGuid();
  1022. if(Creature* KingLlane = m_creature->SummonCreature(NPC_KING_LLANE, PosKing[0], PosKing[1], PosKing[2], PosKing[3], TEMPSUMMON_TIMED_DESPAWN, 60000))
  1023. m_uiKingLlaneGUID = KingLlane->GetObjectGuid();
  1024. if(Creature* VoiceOfYogg = m_creature->SummonCreature(NPC_VOICE_OF_YOGG_SARON, PosVoiceStormwind[0], PosVoiceStormwind[1], PosVoiceStormwind[2], 0, TEMPSUMMON_TIMED_DESPAWN, 60000))
  1025. {
  1026. m_uiVoiceOfYoggGUID = VoiceOfYogg->GetObjectGuid();
  1027. VoiceOfYogg->SetDisplayId(11686); // make invisible
  1028. }
  1029. for(uint8 i = 0; i < 8; i++)
  1030. {
  1031. if(Creature *pTemp = m_creature->SummonCreature(MOB_VISION_TENTACLE, KeepLoc[i].x, KeepLoc[i].y, KeepLoc[i].z, KeepLoc[i].o, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 80000))
  1032. {
  1033. m_lVisionTentacle.push_back(pTemp->GetObjectGuid());
  1034. pTemp->SetDisplayId(28621);
  1035. pTemp->SetMaxHealth(m_bIsRegularMode ? 15000 : 40000);
  1036. pTemp->setFaction(7);
  1037. pTemp->CastSpell(pTemp, SPELL_GRIM_REPRISAL, false);
  1038. }
  1039. }
  1040. for(uint8 i = 0; i < 3; i++)
  1041. m_creature->SummonCreature(NPC_LAUGHING_SKULL, SkullKeepLoc[i].x, SkullKeepLoc[i].y, SkullKeepLoc[i].z, 0, TEMPSUMMON_TIMED_DESPAWN, 80000);
  1042. ++m_uiVisionPhase;
  1043. m_uiSpeechTimer = 1000;
  1044. break;
  1045. case 1:
  1046. if(Creature* Garona = m_pInstance->instance->GetCreature(m_uiGaronaGUID))
  1047. DoScriptText(SAY_GARONA1, Garona);
  1048. ++m_uiVisionPhase;
  1049. m_uiSpeechTimer = 12000;
  1050. break;
  1051. case 2:
  1052. if(Creature* Garona = m_pInstance->instance->GetCreature(m_uiGaronaGUID))
  1053. DoScriptText(SAY_GARONA2, Garona);
  1054. ++m_uiVisionPhase;
  1055. m_uiSpeechTimer = 12000;
  1056. break;
  1057. case 3:
  1058. if(Creature* VoiceOfYogg = m_pInstance->instance->GetCreature(m_uiVoiceOfYoggGUID))
  1059. DoScriptText(SAY_YOGG_V1_1, VoiceOfYogg);
  1060. ++m_uiVisionPhase;
  1061. m_uiSpeechTimer = 4000;
  1062. break;
  1063. case 4:
  1064. if(Creature* VoiceOfYogg = m_pInstance->instance->GetCreature(m_uiVoiceOfYoggGUID))
  1065. DoScriptText(SAY_YOGG_V1_2, VoiceOfYogg);
  1066. ++m_uiVisionPhase;
  1067. m_uiSpeechTimer = 4000;
  1068. break;
  1069. case 5:
  1070. if(Creature* KingLlane = m_pInstance->instance->GetCreature(m_uiKingLlaneGUID))
  1071. DoScriptText(SAY_GARONA3, KingLlane);
  1072. ++m_uiVisionPhase;
  1073. m_uiSpeechTimer = 6000;
  1074. break;
  1075. case 6:
  1076. if(Creature* Garona = m_pInstance->instance->GetCreature(m_uiGaronaGUID))
  1077. {
  1078. Garona->GetMotionMaster()->MovePoint(0, 1931.348f, 61.033f, 241.709f);
  1079. }
  1080. if(Creature* KingLlane = m_pInstance->instance->GetCreature(m_uiKingLlaneGUID))
  1081. {
  1082. DoScriptText(SAY_ILANE, KingLlane);
  1083. }
  1084. ++m_uiVisionPhase;
  1085. m_uiSpeechTimer = 6000;
  1086. break;
  1087. case 7:
  1088. if(Creature* Garona = m_pInstance->instance->GetCreature(m_uiGaronaGUID))
  1089. {
  1090. DoScriptText(SAY_GARONA4, Garona);
  1091. if(Creature* KingLlane = m_pInstance->instance->GetCreature(m_uiKingLlaneGUID))
  1092. {
  1093. KingLlane->SetStandState(UNIT_STAND_STATE_DEAD);
  1094. KingLlane->SetHealth(0);
  1095. Garona->Attack(KingLlane, true);
  1096. }
  1097. }
  1098. ++m_uiVisionPhase;
  1099. m_uiSpeechTimer = 6000;
  1100. break;
  1101. case 8:
  1102. if(Creature* Garona = m_pInstance->instance->GetCreature(m_uiGaronaGUID))
  1103. Garona->AttackStop();
  1104. if(Creature* VoiceOfYogg = m_pInstance->instance->GetCreature(m_uiVoiceOfYoggGUID))
  1105. DoScriptText(SAY_YOGG_V1_3, VoiceOfYogg);
  1106. ++m_uiVisionPhase;
  1107. m_uiSpeechTimer = 8000;
  1108. break;
  1109. default:
  1110. m_uiSpeechTimer = 100000;
  1111. }
  1112. }
  1113. else m_uiSpeechTimer -= uiDiff;
  1114.  
  1115. break;
  1116. }
  1117. case PHASE_VISION_WYRMREST:
  1118. {
  1119. if(m_uiSpeechTimer < uiDiff)
  1120. {
  1121. switch(m_uiVisionPhase)
  1122. {
  1123. case 0:
  1124. m_creature->SummonCreature(NPC_ALEXSTRASZA, PosAlexstrasza[0], PosAlexstrasza[1], PosAlexstrasza[2], PosAlexstrasza[3], TEMPSUMMON_TIMED_DESPAWN, 60000);
  1125. if(Creature* Neltharion = m_creature->SummonCreature(NPC_NELTHARION, PosNeltharion[0], PosNeltharion[1], PosNeltharion[2], PosNeltharion[3], TEMPSUMMON_TIMED_DESPAWN, 60000))
  1126. m_uiNeltharionGUID = Neltharion->GetObjectGuid();
  1127. if(Creature* Malygos = m_creature->SummonCreature(NPC_MALYGOS, PosMalygos[0], PosMalygos[1], PosMalygos[2], PosMalygos[3], TEMPSUMMON_TIMED_DESPAWN, 60000))
  1128. m_uiMalygosGUID = Malygos->GetObjectGuid();
  1129. if(Creature* Ysera = m_creature->SummonCreature(NPC_YSERA, PosYsera[0], PosYsera[1], PosYsera[2], PosYsera[3], TEMPSUMMON_TIMED_DESPAWN, 60000))
  1130. m_uiYseraGUID = Ysera->GetObjectGuid();
  1131. if(Creature* VoiceOfYogg = m_creature->SummonCreature(NPC_VOICE_OF_YOGG_SARON, PosVoiceDragon[0], PosVoiceDragon[1], PosVoiceDragon[2], 0, TEMPSUMMON_TIMED_DESPAWN, 60000))
  1132. {
  1133. m_uiVoiceOfYoggGUID = VoiceOfYogg->GetObjectGuid();
  1134. VoiceOfYogg->SetVisibility(VISIBILITY_OFF);
  1135. }
  1136. for(uint8 i = 0; i < 10; i++)
  1137. {
  1138. if(Creature *pTemp = m_creature->SummonCreature(MOB_VISION_TENTACLE, DragonLoc[i].x, DragonLoc[i].y, DragonLoc[i].z, DragonLoc[i].o, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 80000))
  1139. {
  1140. m_lVisionTentacle.push_back(pTemp->GetObjectGuid());
  1141. pTemp->SetDisplayId(DisplayDragons[i]);
  1142. pTemp->SetMaxHealth(m_bIsRegularMode ? 15000 : 40000);
  1143. pTemp->setFaction(7);
  1144. pTemp->CastSpell(pTemp, SPELL_GRIM_REPRISAL, false);
  1145. }
  1146. }
  1147. for(uint8 i = 0; i < 3; i++)
  1148. m_creature->SummonCreature(NPC_LAUGHING_SKULL, SkullDragonLoc[i].x, SkullDragonLoc[i].y, SkullDragonLoc[i].z, 0, TEMPSUMMON_TIMED_DESPAWN, 80000);
  1149. ++m_uiVisionPhase;
  1150. m_uiSpeechTimer = 1000;
  1151. break;
  1152. case 1:
  1153. if(Creature* Neltharion = m_pInstance->instance->GetCreature(m_uiNeltharionGUID))
  1154. DoScriptText(SAY_NELTHARION1, Neltharion);
  1155. ++m_uiVisionPhase;
  1156. m_uiSpeechTimer = 10000;
  1157. break;
  1158. case 2:
  1159. if(Creature* Ysera = m_pInstance->instance->GetCreature(m_uiYseraGUID))
  1160. DoScriptText(SAY_YSERA, Ysera);
  1161. ++m_uiVisionPhase;
  1162. m_uiSpeechTimer = 7000;
  1163. break;
  1164. case 3:
  1165. if(Creature* Neltharion = m_pInstance->instance->GetCreature(m_uiNeltharionGUID))
  1166. DoScriptText(SAY_NELTHARION2, Neltharion);
  1167. ++m_uiVisionPhase;
  1168. m_uiSpeechTimer = 6000;
  1169. break;
  1170. case 4:
  1171. if(Creature* Malygos = m_pInstance->instance->GetCreature(m_uiMalygosGUID))
  1172. DoScriptText(SAY_MALYGOS, Malygos);
  1173. ++m_uiVisionPhase;
  1174. m_uiSpeechTimer = 9000;
  1175. break;
  1176. case 5:
  1177. if(Creature* VoiceOfYogg = m_pInstance->instance->GetCreature(m_uiVoiceOfYoggGUID))
  1178. DoScriptText(SAY_YOGG_V2, VoiceOfYogg);
  1179. ++m_uiVisionPhase;
  1180. m_uiSpeechTimer = 10000;
  1181. break;
  1182. default:
  1183. m_uiSpeechTimer = 100000;
  1184. }
  1185. }else m_uiSpeechTimer -= uiDiff;
  1186.  
  1187. break;
  1188. }
  1189. case PHASE_VISION_ICECROWN:
  1190. {
  1191. if(m_uiSpeechTimer < uiDiff)
  1192. {
  1193. switch(m_uiVisionPhase)
  1194. {
  1195. case 0:
  1196. if(Creature* LichKing = m_creature->SummonCreature(NPC_LICH_KING, PosLichKing[0], PosLichKing[1], PosLichKing[2], PosLichKing[3], TEMPSUMMON_TIMED_DESPAWN, 60000))
  1197. m_uiLichKingGUID = LichKing->GetObjectGuid();
  1198. if(Creature* Champion = m_creature->SummonCreature(NPC_IMMOLATED_CHAMPION, PosChampion[0], PosChampion[1], PosChampion[2], PosChampion[3], TEMPSUMMON_TIMED_DESPAWN, 60000))
  1199. m_uiChampionGUID = Champion->GetObjectGuid();
  1200. if(Creature* VoiceOfYogg = m_creature->SummonCreature(NPC_VOICE_OF_YOGG_SARON, PosVoiceIcecrown[0], PosVoiceIcecrown[1], PosVoiceIcecrown[2], 0, TEMPSUMMON_TIMED_DESPAWN, 60000))
  1201. {
  1202. m_uiVoiceOfYoggGUID = VoiceOfYogg->GetObjectGuid();
  1203. VoiceOfYogg->SetVisibility(VISIBILITY_OFF);
  1204. }
  1205. for(uint8 i = 0; i < 9; i++)
  1206. {
  1207. if(Creature *pTemp = m_creature->SummonCreature(MOB_VISION_TENTACLE, IcecrownLoc[i].x, IcecrownLoc[i].y, IcecrownLoc[i].z, IcecrownLoc[i].o, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 80000))
  1208. {
  1209. m_lVisionTentacle.push_back(pTemp->GetObjectGuid());
  1210. pTemp->SetMaxHealth(m_bIsRegularMode ? 15000 : 40000);
  1211. pTemp->SetDisplayId(25627);
  1212. pTemp->setFaction(7);
  1213. pTemp->CastSpell(pTemp, SPELL_GRIM_REPRISAL, false);
  1214. }
  1215. }
  1216. for(uint8 i = 0; i < 4; i++)
  1217. m_creature->SummonCreature(NPC_LAUGHING_SKULL, SkullIcecrownLoc[i].x, SkullIcecrownLoc[i].y, SkullIcecrownLoc[i].z, 0, TEMPSUMMON_TIMED_DESPAWN, 80000);
  1218. ++m_uiVisionPhase;
  1219. m_uiSpeechTimer = 1000;
  1220. break;
  1221. case 1:
  1222. if(Creature* Champion = m_pInstance->instance->GetCreature(m_uiChampionGUID))
  1223. {
  1224. Champion->SetStandFlags(UNIT_STAND_STATE_KNEEL);
  1225. if(Creature* LichKing = m_pInstance->instance->GetCreature(m_uiLichKingGUID))
  1226. {
  1227. LichKing->CastSpell(Champion, 54142, false);
  1228. DoScriptText(SAY_LICH_KING1, LichKing);
  1229. }
  1230. }
  1231. ++m_uiVisionPhase;
  1232. m_uiSpeechTimer = 5000;
  1233. break;
  1234. case 2:
  1235. if(Creature* Champion = m_pInstance->instance->GetCreature(m_uiChampionGUID))
  1236. DoScriptText(SAY_CHAMPION1, Champion);
  1237. ++m_uiVisionPhase;
  1238. m_uiSpeechTimer = 8000;
  1239. break;
  1240. case 3:
  1241. if(Creature* Champion = m_pInstance->instance->GetCreature(m_uiChampionGUID))
  1242. DoScriptText(SAY_CHAMPION2, Champion);
  1243. ++m_uiVisionPhase;
  1244. m_uiSpeechTimer = 8000;
  1245. break;
  1246. case 4:
  1247. if(Creature* LichKing = m_pInstance->instance->GetCreature(m_uiLichKingGUID))
  1248. DoScriptText(SAY_LICH_KING2, LichKing);
  1249. ++m_uiVisionPhase;
  1250. m_uiSpeechTimer = 7000;
  1251. break;
  1252. case 5:
  1253. if(Creature* VoiceOfYogg = m_pInstance->instance->GetCreature(m_uiVoiceOfYoggGUID))
  1254. DoScriptText(SAY_YOGG_V3_1, VoiceOfYogg);
  1255. ++m_uiVisionPhase;
  1256. m_uiSpeechTimer = 5000;
  1257. break;
  1258. case 6:
  1259. if(Creature* VoiceOfYogg = m_pInstance->instance->GetCreature(m_uiVoiceOfYoggGUID))
  1260. DoScriptText(SAY_YOGG_V3_2, VoiceOfYogg);
  1261. ++m_uiVisionPhase;
  1262. m_uiSpeechTimer = 10000;
  1263. break;
  1264. default:
  1265. m_uiSpeechTimer = 100000;
  1266. }
  1267. }else m_uiSpeechTimer -= uiDiff;
  1268.  
  1269. break;
  1270. }
  1271. }
  1272.  
  1273. // End phase after 30%
  1274. if(m_creature->GetHealthPercent() < 30 && !m_bIsPhaseFinished)
  1275. {
  1276. if(m_pInstance)
  1277. {
  1278. m_pInstance->SetData(TYPE_YOGG_BRAIN, DONE);
  1279. m_pInstance->SetData(TYPE_YOGG_PHASE, PHASE_OLD_GOD);
  1280. if(Creature* pYogg = m_pInstance->GetSingleCreatureFromStorage(NPC_YOGGSARON))
  1281. ((boss_yogg_saronAI*)pYogg->AI())->StartThirdPhase();
  1282. }
  1283. m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
  1284. DoCast(m_creature, SPELL_SHATTERED_ILLUSION2, true);
  1285. m_bIsPhaseFinished = true;
  1286. }
  1287.  
  1288. // check if tentacles are dead
  1289. if (m_uiTentacleCheckTimer < uiDiff && !m_bIsVisionFinished)
  1290. {
  1291. if(Creature* VoiceOfYogg = m_pInstance->instance->GetCreature(m_uiVoiceOfYoggGUID))
  1292. {
  1293. if(!IsThereAnyAdd(VoiceOfYogg))
  1294. {
  1295. SummonPortals();
  1296. m_pInstance->SetData(TYPE_VISION_PHASE, PHASE_VISION_RETURN);
  1297. m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
  1298. m_uiTentacleCheckTimer = 300000;
  1299. }
  1300. else
  1301. m_uiTentacleCheckTimer = 500;
  1302. }
  1303. }
  1304. else m_uiTentacleCheckTimer -= uiDiff;
  1305.  
  1306. // make boss unattackable -> exploit check
  1307. if (m_uiMadnessTimer < uiDiff)
  1308. {
  1309. DoCast(m_creature, SPELL_SHATTERED_ILLUSION2, true);
  1310. m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
  1311. m_bIsVisionFinished = true;
  1312. m_uiMadnessTimer = 300000;
  1313. }
  1314. else m_uiMadnessTimer -= uiDiff;
  1315. }
  1316. };
  1317.  
  1318. // Sara script
  1319. struct MANGOS_DLL_DECL boss_saraAI : public ScriptedAI
  1320. {
  1321. boss_saraAI(Creature* pCreature) : ScriptedAI(pCreature)
  1322. {
  1323. m_pInstance = (instance_ulduar*)pCreature->GetInstanceData();
  1324. m_bIsRegularMode = pCreature->GetMap()->IsRegularDifficulty();
  1325. m_bIsIntroDone = false;
  1326. Reset();
  1327. }
  1328.  
  1329. instance_ulduar* m_pInstance;
  1330. bool m_bIsRegularMode;
  1331.  
  1332. // intro
  1333. bool m_bIsIntro;
  1334. uint32 m_uiIntro_Phase;
  1335. uint32 m_uiSpeech_Timer;
  1336. bool m_bIsIntroDone;
  1337. bool m_bIsFactionSet;
  1338.  
  1339. // phase 1
  1340. uint32 m_uiPhaseYellTimer;
  1341. uint32 m_uiSarasFervorTimer;
  1342. uint32 m_uiSarasBlessingTimer;
  1343. uint32 m_uiSarasAngerTimer;
  1344. uint32 m_uiAllVisions;
  1345.  
  1346. // transition
  1347. bool m_bIsOutro;
  1348. uint32 m_uiOutroTimer;
  1349. uint32 m_uiOutroStep;
  1350.  
  1351. // phase 2
  1352. uint32 m_uiPsychosisTimer;
  1353. uint32 m_uiPortalsTimer;
  1354. uint32 m_uiMaladyTimer;
  1355. uint32 m_uiBrainLinkTimer;
  1356. uint32 m_uiDeathRaySummonTimer;
  1357.  
  1358. uint32 m_uiFirstVision;
  1359. uint32 m_uiSecondVision;
  1360.  
  1361. void Reset()
  1362. {
  1363. // intro
  1364. m_bIsIntro = false;
  1365. m_uiIntro_Phase = 0;
  1366. m_uiSpeech_Timer = 1000;
  1367. m_bIsFactionSet = false;
  1368.  
  1369. // phase 1
  1370. m_uiPhaseYellTimer = 30000;
  1371. m_uiSarasFervorTimer = urand(10000, 15000);
  1372. m_uiSarasBlessingTimer = urand(15000, 20000);
  1373. m_uiSarasAngerTimer = urand(20000, 25000);
  1374. m_uiAllVisions = 0;
  1375.  
  1376. // transition
  1377. m_bIsOutro = false;
  1378. m_uiOutroTimer = 10000;
  1379. m_uiOutroStep = 1;
  1380.  
  1381. // phase 2
  1382. m_uiPortalsTimer = 60000;
  1383. m_uiPsychosisTimer = 15000;
  1384. m_uiMaladyTimer = 20000;
  1385. m_uiBrainLinkTimer = 25000;
  1386. m_uiDeathRaySummonTimer = 30000;
  1387.  
  1388. m_uiFirstVision = 0;
  1389. m_uiSecondVision = 0;
  1390.  
  1391. if(m_creature->HasAura(SPELL_SHADOWY_BARRIER))
  1392. m_creature->RemoveAurasDueToSpell(SPELL_SHADOWY_BARRIER);
  1393.  
  1394. m_creature->SetDisplayId(MODEL_SARA_HUMAN);
  1395. m_creature->setFaction(35);
  1396. m_creature->SetMaxHealth(199999);
  1397. m_creature->SetHealth(m_creature->GetMaxHealth());
  1398. m_creature->SetUInt32Value(UNIT_FIELD_BYTES_0, 50331648);
  1399. m_creature->SetUInt32Value(UNIT_FIELD_BYTES_1, 50331648);
  1400. m_creature->SetLevitate(true);
  1401. m_creature->GetMotionMaster()->MovePoint(0, m_creature->GetPositionX(), m_creature->GetPositionY(), 329.397f);
  1402. }
  1403.  
  1404. void KilledUnit(Unit* pVictim)
  1405. {
  1406. DoScriptText(urand (0,1) ? SAY_KILL1 : SAY_KILL2, m_creature);
  1407. }
  1408.  
  1409. void DamageTaken(Unit *done_by, uint32 &uiDamage)
  1410. {
  1411. if(uiDamage > m_creature->GetHealth())
  1412. {
  1413. m_bIsOutro = true;
  1414. m_creature->SetHealth(m_creature->GetMaxHealth());
  1415. uiDamage = 0;
  1416. }
  1417. }
  1418.  
  1419. void MoveInLineOfSight(Unit* pWho)
  1420. {
  1421. // start intro speech
  1422. if(m_pInstance->GetData(TYPE_YOGG_PHASE) == PHASE_IDLE)
  1423. {
  1424. if (pWho->isTargetableForAttack() && pWho->isInAccessablePlaceFor(m_creature) && !m_bIsIntro && !m_bIsIntroDone &&
  1425. pWho->GetTypeId() == TYPEID_PLAYER && m_creature->IsWithinDistInMap(pWho, 60) && m_creature->IsWithinLOSInMap(pWho))
  1426. m_bIsIntro = true;
  1427. }
  1428. }
  1429.  
  1430. // return a random npc from the selected entry
  1431. Creature* SelectRandomNpc(float fRange, uint32 uiEntry)
  1432. {
  1433. std::list<Creature* > lNpcList;
  1434. GetCreatureListWithEntryInGrid(lNpcList, m_creature, uiEntry, fRange);
  1435.  
  1436. //This should not appear!
  1437. if (lNpcList.empty()){
  1438. return NULL;
  1439. }
  1440.  
  1441. std::list<Creature* >::iterator iter = lNpcList.begin();
  1442. advance(iter, urand(0, lNpcList.size()-1));
  1443.  
  1444. return *iter;
  1445. }
  1446.  
  1447. void SummonPortals()
  1448. {
  1449. uint8 maxPortals = m_bIsRegularMode ? 4 : 10;
  1450. for(uint8 i = 0; i < maxPortals; i++)
  1451. m_creature->SummonCreature(MOB_DESCEND_INTO_MADNESS, YoggPortalLoc[i].x, YoggPortalLoc[i].y, YoggPortalLoc[i].z, 0, TEMPSUMMON_TIMED_DESPAWN, 60000);
  1452. }
  1453.  
  1454. // set a random vision
  1455. uint32 GetCurrentVision()
  1456. {
  1457. switch(urand(0, 2))
  1458. {
  1459. case 0:
  1460. return PHASE_VISION_STORMWIND;
  1461. break;
  1462. case 1:
  1463. return PHASE_VISION_WYRMREST;
  1464. break;
  1465. case 2:
  1466. return PHASE_VISION_ICECROWN;
  1467. break;
  1468. }
  1469.  
  1470. return 0;
  1471. }
  1472.  
  1473. // start a vision
  1474. void SetVisionPhase()
  1475. {
  1476. uint32 m_uiVisionType = 0;
  1477.  
  1478. // set random different destination
  1479. if(m_uiFirstVision == 0 && m_uiSecondVision == 0)
  1480. {
  1481. m_uiVisionType = GetCurrentVision();
  1482. m_uiFirstVision = m_uiVisionType;
  1483. }
  1484. else if(m_uiSecondVision == 0)
  1485. {
  1486. do
  1487. {
  1488. m_uiVisionType = GetCurrentVision();
  1489. }
  1490. while(m_uiVisionType == m_uiFirstVision);
  1491. m_uiSecondVision = m_uiVisionType;
  1492. }
  1493. else
  1494. {
  1495. do
  1496. {
  1497. m_uiVisionType = GetCurrentVision();
  1498. }
  1499. while(m_uiVisionType == m_uiFirstVision || m_uiVisionType == m_uiSecondVision);
  1500. }
  1501.  
  1502. // set instance data for vision
  1503. if(m_uiVisionType != 0)
  1504. m_pInstance->SetData(TYPE_VISION_PHASE, m_uiVisionType);
  1505.  
  1506. // summon portals
  1507. SummonPortals();
  1508. // start the vision
  1509. if (Creature* pYoggBrain = m_pInstance->GetSingleCreatureFromStorage(NPC_YOGG_BRAIN))
  1510. {
  1511. if(pYoggBrain->isAlive())
  1512. ((boss_brain_of_yogg_saronAI*)pYoggBrain->AI())->StartVisions();
  1513. }
  1514. // increase the vision no.
  1515. m_uiAllVisions += 1;
  1516. }
  1517.  
  1518. void UpdateAI(const uint32 uiDiff)
  1519. {
  1520. switch(m_pInstance->GetData(TYPE_YOGG_PHASE))
  1521. {
  1522. case PHASE_IDLE:
  1523. {
  1524. // intro
  1525. if (m_bIsIntro && !m_bIsIntroDone)
  1526. {
  1527. if(m_uiSpeech_Timer < uiDiff)
  1528. {
  1529. switch(m_uiIntro_Phase)
  1530. {
  1531. case 0:
  1532. DoScriptText(SAY_INTRO1, m_creature);
  1533. m_creature->SetUInt32Value(UNIT_FIELD_BYTES_0, 50331648);
  1534. m_creature->SetUInt32Value(UNIT_FIELD_BYTES_1, 50331648);
  1535. m_creature->GetMotionMaster()->MoveIdle();
  1536. SetCombatMovement(false);
  1537. m_creature->GetMap()->CreatureRelocation(m_creature, m_creature->GetPositionX(), m_creature->GetPositionY(), 329.397f, 5.9f);
  1538. ++m_uiIntro_Phase;
  1539. m_uiSpeech_Timer = 8000;
  1540. break;
  1541. case 1:
  1542. DoScriptText(SAY_INTRO2, m_creature);
  1543. ++m_uiIntro_Phase;
  1544. m_uiSpeech_Timer = 8000;
  1545. break;
  1546. case 2:
  1547. if(Creature* pYogg = m_pInstance->GetSingleCreatureFromStorage(NPC_YOGGSARON))
  1548. pYogg->SetInCombatWithZone();
  1549. m_bIsIntro = false;
  1550. m_bIsIntroDone = true;
  1551. m_uiSpeech_Timer = 12000;
  1552. break;
  1553. default:
  1554. m_uiSpeech_Timer = 100000;
  1555. }
  1556. }
  1557. else m_uiSpeech_Timer -= uiDiff;
  1558. }
  1559. break;
  1560. }
  1561. case PHASE_SARA:
  1562. {
  1563. if(!m_bIsOutro)
  1564. {
  1565. // wipe check
  1566. if(Creature* pYogg = m_pInstance->GetSingleCreatureFromStorage(NPC_YOGGSARON))
  1567. {
  1568. if(!pYogg->getVictim() || !pYogg->SelectHostileTarget() || pYogg->getVictim() == m_creature)
  1569. {
  1570. pYogg->getThreatManager().modifyThreatPercent(m_creature, -100);
  1571. if (pYogg->getThreatManager().getThreatList().size() <= 2)
  1572. {
  1573. pYogg->AI()->EnterEvadeMode();
  1574. DoScriptText(SAY_WIPE, m_creature);
  1575. }
  1576. }
  1577. }
  1578.  
  1579. if (m_uiPhaseYellTimer < uiDiff)
  1580. {
  1581. DoScriptText(urand(0,1) ? SAY_HELP1 : SAY_HELP2, m_creature);
  1582. m_uiPhaseYellTimer = 30000;
  1583. }
  1584. else
  1585. m_uiPhaseYellTimer -= uiDiff;
  1586.  
  1587. if (m_uiSarasFervorTimer < uiDiff)
  1588. {
  1589. if(Creature* pYogg = m_pInstance->GetSingleCreatureFromStorage(NPC_YOGGSARON))
  1590. {
  1591. if (Unit* pTarget = pYogg->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0, (uint32)0, SELECT_FLAG_PLAYER))
  1592. {
  1593. if (DoCastSpellIfCan(pTarget, SPELL_SARAS_FERVOR) == CAST_OK)
  1594. {
  1595. m_uiSarasFervorTimer = urand(20000, 30000);
  1596. }
  1597. }
  1598. }
  1599. }
  1600. else
  1601. m_uiSarasFervorTimer -= uiDiff;
  1602.  
  1603. if (m_uiSarasBlessingTimer < uiDiff)
  1604. {
  1605. if(Creature* pYogg = m_pInstance->GetSingleCreatureFromStorage(NPC_YOGGSARON))
  1606. {
  1607. if (Unit* pTarget = pYogg->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0, (uint32)0, SELECT_FLAG_PLAYER))
  1608. {
  1609. if (DoCastSpellIfCan(pTarget, SPELL_SARAS_BLESSING) == CAST_OK)
  1610. {
  1611. m_uiSarasBlessingTimer = urand(20000, 30000);
  1612. }
  1613. }
  1614. }
  1615. }
  1616. else
  1617. m_uiSarasBlessingTimer -= uiDiff;
  1618.  
  1619. if (m_uiSarasAngerTimer < uiDiff)
  1620. {
  1621. if (Creature* pGuardian = SelectRandomNpc(80.0f, MOB_GUARDIAN_OF_YOGG))
  1622. {
  1623. if (DoCastSpellIfCan(pGuardian, SPELL_SARAS_ANGER) == CAST_OK)
  1624. m_uiSarasAngerTimer = urand(20000, 30000);
  1625. }
  1626. }
  1627. else
  1628. m_uiSarasAngerTimer -= uiDiff;
  1629. }
  1630. // Phase 1 outro
  1631. if(m_bIsOutro)
  1632. {
  1633. switch(m_uiOutroStep)
  1634. {
  1635. case 1:
  1636. m_creature->SetHealth(m_creature->GetMaxHealth());
  1637. m_creature->CombatStop(true);
  1638. m_creature->InterruptNonMeleeSpells(false);
  1639. ++m_uiOutroStep;
  1640. m_uiOutroTimer = 5000;
  1641. break;
  1642. case 3:
  1643. DoScriptText(SAY_PHASE2, m_creature);
  1644. ++m_uiOutroStep;
  1645. m_uiOutroTimer = 15000;
  1646. break;
  1647. case 5:
  1648. if(Creature* pYogg = m_pInstance->GetSingleCreatureFromStorage(NPC_YOGGSARON))
  1649. {
  1650. if (Unit* pTarget = pYogg->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
  1651. {
  1652. m_creature->AddThreat(pTarget, 100.0f);
  1653. m_creature->AI()->AttackStart(pTarget);
  1654. }
  1655. }
  1656. m_creature->setFaction(14);
  1657. m_creature->SetInCombatWithZone();
  1658. SetCombatMovement(false);
  1659. m_creature->GetMotionMaster()->MoveIdle();
  1660. m_creature->SetDisplayId(MODEL_SARA_VALKYR);
  1661. DoCast(m_creature, SPELL_SHADOWY_BARRIER);
  1662. m_creature->SetHealth(m_creature->GetMaxHealth());
  1663. m_creature->GetMap()->CreatureRelocation(m_creature, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ() + 10, 5.9f);
  1664. m_creature->GetMotionMaster()->MovePoint(0,m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ() + 10);
  1665. if(Creature* pYogg = m_pInstance->GetSingleCreatureFromStorage(NPC_YOGGSARON))
  1666. ((boss_yogg_saronAI*)pYogg->AI())->StartSecondPhase();
  1667. m_uiPhaseYellTimer = 30000 + urand(5000, 10000);
  1668. m_pInstance->SetData(TYPE_YOGG_PHASE, PHASE_TENTACLES);
  1669. ++m_uiOutroStep;
  1670. m_uiOutroTimer = 3000;
  1671. break;
  1672. }
  1673. }
  1674. else return;
  1675.  
  1676. if (m_uiOutroTimer <= uiDiff)
  1677. {
  1678. ++m_uiOutroStep;
  1679. m_uiOutroTimer = 330000;
  1680. }
  1681. m_uiOutroTimer -= uiDiff;
  1682.  
  1683. break;
  1684. }
  1685. case PHASE_TENTACLES:
  1686. {
  1687. // wipe check
  1688. if(Creature* pYogg = m_pInstance->GetSingleCreatureFromStorage(NPC_YOGGSARON))
  1689. {
  1690. if(!pYogg->getVictim() || !pYogg->SelectHostileTarget() || pYogg->getVictim() == m_creature)
  1691. {
  1692. pYogg->getThreatManager().modifyThreatPercent(m_creature, -100);
  1693. if (pYogg->getThreatManager().getThreatList().size() <= 2)
  1694. {
  1695. pYogg->AI()->EnterEvadeMode();
  1696. DoScriptText(SAY_WIPE, m_creature);
  1697. }
  1698. }
  1699. }
  1700.  
  1701. if (m_uiPhaseYellTimer < uiDiff)
  1702. {
  1703. switch(urand(0, 1))
  1704. {
  1705. case 0: DoScriptText(SAY_SPECIAL1, m_creature); break;
  1706. case 1: DoScriptText(SAY_SPECIAL2, m_creature); break;
  1707. }
  1708. m_uiPhaseYellTimer = 30000 + urand(5000, 10000);
  1709. }
  1710. else m_uiPhaseYellTimer -= uiDiff;
  1711.  
  1712. // summon madness portals
  1713. if (m_uiPortalsTimer < uiDiff)
  1714. {
  1715. SetVisionPhase();
  1716. if(Creature* pYogg = m_pInstance->GetSingleCreatureFromStorage(NPC_YOGGSARON))
  1717. DoScriptText(SAY_VISION, pYogg);
  1718. m_uiPortalsTimer = 85000;
  1719. }
  1720. else m_uiPortalsTimer -= uiDiff;
  1721.  
  1722. if (m_uiPsychosisTimer < uiDiff)
  1723. {
  1724. if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
  1725. {
  1726. DoCast(pTarget, m_bIsRegularMode ? SPELL_PHYCHOSIS : SPELL_PHYCHOSIS_H);
  1727. m_uiPsychosisTimer = urand(15000, 20000);
  1728. }
  1729. }
  1730. else m_uiPsychosisTimer -= uiDiff;
  1731.  
  1732. if (m_uiMaladyTimer < uiDiff)
  1733. {
  1734. if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
  1735. DoCast(pTarget, SPELL_MALADY_OF_THE_MIND);
  1736. m_uiMaladyTimer = urand(20000, 25000);
  1737. }
  1738. else m_uiMaladyTimer -= uiDiff;
  1739.  
  1740. if (m_uiBrainLinkTimer < uiDiff)
  1741. {
  1742. DoCast(m_creature, SPELL_BRAIN_LINK);
  1743. m_uiBrainLinkTimer = urand(25000, 30000);
  1744. }
  1745. else m_uiBrainLinkTimer -= uiDiff;
  1746.  
  1747. if (m_uiDeathRaySummonTimer < uiDiff)
  1748. {
  1749. for(int32 count = 0; count < 4; ++count)
  1750. {
  1751. if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
  1752. {
  1753. if (pTarget->GetPositionZ() > LAYERCUT)
  1754. {
  1755. //DoCastSpellIfCan(pTarget, SPELL_DEATH_RAY_SUMMON, CAST_TRIGGERED); // spell doesn't work correct, therefor a manuell summon
  1756. m_creature->SummonCreature(MOB_DEATH_ORB, pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 18000);
  1757. }
  1758. else
  1759. count--;
  1760. }
  1761. }
  1762. m_uiDeathRaySummonTimer = 30000;
  1763. }
  1764. else m_uiDeathRaySummonTimer -= uiDiff;
  1765.  
  1766. break;
  1767. }
  1768. }
  1769. }
  1770. };
  1771.  
  1772. /*
  1773. * Keepers
  1774. */
  1775. struct MANGOS_DLL_DECL keeper_hodirAI : public ScriptedAI
  1776. {
  1777. keeper_hodirAI(Creature* pCreature) : ScriptedAI(pCreature)
  1778. {
  1779. m_pInstance = (instance_ulduar*)pCreature->GetInstanceData();
  1780. Reset();
  1781. }
  1782.  
  1783. instance_ulduar* m_pInstance;
  1784.  
  1785. uint32 m_uiHodirProtectivGazeTimer;
  1786.  
  1787. void Reset()
  1788. {
  1789. m_uiHodirProtectivGazeTimer = 30000;
  1790. m_creature->SetRespawnDelay(DAY);
  1791. DoCast(m_creature, SPELL_FORTITUDE_OF_FROST);
  1792. }
  1793.  
  1794. void UpdateAI(const uint32 uiDiff)
  1795. {
  1796. if (m_pInstance->GetData(TYPE_YOGGSARON) != IN_PROGRESS)
  1797. m_creature->ForcedDespawn();
  1798.  
  1799. if (m_uiHodirProtectivGazeTimer < uiDiff)
  1800. {
  1801. if(Unit* pTemp = DoSelectLowestHpFriendly(100.0f))
  1802. DoCast(pTemp, SPELL_HODIRS_PROTECTIVE_GAZE);
  1803. m_uiHodirProtectivGazeTimer = 30000 + urand(10000,30000);
  1804. }
  1805. else m_uiHodirProtectivGazeTimer -= uiDiff;
  1806. }
  1807. };
  1808.  
  1809. struct MANGOS_DLL_DECL keeper_freyaAI : public ScriptedAI
  1810. {
  1811. keeper_freyaAI(Creature* pCreature) : ScriptedAI(pCreature)
  1812. {
  1813. m_pInstance = (instance_ulduar*)pCreature->GetInstanceData();
  1814. Reset();
  1815. }
  1816.  
  1817. instance_ulduar* m_pInstance;
  1818.  
  1819. void Reset()
  1820. {
  1821. DoCast(m_creature, SPELL_RESILIENCE_OF_NATURE);
  1822. m_creature->SetRespawnDelay(DAY);
  1823. // Summon Wells
  1824. SummonSanityWells();
  1825. }
  1826.  
  1827. void SummonSanityWells()
  1828. {
  1829. for(uint8 i = 0; i < 5; i++)
  1830. m_creature->SummonCreature(MOB_SANITY_WELL, SanityWellLoc[i].x, SanityWellLoc[i].y, SanityWellLoc[i].z, 0, TEMPSUMMON_MANUAL_DESPAWN, 30000);
  1831. }
  1832.  
  1833. void UpdateAI(const uint32 uiDiff)
  1834. {
  1835. if (m_pInstance->GetData(TYPE_YOGGSARON) != IN_PROGRESS)
  1836. m_creature->ForcedDespawn();
  1837. }
  1838. };
  1839.  
  1840. struct MANGOS_DLL_DECL keeper_thorimAI : public ScriptedAI
  1841. {
  1842. keeper_thorimAI(Creature* pCreature) : ScriptedAI(pCreature)
  1843. {
  1844. m_pInstance = (instance_ulduar*)pCreature->GetInstanceData();
  1845. Reset();
  1846. }
  1847.  
  1848. instance_ulduar* m_pInstance;
  1849.  
  1850. bool m_bHasTitanicStorm;
  1851.  
  1852. void Reset()
  1853. {
  1854. m_bHasTitanicStorm = false;
  1855. m_creature->SetRespawnDelay(DAY);
  1856. DoCast(m_creature, SPELL_FURY_OF_THE_STORM);
  1857. }
  1858.  
  1859. void UpdateAI(const uint32 uiDiff)
  1860. {
  1861. if (m_pInstance->GetData(TYPE_YOGGSARON) != IN_PROGRESS)
  1862. m_creature->ForcedDespawn();
  1863.  
  1864. if (m_pInstance->GetData(TYPE_YOGG_PHASE) == PHASE_OLD_GOD && !m_bHasTitanicStorm)
  1865. {
  1866. DoCast(m_creature, SPELL_TITANIC_STORM);
  1867. m_bHasTitanicStorm = true;
  1868. }
  1869. }
  1870. };
  1871.  
  1872. struct MANGOS_DLL_DECL keeper_mimironAI : public ScriptedAI
  1873. {
  1874. keeper_mimironAI(Creature* pCreature) : ScriptedAI(pCreature)
  1875. {
  1876. m_pInstance = (instance_ulduar*)pCreature->GetInstanceData();
  1877. Reset();
  1878. }
  1879.  
  1880. instance_ulduar* m_pInstance;
  1881.  
  1882. uint32 m_uiDestabilizationMatrixTimer;
  1883. std::list<Creature*> lTentacleList;
  1884.  
  1885. void Reset()
  1886. {
  1887. lTentacleList.clear();
  1888. m_uiDestabilizationMatrixTimer = 10000;
  1889. m_creature->SetRespawnDelay(DAY);
  1890. DoCast(m_creature, SPELL_SPEED_OF_INVENTION);
  1891. }
  1892.  
  1893. Creature* SelectRandomTentacle(float fRange)
  1894. {
  1895. GetCreatureListWithEntryInGrid(lTentacleList, m_creature, MOB_CRUSHER_TENTACLE, fRange);
  1896. GetCreatureListWithEntryInGrid(lTentacleList, m_creature, MOB_CORRUPTOR_TENTACLE, fRange);
  1897.  
  1898. if (lTentacleList.empty()){
  1899. m_uiDestabilizationMatrixTimer = 30000;
  1900. return NULL;
  1901. }
  1902.  
  1903. std::list<Creature* >::iterator iter = lTentacleList.begin();
  1904. advance(iter, urand(0, lTentacleList.size()-1));
  1905.  
  1906. return *iter;
  1907. }
  1908.  
  1909. void UpdateAI(const uint32 uiDiff)
  1910. {
  1911. if (m_pInstance->GetData(TYPE_YOGGSARON) != IN_PROGRESS)
  1912. m_creature->ForcedDespawn();
  1913.  
  1914. if (m_pInstance->GetData(TYPE_YOGG_PHASE) == PHASE_TENTACLES)
  1915. {
  1916. if (m_uiDestabilizationMatrixTimer < uiDiff)
  1917. {
  1918. if(Unit* pTentacle = SelectRandomTentacle(120.0f))
  1919. DoCast(pTentacle, SPELL_DESTABILIZATION_MATRIX);
  1920. m_uiDestabilizationMatrixTimer = 30000 + urand(10000,30000);
  1921. lTentacleList.clear();
  1922. }
  1923. else m_uiDestabilizationMatrixTimer -= uiDiff;
  1924. }
  1925. }
  1926. };
  1927.  
  1928. /*
  1929. * Guardians
  1930. */
  1931. struct MANGOS_DLL_DECL mob_immortal_guardianAI : public ScriptedAI
  1932. {
  1933. mob_immortal_guardianAI(Creature* pCreature) : ScriptedAI(pCreature)
  1934. {
  1935. m_pInstance = (instance_ulduar*)pCreature->GetInstanceData();
  1936. m_bIsRegularMode = pCreature->GetMap()->IsRegularDifficulty();
  1937. pCreature->SetRespawnTime(WEEK * IN_MILLISECONDS);
  1938. Reset();
  1939. }
  1940.  
  1941. instance_ulduar* m_pInstance;
  1942. bool m_bIsRegularMode;
  1943.  
  1944. uint32 m_uiDrainLifeTimer;
  1945.  
  1946. void Reset()
  1947. {
  1948. m_creature->SetRespawnDelay(DAY);
  1949. DoCast(m_creature, SPELL_RECENTLY_SPAWNED, true);
  1950. DoCast(m_creature, SPELL_EMPOWERED_AURA, true);
  1951. }
  1952.  
  1953. void DamageTaken(Unit *done_by, uint32 &uiDamage)
  1954. {
  1955. if(m_creature->GetHealth() < uiDamage)
  1956. {
  1957. uiDamage = 0;
  1958. }
  1959. }
  1960.  
  1961. void UpdateAI(const uint32 uiDiff)
  1962. {
  1963. //if (m_pInstance && m_pInstance->GetData(TYPE_YOGGSARON) != IN_PROGRESS)
  1964. //m_creature->ForcedDespawn();
  1965.  
  1966. if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
  1967. return;
  1968.  
  1969. if (m_uiDrainLifeTimer < uiDiff)
  1970. {
  1971. if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
  1972. {
  1973. DoCast(pTarget, m_bIsRegularMode ? SPELL_DRAIN_LIFE : SPELL_DRAIN_LIFE_H, false);
  1974. m_uiDrainLifeTimer = urand(15000, 20000);
  1975. }
  1976. }else
  1977. m_uiDrainLifeTimer -= uiDiff;
  1978.  
  1979. DoMeleeAttackIfReady();
  1980. }
  1981. };
  1982.  
  1983. struct MANGOS_DLL_DECL mob_guardian_of_yogg_saronAI : public ScriptedAI
  1984. {
  1985. mob_guardian_of_yogg_saronAI(Creature* pCreature) : ScriptedAI(pCreature)
  1986. {
  1987. m_pInstance = (instance_ulduar*)pCreature->GetInstanceData();
  1988. m_bIsRegularMode = pCreature->GetMap()->IsRegularDifficulty();
  1989. Reset();
  1990. }
  1991.  
  1992. instance_ulduar* m_pInstance;
  1993. bool m_bIsRegularMode;
  1994.  
  1995. uint32 m_uiDarkVolleyTimer;
  1996. uint32 m_uiDieTimer;
  1997. uint32 m_uiDominateMindTimer;
  1998. bool m_bHasCasted;
  1999.  
  2000. void Reset()
  2001. {
  2002. m_uiDarkVolleyTimer = 10000;
  2003. m_uiDominateMindTimer = 30000;
  2004. m_bHasCasted = false;
  2005. m_creature->SetRespawnDelay(DAY);
  2006. }
  2007.  
  2008. void DamageTaken(Unit *done_by, uint32 &uiDamage)
  2009. {
  2010. if(uiDamage > m_creature->GetHealth())
  2011. {
  2012. uiDamage = 0;
  2013. if(!m_bHasCasted)
  2014. {
  2015. m_creature->InterruptNonMeleeSpells(false);
  2016. DoCast(m_creature, m_bIsRegularMode ? SPELL_SHADOW_NOVA : SPELL_SHADOW_NOVA_H);
  2017. m_bHasCasted = true;
  2018. m_uiDieTimer = 500;
  2019. }
  2020. }
  2021. }
  2022.  
  2023. void UpdateAI(const uint32 uiDiff)
  2024. {
  2025. if (m_pInstance && m_pInstance->GetData(TYPE_YOGGSARON) != IN_PROGRESS)
  2026. m_creature->ForcedDespawn();
  2027.  
  2028. if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
  2029. return;
  2030.  
  2031. // workaround that no atacck against sara
  2032. if(Creature* pSara = m_pInstance->GetSingleCreatureFromStorage(NPC_SARA))
  2033. {
  2034. if(m_creature->getVictim() == pSara)
  2035. {
  2036. m_creature->AddThreat(pSara, -100000.0f);
  2037. if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_BOTTOMAGGRO, 0))
  2038. m_creature->AddThreat(pTarget, 1000000.0f);
  2039. }
  2040. }
  2041.  
  2042. if (m_uiDarkVolleyTimer < uiDiff)
  2043. {
  2044. DoCast(m_creature, SPELL_DARK_VOLLEY);
  2045. m_uiDarkVolleyTimer = 15000;
  2046. }
  2047. else m_uiDarkVolleyTimer -= uiDiff;
  2048.  
  2049. if (m_uiDominateMindTimer < uiDiff)
  2050. {
  2051. if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
  2052. DoCast(pTarget, SPELL_DOMINATE_MIND);
  2053. m_uiDominateMindTimer = 30000;
  2054. }
  2055. else m_uiDominateMindTimer -= uiDiff;
  2056.  
  2057. if (m_uiDieTimer < uiDiff && m_bHasCasted)
  2058. m_creature->DealDamage(m_creature, m_creature->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
  2059. else m_uiDieTimer -= uiDiff;
  2060.  
  2061. DoMeleeAttackIfReady();
  2062. }
  2063. };
  2064.  
  2065. /*
  2066. * Tentacules
  2067. */
  2068. struct MANGOS_DLL_DECL mob_corruptor_tentacleAI : public ScriptedAI
  2069. {
  2070. mob_corruptor_tentacleAI(Creature* pCreature) : ScriptedAI(pCreature)
  2071. {
  2072. m_pInstance = (instance_ulduar*)pCreature->GetInstanceData();
  2073. m_bIsRegularMode = pCreature->GetMap()->IsRegularDifficulty();
  2074. SetCombatMovement(false);
  2075. Reset();
  2076. }
  2077.  
  2078. instance_ulduar* m_pInstance;
  2079. bool m_bIsRegularMode;
  2080.  
  2081. uint32 m_uiEruptTimer;
  2082. bool m_bHasErupted;
  2083. uint32 m_uiSpellTimer;
  2084.  
  2085. void Reset()
  2086. {
  2087. m_uiEruptTimer = 500;
  2088. m_bHasErupted = false;
  2089. m_uiSpellTimer = 10000;
  2090. m_creature->SetRespawnDelay(DAY);
  2091. }
  2092.  
  2093. void UpdateAI(const uint32 uiDiff)
  2094. {
  2095. if (m_pInstance && m_pInstance->GetData(TYPE_YOGGSARON) != IN_PROGRESS)
  2096. m_creature->ForcedDespawn();
  2097.  
  2098. if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
  2099. return;
  2100.  
  2101. if (m_uiEruptTimer < uiDiff && !m_bHasErupted)
  2102. {
  2103. DoCast(m_creature, SPELL_ERUPT);
  2104. m_bHasErupted = true;
  2105. }else m_uiEruptTimer -= uiDiff;
  2106.  
  2107. if (m_uiSpellTimer < uiDiff)
  2108. {
  2109. switch(urand(0, 3))
  2110. {
  2111. case 0:
  2112. if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
  2113. DoCast(pTarget, SPELL_BLACK_PLAGUE);
  2114. break;
  2115. case 1:
  2116. if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
  2117. DoCast(pTarget, SPELL_APATHY);
  2118. break;
  2119. case 2:
  2120. if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
  2121. DoCast(pTarget, SPELL_CURSE_OF_DOOM);
  2122. break;
  2123. case 3:
  2124. if (Unit* pTarget = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
  2125. DoCast(pTarget, SPELL_DRAINING_POISON);
  2126. break;
  2127. }
  2128. m_uiSpellTimer = urand(5000, 10000);
  2129. }
  2130. else m_uiSpellTimer -= uiDiff;
  2131.  
  2132. DoMeleeAttackIfReady();
  2133. }
  2134. };
  2135.  
  2136. struct MANGOS_DLL_DECL mob_constrictor_tentacleAI : public ScriptedAI
  2137. {
  2138. mob_constrictor_tentacleAI(Creature* pCreature) : ScriptedAI(pCreature)
  2139. {
  2140. m_pInstance = (instance_ulduar*)pCreature->GetInstanceData();
  2141. m_bIsRegularMode = pCreature->GetMap()->IsRegularDifficulty();
  2142. SetCombatMovement(false);
  2143. pCreature->SetRespawnTime(WEEK * IN_MILLISECONDS);
  2144. Reset();
  2145. }
  2146.  
  2147. bool m_bIsRegularMode;
  2148. instance_ulduar *m_pInstance;
  2149.  
  2150. uint32 m_uiEruptTimer;
  2151. bool m_bHasErupted;
  2152.  
  2153. uint32 m_uiSqueezeTimer;
  2154. ObjectGuid m_uiVictimGUID;
  2155.  
  2156. void Reset()
  2157. {
  2158. m_uiEruptTimer = 500;
  2159. m_bHasErupted = false;
  2160.  
  2161. m_uiSqueezeTimer = 1000;
  2162. m_creature->SetRespawnDelay(DAY);
  2163. }
  2164.  
  2165. void DamageTaken(Unit* pDoneBy, uint32 &uiDamage)
  2166. {
  2167. if (uiDamage > m_creature->GetHealth())
  2168. {
  2169. if (m_uiVictimGUID)
  2170. {
  2171. if (Unit* pVictim = m_creature->GetMap()->GetUnit( m_uiVictimGUID))
  2172. pVictim->RemoveAurasDueToSpell(m_bIsRegularMode ? SPELL_SQUEEZE : SPELL_SQUEEZE_H);
  2173. }
  2174. }
  2175. }
  2176.  
  2177. void JustDied(Unit* pKiller)
  2178. {
  2179. if (Unit* pVictim = m_creature->GetMap()->GetUnit( m_uiVictimGUID))
  2180. pVictim->RemoveAurasDueToSpell(m_bIsRegularMode ? SPELL_SQUEEZE : SPELL_SQUEEZE_H);
  2181.  
  2182. if (pKiller)
  2183. pKiller->RemoveAurasDueToSpell(m_bIsRegularMode ? SPELL_SQUEEZE : SPELL_SQUEEZE_H);
  2184. }
  2185.  
  2186. void KilledUnit(Unit* pVictim)
  2187. {
  2188. if (pVictim)
  2189. pVictim->RemoveAurasDueToSpell(m_bIsRegularMode ? SPELL_SQUEEZE : SPELL_SQUEEZE_H);
  2190. }
  2191.  
  2192. void UpdateAI(const uint32 uiDiff)
  2193. {
  2194. /*if (m_pInstance && m_pInstance->GetData(TYPE_YOGGSARON) != IN_PROGRESS)
  2195. {
  2196. if (Unit* pVictim = m_creature->GetMap()->GetUnit( m_uiVictimGUID))
  2197. pVictim->RemoveAurasDueToSpell(m_bIsRegularMode ? SPELL_SQUEEZE : SPELL_SQUEEZE_H);
  2198. m_creature->ForcedDespawn();
  2199. }*/
  2200.  
  2201. if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
  2202. return;
  2203.  
  2204. if (m_uiEruptTimer < uiDiff && !m_bHasErupted)
  2205. {
  2206. DoCast(m_creature, SPELL_ERUPT);
  2207. m_bHasErupted = true;
  2208. }else m_uiEruptTimer -= uiDiff;
  2209.  
  2210.  
  2211. if (m_uiSqueezeTimer < uiDiff)
  2212. {
  2213. if (Unit* pTarget = GetPlayerAtMinimumRange(5.0f))
  2214. {
  2215. pTarget->CastSpell(m_creature, SPELL_SQUEEZE_GRAB, true);
  2216. m_uiVictimGUID = pTarget->GetObjectGuid();
  2217. m_uiSqueezeTimer = 30000;
  2218. }
  2219. }else m_uiSqueezeTimer -= uiDiff;
  2220. }
  2221. };
  2222.  
  2223. struct MANGOS_DLL_DECL mob_crusher_tentacleAI : public ScriptedAI
  2224. {
  2225. mob_crusher_tentacleAI(Creature* pCreature) : ScriptedAI(pCreature)
  2226. {
  2227. m_pInstance = (instance_ulduar*)pCreature->GetInstanceData();
  2228. m_bIsRegularMode = pCreature->GetMap()->IsRegularDifficulty();
  2229. SetCombatMovement(false);
  2230. pCreature->SetRespawnTime(WEEK * IN_MILLISECONDS);
  2231. Reset();
  2232. }
  2233.  
  2234. instance_ulduar *m_pInstance;
  2235. bool m_bIsRegularMode;
  2236.  
  2237. uint32 m_uiEruptTimer;
  2238. bool m_bHasErupted;
  2239. uint32 m_uiCrushTimer;
  2240.  
  2241. void Reset()
  2242. {
  2243. m_uiEruptTimer = 500;
  2244. m_bHasErupted = false;
  2245. m_uiCrushTimer = 10000;
  2246. m_creature->SetRespawnDelay(DAY);
  2247. DoCast(m_creature, SPELL_FOCUSED_ANGER_TRIGG);
  2248. }
  2249.  
  2250. void UpdateAI(const uint32 uiDiff)
  2251. {
  2252. if (m_pInstance && m_pInstance->GetData(TYPE_YOGGSARON) != IN_PROGRESS)
  2253. m_creature->ForcedDespawn();
  2254.  
  2255. if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
  2256. return;
  2257.  
  2258. if (m_uiEruptTimer < uiDiff && !m_bHasErupted)
  2259. {
  2260. DoCast(m_creature, SPELL_ERUPT);
  2261. m_bHasErupted = true;
  2262. }
  2263. else m_uiEruptTimer -= uiDiff;
  2264.  
  2265. if (Player* pTarget = GetPlayerAtMinimumRange(23.0f)) // radius auf SPELL_CRUSH
  2266. {
  2267. m_creature->InterruptNonMeleeSpells(false, SPELL_DIMINISH_POWER);
  2268. if (m_uiCrushTimer < uiDiff)
  2269. {
  2270. DoCast(pTarget, SPELL_CRUSH);
  2271. m_uiCrushTimer = 10000;
  2272. }else
  2273. m_uiCrushTimer -= uiDiff;
  2274. }else{
  2275. DoCast(m_creature, SPELL_DIMINISH_POWER);
  2276. }
  2277.  
  2278. DoMeleeAttackIfReady();
  2279. }
  2280. };
  2281.  
  2282. struct MANGOS_DLL_DECL mob_vision_tentacleAI : public ScriptedAI
  2283. {
  2284. mob_vision_tentacleAI(Creature* pCreature) : ScriptedAI(pCreature)
  2285. {
  2286. SetCombatMovement(false);
  2287. Reset();
  2288. }
  2289.  
  2290. void Reset()
  2291. {
  2292. DoCast(m_creature, SPELL_GRIM_REPRISAL);
  2293. }
  2294.  
  2295. void DamageTaken(Unit *done_by, uint32 &uiDamage)
  2296. {
  2297. if(uiDamage > 0 && m_creature->GetDisplayId() != 28813)
  2298. m_creature->SetDisplayId(28813);
  2299. }
  2300.  
  2301. void UpdateAI(const uint32 uiDiff)
  2302. {
  2303. if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
  2304. return;
  2305.  
  2306. DoMeleeAttackIfReady();
  2307. }
  2308. };
  2309.  
  2310. /*
  2311. * Other
  2312. */
  2313. struct MANGOS_DLL_DECL mob_death_orbAI : public ScriptedAI
  2314. {
  2315. mob_death_orbAI(Creature* pCreature) : ScriptedAI(pCreature)
  2316. {
  2317. m_pInstance = (instance_ulduar*)pCreature->GetInstanceData();
  2318. pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
  2319. pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
  2320. pCreature->SetDisplayId(16946);
  2321. SetCombatMovement(false);
  2322. pCreature->setFaction(14);
  2323. Reset();
  2324. }
  2325.  
  2326. instance_ulduar* m_pInstance;
  2327.  
  2328. bool m_bIsWarning;
  2329.  
  2330. uint32 m_uiPlayerChange;
  2331. uint32 m_uiDamageTime;
  2332.  
  2333. void Reset()
  2334. {
  2335. m_creature->SetSpeedRate(MOVE_WALK, 0.7f, true);
  2336. m_creature->SetSpeedRate(MOVE_RUN, 0.7f, true);
  2337. DoCast(m_creature, SPELL_DEATH_RAY_VISUAL_W, true);
  2338.  
  2339. m_uiPlayerChange = 1000;
  2340. m_uiDamageTime = 5000;
  2341. }
  2342.  
  2343. void UpdateAI(const uint32 uiDiff)
  2344. {
  2345. if (m_uiDamageTime < uiDiff)
  2346. {
  2347. DoCastSpellIfCan(m_creature, SPELL_DEATH_RAY_TRIGG, CAST_TRIGGERED);
  2348. DoCastSpellIfCan(m_creature, SPELL_DEATH_RAY_VISUAL_D, CAST_TRIGGERED);
  2349. m_uiDamageTime = 600000;
  2350. }
  2351. else
  2352. m_uiDamageTime -= uiDiff;
  2353.  
  2354. if (m_uiPlayerChange < uiDiff)
  2355. {
  2356. if (Creature* pSara = m_pInstance->GetSingleCreatureFromStorage(NPC_SARA))
  2357. {
  2358. if (Unit* pTarget = pSara->SelectAttackingTarget(ATTACKING_TARGET_RANDOM, 0))
  2359. {
  2360. if (pTarget->GetPositionZ() > LAYERCUT)
  2361. {
  2362. m_creature->GetMotionMaster()->MoveFollow(pTarget, 0, 0);
  2363. m_uiPlayerChange = 4000;
  2364. }
  2365. }
  2366. }
  2367. }
  2368. else
  2369. m_uiPlayerChange -= uiDiff;
  2370. }
  2371. };
  2372.  
  2373. struct MANGOS_DLL_DECL mob_sanity_wellAI : public ScriptedAI
  2374. {
  2375. mob_sanity_wellAI(Creature* pCreature) : ScriptedAI(pCreature)
  2376. {
  2377. m_pInstance = (instance_ulduar*)pCreature->GetInstanceData();
  2378. pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
  2379. pCreature->SetDisplayId(11686); // make invisible
  2380. SetCombatMovement(false);
  2381. Reset();
  2382. }
  2383.  
  2384. instance_ulduar* m_pInstance;
  2385.  
  2386. uint32 m_uiAuraDelayTimer;
  2387. bool m_bHasAura;
  2388.  
  2389. void Reset()
  2390. {
  2391. m_uiAuraDelayTimer = 1000;
  2392. m_bHasAura = false;
  2393. DoCast(m_creature, SPELL_SANITY_WELL_VISUAL, true);
  2394. DoCast(m_creature, SPELL_SANITY_WELL, true);
  2395. m_creature->SetRespawnDelay(DAY);
  2396. }
  2397.  
  2398. void AttackStart(Unit* pWho)
  2399. {
  2400. return;
  2401. }
  2402.  
  2403. void UpdateAI(const uint32 uiDiff)
  2404. {
  2405. if (m_pInstance && m_pInstance->GetData(TYPE_YOGGSARON) != IN_PROGRESS)
  2406. m_creature->ForcedDespawn();
  2407.  
  2408. if (m_uiAuraDelayTimer < uiDiff && !m_bHasAura)
  2409. {
  2410. // spell partially broken, it should be triggered by the visual aura
  2411. //DoCast(m_creature, SPELL_SANITY_WELL);
  2412. m_bHasAura = true;
  2413. }
  2414. else m_uiAuraDelayTimer -= uiDiff;
  2415. }
  2416. };
  2417.  
  2418. struct MANGOS_DLL_DECL mob_laughing_skullAI : public ScriptedAI
  2419. {
  2420. mob_laughing_skullAI(Creature* pCreature) : ScriptedAI(pCreature)
  2421. {
  2422. pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
  2423. pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
  2424. pCreature->SetDisplayId(SKULL_DISPLAY_ID);
  2425. pCreature->setFaction(14);
  2426. SetCombatMovement(false);
  2427. pCreature->GetMotionMaster()->MoveConfused();
  2428. Reset();
  2429. }
  2430.  
  2431. void Reset()
  2432. {
  2433. m_creature->SetRespawnDelay(DAY);
  2434. DoCast(m_creature, SPELL_LUNATIC_GAZE);
  2435. }
  2436.  
  2437. void AttackStart(Unit* pWho)
  2438. {
  2439. return;
  2440. }
  2441.  
  2442. void UpdateAI(const uint32 uiDiff)
  2443. {
  2444. }
  2445. };
  2446.  
  2447. struct MANGOS_DLL_DECL mob_ominous_cloudAI : public ScriptedAI
  2448. {
  2449. mob_ominous_cloudAI(Creature* pCreature) : ScriptedAI(pCreature)
  2450. {
  2451. m_pInstance = (instance_ulduar*)pCreature->GetInstanceData();
  2452. pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
  2453. SetCombatMovement(false);
  2454. pCreature->setFaction(14);
  2455. Reset();
  2456. }
  2457.  
  2458. instance_ulduar *m_pInstance;
  2459.  
  2460. void Reset()
  2461. {
  2462. DoCast(m_creature, SPELL_OMINOUS_CLOUD_VISUAL);
  2463. m_creature->SetRespawnDelay(DAY);
  2464. m_creature->GetMotionMaster()->MoveConfused();
  2465. }
  2466.  
  2467. void AttackStart(Unit* pWho)
  2468. {
  2469. return;
  2470. }
  2471.  
  2472. void MoveInLineOfSight(Unit* pWho)
  2473. {
  2474. if (m_creature->IsWithinDist(pWho, 5.0f, true))
  2475. if (pWho->GetTypeId() == TYPEID_PLAYER && pWho->isAlive())
  2476. if (!m_creature->HasAura(SPELL_SUMMON_GUARDIAN2))
  2477. DoCast(m_creature, SPELL_SUMMON_GUARDIAN2, false);
  2478. }
  2479.  
  2480. void JustSummoned(Creature* pSummon)
  2481. {
  2482. pSummon->SetInCombatWithZone();
  2483. }
  2484.  
  2485. void UpdateAI(const uint32 uiDiff)
  2486. {
  2487. }
  2488. };
  2489.  
  2490. CreatureAI* GetAI_boss_yogg_saron(Creature* pCreature)
  2491. {
  2492. return new boss_yogg_saronAI(pCreature);
  2493. }
  2494.  
  2495. CreatureAI* GetAI_boss_sara(Creature* pCreature)
  2496. {
  2497. return new boss_saraAI(pCreature);
  2498. }
  2499.  
  2500. CreatureAI* GetAI_mob_madness_portal(Creature* pCreature)
  2501. {
  2502. return new mob_madness_portalAI(pCreature);
  2503. }
  2504.  
  2505. CreatureAI* GetAI_boss_brain_of_yogg_saron(Creature* pCreature)
  2506. {
  2507. return new boss_brain_of_yogg_saronAI(pCreature);
  2508. }
  2509.  
  2510. CreatureAI* GetAI_mob_corruptor_tentacle(Creature* pCreature)
  2511. {
  2512. return new mob_corruptor_tentacleAI(pCreature);
  2513. }
  2514.  
  2515. CreatureAI* GetAI_mob_constrictor_tentacle(Creature* pCreature)
  2516. {
  2517. return new mob_constrictor_tentacleAI(pCreature);
  2518. }
  2519.  
  2520. CreatureAI* GetAI_mob_crusher_tentacle(Creature* pCreature)
  2521. {
  2522. return new mob_crusher_tentacleAI(pCreature);
  2523. }
  2524.  
  2525. CreatureAI* GetAI_mob_vision_tentacle(Creature* pCreature)
  2526. {
  2527. return new mob_vision_tentacleAI(pCreature);
  2528. }
  2529.  
  2530. CreatureAI* GetAI_mob_guardian_of_yogg_saron(Creature* pCreature)
  2531. {
  2532. return new mob_guardian_of_yogg_saronAI(pCreature);
  2533. }
  2534.  
  2535. CreatureAI* GetAI_mob_immortal_guardian(Creature* pCreature)
  2536. {
  2537. return new mob_immortal_guardianAI(pCreature);
  2538. }
  2539.  
  2540. CreatureAI* GetAI_keeper_hodir(Creature* pCreature)
  2541. {
  2542. return new keeper_hodirAI(pCreature);
  2543. }
  2544.  
  2545. CreatureAI* GetAI_keeper_freya(Creature* pCreature)
  2546. {
  2547. return new keeper_freyaAI(pCreature);
  2548. }
  2549.  
  2550. CreatureAI* GetAI_keeper_thorim(Creature* pCreature)
  2551. {
  2552. return new keeper_thorimAI(pCreature);
  2553. }
  2554.  
  2555. CreatureAI* GetAI_keeper_mimiron(Creature* pCreature)
  2556. {
  2557. return new keeper_mimironAI(pCreature);
  2558. }
  2559.  
  2560. CreatureAI* GetAI_mob_death_orb(Creature* pCreature)
  2561. {
  2562. return new mob_death_orbAI(pCreature);
  2563. }
  2564.  
  2565. CreatureAI* GetAI_mob_sanity_well(Creature* pCreature)
  2566. {
  2567. return new mob_sanity_wellAI(pCreature);
  2568. }
  2569.  
  2570. CreatureAI* GetAI_mob_laughing_skull(Creature* pCreature)
  2571. {
  2572. return new mob_laughing_skullAI(pCreature);
  2573. }
  2574.  
  2575. CreatureAI* GetAI_mob_ominous_cloud(Creature* pCreature)
  2576. {
  2577. return new mob_ominous_cloudAI(pCreature);
  2578. }
  2579.  
  2580. bool pGossipHello_adventurer(Player *pPlayer, Creature *pCreature)
  2581. {
  2582. instance_ulduar* m_pInstance = (instance_ulduar*)pCreature->GetInstanceData();
  2583.  
  2584. if (!m_pInstance)
  2585. return false;
  2586.  
  2587. if(m_pInstance->GetData(TYPE_KEEPER_THORIM) != DONE)
  2588. {
  2589. pPlayer->ADD_GOSSIP_ITEM( 0,"Thorim soll am Kampf teilnehmen.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
  2590. }
  2591. else
  2592. {
  2593. pPlayer->ADD_GOSSIP_ITEM( 0,"Thorim soll am Kampf nicht teilnehmen.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2);
  2594. }
  2595.  
  2596. if(m_pInstance->GetData(TYPE_KEEPER_HODIR) != DONE)
  2597. {
  2598. pPlayer->ADD_GOSSIP_ITEM( 0,"Hodir soll am Kampf teilnehmen.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3);
  2599. }
  2600. else
  2601. {
  2602. pPlayer->ADD_GOSSIP_ITEM( 0,"Hodir soll am Kampf nicht teilnehmen.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4);
  2603. }
  2604.  
  2605. if(m_pInstance->GetData(TYPE_KEEPER_FREYA) != DONE)
  2606. {
  2607. pPlayer->ADD_GOSSIP_ITEM( 0,"Freya soll am Kampf teilnehmen.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5);
  2608. }
  2609. else
  2610. {
  2611. pPlayer->ADD_GOSSIP_ITEM( 0,"Freya soll am Kampf nicht teilnehmen.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+6);
  2612. }
  2613.  
  2614. if(m_pInstance->GetData(TYPE_KEEPER_MIMIRON) != DONE)
  2615. {
  2616. pPlayer->ADD_GOSSIP_ITEM( 0,"Mimiron soll am Kampf teilnehmen.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+7);
  2617. }
  2618. else
  2619. {
  2620. pPlayer->ADD_GOSSIP_ITEM( 0,"Mimiron soll am Kampf nicht teilnehmen.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+8);
  2621. }
  2622. pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetObjectGuid());
  2623. return true;
  2624. }
  2625.  
  2626. bool pGossipSelect_adventurer(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction)
  2627. {
  2628. instance_ulduar *m_pInstance = (instance_ulduar *) pCreature->GetInstanceData();
  2629. pPlayer->CLOSE_GOSSIP_MENU();
  2630. switch (uiAction)
  2631. {
  2632. case GOSSIP_ACTION_INFO_DEF+1:
  2633. m_pInstance->SetData(TYPE_KEEPER_THORIM, DONE);
  2634. pCreature->MonsterSay("Okay, Thorim wird mit euch in die Schlacht ziehen." , LANG_UNIVERSAL);
  2635. break;
  2636. case GOSSIP_ACTION_INFO_DEF+2:
  2637. m_pInstance->SetData(TYPE_KEEPER_THORIM, FAIL);
  2638. pCreature->MonsterSay("Okay, Thorim wird sich nicht einmischen." , LANG_UNIVERSAL);
  2639. break;
  2640. case GOSSIP_ACTION_INFO_DEF+3:
  2641. m_pInstance->SetData(TYPE_KEEPER_HODIR, DONE);
  2642. pCreature->MonsterSay("Okay, Hodir wird mit euch in die Schlacht ziehen." , LANG_UNIVERSAL);
  2643. break;
  2644. case GOSSIP_ACTION_INFO_DEF+4:
  2645. m_pInstance->SetData(TYPE_KEEPER_HODIR, FAIL);
  2646. pCreature->MonsterSay("Okay, Hodir wird sich nicht einmischen." , LANG_UNIVERSAL);
  2647. break;
  2648. case GOSSIP_ACTION_INFO_DEF+5:
  2649. m_pInstance->SetData(TYPE_KEEPER_FREYA, DONE);
  2650. pCreature->MonsterSay("Okay, Freya wird mit euch in die Schlacht ziehen." , LANG_UNIVERSAL);
  2651. break;
  2652. case GOSSIP_ACTION_INFO_DEF+6:
  2653. m_pInstance->SetData(TYPE_KEEPER_FREYA, FAIL);
  2654. pCreature->MonsterSay("Okay, Freya wird sich nicht einmischen." , LANG_UNIVERSAL);
  2655. break;
  2656. case GOSSIP_ACTION_INFO_DEF+7:
  2657. m_pInstance->SetData(TYPE_KEEPER_MIMIRON, DONE);
  2658. pCreature->MonsterSay("Okay, Mimiron wird mit euch in die Schlacht ziehen." , LANG_UNIVERSAL);
  2659. break;
  2660. case GOSSIP_ACTION_INFO_DEF+8:
  2661. m_pInstance->SetData(TYPE_KEEPER_MIMIRON, FAIL);
  2662. pCreature->MonsterSay("Okay, Mimiron wird sich nicht einmischen." , LANG_UNIVERSAL);
  2663. break;
  2664. default:
  2665. pCreature->MonsterSay("Unbekannte Antwort", LANG_UNIVERSAL);
  2666. }
  2667. return true;
  2668. }
  2669.  
  2670. void AddSC_boss_yogg_saron()
  2671. {
  2672. Script *newscript;
  2673. newscript = new Script;
  2674. newscript->Name = "boss_yogg_saron";
  2675. newscript->GetAI = &GetAI_boss_yogg_saron;
  2676. newscript->RegisterSelf();
  2677.  
  2678. newscript = new Script;
  2679. newscript->Name = "boss_sara";
  2680. newscript->GetAI = &GetAI_boss_sara;
  2681. newscript->RegisterSelf();
  2682.  
  2683. newscript = new Script;
  2684. newscript->Name = "mob_madness_portal";
  2685. newscript->GetAI = &GetAI_mob_madness_portal;
  2686. newscript->RegisterSelf();
  2687.  
  2688. newscript = new Script;
  2689. newscript->Name = "boss_brain_of_yogg_saron";
  2690. newscript->GetAI = &GetAI_boss_brain_of_yogg_saron;
  2691. newscript->RegisterSelf();
  2692.  
  2693. newscript = new Script;
  2694. newscript->Name = "mob_corruptor_tentacle";
  2695. newscript->GetAI = &GetAI_mob_corruptor_tentacle;
  2696. newscript->RegisterSelf();
  2697.  
  2698. newscript = new Script;
  2699. newscript->Name = "mob_constrictor_tentacle";
  2700. newscript->GetAI = &GetAI_mob_constrictor_tentacle;
  2701. newscript->RegisterSelf();
  2702.  
  2703. newscript = new Script;
  2704. newscript->Name = "mob_crusher_tentacle";
  2705. newscript->GetAI = &GetAI_mob_crusher_tentacle;
  2706. newscript->RegisterSelf();
  2707.  
  2708. newscript = new Script;
  2709. newscript->Name = "mob_vision_tentacle";
  2710. newscript->GetAI = &GetAI_mob_vision_tentacle;
  2711. newscript->RegisterSelf();
  2712.  
  2713. newscript = new Script;
  2714. newscript->Name = "mob_guardian_of_yogg_saron";
  2715. newscript->GetAI = &GetAI_mob_guardian_of_yogg_saron;
  2716. newscript->RegisterSelf();
  2717.  
  2718. newscript = new Script;
  2719. newscript->Name = "mob_immortal_guardian";
  2720. newscript->GetAI = &GetAI_mob_immortal_guardian;
  2721. newscript->RegisterSelf();
  2722.  
  2723. newscript = new Script;
  2724. newscript->Name = "keeper_hodir";
  2725. newscript->GetAI = &GetAI_keeper_hodir;
  2726. newscript->RegisterSelf();
  2727.  
  2728. newscript = new Script;
  2729. newscript->Name = "keeper_freya";
  2730. newscript->GetAI = &GetAI_keeper_freya;
  2731. newscript->RegisterSelf();
  2732.  
  2733. newscript = new Script;
  2734. newscript->Name = "keeper_thorim";
  2735. newscript->GetAI = &GetAI_keeper_thorim;
  2736. newscript->RegisterSelf();
  2737.  
  2738. newscript = new Script;
  2739. newscript->Name = "keeper_mimiron";
  2740. newscript->GetAI = &GetAI_keeper_mimiron;
  2741. newscript->RegisterSelf();
  2742.  
  2743. newscript = new Script;
  2744. newscript->Name = "mob_death_orb";
  2745. newscript->GetAI = &GetAI_mob_death_orb;
  2746. newscript->RegisterSelf();
  2747.  
  2748. newscript = new Script;
  2749. newscript->Name = "mob_sanity_well";
  2750. newscript->GetAI = &GetAI_mob_sanity_well;
  2751. newscript->RegisterSelf();
  2752.  
  2753. newscript = new Script;
  2754. newscript->Name = "mob_laughing_skull";
  2755. newscript->GetAI = &GetAI_mob_laughing_skull;
  2756. newscript->RegisterSelf();
  2757.  
  2758. newscript = new Script;
  2759. newscript->Name = "mob_ominous_cloud";
  2760. newscript->GetAI = &GetAI_mob_ominous_cloud;
  2761. newscript->RegisterSelf();
  2762.  
  2763. newscript = new Script;
  2764. newscript->Name = "adventurer";
  2765. newscript->pGossipHello = &pGossipHello_adventurer;
  2766. newscript->pGossipSelect = &pGossipSelect_adventurer;
  2767. newscript->RegisterSelf();
  2768. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement