Advertisement
Guest User

stoneharry

a guest
Mar 7th, 2010
1,692
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 31.19 KB | None | 0 0
  1. ------------------------------------------------------------------
  2. --[[
  3. This script was made by Stoneharry of www.MMOwned.com
  4. This script may be edited and changed at will, but credits must be provided.
  5. Thank you.
  6.  
  7. Please note the following has not been included within this script:
  8. - 25man version
  9. - Defile
  10. - Frostmourne Chamber
  11. ]]
  12. ------------------------------------------------------------------
  13.  
  14. local Lich = nil
  15. local Tirion = nil
  16. local package = nil
  17. local Terenas = nil
  18. local Count = 0
  19. local Phase = 0
  20. local Players_Wiped = 0
  21.  
  22. ---- Checkers ----------------------------------------------------
  23.  
  24. if GetLuaEngine() ~= "LuaHypArc" then -- Make sure we are using LuaHypArc
  25.     print("-------------------------------------------------------------------")
  26.     print("LuaHypArc is not installed. This script may not function correctly.")
  27.     print("LuaHypArc comes with ArcEmu by default.")
  28.     print("-------------------------------------------------------------------")
  29.     else
  30.     print("-------------------------------------------------------")
  31.     print("-- The Lich King - Made by Stoneharry of MMOwned.com --")
  32.     print("--                     Enjoy                         --")
  33.     print("-------------------------------------------------------")
  34. end
  35.  
  36. ---- Lich King ---------------------------------------------------
  37.  
  38. function LichKing_OnSpawn(pUnit, Event)
  39.     pUnit:RegisterEvent("LichKing_OnSpawn_Go", 1000, 1)
  40. end
  41.  
  42. function LichKing_OnSpawn_Go(pUnit, Event)
  43.     if Lich ~= nil then -- Do a check
  44.     Lich:RemoveFromWorld()
  45.     end
  46.     Lich = pUnit
  47.     Lich:SetFaction(35)
  48. end
  49.  
  50. RegisterUnitEvent(3072111, 18, "LichKing_OnSpawn")
  51.  
  52. ---- Tirion ------------------------------------------------------
  53.  
  54. function TirionFordring_OnSpawn(pUnit, Event)
  55.     pUnit:RegisterEvent("TirionFordring_OnSpawn_Go", 5000, 0)
  56. end
  57.  
  58. function TirionFordring_OnSpawn_Go(pUnit, Event)
  59.     if Lich ~= nil then -- If theres no lich king we can't start the event
  60.         local plr = pUnit:GetClosestPlayer()
  61.         if plr ~= nil then -- we need a player
  62.             if pUnit:GetDistanceYards(plr) < 5 then -- we are close enough to start
  63.                 local PlayersAllAround = pUnit:GetInRangePlayers()
  64.                 for a, players in pairs(PlayersAllAround) do
  65.                 players:CastSpell(69127)
  66.                 end
  67.             pUnit:PlaySoundToSet(17458)
  68.             pUnit:RemoveEvents() -- Stop repeating
  69.             Lich:MoveTo(461.47, -2123.73, 1572.1, 0)
  70.             pUnit:Emote(375, 60000)
  71.             pUnit:PlaySoundToSet(17349) -- pUnit since players are closer to him
  72.             Lich:SendChatMessage(14, 0, "So...the Light's vaunted justice has finally arrived. Shall I lay down Frostmourne and throw myself at your mercy, Fordring?")
  73.             pUnit:RegisterEvent("TirionFordring_OnSpawn_Goz", 13500, 1)
  74.             end
  75.         end
  76.     end
  77. end
  78.  
  79. RegisterUnitEvent(26529762, 18, "TirionFordring_OnSpawn")
  80.  
  81. function TirionFordring_OnSpawn_Goz(pUnit, Event)
  82.     pUnit:SendChatMessage(14,0,"We will grant you a swift death, Arthas. More than can be said for the thousands you've tortured and slain.")
  83.     pUnit:PlaySoundToSet(17390)
  84.     local PlayersAllAround = pUnit:GetInRangePlayers()
  85.     for a, players in pairs(PlayersAllAround) do
  86.     players:CastSpell(69127)
  87.     end
  88.     pUnit:RegisterEvent("TirionFordring_OnSpawn_Gozz", 9000, 1)
  89. end
  90.  
  91. function TirionFordring_OnSpawn_Gozz(pUnit, Event)
  92.     Lich:SendChatMessage(14,0,"You will learn of that first hand. When my work is complete, you will beg for mercy -- and I will deny you. Your anguished cries will be testament to my unbridled power.")
  93.     pUnit:PlaySoundToSet(17350)
  94.     Lich:Emote(397, 4000)
  95.     pUnit:RegisterEvent("zTirionFordring_OnSpawn_Gozzz", 4500, 1)
  96.     pUnit:RegisterEvent("zzTirionFordring_OnSpawn_Gozzz", 12000, 1)
  97.     pUnit:RegisterEvent("TirionFordring_OnSpawn_Gozzz", 22000, 1)
  98. end
  99.  
  100. function zTirionFordring_OnSpawn_Gozzz(pUnit, Event)
  101.     Lich:Emote(1, 6000)
  102. end
  103.  
  104. function zzTirionFordring_OnSpawn_Gozzz(pUnit, Event)
  105.     Lich:Emote(392, 3500)
  106. end
  107.  
  108. function TirionFordring_OnSpawn_Gozzz(pUnit, Event)
  109.     Lich:SendChatMessage(14,0,"So be it. Champions, attack!")
  110.     pUnit:PlaySoundToSet(17391)
  111.     pUnit:Emote(397, 2000)
  112.     pUnit:RegisterEvent("PATHETIC_RUN_TIRION", 2000, 1)
  113.     pUnit:RegisterEvent("TirionFordring_OnSpawn_Gozzzz", 3000, 1)
  114.     pUnit:RegisterEvent("TirionFordring_zzz_Gozzzz", 4500, 1)
  115. end
  116.  
  117. function PATHETIC_RUN_TIRION(pUnit, Event)
  118.     pUnit:SetMovementFlags(1)
  119.     pUnit:MoveTo(485.92, -2123.2, 1572.1, 3.17)
  120. end
  121.  
  122. function TirionFordring_OnSpawn_Gozzzz(pUnit, Event)
  123.     Lich:SendChatMessage(14,0,"I'll keep you alive to witness the end, Fordring. I would not want the Light's greatest champion to miss seeing this wretched world remade in my image.")
  124.     pUnit:PlaySoundToSet(17351)
  125.     local PlayersAllAround = pUnit:GetInRangePlayers()
  126.     for a, players in pairs(PlayersAllAround) do
  127.     players:CastSpell(69127)
  128.     end
  129.     Tirion = pUnit
  130. end
  131.  
  132. function TirionFordring_zzz_Gozzzz(pUnit, Event)
  133.     Tirion:CastSpell(45776)
  134.     Lich:SetFaction(22)
  135. end
  136.  
  137. -------- Rage Counter ---------------------------------------------
  138.  
  139. function Rage_Counter_Lich_King(pUnit, Event)
  140.     if Lich == nil then
  141.     pUnit:RemoveEvents()
  142.     else
  143.         if Count == 300 then
  144.             if Phase == 2 then
  145.             Count = 0
  146.             Phase = 0
  147.             Lich:RemoveEvents()
  148.             Lich:SendChatMessage(14,0,"Face now your tragic end!")
  149.             Lich:PlaySoundToSet(17365)
  150.             else
  151.             Lich:FullCastSpell(72143) -- Enrage, dunno real spell so we use this method :3
  152.             Phase = Phase + 1
  153.             end
  154.         else
  155.         Count = Count + 5
  156.         end
  157.     end
  158. end
  159.  
  160. -------- Fight ----------------------------------------------------
  161.  
  162. function LichKingHasEnteredCombatLawl_Phase_One(pUnit, Event)
  163.     if Tirion == nil then
  164.     pUnit:Despawn(1, 10000) -- Where the F is he
  165.     Lich = nil -- Reset
  166.     else
  167.         if Players_Wiped == 1 then
  168.         Players_Wiped = 0
  169.         Lich:SetHealthPct(10)
  170.         else
  171.         Lich:SetCombatCapable(0)
  172.         Lich:RegisterEvent("Rage_Counter_Lich_King", 5000, 0)
  173.         Lich:RegisterEvent("Adds_Spawning_Incoming_Dredge_Ghouls", 19000, 0) -- Every 20 seconds (19 + 1 for next)
  174.         Lich:RegisterEvent("Adds_Spawning_Incoming_Shambling_Horror", math.random(60000,70000), 0) -- Every 60-70 seconds (changes each match)
  175.         Lich:RegisterEvent("Necrotic_Plague_Incoming", 20000, 0)
  176.         Lich:RegisterEvent("Infest_Big_AOE_Incoming", 30000, 0)
  177.         Lich:RegisterEvent("Phase_Two_Checker", 2500, 0)
  178.         end
  179.     end
  180. end
  181.  
  182. function Adds_Spawning_Incoming_Dredge_Ghouls(pUnit, Event)
  183.     Lich:RegisterEvent("Adds_Spawning_Incoming_Dredge_Ghoulsz", 1000, 3) -- 3 times
  184. end
  185.  
  186. function Adds_Spawning_Incoming_Dredge_Ghoulsz(pUnit, Event)
  187.     local x = Lich:GetX()
  188.     local y = Lich:GetY()
  189.     local z = Lich:GetZ()
  190.     local o = Lich:GetO()
  191.     if math.random(1,2) == 1 then -- Spawn in different locations basically
  192.     Lich:SpawnCreature(3769511, x+math.random(1,6), y+math.random(1,6), z, o, 15, 360000)
  193.     else
  194.     Lich:SpawnCreature(3769511, x-math.random(1,6), y-math.random(1,6), z, o, 15, 360000)
  195.     end
  196. end
  197.  
  198. function Adds_Spawning_Incoming_Shambling_Horror(pUnit, Event)
  199.     local x = Lich:GetX()
  200.     local y = Lich:GetY()
  201.     local z = Lich:GetZ()
  202.     local o = Lich:GetO()
  203.     if math.random(1,2) == 1 then -- Spawn in different locations basically
  204.     Lich:SpawnCreature(3769811, x+math.random(1,6), y+math.random(1,6), z, o, 15, 360000)
  205.     else
  206.     Lich:SpawnCreature(3769811, x-math.random(1,6), y-math.random(1,6), z, o, 15, 360000)
  207.     end
  208. end
  209.  
  210. function Necrotic_Plague_Incoming(pUnit, Event)
  211.     local plr = Lich:GetRandomPlayer(0) -- I think this is correct
  212.     if plr ~= nil then
  213.     Lich:FullCastSpellOnTarget(70337, plr) -- ^ ^ ^ ^ ^ ^ ^ ^ ^
  214.     end
  215. end
  216.  
  217. function Infest_Big_AOE_Incoming(pUnit, Event)
  218.     Lich:FullCastSpell(70541)
  219. end
  220.  
  221. RegisterUnitEvent(3072111, 1, "LichKingHasEnteredCombatLawl_Phase_One")
  222.  
  223. function Phase_Two_Checker(pUnit, Event)
  224.     if Lich:GetHealthPct() < 71 then
  225.     Lich:RemoveEvents()
  226.     Lich:MoveTo(512.7, -2120.5, 1572.1, 0)
  227.     Lich:SetMovementFlags(1)
  228.     Lich:SetCombatCapable(1)
  229.     Lich:RegisterEvent("Test_Debug_MoveToCentreOfRoom", 100, 0)
  230.     Lich:RegisterEvent("Test_Debug_MoveToCentreOfRoom_z", 4005, 1)
  231.     end
  232. end
  233.  
  234. function Test_Debug_MoveToCentreOfRoom(pUnit, Event)
  235.     Lich:MoveTo(512.7, -2120.5, 1572.1, 0)
  236.     Lich:SetMovementFlags(1)
  237. end
  238.  
  239. function Test_Debug_MoveToCentreOfRoom_z(pUnit, Event)
  240.     Lich:RemoveEvents()
  241.     Lich:Root()
  242.     Lich:FullCastSpell(68981)
  243.     Lich:SendChatMessage(14,0,"I will freeze you from within until all that remains is an icy husk!")
  244.     Lich:PlaySoundToSet(17369)
  245.     Lich:RegisterEvent("weaiyhoahg_delay", 6000, 1)
  246. end
  247.  
  248. function weaiyhoahg_delay(pUnit, Event)
  249.     local x = Lich:GetX()
  250.     local y = Lich:GetY()
  251.     Lich:SpawnCreature(3769812, x+math.random(3,6), y+math.random(3,6), Lich:GetZ(), Lich:GetZ(), 21, 10000)
  252.     Lich:RegisterEvent("Spam_Of_Lightning_That_Looks_Crap_But_Is_Blizzlike", 1500, 0)
  253.     Lich:RegisterEvent("NeedToWaitBecauseAddsBreakAndShizzleOrSomething", 3005, 1)
  254.     Lich:RegisterEvent("RandomRagingSpiritAddsThatAreNotRandom", 19990, 3) -- So we can get 3 in a minute without removing events
  255.     Lich:RegisterEvent("Test_Despawn_Outer_Shell", 59000, 0)
  256. end
  257.  
  258. function NeedToWaitBecauseAddsBreakAndShizzleOrSomething(pUnit,Event)
  259.     local x = Lich:GetX()
  260.     local y = Lich:GetY()
  261.     Lich:SpawnCreature(3769812, x-math.random(3,6), y-math.random(3,6), Lich:GetZ(), Lich:GetZ(), 21, 10000)
  262. end
  263.  
  264. function RandomRagingSpiritAddsThatAreNotRandom(pUnit, Event)
  265.     local plr = Lich:GetRandomPlayer(0)
  266.     if plr ~= nil then
  267.     local x,y,z,o = plr:GetX(),plr:GetY(),plr:GetZ(),plr:GetO()
  268.     Lich:SpawnCreature(3769813, x,y,z,o , 21, 360000)
  269.     end
  270. end
  271.  
  272. function Spam_Of_Lightning_That_Looks_Crap_But_Is_Blizzlike(pUnit, Event)
  273.     local plr = Lich:GetRandomPlayer(0)
  274.     if plr ~= nil then
  275.     Lich:FullCastSpellOnTarget(72133, plr)
  276.     end
  277. end
  278.    
  279. function Test_Despawn_Outer_Shell(pUnit, Event)
  280.     Lich:RemoveEvents()
  281.     Lich:SendChatMessage(14,0,"Watch as the world around you collapses!")
  282.     Lich:PlaySoundToSet(17370)
  283.     --Lich:CastSpell(59084) -- temporary solution to no destructable object support on ArcEmu
  284.     Lich:SpawnCreature(2626262, 476.2, -2083.56, 1573.1, 0, 814, 20000)
  285.     Lich:SpawnCreature(2626262, 505.1, -2074.47, 1573.1, 0, 814, 20000)
  286.     Lich:SpawnCreature(2626262, 523.35, -2077.77, 1573.1, 0, 814, 20000)
  287.     Lich:SpawnCreature(2626262, 541, -2086.36, 1573.1, 0, 814, 20000)
  288.     Lich:SpawnCreature(2626262, 552.7, -2111.2, 1573.1, 0, 814, 20000)
  289.     Lich:SpawnCreature(2626262, 554, -2137, 1573.1, 0, 814, 20000)
  290.     Lich:SpawnCreature(2626262, 545.9, -2153.1, 1573.1, 0, 814, 20000)
  291.     Lich:SpawnCreature(2626262, 528, -2164, 1573.1, 0, 814, 20000)
  292.     Lich:SpawnCreature(2626262, 508.25, -2169.5, 1573.1, 0, 814, 20000)
  293.     Lich:SpawnCreature(2626262, 488.2, -2168, 1573.1, 0, 814, 20000)
  294.     Lich:RegisterEvent("DelayForDespawnSinceVisualTakesSomeTimeTehe_Zieghoszho", 1000, 1)
  295.     Lich:RegisterEvent("DelayForDespawnSinceVisualTakesSomeTimeTehe", 2500, 1)
  296. end
  297.  
  298. function DelayForDespawnSinceVisualTakesSomeTimeTehe_Zieghoszho(pUnit, Event)
  299.     Lich:FullCastSpell(72262) -- Epic shit I got working :D
  300. end
  301.  
  302. function DelayForDespawnSinceVisualTakesSomeTimeTehe(pUnit, Event)
  303.     local Object = Lich:GetGameObjectNearestCoords(pUnit:GetX(),pUnit:GetY(),pUnit:GetZ(), 2957197)
  304.     if Object ~= nil then
  305.     Object:Despawn(1,0)
  306.     --Lich:CastSpell(46853) -- Shakes camera
  307.     end
  308.     Lich:SetCombatCapable(0)
  309.     Lich:Unroot()
  310.     -- Phase 2
  311.     Lich:RegisterEvent("Infest_Big_AOE_Incoming", 22000, 0)
  312.     Lich:RegisterEvent("Summon_Valkyr_Shadowguard", 19500, 0)
  313.     Lich:RegisterEvent("Soul_Reaper_On_Main_Tank", 30000, 0)
  314.     Lich:RegisterEvent("Phase_TwoPointFive_Checker", 2500, 0)
  315.     -- I cba to script defile :3
  316. end
  317.  
  318. function Soul_Reaper_On_Main_Tank(pUnit, Event)
  319.     local tank = Lich:GetMainTank()
  320.     if tank ~= nil then
  321.     Lich:FullCastSpellOnTarget(69409, tank)
  322.     end
  323. end
  324.  
  325. function Summon_Valkyr_Shadowguard(pUnit, Event)
  326.     local x, y, z, o = Lich:GetX()+3, Lich:GetY(), Lich:GetZ(), Lich:GetO()
  327.     Lich:SpawnCreature(25452151, x, y, z, o, 22, 0)
  328.     Lich:SendChatMessage(14,0,"Val'kyr, your master calls!")
  329.     Lich:PlaySoundToSet(17373)
  330. end
  331.  
  332. function Phase_TwoPointFive_Checker(pUnit, Event)
  333.     if Lich:GetHealthPct() < 41 then
  334.     Lich:RemoveEvents()
  335.     Lich:MoveTo(512.7, -2120.5, 1572.1, 0)
  336.     Lich:SetMovementFlags(1)
  337.     Lich:SetCombatCapable(1)
  338.     Lich:RegisterEvent("hhTest_Debug_MoveToCentreOfRoom", 100, 0)
  339.     Lich:RegisterEvent("hhTest_Debug_MoveToCentreOfRoom_z", 4005, 1)
  340.     end
  341. end
  342.  
  343. function hhTest_Debug_MoveToCentreOfRoom(pUnit, Event)
  344.     Lich:MoveTo(512.7, -2120.5, 1572.1, 0)
  345.     Lich:SetMovementFlags(1)
  346. end
  347.  
  348. function hhTest_Debug_MoveToCentreOfRoom_z(pUnit, Event)
  349.     Lich:RemoveEvents()
  350.     Lich:Root()
  351.     Lich:FullCastSpell(68981)
  352.     Lich:SendChatMessage(14,0,"I will freeze you from within until all that remains is an icy husk!")
  353.     Lich:PlaySoundToSet(17369)
  354.     Lich:RegisterEvent("jjweaiyhoahg_delay", 6000, 1)
  355. end
  356.  
  357. function jjweaiyhoahg_delay(pUnit, Event)
  358.     local x = Lich:GetX()
  359.     local y = Lich:GetY()
  360.     Lich:SpawnCreature(3769812, x+math.random(3,6), y+math.random(3,6), Lich:GetZ(), Lich:GetZ(), 21, 10000)
  361.     Lich:RegisterEvent("Spam_Of_Lightning_That_Looks_Crap_But_Is_Blizzlike", 1500, 0)
  362.     Lich:RegisterEvent("NeedToWaitBecauseAddsBreakAndShizzleOrSomething", 3005, 1)
  363.     Lich:RegisterEvent("RandomRagingSpiritAddsThatAreNotRandom", 14000, 3)
  364.     Lich:RegisterEvent("zzzTest_Despawn_Outer_Shell", 59000, 0)
  365. end
  366.  
  367. function zzzTest_Despawn_Outer_Shell(pUnit, Event)
  368.     Lich:RemoveEvents()
  369.     Lich:SendChatMessage(14,0,"Watch as the world around you collapses!")
  370.     Lich:PlaySoundToSet(17370)
  371.     --Lich:CastSpell(59084) -- temporary solution to no destructable object support on ArcEmu
  372.     Lich:SpawnCreature(2626262, 476.2, -2083.56, 1573.1, 0, 814, 20000)
  373.     Lich:SpawnCreature(2626262, 505.1, -2074.47, 1573.1, 0, 814, 20000)
  374.     Lich:SpawnCreature(2626262, 523.35, -2077.77, 1573.1, 0, 814, 20000)
  375.     Lich:SpawnCreature(2626262, 541, -2086.36, 1573.1, 0, 814, 20000)
  376.     Lich:SpawnCreature(2626262, 552.7, -2111.2, 1573.1, 0, 814, 20000)
  377.     Lich:SpawnCreature(2626262, 554, -2137, 1573.1, 0, 814, 20000)
  378.     Lich:SpawnCreature(2626262, 545.9, -2153.1, 1573.1, 0, 814, 20000)
  379.     Lich:SpawnCreature(2626262, 528, -2164, 1573.1, 0, 814, 20000)
  380.     Lich:SpawnCreature(2626262, 508.25, -2169.5, 1573.1, 0, 814, 20000)
  381.     Lich:SpawnCreature(2626262, 488.2, -2168, 1573.1, 0, 814, 20000)
  382.     Lich:RegisterEvent("DelayForDespawnSinceVisualTakesSomeTimeTehe_Zieghoszho", 1000, 1)
  383.     Lich:RegisterEvent("zzzDelayForDespawnSinceVisualTakesSomeTimeTehe", 2500, 1)
  384. end
  385.  
  386. function zzzDelayForDespawnSinceVisualTakesSomeTimeTehe(pUnit, Event)
  387.     -- No object to despawn this time - Outer shell part already there
  388.     Lich:SetCombatCapable(0)
  389.     Lich:Unroot()
  390.     -- Phase 3
  391.     Lich:RemoveEvents()
  392.     Lich:RegisterEvent("Soul_Reaper_On_Main_Tank", 30000, 0)
  393.     Lich:RegisterEvent("Harvest_Soul_Random_Raid_Member", 66000, 0)
  394.     Lich:RegisterEvent("Vile_Spirits_Spawning_Inc", 28000, 0)
  395.     Lich:RegisterEvent("Phase_Four_The_Ending_tehe", 1500, 0)
  396. end
  397.  
  398. function Harvest_Soul_Random_Raid_Member(pUnit, Event)
  399.     local plr = Lich:GetRandomPlayer(0)
  400.     if plr ~= nil then
  401.     Lich:SendChatMessage(14,0,"Frostmourne hungers...")
  402.     Lich:PlaySoundToSet(17366)
  403.     Lich:FullCastSpellOnTarget(68980, plr)
  404.     end
  405. end
  406.  
  407. function Vile_Spirits_Spawning_Inc(pUnit, Event)
  408.     Lich:RegisterEvent("Spawning_The_Vile_spirits_NoW", 1000, 10)
  409. end
  410.  
  411. function Spawning_The_Vile_spirits_NoW(pUnit, Event)
  412.     local pla = Lich:GetRandomPlayer(0)
  413.     if pla ~= nil then
  414.     local x, y, z, o = pla:GetX(), pla:GetY(), pla:GetZ(), pla:GetO()
  415.     Lich:SpawnCreature(5078151, x, y, z, o, 22, 60000)
  416.     end
  417. end
  418.  
  419. function Phase_Four_The_Ending_tehe(pUnit, Event)
  420.     if Lich:GetHealthPct() < 11 then
  421.     Count = 0
  422.     Phase = 0
  423.     Lich:RemoveEvents()
  424.     Lich:SendChatMessage(14,0,"You gnats actually hurt me! Perhaps I've toyed with you long enough, now taste the vengeance of the grave!")
  425.     Lich:PlaySoundToSet(17359)
  426.     Lich:MoveTo(512.7, -2120.5, 1572.1, 0)
  427.     Lich:SetMovementFlags(1)
  428.     Lich:SetCombatCapable(1)
  429.     Lich:RegisterEvent("hhTest_Debug_MoveToCentreOfRoom", 100, 0)
  430.     Lich:RegisterEvent("hggzhTest_Debug_MoveToCentreOfRoom_z", 5005, 1)
  431.     end
  432. end
  433.  
  434. function hggzhTest_Debug_MoveToCentreOfRoom_z(pUnit, Event)
  435.     Lich:RemoveEvents()
  436.     Lich:FullCastSpell(70063)
  437.     Players_Wiped = 1
  438.     -- Most of the visuals needed are not in game due to ArcEmu's screwed up extractors
  439.     Lich:RegisterEvent("Debug_Send_Next_Message_LichKing", 10000, 1)
  440. end
  441.  
  442. function Debug_Send_Next_Message_LichKing(pUnit, Event)
  443.     Lich:SendChatMessage(14,0,"No question remains unanswered. No doubts linger. You are Azeroth's greatest champions! You overcame every challenge I laid before you. My mightiest servants have fallen before your relentless onslaught, your unbridled fury...")
  444.     Lich:PlaySoundToSet(17353)
  445.     Lich:RegisterEvent("zzDebug_Send_Next_Message_LichKing", 25000, 1)
  446. end
  447.  
  448. function zzDebug_Send_Next_Message_LichKing(pUnit, Event)
  449.     Lich:SendChatMessage(14,0,"You trained them well, Fordring. You delivered the greatest fighting force this world has ever known... right into my hands -- exactly as I intended. You shall be rewarded for your unwitting sacrifice.")
  450.     Lich:PlaySoundToSet(17355)
  451.     local plr = Lich:GetRandomPlayer(0)
  452.     if plr ~= nil then
  453.     Lich:ChannelSpell(71769, plr)
  454.     end
  455.     Lich:RegisterEvent("zzzzDebug_Send_Next_Message_LichKing", 24000, 1)
  456. end
  457.  
  458. function zzzzDebug_Send_Next_Message_LichKing(pUnit, Event)
  459.     Lich:SendChatMessage(14,0,"Watch now as I raise them from the dead to become masters of the Scourge. They will shroud this world in chaos and destruction. Azeroth's fall will come at their hands -- and you will be the first to die.")
  460.     Lich:PlaySoundToSet(17356)
  461.     Lich:RegisterEvent("zzzzDebug_Send_Next_Message_LichKingzz", 26000, 1)
  462. end
  463.  
  464. function zzzzDebug_Send_Next_Message_LichKingzz(pUnit, Event)
  465.     Lich:PlaySoundToSet(17357)
  466.     Lich:SendChatMessage(14,0,"I delight in the irony.")
  467.     Lich:RegisterEvent("zzzzDebug_Send_Next_Message_LichKingzzzz", 6000, 1)
  468.     --Lich:StopChannel()
  469. end
  470.  
  471. function zzzzDebug_Send_Next_Message_LichKingzzzz(pUnit, Event)
  472.     if Tirion == nil then
  473.     Lich:Despawn(1,0)
  474.     else
  475.     Tirion:SendChatMessage(14,0,"LIGHT, GRANT ME ONE FINAL BLESSING. GIVE ME THE STRENGTH... TO SHATTER THESE BONDS!")
  476.     Tirion:PlaySoundToSet(17392)
  477.     Lich:RegisterEvent("Breakoutofice", 9000, 1)
  478.     end
  479. end
  480.  
  481. function Breakoutofice(pUnit, Event)
  482.     Tirion:RemoveAura(71614) --(Remove IceBlock, to cast the Spell under this Line :>)
  483.     Tirion:CastSpell(71797)
  484.     Tirion:CastSpell(71614) --(Get the IceBlock Again :>, You cannot see that he was out :>)
  485.     Lich:RegisterEvent("zzzzDebug_Send_Next_Message_LichKingzzzzgg", 5000, 1)
  486. end
  487.  
  488. function zzzzDebug_Send_Next_Message_LichKingzzzzgg(pUnit, Event)
  489.     Tirion:RemoveAura(71614) -- Ice Block
  490.     Tirion:CastSpell(71773)
  491.     Lich:RegisterEvent("zzzzDebug_Send_Next_Message_LichKingzzzzgzg", 1500, 1)
  492.     -- jumps and destroys frostmourne
  493. end
  494.  
  495. function zzzzDebug_Send_Next_Message_LichKingzzzzgzg(pUnit, Event)
  496.     local x, y, z, o = Lich:GetX(), Lich:GetY(), Lich:GetZ(), Lich:GetO()
  497.     Tirion:SetMovementFlags(1)
  498.     Tirion:MoveTo(x, y, z, o)
  499.     Lich:StopChannel()
  500.     Lich:RegisterEvent("zagazzzDebug_Send_Next_Message_LichKingzzzzgzg", 3000, 1)
  501. end
  502.  
  503. function zagazzzDebug_Send_Next_Message_LichKingzzzzgzg(pUnit, Event)
  504.     Lich:CastSpell(37592) -- Knockdown
  505.     Lich:CastSpell(72726) -- Boom visual
  506.     Lich:EquipWeapons(0,0,0)
  507.     Tirion:SetMovementFlags(1)
  508.     Tirion:MoveTo(536.5, -2121, 1572.1, 3.15)
  509.     Lich:RegisterEvent("zagazzzDebug_Send_Next_Message_LichKingzgeazzzzgzg", 1000, 1)
  510. end
  511.  
  512. function zagazzzDebug_Send_Next_Message_LichKingzgeazzzzgzg(pUnit, Event)
  513.     Lich:SendChatMessage(14,0,"Impossible...")
  514.     Lich:PlaySoundToSet(17358)
  515.     Lich:Emote(473, 120000)
  516.     Lich:CastSpell(72523)
  517.     Lich:RegisterEvent("zagazzzDebug_Send_Next_Message_LichKingzgeazzzzedhezgzg", 1500, 1)
  518. end
  519.  
  520. function zagazzzDebug_Send_Next_Message_LichKingzgeazzzzedhezgzg(pUnit, Event)
  521.     Tirion:SendChatMessage(14,0,"No more, Arthas! No more lives will be consumed by your hatred!")
  522.     Tirion:PlaySoundToSet(17393)
  523.     Tirion:SetMovementFlags(1)
  524.     Lich:Emote(473, 120000)
  525.     Lich:SpawnCreature(31021151, 518.8, -2115.8, 1572.1, 3.780169, 35, 0)
  526.     Tirion:MoveTo(526, -2120.5, 1572.1, 3)
  527.     Lich:RegisterEvent("zagazzzDebug_Send_Next_Message_LichKingzgeazzzzedhezgzzzzsay", 5500, 1)
  528. end
  529.  
  530. function zagazzzDebug_Send_Next_Message_LichKingzgeazzzzedhezgzzzzsay(pUnit, Event)
  531.     if Terenas == nil then -- Dunno why this would happen
  532.     Lich:Despawn(1,0)
  533.     Lich = nil
  534.     Tirion:Despawn(1,0)
  535.     Tirion = nil
  536.     else
  537.     Lich:Emote(473, 120000)
  538.     Terenas:SendChatMessage(14,0,"Free at last! It is over, my son. This is the moment of reckoning.")
  539.     Terenas:PlaySoundToSet(17397)
  540.     Terenas:ChannelSpell(51361, Terenas)
  541.     Lich:RegisterEvent("epiashgyophopapea_Lich_King_Is_Not_A_Happy_Bunny", 10000, 1)
  542.     end
  543. end
  544.  
  545. function epiashgyophopapea_Lich_King_Is_Not_A_Happy_Bunny(pUnit, Event)
  546.     Terenas:SendChatMessage(14,0,"Rise up, champions of the Light!")
  547.     Terenas:PlaySoundToSet(17398)
  548.     Terenas:StopChannel()
  549.     Terenas:CastSpell(37755)
  550.     Lich:Emote(473, 120000)
  551.     local PlayersAllAround = Terenas:GetInRangePlayers()
  552.     for a, players in pairs(PlayersAllAround) do
  553.     players:ResurrectPlayer(players)
  554.     players:CastSpell(24171)
  555.     end
  556.     Lich:RegisterEvent("zLich_King_Is_Not_A_Happy_Bunny", 5000, 1)
  557. end
  558.  
  559. function zLich_King_Is_Not_A_Happy_Bunny(pUnit, Event)
  560.     Terenas:Despawn(1,0)
  561.     Lich:Emote(473, 120000)
  562.     Lich:SendChatMessage(14,0,"Now I stand, the lion before the lambs... and they do not fear.")
  563.     Lich:PlaySoundToSet(17361)
  564.     Lich:RegisterEvent("zLich_King_Is_Not_A_Happy_Bunnyz", 8000, 1)
  565. end
  566.  
  567. function zLich_King_Is_Not_A_Happy_Bunnyz(pUnit, Event)
  568.     Lich:SendChatMessage(14,0,"They cannot fear.")
  569.     Lich:PlaySoundToSet(17362)
  570.     Lich:Emote(473, 120000)
  571.     Lich:SetHealthPct(10)
  572.     -- The end, poor arthas, Q_Q, lets all go do a rain dance, ~Stoneharry
  573. end
  574.  
  575. ---- Terenas -----------------------------------------------------
  576.  
  577. function Terenas_Spawned_root_Hes_the_realm_of_My_RETAIL_Char(pUnit, Event)
  578.     if Tirion == nil or Lich == nil then
  579.     pUnit:Despawn(1,0)
  580.     else
  581.     Terenas = pUnit
  582.     end
  583. end
  584.  
  585. RegisterUnitEvent(31021151, 18, "Terenas_Spawned_root_Hes_the_realm_of_My_RETAIL_Char")
  586.  
  587. -------------------------------------------------------------------
  588.  
  589. function LichKingHasDiedSoWePlayMovie(pUnit, Event)
  590.     Lich = nil
  591.     pUnit:RemoveEvents()
  592.     pUnit:PlaySoundToSet(17374) -- Freak makes dying sound
  593.     pUnit:SpawnCreature(3072110, pUnit:GetX(), pUnit:GetY(), pUnit:GetZ(), pUnit:GetO(), 35, 10000)
  594. end
  595.  
  596. RegisterUnitEvent(3072111, 4, "LichKingHasDiedSoWePlayMovie")
  597.  
  598. function TriggerHasSpawnedSoPlayMovie(pUnit, Event)
  599.     pUnit:RegisterEvent("PlayMovieOnceDeathAnimationHasPlayed", 9000, 1)
  600. end
  601.  
  602. function PlayMovieOnceDeathAnimationHasPlayed(pUnit, Event)
  603.     -- Reset Fight
  604.     Tirion = nil
  605.     Lich = nil
  606.     Terenas = nil
  607.     package = nil
  608.     Phase = 0
  609.     Count = 0
  610.     -- Movie
  611.     Players_Wiped = 0
  612.     local PlayersAllAround = pUnit:GetInRangePlayers()
  613.     for a, players in pairs(PlayersAllAround) do
  614.     --SMSG_TRIGGER_MOVIE = 0x464
  615.     local packet = LuaPacket:CreatePacket(0x464, 4) -- Move type 4
  616.     packet:WriteULong(16) -- Id 16
  617.     players:SendPacketToPlayer(packet) -- Send to players
  618.     end
  619.     -- Bolvar
  620.     local Bolvar = pUnit:GetGameObjectNearestCoords(428.758, -2124.4, 1594.69, 2508221) -- Bolvar in chains
  621.     if Bolvar ~= nil then
  622.     Bolvar:Despawn(1,0)
  623.     pUnit:SpawnGameObject(2508220, 428.758, -2124.4, 1594.69, 0, 360000) -- Chains
  624.     pUnit:SpawnGameObject(2508219, 430.103, -2124, 1595.93, 3.3, 360000) -- Bolvar
  625.     end
  626. end
  627.  
  628. RegisterUnitEvent(3072110, 18, "TriggerHasSpawnedSoPlayMovie")
  629.    
  630. ------- Adds ------------------------------------------------------
  631.  
  632. function Dredge_Ghouls_OnSpawn(pUnit, Event)
  633.     pUnit:RegisterEvent("TestRootFunctionNextSecond", 1, 1)
  634. end
  635.  
  636. function TestRootFunctionNextSecond(pUnit, Event)
  637.     if Lich == nil then -- This way when the ghoul spawns, if the fight is not happening for some reason it will just disapear again instantly as if nothing happened ;)
  638.     pUnit:RemoveFromWorld()
  639.     else -- Well if he is here
  640.     pUnit:Emote(449, 4000) -- spawn animation
  641.     pUnit:Root() -- Root him while he spawns
  642.     pUnit:RegisterEvent("Delay_A_Second_And_See_WhatHappens_Tehe", math.random(1,1000), 1)
  643.     pUnit:RegisterEvent("SetFactionToHostileForTheEmote", 4500, 1)
  644.     end
  645. end
  646.  
  647. function Delay_A_Second_And_See_WhatHappens_Tehe(pUnit, Event)
  648.     pUnit:CastSpell(55719)
  649. end
  650.  
  651. function SetFactionToHostileForTheEmote(pUnit, Event)
  652.     pUnit:Unroot() -- let him run free
  653.     pUnit:SetFaction(21) -- hostile
  654. end
  655.  
  656. RegisterUnitEvent(3769511, 18, "Dredge_Ghouls_OnSpawn")
  657.  
  658. ---------------------------------------------------------------------
  659.  
  660. function Shambling_Horrors_OnSpawn(pUnit, Event)
  661.     pUnit:RegisterEvent("zzTestRootFunctionNextSecond", 1, 1)
  662. end
  663.  
  664. function zzTestRootFunctionNextSecond(pUnit, Event)
  665.     if Lich == nil then -- This way when the ghoul spawns, if the fight is not happening for some reason it will just disapear again instantly as if nothing happened ;)
  666.     pUnit:RemoveFromWorld()
  667.     else -- Well if he is here
  668.     pUnit:Emote(449, 4000) -- spawn animation
  669.     pUnit:Root() -- Root him while he spawns
  670.     pUnit:CastSpell(55719)
  671.     pUnit:RegisterEvent("zzSetFactionToHostileForTheEmote", 4500, 1)
  672.     end
  673. end
  674.  
  675. function zzSetFactionToHostileForTheEmote(pUnit, Event)
  676.     pUnit:Unroot() -- let him run free
  677.     pUnit:SetFaction(21) -- hostile
  678. end
  679.  
  680. RegisterUnitEvent(3769811, 18, "Shambling_Horrors_OnSpawn")
  681.  
  682. function Shambling_Horrors_OnCombat(pUnit, Event)
  683.     if Lich == nil then -- This way when the ghoul spawns, if the fight is not happening for some reason it will just disapear again instantly as if nothing happened ;)
  684.     pUnit:RemoveFromWorld()
  685.     else -- Well if he is here
  686.     pUnit:RegisterEvent("Enrage_Spam_Incoming_Varied_Time", math.random(20000,25000), 0) -- Varied time depending on add
  687.     pUnit:RegisterEvent("Shockwave_thingy_time_notsure_on_timer", 15000, 0)
  688.     end
  689. end
  690.  
  691. function Enrage_Spam_Incoming_Varied_Time(pUnit, Event)
  692.     pUnit:FullCastSpell(72143)
  693. end
  694.  
  695. function Shockwave_thingy_time_notsure_on_timer(pUnit, Event)
  696.     pUnit:FullCastSpell(72149)
  697. end
  698.  
  699. function Shambling_Horrors_OnLeave(pUnit, Event)
  700.     pUnit:RemoveEvents()
  701. end
  702.  
  703. function Shambling_Horrors_OnDead(pUnit, Event)
  704.     pUnit:RemoveEvents()
  705. end
  706.  
  707. RegisterUnitEvent(3769811, 1, "Shambling_Horrors_OnCombat")
  708. RegisterUnitEvent(3769811, 2, "Shambling_Horrors_OnLeave")
  709. RegisterUnitEvent(3769811, 4, "Shambling_Horrors_OnDead")
  710.  
  711. ----- Ice Sphere --------------------------------------------------
  712.  
  713. -- 69090 on spawn -- only 2 on phase 1.5, head towards player and explode if hit
  714.  
  715. function IceShard_OnSpawn(pUnit, Event)
  716.     pUnit:RegisterEvent("rage_rage_rage_rage_Rage_rage", 1, 1)
  717. end
  718.  
  719. function rage_rage_rage_rage_Rage_rage(pUnit, Event)
  720.     if Lich == nil then
  721.     pUnit:RemoveFromWorld() -- may cause crash if he tries to despawn but variable broke
  722.     else
  723.         pUnit:FullCastSpell(69090) -- Visual
  724.         local pla = pUnit:GetRandomPlayer(0)
  725.         if pla ~= nil then
  726.         pUnit:MoveTo(pla:GetX(), pla:GetY(), pla:GetZ(), pla:GetO())
  727.         pUnit:SetMovementFlags(1)
  728.         pUnit:RegisterEvent("rage_rage_rage_rage_Rage_rage_r", 1000, 8)
  729.         else
  730.         pUnit:RemoveFromWorld()
  731.         end
  732.     end
  733. end
  734.  
  735. function rage_rage_rage_rage_Rage_rage_r(pUnit, Event)
  736.     local plm = pUnit:GetClosestPlayer()
  737.     if plm ~= nil then
  738.         pUnit:FullCastSpell(69090) -- Visual
  739.         if pUnit:GetDistanceYards(plm) < 4 then
  740.         --pUnit:FullCastSpellOnTarget(70827, plm) -- May be buggy if player dies, maybe not knockbacked and players try to exploit by ressing?
  741.         pUnit:FullCastSpellOnTarget(11027, plm) -- Knockback
  742.         pUnit:CastSpell(56135)
  743.         pUnit:RemoveEvents()
  744.         end
  745.     end
  746. end
  747.  
  748. RegisterUnitEvent(3769812, 18, "IceShard_OnSpawn")
  749.  
  750. ---- Raging Spirit ------------------------------------------------
  751.  
  752. function RagingSpirit_OnCombat(pUnit, Event)
  753.     if Lich == nil then
  754.     pUnit:RemoveFromWorld()
  755.     else
  756.     pUnit:RegisterEvent("Soul_Shriek_Random_Time_Depending_On_Mob", math.random(7500, 15000), 0)
  757.     pUnit:RegisterEvent("Soul_Shriek_Random_Visual", 1000, 1)
  758.     end
  759. end
  760.  
  761. function Soul_Shriek_Random_Visual(pUnit, Event)
  762.     pUnit:FullCastSpell(69198) -- Visual
  763. end
  764.  
  765. function Soul_Shriek_Random_Time_Depending_On_Mob(pUnit, Event)
  766.     pUnit:FullCastSpell(69242) -- Shriek
  767. end
  768.  
  769. function RagingSpirit_OnLeave(pUnit, Event)
  770.     pUnit:RemoveEvents()
  771. end
  772.  
  773. function RagingSpirit_OnDead(pUnit, Event)
  774.     pUnit:RemoveEvents()
  775. end
  776.  
  777. RegisterUnitEvent(3769813, 1, "RagingSpirit_OnCombat")
  778. RegisterUnitEvent(3769813, 2, "RagingSpirit_OnLeave")
  779. RegisterUnitEvent(3769813, 4, "RagingSpirit_OnDead")
  780.  
  781. ---- Flying Dudes ------------------------------------------------------
  782.  
  783. function zhgzFlying_Dude_OnCombat(pUnit, Event)
  784.     if Lich == nil then
  785.     pUnit:RemoveFromWorld()
  786.     else
  787.     pUnit:RegisterEvent("zhgzFlying_Dude_Find_Player", 1, 1)
  788.     end
  789. end
  790.  
  791. function zhgzFlying_Dude_Find_Player(pUnit, Event)
  792.     package = pUnit:GetClosestPlayer()
  793.     if package ~= nil then
  794.     pUnit:SetCombatCapable(1) -- Stop npc running around
  795.     package:SetPlayerLock(1) -- Stop player doing stuff :3
  796.     pUnit:SetMovementFlags(2) -- Flying Mode On
  797.     pUnit:ChannelSpell(55520, package) -- visual
  798.     pUnit:MoveTo(pUnit:GetX(), pUnit:GetY(), pUnit:GetZ()+6, pUnit:GetO(), 12288)
  799.     package:MovePlayerTo(package:GetX(), package:GetY(), package:GetZ()+6, package:GetO(), 12288)
  800.     pUnit:RegisterEvent("now_we_have_loaded_preset_We_can_move_on", 2000, 1)
  801.     else
  802.     pUnit:RemoveFromWorld()
  803.     end
  804. end
  805.  
  806. function now_we_have_loaded_preset_We_can_move_on(pUnit, Event)
  807.     if package ~= nil then
  808.     package:CastSpell(52241) -- Choke visual
  809.     package:CastSpell(53658) -- Bubble to stop stupid animations
  810.     pUnit:ChannelSpell(29172, package) -- visual
  811.     pUnit:RegisterEvent("now_we_have_loaded_preset_We_can_move_on_two", 1500, 0)
  812.     else
  813.     pUnit:RemoveEvents()
  814.     pUnit:RemoveFromWorld()
  815.     end
  816. end
  817.  
  818. function now_we_have_loaded_preset_We_can_move_on_two(pUnit, Event)
  819.     if package ~= nil then
  820.         if pUnit:GetX() == 572 and pUnit:GetY() == -2121.5 then -- Don't use Z, blizzard don't, POI's don't, why should we? It will just screw up and we don't need it :)
  821.         pUnit:RemoveEvents()
  822.         pUnit:StopChannel()
  823.         package:RemoveAura(52241) -- choke
  824.         package:RemoveAura(53658) -- buble
  825.         package:SetPlayerLock(0)
  826.         package = nil
  827.         --pUnit:RemoveFromWorld() -- Causes crash :(
  828.         else   
  829.         pUnit:SetMovementFlags(2)
  830.         package:ModifyFlySpeed(2.5)
  831.         pUnit:MoveTo(572, -2121.5, 1577.2, 0, 12288, 2.5)
  832.         package:MovePlayerTo(pUnit:GetX(), pUnit:GetY(), pUnit:GetZ() ,pUnit:GetO(), 12288)
  833.         end
  834.     else
  835.     pUnit:RemoveEvents()
  836.     pUnit:RemoveFromWorld()
  837.     end
  838. end
  839.  
  840. function zhgzFlying_Dude_OnDead(pUnit, Event)
  841.     pUnit:RemoveEvents()
  842.     pUnit:StopChannel()
  843.     package:RemoveAura(52241) -- choke
  844.     package:RemoveAura(53658) -- buble
  845.     package:SetPlayerLock(0)
  846.     package = nil
  847.     --pUnit:RemoveFromWorld() -- Causes crash :(
  848. end
  849.  
  850. RegisterUnitEvent(25452151, 1, "zhgzFlying_Dude_OnCombat")
  851. RegisterUnitEvent(25452151, 4, "zhgzFlying_Dude_OnDead")
  852.  
  853. ---- Vile Spirits ------------------------------------------------------
  854.  
  855. function VileSpiirt_OnCombat(pUnit, Event)
  856.     if Lich == nil then
  857.     pUnit:RemoveFromWorld()
  858.     else
  859.     pUnit:RegisterEvent("deoaopighophgeoaugozh_delay", 500, 1)
  860.     end
  861. end
  862.  
  863. function deoaopighophgeoaugozh_delay(pUnit, Event)
  864.     pUnit:Root()
  865.     pUnit:SetCombatCapable(1)
  866.     pUnit:RegisterEvent("Tick_Tick_Tick_dot_dot_dot_BOOM", 29000, 1)
  867. end
  868.  
  869. function Tick_Tick_Tick_dot_dot_dot_BOOM(pUnit, Event)
  870.     pUnit:RemoveEvents()
  871.     pUnit:CastSpell(37106)
  872.     pUnit:RegisterEvent("Kill_Self_Suicide_Or_Whathaveyou_vile", 1000, 1)
  873. end
  874.  
  875. function Kill_Self_Suicide_Or_Whathaveyou_vile(pUnit, Event)
  876.     pUnit:Despawn(1,0)
  877. end
  878.  
  879. function VileSpiirt_OnLeave(pUnit, Event)
  880.     pUnit:RemoveEvents()
  881. end
  882.  
  883. function VileSpiirt_OnDead(pUnit, Event)
  884.     pUnit:RemoveEvents()
  885. end
  886.  
  887. RegisterUnitEvent(5078151, 1, "VileSpiirt_OnCombat")
  888. RegisterUnitEvent(5078151, 2, "VileSpiirt_OnLeave")
  889. RegisterUnitEvent(5078151, 4, "VileSpiirt_OnDead")
  890.  
  891. ------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement