Advertisement
Rochet2

LoL - Unfinished

Apr 28th, 2012
307
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.08 KB | None | 0 0
  1. local A_Minion = 190001
  2. local A_Super_minion = 190004
  3. local A_Nexus = 190002
  4. local A_DefTower = 190003
  5. local A_SuperBlock = 190005
  6. local A_Store = 190006
  7. local B_Minion = 190001
  8. local B_Super_minion = 190004
  9. local B_Nexus = 190002
  10. local B_DefTower = 190003
  11. local B_SuperBlock = 190005
  12. local B_Store = 190006
  13. local BEAKON = 190010
  14. local A,B = 1, 0 -- 0 = Alliance, 0 = Horde
  15. local Faction1, Faction2 = 998, 999
  16.  
  17. local Classes =
  18. {
  19.     {"Warrior", 11, 15}, -- Class name and spell list
  20.     {"Mage", 11, 15},
  21. }
  22. local space = 100
  23.  
  24. local T = {Selected = {}, Que = {},QueA = {},QueB = {}, A = {Super = false, Coord = {}}, B = {Super = false, Coord = {}}}
  25. local Running = false
  26.  
  27. T.A.Coord.Minion1 = {map,x,y,z,o}
  28. T.A.Coord.Minion2 = {map,x,y,z,o}
  29. T.A.Coord.Minion3 = {map,x,y,z,o}
  30. T.A.Coord.Minion4 = {map,x,y,z,o}
  31.  
  32. T.B.Coord.Minion1 = {map,x,y,z,o}
  33. T.B.Coord.Minion2 = {map,x,y,z,o}
  34. T.B.Coord.Minion3 = {map,x,y,z,o}
  35. T.B.Coord.Minion4 = {map,x,y,z,o}
  36.  
  37. local function Hello(pUnit, event, pPlayer)
  38.     pUnit:GossipCreateMenu(100, pPlayer, 0)
  39.     if(tostring(pUnit:GetTeam()) == A) then
  40.         pUnit:GossipMenuAddItem(0, "Queuers: "..(#T.QueA), 0, 0, '', 0)
  41.     else
  42.         pUnit:GossipMenuAddItem(0, "Queuers: "..(#T.QueB), 0, 0, '', 0)
  43.     end
  44.     if(not T.Que[tostring(pPlayer)]) then
  45.         pUnit:GossipMenuAddItem(0, "Join the queue", 4, 0, '', 0)
  46.     else
  47.         pUnit:GossipMenuAddItem(0, "Leave the queue", 2, 0, 'Leave the queue?', 0)
  48.     end
  49.     if(Running) then
  50.         pUnit:GossipMenuAddItem(0, "Spectate", 3, 0, '', 0)
  51.     end
  52.     pUnit:GossipSendMenu(pPlayer)
  53. end
  54.  
  55. local function Select(pUnit, event, pPlayer, id, intid, code)
  56.     if(intid == 0) then
  57.         T.Hello(pUnit, event, pPlayer)
  58.         return
  59.     elseif(intid == 4) then
  60.         pUnit:GossipCreateMenu(100, pPlayer, 0)
  61.         for i = 1, #Classes do
  62.             pUnit:GossipMenuAddItem(0, Classes[i][1], i+space, 0, 'Are you sure?', 0)
  63.         end
  64.         pUnit:GossipMenuAddItem(7, "Back..", 0, 0, '', 0)
  65.         pUnit:GossipSendMenu(pPlayer)
  66.     elseif(intid == 2) then
  67.         table.remove(T.QueN, T.Que[tostring(pPlayer)])
  68.         T.Que[tostring(pPlayer)] = nil
  69.         pPlayer:SendBroadcastMessage("You have been removed from the queue")
  70.     elseif(intid == 3) then
  71.         -- Spectate
  72.     elseif(intid > space and <= space+#Classes) then
  73.         table.insert(T.QueN, pPlayer)
  74.         T.Que[tostring(pPlayer)] = {#T.QueN, intid-space}
  75.         pPlayer:SendBroadcastMessage("You have been added to the queue")
  76.         if(not Running and #T.QueN >= 2) then
  77.             Teleport()
  78.         end
  79.     end
  80.     pPlayer:GossipComplete()
  81. end
  82.  
  83. local function Teleport()
  84.     if(#T.QueN < 2) then
  85.         return
  86.     end
  87.     for i = 1, 10 do
  88.         if(not T.QueN[i] or type(T.QueN[i]) ~= "userdata" or not T.QueN[i]:GetName()) then
  89.             table.remove(T.QueN, i)
  90.             Teleport()
  91.             return
  92.         end
  93.     end
  94.     for i = 1, 10 do
  95.         local x,y,z,o = T.QueN[i]:GetLocation()
  96.         local map = T.QueN[i]:GetMapId()
  97.         T.["Loc "..i] = {map,x,y,z,o}
  98.     end
  99.    
  100.     -- Fill in the coordinates!
  101.     T.QueN[1]:Teleport(map, x, y, z, o) -- Teleport player 1
  102.     T.QueN[2]:Teleport(map, x, y, z, o) -- teleport player 2
  103.    
  104.     -- Timer to automatically end the match after 10 min (10 min = 600 sec = 600000 ms)
  105.     T.Event = CreateLuaEvent(function() End(tostring(T[1]), tostring(T[2])) end, 600000, 1)
  106.    
  107.     Running = true
  108. end
  109.  
  110. function End(str1, str2)
  111.     T[1]:Teleport(T.Loc1[1], T.Loc1[2], T.Loc1[3], T.Loc1[4], T.Loc1[5]) -- Teleport player 1 back
  112.     T[2]:Teleport(T.Loc2[1], T.Loc2[2], T.Loc2[3], T.Loc2[4], T.Loc2[5]) -- Teleport player 2 back
  113.     table.remove(T, 1)
  114.     table.remove(T, 1)
  115.     T.Que[str1] = nil
  116.     T.Que[str2] = nil
  117.     Running = false
  118.     T.Teleport()
  119. end
  120.  
  121. local function SpawnMinions()
  122.     for _,Tbl in pairs(T.A.Coord) do
  123.         PerformIngameSpawn(1, A_Minion, Tbl[1], Tbl[2], Tbl[3], Tbl[4], Tbl[5], faction, 0, equip1, equip2, equip3, instanceid, 0)
  124.     end
  125.     for _,Tbl in pairs(T.B.Coord) do
  126.         PerformIngameSpawn(1, B_Minion, Tbl[1], Tbl[2], Tbl[3], Tbl[4], Tbl[5], faction, 0, equip1, equip2, equip3, instanceid, 0)
  127.     end
  128. end
  129.  
  130. local function SuperMinions(Team, pUnit)
  131.     pUnit:Despawn(0, 60000)
  132.     Team.Super = true
  133.     CreateLuaEvent(function() Team.Super = false end, 60000, 1)
  134. end
  135.  
  136. local function EndGame(Winner)
  137.     if(Winner == A or Winner == B) then
  138.         Announce(A, "Team A won!", nil)
  139.         Announce(B, "Team B won!", nil)
  140.     else
  141.         Announce(A, "It is a draw!", nil)
  142.         Announce(B, "It is a draw!", nil)
  143.     end
  144. end
  145.  
  146. local function Announce(team, message, Broad)
  147.     if(Broad == true or Broad == nil) then
  148.         for _,player in ipairs(team) do
  149.             player:SendBroadcastMessage(message)
  150.         end
  151.     end
  152.     if(Broad == false or Broad == nil) then
  153.         for _,player in ipairs(team) do
  154.             player:AreaTriggerMessage(message)
  155.         end
  156.     end
  157. end
  158.  
  159. local Entry = 12345
  160. RegisterUnitGossipEvent(Entry, 1, Hello)
  161. RegisterUnitGossipEvent(Entry, 2, Select)
  162.  
  163. RegisterUnitEvent(A_Nexus, 1, function() Announce(A, "Nexus is under attack", true) end)
  164. RegisterUnitEvent(A_Nexus, 4, function() EndGame(A) end)
  165. RegisterUnitEvent(B_Nexus, 1, function() Announce(B, "Nexus is under attack", true) end)
  166. RegisterUnitEvent(B_Nexus, 4, function() EndGame(B) end)
  167. RegisterUnitEvent(A_SuperBlock, 4, function(pUnit) SuperMinions(T.A,pUnit) end)
  168. RegisterUnitEvent(B_SuperBlock, 4, function(pUnit) SuperMinions(T.B,pUnit) end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement