Advertisement
Guest User

Untitled

a guest
Apr 25th, 2009
408
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 58.92 KB | None | 0 0
  1. --////////////////////////////////////////////////////--
  2. --          The Violet Hold Protection                --
  3. --               Instance Script                      --
  4. --                HalestormXV                         --
  5. --           Serenade of Sorrow Server                --
  6. --                Version 5.0                         --
  7. --////////////////////////////////////////////////////--
  8. local VH_Wave_Handler_Table   = {}
  9. local VH_Wave_Handler_Despawn = {}
  10.  
  11. local bossDeath       = 0
  12. local leaveCheck      = 1
  13. local leaveCheck2     = 1
  14. local leaveCheck3     = 1
  15.  
  16. local VH_WavesCounter = 1
  17.  
  18. local DK    = 48041
  19. local DKC   = 48042
  20. local PG    = 48040
  21. local SS    = 48047
  22. local SC    = 48044
  23. local DS    = 48043
  24.  
  25. --Bosses--
  26. local LDB   = 48048
  27. local PSB   = 48115
  28. local FDB   = 48117
  29. ----------
  30.  
  31. --Friendlies
  32. local Krasus
  33. local KrasusEnd
  34. local Alexstraz
  35.  
  36. function VH_DeclareAlex(pUnit, event)
  37.     Alexstraz = pUnit
  38. end
  39. function VH_DeclareKrasEnd(pUnit, event)
  40.     KrasusEnd = pUnit
  41.     pUnit:SendChatMessage(14, 0, "Champions! I have returned as I promised! My queen has come to our aid.")
  42. end
  43.  
  44. RegisterUnitEvent(48118, 18, "VH_DeclareAlex")
  45. RegisterUnitEvent(48119, 18, "VH_DeclareKrasEnd")
  46. -----------
  47. --Final Encounter
  48. local Cypx
  49. -----------------
  50.  
  51. local KX
  52. local KY
  53. local KZ
  54. local KO
  55.  
  56. local VH_Spawn1
  57. local VH_Spawn1X
  58. local VH_Spawn1Y
  59. local VH_Spawn1Z
  60. local VH_Spawn1O
  61.  
  62. local VH_Spawn2
  63. local VH_Spawn2X
  64. local VH_Spawn2Y
  65. local VH_Spawn2Z
  66. local VH_Spawn2O
  67.  
  68. local VH_Spawn3
  69. local VH_Spawn3X
  70. local VH_Spawn3Y
  71. local VH_Spawn3Z
  72. local VH_Spawn3O
  73.  
  74. local VH_Spawn4
  75. local VH_Spawn4X
  76. local VH_Spawn4Y
  77. local VH_Spawn4Z
  78. local VH_Spawn4O
  79.  
  80. local VH_Spawn5
  81. local VH_Spawn5X
  82. local VH_Spawn5Y
  83. local VH_Spawn5Z
  84. local VH_Spawn5O
  85.  
  86. function VH_DeclareMaster(pUnit, event)
  87.     VH_Master = pUnit
  88.     pUnit:SetUInt64Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)
  89. end
  90.  
  91. RegisterUnitEvent(48046, 18, "VH_DeclareMaster")
  92. --////////////////////////////////////////////////////--
  93. function VH_Collection_One(pUnit, event)
  94.     pUnit:SetUInt64Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)
  95.     VH_Spawn1  = pUnit
  96.     VH_Spawn1X = pUnit:GetX()
  97.     VH_Spawn1Y = pUnit:GetY()
  98.     VH_Spawn1Z = pUnit:GetZ()
  99.     VH_Spawn1O = pUnit:GetO()
  100. end
  101. function VH_Collection_Two(pUnit, event)
  102.     pUnit:SetUInt64Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)
  103.     VH_Spawn2  = pUnit
  104.     VH_Spawn2X = pUnit:GetX()
  105.     VH_Spawn2Y = pUnit:GetY()
  106.     VH_Spawn2Z = pUnit:GetZ()
  107.     VH_Spawn2O = pUnit:GetO()
  108. end
  109. function VH_Collection_Three(pUnit, event)
  110.     pUnit:SetUInt64Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)
  111.     VH_Spawn3  = pUnit
  112.     VH_Spawn3X = pUnit:GetX()
  113.     VH_Spawn3Y = pUnit:GetY()
  114.     VH_Spawn3Z = pUnit:GetZ()
  115.     VH_Spawn3O = pUnit:GetO()
  116. end
  117. function VH_Collection_Four(pUnit, event)
  118.     pUnit:SetUInt64Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)
  119.     VH_Spawn4  = pUnit
  120.     VH_Spawn4X = pUnit:GetX()
  121.     VH_Spawn4Y = pUnit:GetY()
  122.     VH_Spawn4Z = pUnit:GetZ()
  123.     VH_Spawn4O = pUnit:GetO()
  124. end
  125. function VH_Collection_Five(pUnit, event)
  126.     pUnit:SetUInt64Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)
  127.     VH_Spawn5  = pUnit
  128.     VH_Spawn5X = pUnit:GetX()
  129.     VH_Spawn5Y = pUnit:GetY()
  130.     VH_Spawn5Z = pUnit:GetZ()
  131.     VH_Spawn5O = pUnit:GetO()
  132. end
  133. RegisterUnitEvent(48035, 18, "VH_Collection_One")
  134. RegisterUnitEvent(48036, 18, "VH_Collection_Two")
  135. RegisterUnitEvent(48037, 18, "VH_Collection_Three")
  136. RegisterUnitEvent(48038, 18, "VH_Collection_Four")
  137. RegisterUnitEvent(48039, 18, "VH_Collection_Five")
  138.  
  139. function VH_Enemy_Movement(pUnit, event)
  140.     for i,k in pairs(VH_Wave_Handler_Table) do
  141.     k:SetMoveRunFlag(1)
  142.     k:CastSpell(7077)
  143.     k:MoveTo(VH_Master:GetX(), VH_Master:GetY(), VH_Master:GetZ(), VH_Master:GetO())
  144.     end
  145. end
  146.  
  147. function VH_Wave_Handler_Table_Clean(pUnit, event)
  148.     VH_Wave_Handler_Table = {}
  149. end
  150. --////////////////////////////////////////////////////--
  151. --                          Enemy Encounters                                   --
  152. --////////////////////////////////////////////////////--
  153. local SkeletalCaptain
  154. local SkeletalSoldier
  155. local DeathKnightI
  156. local DeathKnightC
  157. local DarkShade
  158. local PlaguedGhoul
  159. function VH_Declare_Enemy_Table(pUnit, event)
  160.     table.insert(VH_Wave_Handler_Table, pUnit)
  161.     table.insert(VH_Wave_Handler_Despawn, pUnit)
  162. end
  163.  
  164. function PlaguedGhouldDeclaration(pUnit, event)
  165.     PlaguedGhoul = pUnit
  166. end
  167. function DeathKnightIDeclaration(pUnit, event)
  168.     DeathKnightI = pUnit
  169. end
  170. function DeathKnightCDeclaration(pUnit, event)
  171.     DeathKnightC = pUnit
  172. end
  173. function DarkShadeDeclaration(pUnit, event)
  174.     DarkShade = pUnit
  175. end
  176. function SkeletalCaptainDeclaration(pUnit, event)
  177.     SkeletalCaptain = pUnit
  178. end
  179. function SkeletalSoldierDeclaration(pUnit, event)
  180.     SkeletalSoldier = pUnit
  181. end
  182. RegisterUnitEvent(48040, 18, "PlaguedGhouldDeclaration")
  183. RegisterUnitEvent(48041, 18, "DeathKnightIDeclaration")
  184. RegisterUnitEvent(48042, 18, "DeathKnightCDeclaration")
  185. RegisterUnitEvent(48043, 18, "DarkShadeDeclaration")
  186. RegisterUnitEvent(48044, 18, "SkeletalCaptainDeclaration")
  187. RegisterUnitEvent(48047, 18, "SkeletalSoldierDeclaration")
  188. ----
  189. RegisterUnitEvent(48040, 18, "VH_Declare_Enemy_Table")
  190. RegisterUnitEvent(48041, 18, "VH_Declare_Enemy_Table")
  191. RegisterUnitEvent(48042, 18, "VH_Declare_Enemy_Table")
  192. RegisterUnitEvent(48043, 18, "VH_Declare_Enemy_Table")
  193. RegisterUnitEvent(48044, 18, "VH_Declare_Enemy_Table")
  194. RegisterUnitEvent(48047, 18, "VH_Declare_Enemy_Table")
  195. --Bosses
  196. RegisterUnitEvent(48048, 18, "VH_Declare_Enemy_Table")
  197. RegisterUnitEvent(48115, 18, "VH_Declare_Enemy_Table")
  198. RegisterUnitEvent(48117, 18, "VH_Declare_Enemy_Table")
  199. --////////////////////////////////////////////////////--
  200. function VH_KrasusVisualCandy(pUnit, event)
  201.     Krasus = pUnit
  202.     Krasus:RegisterEvent("VH_KrasusBeams", 1000, 1)
  203.     KX = pUnit:GetX()
  204.     KY = pUnit:GetY()
  205.     KZ = pUnit:GetZ()
  206.     KO = pUnit:GetO()
  207. end
  208. function VH_KrasusBeams(pUnit, event)
  209.     VH_Spawn1:ChannelSpell(47855, Krasus)
  210.     VH_Spawn2:ChannelSpell(47855, Krasus)
  211.     VH_Spawn3:ChannelSpell(47855, Krasus)
  212.     VH_Spawn5:ChannelSpell(47855, Krasus)
  213.     Krasus:ChannelSpell(47855, VH_Spawn4)
  214. end
  215.    
  216.  
  217. function VH_KrasusSpeak(pUnit, event, player)                    
  218.     pUnit:GossipCreateMenu(70015, player, 0)
  219.     pUnit:GossipMenuAddItem(0, "I am ready to aid the Red Dragonflight Krasus.", 10, 0)
  220.     pUnit:GossipMenuAddItem(0, "I need some more time to prepare Krasus.", 20, 0)
  221.     pUnit:GossipSendMenu(player)
  222. end
  223.  
  224. function VH_KrasusSelect(pUnit, event, player, id, intid, code)
  225.     if (intid == 10) then
  226.     pUnit:GossipCreateMenu(70016, player, 0)
  227.     pUnit:GossipMenuAddItem(4, "I Accept", 11, 0)
  228.     pUnit:GossipMenuAddItem(4, "I Decline", 21, 0)
  229.     pUnit:GossipSendMenu(player)
  230.     end
  231.    
  232.     if (intid == 11) then
  233.     pUnit:RegisterEvent("VH_StartInstance", 2000, 1)
  234.     pUnit:StopChannel()
  235.     VH_Spawn1:StopChannel()
  236.     VH_Spawn2:StopChannel()
  237.     VH_Spawn3:StopChannel()
  238.     VH_Spawn4:StopChannel()
  239.     VH_Spawn5:StopChannel()
  240.     pUnit:SendChatMessage(12, 0, "Very well, I shall return champions you have my word!")
  241.     pUnit:SetUInt64Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)
  242.     bossDeath = 0
  243.     VH_Wave_Handler_Despawn = {}
  244.     player:GossipComplete()
  245.     end
  246.    
  247.     if (intid == 21) then
  248.         local name = player:GetName()
  249.         pUnit:SendChatMessage(12, 0, "Very well "..name..", I will hold off what I can until you are ready.")
  250.         player:GossipComplete()
  251.     end
  252.    
  253.     if (intid == 20) then
  254.         local name = player:GetName()
  255.         pUnit:SendChatMessage(12, 0, "Very well "..name..", I will hold off what I can until you are ready.")
  256.         player:GossipComplete()
  257.     end
  258. end
  259.  
  260. RegisterUnitGossipEvent(48045, 1, "VH_KrasusSpeak")
  261. RegisterUnitGossipEvent(48045, 2, "VH_KrasusSelect")
  262. RegisterUnitEvent(48045, 18, "VH_KrasusVisualCandy")
  263. --////////////////////////////////////////////////////--
  264. function VH_LichKingDeclare(pUnit, event)
  265.     LichKing = pUnit
  266.     pUnit:Emote(11, 1)
  267.     pUnit:SetUInt64Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)
  268. end
  269.  
  270. RegisterUnitEvent(48034, 18, "VH_LichKingDeclare")
  271.  
  272. function VH_StartInstance(pUnit, event)
  273.     pUnit:SendChatMessage(16, 0, "You can feel a dark energy fill the room.")
  274.     pUnit:SpawnCreature(48034, 1876.880005, 805.305725, 38.609207, 3.165159, 7, 0)
  275.     pUnit:PlaySoundToSet(14820)
  276.     pUnit:RegisterEvent("VH_StartInstance2", 4000, 1)
  277. end
  278.  
  279. function VH_StartInstance2(pUnit, event)
  280.     LichKing:PlaySoundToSet(14804)
  281.     LichKing:SendChatMessage(14, 0, "Pathetic...")
  282.     LichKing:RegisterEvent("VH_StartInstance3", 6000, 1)
  283. end
  284.  
  285. function VH_StartInstance3(pUnit, event)
  286.     LichKing:PlaySoundToSet(14738)
  287.     LichKing:SendChatMessage(14, 0, "You have crossed into the world of the dead in search of answers. You wish to save your ally, and have risked life and limb to be here? Allow me..to help.")
  288.     LichKing:RegisterEvent("VH_StartInstance4", 20000, 1)
  289. end
  290.  
  291. function VH_StartInstance4(pUnit, event)
  292.     Krasus:SendChatMessage(14, 0, "Quiet Arthas! Your corruption has spread for to long! You will be stopped!")
  293.     Krasus:RegisterEvent("VH_StartInstance5", 4000, 1)
  294. end
  295.  
  296. function VH_StartInstance5(pUnit, event)
  297.     LichKing:PlaySoundToSet(14803)
  298.     LichKing:SendChatMessage(14, 0, "Touching...")
  299.     LichKing:RegisterEvent("VH_StartInstance6", 5000, 1)
  300. end
  301.  
  302. function VH_StartInstance6(pUnit, event)
  303.     LichKing:PlaySoundToSet(14741)
  304.     LichKing:SendChatMessage(14, 0, "Remember this mortal...for now..I give you the choice...I allow you to pick your allegeance..but in the end..you will be mine....One way...or another..")
  305.     LichKing:RegisterEvent("VH_StartInstance7", 20000, 1)
  306. end
  307.  
  308. function VH_StartInstance7(pUnit, event)
  309.     Krasus:SendChatMessage(14, 0, "They will never side with you Arthas! You hold yourself high in glory but your reign will come to an end! By the honor of my queen I will NOT allow you to take control of Dalaran!")
  310.     Krasus:RegisterEvent("VH_StartInstance8", 10000, 1)
  311. end
  312.  
  313. function VH_StartInstance8(pUnit, event)
  314.     LichKing:PlaySoundToSet(14770)
  315.     LichKing:CastSpell(45775)
  316.     LichKing:SendChatMessage(14, 0, "Very well, warriors of the frozen wastes, rise up, I command you to fight, kill and die for your master! Let none survive!")
  317.     LichKing:RegisterEvent("VH_StartInstance9", 12000, 1)
  318. end
  319.  
  320. function VH_StartInstance9(pUnit, event)
  321.     LichKing:SendChatMessage(42, 0, "The Lich King begins to open portals in the hold.")
  322.     Krasus:SendChatMessage(15, 0, "I am too weak champions, I must get back to Queen Alexstraza. Do NOT let Arthas take control of Dalaran, should he succeed the effects will be devastating.")
  323.     Krasus:SpawnCreature(48046, LichKing:GetX(), LichKing:GetY(), LichKing:GetZ(), LichKing:GetO(), 35, 0)
  324.     Krasus:RegisterEvent("VH_StartInstance10", 1000, 1)
  325. end
  326.  
  327. function VH_StartInstance10(pUnit, event)
  328.     Krasus:SetMoveRunFlag(1)
  329.     LichKing:Despawn(1000, 0)
  330.     Krasus:SendChatMessage(12, 0, "I will return champions, do not fear, you have the word of her Consort.")
  331.     Krasus:MoveTo(1804.175049, 804.329712, 44.365353, 3.115675)
  332.     Krasus:Despawn(7000, 0)
  333.     VH_Master:RegisterEvent("VH_Wave1", 5000, 1)
  334. end
  335. --////////////////////////////////////////////////////--
  336. --                       Waves of the Instance                               --
  337. --////////////////////////////////////////////////////--
  338. function VH_Instance_Reset_Check(pUnit, event)
  339.     if VH_Master:GetInRangePlayersCount() == 0 then
  340.         VH_Master:RemoveEvents()
  341.         VH_Master:SpawnCreature(48045, KX, KY, KZ, KO, 35, 0)
  342.         VH_Master:RegisterEvent("VH_Enemy_Reset_Despawn", 2000, 1)
  343.         bossDeath  = 0
  344.     else
  345.     end
  346. end
  347.  
  348. function VH_Instance_Increase_Check(pUnit, event)
  349.     VH_WavesCounter = VH_WavesCounter + 1
  350. end
  351.    
  352. function VH_Enemy_Reset_Despawn(pUnit, event)
  353.     for i,k in pairs(VH_Wave_Handler_Despawn) do
  354.     k:Despawn(1000, 0)
  355.     end
  356.     VH_Master:Despawn(2000, 0)
  357. end
  358.  
  359. function VH_WaveCounterConversion(pUnit, event)
  360.     if VH_WavesCounter == 1 then
  361.     print "Wave number 1 has spawned.."
  362.     else
  363.     print ("Wave number "..tostring(VH_WavesCounter).." has spawned..")
  364.     end
  365. end
  366.  
  367. function VH_Wave1(pUnit, event)
  368.     VH_Master:SpawnGameObject(8000028, VH_Spawn1X, VH_Spawn1Y, VH_Spawn1Z, VH_Spawn1O, 5000)
  369.     local mobPick = math.random(1, 3)
  370.     if mobPick == 1 then
  371.     pUnit:SpawnCreature(SS, VH_Spawn1X + 2, VH_Spawn1Y + 2, VH_Spawn1Z, VH_Spawn1O, 14, 0)
  372.     pUnit:SpawnCreature(SS, VH_Spawn1X - 2, VH_Spawn1Y - 2, VH_Spawn1Z, VH_Spawn1O, 14, 0)
  373.     pUnit:SpawnCreature(SC, VH_Spawn1X + 2, VH_Spawn1Y - 2, VH_Spawn1Z, VH_Spawn1O, 14, 0, 40345)
  374.     pUnit:RegisterEvent("VH_Enemy_Movement", 1000, 1)
  375.     pUnit:RegisterEvent("VH_Wave_Handler_Table_Clean", 5000, 1)
  376.     end
  377.     if mobPick == 2 then
  378.     pUnit:SpawnCreature(DK, VH_Spawn1X + 2, VH_Spawn1Y + 2, VH_Spawn1Z, VH_Spawn1O, 14, 0,  38237)
  379.     pUnit:SpawnCreature(DK, VH_Spawn1X - 2, VH_Spawn1Y - 2, VH_Spawn1Z, VH_Spawn1O, 14, 0,  38237)
  380.     pUnit:SpawnCreature(DKC, VH_Spawn1X + 2, VH_Spawn1Y - 2, VH_Spawn1Z, VH_Spawn1O, 14, 0, 40343)
  381.     pUnit:RegisterEvent("VH_Enemy_Movement", 1000, 1)
  382.     pUnit:RegisterEvent("VH_Wave_Handler_Table_Clean", 5000, 1)
  383.     end
  384.     if mobPick == 3 then
  385.     pUnit:SpawnCreature(PG, VH_Spawn1X + 2, VH_Spawn1Y + 2, VH_Spawn1Z, VH_Spawn1O, 14, 0)
  386.     pUnit:SpawnCreature(DS, VH_Spawn1X - 2, VH_Spawn1Y - 2, VH_Spawn1Z, VH_Spawn1O, 14, 0)
  387.     pUnit:SpawnCreature(PG, VH_Spawn1X + 2, VH_Spawn1Y - 2, VH_Spawn1Z, VH_Spawn1O, 14, 0)
  388.     pUnit:RegisterEvent("VH_Enemy_Movement", 1000, 1)
  389.     pUnit:RegisterEvent("VH_Wave_Handler_Table_Clean", 5000, 1)
  390.     end
  391.     --if bossDeath == 0 then
  392.     VH_Master:RegisterEvent("VH_Waves", 150000, 4)
  393.     --VH_Master:RegisterEvent("VH_BossWave1", 660000, 1) --Possible Fix?
  394.     if bossDeath == 0 then
  395.     print "The waves have started.."
  396.     end
  397.     --else
  398.     --end
  399.     --if bossDeath == 0 then  --OLD METHOD--
  400.     --VH_Master:RegisterEvent("VH_BossWave1", 780000, 1)
  401.     --else
  402.     --end
  403.     --if bossDeath == 1 then
  404.     --VH_Master:RegisterEvent("VH_Waves", 150000, 4)
  405.     --VH_Master:RegisterEvent("VH_BossWave2", 660000, 1) --Possible Fix?
  406.     --else
  407.     --end
  408.     --if bossDeath == 1 then --OLD METHOD--
  409.     --VH_Master:RegisterEvent("VH_BossWave2", 780000, 1)
  410.     --else
  411.     --end
  412.     --if bossDeath == 2 then
  413.     --VH_Master:RegisterEvent("VH_Waves", 150000, 4)
  414.     --VH_Master:RegisterEvent("VH_BossWave3", 660000, 1) --Possible Fix?
  415.     --else
  416.     --end
  417.     VH_Master:SendChatMessage(42, 0, "The portal has opened and wave "..tostring(VH_WavesCounter).." has arrived!")
  418.     print ("Wave number "..tostring(VH_WavesCounter).." has spawned..")
  419.     VH_Master:RegisterEvent("VH_Instance_Increase_Check", 2000, 1)
  420.     VH_Master:RegisterEvent("VH_Instance_Reset_Check", 5000, 0)
  421. end
  422.  
  423. function VH_Waves(pUnit, event)
  424.     VH_WaveSelection = math.random(1, 5)
  425.     VH_Master:SendChatMessage(42, 0, "The portal has opened and wave "..tostring(VH_WavesCounter).." has arrived!")
  426.     if VH_WaveSelection == 1 then
  427.         VH_Master:SpawnGameObject(8000028, VH_Spawn1X, VH_Spawn1Y, VH_Spawn1Z + 4, VH_Spawn1O, 5000)
  428.             local mobSelection = math.random(1, 3)
  429.                     if mobSelection == 1 then
  430.                     pUnit:SpawnCreature(SS, VH_Spawn1X + 2, VH_Spawn1Y + 2, VH_Spawn1Z, VH_Spawn1O, 14, 0)
  431.                     pUnit:SpawnCreature(SS, VH_Spawn1X - 2, VH_Spawn1Y - 2, VH_Spawn1Z, VH_Spawn1O, 14, 0)
  432.                     pUnit:SpawnCreature(SC, VH_Spawn1X + 2, VH_Spawn1Y - 2, VH_Spawn1Z, VH_Spawn1O, 14, 0, 40345)
  433.                     pUnit:RegisterEvent("VH_Enemy_Movement", 1000, 1)
  434.                     pUnit:RegisterEvent("VH_Wave_Handler_Table_Clean", 5000, 1)
  435.                     end
  436.                     if mobSelection == 2 then
  437.                     pUnit:SpawnCreature(DK, VH_Spawn1X + 2, VH_Spawn1Y + 2, VH_Spawn1Z, VH_Spawn1O, 14, 0,  38237)
  438.                     pUnit:SpawnCreature(DK, VH_Spawn1X - 2, VH_Spawn1Y - 2, VH_Spawn1Z, VH_Spawn1O, 14, 0,  38237)
  439.                     pUnit:SpawnCreature(DKC, VH_Spawn1X + 2, VH_Spawn1Y - 2, VH_Spawn1Z, VH_Spawn1O, 14, 0, 40343)
  440.                     pUnit:RegisterEvent("VH_Enemy_Movement", 1000, 1)
  441.                     pUnit:RegisterEvent("VH_Wave_Handler_Table_Clean", 5000, 1)
  442.                     end
  443.                     if mobSelection == 3 then
  444.                     pUnit:SpawnCreature(PG, VH_Spawn1X + 2, VH_Spawn1Y + 2, VH_Spawn1Z, VH_Spawn1O, 14, 0)
  445.                     pUnit:SpawnCreature(DS, VH_Spawn1X - 2, VH_Spawn1Y - 2, VH_Spawn1Z, VH_Spawn1O, 14, 0)
  446.                     pUnit:SpawnCreature(PG, VH_Spawn1X + 2, VH_Spawn1Y - 2, VH_Spawn1Z, VH_Spawn1O, 14, 0)
  447.                     pUnit:RegisterEvent("VH_Enemy_Movement", 1000, 1)
  448.                     pUnit:RegisterEvent("VH_Wave_Handler_Table_Clean", 5000, 1)
  449.                     end
  450.             end
  451.     if VH_WaveSelection == 2 then
  452.         VH_Master:SpawnGameObject(8000028, VH_Spawn2X, VH_Spawn2Y, VH_Spawn2Z + 4, VH_Spawn2O, 5000)
  453.             local mobSelection = math.random(1, 3)
  454.                     if mobSelection == 1 then
  455.                     pUnit:SpawnCreature(SS, VH_Spawn2X + 2, VH_Spawn2Y + 2, VH_Spawn2Z, VH_Spawn2O, 14, 0)
  456.                     pUnit:SpawnCreature(SS, VH_Spawn2X - 2, VH_Spawn2Y - 2, VH_Spawn2Z, VH_Spawn2O, 14, 0)
  457.                     pUnit:SpawnCreature(SC, VH_Spawn2X + 2, VH_Spawn2Y - 2, VH_Spawn2Z, VH_Spawn2O, 14, 0, 40345)
  458.                     pUnit:RegisterEvent("VH_Enemy_Movement", 1000, 1)
  459.                     pUnit:RegisterEvent("VH_Wave_Handler_Table_Clean", 5000, 1)
  460.                     end
  461.                     if mobSelection == 2 then
  462.                     pUnit:SpawnCreature(DK, VH_Spawn2X + 2, VH_Spawn2Y + 2, VH_Spawn2Z, VH_Spawn2O, 14, 0,  38237)
  463.                     pUnit:SpawnCreature(DK, VH_Spawn2X - 2, VH_Spawn2Y - 2, VH_Spawn2Z, VH_Spawn2O, 14, 0,  38237)
  464.                     pUnit:SpawnCreature(DKC, VH_Spawn2X + 2, VH_Spawn2Y - 2, VH_Spawn2Z, VH_Spawn2O, 14, 0, 40343)
  465.                     pUnit:RegisterEvent("VH_Enemy_Movement", 1000, 1)
  466.                     pUnit:RegisterEvent("VH_Wave_Handler_Table_Clean", 5000, 1)
  467.                     end
  468.                     if mobSelection == 3 then
  469.                     pUnit:SpawnCreature(PG, VH_Spawn2X + 2, VH_Spawn2Y + 2, VH_Spawn2Z, VH_Spawn2O, 14, 0)
  470.                     pUnit:SpawnCreature(DS, VH_Spawn2X - 2, VH_Spawn2Y - 2, VH_Spawn2Z, VH_Spawn2O, 14, 0)
  471.                     pUnit:SpawnCreature(PG, VH_Spawn2X + 2, VH_Spawn2Y - 2, VH_Spawn2Z, VH_Spawn2O, 14, 0)
  472.                     pUnit:RegisterEvent("VH_Enemy_Movement", 1000, 1)
  473.                     pUnit:RegisterEvent("VH_Wave_Handler_Table_Clean", 5000, 1)
  474.                     end
  475.             end
  476.     if VH_WaveSelection == 3 then
  477.         VH_Master:SpawnGameObject(8000028, VH_Spawn3X, VH_Spawn3Y, VH_Spawn3Z + 4, VH_Spawn3O, 1, 5000)
  478.             local mobSelection = math.random(1, 3)
  479.                     if mobSelection == 1 then
  480.                     pUnit:SpawnCreature(SS, VH_Spawn3X + 2, VH_Spawn3Y + 2, VH_Spawn3Z, VH_Spawn3O, 14, 0)
  481.                     pUnit:SpawnCreature(SS, VH_Spawn3X - 2, VH_Spawn3Y - 2, VH_Spawn3Z, VH_Spawn3O, 14, 0)
  482.                     pUnit:SpawnCreature(SC, VH_Spawn3X + 2, VH_Spawn3Y - 2, VH_Spawn3Z, VH_Spawn3O, 14, 0, 40345)
  483.                     pUnit:RegisterEvent("VH_Enemy_Movement", 1000, 1)
  484.                     pUnit:RegisterEvent("VH_Wave_Handler_Table_Clean", 5000, 1)
  485.                     end
  486.                     if mobSelection == 2 then
  487.                     pUnit:SpawnCreature(DK, VH_Spawn3X + 2, VH_Spawn3Y + 2, VH_Spawn3Z, VH_Spawn3O, 14, 0,  38237)
  488.                     pUnit:SpawnCreature(DK, VH_Spawn3X - 2, VH_Spawn3Y - 2, VH_Spawn3Z, VH_Spawn3O, 14, 0,  38237)
  489.                     pUnit:SpawnCreature(DKC, VH_Spawn3X + 2, VH_Spawn3Y - 2, VH_Spawn3Z, VH_Spawn3O, 14, 0, 40343)
  490.                     pUnit:RegisterEvent("VH_Enemy_Movement", 1000, 1)
  491.                     pUnit:RegisterEvent("VH_Wave_Handler_Table_Clean", 5000, 1)
  492.                     end
  493.                     if mobSelection == 3 then
  494.                     pUnit:SpawnCreature(PG, VH_Spawn3X + 2, VH_Spawn3Y + 2, VH_Spawn3Z, VH_Spawn3O, 14, 0)
  495.                     pUnit:SpawnCreature(DS, VH_Spawn3X - 2, VH_Spawn3Y - 2, VH_Spawn3Z, VH_Spawn3O, 14, 0)
  496.                     pUnit:SpawnCreature(PG, VH_Spawn3X + 2, VH_Spawn3Y - 2, VH_Spawn3Z, VH_Spawn3O, 14, 0)
  497.                     pUnit:RegisterEvent("VH_Enemy_Movement", 1000, 1)
  498.                     pUnit:RegisterEvent("VH_Wave_Handler_Table_Clean", 5000, 1)
  499.                     end
  500.             end
  501.     if VH_WaveSelection == 4 then
  502.         VH_Master:SpawnGameObject(8000028, VH_Spawn4X, VH_Spawn4Y, VH_Spawn4Z + 4, VH_Spawn4O, 5000)
  503.             local mobSelection = math.random(1, 3)
  504.                     if mobSelection == 1 then
  505.                     pUnit:SpawnCreature(SS, VH_Spawn4X + 2, VH_Spawn4Y + 2, VH_Spawn4Z, VH_Spawn4O, 14, 0)
  506.                     pUnit:SpawnCreature(SS, VH_Spawn4X - 2, VH_Spawn4Y - 2, VH_Spawn4Z, VH_Spawn4O, 14, 0)
  507.                     pUnit:SpawnCreature(SC, VH_Spawn4X + 2, VH_Spawn4Y - 2, VH_Spawn4Z, VH_Spawn4O, 14, 0, 40345)
  508.                     pUnit:RegisterEvent("VH_Enemy_Movement", 1000, 1)
  509.                     pUnit:RegisterEvent("VH_Wave_Handler_Table_Clean", 5000, 1)
  510.                     end
  511.                     if mobSelection == 2 then
  512.                     pUnit:SpawnCreature(DK, VH_Spawn4X + 2, VH_Spawn4Y + 2, VH_Spawn4Z, VH_Spawn4O, 14, 0,  38237)
  513.                     pUnit:SpawnCreature(DK, VH_Spawn4X - 2, VH_Spawn4Y - 2, VH_Spawn4Z, VH_Spawn4O, 14, 0,  38237)
  514.                     pUnit:SpawnCreature(DKC, VH_Spawn4X + 2, VH_Spawn4Y - 2, VH_Spawn4Z, VH_Spawn4O, 14, 0, 40343)
  515.                     pUnit:RegisterEvent("VH_Enemy_Movement", 1000, 1)
  516.                     pUnit:RegisterEvent("VH_Wave_Handler_Table_Clean", 5000, 1)
  517.                     end
  518.                     if mobSelection == 3 then
  519.                     pUnit:SpawnCreature(PG, VH_Spawn4X + 2, VH_Spawn4Y + 2, VH_Spawn4Z, VH_Spawn4O, 14, 0)
  520.                     pUnit:SpawnCreature(DS, VH_Spawn4X - 2, VH_Spawn4Y - 2, VH_Spawn4Z, VH_Spawn4O, 14, 0)
  521.                     pUnit:SpawnCreature(PG, VH_Spawn4X + 2, VH_Spawn4Y - 2, VH_Spawn4Z, VH_Spawn4O, 14, 0)
  522.                     pUnit:RegisterEvent("VH_Enemy_Movement", 1000, 1)
  523.                     pUnit:RegisterEvent("VH_Wave_Handler_Table_Clean", 5000, 1)
  524.                     end
  525.             end
  526.     if VH_WaveSelection == 5 then
  527.         VH_Master:SpawnGameObject(8000028, VH_Spawn5X, VH_Spawn5Y, VH_Spawn5Z + 4, VH_Spawn5O, 5000)
  528.             local mobSelection = math.random(1, 3)
  529.                     if mobSelection == 1 then
  530.                     pUnit:SpawnCreature(SS, VH_Spawn5X + 2, VH_Spawn5Y + 2, VH_Spawn5Z, VH_Spawn5O, 14, 0)
  531.                     pUnit:SpawnCreature(SS, VH_Spawn5X - 2, VH_Spawn5Y - 2, VH_Spawn5Z, VH_Spawn5O, 14, 0)
  532.                     pUnit:SpawnCreature(SC, VH_Spawn5X + 2, VH_Spawn5Y - 2, VH_Spawn5Z, VH_Spawn5O, 14, 0, 40345)
  533.                     pUnit:RegisterEvent("VH_Enemy_Movement", 1000, 1)
  534.                     pUnit:RegisterEvent("VH_Wave_Handler_Table_Clean", 5000, 1)
  535.                     end
  536.                     if mobSelection == 2 then
  537.                     pUnit:SpawnCreature(DK, VH_Spawn5X + 2, VH_Spawn5Y + 2, VH_Spawn5Z, VH_Spawn5O, 14, 0,  38237)
  538.                     pUnit:SpawnCreature(DK, VH_Spawn5X - 2, VH_Spawn5Y - 2, VH_Spawn5Z, VH_Spawn5O, 14, 0,  38237)
  539.                     pUnit:SpawnCreature(DKC, VH_Spawn5X + 2, VH_Spawn5Y - 2, VH_Spawn5Z, VH_Spawn5O, 14, 0, 40343)
  540.                     pUnit:RegisterEvent("VH_Enemy_Movement", 1000, 1)
  541.                     pUnit:RegisterEvent("VH_Wave_Handler_Table_Clean", 5000, 1)
  542.                     end
  543.                     if mobSelection == 3 then
  544.                     pUnit:SpawnCreature(PG, VH_Spawn5X + 2, VH_Spawn5Y + 2, VH_Spawn5Z, VH_Spawn5O, 14, 0)
  545.                     pUnit:SpawnCreature(DS, VH_Spawn5X - 2, VH_Spawn5Y - 2, VH_Spawn5Z, VH_Spawn5O, 14, 0)
  546.                     pUnit:SpawnCreature(PG, VH_Spawn5X + 2, VH_Spawn5Y - 2, VH_Spawn5Z, VH_Spawn5O, 14, 0)
  547.                     pUnit:RegisterEvent("VH_Enemy_Movement", 1000, 1)
  548.                     pUnit:RegisterEvent("VH_Wave_Handler_Table_Clean", 5000, 1)
  549.                     end
  550.             end
  551.     if VH_WavesCounter == 5 then
  552.         VH_Master:RemoveEvents()
  553.         VH_Master:RegisterEvent("VH_BossWave1", 150000, 1)
  554.     end
  555.     if VH_WavesCounter == 11 then
  556.         VH_Master:RemoveEvents()
  557.         VH_Master:RegisterEvent("VH_BossWave2", 150000, 1)
  558.     end
  559.     if VH_WavesCounter == 17 then
  560.         VH_Master:RemoveEvents()
  561.         VH_Master:RegisterEvent("VH_BossWave3", 150000, 1)
  562.     end
  563.     if (VH_WavesCounter ~= 5) or (VH_WavesCounter ~= 11) or (VH_WavesCounter ~= 17) then
  564.     VH_Master:RegisterEvent("VH_Instance_Increase_Check", 2000, 1)
  565.     VH_Master:RegisterEvent("VH_WaveCounterConversion", 1000, 1)
  566.     end
  567. end
  568.  
  569. function VH_BossWave1(pUnit, event)
  570.     VH_Master:RemoveEvents()
  571.     VH_Master:SendChatMessage(42, 0, "A leader of the invasion force has spawned!")
  572.     VH_Master:SpawnGameObject(8000028, VH_Master:GetX(), VH_Master:GetY(), VH_Master:GetZ(), VH_Master:GetO(), 5000)
  573.     VH_Master:SpawnCreature(LDB, VH_Master:GetX() - 3, VH_Master:GetY() - 3, VH_Master:GetZ(), VH_Master:GetO(), 14, 0, 31308)
  574.     VH_Master:RegisterEvent("VH_Instance_Increase_Check", 2000, 1)
  575.     VH_Master:RegisterEvent("VH_WaveCounterConversion", 1000, 1)
  576. end
  577.  
  578. function VH_BossWave2(pUnit, event)
  579.     VH_Master:RemoveEvents()
  580.     VH_Master:SendChatMessage(42, 0, "A leader of the invasion force has spawned!")
  581.     VH_Master:SpawnGameObject(8000028, VH_Master:GetX(), VH_Master:GetY(), VH_Master:GetZ(), VH_Master:GetO(), 5000)
  582.     VH_Master:SpawnCreature(PSB, VH_Master:GetX() - 3, VH_Master:GetY() - 3, VH_Master:GetZ(), VH_Master:GetO(), 14, 0, 39245)
  583.     VH_Master:RegisterEvent("VH_Instance_Increase_Check", 2000, 1)
  584.     VH_Master:RegisterEvent("VH_WaveCounterConversion", 1000, 1)
  585. end
  586.  
  587. function VH_BossWave3(pUnit, event)
  588.     VH_Master:RemoveEvents()
  589.     VH_Master:SendChatMessage(42, 0, "The final leader has arrived.")
  590.     VH_Master:SpawnGameObject(8000028, VH_Master:GetX(), VH_Master:GetY(), VH_Master:GetZ(), VH_Master:GetO(), 5000)
  591.     VH_Master:SpawnCreature(FDB, VH_Master:GetX() - 3, VH_Master:GetY() - 3, VH_Master:GetZ(), VH_Master:GetO(), 7, 0, 39422)
  592.     VH_Master:RegisterEvent("VH_WaveCounterConversion", 1000, 1)
  593. end
  594.  
  595.  
  596.  
  597.  
  598.  
  599. --Violet Hold NPC Boss Scripts--
  600. function VH_InstanceLDB_PrimeAbility(pUnit, event)
  601.     local target = pUnit:GetRandomPlayer(0)
  602.     if target ~= nil then
  603.         local selection = math.random(1 , 4)
  604.         if selection == 1 then
  605.         pUnit:FullCastSpellOnTarget(38836, target)
  606.         end
  607.         if selection == 2 then
  608.         pUnit:FullCastSpellOnTarget(38534, target)
  609.         end
  610.         if selection == 3 then
  611.         pUnit:FullCastSpellOnTarget(59016, target)
  612.         end
  613.         if selection == 4 then
  614.         pUnit:FullCastSpellOnTarget(62249, target)
  615.         end
  616.     else
  617.     end
  618. end
  619.  
  620. function VH_InstanceLDB_BlastNova(pUnit, event)
  621.     pUnit:FullCastSpell(30600)
  622. end
  623.  
  624. function VH_InstanceLDB_Start(pUnit, event)
  625.     pUnit:PlaySoundToSet(13175)
  626.     pUnit:SendChatMessage(14, 0, "Such is the fate of all who oppose the Lich King.")
  627.     pUnit:RegisterEvent("VH_InstanceLDB_PrimeAbility", math.random(6000, 9000), 0)
  628.     pUnit:RegisterEvent("VH_InstanceLDB_BlastNova", 24000, 0)
  629.     pUnit:RegisterEvent("VH_InstanceLDB_Phase2", 1000, 0)
  630.     VH_Master:RegisterEvent("VH_Instance_Reset_Check", 5000, 0)
  631. end
  632. ---
  633. ---
  634. function VH_InstanceLDB_Explosion(pUnit, event)
  635.     pUnit:SendChatMessage(14, 0, "I will be your demise!")
  636.     pUnit:FullCastSpell(37106)
  637. end
  638.  
  639.  
  640. function VH_InstanceLDB_Phase2(pUnit, event)
  641.     if pUnit:GetHealthPct() <= 70 then
  642.     pUnit:RemoveEvents()
  643.     pUnit:PlaySoundToSet(13177)
  644.     pUnit:SendChatMessage(14, 0, "Surely you can see the futility of it all?")
  645.     pUnit:RegisterEvent("VH_InstanceLDB_PrimeAbility", math.random(6000, 9000), 0)
  646.     pUnit:RegisterEvent("VH_InstanceLDB_Explosion", 27000, 0)
  647.     pUnit:RegisterEvent("VH_InstanceLDB_Phase3", 1000, 0)
  648.     VH_Master:RegisterEvent("VH_Instance_Reset_Check", 5000, 0)
  649.     end
  650. end
  651.  
  652. function VH_InstanceLDB_Lightning(pUnit, event)
  653.     local light = pUnit:GetMainTank()
  654.     if light ~= nil then
  655.     pUnit:FullCastSpellOnTarget(46479, light)
  656.     else
  657.     end
  658. end
  659.  
  660. function VH_InstanceLDB_SpecialChill(pUnit, event)
  661.     local chillTarg = pUnit:GetRandomPlayer(0)
  662.     if chillTarg ~= nil then
  663.         pUnit:PlaySoundToSet(13173)
  664.         pUnit:SendChatMessage(14, 0, "The chill you feel is the herald of your doom.")
  665.         pUnit:CastSpellAoF(chillTarg:GetX(), chillTarg:GetY(), chillTarg:GetZ(), 28547)
  666.     else
  667.     end
  668. end
  669.  
  670. function VH_InstanceLDB_Phase3(pUnit, event)
  671.     if pUnit:GetHealthPct() <= 40 then
  672.     pUnit:RemoveEvents()
  673.     pUnit:PlaySoundToSet(13178)
  674.     pUnit:SendChatMessage(14, 0, "Just give up and die already!")
  675.     pUnit:RegisterEvent("VH_InstanceLDB_PrimeAbility", math.random(6000, 9000), 0)
  676.     pUnit:RegisterEvent("VH_InstanceLDB_Lightning",    math.random(12000, 15000), 0)
  677.     pUnit:RegisterEvent("VH_InstanceLDB_SpecialChill", 32000, 0)
  678.     VH_Master:RegisterEvent("VH_Instance_Reset_Check", 5000, 0)
  679.     end
  680. end
  681.  
  682. function VH_InstanceLDB_Dies(pUnit, event)
  683.     pUnit:RemoveEvents()
  684.     bossDeath  = 1
  685.     leaveCheck = 0
  686.     pUnit:PlaySoundToSet(13174)
  687.     pUnit:SendChatMessage(14, 0, "Haha...your efforts...are in....vain...")
  688.     VH_Master:RegisterEvent("VH_Wave_Handler_Table_Clean", 5000, 1)
  689.     VH_Master:RegisterEvent("VH_Wave1", 30000, 1)
  690. end
  691.  
  692. function VH_InstanceLDB_Leaves(pUnit, event)
  693.     pUnit:RemoveEvents()
  694.         if leaveCheck == 1 then
  695.         VH_Master:RegisterEvent("VH_Instance_Reset_Check", 5000, 0)
  696.         end
  697. end
  698.  
  699. RegisterUnitEvent(LDB, 1, "VH_InstanceLDB_Start")
  700. RegisterUnitEvent(LDB, 2, "VH_InstanceLDB_Leaves")
  701. RegisterUnitEvent(LDB, 4, "VH_InstanceLDB_Dies")
  702. -------------------------------------------------------------------
  703. -------------------------------------------------------------------
  704. function VH_InstancePSB_Frostshock(pUnit, event)
  705.     local target = pUnit:GetRandomPlayer(0)
  706.     if target ~= nil then
  707.     pUnit:FullCastSpellOnTarget(29666, target)
  708.     else
  709.     end
  710. end
  711.  
  712. function VH_InstancePSB_FrostVolley(pUnit, event)
  713.     pUnit:FullCastSpell(61594)
  714. end
  715.  
  716. function VH_InstancePSB_Aggro(pUnit, event)
  717.     pUnit:PlaySoundToSet(13947)
  718.     pUnit:SendChatMessage(14, 0, "We finish this now champions of the Kirin'Tor!")
  719.     pUnit:RegisterEvent("VH_InstancePSB_Frostshock", 6000, 0)
  720.     pUnit:RegisterEvent("VH_InstancePSB_FrostVolley", 15000, 0)
  721.     pUnit:RegisterEvent("VH_InstancePSB_Phase2", 1000, 0)
  722.     VH_Master:RegisterEvent("VH_Instance_Reset_Check", 5000, 0)
  723. end
  724. ----
  725. ----
  726. function VH_InstancePSB_FrostBreath(pUnit, event)
  727.     local target = pUnit:GetMainTank()
  728.     if target ~= nil then
  729.     pUnit:FullCastSpellOnTarget(44799, target)
  730.     else
  731.     end
  732. end
  733.  
  734. function VH_InstancePSB_FrostCleave(pUnit, event)
  735.     local target = pUnit:GetMainTank()
  736.     if target ~= nil then
  737.     pUnit:FullCastSpellOnTarget(51857, target)
  738.     else
  739.     end
  740. end
  741.  
  742. function VH_InstancePSB_Phase2(pUnit, event)
  743.     if pUnit:GetHealthPct() <= 75 then
  744.     pUnit:RemoveEvents()
  745.     pUnit:PlaySoundToSet(13953)
  746.     pUnit:SendChatMessage(14, 0, "Dalaran will fall!")
  747.     pUnit:RegisterEvent("VH_InstancePSB_FrostCleave", 6000, 0)
  748.     pUnit:RegisterEvent("VH_InstancePSB_FrostBreath", 15000, 0)
  749.     pUnit:RegisterEvent("VH_InstancePSB_Phase3", 1000, 0)
  750.     VH_Master:RegisterEvent("VH_Instance_Reset_Check", 5000, 0)
  751.     end
  752. end
  753. ----
  754. ----
  755. function VH_InstancePSB_Blizzard(pUnit, event)
  756.     pUnit:PlaySoundToSet(13950)
  757.     pUnit:SendChatMessage(14, 0, "Who among you can withstand my power!")
  758.     pUnit:RegisterEvent("VH_InstancePSB_BlizzardGo", 2000, 4)
  759. end
  760. function VH_InstancePSB_BlizzardGo(pUnit, event)
  761.     pUnit:CastSpell(36751)
  762. end
  763.  
  764. function VH_InstancePSB_Phase3(pUnit, event)
  765.     if pUnit:GetHealthPct() <= 50 then
  766.     pUnit:RemoveEvents()
  767.     pUnit:PlaySoundToSet(13948)
  768.     pUnit:SendChatMessage(14, 0, "Shiver and die!")
  769.     pUnit:RegisterEvent("VH_InstancePSB_FrostCleave", 6000, 0)
  770.     pUnit:RegisterEvent("VH_InstancePSB_FrostVolley", 15000, 0)
  771.     pUnit:RegisterEvent("VH_InstancePSB_Blizzard", 27000, 0)   
  772.     pUnit:RegisterEvent("VH_InstancePSB_Phase4", 1000, 0)
  773.     VH_Master:RegisterEvent("VH_Instance_Reset_Check", 5000, 0)
  774.     end
  775. end
  776. ----
  777. ----
  778. local selectTrue
  779.  
  780. function VH_InstancePSB_SpecialFinal4(pUnit, event)
  781.     pUnit:RemoveEvents()
  782.     pUnit:CastSpell(42049)
  783.     pUnit:SetFlying()
  784.     pUnit:MoveFly(pUnit:GetX(), pUnit:GetY(), pUnit:GetZ() + 10, pUnit:GetO())
  785.     pUnit:SetUInt64Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)
  786.     pUnit:PlaySoundToSet(13949)
  787.     pUnit:SendChatMessage(14, 0, "The world has forgotten what true magic is! Let this be a reminder!")
  788.     pUnit:RegisterEvent("VH_InstancePSB_SpecialAbility4Cast", 2000, 4)
  789.     pUnit:RegisterEvent("VH_InstancePSB_Phase4Return", 9000, 1)
  790.     pUnit:RegisterEvent("VH_InstancePSB_Phase4Moves", 10000, 1)
  791. end
  792. function VH_InstancePSB_SpecialAbility4Cast(pUnit, event)
  793.     pUnit:FullCastSpell(38837)
  794. end
  795. function VH_InstancePSB_Phase4Return(pUnit, event)
  796.     pUnit:MoveTo(pUnit:GetX(), pUnit:GetY(), pUnit:GetZ() - 10, pUnit:GetO())
  797. end
  798.  
  799. function VH_InstancePSB_Phase4(pUnit, event)
  800.     if pUnit:GetHealthPct() <= 30 then
  801.     pUnit:RemoveEvents()
  802.     pUnit:PlaySoundToSet(13952)
  803.     selectTrue = pUnit:GetUInt64Value(UNIT_FIELD_FLAGS)
  804.     pUnit:SendChatMessage(14, 0, "I will end the Kirin'Tor!")
  805.     pUnit:RegisterEvent("VH_InstancePSB_Phase4Moves", 1000, 1)
  806.     end
  807. end
  808.  
  809. function VH_InstancePSB_Phase4Moves(pUnit, event)
  810.     pUnit:Land()
  811.     pUnit:SetUInt64Value(UNIT_FIELD_FLAGS, selectTrue)
  812.     pUnit:RegisterEvent("VH_InstancePSB_FrostCleave", math.random(6000, 8000)  , 0)
  813.     pUnit:RegisterEvent("VH_InstancePSB_Frostshock",  math.random(7000, 9000)  , 0)
  814.     pUnit:RegisterEvent("VH_InstancePSB_FrostVolley", math.random(14000, 17000), 0)
  815.     pUnit:RegisterEvent("VH_InstancePSB_FrostBreath", math.random(18000, 22000), 0)
  816.     pUnit:RegisterEvent("VH_InstancePSB_SpecialFinal4", 26000, 0)
  817. end
  818.  
  819. function VH_InstancePSB_Dies(pUnit, event)
  820.     pUnit:RemoveEvents()
  821.     bossDeath  = 2
  822.     leaveCheck2 = 0
  823.     pUnit:PlaySoundToSet(13955)
  824.     pUnit:SendChatMessage(14, 0, "Perhaps we have...underestimated...you..")
  825.     VH_Master:RegisterEvent("VH_Wave_Handler_Table_Clean", 5000, 1)
  826.     VH_Master:RegisterEvent("VH_Wave1", 30000, 1)
  827. end
  828.  
  829. function VH_InstancePSB_Leaves(pUnit, event)
  830.     pUnit:RemoveEvents()
  831.     if leaveCheck2 == 1 then
  832.         VH_Master:RegisterEvent("VH_Instance_Reset_Check", 5000, 0)
  833.     end
  834. end
  835.  
  836. function VH_InstancePSB_Slay(pUnit, event)
  837.     pUnit:PlaySoundToSet(13951)
  838.     pUnit:SendChatMessage(14, 0, "Am I interrupting?")
  839.     pUnit:CastSpell(38580)
  840. end
  841.  
  842. RegisterUnitEvent(PSB, 1, "VH_InstancePSB_Aggro")
  843. RegisterUnitEvent(PSB, 2, "VH_InstancePSB_Leaves")
  844. RegisterUnitEvent(PSB, 3, "VH_InstancePSB_Slay")
  845. RegisterUnitEvent(PSB, 4, "VH_InstancePSB_Dies")
  846. -------------------------------------------------------------------
  847. -- Final Encounter
  848. -------------------------------------------------------------------
  849. local CypxSelect
  850.  
  851. function VH_InstanceFDB_ShadowVolley(pUnit, event)
  852.     pUnit:FullCastSpell(38840)
  853. end
  854.  
  855. ----------------------CINEMATIC FOR THE FINAL BATTLE-------------------------------
  856. function VH_InstanceEnterAlexKrasus(pUnit, event)
  857.     VH_Master:SpawnCreature(48118, 1804.175049, 804.329712, 44.365353, 3.115675, 1719, 0)
  858.     VH_Master:SpawnCreature(48119, 1804.175049, 804.329712 + 6, 44.365353, 3.115675, 1719, 0, 39291)
  859.     Cypx:SetUInt64Value(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)
  860.     Cypx:CastSpell(30206)
  861.     Cypx:RemoveEvents()
  862.     --Cypx:SetFaction(7)
  863.     Cypx:SetCombatCapable(1)
  864.     Cypx:Root()
  865.     VH_Master:RegisterEvent("VH_KrasusAlexMove", 2000, 1)
  866. end
  867.  
  868. function VH_KrasusAlexMove(pUnit, event)
  869.     KrasusEnd:SetMoveRunFlag(1)
  870.     KrasusEnd:MoveTo(KX - 4, KY, KZ, KO)
  871.     Alexstraz:SetMoveRunFlag(1)
  872.     Alexstraz:MoveTo(KX + 4, KY - 3, KZ, KO)
  873.     VH_Master:RegisterEvent("VH_AlexstrazSpeak", 5000, 1)
  874. end
  875.  
  876. function VH_AlexstrazSpeak(pUnit, event)
  877.     Alexstraz:SendChatMessage(12, 0, "Do not fear champions, I have contained this creature within my bindings. Krasus has told me what you have endured to protect Dalaran. Be at rest now. This is almost over.")
  878.     Alexstraz:RegisterEvent("VH_AlexstrazSpeak2", 5000, 1)
  879.     Cypx:SendChatMessage(16, 0, "Chrysophylax has become weakend by the Alexstraza's prison.")
  880. end
  881.  
  882. function VH_AlexstrazSpeak2(pUnit, event)
  883.     Cypx:PlaySoundToSet(11209)
  884.     Cypx:SendChatMessage(12, 0, "I revel in your pain.")
  885.     Cypx:RegisterEvent("VH_AlexstrazSpeak3", 6000, 1)
  886. end
  887.  
  888. function VH_AlexstrazSpeak3(pUnit, event)
  889.     KrasusEnd:SendChatMessage(14, 0, "Quiet you sniviling wretch..You think you can insult us that easily..I should slit your -")
  890.     KrasusEnd:RegisterEvent("VH_AlexstrazSpeak4", 5000, 1)
  891. end
  892.  
  893. function VH_AlexstrazSpeak4(pUnit, event)
  894.     Alexstraz:SendChatMessage(12, 0, "Enough Krasus, you know there is no prize in action out of anger. This creature is helpless in my bindings.")
  895.     Cypx:SendChatMessage(16, 0, "Chrysophylax shows a sly grin.")
  896.     Alexstraz:RegisterEvent("VH_AlexstrazSpeak5", 8000, 1)
  897. end
  898.  
  899. function VH_AlexstrazSpeak5(pUnit, event)
  900.     Cypx:PlaySoundToSet(11206)
  901.     Cypx:SendChatMessage(12, 0, "You seek a prize aye? How about death?")
  902.     Cypx:RegisterEvent("VH_AlexstrazSpeak6", 8000, 1)
  903. end
  904.  
  905. function VH_AlexstrazSpeak6(pUnit, event)
  906.     Alexstraz:SendChatMessage(12, 0, "Be silent creature. Do not think your manipulative chat can turn my consort, myself, or these Champions of the Kirin'Tor!")
  907.     Alexstraz:RegisterEvent("VH_AlexstrazSpeak7", 10000, 1)
  908. end
  909.  
  910. function VH_AlexstrazSpeak7(pUnit, event)
  911.     Cypx:SendChatMessage(12, 0, "You know I can break these chains Alexstraza, and you know these bindings cannot hold me..and when I do break free it will not be pleasing..")
  912.     Cypx:RegisterEvent("VH_AlexstrazSpeak8", 8000, 1)
  913. end
  914.  
  915. function VH_AlexstrazSpeak8(pUnit, event)
  916.     KrasusEnd:SendChatMessage(12, 0, "You are foolish. My queen I think we should remove this creature and bring him back to the temple for justice. These champions must be weary.")
  917.     Alexstraz:SetMoveRunFlag(0)
  918.     Alexstraz:MoveTo(VH_Master:GetX() - 4, VH_Master:GetY(), VH_Master:GetZ(), VH_Master:GetO())
  919.     KrasusEnd:SetMoveRunFlag(0)
  920.     KrasusEnd:MoveTo(VH_Master:GetX() + 4, VH_Master:GetY() , VH_Master:GetZ(), VH_Master:GetO())
  921.     KrasusEnd:RegisterEvent("VH_AlexstrazSpeak9", 4000, 1)
  922. end
  923.  
  924. function VH_AlexstrazSpeak9(pUnit, event)
  925.     Alexstraz:SendChatMessage(12, 0, "Yes Krasus, it is time to return. Champions I am forever in your debt. Thank You for the aid you have -")
  926.     Alexstraz:RegisterEvent("VH_AlexstrazSpeak10", 3000, 1)
  927. end
  928.  
  929. function VH_AlexstrazSpeak10(pUnit, event)
  930.     Cypx:PlaySoundToSet(11207)
  931.     Cypx:SendChatMessage(12, 0, "I hate to say I told you so...")
  932.     Cypx:RegisterEvent("VH_CypxVisualEscape", 2000, 4)
  933.     Cypx:RegisterEvent("VH_CypxBeginTransform", 9000, 1)
  934. end
  935.  
  936. function VH_CypxVisualEscape(pUnit, event)
  937.     Cypx:CastSpell(46242)
  938. end
  939.  
  940. function VH_CypxBeginTransform(pUnit, event)
  941.     Cypx:RemoveAura(30206)
  942.     KrasusEnd:SendChatMessage(12, 0, "What is this?!")
  943.     Cypx:CastSpell(30852)
  944.     Cypx:RegisterEvent("VH_CypxDragonForm", 4000, 1)
  945. end
  946.  
  947. function VH_CypxDragonForm(pUnit, event)
  948.     Cypx:SetModel(11380)
  949.     Cypx:SetScale(.5)
  950.     Cypx:SetFaction(1720)
  951.     Cypx:SetUInt64Value(UNIT_FIELD_FLAGS, CypxSelect)
  952.     Cypx:SetCombatCapable(0)
  953.     Cypx:Unroot()
  954.     Cypx:PlaySoundToSet(13414)
  955.     Cypx:SendChatMessage(14, 0, "This is the hour of our greatest triumph!")
  956.     Cypx:RegisterEvent("VH_InstanceFDB_Phase1", 1000, 1)
  957. end
  958. ----------------------CINEMATIC END-----------------------------------------
  959. function VH_CypxShadowBreath(pUnit, event)
  960.     local target = pUnit:GetMainTank()
  961.     if target ~= nil then
  962.     Cypx:FullCastSpellOnTarget(59126, target)
  963.     else
  964.     end
  965. end
  966.  
  967. function VH_AlexFireball(pUnit, event)
  968.     Alexstraz:FullCastSpellOnTarget(29953, Cypx)
  969. end
  970.  
  971. function VH_KrasusDebuff(pUnit, event)
  972.     KrasusEnd:FullCastSpellOnTarget(46279, Cypx)
  973. end
  974.  
  975. function VH_InstanceFDB_Phase1(pUnit, event)
  976.     Alexstraz:SendChatMessage(14, 0, "Do not lose faith champions! I will aid you in this fight!")
  977.     Cypx:RegisterEvent("VH_CypxShadowBreath", 10000, 0)
  978.     Alexstraz:RegisterEvent("VH_AlexFireball", 7000, 0)
  979.     KrasusEnd:RegisterEvent("VH_KrasusDebuff", 12000, 0)
  980.     Cypx:RegisterEvent("VH_InstanceFDB_ShadowVolley", 7000, 0)
  981.     Cypx:RegisterEvent("VH_InstanceFDB_Phase2", 1000, 0)
  982. end
  983. --
  984. --
  985. function VH_KrasusFlamestrike(pUnit, event)
  986.     KrasusEnd:CastSpellAoF(Cypx:GetX(), Cypx:GetY(), Cypx:GetZ(), 41481)
  987. end
  988.  
  989. function VH_InstanceFDB_TimeStop(pUnit, event)
  990.     Cypx:PlaySoundToSet(13410)
  991.     Cypx:SendChatMessage(14, 0, "Tick Tock, Tick Tock.")
  992.     Cypx:CastSpell(60074)
  993. end
  994.  
  995. function VH_AlexChainHeal(pUnit, event)
  996.     Alexstraz:FullCastSpellOnTarget(42027, KrasusEnd)
  997. end
  998.  
  999. function VH_InstanceFDB_Darkness(pUnit, event)
  1000.     local target = Cypx:GetRandomPlayer(0)
  1001.     if target ~= pUnit:GetMainTank() then
  1002.     Cypx:PlaySoundToSet(13413)
  1003.     Cypx:SendChatMessage(14, 0, "There is no future...for you.")
  1004.     Cypx:CastSpellAoF(target:GetX(), target:GetY(), target:GetZ(), 45996)'
  1005.     else
  1006.     Cypx:RegisterEvent("VH_InstanceFDB_Darkness", 500, 1)
  1007.     end
  1008. end
  1009.  
  1010. function VH_InstanceFDB_Phase2(pUnit, event)
  1011.     if Cypx:GetHealthPct() <= 80 then
  1012.         pUnit:RemoveEvents()
  1013.         Cypx:PlaySoundToSet(13412)
  1014.         Cypx:SendChatMessage(14, 0, "Lets get this over with..")
  1015.         Cypx:RegisterEvent("VH_CypxShadowBreath", 10000, 0)
  1016.         Alexstraz:RegisterEvent("VH_AlexFireball", 7000, 0)
  1017.         KrasusEnd:RegisterEvent("VH_KrasusFlamestrike", 17000, 0)
  1018.         Cypx:RegisterEvent("VH_InstanceFDB_ShadowVolley", 7000, 0)
  1019.         Cypx:RegisterEvent("VH_InstanceFDB_TimeStop", 23000, 0)
  1020.         Alexstraz:RegisterEvent("VH_AlexChainHeal", 32000, 0)
  1021.         Cypx:RegisterEvent("VH_InstanceFDB_Darkness", 30000, 0)
  1022.         Cypx:RegisterEvent("VH_InstanceFDB_Phase3", 1000, 0)
  1023.     end
  1024. end
  1025. ----
  1026. ----
  1027. function VH_InstanceFDB_Phase3(pUnit, event)
  1028.     if Cypx:GetHealthPct() <= 65 then
  1029.         pUnit:RemoveEvents()
  1030.         Cypx:SetFlying()
  1031.         Cypx:MoveTo(VH_Master:GetX(), VH_Master:GetY(), VH_Master:GetZ() + 20, VH_Master:GetO())
  1032.         Cypx:PlaySoundToSet(10414)
  1033.         Cypx:SendChatMessage(14, 0, "If you do not cese this foolish quest then you will die!")
  1034.         Cypx:RegisterEvent("VH_InstanceAlexMorph", 3000, 1)
  1035.     end
  1036. end
  1037.  
  1038. function VH_InstanceAlexMorph(pUnit, event)
  1039.     Alexstraz:SendChatMessage(14, 0, "Very well Chrysophylax! If it is a battle in the air you wish then it is one you will get!")
  1040.     Alexstraz:MoveTo(VH_Master:GetX(), VH_Master:GetY(), VH_Master:GetZ(), VH_Master:GetO())
  1041.     Alexstraz:SetCombatMeleeCapable(1)
  1042.     Alexstraz:RegisterEvent("VH_InstanceKrasusSpeak", 3000, 1)
  1043. end
  1044.  
  1045. function VH_InstanceKrasusSpeak(pUnit, event)
  1046.     KrasusEnd:SendChatMessage(14, 0, "My queen we should stay grounded to aid the champions!")
  1047.     KrasusEnd:MoveTo(VH_Master:GetX(), VH_Master:GetY(), VH_Master:GetZ(), VH_Master:GetO())
  1048.     KrasusEnd:SetCombatMeleeCapable(1)
  1049.     KrasusEnd:RegisterEvent("VH_InstanceFDB_Phase3Go", 2000, 1)
  1050. end
  1051. --
  1052. --
  1053. function VH_InstanceAlexFlameBreath(pUnit, event)
  1054.     Alexstraz:FullCastSpellOnTarget(29953, Cypx)
  1055. end
  1056.  
  1057. function VH_InstanceFDB_Shadowflame(pUnit, event)
  1058.     Cypx:FullCastSpellOnTarget(22539, Alexstraz)
  1059. end
  1060.  
  1061. function VH_InstanceFDB_Flameshock(pUnit, event)
  1062.     local flameShock = pUnit:GetRandomPlayer(0)
  1063.     if flameShock ~= nil then
  1064.     Cypx:FullCastSpellOnTarget(41115, flameShock)
  1065.     else
  1066.     end
  1067. end
  1068.  
  1069. function VH_InstanceFDB_FireVolley(pUnit, event)
  1070.     pUnit:FullCastSpell(37109)
  1071. end
  1072.  
  1073. function VH_InstanceKrasusCleave(pUnit, event)
  1074.     pUnit:FullCastSpellOnTarget(40932, Cypx)
  1075. end
  1076.  
  1077. function VH_InstanceFDB_Special1(pUnit, event)
  1078.     Cypx:PlaySoundToSet(10446)
  1079.     Cypx:SendChatMessage(14, 0, "Your days are done!")
  1080.     Cypx:FullCastSpell(57557)
  1081. end
  1082.  
  1083. function VH_InstanceFDB_Phase3Go(pUnit, event)
  1084.     Alexstraz:RegisterEvent("VH_InstancePlayerFlightStart", 1000, 1)
  1085.     Alexstraz:RegisterEvent("VH_InstanceAlexFlameBreath", 7000, 0)
  1086.     Cypx:RegisterEvent("VH_InstanceFDB_Shadowflame", 7000, 0)
  1087.     Cypx:RegisterEvent("VH_InstanceFDB_Flameshock", 10000, 0)
  1088.     Cypx:RegisterEvent("VH_InstanceFDB_FireVolley", 13000, 0)
  1089.     Cypx:RegisterEvent("VH_InstanceFDB_Special1", 57000, 0)
  1090.     KrasusEnd:RegisterEvent("VH_InstanceKrasusCleave", 8000, 0)
  1091.     Cypx:RegisterEvent("VH_InstanceFDBPhase4", 1000, 0)
  1092. end
  1093. --
  1094. --
  1095. function VH_InstanceFDB_LegionLight(pUnit, event)
  1096.     local target = pUnit:GetRandomPlayer(0)
  1097.         if target ~= nil then
  1098.         Cypx:FullCastSpellOnTarget(45664, target)
  1099.         else
  1100.     end
  1101. end
  1102.    
  1103. function VH_InstanceFDB_FlameBreath(pUnit, event)
  1104.     local target = pUnit:GetMainTank()
  1105.         if target ~= nil then
  1106.         Cypx:FullCastSpellOnTarget(56908, target)
  1107.         else
  1108.     end
  1109. end
  1110.  
  1111. function VH_InstanceAlexstrazCleave(pUnit, event)
  1112.     Alexstraz:FullCastSpellOnTarget(31345, Cypx)
  1113. end
  1114.  
  1115. function VH_InstanceKrasusFlame(pUnit, event)
  1116.     KrasusEnd:FullCastSpellOnTarget(56908, Cypx)
  1117. end
  1118. ----
  1119. ----
  1120. function VH_InstanceFDBPhase4(pUnit, event)
  1121.     if Cypx:GetHealthPct() <= 50 then
  1122.     Cypx:RemoveEvents()
  1123.     Cypx:PlaySoundToSet(10442)
  1124.     Cypx:SendChatMessage(14, 0, "Why do you persist? Surely you ca nsee the futility of it all..It's not to late. You may still leave with your lives!")
  1125.     Cypx:MoveTo(VH_Master:GetSpawnX(), VH_Master:GetSpawnY(), VH_Master:GetSpawnZ(), VH_Master:GetSpawnO())
  1126.     Cypx:Land()
  1127.     Alexstraz:MoveTo(VH_Master:GetX() + 6, VH_Master:GetY(), VH_Master:GetZ(), VH_Master:GetO())
  1128.     KrasusEnd:MoveTo(VH_Master:GetX() - 6, VH_Master:GetY(), VH_Master:GetZ(), VH_Master:GetO())
  1129.     KrasusEnd:Land()
  1130.     Alexstraz:Land()
  1131.     Alexstraz:RegisterEvent("VH_DisableFlightMorph", 1000, 1)
  1132.     Cypx:RegisterEvent("VH_InstanceFDB_LegionLight", 6000, 0)
  1133.     Cypx:RegisterEvent("VH_InstanceFDB_FlameBreath", 15000, 0)
  1134.     Alexstraz:RegisterEvent("VH_InstanceAlexstrazCleave", 8000, 0)
  1135.     KrasusEnd:RegisterEvent("VH_InstanceKrasusFlame", 12000, 0)
  1136.     Cypx:RegisterEvent("VH_InstanceFDBPhase5", 1000, 0)
  1137.     end
  1138. end
  1139. ----
  1140. ----
  1141. function VH_InstanceFDBSingleFire(pUnit, event)
  1142.     local target = pUnit:GetRandomPlayer(0)
  1143.     if target ~= nil then
  1144.     Cypx:FullCastSpellOnTarget(29953, target)
  1145.     else
  1146.     end
  1147. end
  1148.  
  1149. function VH_InstanceFDBSpecialFire(pUnit, event)
  1150.     Cypx:PlaySoundToSet(10446)
  1151.     Cypx:SendChatMessage(14, 0, "Your days are done....")
  1152.     local FireRain = pUnit:GetRandomPlayer(0)
  1153.         if FireRain ~= nil then
  1154.         Cypx:CastSpellAoF(FireRain:GetX(), FireRain:GetY(), FireRain:GetZ(), 58936)
  1155.         else
  1156.     end
  1157.     Cypx:FullCastSpell(38836)
  1158. end
  1159.  
  1160. function VH_InstanceFDBPyroDeath(pUnit, event)
  1161.     local target = pUnit:GetRandomPlayer(0)
  1162.         if target ~= nil then
  1163.             Cypx:PlaySoundToSet(13415)
  1164.             Cypx:SendChatMessage(14, 0, "Lets get this over with.")
  1165.             Cypx:FullCastSpellOnTarget(64698, target)
  1166.         else
  1167.     end
  1168. end
  1169.    
  1170.  
  1171. function VH_InstanceFDBPhase5(pUnit, event)
  1172.     if Cypx:GetHealthPct() <= 40 then
  1173.     Cypx:RemoveEvents()
  1174.     Cypx:PlaySoundToSet(10402)
  1175.     Cypx:SendChatMessage(14, 0, "Let us see what fate has in store..")
  1176.     Alexstraz:RegisterEvent("VH_InstanceAlexstrazCleave", 8000, 0)
  1177.     KrasusEnd:RegisterEvent("VH_KrasusFlamestrike", 23000, 0)
  1178.     Cypx:RegisterEvent("VH_InstanceFDBSingleFire", 6000, 0)
  1179.     Cypx:RegisterEvent("VH_InstanceFDBSpecialFire", 24000, 0)
  1180.     Cypx:RegisterEvent("VH_InstanceFDBPyroDeath", 33000, 0)
  1181.     Cypx:RegisterEvent("VH_InstanceFDBPhase6", 1000, 0)
  1182.     end
  1183. end
  1184. ----
  1185. ----
  1186. function VH_InstanceFDBFireBarrageFinal(pUnit, event)
  1187.     Cypx:FullCastSpell(38836)
  1188. end
  1189.  
  1190. --Final Special--
  1191. function VH_InstanceFDBFinalSpecial6_1(pUnit, event)
  1192.     Cypx:RemoveEvents()
  1193.     Cypx:CastSpell(40647)
  1194.     Cypx:PlaySoundToSet(10404)
  1195.     Cypx:SendChatMessage(14, 0, "No one can stop us! No one!")
  1196.     Cypx:SetFlying()
  1197.     Cypx:MoveTo(VH_Master:GetX(), VH_Master:GetY(), VH_Master:GetZ() + 20, VH_Master:GetO())
  1198.     Cypx:RegisterEvent("VH_InstanceFDBFinalSpecial6_2", 5000, 1)
  1199. end
  1200. function VH_InstanceFDBFinalSpecial6_2(pUnit, event)
  1201.     Cypx:SendChatMessage(42, 0, "Chrysophylax begins to power a massive spell")
  1202.     Cypx:PlaySoundToSet(10424)
  1203.     Cypx:SendChatMessage(14, 0, "Struggle as much as you like!")
  1204.     Cypx:ChannelSpell(60309, VH_Master)
  1205.     VH_Master:CastSpell(54141)
  1206.     Cypx:RegisterEvent("VH_InstanceFDBFinalSpecial6_3", 2000, 1)
  1207. end
  1208. function VH_InstanceFDBFinalSpecial6_3(pUnit, event)
  1209.     VH_Spawn1:ChannelSpell(46906, VH_Master)
  1210.     Cypx:CastSpell(40647)
  1211.     Alexstraz:SendChatMessage(14, 0, "Do not worry champions I will give my life for you if the need come!")
  1212.     Cypx:RegisterEvent("VH_InstanceFDBFinalSpecial6_4", 3000, 1)
  1213. end
  1214. function VH_InstanceFDBFinalSpecial6_4(pUnit, event)
  1215.     VH_Spawn2:ChannelSpell(46906, VH_Master)
  1216.     KrasusEnd:SendChatMessage(14, 0, "Nor will I allow you to perish my friends, we have come to far!")
  1217.     Cypx:RegisterEvent("VH_InstanceFDBFinalSpecial6_5", 3000, 1)
  1218. end
  1219. function VH_InstanceFDBFinalSpecial6_5(pUnit, event)
  1220.     VH_Spawn3:ChannelSpell(46906, VH_Master)
  1221.     Cypx:PlaySoundToSet(13415)
  1222.     Cypx:CastSpell(40647)
  1223.     Cypx:SendChatMessage(14, 0, "You were destined to fail!")
  1224.     Cypx:RegisterEvent("VH_InstanceFDBFinalSpecial6_6", 2000, 1)
  1225. end
  1226. function VH_InstanceFDBFinalSpecial6_6(pUnit, event)
  1227.     VH_Spawn4:ChannelSpell(46906, VH_Master)
  1228.     Alexstraz:SendChatMessage(14, 0, "I WILL NOT allow you to take...control...OF.....THIS PLACE!")
  1229.     Cypx:RegisterEvent("VH_InstanceFDBFinalSpecial6_7", 2000, 1)
  1230. end
  1231. function VH_InstanceFDBFinalSpecial6_7(pUnit, event)
  1232.     Alexstraz:SendChatMessage(42, 0, "Alexstraza breaks the bindings of the Twilight Master")
  1233.     Alexstraz:RemoveAura(40647)
  1234.     Alexstraz:SetCombatMeleeCapable(1)
  1235.     Alexstraz:Root()
  1236.     Alexstraz:RegisterEvent("VH_InstancePlayerPrisonBreakStart", 1000, 1)
  1237.     Cypx:RegisterEvent("VH_InstanceFDBFinalSpecial6_8", 2000, 1)
  1238. end
  1239. function VH_InstanceFDBFinalSpecial6_8(pUnit, event)
  1240.     VH_Spawn5:ChannelSpell(46906, VH_Master)
  1241.     Cypx:PlaySoundToSet(10421)
  1242.     Cypx:SendChatMessage(14, 0, "Enough! I will erase your very existence!")
  1243.     Cypx:RegisterEvent("VH_InstanceFDBFinalSpecial6_9", 3000, 1)
  1244. end
  1245. function VH_InstanceFDBFinalSpecial6_9(pUnit, event)
  1246.     Cypx:SendChatMessage(42, 0, "Chrysophylax gets ready to unleashes an ultimate ability.")
  1247.     Alexstraz:RegisterEvent("VH_InstancePlayerProtectionStart", 1000, 1)
  1248.     Cypx:RegisterEvent("VH_InstanceFDBFinalSpecial6_10", 2000, 1)
  1249. end
  1250. function VH_InstanceFDBFinalSpecial6_9(pUnit, event)
  1251.     Cypx:CastSpell(56397)
  1252.     Cypx:CastSpell(57432)
  1253.     Cypx:CastSpell(58538)
  1254.     VH_Spawn1:StopChannel()
  1255.     VH_Spawn2:StopChannel()
  1256.     VH_Spawn3:StopChannel()
  1257.     VH_Spawn4:StopChannel()
  1258.     VH_Spawn5:StopChannel()
  1259.     Cypx:StopChannel()
  1260.     VH_Master:RemoveAura(54141)
  1261.     Cypx:RegisterEvent("VH_InstanceReturnFinalSpecial6", 2000, 1)
  1262. end
  1263. function VH_InstanceReturnFinalSpecial6(pUnit, event)
  1264.     Cypx:MoveTo(Cypx:GetSpawnX(), Cypx:GetSpawnY(), Cypx:GetSpawnZ(), Cypx:GetSpawnO())
  1265.     Cypx:RegisterEvent("VH_InstanceFDBPhase6Start", 3000, 1)
  1266. end
  1267. --Final Special End--
  1268.  
  1269. function VH_InstanceFDBPhase6(pUnit, event)
  1270.     if Cypx:GetHealthPct() <= 20 then
  1271.     Cypx:RemoveEvents()
  1272.     Cypx:PlaySoundToSet(10444)
  1273.     Cypx:SendChatMessage(14, 0, "So be it..You were warned..")
  1274.     Cypx:RegisterEvent("VH_InstanceFDBPhase6Start", 1000, 1)
  1275.     end
  1276. end
  1277.  
  1278. function VH_InstanceFDBPhase6Start(pUnit, event)
  1279.     Cypx:Land()
  1280.     Alexstraz:RegisterEvent("VH_InstanceAlexstrazCleave", 8000, 0)
  1281.     KrasusEnd:RegisterEvent("VH_InstanceKrasusFlame", 12000, 0)
  1282.     Cypx:RegisterEvent("VH_InstanceFDBFireBarrageFinal", 7000, 0)
  1283.     Cypx:RegisterEvent("VH_InstanceFDBFinalSpecial6_1", 40000, 0)
  1284. end
  1285.  
  1286. function VH_InstanceFDB_Start(pUnit, event)
  1287.     Cypx = pUnit
  1288.     pUnit:PlaySoundToSet(11205)
  1289.     pUnit:SendChatMessage(12, 0, "What aggrivation is this? You will die!")
  1290.     CypxSelect = pUnit:GetUInt64Value(UNIT_FIELD_FLAGS)
  1291. end
  1292.  
  1293. function VH_InstanceFDB_Aggro(pUnit, event)
  1294.     pUnit:SetFaction(14)
  1295.     pUnit:PlaySoundToSet(11208)
  1296.     pUnit:SendChatMessage(14, 0,  "Your life will be mine!")
  1297.     pUnit:RegisterEvent("VH_InstanceFDB_ShadowVolley", math.random(7000, 11000), 0)
  1298.     pUnit:RegisterEvent("VH_InstanceEnterAlexKrasus", 45000, 1)
  1299. end
  1300.  
  1301. function VH_InstanceFDB_Dies(pUnit, event)
  1302.     pUnit:RemoveEvents()
  1303.     Alexstraz:RemoveEvents()
  1304.     KrasusEnd:RemoveEvents()
  1305.     bossDeath  = 3
  1306.     leaveCheck3 = 0
  1307.     pUnit:PlaySoundToSet(10405)
  1308.     pUnit:SendChatMessage(14, 0, "We will triumph.....it is only...a matter...of time....")
  1309.     VH_Master:RegisterEvent("VH_Wave_Handler_Table_Clean", 5000, 1)
  1310.     Alexstraz:RegisterEvent("VH_InstanceGrandCinematic_1", 3000, 1)
  1311. end
  1312.  
  1313. function VH_InstanceFDB_Slay(pUnit, event)
  1314.     local slayerSpeak = math.random(1, 4)
  1315.         if slayerSpeak == 1 then
  1316.         Cypx:PlaySoundToSet(10403)
  1317.         Cypx:SendChatMessage(14, 0, "One less obstacle in our way.")
  1318.         end
  1319.         if slayerSpeak == 2 then
  1320.         Cypx:PlaySoundToSet(10416)
  1321.         Cypx:SendChatMessage(14, 0, "Leaving so soon?")
  1322.         end
  1323.         if slayerSpeak == 3 then
  1324.         Cypx:PlaySoundToSet(13413)
  1325.         Cypx:SendChatMessage(14, 0, "There is no future for you!")
  1326.         end
  1327.         if slayerSpeak == 4 then
  1328.         Cypx:PlaySoundToSet(10425)
  1329.         Cypx:SendChatMessage(14, 0, "You are irrelevant!")
  1330.         end
  1331.  
  1332. end
  1333.  
  1334. function VH_InstanceFDB_Leaves(pUnit, event)
  1335.     pUnit:RemoveEvents()
  1336.     if leaveCheck3 == 1 then
  1337.         VH_Master:RegisterEvent("VH_Instance_Reset_Check", 5000, 0)
  1338.         Cypx:Despawn(2000, 0)
  1339.         Alexstraz:Despawn(2000, 0)
  1340.         KrasusEnd:Despawn(2000, 0)
  1341.     end
  1342. end
  1343.  
  1344. function VH_InstanceFDB_KillKrasus(pUnit, event)
  1345.     Cypx:RemoveEvents()
  1346.     Cypx:Root()
  1347.     Alexstraz:RemoveEvents()
  1348.     Alexstraz:Root()
  1349.     Cypx:PlaySoundToSet(10400)
  1350.     Cypx:SendChatMessage(14, 0, "The time has come to shatter this clockwork universe forever, let us no longer be slaves of the hourglass. I warn you, those who do not embrace this greater path shall be victims of its passing.")
  1351.     Cypx:RegisterEvent("VH_InstanceFDB_KillKrasusScene", 1000, 1)
  1352. end
  1353. function VH_InstanceFDB_KillKrasusScene(pUnit, event)
  1354.     Alexstraz:SendChatMessage(14, 0, "NO! Krasus!!! My love!!!!")
  1355.     Alexstraz:SendChatMessage(16, 0, "The Queen of the Dragons cries out in agony")
  1356.     Cypx:Despawn(2000, 0)
  1357.     Alexstraz:Despawn(3000, 0)
  1358.     VH_Master:SendChatMessage(42, 0, "The consort of the queen has fallen. The will to fight has been diminished.")
  1359. end
  1360.  
  1361. function VH_InstanceFDB_KillAlexstraz(pUnit, event)
  1362.     KrasusEnd:RemoveEvents()
  1363.     KrasusEnd:Root()
  1364.     Cypx:RemoveEvents()
  1365.     Cypx:Root()
  1366.     Cypx:PlaySoundToSet(10443)
  1367.     Cypx:SendChatMessage(14, 0, "Time-keeper, the sands of time have run out for you.")
  1368.     Cypx:RegisterEvent("VH_InstanceFDB_KillAlexstrazScene", 1000, 1)
  1369. end
  1370. function VH_InstanceFDB_KillAlexstrazScene(pUnit, event)
  1371.     KrasusEnd:SendChatMessage(14, 0, "My queen....my love...my wife...I have...failed you....")
  1372.     KrasusEnd:SendChatMessage(16, 0, "Krasus cries out in agony")
  1373.     Cypx:Despawn(2000, 0)
  1374.     KrasusEnd:Despawn(3000, 0)
  1375.     VH_Master:SendChatMessage(42, 0, "The Queen has fallen in battle. The will to fight has been diminished.")
  1376. end
  1377.    
  1378. RegisterUnitEvent(48118, 4, "VH_InstanceFDB_KillAlexstraz")
  1379. RegisterUnitEvent(48119, 4, "VH_InstanceFDB_KillKrasus")
  1380. ----
  1381. ----
  1382.  
  1383.  
  1384. RegisterUnitEvent(FDB, 1, "VH_InstanceFDB_Aggro")
  1385. RegisterUnitEvent(FDB, 2, "VH_InstanceFDB_Leaves")
  1386. RegisterUnitEvent(FDB, 3, "VH_InstanceFDB_Slay")
  1387. RegisterUnitEvent(FDB, 4, "VH_InstanceFDB_Dies")
  1388. RegisterUnitEvent(FDB, 18, "VH_InstanceFDB_Start")
  1389. ------HANDLE PLAYER FLYING-------------
  1390. local FlightList  = 0
  1391. local FlightTable = {}
  1392.  
  1393. function VH_InstancePlayerFlightStart(pUnit, event)
  1394.     Alexstraz:SendChatMessage(14, 0, "Champions! I have imbued you with a portion of power that will allow you to take flight! Come and help put an end to this fiend!")
  1395.     FlightList = VH_Master:GetInRangePlayersCount()
  1396.     Alexstraz:RegisterEvent("VH_InstancePlayerFlightEnable", 2000, 1)
  1397. end
  1398.  
  1399. function VH_InstancePlayerFlightEnable(pUnit, event)
  1400.     local players
  1401.    while #FlightTable < FlightList do
  1402.        players = pUnit:GetRandomPlayer(0)
  1403.        if table.find(FlightTable, players) == false then table.insert(FlightTable, players) end
  1404.         players:SetFlying()
  1405.         players:SetMovementType(768)
  1406.         players:SetModel(6371)
  1407.         players:CastSpell(51802)
  1408.         players:SetScale(.6)
  1409.         players:EnableFlight(1)
  1410.    end
  1411.     FlightList  = 0
  1412.     FlightTable = {}
  1413. end
  1414. ------HANDLE PRISON BREAK-------------
  1415. local PrisonList  = 0
  1416. local PrisonTable = {}
  1417.  
  1418. function VH_InstancePlayerPrisonBreakStart(pUnit, event)
  1419.     PrisonList = VH_Master:GetInRangePlayersCount()
  1420.     Alexstraz:RegisterEvent("VH_InstancePlayerPrisonBreak", 1000, 1)
  1421. end
  1422.  
  1423. function VH_InstancePlayerPrisonBreak(pUnit, event)
  1424.     local playersP
  1425.    while #PrisonTable < PrisonList do
  1426.        playersP = pUnit:GetRandomPlayer(0)
  1427.        if table.find(PrisonTable, playersP) == false then table.insert(PrisonTable, playersP) end
  1428.         playersP:RemoveAura(40647)
  1429.    end
  1430.     PrisonList  = 0
  1431.     PrisonTable = {}
  1432.     KrasusEnd:RemoveAura(40647)
  1433. end
  1434. ------HANDLE ULTIMATE PROTECT-------------
  1435. local ProtectList  = 0
  1436. local ProtectTable = {}
  1437.  
  1438. function VH_InstancePlayerProtectionStart(pUnit, event)
  1439.     PrisonList = VH_Master:GetInRangePlayersCount()
  1440.     Alexstraz:RegisterEvent("VH_InstancePlayerProtection", 1000, 1)
  1441. end
  1442.  
  1443. function VH_InstancePlayerProtection(pUnit, event)
  1444.     local playersPr
  1445.    while #ProtectTable < ProtectList do
  1446.        playersPr = pUnit:GetRandomPlayer(0)
  1447.        if table.find(ProtectTable, playersPr) == false then table.insert(ProtectTable, playersPr) end
  1448.         playersPr:CastSpell(31901)
  1449.    end
  1450.     ProtectList  = 0
  1451.     ProtectTable = {}
  1452. end
  1453. ------HANDLE DISABLE FLIGHT AND MORPH-------------
  1454. local DeFlightList  = 0
  1455. local DeFlightTable = {}
  1456.  
  1457. function VH_DisableFlightMorph(pUnit, event)
  1458.     DeFlightList = VH_Master:GetInRangePlayersCount()
  1459.     Alexstraz:RegisterEvent("VH_DisableFlightMorphExecute", 1000, 1)
  1460. end
  1461.  
  1462. function VH_DisableFlightMorphExecute(pUnit, event)
  1463.     local playersFlight
  1464.    while #DeFlightTable < DeFlightList do
  1465.        playersFlight = pUnit:GetRandomPlayer(0)
  1466.        if table.find(DeFlightTable, playersFlight) == false then table.insert(DeFlightTable, playersFlight) end
  1467.         playersFlight:SetMovementType(256)
  1468.         playersFlight:Land()
  1469.         playersFlight:SetModel(0)
  1470.         playersFlight:DeMorph()
  1471.         playersFlight:SetScale(1)
  1472.         playersFlight:EnableFlight(0)
  1473.         Alexstraz:FullCastSpellOnTarget(130, playersFlight)
  1474.    end
  1475.     DeFlightList  = 0
  1476.     DeFlightTable = {}
  1477. end
  1478.  
  1479. ---GRAND CINEMATIC ENDING---
  1480. function VH_InstanceGrandCinematic_1(pUnit, event)
  1481.     Alexstraz:CastSpell(63660)
  1482.     KrasusEnd:CastSpell(63660)
  1483.     Alexstraz:SetModel(28227)
  1484.     KrasusEnd:SetModel(24976)
  1485.     Alexstraz:SetScale(1)
  1486.     KrasusEnd:SetScale(1)
  1487.     Alexstraz:RegisterEvent("VH_InstanceGrandCinematic_2", 2000, 1)
  1488. end
  1489. function VH_InstanceGrandCinematic_2(pUnit, event)
  1490.     Alexstraz:SendChatMessage(12, 0, "Young heroes, I cannot express how grateful I am to have your aid. I do not wish to fathom what may have occured had you not aided my consort.")
  1491.     Alexstraz:RegisterEvent("VH_InstanceGrandCinematic_3", 4000, 1)
  1492. end
  1493. function VH_InstanceGrandCinematic_3(pUnit, event)
  1494.     KrasusEnd:SendChatMessage(12, 0, "Chrysophylax was a powerful opponent. He managed to fool all of us..I can only imagine what other minions The Lich King has.")
  1495.     KrasusEnd:RegisterEvent("VH_InstanceGrandCinematic_4", 5000, 1)
  1496. end
  1497. function VH_InstanceGrandCinematic_4(pUnit, event)
  1498.     KrasusEnd:SendChatMessage(16, 0, "Krasus has a troubled look on his face.")
  1499.     Alexstraz:SendChatMessage(12, 0, "Krasus my love, do not worry what the future holds. We have heroes like these all across the lands to protect Azeroth from destruction.")
  1500.     Alexstraz:RegisterEvent("VH_InstanceGrandCinematic_5", 6000, 1)
  1501. end
  1502. function VH_InstanceGrandCinematic_5(pUnit, event)
  1503.     Alexstraz:SendChatMessage(12, 0, "My friends, I hearby declare you Chapions of the Red Dragonflight. Your actions on this day have showed burning courage in the face of destruction.")
  1504.     Alexstraz:RegisterEvent("VH_InstanceGrandCinematic_6", 4000, 1)
  1505. end
  1506. function VH_InstanceGrandCinematic_6(pUnit, event)
  1507.     Alexstraz:SendChatMessage(12, 0, "Because of you the Kirin'Tor, Dalaran, and Northrend have been protected from the forces of Arthas, and for this we are eternally grateful!")
  1508.     Alexstraz:RegisterEvent("VH_InstanceGrandCinematic_7", 6000, 1)
  1509. end
  1510. function VH_InstanceGrandCinematic_7(pUnit, event)
  1511.     KrasusEnd:SendChatMessage(12, 0, "I must also extend my personal thanks to you champions, without you I fear I may have not been able to keep the seal on the Violet Hold strong to hold back the forces.")
  1512.     KrasusEnd:RegisterEvent("VH_InstanceGrandCinematic_8", 7000, 1)
  1513. end
  1514. function VH_InstanceGrandCinematic_8(pUnit, event)
  1515.     KrasusEnd:SendChatMessage(12, 0, "And now that Chrysophylax has been defeated the Violet Hold is safe from any further invasions, so for that the Kirin'Tor thank you as well.")
  1516.     KrasusEnd:RegisterEvent("VH_InstanceGrandCinematic_9", 5000, 1)
  1517. end
  1518. function VH_InstanceGrandCinematic_9(pUnit, event)
  1519.     Alexstraz:SendChatMessage(12, 0, "Come Krasus, let us go back to the Wyrmrest temple and rest, we have had a long fight today and it is well deserved.")
  1520.     Alexstraz:RegisterEvent("VH_InstanceGrandCinematic_10", 4000, 1)
  1521. end
  1522. function VH_InstanceGrandCinematic_10(pUnit, event)
  1523.     KrasusEnd:SendChatMessage(12, 0, "Yes my queen.")
  1524.     KrasusEnd:RegisterEvent("VH_InstanceGrandCinematic_11", 2000, 1)
  1525. end
  1526. function VH_InstanceGrandCinematic_11(pUnit, event)
  1527.     KrasusEnd:SendChatMessage(15, 0, "Haha I think I shall enjoy a nice 'rest' with my queen.")
  1528.     KrasusEnd:RegisterEvent("VH_InstanceGrandCinematic_12" , 3000, 1)
  1529. end
  1530. function VH_InstanceGrandCinematic_12(pUnit, event)
  1531.     Alexstraz:SendChatMessage(12, 0, "You know...I can hear your thoughts my love.")
  1532.     Alexstraz:RegisterEvent("VH_InstanceGrandCinematic_13", 2000, 1)
  1533. end
  1534. function VH_InstanceGrandCinematic_13(pUnit, event)
  1535.     Alexstraz:SendChatMessage(16, 0, "Alexstrasza smiles.")
  1536.     Alexstraz:RegisterEvent("VH_InstanceGrandCinematic_14", 3000, 1)
  1537. end
  1538. function VH_InstanceGrandCinematic_14(pUnit, event)
  1539.     Alexstraz:CastSpell(7077)
  1540.     Alexstraz:Despawn(2000 , 0)
  1541.     KrasusEnd:RegisterEvent("VH_InstanceGrandCinematic_15", 3000, 1)
  1542. end
  1543. function VH_InstanceGrandCinematic_15(pUnit, event)
  1544.     KrasusEnd:SendChatMessage(12, 0, "Oh my, oh my, this should be fun...Erhem...uhh..Farewell Champions!")
  1545.     KrasusEnd:RegisterEvent("VH_InstanceGrandCinematic_16", 2000, 1)
  1546. end
  1547. function VH_InstanceGrandCinematic_16(pUnit, event)
  1548.     KrasusEnd:CastSpell(7077)
  1549.     KrasusEnd:Despawn(2000, 0)
  1550. end
  1551. -------------------------------------------------------------------------
  1552. ---                             VIOLET HOLD TRASH           ---
  1553. -------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement