stoneharry

Untitled

Mar 29th, 2011
324
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 17.10 KB | None | 0 0
  1. -------------------
  2. -- By Stoneharry --
  3. -------------------
  4. -- Variable Decleration
  5. -- Configuration
  6.  
  7. local HANDLER_CREATURE = 780000
  8. local AddA = 780002 -- 4 of them     Gate A
  9. local AddB = 780003 -- 10 of them    Gate A
  10. local AddC = 780004 -- 2 of them     Gate A and B
  11. local AddD = 780005 -- 20 of them    Gate A and B
  12. local AddE = 780006 -- 6 of them     Gate A
  13. local AddF = 780007 -- 15 of them    Gate B
  14. local AddG = 780008 -- 4 of them     Gate A and B
  15. local AddH = 780009 -- 20 of them    no gate
  16. local BossID = 780001
  17.  
  18. local locA, locB, locC = 4523, 2778, 404 -- Randomly moves to one of these two coords on spawn (make near middle)
  19. local locX, locY, locZ = 4522, 2760, 404
  20. local gateAX, gateAY, gateAZ, gateAID = 4522.24, 2740.8, 403.984, 201374 -- The coords then ID of each gate on each side of the room
  21. local gateBX, gateBY, gateBZ, gateBID = 4522.21, 2797.87, 403.984, 201374
  22. local behindGateAX, behindGateAY, behindGateAZ = 4522, 2734, 404 -- The coords behind gate A to spawn mobs
  23. local behindGateBX, behindGateBY, behindGateBZ = 4522, 2804, 404 -- The coords behind gate B to spawn mobs
  24.  
  25. -- Do not touch below unless you are not using 3.3.5a
  26.  
  27. local OBJECT_END = 0x0006
  28. local GAMEOBJECT_BYTES_1 = OBJECT_END + 0x000B
  29. local SMSG_INIT_WORLD_STATES = 0x2C2
  30. local SMSG_UPDATE_WORLD_STATE = 0x2C3
  31.  
  32. -- Do not touch below
  33.  
  34. local CanStart = false
  35. local Wave = 1
  36. local Dead = 0
  37. local gateA = nil
  38. local gateB = nil
  39. local Open = false
  40. local pack = nil
  41.  
  42. ---------------------------------------------------------
  43. -- Wave Handler -----------------------------------------
  44. ---------------------------------------------------------
  45.  
  46. function Invisible_NpcDEFENDMALL(pUnit, Event)
  47.     pUnit:RegisterEvent("Check_For_EventDEFENDMALL", 5000, 0)
  48. end
  49.  
  50. function Check_For_EventDEFENDMALL(pUnit)
  51.     if CanStart then
  52.         pUnit:RemoveEvents()
  53.         CanStart = false
  54.         Wave = 1
  55.         gateA = pUnit:GetGameObjectNearestCoords(gateAX, gateAY, gateAZ, gateAID)
  56.         gateB = pUnit:GetGameObjectNearestCoords(gateBX, gateBY, gateBZ, gateBID)
  57.         for place, plrs in pairs(pUnit:GetInRangePlayers()) do
  58.             if plrs:GetPhase() == 2 then
  59.                 pUnit:SendChatMessageToPlayer(42,0,"The event has begun! Defend the room for all 8 waves.", plrs)
  60.                 pack = LuaPacket:CreatePacket(SMSG_INIT_WORLD_STATES, 18) -- Waves remaining
  61.                 pack:WriteULong(534) -- Map
  62.                 pack:WriteULong(3606) -- Zone
  63.                 pack:WriteULong(0)
  64.                 pack:WriteUShort(2)
  65.                 pack:WriteULong(2842) -- ID
  66.                 pack:WriteULong(1) -- Value
  67.                 plrs:SendPacketToPlayer(pack)
  68.                 pack = LuaPacket:CreatePacket(SMSG_UPDATE_WORLD_STATE, 8)
  69.                 pack:WriteULong(2842) -- ID, total
  70.                 pack:WriteULong(Wave) -- Value
  71.                 plrs:SendPacketToPlayer(pack)
  72.                 pUnit:SendChatMessageToPlayer(42, 0, "Wave "..Wave.."!", plrs) -- 1
  73.             end
  74.         end
  75.         pUnit:PlaySoundToSet(8887) -- Scary music
  76.         pUnit:RegisterEvent("Spawn_Adds_DEFENDMALL", 7000, 1)
  77.     end
  78. end
  79.  
  80. RegisterUnitEvent(HANDLER_CREATURE, 18, "Invisible_NpcDEFENDMALL")
  81.  
  82. function Spawn_Adds_DEFENDMALL(pUnit)
  83.     if gateA ~= nil then
  84.         gateA:SetByte(GAMEOBJECT_BYTES_1,0,0) -- Open
  85.         Open = true
  86.     end
  87.     local i = 0
  88.     while i ~= 4 do
  89.         i = i + 1
  90.         pUnit:SpawnCreature(AddA, behindGateAX, behindGateAY, behindGateAZ, 0, 15, 180000)
  91.     end
  92.     pUnit:RegisterEvent("CheckForDeadAddsOhLol", 5000, 0)
  93. end
  94.  
  95. function CheckForDeadAddsOhLol(pUnit)
  96.     if Open then
  97.         if gateA ~= nil then
  98.             gateA:SetByte(GAMEOBJECT_BYTES_1,0,1) -- Close
  99.             Open = false
  100.         end
  101.     end
  102.     if Dead > 3 then
  103.         Wave = Wave + 1
  104.         pUnit:RemoveEvents()
  105.         for place, plrs in pairs(pUnit:GetInRangePlayers()) do
  106.             if plrs:GetPhase() == 2 then
  107.                 pack = LuaPacket:CreatePacket(SMSG_UPDATE_WORLD_STATE, 8)
  108.                 pack:WriteULong(2842) -- ID, total
  109.                 pack:WriteULong(Wave) -- Value
  110.                 plrs:SendPacketToPlayer(pack)
  111.                 pUnit:SendChatMessageToPlayer(42, 0, "Wave "..Wave.."!", plrs) -- 2
  112.             end
  113.         end
  114.         if gateA ~= nil then
  115.             gateA:SetByte(GAMEOBJECT_BYTES_1,0,0) -- Open
  116.             Open = true
  117.         end
  118.         local i = 0
  119.         while i ~= 10 do
  120.             i = i + 1
  121.             pUnit:SpawnCreature(AddB, behindGateAX, behindGateAY, behindGateAZ, 0, 15, 300000)
  122.         end
  123.         pUnit:RegisterEvent("Check_For_All_DeadDEFENDMALL", 5000, 0)
  124.     end
  125. end
  126.  
  127. function Check_For_All_DeadDEFENDMALL(pUnit)
  128.     if Open then
  129.         if gateA ~= nil then
  130.             gateA:SetByte(GAMEOBJECT_BYTES_1,0,1) -- Close
  131.             Open = false
  132.         end
  133.     end
  134.     if Dead > 11 then
  135.         pUnit:RemoveEvents()
  136.         Wave = Wave + 1
  137.         for place, plrs in pairs(pUnit:GetInRangePlayers()) do
  138.             if plrs:GetPhase() == 2 then
  139.                 pack = LuaPacket:CreatePacket(SMSG_UPDATE_WORLD_STATE, 8)
  140.                 pack:WriteULong(2842) -- ID, total
  141.                 pack:WriteULong(Wave) -- Value
  142.                 plrs:SendPacketToPlayer(pack)
  143.                 pUnit:SendChatMessageToPlayer(42, 0, "Wave "..Wave.."!", plrs) -- 3
  144.             end
  145.         end
  146.         if gateA ~= nil then
  147.             gateA:SetByte(GAMEOBJECT_BYTES_1,0,0) -- Open
  148.             Open = true
  149.         end
  150.         if gateB ~= nil then
  151.             gateB:SetByte(GAMEOBJECT_BYTES_1,0,0) -- Open
  152.             Open = true
  153.         end
  154.         pUnit:SpawnCreature(AddC, behindGateAX, behindGateAY, behindGateAZ, 0, 15, 320000)
  155.         pUnit:SpawnCreature(AddC, behindGateBX, behindGateBY, behindGateBZ, 0, 15, 320000)
  156.         pUnit:RegisterEvent("Check_For_ADDCDEATHS_DEFENDMALL", 5000, 0)
  157.     end
  158. end
  159.  
  160. function Check_For_ADDCDEATHS_DEFENDMALL(pUnit)
  161.     if Open then
  162.         if gateA ~= nil then
  163.             gateA:SetByte(GAMEOBJECT_BYTES_1,0,1) -- Close
  164.             Open = false
  165.         end
  166.         if gateB ~= nil then
  167.             gateB:SetByte(GAMEOBJECT_BYTES_1,0,1) -- Close
  168.             Open = false
  169.         end
  170.     end
  171.     if Dead > 13 then
  172.         pUnit:RemoveEvents()
  173.         Wave = Wave + 1
  174.         for place, plrs in pairs(pUnit:GetInRangePlayers()) do
  175.             if plrs:GetPhase() == 2 then
  176.                 pack = LuaPacket:CreatePacket(SMSG_UPDATE_WORLD_STATE, 8)
  177.                 pack:WriteULong(2842) -- ID, total
  178.                 pack:WriteULong(Wave) -- Value
  179.                 plrs:SendPacketToPlayer(pack)
  180.                 pUnit:SendChatMessageToPlayer(42, 0, "Wave "..Wave.."!", plrs) -- 4
  181.             end
  182.         end
  183.         --pUnit:PlaySoundToSet(10763)
  184.         pUnit:RegisterEvent("Break_Break_GiveBreak_DEFENDMALL", 8000, 1)
  185.     end
  186. end
  187.  
  188. function Break_Break_GiveBreak_DEFENDMALL(pUnit)
  189.     local i = 0
  190.     while i ~= 20 do
  191.         i = i + 1
  192.         if math.random(1,2) == 1 then
  193.             pUnit:SpawnCreature(AddD, behindGateAX, behindGateAY, behindGateAZ , 0, 15, 180000)
  194.         else
  195.             pUnit:SpawnCreature(AddD, behindGateBX, behindGateBY, behindGateBZ , 0, 15, 180000)
  196.         end
  197.     end
  198.     if gateA ~= nil then
  199.         gateA:SetByte(GAMEOBJECT_BYTES_1,0,0) -- Open
  200.         Open = true
  201.     end
  202.     if gateB ~= nil then
  203.         gateB:SetByte(GAMEOBJECT_BYTES_1,0,0) -- Open
  204.         Open = true
  205.     end
  206.     pUnit:RegisterEvent("Check_For_mobDDeaths_Yarp", 7500, 0)
  207. end
  208.  
  209. function Check_For_mobDDeaths_Yarp(pUnit)
  210.     if Open then
  211.         if gateA ~= nil then
  212.             gateA:SetByte(GAMEOBJECT_BYTES_1,0,1) -- Close
  213.             Open = false
  214.         end
  215.         if gateB ~= nil then
  216.             gateB:SetByte(GAMEOBJECT_BYTES_1,0,1) -- Close
  217.             Open = false
  218.         end
  219.     end
  220.     if Dead > 35 then
  221.         pUnit:RemoveEvents()
  222.         Wave = Wave + 1
  223.         for place, plrs in pairs(pUnit:GetInRangePlayers()) do
  224.             if plrs:GetPhase() == 2 then
  225.                 pack = LuaPacket:CreatePacket(SMSG_UPDATE_WORLD_STATE, 8)
  226.                 pack:WriteULong(2842) -- ID, total
  227.                 pack:WriteULong(Wave) -- Value
  228.                 plrs:SendPacketToPlayer(pack)
  229.                 pUnit:SendChatMessageToPlayer(42, 0, "Wave "..Wave.."!", plrs) -- 5
  230.             end
  231.         end
  232.         pUnit:PlaySoundToSet(15119)
  233.         pUnit:RegisterEvent("WAIT_FOR_THE_RIGHT_MOMENT_DUN_DUN_DEFENDMALL", 7500, 1)
  234.     end
  235. end
  236.  
  237. function WAIT_FOR_THE_RIGHT_MOMENT_DUN_DUN_DEFENDMALL(pUnit)
  238.     local i = 0
  239.     while i ~= 6 do
  240.         i = i + 1
  241.         pUnit:SpawnCreature(AddE, behindGateAX, behindGateAY, behindGateAZ , 0, 15, 380000)
  242.     end
  243.     if gateA ~= nil then
  244.         gateA:SetByte(GAMEOBJECT_BYTES_1,0,0) -- Open
  245.         Open = true
  246.     end
  247.     pUnit:RegisterEvent("CHECK_FOR_DEAD_MALLEVENTgtoustwo", 7500, 0)
  248. end
  249.  
  250. function CHECK_FOR_DEAD_MALLEVENTgtoustwo(pUnit)
  251.     if Open then
  252.         if gateA ~= nil then
  253.             gateA:SetByte(GAMEOBJECT_BYTES_1,0,1) -- Close
  254.             Open = false
  255.         end
  256.     end
  257.     if Dead > 40 then
  258.         pUnit:RemoveEvents()
  259.         Wave = Wave + 1
  260.         for place, plrs in pairs(pUnit:GetInRangePlayers()) do
  261.             if plrs:GetPhase() == 2 then
  262.                 pack = LuaPacket:CreatePacket(SMSG_UPDATE_WORLD_STATE, 8)
  263.                 pack:WriteULong(2842) -- ID, total
  264.                 pack:WriteULong(Wave) -- Value
  265.                 plrs:SendPacketToPlayer(pack)
  266.                 pUnit:SendChatMessageToPlayer(42, 0, "Wave "..Wave.."!", plrs) -- 6
  267.             end
  268.         end
  269.         pUnit:RegisterEvent("WAIT_FOR_THE_RIGHT_MOMENT_DUN_DUN_DEFENDMALLtwo", 7500, 1)
  270.     end
  271. end
  272.  
  273. function WAIT_FOR_THE_RIGHT_MOMENT_DUN_DUN_DEFENDMALLtwo(pUnit)
  274.     local i = 0
  275.     while i ~= 15 do
  276.         i = i + 1
  277.         pUnit:SpawnCreature(AddF, behindGateBX, behindGateBY, behindGateBZ , 0, 15, 280000)
  278.     end
  279.     if gateB ~= nil then
  280.         gateB:SetByte(GAMEOBJECT_BYTES_1,0,0) -- Open
  281.         Open = true
  282.     end
  283.     pUnit:RegisterEvent("CHECK_FOR_DEAD_MALLEVENTaaassssffff", 7500, 0)
  284. end
  285.  
  286. function CHECK_FOR_DEAD_MALLEVENTaaassssffff(pUnit)
  287.     if Open then
  288.         if gateB ~= nil then
  289.             gateB:SetByte(GAMEOBJECT_BYTES_1,0,1) -- Close
  290.             Open = false
  291.         end
  292.     end
  293.     if Dead > 54 then
  294.         pUnit:RemoveEvents()
  295.         Wave = Wave + 1
  296.         for place, plrs in pairs(pUnit:GetInRangePlayers()) do
  297.             if plrs:GetPhase() == 2 then
  298.                 pack = LuaPacket:CreatePacket(SMSG_UPDATE_WORLD_STATE, 8)
  299.                 pack:WriteULong(2842) -- ID, total
  300.                 pack:WriteULong(Wave) -- Value
  301.                 plrs:SendPacketToPlayer(pack)
  302.                 pUnit:SendChatMessageToPlayer(42, 0, "Wave "..Wave.."!", plrs) -- 7
  303.             end
  304.         end
  305.         pUnit:RegisterEvent("WAIT_FOR_THE_RIGHT_MOMENT_DUN_DUN_DEFENDMALLgaga", 7500, 1)
  306.     end
  307. end
  308.  
  309. function WAIT_FOR_THE_RIGHT_MOMENT_DUN_DUN_DEFENDMALLgaga(pUnit)
  310.     local i = 0
  311.     while i ~= 4 do
  312.         i = i + 1
  313.         if math.random(1,2) == 1 then
  314.             pUnit:SpawnCreature(AddG, behindGateAX, behindGateAY, behindGateAZ , 0, 15, 480000)
  315.         else
  316.             pUnit:SpawnCreature(AddG, behindGateBX, behindGateBY, behindGateBZ , 0, 15, 480000)
  317.         end
  318.     end
  319.     if gateA ~= nil then
  320.         gateA:SetByte(GAMEOBJECT_BYTES_1,0,0) -- Open
  321.         Open = true
  322.     end
  323.     if gateB ~= nil then
  324.         gateB:SetByte(GAMEOBJECT_BYTES_1,0,0) -- Open
  325.         Open = true
  326.     end
  327.     pUnit:RegisterEvent("Check_For_mobDDeaths_Yarpgggggh", 7500, 0)
  328. end
  329.  
  330. function Check_For_mobDDeaths_Yarpgggggh(pUnit)
  331.     if Open then
  332.         if gateA ~= nil then
  333.             gateA:SetByte(GAMEOBJECT_BYTES_1,0,1) -- Close
  334.             Open = false
  335.         end
  336.         if gateB ~= nil then
  337.             gateB:SetByte(GAMEOBJECT_BYTES_1,0,1) -- Close
  338.             Open = false
  339.         end
  340.     end
  341.     if Dead > 59 then
  342.         pUnit:RemoveEvents()
  343.         Wave = Wave + 1
  344.         for place, plrs in pairs(pUnit:GetInRangePlayers()) do
  345.             if plrs:GetPhase() == 2 then
  346.                 pack = LuaPacket:CreatePacket(SMSG_UPDATE_WORLD_STATE, 8)
  347.                 pack:WriteULong(2842) -- ID, total
  348.                 pack:WriteULong(Wave) -- Value
  349.                 plrs:SendPacketToPlayer(pack)
  350.                 pUnit:SendChatMessageToPlayer(42, 0, "Wave "..Wave.."!", plrs) -- 8
  351.             end
  352.         end
  353.         pUnit:RegisterEvent("FINALWAVE_DEFENDMALL", 8000, 1)
  354.     end
  355. end
  356.  
  357. function FINALWAVE_DEFENDMALL(pUnit)
  358.     local i = 0
  359.     local pla = nil
  360.     while i ~= 20 do
  361.         i = i + 1
  362.         pla = pUnit:GetRandomPlayer(0)
  363.         if pla ~= nil then
  364.             pUnit:SpawnCreature(AddH, pla:GetX(), pla:GetY(), pla:GetZ(), 0, 15, 300000)
  365.         end
  366.     end
  367.     pUnit:RegisterEvent("WAVES_COMPLETE_BOSS_DUNDUN", 8000, 0)
  368. end
  369.  
  370. function WAVES_COMPLETE_BOSS_DUNDUN(pUnit)
  371.     if Dead > 62 then
  372.         pUnit:RemoveEvents()
  373.         Wave = 1
  374.         Dead = 0
  375.         local Grill = pUnit:GetGameObjectNearestCoords(4522, 2769, 404, 201755) -- x,y,z,id
  376.         if Grill ~= nil then
  377.             Grill:SetByte(GAMEOBJECT_BYTES_1,0,0) -- Open Trap
  378.             pUnit:PlaySoundToSet(16541)
  379.             Grill:Despawn(30000, 10000)
  380.         end
  381.         for place, plrs in pairs(pUnit:GetInRangePlayers()) do
  382.             if plrs:GetPhase() == 2 then
  383.                 pUnit:SendChatMessageToPlayer(42, 0, "The way to the boss is clear!", plrs)
  384.             end
  385.         end
  386.         pUnit:SpawnCreature(BossID, 4575, 2768, 361.3, 3.121345, 35, 0)
  387.         pUnit:RegisterEvent("Check_For_EventDEFENDMALL", 10000, 0) -- CanStart is not true yet
  388.     end
  389. end
  390.  
  391. ---------------------------------------------------------
  392. -- Add Scripts ------------------------------------------
  393. ---------------------------------------------------------
  394.  
  395. function Adds_OnSpawn_ohlol(pUnit, Event)
  396.     pUnit:SetPhase(2)
  397.     pUnit:SetMovementFlags(1)
  398.     pUnit:RegisterEvent("SetFaction_Hostile_After_Gate", 2500, 1)
  399.     if pUnit:GetEntry() == AddC then
  400.         pUnit:RegisterEvent("Cast_ADDC_DEFENDMALL", math.random(6000, 12000), 0)
  401.     elseif pUnit:GetEntry() == AddG then
  402.         pUnit:RegisterEvent("CastSoekks_DEFENDMALL", math.random(2000, 12000), 1)
  403.     elseif pUnit:GetEntry() == AddH then
  404.         pUnit:RegisterEvent("SPawnVisual_teoaj", math.random(750, 1500), 1)
  405.     end
  406. end
  407.  
  408. function SetFaction_Hostile_After_Gate(pUnit)
  409.     pUnit:SetPhase(2) -- Just in case
  410.     pUnit:SetMovementFlags(1)
  411.     pUnit:SetFaction(21)
  412.     if math.random(1,2) == 1 then
  413.         pUnit:MoveTo(locA+math.random(0,2),locB-math.random(0,2),locC,0)
  414.     else
  415.         pUnit:MoveTo(locX-math.random(0,2),locY+math.random(0,2),locZ,0)
  416.     end
  417. end
  418.  
  419. function Adds_OnDead_Ohlol(pUnit)
  420.     pUnit:RemoveEvents()
  421.     Dead = Dead + 1
  422. end
  423.  
  424. function Cast_ADDC_DEFENDMALL(pUnit)
  425.     pUnit:FullCastSpell(36132) -- Normal damage + 300 for two strong adds
  426. end
  427.  
  428. function CastSoekks_DEFENDMALL(pUnit)
  429.     pUnit:CastSpell(15636) -- Avatar of flame
  430. end
  431.  
  432. function SPawnVisual_teoaj(pUnit)
  433.     pUnit:CastSpell(64446) -- Teleport visual
  434. end
  435.  
  436. RegisterUnitEvent(AddA, 18, "Adds_OnSpawn_ohlol")
  437. RegisterUnitEvent(AddB, 18, "Adds_OnSpawn_ohlol")
  438. RegisterUnitEvent(AddC, 18, "Adds_OnSpawn_ohlol")
  439. RegisterUnitEvent(AddD, 18, "Adds_OnSpawn_ohlol")
  440. RegisterUnitEvent(AddE, 18, "Adds_OnSpawn_ohlol")
  441. RegisterUnitEvent(AddF, 18, "Adds_OnSpawn_ohlol")
  442. RegisterUnitEvent(AddG, 18, "Adds_OnSpawn_ohlol")
  443. RegisterUnitEvent(AddH, 18, "Adds_OnSpawn_ohlol")
  444.  
  445. RegisterUnitEvent(AddA, 4, "Adds_OnDead_Ohlol")
  446. RegisterUnitEvent(AddB, 4, "Adds_OnDead_Ohlol")
  447. RegisterUnitEvent(AddC, 4, "Adds_OnDead_Ohlol")
  448. RegisterUnitEvent(AddD, 4, "Adds_OnDead_Ohlol")
  449. RegisterUnitEvent(AddE, 4, "Adds_OnDead_Ohlol")
  450. RegisterUnitEvent(AddF, 4, "Adds_OnDead_Ohlol")
  451. RegisterUnitEvent(AddG, 4, "Adds_OnDead_Ohlol")
  452. RegisterUnitEvent(AddH, 4, "Adds_OnDead_Ohlol")
  453.  
  454. ---------------------------------------------------------
  455. -- Boss -------------------------------------------------
  456. ---------------------------------------------------------
  457.  
  458. function BOSS_ONDEATH_HURPDURP(pUnit)
  459.     pUnit:RemoveEvents()
  460.     pUnit:SendChatMessage(12,0,"Death... Is only the beginning.")
  461. end
  462.  
  463. function BOSS_ONLEAVE_HURPDURP(pUnit)
  464.     pUnit:RemoveEvents()
  465.     pUnit:Despawn(5000, 0)
  466. end
  467.  
  468. function Boss_ONSPAWN_DEFENDMALL(pUnit)
  469.     pUnit:SetPhase(2)
  470.     pUnit:RegisterEvent("CheckFOrPlayers_HUtoayp", 2500, 0)
  471. end
  472.  
  473. function CheckFOrPlayers_HUtoayp(pUnit)
  474.     local plr = pUnit:GetClosestPlayer()
  475.     if plr ~= nil then
  476.         if plr:GetPhase() == 2 then
  477.             if pUnit:GetDistanceYards(plr) < 12 then
  478.                 pUnit:RemoveEvents()
  479.                 pUnit:SendChatMessage(12,0,"Welcome all, salutations are in order. My name is Arugal and unfortunately, you appear to be on tonights menu.")
  480.                 pUnit:MoveTo(4552.8, 2769.2, 351.4, 3)
  481.                 pUnit:EquipWeapons(18842, 0, 0)
  482.                 pUnit:RegisterEvent("WalkingDownStairs_DEFENDMALL", 11000, 1)
  483.             end
  484.         end
  485.     end
  486. end
  487.  
  488. function WalkingDownStairs_DEFENDMALL(pUnit)
  489.     pUnit:SendChatMessage(12,0,"Let me tenderise you all.")
  490.     pUnit:Emote(1,3000)
  491.     pUnit:RegisterEvent("Delay_A_Moment_GPOAJ", 4000, 1)
  492. end
  493.  
  494. function Delay_A_Moment_GPOAJ(pUnit)
  495.     pUnit:CastSpell(29880) -- Mana shield
  496.     pUnit:Root()
  497.     pUnit:SetFaction(21)
  498.     local plr = nil
  499.     local i = 0
  500.     while i ~= 10 do
  501.         i = i + 1
  502.         plr = pUnit:GetRandomPlayer(0)
  503.         if plr ~= nil then
  504.             if plr:GetPhase() == 2 then
  505.                 pUnit:CastSpellOnTarget(52257, plr) -- Shadowbolt
  506.                 pUnit:CastSpellOnTarget(7124, plr) -- Damage
  507.             end
  508.         end
  509.     end
  510.     pUnit:RegisterEvent("Shadowbolt_Spam_Three_Argual", 3005, 0)
  511.     pUnit:RegisterEvent("VolleyOfShadowbolts", 7000, 0)
  512. end
  513.  
  514. function Shadowbolt_Spam_Three_Argual(pUnit)
  515.     local plr = pUnit:GetRandomPlayer(0)
  516.     if plr ~= nil then
  517.         if plr:GetPhase() == 2 then
  518.             if math.random(1,2) == 1 then
  519.                 pUnit:FullCastSpellOnTarget(12739, plr) -- shadowbolt
  520.             else
  521.                 pUnit:FullCastSpell(39082) -- shadowfury
  522.             end
  523.         end
  524.     end
  525. end
  526.  
  527. function VolleyOfShadowbolts(pUnit)
  528.     local plr = nil
  529.     local i = 0
  530.     while i ~= 10 do
  531.         i = i + 1
  532.         plr = pUnit:GetRandomPlayer(0)
  533.         if plr ~= nil then
  534.             if plr:GetPhase() == 2 then
  535.                 pUnit:CastSpellOnTarget(52257, plr) -- Shadowbolt
  536.                 pUnit:CastSpellOnTarget(7124, plr) -- Damage
  537.             end
  538.         end
  539.     end
  540. end
  541.  
  542. RegisterUnitEvent(BossID, 18, "Boss_ONSPAWN_DEFENDMALL")
  543. RegisterUnitEvent(BossID, 4, "BOSS_ONDEATH_HURPDURP")
  544. RegisterUnitEvent(BossID, 2, "BOSS_ONLEAVE_HURPDURP")
  545.  
  546. ---------------------------------------------------------
  547.  
  548. --[[
  549.     Debug Below
  550.         Comment out later
  551. ]]
  552.  
  553. function OnChat_Hook_ToJoinBG(event, plr, message, pType, pLanguage, pMisc)
  554.     local message = string.lower(message)
  555.     --[[if message == "test" then
  556.         local object = plr:GetGameObjectNearestCoords(4522, 2769, 404, 201755) -- x,y,z,id
  557.         if object ~= nil then
  558.             object:SetByte(GAMEOBJECT_BYTES_1,0,0) -- Open WORKSSSSS
  559.             plr:PlaySoundToSet(16541)
  560.         end
  561.     end
  562.     if message == "fix" then
  563.         local object = plr:GetGameObjectNearestCoords(4522, 2769, 404, 201755) -- x,y,z,id
  564.         if object ~= nil then
  565.             object:SetByte(GAMEOBJECT_BYTES_1,0,1) -- Close, buggy
  566.         end
  567.     end]]
  568.     if message == "#start" then
  569.         CanStart = true
  570.     end
  571. end
  572.  
  573. RegisterServerHook(16, "OnChat_Hook_ToJoinBG")
  574.  
  575. ---------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment