Don't like ads? PRO users don't see any ads ;-)
Guest

molten/deathwing Fixed lich king 25m

By: a guest on Jul 10th, 2012  |  syntax: None  |  size: 50.64 KB  |  hits: 28  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #Created by Nikola ristevski
  2.      
  3.     #
  4.     Please note the following has not been included within this script:
  5.     #
  6.     - Defile
  7.     #
  8.     - Frostmourne Chamber
  9.     #
  10.     Please note that this is the 25man version and will conflict if the 10man version is used as well.
  11.     #
  12.     ]]
  13.     #
  14.     ------------------------------------------------------------------
  15.     #
  16.      
  17.     #
  18.     local Lich = nil
  19.     #
  20.     local Tirion = nil
  21.     #
  22.     local package = nil
  23.     #
  24.     local Terenas = nil
  25.     #
  26.     local Garfield = nil
  27.     #
  28.     local Object = nil
  29.     #
  30.     local Count = 0
  31.     #
  32.     local Phase = 0
  33.     #
  34.     local Players_Wiped = 0
  35.     #
  36.     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!
  37.     #
  38.      
  39.     #
  40.     ---- Checkers ----------------------------------------------------
  41.     #
  42.      
  43.     #
  44.     if GetLuaEngine() ~= "LuaHypArc" then -- Make sure we are using LuaHypArc
  45.     #
  46.             print("-------------------------------------------------------------------")
  47.     #
  48.             print("LuaHypArc is not installed. This script may not function correctly.")
  49.     #
  50.             print("LuaHypArc comes with ArcEmu by default.")
  51.     #
  52.             print("-------------------------------------------------------------------")
  53.     #
  54.             else
  55.     #
  56.             print("-------------------------------------------------------")
  57.     #
  58.             print("-- The Lich King - Made by Stoneharry of MMOwned.com --")
  59.     #
  60.             print("--                     Enjoy                         --")
  61.     #
  62.             print("-------------------------------------------------------")
  63.     #
  64.     end
  65.     #
  66.      
  67.     #
  68.     ---- Lich King ---------------------------------------------------
  69.     #
  70.      
  71.     #
  72.     function LichKing_OnSpawn(pUnit, Event)
  73.     #
  74.             pUnit:RegisterEvent("LichKing_OnSpawn_Go", 1000, 1)
  75.     #
  76.     end
  77.     #
  78.      
  79.     #
  80.     function LichKing_OnSpawn_Go(pUnit, Event)
  81.     #
  82.             if Lich ~= nil then -- Do a check
  83.     #
  84.             Lich:RemoveFromWorld()
  85.     #
  86.             end
  87.     #
  88.             Lich = pUnit
  89.     #
  90.             Lich:SetFaction(35)
  91.     #
  92.     end
  93.     #
  94.      
  95.     #
  96.     RegisterUnitEvent(3072112, 18, "LichKing_OnSpawn")
  97.     #
  98.      
  99.     #
  100.     function LichKing_OnLeaveJewCombat(pUnit, Event)
  101.     #
  102.             if Players_Wiped == 1 then
  103.     #
  104.             Players_Wiped = 0
  105.     #
  106.             Lich:SetHealthPct(10)
  107.     #
  108.             else
  109.     #
  110.             pUnit:RemoveEvents()
  111.     #
  112.             end
  113.     #
  114.     end
  115.     #
  116.      
  117.     #
  118.     RegisterUnitEvent(3072111, 2, "LichKing_OnLeaveJewCombat")
  119.     #
  120.      
  121.     #
  122.     ---- Tirion ------------------------------------------------------
  123.     #
  124.      
  125.     #
  126.     function TirionFordring_OnSpawn(pUnit, Event)
  127.     #
  128.             Tirion = pUnit
  129.     #
  130.             pUnit:RegisterEvent("TirionFordring_OnSpawn_Go", 5000, 0)
  131.     #
  132.     end
  133.     #
  134.      
  135.     #
  136.     function TirionFordring_OnSpawn_Go(pUnit, Event)
  137.     #
  138.             if Lich ~= nil then -- If theres no lich king we can't start the event
  139.     #
  140.                     local plr = pUnit:GetClosestPlayer()
  141.     #
  142.                     if plr ~= nil then -- we need a player
  143.     #
  144.                             if pUnit:GetDistanceYards(plr) < 5 then -- we are close enough to start
  145.     #
  146.                                     local PlayersAllAround = pUnit:GetInRangePlayers()
  147.     #
  148.                                     for a, players in pairs(PlayersAllAround) do
  149.     #
  150.                                     players:CastSpell(69127)
  151.     #
  152.                                     end
  153.     #
  154.                             pUnit:PlaySoundToSet(17458)
  155.     #
  156.                             pUnit:RemoveEvents() -- Stop repeating
  157.     #
  158.                             Lich:MoveTo(461.47, -2123.73, 1572.1, 0)
  159.     #
  160.                             pUnit:Emote(375, 60000)
  161.     #
  162.                             pUnit:PlaySoundToSet(17349) -- pUnit since players are closer to him
  163.     #
  164.                             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?")
  165.     #
  166.                             pUnit:RegisterEvent("TirionFordring_OnSpawn_Goz", 13500, 1)
  167.     #
  168.                             end
  169.     #
  170.                     end
  171.     #
  172.             end
  173.     #
  174.     end
  175.     #
  176.      
  177.     #
  178.     RegisterUnitEvent(26529762, 18, "TirionFordring_OnSpawn")
  179.     #
  180.      
  181.     #
  182.     function TirionFordring_OnSpawn_Goz(pUnit, Event)
  183.     #
  184.             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.")
  185.     #
  186.             pUnit:PlaySoundToSet(17390)
  187.     #
  188.             local PlayersAllAround = pUnit:GetInRangePlayers()
  189.     #
  190.             for a, players in pairs(PlayersAllAround) do
  191.     #
  192.             players:CastSpell(69127)
  193.     #
  194.             end
  195.     #
  196.             pUnit:RegisterEvent("TirionFordring_OnSpawn_Gozz", 9000, 1)
  197.     #
  198.     end
  199.     #
  200.      
  201.     #
  202.     function TirionFordring_OnSpawn_Gozz(pUnit, Event)
  203.     #
  204.             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.")
  205.     #
  206.             pUnit:PlaySoundToSet(17350)
  207.     #
  208.             Lich:Emote(397, 4000)
  209.     #
  210.             pUnit:RegisterEvent("zTirionFordring_OnSpawn_Gozzz", 4500, 1)
  211.     #
  212.             pUnit:RegisterEvent("zzTirionFordring_OnSpawn_Gozzz", 12000, 1)
  213.     #
  214.             pUnit:RegisterEvent("TirionFordring_OnSpawn_Gozzz", 22000, 1)
  215.     #
  216.     end
  217.     #
  218.      
  219.     #
  220.     function zTirionFordring_OnSpawn_Gozzz(pUnit, Event)
  221.     #
  222.             Lich:Emote(1, 6000)
  223.     #
  224.     end
  225.     #
  226.      
  227.     #
  228.     function zzTirionFordring_OnSpawn_Gozzz(pUnit, Event)
  229.     #
  230.             Lich:Emote(392, 3500)
  231.     #
  232.     end
  233.     #
  234.      
  235.     #
  236.     function TirionFordring_OnSpawn_Gozzz(pUnit, Event)
  237.     #
  238.             Lich:SendChatMessage(14,0,"So be it. Champions, attack!")
  239.     #
  240.             pUnit:PlaySoundToSet(17391)
  241.     #
  242.             pUnit:Emote(397, 2000)
  243.     #
  244.             pUnit:RegisterEvent("PATHETIC_RUN_TIRION", 2000, 1)
  245.     #
  246.             pUnit:RegisterEvent("TirionFordring_OnSpawn_Gozzzz", 3000, 1)
  247.     #
  248.             pUnit:RegisterEvent("TirionFordring_zzz_Gozzzz", 4500, 1)
  249.     #
  250.     end
  251.     #
  252.      
  253.     #
  254.     function PATHETIC_RUN_TIRION(pUnit, Event)
  255.     #
  256.             pUnit:SetMovementFlags(1)
  257.     #
  258.             pUnit:MoveTo(485.92, -2123.2, 1572.1, 3.17)
  259.     #
  260.     end
  261.     #
  262.      
  263.     #
  264.     function TirionFordring_OnSpawn_Gozzzz(pUnit, Event)
  265.     #
  266.             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.")
  267.     #
  268.             pUnit:PlaySoundToSet(17351)
  269.     #
  270.             local PlayersAllAround = pUnit:GetInRangePlayers()
  271.     #
  272.             for a, players in pairs(PlayersAllAround) do
  273.     #
  274.             players:CastSpell(69127)
  275.     #
  276.             end
  277.     #
  278.             Tirion = pUnit
  279.     #
  280.     end
  281.     #
  282.      
  283.     #
  284.     function TirionFordring_zzz_Gozzzz(pUnit, Event)
  285.     #
  286.             Tirion:CastSpell(71614)
  287.     #
  288.             Lich:SetFaction(22)
  289.     #
  290.     end
  291.     #
  292.      
  293.     #
  294.     -------- Rage Counter ---------------------------------------------
  295.     #
  296.      
  297.     #
  298.     function Rage_Counter_Lich_King(pUnit, Event)
  299.     #
  300.             if Lich == nil then
  301.     #
  302.             pUnit:RemoveEvents()
  303.     #
  304.             else
  305.     #
  306.                     if Count == 300 then
  307.     #
  308.                             if Phase == 2 then
  309.     #
  310.                             Count = 0
  311.     #
  312.                             Phase = 0
  313.     #
  314.                             Lich:RemoveEvents()
  315.     #
  316.                             Lich:SendChatMessage(14,0,"Face now your tragic end!")
  317.     #
  318.                             Lich:PlaySoundToSet(17365)
  319.     #
  320.                             else
  321.     #
  322.                             Lich:FullCastSpell(61714) -- Enrage, basic enrage spell used for all wrath bosses
  323.     #
  324.                             Phase = Phase + 1
  325.     #
  326.                             end
  327.     #
  328.                     else
  329.     #
  330.                     Count = Count + 5
  331.     #
  332.                     end
  333.     #
  334.             end
  335.     #
  336.     end
  337.     #
  338.      
  339.     #
  340.     -------- Fight ----------------------------------------------------
  341.     #
  342.      
  343.     #
  344.     function LichKingHasEnteredCombatLawl_Phase_One(pUnit, Event)
  345.     #
  346.             if Tirion == nil then
  347.     #
  348.             pUnit:Despawn(1, 10000) -- Where the F is he
  349.     #
  350.             Lich = nil -- Reset
  351.     #
  352.             else
  353.     #
  354.                     if Players_Wiped == 1 then
  355.     #
  356.                     --Players_Wiped = 0
  357.     #
  358.                     Lich:SetHealthPct(10)
  359.     #
  360.                     else
  361.     #
  362.                     Lich:SetCombatCapable(0)
  363.     #
  364.                     Lich:RegisterEvent("Rage_Counter_Lich_King", 5000, 0)
  365.     #
  366.                     Lich:RegisterEvent("Adds_Spawning_Incoming_Dredge_Ghouls", 19000, 0) -- Every 20 seconds (19 + 1 for next)
  367.     #
  368.                     Lich:RegisterEvent("Adds_Spawning_Incoming_Shambling_Horror", math.random(60000,70000), 0) -- Every 60-70 seconds (changes each match)
  369.     #
  370.                     Lich:RegisterEvent("Necrotic_Plague_Incoming", 20000, 0)
  371.     #
  372.                     Lich:RegisterEvent("Infest_Big_AOE_Incoming", 30000, 0)
  373.     #
  374.                     Lich:RegisterEvent("Phase_Two_Checker", 2500, 0)
  375.     #
  376.                     end
  377.     #
  378.             end
  379.     #
  380.     end
  381.     #
  382.      
  383.     #
  384.     function Adds_Spawning_Incoming_Dredge_Ghouls(pUnit, Event)
  385.     #
  386.             Lich:RegisterEvent("Adds_Spawning_Incoming_Dredge_Ghoulsz", 1000, 3) -- 3 times
  387.     #
  388.     end
  389.     #
  390.      
  391.     #
  392.     function Adds_Spawning_Incoming_Dredge_Ghoulsz(pUnit, Event)
  393.     #
  394.             local x = Lich:GetX()
  395.     #
  396.             local y = Lich:GetY()
  397.     #
  398.             local z = Lich:GetZ()
  399.     #
  400.             local o = Lich:GetO()
  401.     #
  402.             if math.random(1,2) == 1 then -- Spawn in different locations basically
  403.     #
  404.             Lich:SpawnCreature(3769511, x+math.random(1,6), y+math.random(1,6), z, o, 15, 360000)
  405.     #
  406.             else
  407.     #
  408.             Lich:SpawnCreature(3769511, x-math.random(1,6), y-math.random(1,6), z, o, 15, 360000)
  409.     #
  410.             end
  411.     #
  412.     end
  413.     #
  414.      
  415.     #
  416.     function Adds_Spawning_Incoming_Shambling_Horror(pUnit, Event)
  417.     #
  418.             local x = Lich:GetX()
  419.     #
  420.             local y = Lich:GetY()
  421.     #
  422.             local z = Lich:GetZ()
  423.     #
  424.             local o = Lich:GetO()
  425.     #
  426.             if math.random(1,2) == 1 then -- Spawn in different locations basically
  427.     #
  428.             Lich:SpawnCreature(3769811, x+math.random(1,6), y+math.random(1,6), z, o, 15, 360000)
  429.     #
  430.             else
  431.     #
  432.             Lich:SpawnCreature(3769811, x-math.random(1,6), y-math.random(1,6), z, o, 15, 360000)
  433.     #
  434.             end
  435.     #
  436.     end
  437.     #
  438.      
  439.     #
  440.     function Necrotic_Plague_Incoming(pUnit, Event)
  441.     #
  442.             local plr = Lich:GetRandomPlayer(0) -- I think this is correct
  443.     #
  444.             if plr ~= nil then
  445.     #
  446.             Lich:FullCastSpellOnTarget(73912, plr) -- ^ ^ ^ ^ ^ ^ ^ ^ ^
  447.     #
  448.             end
  449.     #
  450.     end
  451.     #
  452.      
  453.     #
  454.     function Infest_Big_AOE_Incoming(pUnit, Event)
  455.     #
  456.             Lich:FullCastSpell(73779)
  457.     #
  458.     end
  459.     #
  460.      
  461.     #
  462.     RegisterUnitEvent(3072111, 1, "LichKingHasEnteredCombatLawl_Phase_One")
  463.     #
  464.      
  465.     #
  466.     function Phase_Two_Checker(pUnit, Event)
  467.     #
  468.             if Lich:GetHealthPct() < 71 then
  469.     #
  470.             Lich:RemoveEvents()
  471.     #
  472.             Lich:MoveTo(512.7, -2120.5, 1572.1, 0)
  473.     #
  474.             Lich:SetMovementFlags(1)
  475.     #
  476.             Lich:SetCombatCapable(1)
  477.     #
  478.             Lich:RegisterEvent("Test_Debug_MoveToCentreOfRoom", 100, 0)
  479.     #
  480.             Lich:RegisterEvent("Test_Debug_MoveToCentreOfRoom_z", 4005, 1)
  481.     #
  482.             end
  483.     #
  484.     end
  485.     #
  486.      
  487.     #
  488.     function Test_Debug_MoveToCentreOfRoom(pUnit, Event)
  489.     #
  490.             Lich:MoveTo(512.7, -2120.5, 1572.1, 0)
  491.     #
  492.             Lich:SetMovementFlags(1)
  493.     #
  494.     end
  495.     #
  496.      
  497.     #
  498.     function Test_Debug_MoveToCentreOfRoom_z(pUnit, Event)
  499.     #
  500.             Lich:RemoveEvents()
  501.     #
  502.             Lich:Root()
  503.     #
  504.             Lich:FullCastSpell(74270)
  505.     #
  506.             Lich:SendChatMessage(14,0,"I will freeze you from within until all that remains is an icy husk!")
  507.     #
  508.             Lich:PlaySoundToSet(17369)
  509.     #
  510.             Lich:RegisterEvent("weaiyhoahg_delay", 6000, 1)
  511.     #
  512.     end
  513.     #
  514.      
  515.     #
  516.     function weaiyhoahg_delay(pUnit, Event)
  517.     #
  518.             local x = Lich:GetX()
  519.     #
  520.             local y = Lich:GetY()
  521.     #
  522.             Lich:SpawnCreature(3769812, x+math.random(3,6), y+math.random(3,6), Lich:GetZ(), Lich:GetZ(), 21, 10000)
  523.     #
  524.             Lich:RegisterEvent("Spam_Of_Lightning_That_Looks_Crap_But_Is_Blizzlike", 1500, 0)
  525.     #
  526.             Lich:RegisterEvent("NeedToWaitBecauseAddsBreakAndShizzleOrSomething", 3005, 1)
  527.     #
  528.             Lich:RegisterEvent("RandomRagingSpiritAddsThatAreNotRandom", 19990, 3) -- So we can get 3 in a minute without removing events
  529.     #
  530.             Lich:RegisterEvent("Test_Despawn_Outer_Shell", 59000, 0)
  531.     #
  532.     end
  533.     #
  534.      
  535.     #
  536.     function NeedToWaitBecauseAddsBreakAndShizzleOrSomething(pUnit,Event)
  537.     #
  538.             local x = Lich:GetX()
  539.     #
  540.             local y = Lich:GetY()
  541.     #
  542.             Lich:SpawnCreature(3769812, x-math.random(3,6), y-math.random(3,6), Lich:GetZ(), Lich:GetZ(), 21, 10000)
  543.     #
  544.     end
  545.     #
  546.      
  547.     #
  548.     function RandomRagingSpiritAddsThatAreNotRandom(pUnit, Event)
  549.     #
  550.             local plr = Lich:GetRandomPlayer(0)
  551.     #
  552.             if plr ~= nil then
  553.     #
  554.             local x,y,z,o = plr:GetX(),plr:GetY(),plr:GetZ(),plr:GetO()
  555.     #
  556.             Lich:SpawnCreature(3769813, x,y,z,o , 21, 360000)
  557.     #
  558.             end
  559.     #
  560.     end
  561.     #
  562.      
  563.     #
  564.     function Spam_Of_Lightning_That_Looks_Crap_But_Is_Blizzlike(pUnit, Event)
  565.     #
  566.             local plr = Lich:GetRandomPlayer(0)
  567.     #
  568.             if plr ~= nil then
  569.     #
  570.             Lich:FullCastSpellOnTarget(73788, plr)
  571.     #
  572.             end    
  573.     #
  574.     end
  575.     #
  576.            
  577.     #
  578.     function Test_Despawn_Outer_Shell(pUnit, Event)
  579.     #
  580.             Lich:RemoveEvents()
  581.     #
  582.             Lich:SendChatMessage(14,0,"Watch as the world around you collapses!")
  583.     #
  584.             Lich:PlaySoundToSet(17370)
  585.     #
  586.             --Lich:CastSpell(59084) -- temporary solution to no destructable object support on ArcEmu
  587.     #
  588.             Lich:SpawnCreature(2626262, 476.2, -2083.56, 1573.1, 0, 814, 20000)
  589.     #
  590.             Lich:SpawnCreature(2626262, 505.1, -2074.47, 1573.1, 0, 814, 20000)
  591.     #
  592.             Lich:SpawnCreature(2626262, 523.35, -2077.77, 1573.1, 0, 814, 20000)
  593.     #
  594.             Lich:SpawnCreature(2626262, 541, -2086.36, 1573.1, 0, 814, 20000)
  595.     #
  596.             Lich:SpawnCreature(2626262, 552.7, -2111.2, 1573.1, 0, 814, 20000)
  597.     #
  598.             Lich:SpawnCreature(2626262, 554, -2137, 1573.1, 0, 814, 20000)
  599.     #
  600.             Lich:SpawnCreature(2626262, 545.9, -2153.1, 1573.1, 0, 814, 20000)
  601.     #
  602.             Lich:SpawnCreature(2626262, 528, -2164, 1573.1, 0, 814, 20000)
  603.     #
  604.             Lich:SpawnCreature(2626262, 508.25, -2169.5, 1573.1, 0, 814, 20000)
  605.     #
  606.             Lich:SpawnCreature(2626262, 488.2, -2168, 1573.1, 0, 814, 20000)
  607.     #
  608.             Lich:RegisterEvent("DelayForDespawnSinceVisualTakesSomeTimeTehe_Zieghoszho", 1000, 1)
  609.     #
  610.             Lich:RegisterEvent("DelayForDespawnSinceVisualTakesSomeTimeTehe", 2500, 1)
  611.     #
  612.     end
  613.     #
  614.      
  615.     #
  616.     function DelayForDespawnSinceVisualTakesSomeTimeTehe_Zieghoszho(pUnit, Event)
  617.     #
  618.             Lich:FullCastSpell(72262) -- Epic shit I got working :D
  619.     #
  620.     end
  621.     #
  622.      
  623.     #
  624.     function DelayForDespawnSinceVisualTakesSomeTimeTehe(pUnit, Event)
  625.     #
  626.             Object = Lich:GetGameObjectNearestCoords(pUnit:GetX(),pUnit:GetY(),pUnit:GetZ(), 2957197)
  627.     #
  628.             if Object ~= nil then
  629.     #
  630.             Object:SetScale(0.01)
  631.     #
  632.             --Object:Despawn(1,0)
  633.     #
  634.             --Lich:CastSpell(46853) -- Shakes camera
  635.     #
  636.             end
  637.     #
  638.             Lich:SetCombatCapable(0)
  639.     #
  640.             Lich:Unroot()
  641.     #
  642.             -- Phase 2
  643.     #
  644.             Lich:RegisterEvent("Infest_Big_AOE_Incoming", 22000, 0)
  645.     #
  646.             Lich:RegisterEvent("Summon_Valkyr_Shadowguard", 19500, 0)
  647.     #
  648.             Lich:RegisterEvent("Soul_Reaper_On_Main_Tank", 30000, 0)
  649.     #
  650.             Lich:RegisterEvent("Phase_TwoPointFive_Checker", 2500, 0)
  651.     #
  652.             -- I cba to script defile :3
  653.     #
  654.     end
  655.     #
  656.      
  657.     #
  658.     function Soul_Reaper_On_Main_Tank(pUnit, Event)
  659.     #
  660.             local tank = Lich:GetMainTank()
  661.     #
  662.             if tank ~= nil then
  663.     #
  664.             Lich:FullCastSpellOnTarget(73798, tank)
  665.     #
  666.             end
  667.     #
  668.     end
  669.     #
  670.      
  671.     #
  672.     function Summon_Valkyr_Shadowguard(pUnit, Event)
  673.     #
  674.             local x, y, z, o = Lich:GetX()+3, Lich:GetY(), Lich:GetZ(), Lich:GetO()
  675.     #
  676.             Lich:SpawnCreature(25452151, x, y, z, o, 22, 0)
  677.     #
  678.             Lich:SendChatMessage(14,0,"Val'kyr, your master calls!")
  679.     #
  680.             Lich:PlaySoundToSet(17373)
  681.     #
  682.     end
  683.     #
  684.      
  685.     #
  686.     function Phase_TwoPointFive_Checker(pUnit, Event)
  687.     #
  688.             if Lich:GetHealthPct() < 41 then
  689.     #
  690.             Lich:RemoveEvents()
  691.     #
  692.             Lich:MoveTo(512.7, -2120.5, 1572.1, 0)
  693.     #
  694.             Lich:SetMovementFlags(1)
  695.     #
  696.             Lich:SetCombatCapable(1)
  697.     #
  698.             Lich:RegisterEvent("hhTest_Debug_MoveToCentreOfRoom", 100, 0)
  699.     #
  700.             Lich:RegisterEvent("hhTest_Debug_MoveToCentreOfRoom_z", 4005, 1)
  701.     #
  702.             end
  703.     #
  704.     end
  705.     #
  706.      
  707.     #
  708.     function hhTest_Debug_MoveToCentreOfRoom(pUnit, Event)
  709.     #
  710.             Lich:MoveTo(512.7, -2120.5, 1572.1, 0)
  711.     #
  712.             Lich:SetMovementFlags(1)
  713.     #
  714.     end
  715.     #
  716.      
  717.     #
  718.     function hhTest_Debug_MoveToCentreOfRoom_z(pUnit, Event)
  719.     #
  720.             Lich:RemoveEvents()
  721.     #
  722.             Lich:Root()
  723.     #
  724.             Lich:FullCastSpell(74270)
  725.     #
  726.             Lich:SendChatMessage(14,0,"I will freeze you from within until all that remains is an icy husk!")
  727.     #
  728.             Lich:PlaySoundToSet(17369)
  729.     #
  730.             Lich:RegisterEvent("jjweaiyhoahg_delay", 6000, 1)
  731.     #
  732.     end
  733.     #
  734.      
  735.     #
  736.     function jjweaiyhoahg_delay(pUnit, Event)
  737.     #
  738.             local x = Lich:GetX()
  739.     #
  740.             local y = Lich:GetY()
  741.     #
  742.             Lich:SpawnCreature(3769812, x+math.random(3,6), y+math.random(3,6), Lich:GetZ(), Lich:GetZ(), 21, 10000)
  743.     #
  744.             Lich:RegisterEvent("Spam_Of_Lightning_That_Looks_Crap_But_Is_Blizzlike", 1500, 0)
  745.     #
  746.             Lich:RegisterEvent("NeedToWaitBecauseAddsBreakAndShizzleOrSomething", 3005, 1)
  747.     #
  748.             Lich:RegisterEvent("RandomRagingSpiritAddsThatAreNotRandom", 14000, 3)
  749.     #
  750.             Lich:RegisterEvent("zzzTest_Despawn_Outer_Shell", 59000, 0)
  751.     #
  752.     end
  753.     #
  754.      
  755.     #
  756.     function zzzTest_Despawn_Outer_Shell(pUnit, Event)
  757.     #
  758.             Lich:RemoveEvents()
  759.     #
  760.             Lich:SendChatMessage(14,0,"Watch as the world around you collapses!")
  761.     #
  762.             Lich:PlaySoundToSet(17370)
  763.     #
  764.             if Object ~= nil then
  765.     #
  766.             Object:SetScale(1)
  767.     #
  768.             end
  769.     #
  770.             --Lich:CastSpell(59084) -- temporary solution to no destructable object support on ArcEmu
  771.     #
  772.             Lich:SpawnCreature(2626262, 476.2, -2083.56, 1573.1, 0, 814, 20000)
  773.     #
  774.             Lich:SpawnCreature(2626262, 505.1, -2074.47, 1573.1, 0, 814, 20000)
  775.     #
  776.             Lich:SpawnCreature(2626262, 523.35, -2077.77, 1573.1, 0, 814, 20000)
  777.     #
  778.             Lich:SpawnCreature(2626262, 541, -2086.36, 1573.1, 0, 814, 20000)
  779.     #
  780.             Lich:SpawnCreature(2626262, 552.7, -2111.2, 1573.1, 0, 814, 20000)
  781.     #
  782.             Lich:SpawnCreature(2626262, 554, -2137, 1573.1, 0, 814, 20000)
  783.     #
  784.             Lich:SpawnCreature(2626262, 545.9, -2153.1, 1573.1, 0, 814, 20000)
  785.     #
  786.             Lich:SpawnCreature(2626262, 528, -2164, 1573.1, 0, 814, 20000)
  787.     #
  788.             Lich:SpawnCreature(2626262, 508.25, -2169.5, 1573.1, 0, 814, 20000)
  789.     #
  790.             Lich:SpawnCreature(2626262, 488.2, -2168, 1573.1, 0, 814, 20000)
  791.     #
  792.             Lich:RegisterEvent("DelayForDespawnSinceVisualTakesSomeTimeTehe_Zieghoszho", 1000, 1)
  793.     #
  794.             Lich:RegisterEvent("zzzDelayForDespawnSinceVisualTakesSomeTimeTehe", 2500, 1)
  795.     #
  796.     end
  797.     #
  798.      
  799.     #
  800.     function zzzDelayForDespawnSinceVisualTakesSomeTimeTehe(pUnit, Event)
  801.     #
  802.             if Object ~= nil then
  803.     #
  804.             Object:Despawn(1,0)
  805.     #
  806.             end
  807.     #
  808.             Lich:SetCombatCapable(0)
  809.     #
  810.             Lich:Unroot()
  811.     #
  812.             -- Phase 3
  813.     #
  814.             Lich:RemoveEvents()
  815.     #
  816.             Lich:RegisterEvent("Soul_Reaper_On_Main_Tank", 30000, 0)
  817.     #
  818.             Lich:RegisterEvent("Harvest_Soul_Random_Raid_Member", 66000, 0)
  819.     #
  820.             Lich:RegisterEvent("Vile_Spirits_Spawning_Inc", 28000, 0)
  821.     #
  822.             Lich:RegisterEvent("Phase_Four_The_Ending_tehe", 1500, 0)
  823.     #
  824.     end
  825.     #
  826.      
  827.     #
  828.     function Harvest_Soul_Random_Raid_Member(pUnit, Event)
  829.     #
  830.             local plr = Lich:GetRandomPlayer(0)
  831.     #
  832.             if plr ~= nil then
  833.     #
  834.             Lich:SendChatMessage(14,0,"Frostmourne hungers...")
  835.     #
  836.             Lich:PlaySoundToSet(17366)
  837.     #
  838.             Lich:FullCastSpellOnTarget(74325, plr)
  839.     #
  840.             end
  841.     #
  842.     end
  843.     #
  844.      
  845.     #
  846.     function Vile_Spirits_Spawning_Inc(pUnit, Event)
  847.     #
  848.             Lich:RegisterEvent("Spawning_The_Vile_spirits_NoW", 1000, 10)
  849.     #
  850.     end
  851.     #
  852.      
  853.     #
  854.     function Spawning_The_Vile_spirits_NoW(pUnit, Event)
  855.     #
  856.             local pla = Lich:GetRandomPlayer(0)
  857.     #
  858.             if pla ~= nil then
  859.     #
  860.             local x, y, z, o = pla:GetX(), pla:GetY(), pla:GetZ(), pla:GetO()
  861.     #
  862.             Lich:SpawnCreature(5078151, x, y, z, o, 22, 60000)
  863.     #
  864.             end
  865.     #
  866.     end
  867.     #
  868.      
  869.     #
  870.     function Phase_Four_The_Ending_tehe(pUnit, Event)
  871.     #
  872.             if Lich:GetHealthPct() < 11 then
  873.     #
  874.             Count = 0
  875.     #
  876.             Phase = 0
  877.     #
  878.             Lich:RemoveEvents()
  879.     #
  880.             Lich:SendChatMessage(14,0,"You gnats actually hurt me! Perhaps I've toyed with you long enough, now taste the vengeance of the grave!")
  881.     #
  882.             Lich:PlaySoundToSet(17359)
  883.     #
  884.             Lich:MoveTo(512.7, -2120.5, 1572.1, 0)
  885.     #
  886.             Lich:SetMovementFlags(1)
  887.     #
  888.             Lich:SetCombatCapable(1)
  889.     #
  890.             Lich:RegisterEvent("hhTest_Debug_MoveToCentreOfRoom", 100, 0)
  891.     #
  892.             Lich:RegisterEvent("hggzhTest_Debug_MoveToCentreOfRoom_z", 5005, 1)
  893.     #
  894.             end
  895.     #
  896.     end
  897.     #
  898.      
  899.     #
  900.     function hggzhTest_Debug_MoveToCentreOfRoom_z(pUnit, Event)
  901.     #
  902.             Lich:RemoveEvents()
  903.     #
  904.             Lich:FullCastSpell(72350)
  905.     #
  906.             Players_Wiped = 1
  907.     #
  908.             -- Most of the visuals needed are not in game due to ArcEmu's screwed up extractors
  909.     #
  910.             Lich:RegisterEvent("Debug_Send_Next_Message_LichKing", 10000, 1)
  911.     #
  912.     end
  913.     #
  914.      
  915.     #
  916.     function Debug_Send_Next_Message_LichKing(pUnit, Event)
  917.     #
  918.             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...")
  919.     #
  920.             Lich:PlaySoundToSet(17353)
  921.     #
  922.             Lich:RegisterEvent("zzDebug_Send_Next_Message_LichKing", 25000, 1)
  923.     #
  924.     end
  925.     #
  926.      
  927.     #
  928.     function zzDebug_Send_Next_Message_LichKing(pUnit, Event)
  929.     #
  930.             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.")
  931.     #
  932.             Lich:PlaySoundToSet(17355)
  933.     #
  934.             local plr = Lich:GetRandomPlayer(0)
  935.     #
  936.             if plr ~= nil then
  937.     #
  938.             Lich:ChannelSpell(71769, plr)
  939.     #
  940.             end
  941.     #
  942.             local DeadGuys = Lich:GetInRangePlayers()
  943.     #
  944.             for k, plrs in pairs(DeadGuys) do
  945.     #
  946.             plrs:ChannelSpell(47855, Lich)
  947.     #
  948.             end
  949.     #
  950.             Lich:RegisterEvent("zzzzDebug_Send_Next_Message_LichKing", 24000, 1)
  951.     #
  952.     end
  953.     #
  954.      
  955.     #
  956.     function zzzzDebug_Send_Next_Message_LichKing(pUnit, Event)
  957.     #
  958.             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.")
  959.     #
  960.             Lich:PlaySoundToSet(17356)
  961.     #
  962.             Lich:RegisterEvent("zzzzDebug_Send_Next_Message_LichKingzz", 26000, 1)
  963.     #
  964.     end
  965.     #
  966.      
  967.     #
  968.     function zzzzDebug_Send_Next_Message_LichKingzz(pUnit, Event)
  969.     #
  970.             Lich:PlaySoundToSet(17357)
  971.     #
  972.             Lich:SendChatMessage(14,0,"I delight in the irony.")
  973.     #
  974.             Lich:RegisterEvent("zzzzDebug_Send_Next_Message_LichKingzzzz", 6000, 1)
  975.     #
  976.             --Lich:StopChannel()
  977.     #
  978.     end
  979.     #
  980.      
  981.     #
  982.     function zzzzDebug_Send_Next_Message_LichKingzzzz(pUnit, Event)
  983.     #
  984.             if Tirion == nil then
  985.     #
  986.             Lich:Despawn(1,0)
  987.     #
  988.             else
  989.     #
  990.             Tirion:SendChatMessage(14,0,"LIGHT, GRANT ME ONE FINAL BLESSING. GIVE ME THE STRENGTH... TO SHATTER THESE BONDS!")
  991.     #
  992.             Tirion:PlaySoundToSet(17392)
  993.     #
  994.             Lich:RegisterEvent("Breakoutofice", 9000, 1)
  995.     #
  996.             end
  997.     #
  998.     end
  999.     #
  1000.      
  1001.     #
  1002.     function Breakoutofice(pUnit, Event)
  1003.     #
  1004.             Tirion:RemoveAura(71614) --(Remove IceBlock, to cast the Spell under this Line :>)
  1005.     #
  1006.             Tirion:CastSpell(71797)
  1007.     #
  1008.             Tirion:CastSpell(71614) --(Get the IceBlock Again :>, You cannot see that he was out :>) -- Stays in ice block? lol
  1009.     #
  1010.             Lich:RegisterEvent("zzzzDebug_Send_Next_Message_LichKingzzzzgg", 5000, 1)
  1011.     #
  1012.     end
  1013.     #
  1014.      
  1015.     #
  1016.     function zzzzDebug_Send_Next_Message_LichKingzzzzgg(pUnit, Event)
  1017.     #
  1018.             Tirion:RemoveAura(71614) -- Ice Block
  1019.     #
  1020.             Tirion:CastSpell(71773)
  1021.     #
  1022.             Lich:RegisterEvent("zzzzDebug_Send_Next_Message_LichKingzzzzgzg", 1500, 1)
  1023.     #
  1024.             -- jumps and destroys frostmourne
  1025.     #
  1026.     end
  1027.     #
  1028.      
  1029.     #
  1030.     function zzzzDebug_Send_Next_Message_LichKingzzzzgzg(pUnit, Event)
  1031.     #
  1032.             Tirion:SetMovementFlags(2)
  1033.     #
  1034.             Tirion:SetFlying()
  1035.     #
  1036.             Tirion:Emote(375, 60000)
  1037.     #
  1038.             Tirion:MoveTo(511, -2121, 1575, 14)
  1039.     #
  1040.             Tirion:Emote(375, 60000)
  1041.     #
  1042.             Lich:StopChannel()
  1043.     #
  1044.             Lich:RegisterEvent("zagazzzDebug_Send_Next_Message_LichKingzzzzgzg", 3000, 1)
  1045.     #
  1046.     end
  1047.     #
  1048.      
  1049.     #
  1050.     function zagazzzDebug_Send_Next_Message_LichKingzzzzgzg(pUnit, Event)
  1051.     #
  1052.             Tirion:SetMovementFlags(1)
  1053.     #
  1054.             Tirion:MoveTo(536.5, -2121, 1572.1, 3.15)
  1055.     #
  1056.             Lich:PlaySoundToSet(17459)
  1057.     #
  1058.             Lich:SpawnCreature(2626269, Lich:GetX(), Lich:GetY(), Lich:GetZ(), 0, 35, 0) -- Invisible trigger
  1059.     #
  1060.             Lich:RegisterEvent("zagazzzDebug_Send_Next_Message_LichKingzgeazzzzgzg", 1900, 1)
  1061.     #
  1062.             Tirion:RegisterEvent("lichisdead", 1900, 1)
  1063.     #
  1064.     end
  1065.     #
  1066.      
  1067.     #
  1068.     function lichisdead(pUnit, Event)
  1069.     #
  1070.             Tirion:MoveTo(514.135254, -2122.514160, 1572)
  1071.     #
  1072.     end
  1073.     #
  1074.      
  1075.     #
  1076.     function zagazzzDebug_Send_Next_Message_LichKingzgeazzzzgzg(pUnit, Event)
  1077.     #
  1078.             Lich:CastSpell(37592) -- Knockdown
  1079.     #
  1080.             --Lich:CastSpell(72726) -- Boom visual
  1081.     #
  1082.             local DeadGuys = Lich:GetInRangePlayers()
  1083.     #
  1084.             for k, plrs in pairs(DeadGuys) do
  1085.     #
  1086.             plrs:StopChannel()
  1087.     #
  1088.             end
  1089.     #
  1090.             if Garfield ~= nil then
  1091.     #
  1092.             Garfield:CastSpell(72405) -- THE CORRECT VISUAL ;D
  1093.     #
  1094.             end -- I cba to add a debugger, if it screws up at this point SCREW YOU BLIZZARD AND EMULATION
  1095.     #
  1096.             --Lich:FullCastSpell(72406) -- The drop frostmourne visual thing (it fucks up his animations so I cba with this :D)
  1097.     #
  1098.             Lich:CastSpell(73017) -- The soul free thing
  1099.     #
  1100.             Lich:FullCastSpell(72398) -- Frostmourne on floor
  1101.     #
  1102.             Lich:EquipWeapons(0,0,0)
  1103.     #
  1104.             Lich:SendChatMessage(14,0,"Impossible...")
  1105.     #
  1106.             Lich:PlaySoundToSet(17358)
  1107.     #
  1108.             Lich:Emote(473, 120000)
  1109.     #
  1110.             --Lich:CastSpell(72523)
  1111.     #
  1112.             Lich:RegisterEvent("zagazzzDebug_Send_Next_Message_LichKingzgeazzzzedhezgzg", 1500, 1)
  1113.     #
  1114.     end
  1115.     #
  1116.      
  1117.     #
  1118.     function zagazzzDebug_Send_Next_Message_LichKingzgeazzzzedhezgzg(pUnit, Event)
  1119.     #
  1120.             Tirion:SendChatMessage(14,0,"No more, Arthas! No more lives will be consumed by your hatred!")
  1121.     #
  1122.             Tirion:PlaySoundToSet(17393)
  1123.     #
  1124.             Tirion:SetMovementFlags(1)
  1125.     #
  1126.             Lich:Emote(473, 120000)
  1127.     #
  1128.             Lich:SpawnCreature(31021151, 518.8, -2115.8, 1572.1, 3.780169, 35, 0)
  1129.     #
  1130.             Tirion:MoveTo(526, -2120.5, 1572.1, 3)
  1131.     #
  1132.             Lich:RegisterEvent("zagazzzDebug_Send_Next_Message_LichKingzgeazzzzedhezgzzzzsay", 5500, 1)
  1133.     #
  1134.     end
  1135.     #
  1136.      
  1137.     #
  1138.     function zagazzzDebug_Send_Next_Message_LichKingzgeazzzzedhezgzzzzsay(pUnit, Event)
  1139.     #
  1140.             if Terenas == nil then -- Dunno why this would happen
  1141.     #
  1142.             Lich:Despawn(1,0)
  1143.     #
  1144.             Lich = nil
  1145.     #
  1146.             Tirion:Despawn(1,0)
  1147.     #
  1148.             Tirion = nil
  1149.     #
  1150.             else
  1151.     #
  1152.             Lich:Emote(473, 120000)
  1153.     #
  1154.             Terenas:EquipWeapons(23456, 18825, 0)
  1155.     #
  1156.             Terenas:SendChatMessage(14,0,"Free at last! It is over, my son. This is the moment of reckoning.")
  1157.     #
  1158.             Terenas:PlaySoundToSet(17397)
  1159.     #
  1160.             Terenas:ChannelSpell(51361, Terenas)
  1161.     #
  1162.             Lich:RegisterEvent("epiashgyophopapea_Lich_King_Is_Not_A_Happy_Bunny", 10000, 1)
  1163.     #
  1164.             end
  1165.     #
  1166.     end
  1167.     #
  1168.      
  1169.     #
  1170.     function epiashgyophopapea_Lich_King_Is_Not_A_Happy_Bunny(pUnit, Event)
  1171.     #
  1172.             Terenas:SendChatMessage(14,0,"Rise up, champions of the Light!")
  1173.     #
  1174.             Terenas:PlaySoundToSet(17398)
  1175.     #
  1176.             Terenas:StopChannel()
  1177.     #
  1178.             Terenas:CastSpell(37755)
  1179.     #
  1180.             Lich:Emote(473, 120000)
  1181.     #
  1182.             local PlayersAllAround = Terenas:GetInRangePlayers()
  1183.     #
  1184.             for a, players in pairs(PlayersAllAround) do
  1185.     #
  1186.             players:ResurrectPlayer(players)
  1187.     #
  1188.             players:CastSpell(24171)
  1189.     #
  1190.             end
  1191.     #
  1192.             --Terenas:FullCastSpell(72429) -- Failure
  1193.     #
  1194.             Lich:RegisterEvent("zLich_King_Is_Not_A_Happy_Bunny", 5000, 1)
  1195.     #
  1196.     end
  1197.     #
  1198.      
  1199.     #
  1200.     function zLich_King_Is_Not_A_Happy_Bunny(pUnit, Event)
  1201.     #
  1202.             Terenas:Despawn(500,0)
  1203.     #
  1204.             Lich:Emote(473, 120000)
  1205.     #
  1206.             Lich:SendChatMessage(14,0,"Now I stand, the lion before the lambs... and they do not fear.")
  1207.     #
  1208.             Lich:PlaySoundToSet(17361)
  1209.     #
  1210.             Lich:RegisterEvent("zLich_King_Is_Not_A_Happy_Bunnyz", 8000, 1)
  1211.     #
  1212.     end
  1213.     #
  1214.      
  1215.     #
  1216.     function zLich_King_Is_Not_A_Happy_Bunnyz(pUnit, Event)
  1217.     #
  1218.             Lich:SendChatMessage(14,0,"They cannot fear.")
  1219.     #
  1220.             Lich:PlaySoundToSet(17362)
  1221.     #
  1222.             Lich:Emote(473, 120000)
  1223.     #
  1224.             Lich:SetHealthPct(10)
  1225.     #
  1226.             -- The end, poor arthas, Q_Q, lets all go do a rain dance, ~Stoneharry
  1227.     #
  1228.     end
  1229.     #
  1230.      
  1231.     #
  1232.     ---- Terenas -----------------------------------------------------
  1233.     #
  1234.      
  1235.     #
  1236.     function Terenas_Spawned_root_Hes_the_realm_of_My_RETAIL_Char(pUnit, Event)
  1237.     #
  1238.             if Tirion == nil or Lich == nil then
  1239.     #
  1240.             pUnit:Despawn(1,0)
  1241.     #
  1242.             else
  1243.     #
  1244.             Terenas = pUnit
  1245.     #
  1246.             end
  1247.     #
  1248.     end
  1249.     #
  1250.      
  1251.     #
  1252.     RegisterUnitEvent(31021151, 18, "Terenas_Spawned_root_Hes_the_realm_of_My_RETAIL_Char")
  1253.     #
  1254.      
  1255.     #
  1256.     -------------------------------------------------------------------
  1257.     #
  1258.      
  1259.     #
  1260.     function LichKingHasDiedSoWePlayMovie(pUnit, Event)
  1261.     #
  1262.             if Garfield ~= nil then
  1263.     #
  1264.             Garfield:Despawn(1,0)
  1265.     #
  1266.             end
  1267.     #
  1268.             local PlayersAllAround = pUnit:GetInRangePlayers()
  1269.     #
  1270.             for a, players in pairs(PlayersAllAround) do
  1271.     #
  1272.                     if players:HasAchievement(4579) == false then
  1273.     #
  1274.                     players:AddAchievement(4579)
  1275.     #
  1276.                     end
  1277.     #
  1278.             end
  1279.     #
  1280.             Lich = nil
  1281.     #
  1282.             pUnit:RemoveEvents()
  1283.     #
  1284.             pUnit:PlaySoundToSet(17374) -- Freak makes dying sound
  1285.     #
  1286.             pUnit:SpawnCreature(3072110, pUnit:GetX(), pUnit:GetY(), pUnit:GetZ(), pUnit:GetO(), 35, 10000)
  1287.     #
  1288.     end
  1289.     #
  1290.      
  1291.     #
  1292.     RegisterUnitEvent(3072111, 4, "LichKingHasDiedSoWePlayMovie")
  1293.     #
  1294.      
  1295.     #
  1296.     function TriggerHasSpawnedSoPlayMovie(pUnit, Event)
  1297.     #
  1298.             pUnit:RegisterEvent("PlayMovieOnceDeathAnimationHasPlayed", 9000, 1)
  1299.     #
  1300.     end
  1301.     #
  1302.      
  1303.     #
  1304.     function PlayMovieOnceDeathAnimationHasPlayed(pUnit, Event)
  1305.     #
  1306.             -- Reset Fight
  1307.     #
  1308.             Garfield = nil
  1309.     #
  1310.             Tirion = nil
  1311.     #
  1312.             Lich = nil
  1313.     #
  1314.             Terenas = nil
  1315.     #
  1316.             package = nil
  1317.     #
  1318.             Phase = 0
  1319.     #
  1320.             Count = 0
  1321.     #
  1322.             -- Movie
  1323.     #
  1324.             Players_Wiped = 0
  1325.     #
  1326.             local PlayersAllAround = pUnit:GetInRangePlayers()
  1327.     #
  1328.             for a, players in pairs(PlayersAllAround) do
  1329.     #
  1330.             --SMSG_TRIGGER_MOVIE = 0x464
  1331.     #
  1332.             local packet = LuaPacket:CreatePacket(0x464, 4) -- Move type 4
  1333.     #
  1334.             packet:WriteULong(16) -- Id 16
  1335.     #
  1336.             players:SendPacketToPlayer(packet) -- Send to players
  1337.     #
  1338.             end
  1339.     #
  1340.             -- Bolvar
  1341.     #
  1342.             local Bolvar = pUnit:GetGameObjectNearestCoords(428.758, -2124.4, 1594.69, 2508221) -- Bolvar in chains
  1343.     #
  1344.             if Bolvar ~= nil then
  1345.     #
  1346.             Bolvar:Despawn(1,0)
  1347.     #
  1348.             pUnit:SpawnGameObject(2508220, 428.758, -2124.4, 1594.69, 0, 360000) -- Chains
  1349.     #
  1350.             pUnit:SpawnGameObject(2508219, 430.103, -2124, 1595.93, 3.3, 360000) -- Bolvar
  1351.     #
  1352.             end
  1353.     #
  1354.     end
  1355.     #
  1356.      
  1357.     #
  1358.     RegisterUnitEvent(3072110, 18, "TriggerHasSpawnedSoPlayMovie")
  1359.     #
  1360.            
  1361.     #
  1362.     ------- Adds ------------------------------------------------------
  1363.     #
  1364.      
  1365.     #
  1366.     function Dredge_Ghouls_OnSpawn(pUnit, Event)
  1367.     #
  1368.             pUnit:RegisterEvent("TestRootFunctionNextSecond", 1, 1)
  1369.     #
  1370.     end
  1371.     #
  1372.      
  1373.     #
  1374.     function TestRootFunctionNextSecond(pUnit, Event)
  1375.     #
  1376.             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 ;)
  1377.     #
  1378.             pUnit:RemoveFromWorld()
  1379.     #
  1380.             else -- Well if he is here
  1381.     #
  1382.             pUnit:Emote(449, 4000) -- spawn animation
  1383.     #
  1384.             pUnit:Root() -- Root him while he spawns
  1385.     #
  1386.             pUnit:RegisterEvent("Delay_A_Second_And_See_WhatHappens_Tehe", math.random(1,1000), 1)
  1387.     #
  1388.             pUnit:RegisterEvent("SetFactionToHostileForTheEmote", 4500, 1)
  1389.     #
  1390.             end
  1391.     #
  1392.     end
  1393.     #
  1394.      
  1395.     #
  1396.     function Delay_A_Second_And_See_WhatHappens_Tehe(pUnit, Event)
  1397.     #
  1398.             pUnit:CastSpell(55719)
  1399.     #
  1400.     end
  1401.     #
  1402.      
  1403.     #
  1404.     function SetFactionToHostileForTheEmote(pUnit, Event)
  1405.     #
  1406.             pUnit:Unroot() -- let him run free
  1407.     #
  1408.             pUnit:SetFaction(21) -- hostile
  1409.     #
  1410.     end
  1411.     #
  1412.      
  1413.     #
  1414.     RegisterUnitEvent(3769511, 18, "Dredge_Ghouls_OnSpawn")
  1415.     #
  1416.      
  1417.     #
  1418.     ---------------------------------------------------------------------
  1419.     #
  1420.      
  1421.     #
  1422.     function Shambling_Horrors_OnSpawn(pUnit, Event)
  1423.     #
  1424.             pUnit:RegisterEvent("zzTestRootFunctionNextSecond", 1, 1)
  1425.     #
  1426.     end
  1427.     #
  1428.      
  1429.     #
  1430.     function zzTestRootFunctionNextSecond(pUnit, Event)
  1431.     #
  1432.             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 ;)
  1433.     #
  1434.             pUnit:RemoveFromWorld()
  1435.     #
  1436.             else -- Well if he is here
  1437.     #
  1438.             pUnit:Emote(449, 4000) -- spawn animation
  1439.     #
  1440.             pUnit:Root() -- Root him while he spawns
  1441.     #
  1442.             pUnit:CastSpell(55719)
  1443.     #
  1444.             pUnit:RegisterEvent("zzSetFactionToHostileForTheEmote", 4500, 1)
  1445.     #
  1446.             end
  1447.     #
  1448.     end
  1449.     #
  1450.      
  1451.     #
  1452.     function zzSetFactionToHostileForTheEmote(pUnit, Event)
  1453.     #
  1454.             pUnit:Unroot() -- let him run free
  1455.     #
  1456.             pUnit:SetFaction(21) -- hostile
  1457.     #
  1458.     end
  1459.     #
  1460.      
  1461.     #
  1462.     RegisterUnitEvent(3769811, 18, "Shambling_Horrors_OnSpawn")
  1463.     #
  1464.      
  1465.     #
  1466.     function Shambling_Horrors_OnCombat(pUnit, Event)
  1467.     #
  1468.             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 ;)
  1469.     #
  1470.             pUnit:RemoveFromWorld()
  1471.     #
  1472.             else -- Well if he is here
  1473.     #
  1474.             pUnit:RegisterEvent("Enrage_Spam_Incoming_Varied_Time", math.random(20000,25000), 0) -- Varied time depending on add
  1475.     #
  1476.             pUnit:RegisterEvent("Shockwave_thingy_time_notsure_on_timer", 15000, 0)
  1477.     #
  1478.             end
  1479.     #
  1480.     end
  1481.     #
  1482.      
  1483.     #
  1484.     function Enrage_Spam_Incoming_Varied_Time(pUnit, Event)
  1485.     #
  1486.             pUnit:FullCastSpell(72143)
  1487.     #
  1488.     end
  1489.     #
  1490.      
  1491.     #
  1492.     function Shockwave_thingy_time_notsure_on_timer(pUnit, Event)
  1493.     #
  1494.             pUnit:FullCastSpell(72149)
  1495.     #
  1496.     end
  1497.     #
  1498.      
  1499.     #
  1500.     function Shambling_Horrors_OnLeave(pUnit, Event)
  1501.     #
  1502.             pUnit:RemoveEvents()
  1503.     #
  1504.     end
  1505.     #
  1506.      
  1507.     #
  1508.     function Shambling_Horrors_OnDead(pUnit, Event)
  1509.     #
  1510.             pUnit:RemoveEvents()
  1511.     #
  1512.     end
  1513.     #
  1514.      
  1515.     #
  1516.     RegisterUnitEvent(3769811, 1, "Shambling_Horrors_OnCombat")
  1517.     #
  1518.     RegisterUnitEvent(3769811, 2, "Shambling_Horrors_OnLeave")
  1519.     #
  1520.     RegisterUnitEvent(3769811, 4, "Shambling_Horrors_OnDead")
  1521.     #
  1522.      
  1523.     #
  1524.     ----- Ice Sphere --------------------------------------------------
  1525.     #
  1526.      
  1527.     #
  1528.     -- 69090 on spawn -- only 2 on phase 1.5, head towards player and explode if hit
  1529.     #
  1530.      
  1531.     #
  1532.     function IceShard_OnSpawn(pUnit, Event)
  1533.     #
  1534.             pUnit:RegisterEvent("rage_rage_rage_rage_Rage_rage", 1, 1)
  1535.     #
  1536.     end
  1537.     #
  1538.      
  1539.     #
  1540.     function rage_rage_rage_rage_Rage_rage(pUnit, Event)
  1541.     #
  1542.             if Lich == nil then
  1543.     #
  1544.             pUnit:RemoveFromWorld() -- may cause crash if he tries to despawn but variable broke
  1545.     #
  1546.             else
  1547.     #
  1548.                     pUnit:FullCastSpell(69090) -- Visual
  1549.     #
  1550.                     local pla = pUnit:GetRandomPlayer(0)
  1551.     #
  1552.                     if pla ~= nil then
  1553.     #
  1554.                     pUnit:MoveTo(pla:GetX(), pla:GetY(), pla:GetZ(), pla:GetO())
  1555.     #
  1556.                     pUnit:SetMovementFlags(1)
  1557.     #
  1558.                     pUnit:RegisterEvent("rage_rage_rage_rage_Rage_rage_r", 1000, 8)
  1559.     #
  1560.                     else
  1561.     #
  1562.                     pUnit:RemoveFromWorld()
  1563.     #
  1564.                     end
  1565.     #
  1566.             end
  1567.     #
  1568.     end
  1569.     #
  1570.      
  1571.     #
  1572.     function rage_rage_rage_rage_Rage_rage_r(pUnit, Event)
  1573.     #
  1574.             local plm = pUnit:GetClosestPlayer()
  1575.     #
  1576.             if plm ~= nil then
  1577.     #
  1578.                     pUnit:FullCastSpell(69090) -- Visual
  1579.     #
  1580.                     if pUnit:GetDistanceYards(plm) < 4 then
  1581.     #
  1582.                     --pUnit:FullCastSpellOnTarget(70827, plm) -- May be buggy if player dies, maybe not knockbacked and players try to exploit by ressing?
  1583.     #
  1584.                     pUnit:FullCastSpellOnTarget(11027, plm) -- Knockback
  1585.     #
  1586.                     pUnit:CastSpell(56135)
  1587.     #
  1588.                     pUnit:RemoveEvents()
  1589.     #
  1590.                     end
  1591.     #
  1592.             end
  1593.     #
  1594.     end
  1595.     #
  1596.      
  1597.     #
  1598.     RegisterUnitEvent(3769812, 18, "IceShard_OnSpawn")
  1599.     #
  1600.      
  1601.     #
  1602.     ---- Raging Spirit ------------------------------------------------
  1603.     #
  1604.      
  1605.     #
  1606.     function RagingSpirit_OnCombat(pUnit, Event)
  1607.     #
  1608.             if Lich == nil then
  1609.     #
  1610.             pUnit:RemoveFromWorld()
  1611.     #
  1612.             else
  1613.     #
  1614.             pUnit:RegisterEvent("Soul_Shriek_Random_Time_Depending_On_Mob", math.random(7500, 15000), 0)
  1615.     #
  1616.             pUnit:RegisterEvent("Soul_Shriek_Random_Visual", 1000, 1)
  1617.     #
  1618.             end
  1619.     #
  1620.     end
  1621.     #
  1622.      
  1623.     #
  1624.     function Soul_Shriek_Random_Visual(pUnit, Event)
  1625.     #
  1626.             pUnit:FullCastSpell(69198) -- Visual
  1627.     #
  1628.     end
  1629.     #
  1630.      
  1631.     #
  1632.     function Soul_Shriek_Random_Time_Depending_On_Mob(pUnit, Event)
  1633.     #
  1634.             pUnit:FullCastSpell(69242) -- Shriek
  1635.     #
  1636.     end
  1637.     #
  1638.      
  1639.     #
  1640.     function RagingSpirit_OnLeave(pUnit, Event)
  1641.     #
  1642.             pUnit:RemoveEvents()
  1643.     #
  1644.     end
  1645.     #
  1646.      
  1647.     #
  1648.     function RagingSpirit_OnDead(pUnit, Event)
  1649.     #
  1650.             pUnit:RemoveEvents()
  1651.     #
  1652.     end
  1653.     #
  1654.      
  1655.     #
  1656.     RegisterUnitEvent(3769813, 1, "RagingSpirit_OnCombat")
  1657.     #
  1658.     RegisterUnitEvent(3769813, 2, "RagingSpirit_OnLeave")
  1659.     #
  1660.     RegisterUnitEvent(3769813, 4, "RagingSpirit_OnDead")
  1661.     #
  1662.      
  1663.     #
  1664.     ---- Flying Dudes ------------------------------------------------------
  1665.     #
  1666.      
  1667.     #
  1668.     function zhgzFlying_Dude_OnCombat(pUnit, Event)
  1669.     #
  1670.             if Lich == nil then
  1671.     #
  1672.             pUnit:RemoveFromWorld()
  1673.     #
  1674.             else
  1675.     #
  1676.             pUnit:RegisterEvent("zhgzFlying_Dude_Find_Player", 1, 1)
  1677.     #
  1678.             end
  1679.     #
  1680.     end
  1681.     #
  1682.      
  1683.     #
  1684.     function zhgzFlying_Dude_Find_Player(pUnit, Event)
  1685.     #
  1686.             package = pUnit:GetClosestPlayer()
  1687.     #
  1688.             if package ~= nil then
  1689.     #
  1690.             pUnit:SetCombatCapable(1) -- Stop npc running around
  1691.     #
  1692.             package:SetPlayerLock(1) -- Stop player doing stuff :3
  1693.     #
  1694.             pUnit:SetMovementFlags(2) -- Flying Mode On
  1695.     #
  1696.             pUnit:ChannelSpell(55520, package) -- visual
  1697.     #
  1698.             pUnit:MoveTo(pUnit:GetX(), pUnit:GetY(), pUnit:GetZ()+6, pUnit:GetO(), 12288)
  1699.     #
  1700.             package:MovePlayerTo(package:GetX(), package:GetY(), package:GetZ()+6, package:GetO(), 12288)
  1701.     #
  1702.             pUnit:RegisterEvent("now_we_have_loaded_preset_We_can_move_on", 2000, 1)
  1703.     #
  1704.             else
  1705.     #
  1706.             pUnit:RemoveFromWorld()
  1707.     #
  1708.             end
  1709.     #
  1710.     end
  1711.     #
  1712.      
  1713.     #
  1714.     function now_we_have_loaded_preset_We_can_move_on(pUnit, Event)
  1715.     #
  1716.             if package ~= nil then
  1717.     #
  1718.             package:CastSpell(52241) -- Choke visual
  1719.     #
  1720.             package:CastSpell(53658) -- Bubble to stop stupid animations
  1721.     #
  1722.             pUnit:ChannelSpell(29172, package) -- visual
  1723.     #
  1724.             pUnit:RegisterEvent("now_we_have_loaded_preset_We_can_move_on_two", 1500, 0)
  1725.     #
  1726.             else
  1727.     #
  1728.             pUnit:RemoveEvents()
  1729.     #
  1730.             pUnit:RemoveFromWorld()
  1731.     #
  1732.             end
  1733.     #
  1734.     end
  1735.     #
  1736.      
  1737.     #
  1738.     function now_we_have_loaded_preset_We_can_move_on_two(pUnit, Event)
  1739.     #
  1740.             if package ~= nil then
  1741.     #
  1742.                     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 :)
  1743.     #
  1744.                     pUnit:RemoveEvents()
  1745.     #
  1746.                     pUnit:StopChannel()
  1747.     #
  1748.                     package:RemoveAura(52241) -- choke
  1749.     #
  1750.                     package:RemoveAura(53658) -- buble
  1751.     #
  1752.                     package:SetPlayerLock(0)
  1753.     #
  1754.                     package = nil
  1755.     #
  1756.                     --pUnit:RemoveFromWorld() -- Causes crash :(
  1757.     #
  1758.                     else    
  1759.     #
  1760.                     pUnit:SetMovementFlags(2)
  1761.     #
  1762.                     package:ModifyFlySpeed(2.5)
  1763.     #
  1764.                     pUnit:MoveTo(572, -2121.5, 1577.2, 0, 12288, 2.5)
  1765.     #
  1766.                     package:MovePlayerTo(pUnit:GetX(), pUnit:GetY(), pUnit:GetZ() ,pUnit:GetO(), 12288)
  1767.     #
  1768.                     end
  1769.     #
  1770.             else
  1771.     #
  1772.             pUnit:RemoveEvents()
  1773.     #
  1774.             pUnit:RemoveFromWorld()
  1775.     #
  1776.             end
  1777.     #
  1778.     end
  1779.     #
  1780.      
  1781.     #
  1782.     function zhgzFlying_Dude_OnDead(pUnit, Event)
  1783.     #
  1784.             pUnit:RemoveEvents()
  1785.     #
  1786.             pUnit:StopChannel()
  1787.     #
  1788.             package:RemoveAura(52241) -- choke
  1789.     #
  1790.             package:RemoveAura(53658) -- buble
  1791.     #
  1792.             package:SetPlayerLock(0)
  1793.     #
  1794.             package = nil
  1795.     #
  1796.             --pUnit:RemoveFromWorld() -- Causes crash :(
  1797.     #
  1798.     end
  1799.     #
  1800.      
  1801.     #
  1802.     RegisterUnitEvent(25452152, 1, "zhgzFlying_Dude_OnCombat")
  1803.     #
  1804.     RegisterUnitEvent(25452152, 4, "zhgzFlying_Dude_OnDead")
  1805.     #
  1806.      
  1807.     #
  1808.     ---- Vile Spirits ------------------------------------------------------
  1809.     #
  1810.      
  1811.     #
  1812.     function VileSpiirt_OnCombat(pUnit, Event)
  1813.     #
  1814.             if Lich == nil then
  1815.     #
  1816.             pUnit:RemoveFromWorld()
  1817.     #
  1818.             else
  1819.     #
  1820.             pUnit:RegisterEvent("deoaopighophgeoaugozh_delay", 500, 1)
  1821.     #
  1822.             end
  1823.     #
  1824.     end
  1825.     #
  1826.      
  1827.     #
  1828.     function deoaopighophgeoaugozh_delay(pUnit, Event)
  1829.     #
  1830.             pUnit:Root()
  1831.     #
  1832.             pUnit:SetCombatCapable(1)
  1833.     #
  1834.             pUnit:RegisterEvent("Tick_Tick_Tick_dot_dot_dot_BOOM", 29000, 1)
  1835.     #
  1836.     end
  1837.     #
  1838.      
  1839.     #
  1840.     function Tick_Tick_Tick_dot_dot_dot_BOOM(pUnit, Event)
  1841.     #
  1842.             pUnit:RemoveEvents()
  1843.     #
  1844.             pUnit:CastSpell(37106)
  1845.     #
  1846.             pUnit:RegisterEvent("Kill_Self_Suicide_Or_Whathaveyou_vile", 1000, 1)
  1847.     #
  1848.     end
  1849.     #
  1850.      
  1851.     #
  1852.     function Kill_Self_Suicide_Or_Whathaveyou_vile(pUnit, Event)
  1853.     #
  1854.             pUnit:Despawn(1,0)
  1855.     #
  1856.     end
  1857.     #
  1858.      
  1859.     #
  1860.     function VileSpiirt_OnLeave(pUnit, Event)
  1861.     #
  1862.             pUnit:RemoveEvents()
  1863.     #
  1864.     end
  1865.     #
  1866.      
  1867.     #
  1868.     function VileSpiirt_OnDead(pUnit, Event)
  1869.     #
  1870.             pUnit:RemoveEvents()
  1871.     #
  1872.     end
  1873.     #
  1874.      
  1875.     #
  1876.     RegisterUnitEvent(5078151, 1, "VileSpiirt_OnCombat")
  1877.     #
  1878.     RegisterUnitEvent(5078151, 2, "VileSpiirt_OnLeave")
  1879.     #
  1880.     RegisterUnitEvent(5078151, 4, "VileSpiirt_OnDead")
  1881.     #
  1882.      
  1883.     #
  1884.     ------------------------------------------------------------------------
  1885.     #
  1886.      
  1887.     #
  1888.     function Garfield_On_Spawn_Trigger_Define(pUnit, Event)
  1889.     #
  1890.             Garfield = pUnit
  1891.     #
  1892.     end
  1893.     #
  1894.      
  1895.     #
  1896.     RegisterUnitEvent(2626269, 18, "Garfield_On_Spawn_Trigger_Define")
  1897.     #
  1898.      
  1899.     #
  1900.     ------------------------------------------------------------------------
  1901.     #
  1902.      
  1903.     #
  1904.     if CheatMode == true then
  1905.     #
  1906.             function zczz_OnChat(event, plr, message, type, language)
  1907.     #
  1908.                     local message = string.lower(message)
  1909.     #
  1910.                     if (message == "#startlk") then
  1911.     #
  1912.                             if plr:IsGm() == true then
  1913.     #
  1914.                                     if Lich ~= nil and Tirion ~= nil then
  1915.     #
  1916.                                     Tirion:PlaySoundToSet(17458)
  1917.     #
  1918.                                     Tirion:RemoveEvents() -- Stop repeating
  1919.     #
  1920.                                     Lich:RemoveEvents()
  1921.     #
  1922.                                     Lich:MoveTo(461.47, -2123.73, 1572.1, 0)
  1923.     #
  1924.                                     Tirion:Emote(375, 60000)
  1925.     #
  1926.                                     Tirion:PlaySoundToSet(17349) -- pUnit since players are closer to him
  1927.     #
  1928.                                     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?")
  1929.     #
  1930.                                     Tirion:RegisterEvent("TirionFordring_OnSpawn_Goz", 13500, 1)
  1931.     #
  1932.                                     end
  1933.     #
  1934.                             end
  1935.     #
  1936.                     end
  1937.     #
  1938.                     if (message == "#endlk") then
  1939.     #
  1940.                             if Lich ~= nil and Tirion ~= nil then
  1941.     #
  1942.                                     if plr:IsGm() == true then
  1943.     #
  1944.                                     Count = 0
  1945.     #
  1946.                                     Phase = 0
  1947.     #
  1948.                                     Lich:RemoveEvents()
  1949.     #
  1950.                                     Tirion:RemoveEvents()
  1951.     #
  1952.                                     Lich:SendChatMessage(14,0,"You gnats actually hurt me! Perhaps I've toyed with you long enough, now taste the vengeance of the grave!")
  1953.     #
  1954.                                     Lich:PlaySoundToSet(17359)
  1955.     #
  1956.                                     Lich:MoveTo(512.7, -2120.5, 1572.1, 0)
  1957.     #
  1958.                                     Lich:SetMovementFlags(1)
  1959.     #
  1960.                                     Lich:SetCombatCapable(1)
  1961.     #
  1962.                                     Lich:RegisterEvent("hhTest_Debug_MoveToCentreOfRoom", 100, 0)
  1963.     #
  1964.                                     Lich:RegisterEvent("hggzhTest_Debug_MoveToCentreOfRoom_z", 5005, 1)
  1965.     #
  1966.                                     end
  1967.     #
  1968.                             end
  1969.     #
  1970.                     end
  1971.     #
  1972.             end
  1973.     #
  1974.             RegisterServerHook(16, "zczz_OnChat")
  1975.     #
  1976.     end
  1977.     #