Advertisement
Guest User

Stoneharry

a guest
Apr 29th, 2010
588
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 35.18 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. Please note that this is the 25man version and will conflict if the 10man version is used as well.
  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(3072112, 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 enrage spell used for all wrath bosses
  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.         Lich:SetCombatCapable(0)
  187.         Lich:RegisterEvent("Rage_Counter_Lich_King", 5000, 0)
  188.         Lich:RegisterEvent("Adds_Spawning_Incoming_Dredge_Ghouls", 19000, 0) -- Every 20 seconds (19 + 1 for next)
  189.         Lich:RegisterEvent("Adds_Spawning_Incoming_Shambling_Horror", math.random(60000,70000), 0) -- Every 60-70 seconds (changes each match)
  190.         Lich:RegisterEvent("Necrotic_Plague_Incoming", 20000, 0)
  191.         Lich:RegisterEvent("Infest_Big_AOE_Incoming", 30000, 0)
  192.         Lich:RegisterEvent("Phase_Two_Checker", 2500, 0)
  193.         end
  194.     end
  195. end
  196.  
  197. function Adds_Spawning_Incoming_Dredge_Ghouls(pUnit, Event)
  198.     Lich:RegisterEvent("Adds_Spawning_Incoming_Dredge_Ghoulsz", 1000, 3) -- 3 times
  199. end
  200.  
  201. function Adds_Spawning_Incoming_Dredge_Ghoulsz(pUnit, Event)
  202.     local x = Lich:GetX()
  203.     local y = Lich:GetY()
  204.     local z = Lich:GetZ()
  205.     local o = Lich:GetO()
  206.     if math.random(1,2) == 1 then -- Spawn in different locations basically
  207.     Lich:SpawnCreature(3769511, x+math.random(1,6), y+math.random(1,6), z, o, 15, 360000)
  208.     else
  209.     Lich:SpawnCreature(3769511, x-math.random(1,6), y-math.random(1,6), z, o, 15, 360000)
  210.     end
  211. end
  212.  
  213. function Adds_Spawning_Incoming_Shambling_Horror(pUnit, Event)
  214.     local x = Lich:GetX()
  215.     local y = Lich:GetY()
  216.     local z = Lich:GetZ()
  217.     local o = Lich:GetO()
  218.     if math.random(1,2) == 1 then -- Spawn in different locations basically
  219.     Lich:SpawnCreature(3769811, x+math.random(1,6), y+math.random(1,6), z, o, 15, 360000)
  220.     else
  221.     Lich:SpawnCreature(3769811, x-math.random(1,6), y-math.random(1,6), z, o, 15, 360000)
  222.     end
  223. end
  224.  
  225. function Necrotic_Plague_Incoming(pUnit, Event)
  226.     local plr = Lich:GetRandomPlayer(0) -- I think this is correct
  227.     if plr ~= nil then
  228.     Lich:FullCastSpellOnTarget(73912, plr) -- ^ ^ ^ ^ ^ ^ ^ ^ ^
  229.     end
  230. end
  231.  
  232. function Infest_Big_AOE_Incoming(pUnit, Event)
  233.     Lich:FullCastSpell(73779)
  234. end
  235.  
  236. RegisterUnitEvent(3072111, 1, "LichKingHasEnteredCombatLawl_Phase_One")
  237.  
  238. function Phase_Two_Checker(pUnit, Event)
  239.     if Lich:GetHealthPct() < 71 then
  240.     Lich:RemoveEvents()
  241.     Lich:MoveTo(512.7, -2120.5, 1572.1, 0)
  242.     Lich:SetMovementFlags(1)
  243.     Lich:SetCombatCapable(1)
  244.     Lich:RegisterEvent("Test_Debug_MoveToCentreOfRoom", 100, 0)
  245.     Lich:RegisterEvent("Test_Debug_MoveToCentreOfRoom_z", 4005, 1)
  246.     end
  247. end
  248.  
  249. function Test_Debug_MoveToCentreOfRoom(pUnit, Event)
  250.     Lich:MoveTo(512.7, -2120.5, 1572.1, 0)
  251.     Lich:SetMovementFlags(1)
  252. end
  253.  
  254. function Test_Debug_MoveToCentreOfRoom_z(pUnit, Event)
  255.     Lich:RemoveEvents()
  256.     Lich:Root()
  257.     Lich:FullCastSpell(74270)
  258.     Lich:SendChatMessage(14,0,"I will freeze you from within until all that remains is an icy husk!")
  259.     Lich:PlaySoundToSet(17369)
  260.     Lich:RegisterEvent("weaiyhoahg_delay", 6000, 1)
  261. end
  262.  
  263. function weaiyhoahg_delay(pUnit, Event)
  264.     local x = Lich:GetX()
  265.     local y = Lich:GetY()
  266.     Lich:SpawnCreature(3769812, x+math.random(3,6), y+math.random(3,6), Lich:GetZ(), Lich:GetZ(), 21, 10000)
  267.     Lich:RegisterEvent("Spam_Of_Lightning_That_Looks_Crap_But_Is_Blizzlike", 1500, 0)
  268.     Lich:RegisterEvent("NeedToWaitBecauseAddsBreakAndShizzleOrSomething", 3005, 1)
  269.     Lich:RegisterEvent("RandomRagingSpiritAddsThatAreNotRandom", 19990, 3) -- So we can get 3 in a minute without removing events
  270.     Lich:RegisterEvent("Test_Despawn_Outer_Shell", 59000, 0)
  271. end
  272.  
  273. function NeedToWaitBecauseAddsBreakAndShizzleOrSomething(pUnit,Event)
  274.     local x = Lich:GetX()
  275.     local y = Lich:GetY()
  276.     Lich:SpawnCreature(3769812, x-math.random(3,6), y-math.random(3,6), Lich:GetZ(), Lich:GetZ(), 21, 10000)
  277. end
  278.  
  279. function RandomRagingSpiritAddsThatAreNotRandom(pUnit, Event)
  280.     local plr = Lich:GetRandomPlayer(0)
  281.     if plr ~= nil then
  282.     local x,y,z,o = plr:GetX(),plr:GetY(),plr:GetZ(),plr:GetO()
  283.     Lich:SpawnCreature(3769813, x,y,z,o , 21, 360000)
  284.     end
  285. end
  286.  
  287. function Spam_Of_Lightning_That_Looks_Crap_But_Is_Blizzlike(pUnit, Event)
  288.     local plr = Lich:GetRandomPlayer(0)
  289.     if plr ~= nil then
  290.     Lich:FullCastSpellOnTarget(73788, plr)
  291.     end
  292. end
  293.    
  294. function Test_Despawn_Outer_Shell(pUnit, Event)
  295.     Lich:RemoveEvents()
  296.     Lich:SendChatMessage(14,0,"Watch as the world around you collapses!")
  297.     Lich:PlaySoundToSet(17370)
  298.     --Lich:CastSpell(59084) -- temporary solution to no destructable object support on ArcEmu
  299.     Lich:SpawnCreature(2626262, 476.2, -2083.56, 1573.1, 0, 814, 20000)
  300.     Lich:SpawnCreature(2626262, 505.1, -2074.47, 1573.1, 0, 814, 20000)
  301.     Lich:SpawnCreature(2626262, 523.35, -2077.77, 1573.1, 0, 814, 20000)
  302.     Lich:SpawnCreature(2626262, 541, -2086.36, 1573.1, 0, 814, 20000)
  303.     Lich:SpawnCreature(2626262, 552.7, -2111.2, 1573.1, 0, 814, 20000)
  304.     Lich:SpawnCreature(2626262, 554, -2137, 1573.1, 0, 814, 20000)
  305.     Lich:SpawnCreature(2626262, 545.9, -2153.1, 1573.1, 0, 814, 20000)
  306.     Lich:SpawnCreature(2626262, 528, -2164, 1573.1, 0, 814, 20000)
  307.     Lich:SpawnCreature(2626262, 508.25, -2169.5, 1573.1, 0, 814, 20000)
  308.     Lich:SpawnCreature(2626262, 488.2, -2168, 1573.1, 0, 814, 20000)
  309.     Lich:RegisterEvent("DelayForDespawnSinceVisualTakesSomeTimeTehe_Zieghoszho", 1000, 1)
  310.     Lich:RegisterEvent("DelayForDespawnSinceVisualTakesSomeTimeTehe", 2500, 1)
  311. end
  312.  
  313. function DelayForDespawnSinceVisualTakesSomeTimeTehe_Zieghoszho(pUnit, Event)
  314.     Lich:FullCastSpell(72262) -- Epic shit I got working :D
  315. end
  316.  
  317. function DelayForDespawnSinceVisualTakesSomeTimeTehe(pUnit, Event)
  318.     Object = Lich:GetGameObjectNearestCoords(pUnit:GetX(),pUnit:GetY(),pUnit:GetZ(), 2957197)
  319.     if Object ~= nil then
  320.     Object:SetScale(0.01)
  321.     --Object:Despawn(1,0)
  322.     --Lich:CastSpell(46853) -- Shakes camera
  323.     end
  324.     Lich:SetCombatCapable(0)
  325.     Lich:Unroot()
  326.     -- Phase 2
  327.     Lich:RegisterEvent("Infest_Big_AOE_Incoming", 22000, 0)
  328.     Lich:RegisterEvent("Summon_Valkyr_Shadowguard", 19500, 0)
  329.     Lich:RegisterEvent("Soul_Reaper_On_Main_Tank", 30000, 0)
  330.     Lich:RegisterEvent("Phase_TwoPointFive_Checker", 2500, 0)
  331.     -- I cba to script defile :3
  332. end
  333.  
  334. function Soul_Reaper_On_Main_Tank(pUnit, Event)
  335.     local tank = Lich:GetMainTank()
  336.     if tank ~= nil then
  337.     Lich:FullCastSpellOnTarget(73798, tank)
  338.     end
  339. end
  340.  
  341. function Summon_Valkyr_Shadowguard(pUnit, Event)
  342.     local x, y, z, o = Lich:GetX()+3, Lich:GetY(), Lich:GetZ(), Lich:GetO()
  343.     Lich:SpawnCreature(25452151, x, y, z, o, 22, 0)
  344.     Lich:SendChatMessage(14,0,"Val'kyr, your master calls!")
  345.     Lich:PlaySoundToSet(17373)
  346. end
  347.  
  348. function Phase_TwoPointFive_Checker(pUnit, Event)
  349.     if Lich:GetHealthPct() < 41 then
  350.     Lich:RemoveEvents()
  351.     Lich:MoveTo(512.7, -2120.5, 1572.1, 0)
  352.     Lich:SetMovementFlags(1)
  353.     Lich:SetCombatCapable(1)
  354.     Lich:RegisterEvent("hhTest_Debug_MoveToCentreOfRoom", 100, 0)
  355.     Lich:RegisterEvent("hhTest_Debug_MoveToCentreOfRoom_z", 4005, 1)
  356.     end
  357. end
  358.  
  359. function hhTest_Debug_MoveToCentreOfRoom(pUnit, Event)
  360.     Lich:MoveTo(512.7, -2120.5, 1572.1, 0)
  361.     Lich:SetMovementFlags(1)
  362. end
  363.  
  364. function hhTest_Debug_MoveToCentreOfRoom_z(pUnit, Event)
  365.     Lich:RemoveEvents()
  366.     Lich:Root()
  367.     Lich:FullCastSpell(74270)
  368.     Lich:SendChatMessage(14,0,"I will freeze you from within until all that remains is an icy husk!")
  369.     Lich:PlaySoundToSet(17369)
  370.     Lich:RegisterEvent("jjweaiyhoahg_delay", 6000, 1)
  371. end
  372.  
  373. function jjweaiyhoahg_delay(pUnit, Event)
  374.     local x = Lich:GetX()
  375.     local y = Lich:GetY()
  376.     Lich:SpawnCreature(3769812, x+math.random(3,6), y+math.random(3,6), Lich:GetZ(), Lich:GetZ(), 21, 10000)
  377.     Lich:RegisterEvent("Spam_Of_Lightning_That_Looks_Crap_But_Is_Blizzlike", 1500, 0)
  378.     Lich:RegisterEvent("NeedToWaitBecauseAddsBreakAndShizzleOrSomething", 3005, 1)
  379.     Lich:RegisterEvent("RandomRagingSpiritAddsThatAreNotRandom", 14000, 3)
  380.     Lich:RegisterEvent("zzzTest_Despawn_Outer_Shell", 59000, 0)
  381. end
  382.  
  383. function zzzTest_Despawn_Outer_Shell(pUnit, Event)
  384.     Lich:RemoveEvents()
  385.     Lich:SendChatMessage(14,0,"Watch as the world around you collapses!")
  386.     Lich:PlaySoundToSet(17370)
  387.     if Object ~= nil then
  388.     Object:SetScale(1)
  389.     end
  390.     --Lich:CastSpell(59084) -- temporary solution to no destructable object support on ArcEmu
  391.     Lich:SpawnCreature(2626262, 476.2, -2083.56, 1573.1, 0, 814, 20000)
  392.     Lich:SpawnCreature(2626262, 505.1, -2074.47, 1573.1, 0, 814, 20000)
  393.     Lich:SpawnCreature(2626262, 523.35, -2077.77, 1573.1, 0, 814, 20000)
  394.     Lich:SpawnCreature(2626262, 541, -2086.36, 1573.1, 0, 814, 20000)
  395.     Lich:SpawnCreature(2626262, 552.7, -2111.2, 1573.1, 0, 814, 20000)
  396.     Lich:SpawnCreature(2626262, 554, -2137, 1573.1, 0, 814, 20000)
  397.     Lich:SpawnCreature(2626262, 545.9, -2153.1, 1573.1, 0, 814, 20000)
  398.     Lich:SpawnCreature(2626262, 528, -2164, 1573.1, 0, 814, 20000)
  399.     Lich:SpawnCreature(2626262, 508.25, -2169.5, 1573.1, 0, 814, 20000)
  400.     Lich:SpawnCreature(2626262, 488.2, -2168, 1573.1, 0, 814, 20000)
  401.     Lich:RegisterEvent("DelayForDespawnSinceVisualTakesSomeTimeTehe_Zieghoszho", 1000, 1)
  402.     Lich:RegisterEvent("zzzDelayForDespawnSinceVisualTakesSomeTimeTehe", 2500, 1)
  403. end
  404.  
  405. function zzzDelayForDespawnSinceVisualTakesSomeTimeTehe(pUnit, Event)
  406.     if Object ~= nil then
  407.     Object:Despawn(1,0)
  408.     end
  409.     Lich:SetCombatCapable(0)
  410.     Lich:Unroot()
  411.     -- Phase 3
  412.     Lich:RemoveEvents()
  413.     Lich:RegisterEvent("Soul_Reaper_On_Main_Tank", 30000, 0)
  414.     Lich:RegisterEvent("Harvest_Soul_Random_Raid_Member", 66000, 0)
  415.     Lich:RegisterEvent("Vile_Spirits_Spawning_Inc", 28000, 0)
  416.     Lich:RegisterEvent("Phase_Four_The_Ending_tehe", 1500, 0)
  417. end
  418.  
  419. function Harvest_Soul_Random_Raid_Member(pUnit, Event)
  420.     local plr = Lich:GetRandomPlayer(0)
  421.     if plr ~= nil then
  422.     Lich:SendChatMessage(14,0,"Frostmourne hungers...")
  423.     Lich:PlaySoundToSet(17366)
  424.     Lich:FullCastSpellOnTarget(74325, plr)
  425.     end
  426. end
  427.  
  428. function Vile_Spirits_Spawning_Inc(pUnit, Event)
  429.     Lich:RegisterEvent("Spawning_The_Vile_spirits_NoW", 1000, 10)
  430. end
  431.  
  432. function Spawning_The_Vile_spirits_NoW(pUnit, Event)
  433.     local pla = Lich:GetRandomPlayer(0)
  434.     if pla ~= nil then
  435.     local x, y, z, o = pla:GetX(), pla:GetY(), pla:GetZ(), pla:GetO()
  436.     Lich:SpawnCreature(5078151, x, y, z, o, 22, 60000)
  437.     end
  438. end
  439.  
  440. function Phase_Four_The_Ending_tehe(pUnit, Event)
  441.     if Lich:GetHealthPct() < 11 then
  442.     Count = 0
  443.     Phase = 0
  444.     Lich:RemoveEvents()
  445.     Lich:SendChatMessage(14,0,"You gnats actually hurt me! Perhaps I've toyed with you long enough, now taste the vengeance of the grave!")
  446.     Lich:PlaySoundToSet(17359)
  447.     Lich:MoveTo(512.7, -2120.5, 1572.1, 0)
  448.     Lich:SetMovementFlags(1)
  449.     Lich:SetCombatCapable(1)
  450.     Lich:RegisterEvent("hhTest_Debug_MoveToCentreOfRoom", 100, 0)
  451.     Lich:RegisterEvent("hggzhTest_Debug_MoveToCentreOfRoom_z", 5005, 1)
  452.     end
  453. end
  454.  
  455. function hggzhTest_Debug_MoveToCentreOfRoom_z(pUnit, Event)
  456.     Lich:RemoveEvents()
  457.     Lich:FullCastSpell(72350)
  458.     Players_Wiped = 1
  459.     -- Most of the visuals needed are not in game due to ArcEmu's screwed up extractors
  460.     Lich:RegisterEvent("Debug_Send_Next_Message_LichKing", 10000, 1)
  461. end
  462.  
  463. function Debug_Send_Next_Message_LichKing(pUnit, Event)
  464.     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...")
  465.     Lich:PlaySoundToSet(17353)
  466.     Lich:RegisterEvent("zzDebug_Send_Next_Message_LichKing", 25000, 1)
  467. end
  468.  
  469. function zzDebug_Send_Next_Message_LichKing(pUnit, Event)
  470.     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.")
  471.     Lich:PlaySoundToSet(17355)
  472.     local plr = Lich:GetRandomPlayer(0)
  473.     if plr ~= nil then
  474.     Lich:ChannelSpell(71769, plr)
  475.     end
  476.     local DeadGuys = Lich:GetInRangePlayers()
  477.     for k, plrs in pairs(DeadGuys) do
  478.     plrs:ChannelSpell(47855, Lich)
  479.     end
  480.     Lich:RegisterEvent("zzzzDebug_Send_Next_Message_LichKing", 24000, 1)
  481. end
  482.  
  483. function zzzzDebug_Send_Next_Message_LichKing(pUnit, Event)
  484.     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.")
  485.     Lich:PlaySoundToSet(17356)
  486.     Lich:RegisterEvent("zzzzDebug_Send_Next_Message_LichKingzz", 26000, 1)
  487. end
  488.  
  489. function zzzzDebug_Send_Next_Message_LichKingzz(pUnit, Event)
  490.     Lich:PlaySoundToSet(17357)
  491.     Lich:SendChatMessage(14,0,"I delight in the irony.")
  492.     Lich:RegisterEvent("zzzzDebug_Send_Next_Message_LichKingzzzz", 6000, 1)
  493.     --Lich:StopChannel()
  494. end
  495.  
  496. function zzzzDebug_Send_Next_Message_LichKingzzzz(pUnit, Event)
  497.     if Tirion == nil then
  498.     Lich:Despawn(1,0)
  499.     else
  500.     Tirion:SendChatMessage(14,0,"LIGHT, GRANT ME ONE FINAL BLESSING. GIVE ME THE STRENGTH... TO SHATTER THESE BONDS!")
  501.     Tirion:PlaySoundToSet(17392)
  502.     Lich:RegisterEvent("Breakoutofice", 9000, 1)
  503.     end
  504. end
  505.  
  506. function Breakoutofice(pUnit, Event)
  507.     Tirion:RemoveAura(71614) --(Remove IceBlock, to cast the Spell under this Line :>)
  508.     Tirion:CastSpell(71797)
  509.     Tirion:CastSpell(71614) --(Get the IceBlock Again :>, You cannot see that he was out :>) -- Stays in ice block? lol
  510.     Lich:RegisterEvent("zzzzDebug_Send_Next_Message_LichKingzzzzgg", 5000, 1)
  511. end
  512.  
  513. function zzzzDebug_Send_Next_Message_LichKingzzzzgg(pUnit, Event)
  514.     Tirion:RemoveAura(71614) -- Ice Block
  515.     Tirion:CastSpell(71773)
  516.     Lich:RegisterEvent("zzzzDebug_Send_Next_Message_LichKingzzzzgzg", 1500, 1)
  517.     -- jumps and destroys frostmourne
  518. end
  519.  
  520. function zzzzDebug_Send_Next_Message_LichKingzzzzgzg(pUnit, Event)
  521.     Tirion:SetMovementFlags(2)
  522.     Tirion:SetFlying()
  523.     Tirion:Emote(375, 60000)
  524.     Tirion:MoveTo(511, -2121, 1575, 14)
  525.     Tirion:Emote(375, 60000)
  526.     Lich:StopChannel()
  527.     Lich:RegisterEvent("zagazzzDebug_Send_Next_Message_LichKingzzzzgzg", 3000, 1)
  528. end
  529.  
  530. function zagazzzDebug_Send_Next_Message_LichKingzzzzgzg(pUnit, Event)
  531.     Tirion:SetMovementFlags(1)
  532.     Tirion:MoveTo(536.5, -2121, 1572.1, 3.15)
  533.     Lich:PlaySoundToSet(17459)
  534.     Lich:SpawnCreature(2626269, Lich:GetX(), Lich:GetY(), Lich:GetZ(), 0, 35, 0) -- Invisible trigger
  535.     Lich:RegisterEvent("zagazzzDebug_Send_Next_Message_LichKingzgeazzzzgzg", 1900, 1)
  536.     Tirion:RegisterEvent("lichisdead", 1900, 1)
  537. end
  538.  
  539. function lichisdead(pUnit, Event)
  540.     Tirion:MoveTo(514.135254, -2122.514160, 1572)
  541. end
  542.  
  543. function zagazzzDebug_Send_Next_Message_LichKingzgeazzzzgzg(pUnit, Event)
  544.     Lich:CastSpell(37592) -- Knockdown
  545.     --Lich:CastSpell(72726) -- Boom visual
  546.     local DeadGuys = Lich:GetInRangePlayers()
  547.     for k, plrs in pairs(DeadGuys) do
  548.     plrs:StopChannel()
  549.     end
  550.     if Garfield ~= nil then
  551.     Garfield:CastSpell(72405) -- THE CORRECT VISUAL ;D
  552.     end -- I cba to add a debugger, if it screws up at this point SCREW YOU BLIZZARD AND EMULATION
  553.     --Lich:FullCastSpell(72406) -- The drop frostmourne visual thing (it fucks up his animations so I cba with this :D)
  554.     Lich:CastSpell(73017) -- The soul free thing
  555.     Lich:FullCastSpell(72398) -- Frostmourne on floor
  556.     Lich:EquipWeapons(0,0,0)
  557.     Lich:SendChatMessage(14,0,"Impossible...")
  558.     Lich:PlaySoundToSet(17358)
  559.     Lich:Emote(473, 120000)
  560.     --Lich:CastSpell(72523)
  561.     Lich:RegisterEvent("zagazzzDebug_Send_Next_Message_LichKingzgeazzzzedhezgzg", 1500, 1)
  562. end
  563.  
  564. function zagazzzDebug_Send_Next_Message_LichKingzgeazzzzedhezgzg(pUnit, Event)
  565.     Tirion:SendChatMessage(14,0,"No more, Arthas! No more lives will be consumed by your hatred!")
  566.     Tirion:PlaySoundToSet(17393)
  567.     Tirion:SetMovementFlags(1)
  568.     Lich:Emote(473, 120000)
  569.     Lich:SpawnCreature(31021151, 518.8, -2115.8, 1572.1, 3.780169, 35, 0)
  570.     Tirion:MoveTo(526, -2120.5, 1572.1, 3)
  571.     Lich:RegisterEvent("zagazzzDebug_Send_Next_Message_LichKingzgeazzzzedhezgzzzzsay", 5500, 1)
  572. end
  573.  
  574. function zagazzzDebug_Send_Next_Message_LichKingzgeazzzzedhezgzzzzsay(pUnit, Event)
  575.     if Terenas == nil then -- Dunno why this would happen
  576.     Lich:Despawn(1,0)
  577.     Lich = nil
  578.     Tirion:Despawn(1,0)
  579.     Tirion = nil
  580.     else
  581.     Lich:Emote(473, 120000)
  582.     Terenas:EquipWeapons(23456, 18825, 0)
  583.     Terenas:SendChatMessage(14,0,"Free at last! It is over, my son. This is the moment of reckoning.")
  584.     Terenas:PlaySoundToSet(17397)
  585.     Terenas:ChannelSpell(51361, Terenas)
  586.     Lich:RegisterEvent("epiashgyophopapea_Lich_King_Is_Not_A_Happy_Bunny", 10000, 1)
  587.     end
  588. end
  589.  
  590. function epiashgyophopapea_Lich_King_Is_Not_A_Happy_Bunny(pUnit, Event)
  591.     Terenas:SendChatMessage(14,0,"Rise up, champions of the Light!")
  592.     Terenas:PlaySoundToSet(17398)
  593.     Terenas:StopChannel()
  594.     Terenas:CastSpell(37755)
  595.     Lich:Emote(473, 120000)
  596.     local PlayersAllAround = Terenas:GetInRangePlayers()
  597.     for a, players in pairs(PlayersAllAround) do
  598.     players:ResurrectPlayer(players)
  599.     players:CastSpell(24171)
  600.     end
  601.     --Terenas:FullCastSpell(72429) -- Failure
  602.     Lich:RegisterEvent("zLich_King_Is_Not_A_Happy_Bunny", 5000, 1)
  603. end
  604.  
  605. function zLich_King_Is_Not_A_Happy_Bunny(pUnit, Event)
  606.     Terenas:Despawn(500,0)
  607.     Lich:Emote(473, 120000)
  608.     Lich:SendChatMessage(14,0,"Now I stand, the lion before the lambs... and they do not fear.")
  609.     Lich:PlaySoundToSet(17361)
  610.     Lich:RegisterEvent("zLich_King_Is_Not_A_Happy_Bunnyz", 8000, 1)
  611. end
  612.  
  613. function zLich_King_Is_Not_A_Happy_Bunnyz(pUnit, Event)
  614.     Lich:SendChatMessage(14,0,"They cannot fear.")
  615.     Lich:PlaySoundToSet(17362)
  616.     Lich:Emote(473, 120000)
  617.     Lich:SetHealthPct(10)
  618.     -- The end, poor arthas, Q_Q, lets all go do a rain dance, ~Stoneharry
  619. end
  620.  
  621. ---- Terenas -----------------------------------------------------
  622.  
  623. function Terenas_Spawned_root_Hes_the_realm_of_My_RETAIL_Char(pUnit, Event)
  624.     if Tirion == nil or Lich == nil then
  625.     pUnit:Despawn(1,0)
  626.     else
  627.     Terenas = pUnit
  628.     end
  629. end
  630.  
  631. RegisterUnitEvent(31021151, 18, "Terenas_Spawned_root_Hes_the_realm_of_My_RETAIL_Char")
  632.  
  633. -------------------------------------------------------------------
  634.  
  635. function LichKingHasDiedSoWePlayMovie(pUnit, Event)
  636.     if Garfield ~= nil then
  637.     Garfield:Despawn(1,0)
  638.     end
  639.     local PlayersAllAround = pUnit:GetInRangePlayers()
  640.     for a, players in pairs(PlayersAllAround) do
  641.         if players:HasAchievement(4579) == false then
  642.         players:AddAchievement(4579)
  643.         end
  644.     end
  645.     Lich = nil
  646.     pUnit:RemoveEvents()
  647.     pUnit:PlaySoundToSet(17374) -- Freak makes dying sound
  648.     pUnit:SpawnCreature(3072110, pUnit:GetX(), pUnit:GetY(), pUnit:GetZ(), pUnit:GetO(), 35, 10000)
  649. end
  650.  
  651. RegisterUnitEvent(3072111, 4, "LichKingHasDiedSoWePlayMovie")
  652.  
  653. function TriggerHasSpawnedSoPlayMovie(pUnit, Event)
  654.     pUnit:RegisterEvent("PlayMovieOnceDeathAnimationHasPlayed", 9000, 1)
  655. end
  656.  
  657. function PlayMovieOnceDeathAnimationHasPlayed(pUnit, Event)
  658.     -- Reset Fight
  659.     Garfield = nil
  660.     Tirion = nil
  661.     Lich = nil
  662.     Terenas = nil
  663.     package = nil
  664.     Phase = 0
  665.     Count = 0
  666.     -- Movie
  667.     Players_Wiped = 0
  668.     local PlayersAllAround = pUnit:GetInRangePlayers()
  669.     for a, players in pairs(PlayersAllAround) do
  670.     --SMSG_TRIGGER_MOVIE = 0x464
  671.     local packet = LuaPacket:CreatePacket(0x464, 4) -- Move type 4
  672.     packet:WriteULong(16) -- Id 16
  673.     players:SendPacketToPlayer(packet) -- Send to players
  674.     end
  675.     -- Bolvar
  676.     local Bolvar = pUnit:GetGameObjectNearestCoords(428.758, -2124.4, 1594.69, 2508221) -- Bolvar in chains
  677.     if Bolvar ~= nil then
  678.     Bolvar:Despawn(1,0)
  679.     pUnit:SpawnGameObject(2508220, 428.758, -2124.4, 1594.69, 0, 360000) -- Chains
  680.     pUnit:SpawnGameObject(2508219, 430.103, -2124, 1595.93, 3.3, 360000) -- Bolvar
  681.     end
  682. end
  683.  
  684. RegisterUnitEvent(3072110, 18, "TriggerHasSpawnedSoPlayMovie")
  685.    
  686. ------- Adds ------------------------------------------------------
  687.  
  688. function Dredge_Ghouls_OnSpawn(pUnit, Event)
  689.     pUnit:RegisterEvent("TestRootFunctionNextSecond", 1, 1)
  690. end
  691.  
  692. function TestRootFunctionNextSecond(pUnit, Event)
  693.     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 ;)
  694.     pUnit:RemoveFromWorld()
  695.     else -- Well if he is here
  696.     pUnit:Emote(449, 4000) -- spawn animation
  697.     pUnit:Root() -- Root him while he spawns
  698.     pUnit:RegisterEvent("Delay_A_Second_And_See_WhatHappens_Tehe", math.random(1,1000), 1)
  699.     pUnit:RegisterEvent("SetFactionToHostileForTheEmote", 4500, 1)
  700.     end
  701. end
  702.  
  703. function Delay_A_Second_And_See_WhatHappens_Tehe(pUnit, Event)
  704.     pUnit:CastSpell(55719)
  705. end
  706.  
  707. function SetFactionToHostileForTheEmote(pUnit, Event)
  708.     pUnit:Unroot() -- let him run free
  709.     pUnit:SetFaction(21) -- hostile
  710. end
  711.  
  712. RegisterUnitEvent(3769511, 18, "Dredge_Ghouls_OnSpawn")
  713.  
  714. ---------------------------------------------------------------------
  715.  
  716. function Shambling_Horrors_OnSpawn(pUnit, Event)
  717.     pUnit:RegisterEvent("zzTestRootFunctionNextSecond", 1, 1)
  718. end
  719.  
  720. function zzTestRootFunctionNextSecond(pUnit, Event)
  721.     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 ;)
  722.     pUnit:RemoveFromWorld()
  723.     else -- Well if he is here
  724.     pUnit:Emote(449, 4000) -- spawn animation
  725.     pUnit:Root() -- Root him while he spawns
  726.     pUnit:CastSpell(55719)
  727.     pUnit:RegisterEvent("zzSetFactionToHostileForTheEmote", 4500, 1)
  728.     end
  729. end
  730.  
  731. function zzSetFactionToHostileForTheEmote(pUnit, Event)
  732.     pUnit:Unroot() -- let him run free
  733.     pUnit:SetFaction(21) -- hostile
  734. end
  735.  
  736. RegisterUnitEvent(3769811, 18, "Shambling_Horrors_OnSpawn")
  737.  
  738. function Shambling_Horrors_OnCombat(pUnit, Event)
  739.     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 ;)
  740.     pUnit:RemoveFromWorld()
  741.     else -- Well if he is here
  742.     pUnit:RegisterEvent("Enrage_Spam_Incoming_Varied_Time", math.random(20000,25000), 0) -- Varied time depending on add
  743.     pUnit:RegisterEvent("Shockwave_thingy_time_notsure_on_timer", 15000, 0)
  744.     end
  745. end
  746.  
  747. function Enrage_Spam_Incoming_Varied_Time(pUnit, Event)
  748.     pUnit:FullCastSpell(72143)
  749. end
  750.  
  751. function Shockwave_thingy_time_notsure_on_timer(pUnit, Event)
  752.     pUnit:FullCastSpell(72149)
  753. end
  754.  
  755. function Shambling_Horrors_OnLeave(pUnit, Event)
  756.     pUnit:RemoveEvents()
  757. end
  758.  
  759. function Shambling_Horrors_OnDead(pUnit, Event)
  760.     pUnit:RemoveEvents()
  761. end
  762.  
  763. RegisterUnitEvent(3769811, 1, "Shambling_Horrors_OnCombat")
  764. RegisterUnitEvent(3769811, 2, "Shambling_Horrors_OnLeave")
  765. RegisterUnitEvent(3769811, 4, "Shambling_Horrors_OnDead")
  766.  
  767. ----- Ice Sphere --------------------------------------------------
  768.  
  769. -- 69090 on spawn -- only 2 on phase 1.5, head towards player and explode if hit
  770.  
  771. function IceShard_OnSpawn(pUnit, Event)
  772.     pUnit:RegisterEvent("rage_rage_rage_rage_Rage_rage", 1, 1)
  773. end
  774.  
  775. function rage_rage_rage_rage_Rage_rage(pUnit, Event)
  776.     if Lich == nil then
  777.     pUnit:RemoveFromWorld() -- may cause crash if he tries to despawn but variable broke
  778.     else
  779.         pUnit:FullCastSpell(69090) -- Visual
  780.         local pla = pUnit:GetRandomPlayer(0)
  781.         if pla ~= nil then
  782.         pUnit:MoveTo(pla:GetX(), pla:GetY(), pla:GetZ(), pla:GetO())
  783.         pUnit:SetMovementFlags(1)
  784.         pUnit:RegisterEvent("rage_rage_rage_rage_Rage_rage_r", 1000, 8)
  785.         else
  786.         pUnit:RemoveFromWorld()
  787.         end
  788.     end
  789. end
  790.  
  791. function rage_rage_rage_rage_Rage_rage_r(pUnit, Event)
  792.     local plm = pUnit:GetClosestPlayer()
  793.     if plm ~= nil then
  794.         pUnit:FullCastSpell(69090) -- Visual
  795.         if pUnit:GetDistanceYards(plm) < 4 then
  796.         --pUnit:FullCastSpellOnTarget(70827, plm) -- May be buggy if player dies, maybe not knockbacked and players try to exploit by ressing?
  797.         pUnit:FullCastSpellOnTarget(11027, plm) -- Knockback
  798.         pUnit:CastSpell(56135)
  799.         pUnit:RemoveEvents()
  800.         end
  801.     end
  802. end
  803.  
  804. RegisterUnitEvent(3769812, 18, "IceShard_OnSpawn")
  805.  
  806. ---- Raging Spirit ------------------------------------------------
  807.  
  808. function RagingSpirit_OnCombat(pUnit, Event)
  809.     if Lich == nil then
  810.     pUnit:RemoveFromWorld()
  811.     else
  812.     pUnit:RegisterEvent("Soul_Shriek_Random_Time_Depending_On_Mob", math.random(7500, 15000), 0)
  813.     pUnit:RegisterEvent("Soul_Shriek_Random_Visual", 1000, 1)
  814.     end
  815. end
  816.  
  817. function Soul_Shriek_Random_Visual(pUnit, Event)
  818.     pUnit:FullCastSpell(69198) -- Visual
  819. end
  820.  
  821. function Soul_Shriek_Random_Time_Depending_On_Mob(pUnit, Event)
  822.     pUnit:FullCastSpell(69242) -- Shriek
  823. end
  824.  
  825. function RagingSpirit_OnLeave(pUnit, Event)
  826.     pUnit:RemoveEvents()
  827. end
  828.  
  829. function RagingSpirit_OnDead(pUnit, Event)
  830.     pUnit:RemoveEvents()
  831. end
  832.  
  833. RegisterUnitEvent(3769813, 1, "RagingSpirit_OnCombat")
  834. RegisterUnitEvent(3769813, 2, "RagingSpirit_OnLeave")
  835. RegisterUnitEvent(3769813, 4, "RagingSpirit_OnDead")
  836.  
  837. ---- Flying Dudes ------------------------------------------------------
  838.  
  839. function zhgzFlying_Dude_OnCombat(pUnit, Event)
  840.         if Lich == nil then
  841.         pUnit:RemoveFromWorld()
  842.         else
  843.         pUnit:RegisterEvent("zhgzFlying_Dude_Find_Player", 1, 1)
  844.         end
  845. end
  846.  
  847. function zhgzFlying_Dude_Find_Player(pUnit, Event)
  848.         package = pUnit:GetClosestPlayer()
  849.         if package ~= nil then
  850.         pUnit:SetCombatCapable(1) -- Stop npc running around
  851.         package:SetPlayerLock(1) -- Stop player doing stuff :3
  852.         pUnit:SetMovementFlags(2) -- Flying Mode On
  853.         pUnit:ChannelSpell(55520, package) -- visual
  854.         pUnit:MoveTo(pUnit:GetX(), pUnit:GetY(), pUnit:GetZ()+6, pUnit:GetO(), 12288)
  855.         package:MovePlayerTo(package:GetX(), package:GetY(), package:GetZ()+6, package:GetO(), 12288)
  856.         pUnit:RegisterEvent("now_we_have_loaded_preset_We_can_move_on", 2000, 1)
  857.         else
  858.         pUnit:RemoveFromWorld()
  859.         end
  860. end
  861.  
  862. function now_we_have_loaded_preset_We_can_move_on(pUnit, Event)
  863.         if package ~= nil then
  864.         package:CastSpell(52241) -- Choke visual
  865.         package:CastSpell(53658) -- Bubble to stop stupid animations
  866.         pUnit:ChannelSpell(29172, package) -- visual
  867.         pUnit:RegisterEvent("now_we_have_loaded_preset_We_can_move_on_two", 1500, 0)
  868.         else
  869.         pUnit:RemoveEvents()
  870.         pUnit:RemoveFromWorld()
  871.         end
  872. end
  873.  
  874. function now_we_have_loaded_preset_We_can_move_on_two(pUnit, Event)
  875.         if package ~= nil then
  876.                 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 :)
  877.                 pUnit:RemoveEvents()
  878.                 pUnit:StopChannel()
  879.                 package:RemoveAura(52241) -- choke
  880.                 package:RemoveAura(53658) -- buble
  881.                 package:SetPlayerLock(0)
  882.                 package = nil
  883.                 --pUnit:RemoveFromWorld() -- Causes crash :(
  884.                 else    
  885.                 pUnit:SetMovementFlags(2)
  886.                 package:ModifyFlySpeed(2.5)
  887.                 pUnit:MoveTo(572, -2121.5, 1577.2, 0, 12288, 2.5)
  888.                 package:MovePlayerTo(pUnit:GetX(), pUnit:GetY(), pUnit:GetZ() ,pUnit:GetO(), 12288)
  889.                 end
  890.         else
  891.         pUnit:RemoveEvents()
  892.         pUnit:RemoveFromWorld()
  893.         end
  894. end
  895.  
  896. function zhgzFlying_Dude_OnDead(pUnit, Event)
  897.         pUnit:RemoveEvents()
  898.         pUnit:StopChannel()
  899.         package:RemoveAura(52241) -- choke
  900.         package:RemoveAura(53658) -- buble
  901.         package:SetPlayerLock(0)
  902.         package = nil
  903.         --pUnit:RemoveFromWorld() -- Causes crash :(
  904. end
  905.  
  906. RegisterUnitEvent(25452152, 1, "zhgzFlying_Dude_OnCombat")
  907. RegisterUnitEvent(25452152, 4, "zhgzFlying_Dude_OnDead")
  908.  
  909. ---- Vile Spirits ------------------------------------------------------
  910.  
  911. function VileSpiirt_OnCombat(pUnit, Event)
  912.     if Lich == nil then
  913.     pUnit:RemoveFromWorld()
  914.     else
  915.     pUnit:RegisterEvent("deoaopighophgeoaugozh_delay", 500, 1)
  916.     end
  917. end
  918.  
  919. function deoaopighophgeoaugozh_delay(pUnit, Event)
  920.     pUnit:Root()
  921.     pUnit:SetCombatCapable(1)
  922.     pUnit:RegisterEvent("Tick_Tick_Tick_dot_dot_dot_BOOM", 29000, 1)
  923. end
  924.  
  925. function Tick_Tick_Tick_dot_dot_dot_BOOM(pUnit, Event)
  926.     pUnit:RemoveEvents()
  927.     pUnit:CastSpell(37106)
  928.     pUnit:RegisterEvent("Kill_Self_Suicide_Or_Whathaveyou_vile", 1000, 1)
  929. end
  930.  
  931. function Kill_Self_Suicide_Or_Whathaveyou_vile(pUnit, Event)
  932.     pUnit:Despawn(1,0)
  933. end
  934.  
  935. function VileSpiirt_OnLeave(pUnit, Event)
  936.     pUnit:RemoveEvents()
  937. end
  938.  
  939. function VileSpiirt_OnDead(pUnit, Event)
  940.     pUnit:RemoveEvents()
  941. end
  942.  
  943. RegisterUnitEvent(5078151, 1, "VileSpiirt_OnCombat")
  944. RegisterUnitEvent(5078151, 2, "VileSpiirt_OnLeave")
  945. RegisterUnitEvent(5078151, 4, "VileSpiirt_OnDead")
  946.  
  947. ------------------------------------------------------------------------
  948.  
  949. function Garfield_On_Spawn_Trigger_Define(pUnit, Event)
  950.     Garfield = pUnit
  951. end
  952.  
  953. RegisterUnitEvent(2626269, 18, "Garfield_On_Spawn_Trigger_Define")
  954.  
  955. ------------------------------------------------------------------------
  956.  
  957. if CheatMode == true then
  958.     function zczz_OnChat(event, plr, message, type, language)
  959.         local message = string.lower(message)
  960.         if (message == "#startlk") then
  961.             if plr:IsGm() == true then
  962.                 if Lich ~= nil and Tirion ~= nil then
  963.                 Tirion:PlaySoundToSet(17458)
  964.                 Tirion:RemoveEvents() -- Stop repeating
  965.                 Lich:RemoveEvents()
  966.                 Lich:MoveTo(461.47, -2123.73, 1572.1, 0)
  967.                 Tirion:Emote(375, 60000)
  968.                 Tirion:PlaySoundToSet(17349) -- pUnit since players are closer to him
  969.                 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?")
  970.                 Tirion:RegisterEvent("TirionFordring_OnSpawn_Goz", 13500, 1)
  971.                 end
  972.             end
  973.         end
  974.         if (message == "#endlk") then
  975.             if Lich ~= nil and Tirion ~= nil then
  976.                 if plr:IsGm() == true then
  977.                 Count = 0
  978.                 Phase = 0
  979.                 Lich:RemoveEvents()
  980.                 Tirion:RemoveEvents()
  981.                 Lich:SendChatMessage(14,0,"You gnats actually hurt me! Perhaps I've toyed with you long enough, now taste the vengeance of the grave!")
  982.                 Lich:PlaySoundToSet(17359)
  983.                 Lich:MoveTo(512.7, -2120.5, 1572.1, 0)
  984.                 Lich:SetMovementFlags(1)
  985.                 Lich:SetCombatCapable(1)
  986.                 Lich:RegisterEvent("hhTest_Debug_MoveToCentreOfRoom", 100, 0)
  987.                 Lich:RegisterEvent("hggzhTest_Debug_MoveToCentreOfRoom_z", 5005, 1)
  988.                 end
  989.             end
  990.         end
  991.     end
  992.     RegisterServerHook(16, "zczz_OnChat")
  993. end
  994.  
  995. ------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement