stoneharry

Untitled

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