Advertisement
Guest User

stoneharry

a guest
May 3rd, 2010
1,419
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 41.08 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. - Defile
  9. - Frostmourne Chamber
  10.  
  11. ]]
  12. ------------------------------------------------------------------
  13.  
  14. local Lich = nil
  15. local Tirion = nil
  16. local package = nil
  17. local Terenas = nil
  18. local Garfield = nil
  19. local Object = nil
  20. local Count = 0
  21. local Phase = 0
  22. local Players_Wiped = 0
  23. local CheatMode = true -- If this is set to true then you can use #startlk and #endlk to to the intro and outro without actually fighting him. :) CAN BE VERY BUGGY!
  24.  
  25. ---- Checkers ----------------------------------------------------
  26.  
  27. if GetLuaEngine() ~= "LuaHypArc" then -- Make sure we are using LuaHypArc
  28.     print("-------------------------------------------------------------------")
  29.     print("LuaHypArc is not installed. This script may not function correctly.")
  30.     print("LuaHypArc comes with ArcEmu by default.")
  31.     print("-------------------------------------------------------------------")
  32.     else
  33.     print("-------------------------------------------------------")
  34.     print("-- The Lich King - Made by Stoneharry of MMOwned.com --")
  35.     print("--                     Enjoy                         --")
  36.     print("-------------------------------------------------------")
  37. end
  38.  
  39. ---- Lich King ---------------------------------------------------
  40.  
  41. function LichKing_OnSpawn(pUnit, Event)
  42.     pUnit:RegisterEvent("LichKing_OnSpawn_Go", 1000, 1)
  43. end
  44.  
  45. function LichKing_OnSpawn_Go(pUnit, Event)
  46.     if Lich ~= nil then -- Do a check
  47.     Lich:RemoveFromWorld()
  48.     end
  49.     Lich = pUnit
  50.     Lich:SetFaction(35)
  51. end
  52.  
  53. RegisterUnitEvent(3072111, 18, "LichKing_OnSpawn")
  54.  
  55. function LichKing_OnLeaveJewCombat(pUnit, Event)
  56.     if Players_Wiped == 1 then
  57.     Players_Wiped = 0
  58.     Lich:SetHealthPct(10)
  59.     else
  60.     pUnit:RemoveEvents()
  61.     end
  62. end
  63.  
  64. RegisterUnitEvent(3072111, 2, "LichKing_OnLeaveJewCombat")
  65.  
  66. ---- Tirion ------------------------------------------------------
  67.  
  68. function TirionFordring_OnSpawn(pUnit, Event)
  69.         Tirion = pUnit
  70.     pUnit:RegisterEvent("TirionFordring_OnSpawn_Go", 5000, 0)
  71. end
  72.  
  73. function TirionFordring_OnSpawn_Go(pUnit, Event)
  74.     if Lich ~= nil then -- If theres no lich king we can't start the event
  75.         local plr = pUnit:GetClosestPlayer()
  76.         if plr ~= nil then -- we need a player
  77.             if pUnit:GetDistanceYards(plr) < 5 then -- we are close enough to start
  78.                 local PlayersAllAround = pUnit:GetInRangePlayers()
  79.                 for a, players in pairs(PlayersAllAround) do
  80.                 players:CastSpell(69127)
  81.                 end
  82.             pUnit:PlaySoundToSet(17458)
  83.             pUnit:RemoveEvents() -- Stop repeating
  84.             Lich:MoveTo(461.47, -2123.73, 1572.1, 0)
  85.             pUnit:Emote(375, 60000)
  86.             pUnit:PlaySoundToSet(17349) -- pUnit since players are closer to him
  87.             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?")
  88.             pUnit:RegisterEvent("TirionFordring_OnSpawn_Goz", 13500, 1)
  89.             end
  90.         end
  91.     end
  92. end
  93.  
  94. RegisterUnitEvent(26529762, 18, "TirionFordring_OnSpawn")
  95.  
  96. function TirionFordring_OnSpawn_Goz(pUnit, Event)
  97.     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.")
  98.     pUnit:PlaySoundToSet(17390)
  99.     local PlayersAllAround = pUnit:GetInRangePlayers()
  100.     for a, players in pairs(PlayersAllAround) do
  101.     players:CastSpell(69127)
  102.     end
  103.     pUnit:RegisterEvent("TirionFordring_OnSpawn_Gozz", 9000, 1)
  104. end
  105.  
  106. function TirionFordring_OnSpawn_Gozz(pUnit, Event)
  107.     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.")
  108.     pUnit:PlaySoundToSet(17350)
  109.     Lich:Emote(397, 4000)
  110.     pUnit:RegisterEvent("zTirionFordring_OnSpawn_Gozzz", 4500, 1)
  111.     pUnit:RegisterEvent("zzTirionFordring_OnSpawn_Gozzz", 12000, 1)
  112.     pUnit:RegisterEvent("TirionFordring_OnSpawn_Gozzz", 22000, 1)
  113. end
  114.  
  115. function zTirionFordring_OnSpawn_Gozzz(pUnit, Event)
  116.     Lich:Emote(1, 6000)
  117. end
  118.  
  119. function zzTirionFordring_OnSpawn_Gozzz(pUnit, Event)
  120.     Lich:Emote(392, 3500)
  121. end
  122.  
  123. function TirionFordring_OnSpawn_Gozzz(pUnit, Event)
  124.     Lich:SendChatMessage(14,0,"So be it. Champions, attack!")
  125.     pUnit:PlaySoundToSet(17391)
  126.     pUnit:Emote(397, 2000)
  127.     pUnit:RegisterEvent("PATHETIC_RUN_TIRION", 2000, 1)
  128.     pUnit:RegisterEvent("TirionFordring_OnSpawn_Gozzzz", 3000, 1)
  129.     pUnit:RegisterEvent("TirionFordring_zzz_Gozzzz", 4500, 1)
  130. end
  131.  
  132. function PATHETIC_RUN_TIRION(pUnit, Event)
  133.     pUnit:SetMovementFlags(1)
  134.     pUnit:MoveTo(485.92, -2123.2, 1572.1, 3.17)
  135. end
  136.  
  137. function TirionFordring_OnSpawn_Gozzzz(pUnit, Event)
  138.     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.")
  139.     pUnit:PlaySoundToSet(17351)
  140.     local PlayersAllAround = pUnit:GetInRangePlayers()
  141.     for a, players in pairs(PlayersAllAround) do
  142.     players:CastSpell(69127)
  143.     end
  144.     Tirion = pUnit
  145. end
  146.  
  147. function TirionFordring_zzz_Gozzzz(pUnit, Event)
  148.     Tirion:CastSpell(71614)
  149.     Lich:SetFaction(22)
  150. end
  151.  
  152. -------- Rage Counter ---------------------------------------------
  153.  
  154. function Rage_Counter_Lich_King(pUnit, Event)
  155.     if Lich == nil then
  156.     pUnit:RemoveEvents()
  157.     else
  158.         if Count == 300 then
  159.             if Phase == 2 then
  160.             Count = 0
  161.             Phase = 0
  162.             Lich:RemoveEvents()
  163.             Lich:SendChatMessage(14,0,"Face now your tragic end!")
  164.             Lich:PlaySoundToSet(17365)
  165.             else
  166.             Lich:FullCastSpell(61714) -- Enrage, basic method used by most bosses, not real spell
  167.             Phase = Phase + 1
  168.             end
  169.         else
  170.         Count = Count + 5
  171.         end
  172.     end
  173. end
  174.  
  175. -------- Fight ----------------------------------------------------
  176.  
  177. function LichKingHasEnteredCombatLawl_Phase_One(pUnit, Event)
  178.     if Tirion == nil then
  179.     pUnit:Despawn(1, 10000) -- Where the F is he
  180.     Lich = nil -- Reset
  181.     else
  182.         if Players_Wiped == 1 then
  183.         --Players_Wiped = 0
  184.         Lich:SetHealthPct(10)
  185.         else
  186.             local Dungeon = pUnit:GetDungeonDifficulty()
  187.             if Dungeon == 0 then -- 10man normal
  188.             Lich:SetCombatCapable(0)
  189.             Lich:RegisterEvent("Rage_Counter_Lich_King", 5000, 0)
  190.             Lich:RegisterEvent("Adds_Spawning_Incoming_Dredge_Ghouls", 19000, 0) -- Every 20 seconds (19 + 1 for next)
  191.             Lich:RegisterEvent("Adds_Spawning_Incoming_Shambling_Horror", math.random(60000,70000), 0) -- Every 60-70 seconds (changes each match)
  192.             Lich:RegisterEvent("Necrotic_Plague_Incoming", 20000, 0)
  193.             Lich:RegisterEvent("Infest_Big_AOE_Incoming", 30000, 0)
  194.             Lich:RegisterEvent("Phase_Two_Checker", 2500, 0)
  195.             end
  196.             if Dungeon == 1 then -- 10man heroic
  197.             Lich:SetMaxHealth(29009376)
  198.             Lich:SetHealth(29009376)
  199.             Lich:SetCombatCapable(0)
  200.             Lich:RegisterEvent("Rage_Counter_Lich_King", 5000, 0)
  201.             Lich:RegisterEvent("Adds_Spawning_Incoming_Dredge_Ghouls", 19000, 0) -- Every 20 seconds (19 + 1 for next)
  202.             Lich:RegisterEvent("Adds_Spawning_Incoming_Shambling_Horror", math.random(60000,70000), 0) -- Every 60-70 seconds (changes each match)
  203.             Lich:RegisterEvent("zNecrotic_Plague_Incoming", 20000, 0)
  204.             Lich:RegisterEvent("zInfest_Big_AOE_Incoming", 30000, 0)
  205.             Lich:RegisterEvent("Phase_Two_Checker", 2500, 0)
  206.             end
  207.             if Dungeon == 2 then -- 25man normal
  208.             Lich:SetMaxHealth(60109376)
  209.             Lich:SetHealth(60109376)
  210.             Lich:SetCombatCapable(0)
  211.             Lich:RegisterEvent("Rage_Counter_Lich_King", 5000, 0)
  212.             Lich:RegisterEvent("Adds_Spawning_Incoming_Dredge_Ghouls", 19000, 0) -- Every 20 seconds (19 + 1 for next)
  213.             Lich:RegisterEvent("Adds_Spawning_Incoming_Shambling_Horror", math.random(60000,70000), 0) -- Every 60-70 seconds (changes each match)
  214.             Lich:RegisterEvent("zzNecrotic_Plague_Incoming", 20000, 0)
  215.             Lich:RegisterEvent("zzInfest_Big_AOE_Incoming", 30000, 0)
  216.             Lich:RegisterEvent("Phase_Two_Checker", 2500, 0)
  217.             end
  218.             if Dungeon == 3 then -- 25man heroic
  219.             Lich:SetMaxHealth(61009376)
  220.             Lich:SetHealth(61009376)
  221.             Lich:SetCombatCapable(0)
  222.             Lich:RegisterEvent("Rage_Counter_Lich_King", 5000, 0)
  223.             Lich:RegisterEvent("Adds_Spawning_Incoming_Dredge_Ghouls", 19000, 0) -- Every 20 seconds (19 + 1 for next)
  224.             Lich:RegisterEvent("Adds_Spawning_Incoming_Shambling_Horror", math.random(60000,70000), 0) -- Every 60-70 seconds (changes each match)
  225.             Lich:RegisterEvent("zzNecrotic_Plague_Incoming", 20000, 0)
  226.             Lich:RegisterEvent("zzInfest_Big_AOE_Incoming", 30000, 0)
  227.             Lich:RegisterEvent("Phase_Two_Checker", 2500, 0)
  228.             end
  229.         end
  230.     end
  231. end
  232.  
  233. function Adds_Spawning_Incoming_Dredge_Ghouls(pUnit, Event)
  234.     Lich:RegisterEvent("Adds_Spawning_Incoming_Dredge_Ghoulsz", 1000, 3) -- 3 times
  235. end
  236.  
  237. function Adds_Spawning_Incoming_Dredge_Ghoulsz(pUnit, Event)
  238.     local x = Lich:GetX()
  239.     local y = Lich:GetY()
  240.     local z = Lich:GetZ()
  241.     local o = Lich:GetO()
  242.     if math.random(1,2) == 1 then -- Spawn in different locations basically
  243.     Lich:SpawnCreature(3769511, x+math.random(1,6), y+math.random(1,6), z, o, 15, 360000)
  244.     else
  245.     Lich:SpawnCreature(3769511, x-math.random(1,6), y-math.random(1,6), z, o, 15, 360000)
  246.     end
  247. end
  248.  
  249. function Adds_Spawning_Incoming_Shambling_Horror(pUnit, Event)
  250.     local x = Lich:GetX()
  251.     local y = Lich:GetY()
  252.     local z = Lich:GetZ()
  253.     local o = Lich:GetO()
  254.     if math.random(1,2) == 1 then -- Spawn in different locations basically
  255.     Lich:SpawnCreature(3769811, x+math.random(1,6), y+math.random(1,6), z, o, 15, 360000)
  256.     else
  257.     Lich:SpawnCreature(3769811, x-math.random(1,6), y-math.random(1,6), z, o, 15, 360000)
  258.     end
  259. end
  260.  
  261. function Necrotic_Plague_Incoming(pUnit, Event) -- 10 man
  262.     local plr = Lich:GetRandomPlayer(0)
  263.     if plr ~= nil then
  264.     Lich:FullCastSpellOnTarget(70337, plr)
  265.     end
  266. end
  267.  
  268. function Infest_Big_AOE_Incoming(pUnit, Event)
  269.     Lich:FullCastSpell(70541)
  270. end
  271.  
  272. function zNecrotic_Plague_Incoming(pUnit, Event) -- 10 man heroic
  273.     local plr = Lich:GetRandomPlayer(0)
  274.     if plr ~= nil then
  275.     Lich:FullCastSpellOnTarget(73912, plr)
  276.     end
  277. end
  278.  
  279. function zInfest_Big_AOE_Incoming(pUnit, Event)
  280.     Lich:FullCastSpell(73780)
  281. end
  282.  
  283. function zzNecrotic_Plague_Incoming(pUnit, Event) -- 25 man
  284.     local plr = Lich:GetRandomPlayer(0)
  285.     if plr ~= nil then
  286.     Lich:FullCastSpellOnTarget(73779, plr)
  287.     end
  288. end
  289.  
  290. function zzInfest_Big_AOE_Incoming(pUnit, Event)
  291.     Lich:FullCastSpell(73780)
  292. end
  293.  
  294. RegisterUnitEvent(3072111, 1, "LichKingHasEnteredCombatLawl_Phase_One")
  295.  
  296. function Phase_Two_Checker(pUnit, Event)
  297.     if Lich:GetHealthPct() < 71 then
  298.     Lich:RemoveEvents()
  299.     Lich:MoveTo(512.7, -2120.5, 1572.1, 0)
  300.     Lich:SetMovementFlags(1)
  301.     Lich:SetCombatCapable(1)
  302.     Lich:RegisterEvent("Test_Debug_MoveToCentreOfRoom", 100, 0)
  303.     Lich:RegisterEvent("Test_Debug_MoveToCentreOfRoom_z", 4005, 1)
  304.     end
  305. end
  306.  
  307. function Test_Debug_MoveToCentreOfRoom(pUnit, Event)
  308.     Lich:MoveTo(512.7, -2120.5, 1572.1, 0)
  309.     Lich:SetMovementFlags(1)
  310. end
  311.  
  312. function Test_Debug_MoveToCentreOfRoom_z(pUnit, Event)
  313.     Lich:RemoveEvents()
  314.     Lich:Root()
  315.     if pUnit:GetDungeonDifficulty() == 0 then -- 10 man normal
  316.     Lich:FullCastSpell(68981)
  317.     --end
  318.     else
  319.     --if pUnit:GetDungeonDifficulty() == 1 then -- 10 man heroic
  320.     Lich:FullCastSpell(74270)
  321.     end
  322.     Lich:SendChatMessage(14,0,"I will freeze you from within until all that remains is an icy husk!")
  323.     Lich:PlaySoundToSet(17369)
  324.     Lich:RegisterEvent("weaiyhoahg_delay", 6000, 1)
  325. end
  326.  
  327. function weaiyhoahg_delay(pUnit, Event)
  328.     local x = Lich:GetX()
  329.     local y = Lich:GetY()
  330.     Lich:SpawnCreature(3769812, x+math.random(3,6), y+math.random(3,6), Lich:GetZ(), Lich:GetZ(), 21, 10000)
  331.     if pUnit:GetDungeonDifficulty() == 0 then -- 10 man normal
  332.     Lich:RegisterEvent("Spam_Of_Lightning_That_Looks_Crap_But_Is_Blizzlike", 1500, 0)
  333.     --end
  334.     else
  335.     --if pUnit:GetDungeonDifficulty() == 1 then -- 10 man normal
  336.     Lich:RegisterEvent("zSpam_Of_Lightning_That_Looks_Crap_But_Is_Blizzlike", 1500, 0)
  337.     end
  338.     Lich:RegisterEvent("NeedToWaitBecauseAddsBreakAndShizzleOrSomething", 3005, 1)
  339.     Lich:RegisterEvent("RandomRagingSpiritAddsThatAreNotRandom", 19990, 3) -- So we can get 3 in a minute without removing events
  340.     Lich:RegisterEvent("Test_Despawn_Outer_Shell", 59000, 0)
  341. end
  342.  
  343. function NeedToWaitBecauseAddsBreakAndShizzleOrSomething(pUnit,Event)
  344.     local x = Lich:GetX()
  345.     local y = Lich:GetY()
  346.     Lich:SpawnCreature(3769812, x-math.random(3,6), y-math.random(3,6), Lich:GetZ(), Lich:GetZ(), 21, 10000)
  347. end
  348.  
  349. function RandomRagingSpiritAddsThatAreNotRandom(pUnit, Event)
  350.     local plr = Lich:GetRandomPlayer(0)
  351.     if plr ~= nil then
  352.     local x,y,z,o = plr:GetX(),plr:GetY(),plr:GetZ(),plr:GetO()
  353.     Lich:SpawnCreature(3769813, x,y,z,o , 21, 360000)
  354.     end
  355. end
  356.  
  357. function Spam_Of_Lightning_That_Looks_Crap_But_Is_Blizzlike(pUnit, Event) -- 10 man normal
  358.     local plr = Lich:GetRandomPlayer(0)
  359.     if plr ~= nil then
  360.     Lich:FullCastSpellOnTarget(72133, plr)
  361.     end
  362. end
  363.  
  364. function zSpam_Of_Lightning_That_Looks_Crap_But_Is_Blizzlike(pUnit, Event) -- 10 man heroic
  365.     local plr = Lich:GetRandomPlayer(0)
  366.     if plr ~= nil then
  367.     Lich:FullCastSpellOnTarget(73788, plr)
  368.     end
  369. end
  370.    
  371. function Test_Despawn_Outer_Shell(pUnit, Event)
  372.     Lich:RemoveEvents()
  373.     Lich:SendChatMessage(14,0,"Watch as the world around you collapses!")
  374.     Lich:PlaySoundToSet(17370)
  375.     --Lich:CastSpell(59084) -- temporary solution to no destructable object support on ArcEmu
  376.     Lich:SpawnCreature(2626262, 476.2, -2083.56, 1573.1, 0, 814, 20000)
  377.     Lich:SpawnCreature(2626262, 505.1, -2074.47, 1573.1, 0, 814, 20000)
  378.     Lich:SpawnCreature(2626262, 523.35, -2077.77, 1573.1, 0, 814, 20000)
  379.     Lich:SpawnCreature(2626262, 541, -2086.36, 1573.1, 0, 814, 20000)
  380.     Lich:SpawnCreature(2626262, 552.7, -2111.2, 1573.1, 0, 814, 20000)
  381.     Lich:SpawnCreature(2626262, 554, -2137, 1573.1, 0, 814, 20000)
  382.     Lich:SpawnCreature(2626262, 545.9, -2153.1, 1573.1, 0, 814, 20000)
  383.     Lich:SpawnCreature(2626262, 528, -2164, 1573.1, 0, 814, 20000)
  384.     Lich:SpawnCreature(2626262, 508.25, -2169.5, 1573.1, 0, 814, 20000)
  385.     Lich:SpawnCreature(2626262, 488.2, -2168, 1573.1, 0, 814, 20000)
  386.     Lich:RegisterEvent("DelayForDespawnSinceVisualTakesSomeTimeTehe_Zieghoszho", 1000, 1)
  387.     Lich:RegisterEvent("DelayForDespawnSinceVisualTakesSomeTimeTehe", 2500, 1)
  388. end
  389.  
  390. function DelayForDespawnSinceVisualTakesSomeTimeTehe_Zieghoszho(pUnit, Event)
  391.     Lich:FullCastSpell(72262) -- Epic shit I got working :D
  392. end
  393.  
  394. function DelayForDespawnSinceVisualTakesSomeTimeTehe(pUnit, Event)
  395.     Object = Lich:GetGameObjectNearestCoords(pUnit:GetX(),pUnit:GetY(),pUnit:GetZ(), 2957197)
  396.     if Object ~= nil then
  397.     Object:SetScale(0.01)
  398.     --Object:Despawn(1,0)
  399.     --Lich:CastSpell(46853) -- Shakes camera
  400.     end
  401.     Lich:SetCombatCapable(0)
  402.     Lich:Unroot()
  403.     -- Phase 2
  404.     Lich:RegisterEvent("Summon_Valkyr_Shadowguard", 19500, 0)
  405.     if pUnit:GetDungeonDifficulty() == 0 then -- 10 man normal
  406.     Lich:RegisterEvent("Infest_Big_AOE_Incoming", 22000, 0)
  407.     Lich:RegisterEvent("Soul_Reaper_On_Main_Tank", 30000, 0)
  408.     --end
  409.     else
  410.     --if pUnit:GetDungeonDifficulty() == 1 then -- 10 man normal
  411.     Lich:RegisterEvent("zInfest_Big_AOE_Incoming", 22000, 0)
  412.     Lich:RegisterEvent("zSoul_Reaper_On_Main_Tank", 30000, 0)
  413.     end
  414.     Lich:RegisterEvent("Phase_TwoPointFive_Checker", 2500, 0)
  415.     -- I cba to script defile :3
  416. end
  417.  
  418. function Soul_Reaper_On_Main_Tank(pUnit, Event) -- 10 man normal
  419.     local tank = Lich:GetMainTank()
  420.     if tank ~= nil then
  421.     Lich:FullCastSpellOnTarget(69409, tank)
  422.     end
  423. end
  424.  
  425. function zSoul_Reaper_On_Main_Tank(pUnit, Event) -- 10 man heroic
  426.     local tank = Lich:GetMainTank()
  427.     if tank ~= nil then
  428.     Lich:FullCastSpellOnTarget(73798, tank)
  429.     end
  430. end
  431.  
  432. function Summon_Valkyr_Shadowguard(pUnit, Event)
  433.     local x, y, z, o = Lich:GetX()+3, Lich:GetY(), Lich:GetZ(), Lich:GetO()
  434.     Lich:SpawnCreature(25452151, x, y, z, o, 22, 0)
  435.     Lich:SendChatMessage(14,0,"Val'kyr, your master calls!")
  436.     Lich:PlaySoundToSet(17373)
  437. end
  438.  
  439. function Phase_TwoPointFive_Checker(pUnit, Event)
  440.     if Lich:GetHealthPct() < 41 then
  441.     Lich:RemoveEvents()
  442.     Lich:MoveTo(512.7, -2120.5, 1572.1, 0)
  443.     Lich:SetMovementFlags(1)
  444.     Lich:SetCombatCapable(1)
  445.     Lich:RegisterEvent("hhTest_Debug_MoveToCentreOfRoom", 100, 0)
  446.     Lich:RegisterEvent("hhTest_Debug_MoveToCentreOfRoom_z", 4005, 1)
  447.     end
  448. end
  449.  
  450. function hhTest_Debug_MoveToCentreOfRoom(pUnit, Event)
  451.     Lich:MoveTo(512.7, -2120.5, 1572.1, 0)
  452.     Lich:SetMovementFlags(1)
  453. end
  454.  
  455. function hhTest_Debug_MoveToCentreOfRoom_z(pUnit, Event)
  456.     Lich:RemoveEvents()
  457.     Lich:Root()
  458.     if pUnit:GetDungeonDifficulty() == 0 then -- 10 man normal
  459.     Lich:FullCastSpell(68981)
  460.     --end
  461.     else
  462.     --if pUnit:GetDungeonDifficulty() == 1 then -- 10 man heroic
  463.     Lich:FullCastSpell(74270)
  464.     end
  465.     Lich:SendChatMessage(14,0,"I will freeze you from within until all that remains is an icy husk!")
  466.     Lich:PlaySoundToSet(17369)
  467.     Lich:RegisterEvent("jjweaiyhoahg_delay", 6000, 1)
  468. end
  469.  
  470. function jjweaiyhoahg_delay(pUnit, Event)
  471.     local x = Lich:GetX()
  472.     local y = Lich:GetY()
  473.     Lich:SpawnCreature(3769812, x+math.random(3,6), y+math.random(3,6), Lich:GetZ(), Lich:GetZ(), 21, 10000)
  474.     Lich:RegisterEvent("Spam_Of_Lightning_That_Looks_Crap_But_Is_Blizzlike", 1500, 0)
  475.     Lich:RegisterEvent("NeedToWaitBecauseAddsBreakAndShizzleOrSomething", 3005, 1)
  476.     Lich:RegisterEvent("RandomRagingSpiritAddsThatAreNotRandom", 14000, 3)
  477.     Lich:RegisterEvent("zzzTest_Despawn_Outer_Shell", 59000, 0)
  478. end
  479.  
  480. function zzzTest_Despawn_Outer_Shell(pUnit, Event)
  481.     Lich:RemoveEvents()
  482.     Lich:SendChatMessage(14,0,"Watch as the world around you collapses!")
  483.     Lich:PlaySoundToSet(17370)
  484.     if Object ~= nil then
  485.     Object:SetScale(1)
  486.     end
  487.     --Lich:CastSpell(59084) -- temporary solution to no destructable object support on ArcEmu
  488.     Lich:SpawnCreature(2626262, 476.2, -2083.56, 1573.1, 0, 814, 20000)
  489.     Lich:SpawnCreature(2626262, 505.1, -2074.47, 1573.1, 0, 814, 20000)
  490.     Lich:SpawnCreature(2626262, 523.35, -2077.77, 1573.1, 0, 814, 20000)
  491.     Lich:SpawnCreature(2626262, 541, -2086.36, 1573.1, 0, 814, 20000)
  492.     Lich:SpawnCreature(2626262, 552.7, -2111.2, 1573.1, 0, 814, 20000)
  493.     Lich:SpawnCreature(2626262, 554, -2137, 1573.1, 0, 814, 20000)
  494.     Lich:SpawnCreature(2626262, 545.9, -2153.1, 1573.1, 0, 814, 20000)
  495.     Lich:SpawnCreature(2626262, 528, -2164, 1573.1, 0, 814, 20000)
  496.     Lich:SpawnCreature(2626262, 508.25, -2169.5, 1573.1, 0, 814, 20000)
  497.     Lich:SpawnCreature(2626262, 488.2, -2168, 1573.1, 0, 814, 20000)
  498.     Lich:RegisterEvent("DelayForDespawnSinceVisualTakesSomeTimeTehe_Zieghoszho", 1000, 1)
  499.     Lich:RegisterEvent("zzzDelayForDespawnSinceVisualTakesSomeTimeTehe", 2500, 1)
  500. end
  501.  
  502. function zzzDelayForDespawnSinceVisualTakesSomeTimeTehe(pUnit, Event)
  503.     if Object ~= nil then
  504.     Object:Despawn(1,0)
  505.     end
  506.     Lich:SetCombatCapable(0)
  507.     Lich:Unroot()
  508.     -- Phase 3
  509.     Lich:RemoveEvents()
  510.     Lich:RegisterEvent("Soul_Reaper_On_Main_Tank", 30000, 0)
  511.     if pUnit:GetDungeonDifficulty() == 0 then -- 10 man normal
  512.     Lich:RegisterEvent("Harvest_Soul_Random_Raid_Member", 66000, 0)
  513.     else
  514.         if pUnit:GetDungeonDifficulty() == 1 then -- 10 man heroic
  515.         Lich:RegisterEvent("zHarvest_Soul_Random_Raid_Member", 66000, 0)
  516.         else
  517.             if pUnit:GetDungeonDifficulty() == 2 then -- 25 man
  518.             Lich:RegisterEvent("zzHarvest_Soul_Random_Raid_Member", 66000, 0)
  519.             else
  520.             Lich:RegisterEvent("zzHarvest_Soul_Random_Raid_Member", 66000, 0)
  521.             end
  522.         end
  523.     end
  524.     Lich:RegisterEvent("Vile_Spirits_Spawning_Inc", 28000, 0)
  525.     Lich:RegisterEvent("Phase_Four_The_Ending_tehe", 1500, 0)
  526. end
  527.  
  528. function Harvest_Soul_Random_Raid_Member(pUnit, Event) -- 10 man normal
  529.     local plr = Lich:GetRandomPlayer(0)
  530.     if plr ~= nil then
  531.     Lich:SendChatMessage(14,0,"Frostmourne hungers...")
  532.     Lich:PlaySoundToSet(17366)
  533.     Lich:FullCastSpellOnTarget(68980, plr)
  534.     end
  535. end
  536.  
  537. function zHarvest_Soul_Random_Raid_Member(pUnit, Event) -- 10 man heroic
  538.     local plr = Lich:GetRandomPlayer(0)
  539.     if plr ~= nil then
  540.     Lich:SendChatMessage(14,0,"Frostmourne hungers...")
  541.     Lich:PlaySoundToSet(17366)
  542.     Lich:FullCastSpellOnTarget(74296, plr)
  543.     end
  544. end
  545.  
  546. function zzHarvest_Soul_Random_Raid_Member(pUnit, Event) -- 25 man
  547.     local plr = Lich:GetRandomPlayer(0)
  548.     if plr ~= nil then
  549.     Lich:SendChatMessage(14,0,"Frostmourne hungers...")
  550.     Lich:PlaySoundToSet(17366)
  551.     Lich:FullCastSpellOnTarget(74325, plr)
  552.     end
  553. end
  554.  
  555. function Vile_Spirits_Spawning_Inc(pUnit, Event)
  556.     Lich:RegisterEvent("Spawning_The_Vile_spirits_NoW", 1000, 10)
  557. end
  558.  
  559. function Spawning_The_Vile_spirits_NoW(pUnit, Event)
  560.     local pla = Lich:GetRandomPlayer(0)
  561.     if pla ~= nil then
  562.     local x, y, z, o = pla:GetX(), pla:GetY(), pla:GetZ(), pla:GetO()
  563.     Lich:SpawnCreature(5078151, x, y, z, o, 22, 60000)
  564.     end
  565. end
  566.  
  567. function Phase_Four_The_Ending_tehe(pUnit, Event)
  568.     if Lich:GetHealthPct() < 11 then
  569.     Count = 0
  570.     Phase = 0
  571.     Lich:RemoveEvents()
  572.     Lich:SendChatMessage(14,0,"You gnats actually hurt me! Perhaps I've toyed with you long enough, now taste the vengeance of the grave!")
  573.     Lich:PlaySoundToSet(17359)
  574.     Lich:MoveTo(512.7, -2120.5, 1572.1, 0)
  575.     Lich:SetMovementFlags(1)
  576.     Lich:SetCombatCapable(1)
  577.     Lich:RegisterEvent("hhTest_Debug_MoveToCentreOfRoom", 100, 0)
  578.     Lich:RegisterEvent("hggzhTest_Debug_MoveToCentreOfRoom_z", 5005, 1)
  579.     end
  580. end
  581.  
  582. function hggzhTest_Debug_MoveToCentreOfRoom_z(pUnit, Event)
  583.     Lich:RemoveEvents()
  584.     if pUnit:GetDungeonDifficulty() == 0 then -- 10 man normal
  585.     Lich:FullCastSpell(70063)
  586.     else
  587.     --if pUnit:GetDungeonDifficulty() == 1 then -- 10 man heroic
  588.     Lich:FullCastSpell(72350)
  589.     end
  590.     Players_Wiped = 1
  591.     -- Some visuals missing
  592.     Lich:RegisterEvent("Debug_Send_Next_Message_LichKing", 10000, 1)
  593. end
  594.  
  595. function Debug_Send_Next_Message_LichKing(pUnit, Event)
  596.     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...")
  597.     Lich:PlaySoundToSet(17353)
  598.     Lich:RegisterEvent("zzDebug_Send_Next_Message_LichKing", 25000, 1)
  599. end
  600.  
  601. function zzDebug_Send_Next_Message_LichKing(pUnit, Event)
  602.     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.")
  603.     Lich:PlaySoundToSet(17355)
  604.     local plr = Lich:GetRandomPlayer(0)
  605.     if plr ~= nil then
  606.     Lich:ChannelSpell(71769, plr)
  607.     end
  608.     local DeadGuys = Lich:GetInRangePlayers()
  609.     for k, plrs in pairs(DeadGuys) do
  610.     plrs:ChannelSpell(47855, Lich)
  611.     end
  612.     Lich:RegisterEvent("zzzzDebug_Send_Next_Message_LichKing", 24000, 1)
  613. end
  614.  
  615. function zzzzDebug_Send_Next_Message_LichKing(pUnit, Event)
  616.     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.")
  617.     Lich:PlaySoundToSet(17356)
  618.     Lich:RegisterEvent("zzzzDebug_Send_Next_Message_LichKingzz", 26000, 1)
  619. end
  620.  
  621. function zzzzDebug_Send_Next_Message_LichKingzz(pUnit, Event)
  622.     Lich:PlaySoundToSet(17357)
  623.     Lich:SendChatMessage(14,0,"I delight in the irony.")
  624.     Lich:RegisterEvent("zzzzDebug_Send_Next_Message_LichKingzzzz", 6000, 1)
  625.     --Lich:StopChannel()
  626. end
  627.  
  628. function zzzzDebug_Send_Next_Message_LichKingzzzz(pUnit, Event)
  629.     if Tirion == nil then
  630.     Lich:Despawn(1,0)
  631.     else
  632.     Tirion:SendChatMessage(14,0,"LIGHT, GRANT ME ONE FINAL BLESSING. GIVE ME THE STRENGTH... TO SHATTER THESE BONDS!")
  633.     Tirion:PlaySoundToSet(17392)
  634.     Lich:RegisterEvent("Breakoutofice", 9000, 1)
  635.     end
  636. end
  637.  
  638. function Breakoutofice(pUnit, Event)
  639.     Tirion:RemoveAura(71614) --(Remove IceBlock, to cast the Spell under this Line :>)
  640.     Tirion:CastSpell(71797)
  641.     Tirion:CastSpell(71614) --(Get the IceBlock Again :>, You cannot see that he was out :>) -- Stays in ice block? lol
  642.     Lich:RegisterEvent("zzzzDebug_Send_Next_Message_LichKingzzzzgg", 5000, 1)
  643. end
  644.  
  645. function zzzzDebug_Send_Next_Message_LichKingzzzzgg(pUnit, Event)
  646.     Tirion:RemoveAura(71614) -- Ice Block
  647.     Tirion:CastSpell(71773)
  648.     Lich:RegisterEvent("zzzzDebug_Send_Next_Message_LichKingzzzzgzg", 1500, 1)
  649.     -- jumps and destroys frostmourne
  650. end
  651.  
  652. function zzzzDebug_Send_Next_Message_LichKingzzzzgzg(pUnit, Event)
  653.     Tirion:SetMovementFlags(2)
  654.     Tirion:SetFlying()
  655.     Tirion:Emote(375, 60000)
  656.     Tirion:MoveTo(511, -2121, 1575, 14)
  657.     Tirion:Emote(375, 60000)
  658.     Lich:StopChannel()
  659.     Lich:RegisterEvent("zagazzzDebug_Send_Next_Message_LichKingzzzzgzg", 3000, 1)
  660. end
  661.  
  662. function zagazzzDebug_Send_Next_Message_LichKingzzzzgzg(pUnit, Event)
  663.     Tirion:SetMovementFlags(1)
  664.     Tirion:MoveTo(536.5, -2121, 1572.1, 3.15)
  665.     Lich:PlaySoundToSet(17459)
  666.     Lich:SpawnCreature(2626269, Lich:GetX(), Lich:GetY(), Lich:GetZ(), 0, 35, 0) -- Invisible trigger
  667.     Lich:RegisterEvent("zagazzzDebug_Send_Next_Message_LichKingzgeazzzzgzg", 1900, 1)
  668.     Tirion:RegisterEvent("lichisdead", 1900, 1)
  669. end
  670.  
  671. function lichisdead(pUnit, Event)
  672.     Tirion:MoveTo(514.135254, -2122.514160, 1572)
  673. end
  674.  
  675. function zagazzzDebug_Send_Next_Message_LichKingzgeazzzzgzg(pUnit, Event)
  676.     Lich:CastSpell(37592) -- Knockdown
  677.     --Lich:CastSpell(72726) -- Boom visual
  678.     local DeadGuys = Lich:GetInRangePlayers()
  679.     for k, plrs in pairs(DeadGuys) do
  680.     plrs:StopChannel()
  681.     end
  682.     if Garfield ~= nil then
  683.     Garfield:CastSpell(72405) -- THE CORRECT VISUAL ;D
  684.     end -- I cba to add a debugger, if it screws up at this point SCREW YOU BLIZZARD AND EMULATION
  685.     --Lich:FullCastSpell(72406) -- The drop frostmourne visual thing (it fucks up his animations so I cba with this :D)
  686.     Lich:CastSpell(73017) -- The soul free thing
  687.     Lich:FullCastSpell(72398) -- Frostmourne on floor
  688.     Lich:EquipWeapons(0,0,0)
  689.     Lich:SendChatMessage(14,0,"Impossible...")
  690.     Lich:PlaySoundToSet(17358)
  691.     Lich:Emote(473, 120000)
  692.     --Lich:CastSpell(72523)
  693.     Lich:RegisterEvent("zagazzzDebug_Send_Next_Message_LichKingzgeazzzzedhezgzg", 1500, 1)
  694. end
  695.  
  696. function zagazzzDebug_Send_Next_Message_LichKingzgeazzzzedhezgzg(pUnit, Event)
  697.     Tirion:SendChatMessage(14,0,"No more, Arthas! No more lives will be consumed by your hatred!")
  698.     Tirion:PlaySoundToSet(17393)
  699.     Tirion:SetMovementFlags(1)
  700.     Lich:Emote(473, 120000)
  701.     Lich:SpawnCreature(31021151, 518.8, -2115.8, 1572.1, 3.780169, 35, 0)
  702.     Tirion:MoveTo(526, -2120.5, 1572.1, 3)
  703.     Lich:RegisterEvent("zagazzzDebug_Send_Next_Message_LichKingzgeazzzzedhezgzzzzsay", 5500, 1)
  704. end
  705.  
  706. function zagazzzDebug_Send_Next_Message_LichKingzgeazzzzedhezgzzzzsay(pUnit, Event)
  707.     if Terenas == nil then -- Dunno why this would happen
  708.     Lich:Despawn(1,0)
  709.     Lich = nil
  710.     Tirion:Despawn(1,0)
  711.     Tirion = nil
  712.     else
  713.     Lich:Emote(473, 120000)
  714.     Terenas:EquipWeapons(23456, 18825, 0)
  715.     Terenas:SendChatMessage(14,0,"Free at last! It is over, my son. This is the moment of reckoning.")
  716.     Terenas:PlaySoundToSet(17397)
  717.     Terenas:ChannelSpell(51361, Terenas)
  718.     Lich:RegisterEvent("epiashgyophopapea_Lich_King_Is_Not_A_Happy_Bunny", 10000, 1)
  719.     end
  720. end
  721.  
  722. function epiashgyophopapea_Lich_King_Is_Not_A_Happy_Bunny(pUnit, Event)
  723.     Terenas:SendChatMessage(14,0,"Rise up, champions of the Light!")
  724.     Terenas:PlaySoundToSet(17398)
  725.     Terenas:StopChannel()
  726.     Terenas:CastSpell(37755)
  727.     Lich:Emote(473, 120000)
  728.     local PlayersAllAround = Terenas:GetInRangePlayers()
  729.     for a, players in pairs(PlayersAllAround) do
  730.     players:ResurrectPlayer(players)
  731.     players:CastSpell(24171)
  732.     end
  733.     --Terenas:FullCastSpell(72429) -- Failure
  734.     Lich:RegisterEvent("zLich_King_Is_Not_A_Happy_Bunny", 5000, 1)
  735. end
  736.  
  737. function zLich_King_Is_Not_A_Happy_Bunny(pUnit, Event)
  738.     Terenas:Despawn(500,0)
  739.     Lich:Emote(473, 120000)
  740.     Lich:SendChatMessage(14,0,"Now I stand, the lion before the lambs... and they do not fear.")
  741.     Lich:PlaySoundToSet(17361)
  742.     Lich:RegisterEvent("zLich_King_Is_Not_A_Happy_Bunnyz", 8000, 1)
  743. end
  744.  
  745. function zLich_King_Is_Not_A_Happy_Bunnyz(pUnit, Event)
  746.     Lich:SendChatMessage(14,0,"They cannot fear.")
  747.     Lich:PlaySoundToSet(17362)
  748.     Lich:Emote(473, 120000)
  749.     Lich:SetHealthPct(10)
  750.     -- The end, poor arthas, Q_Q, lets all go do a rain dance, ~Stoneharry
  751. end
  752.  
  753. ---- Terenas -----------------------------------------------------
  754.  
  755. function Terenas_Spawned_root_Hes_the_realm_of_My_RETAIL_Char(pUnit, Event)
  756.     if Tirion == nil or Lich == nil then
  757.     pUnit:Despawn(1,0)
  758.     else
  759.     Terenas = pUnit
  760.     end
  761. end
  762.  
  763. RegisterUnitEvent(31021151, 18, "Terenas_Spawned_root_Hes_the_realm_of_My_RETAIL_Char")
  764.  
  765. -------------------------------------------------------------------
  766.  
  767. function LichKingHasDiedSoWePlayMovie(pUnit, Event)
  768.     if Garfield ~= nil then
  769.     Garfield:Despawn(1,0)
  770.     end
  771.     local PlayersAllAround = pUnit:GetInRangePlayers()
  772.     for a, players in pairs(PlayersAllAround) do
  773.         if players:GetDungeonDifficulty() == 0 then -- 10 man
  774.             if players:HasAchievement(4530) == false then
  775.             players:AddAchievement(4530)
  776.             end
  777.         else
  778.             if players:GetDungeonDifficulty() == 1 then -- 10 man heroic
  779.                 if players:HasAchievement(4583) == false then
  780.                 players:AddAchievement(4583)
  781.                 end
  782.             else
  783.                 if players:GetDungeonDifficulty() == 2 then -- 25 man
  784.                     if players:HasAchievement(4579) == false then
  785.                     players:AddAchievement(4579)
  786.                     end
  787.                 else
  788.                     if players:GetDungeonDifficulty() == 3 then -- 25 man heroic
  789.                         if players:HasAchievement(4584) == false then
  790.                         players:AddAchievement(4584)
  791.                         end
  792.                     end
  793.                 end
  794.             end
  795.         end
  796.     end
  797.     Lich = nil
  798.     pUnit:RemoveEvents()
  799.     pUnit:PlaySoundToSet(17374) -- Freak makes dying sound
  800.     pUnit:SpawnCreature(3072110, pUnit:GetX(), pUnit:GetY(), pUnit:GetZ(), pUnit:GetO(), 35, 10000)
  801. end
  802.  
  803. RegisterUnitEvent(3072111, 4, "LichKingHasDiedSoWePlayMovie")
  804.  
  805. function TriggerHasSpawnedSoPlayMovie(pUnit, Event)
  806.     pUnit:RegisterEvent("PlayMovieOnceDeathAnimationHasPlayed", 9000, 1)
  807. end
  808.  
  809. function PlayMovieOnceDeathAnimationHasPlayed(pUnit, Event)
  810.     -- Reset Fight
  811.     Garfield = nil
  812.     Tirion = nil
  813.     Lich = nil
  814.     Terenas = nil
  815.     package = nil
  816.     Phase = 0
  817.     Count = 0
  818.     -- Movie
  819.     Players_Wiped = 0
  820.     local PlayersAllAround = pUnit:GetInRangePlayers()
  821.     for a, players in pairs(PlayersAllAround) do
  822.     --SMSG_TRIGGER_MOVIE = 0x464
  823.     local packet = LuaPacket:CreatePacket(0x464, 4) -- Move type 4
  824.     packet:WriteULong(16) -- Id 16
  825.     players:SendPacketToPlayer(packet) -- Send to players
  826.     end
  827.     -- Bolvar
  828.     local Bolvar = pUnit:GetGameObjectNearestCoords(428.758, -2124.4, 1594.69, 2508221) -- Bolvar in chains
  829.     if Bolvar ~= nil then
  830.     Bolvar:Despawn(1,0)
  831.     pUnit:SpawnGameObject(2508220, 428.758, -2124.4, 1594.69, 0, 360000) -- Chains
  832.     pUnit:SpawnGameObject(2508219, 430.103, -2124, 1595.93, 3.3, 360000) -- Bolvar
  833.     end
  834. end
  835.  
  836. RegisterUnitEvent(3072110, 18, "TriggerHasSpawnedSoPlayMovie")
  837.    
  838. ------- Adds ------------------------------------------------------
  839.  
  840. function Dredge_Ghouls_OnSpawn(pUnit, Event)
  841.     pUnit:RegisterEvent("TestRootFunctionNextSecond", 1, 1)
  842. end
  843.  
  844. function TestRootFunctionNextSecond(pUnit, Event)
  845.     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 ;)
  846.     pUnit:RemoveFromWorld()
  847.     else -- Well if he is here
  848.     pUnit:Emote(449, 4000) -- spawn animation
  849.     pUnit:Root() -- Root him while he spawns
  850.     pUnit:RegisterEvent("Delay_A_Second_And_See_WhatHappens_Tehe", math.random(1,1000), 1)
  851.     pUnit:RegisterEvent("SetFactionToHostileForTheEmote", 4500, 1)
  852.     end
  853. end
  854.  
  855. function Delay_A_Second_And_See_WhatHappens_Tehe(pUnit, Event)
  856.     pUnit:CastSpell(55719)
  857. end
  858.  
  859. function SetFactionToHostileForTheEmote(pUnit, Event)
  860.     pUnit:Unroot() -- let him run free
  861.     pUnit:SetFaction(21) -- hostile
  862. end
  863.  
  864. RegisterUnitEvent(3769511, 18, "Dredge_Ghouls_OnSpawn")
  865.  
  866. ---------------------------------------------------------------------
  867.  
  868. function Shambling_Horrors_OnSpawn(pUnit, Event)
  869.     pUnit:RegisterEvent("zzTestRootFunctionNextSecond", 1, 1)
  870. end
  871.  
  872. function zzTestRootFunctionNextSecond(pUnit, Event)
  873.     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 ;)
  874.     pUnit:RemoveFromWorld()
  875.     else -- Well if he is here
  876.     pUnit:Emote(449, 4000) -- spawn animation
  877.     pUnit:Root() -- Root him while he spawns
  878.     pUnit:CastSpell(55719)
  879.     pUnit:RegisterEvent("zzSetFactionToHostileForTheEmote", 4500, 1)
  880.     end
  881. end
  882.  
  883. function zzSetFactionToHostileForTheEmote(pUnit, Event)
  884.     pUnit:Unroot() -- let him run free
  885.     pUnit:SetFaction(21) -- hostile
  886. end
  887.  
  888. RegisterUnitEvent(3769811, 18, "Shambling_Horrors_OnSpawn")
  889.  
  890. function Shambling_Horrors_OnCombat(pUnit, Event)
  891.     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 ;)
  892.     pUnit:RemoveFromWorld()
  893.     else -- Well if he is here
  894.     pUnit:RegisterEvent("Enrage_Spam_Incoming_Varied_Time", math.random(20000,25000), 0) -- Varied time depending on add
  895.     pUnit:RegisterEvent("Shockwave_thingy_time_notsure_on_timer", 15000, 0)
  896.     end
  897. end
  898.  
  899. function Enrage_Spam_Incoming_Varied_Time(pUnit, Event)
  900.     pUnit:FullCastSpell(72143)
  901. end
  902.  
  903. function Shockwave_thingy_time_notsure_on_timer(pUnit, Event)
  904.     pUnit:FullCastSpell(72149)
  905. end
  906.  
  907. function Shambling_Horrors_OnLeave(pUnit, Event)
  908.     pUnit:RemoveEvents()
  909. end
  910.  
  911. function Shambling_Horrors_OnDead(pUnit, Event)
  912.     pUnit:RemoveEvents()
  913. end
  914.  
  915. function Low_Enrage(pUnit, Event)
  916.     if pUnit:GetDungeonDifficulty() ~= 0 then -- not 10 man
  917.         if pUnit:GetHealthPct() < 20 then
  918.         pUnit:CastSpell(28747) -- ENRAGEEEEEE (a lust for blood? :p)
  919.         end
  920.     end
  921. end
  922.  
  923. RegisterUnitEvent(3769811, 1, "Shambling_Horrors_OnCombat")
  924. RegisterUnitEvent(3769811, 2, "Shambling_Horrors_OnLeave")
  925. RegisterUnitEvent(3769810, 3, "Low_Enrage")
  926. RegisterUnitEvent(3769811, 4, "Shambling_Horrors_OnDead")
  927.  
  928. ----- Ice Sphere --------------------------------------------------
  929.  
  930. -- 69090 on spawn -- only 2 on phase 1.5, head towards player and explode if hit
  931.  
  932. function IceShard_OnSpawn(pUnit, Event)
  933.     pUnit:RegisterEvent("rage_rage_rage_rage_Rage_rage", 1, 1)
  934. end
  935.  
  936. function rage_rage_rage_rage_Rage_rage(pUnit, Event)
  937.     if Lich == nil then
  938.     pUnit:RemoveFromWorld() -- may cause crash if he tries to despawn but variable broke
  939.     else
  940.         pUnit:FullCastSpell(69090) -- Visual
  941.         local pla = pUnit:GetRandomPlayer(0)
  942.         if pla ~= nil then
  943.         pUnit:MoveTo(pla:GetX(), pla:GetY(), pla:GetZ(), pla:GetO())
  944.         pUnit:SetMovementFlags(1)
  945.         pUnit:RegisterEvent("rage_rage_rage_rage_Rage_rage_r", 1000, 8)
  946.         else
  947.         pUnit:RemoveFromWorld()
  948.         end
  949.     end
  950. end
  951.  
  952. function rage_rage_rage_rage_Rage_rage_r(pUnit, Event)
  953.     local plm = pUnit:GetClosestPlayer()
  954.     if plm ~= nil then
  955.         pUnit:FullCastSpell(69090) -- Visual
  956.         if pUnit:GetDistanceYards(plm) < 4 then
  957.         --pUnit:FullCastSpellOnTarget(70827, plm) -- May be buggy if player dies, maybe not knockbacked and players try to exploit by ressing?
  958.         pUnit:FullCastSpellOnTarget(11027, plm) -- Knockback
  959.         pUnit:CastSpell(56135)
  960.         pUnit:RemoveEvents()
  961.         end
  962.     end
  963. end
  964.  
  965. RegisterUnitEvent(3769812, 18, "IceShard_OnSpawn")
  966.  
  967. ---- Raging Spirit ------------------------------------------------
  968.  
  969. function RagingSpirit_OnCombat(pUnit, Event)
  970.     if Lich == nil then
  971.     pUnit:RemoveFromWorld()
  972.     else
  973.     pUnit:RegisterEvent("Soul_Shriek_Random_Time_Depending_On_Mob", math.random(7500, 15000), 0)
  974.     pUnit:RegisterEvent("Soul_Shriek_Random_Visual", 1000, 1)
  975.     end
  976. end
  977.  
  978. function Soul_Shriek_Random_Visual(pUnit, Event)
  979.     pUnit:FullCastSpell(69198) -- Visual
  980. end
  981.  
  982. function Soul_Shriek_Random_Time_Depending_On_Mob(pUnit, Event)
  983.     if pUnit:GetDungeonDifficulty() == 0 then -- 10 man
  984.     pUnit:FullCastSpell(69242) -- Shriek normal
  985.     else
  986.     pUnit:FullCastSpell(73801) -- Shriek heroic
  987.     end
  988. end
  989.  
  990. function RagingSpirit_OnLeave(pUnit, Event)
  991.     pUnit:RemoveEvents()
  992. end
  993.  
  994. function RagingSpirit_OnDead(pUnit, Event)
  995.     pUnit:RemoveEvents()
  996. end
  997.  
  998. RegisterUnitEvent(3769813, 1, "RagingSpirit_OnCombat")
  999. RegisterUnitEvent(3769813, 2, "RagingSpirit_OnLeave")
  1000. RegisterUnitEvent(3769813, 4, "RagingSpirit_OnDead")
  1001.  
  1002. ---- Flying Dudes ------------------------------------------------------
  1003.  
  1004. function zhgzFlying_Dude_OnCombat(pUnit, Event)
  1005.     if Lich == nil then
  1006.     pUnit:RemoveFromWorld()
  1007.     else
  1008.     pUnit:RegisterEvent("zhgzFlying_Dude_Find_Player", 1, 1)
  1009.     end
  1010. end
  1011.  
  1012. function zhgzFlying_Dude_Find_Player(pUnit, Event)
  1013.     package = pUnit:GetClosestPlayer()
  1014.     if package ~= nil then
  1015.     pUnit:SetCombatCapable(1) -- Stop npc running around
  1016.     package:SetPlayerLock(1) -- Stop player doing stuff :3
  1017.     pUnit:SetMovementFlags(2) -- Flying Mode On
  1018.     pUnit:ChannelSpell(55520, package) -- visual
  1019.     pUnit:MoveTo(pUnit:GetX(), pUnit:GetY(), pUnit:GetZ()+6, pUnit:GetO(), 12288)
  1020.     package:MovePlayerTo(package:GetX(), package:GetY(), package:GetZ()+6, package:GetO(), 12288)
  1021.     pUnit:RegisterEvent("now_we_have_loaded_preset_We_can_move_on", 2000, 1)
  1022.     else
  1023.     pUnit:RemoveFromWorld()
  1024.     end
  1025. end
  1026.  
  1027. function now_we_have_loaded_preset_We_can_move_on(pUnit, Event)
  1028.     if package ~= nil then
  1029.     package:CastSpell(52241) -- Choke visual
  1030.     package:CastSpell(53658) -- Bubble to stop stupid animations
  1031.     pUnit:ChannelSpell(29172, package) -- visual
  1032.     pUnit:RegisterEvent("now_we_have_loaded_preset_We_can_move_on_two", 1500, 0)
  1033.     else
  1034.     pUnit:RemoveEvents()
  1035.     pUnit:RemoveFromWorld()
  1036.     end
  1037. end
  1038.  
  1039. function now_we_have_loaded_preset_We_can_move_on_two(pUnit, Event)
  1040.     if package ~= nil then
  1041.         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 :)
  1042.         pUnit:RemoveEvents()
  1043.         pUnit:StopChannel()
  1044.         package:RemoveAura(52241) -- choke
  1045.         package:RemoveAura(53658) -- buble
  1046.         package:SetPlayerLock(0)
  1047.         package = nil
  1048.         --pUnit:RemoveFromWorld() -- Causes crash :(       
  1049.         else
  1050.             if pUnit:GetDungeonDifficulty() ~= 0 and pUnit:GetDungeonDifficulty() ~= 2 then --not 10 man normal or 25man normal
  1051.                 if pUnit:GetHealthPct() < 50 then
  1052.                 pUnit:RemoveEvents()
  1053.                 pUnit:StopChannel()
  1054.                 package:RemoveAura(52241) -- choke
  1055.                 package:RemoveAura(53658) -- buble
  1056.                 package:SetPlayerLock(0)
  1057.                 package = nil
  1058.                 pUnit:MoveTo(pUnit:GetX(), pUnit:GetY(), pUnit:GetZ()+4, pUnit:GetO())
  1059.                 pUnit:RegisterEvent("lol_siphon_spam_or_something_vrykul", 10000, 0)
  1060.                 else       
  1061.                 pUnit:SetMovementFlags(2)
  1062.                 package:ModifyFlySpeed(2.5)
  1063.                 pUnit:MoveTo(572, -2121.5, 1577.2, 0, 12288, 2.5)
  1064.                 package:MovePlayerTo(pUnit:GetX(), pUnit:GetY(), pUnit:GetZ() ,pUnit:GetO(), 12288)
  1065.                 end
  1066.             end
  1067.         end
  1068.     else
  1069.     pUnit:RemoveEvents()
  1070.     pUnit:RemoveFromWorld()
  1071.     end
  1072. end
  1073.  
  1074. function lol_siphon_spam_or_something_vrykul(pUnit, Event)
  1075.     local tank = pUnit:GetMainTank()
  1076.     if tank ~= nil then
  1077.     pUnit:FullCastSpellOnTarget(73784, tank) -- Correct spell - 2 second cast time, lasts for ???
  1078.     end
  1079. end
  1080.  
  1081. function zhgzFlying_Dude_OnDead(pUnit, Event)
  1082.     pUnit:RemoveEvents()
  1083.     pUnit:StopChannel()
  1084.     package:RemoveAura(52241) -- choke
  1085.     package:RemoveAura(53658) -- buble
  1086.     package:SetPlayerLock(0)
  1087.     package = nil
  1088.     --pUnit:RemoveFromWorld() -- Causes crash :(
  1089. end
  1090.  
  1091. RegisterUnitEvent(25452151, 1, "zhgzFlying_Dude_OnCombat")
  1092. RegisterUnitEvent(25452151, 4, "zhgzFlying_Dude_OnDead")
  1093.  
  1094. ---- Vile Spirits ------------------------------------------------------
  1095.  
  1096. function VileSpiirt_OnCombat(pUnit, Event)
  1097.     if Lich == nil then
  1098.     pUnit:RemoveFromWorld()
  1099.     else
  1100.     pUnit:RegisterEvent("deoaopighophgeoaugozh_delay", 500, 1)
  1101.     end
  1102. end
  1103.  
  1104. function deoaopighophgeoaugozh_delay(pUnit, Event)
  1105.     pUnit:Root()
  1106.     pUnit:SetCombatCapable(1)
  1107.     pUnit:RegisterEvent("Tick_Tick_Tick_dot_dot_dot_BOOM", 29000, 1)
  1108. end
  1109.  
  1110. function Tick_Tick_Tick_dot_dot_dot_BOOM(pUnit, Event)
  1111.     pUnit:RemoveEvents()
  1112.     pUnit:CastSpell(73807) -- Correct spell now
  1113.     pUnit:RegisterEvent("Kill_Self_Suicide_Or_Whathaveyou_vile", 1000, 1)
  1114. end
  1115.  
  1116. function Kill_Self_Suicide_Or_Whathaveyou_vile(pUnit, Event)
  1117.     if pUnit:IsAlive() == true then
  1118.     pUnit:Despawn(1,0)
  1119.     end
  1120. end
  1121.  
  1122. function VileSpiirt_OnLeave(pUnit, Event)
  1123.     pUnit:RemoveEvents()
  1124. end
  1125.  
  1126. function VileSpiirt_OnDead(pUnit, Event)
  1127.     pUnit:RemoveEvents()
  1128. end
  1129.  
  1130. RegisterUnitEvent(5078151, 1, "VileSpiirt_OnCombat")
  1131. RegisterUnitEvent(5078151, 2, "VileSpiirt_OnLeave")
  1132. RegisterUnitEvent(5078151, 4, "VileSpiirt_OnDead")
  1133.  
  1134. ------------------------------------------------------------------------
  1135.  
  1136. function Garfield_On_Spawn_Trigger_Define(pUnit, Event)
  1137.     Garfield = pUnit
  1138. end
  1139.  
  1140. RegisterUnitEvent(2626269, 18, "Garfield_On_Spawn_Trigger_Define")
  1141.  
  1142. ------------------------------------------------------------------------
  1143.  
  1144. if CheatMode == true then
  1145.     function zczz_OnChat(event, plr, message, type, language)
  1146.         local message = string.lower(message)
  1147.         if (message == "#startlk") then
  1148.             if plr:IsGm() == true then
  1149.                 if Lich ~= nil and Tirion ~= nil then
  1150.                 Tirion:PlaySoundToSet(17458)
  1151.                 Tirion:RemoveEvents() -- Stop repeating
  1152.                 Lich:RemoveEvents()
  1153.                 Lich:MoveTo(461.47, -2123.73, 1572.1, 0)
  1154.                 Tirion:Emote(375, 60000)
  1155.                 Tirion:PlaySoundToSet(17349) -- pUnit since players are closer to him
  1156.                 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?")
  1157.                 Tirion:RegisterEvent("TirionFordring_OnSpawn_Goz", 13500, 1)
  1158.                 end
  1159.             end
  1160.         end
  1161.         if (message == "#endlk") then
  1162.             if Lich ~= nil and Tirion ~= nil then
  1163.                 if plr:IsGm() == true then
  1164.                 Count = 0
  1165.                 Phase = 0
  1166.                 Lich:RemoveEvents()
  1167.                 Tirion:RemoveEvents()
  1168.                 Lich:SendChatMessage(14,0,"You gnats actually hurt me! Perhaps I've toyed with you long enough, now taste the vengeance of the grave!")
  1169.                 Lich:PlaySoundToSet(17359)
  1170.                 Lich:MoveTo(512.7, -2120.5, 1572.1, 0)
  1171.                 Lich:SetMovementFlags(1)
  1172.                 Lich:SetCombatCapable(1)
  1173.                 Lich:RegisterEvent("hhTest_Debug_MoveToCentreOfRoom", 100, 0)
  1174.                 Lich:RegisterEvent("hggzhTest_Debug_MoveToCentreOfRoom_z", 5005, 1)
  1175.                 end
  1176.             end
  1177.         end
  1178.     end
  1179.     RegisterServerHook(16, "zczz_OnChat")
  1180. end
  1181.  
  1182. ------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement