Advertisement
Guest User

guild

a guest
May 27th, 2015
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.26 KB | None | 0 0
  1. GATES_config = {
  2. --// Apenas mexa aqui, CONFIGS -- // ]]
  3. warning_times = 2, -- Tempo até iniciar o evento, exemplo: (19:50 > 20:00 = 10);
  4. event_duration = 60000, -- Duração do evento (Padrão 1 hora.);
  5. removegates_effect = 3, -- Effect ao remover os portões;
  6. creategates_effect = 11, -- Effect ao criar os portões;
  7. time_winnersopen = 2 * 1000, -- Tempo para abrir o portão dos vencedores;
  8. time_winnersclose = 2 * 1000, -- Tempo pra fechar o portão dos perdedores;
  9. gates_itemid = 1544, -- ItemID dos portões;
  10. dates_start = {"Sunday-10:50", "Tuesday-10:50", "Monday-10:50", "Wednesday-07:31", "Thursday-10:50", "Friday-10:50", "Saturday-10:50"}, -- Datas do evento;
  11. position_tilewin = {x = 1739, y = 1492, z = 3}, -- Position do TILE pra ganhar o evento;
  12. position_winners = {x = 1739, y = 1484, z = 3}, -- Position aonde os vencedores vão após vencerem;
  13. open_eventgates = { -- // Abaixo as posições dos portões do evento;
  14. {x = 1675, y = 1478, z = 4, stackpos = 1},
  15. {x = 1676, y = 1478, z = 4, stackpos = 1},
  16. {x = 1677, y = 1478, z = 4, stackpos = 1},
  17. {x = 1678, y = 1478, z = 4, stackpos = 1},
  18. {x = 1679, y = 1478, z = 4, stackpos = 1},
  19. {x = 1680, y = 1478, z = 4, stackpos = 1},
  20. {x = 1675, y = 1482, z = 5, stackpos = 1},
  21. {x = 1676, y = 1482, z = 5, stackpos = 1},
  22. {x = 1677, y = 1482, z = 5, stackpos = 1},
  23. {x = 1678, y = 1482, z = 5, stackpos = 1},
  24. {x = 1679, y = 1482, z = 5, stackpos = 1},
  25. {x = 1739, y = 1492, z = 3, stackpos = 1},
  26. {x = 1740, y = 1492, z = 3, stackpos = 1},
  27. },
  28. open_winnersgates = { -- Abaixo as posições dos portões dos vencedores;
  29. {x = 1700, y = 1516, z = 5, stackpos = 1},
  30. {x = 1701, y = 1516, z = 5, stackpos = 1},
  31. },
  32. --// Não mexa daqui para baixo em NADA! -- // ]]
  33. times_storage = 181491,
  34. started_storage = 181492,
  35. tile_storage = 181493,
  36. }
  37.  
  38. function gatesClose()
  39. for table, gates in ipairs(GATES_config.open_eventgates) do
  40. doSendMagicEffect(gates, GATES_config.creategates_effect)
  41. doCreateItem(GATES_config.gates_itemid, 1, gates)
  42. end
  43. for cid, player in ipairs(getGateWinners()) do
  44. doSendMagicEffect(getThingPos(player), 13)
  45. doTeleportThing(player, GATES_config.position_winners, true)
  46. end
  47. addEvent(gatesWinnersOpen, GATES_config.time_winnersopen)
  48. addEvent(gatesWinnersClose, GATES_config.time_winnersclose)
  49. addEvent(setGlobalStorageValue, 5 * 1000, GATES_config.started_storage, -1)
  50. addEvent(setGlobalStorageValue, 5 * 1000, GATES_config.times_storage, -1)
  51. doBroadcastMessage("[Castle of War]: Os portões do castle foram trancados!", 21)
  52. return true
  53. end
  54.  
  55. function gatesWinnersOpen()
  56. for table, gates in ipairs(GATES_config.open_winnersgates) do
  57. doSendMagicEffect(gates, GATES_config.removegates_effect)
  58. doRemoveItem(getTileItemById(gates, GATES_config.gates_itemid).uid)
  59. end
  60. return true
  61. end
  62.  
  63. function gatesWinnersClose()
  64. for table, gates in ipairs(GATES_config.open_winnersgates) do
  65. doSendMagicEffect(gates, GATES_config.creategates_effect)
  66. doCreateItem(GATES_config.gates_itemid, 1, gates)
  67. end
  68. return true
  69. end
  70.  
  71. function getGateWinners()
  72. local winners = {}
  73. for cid, player in ipairs(getPlayersOnline()) do
  74. if isPlayer(player) then
  75. if (getPlayerStorageValue(player, GATES_config.tile_storage) ~= -1) then
  76. table.insert(winners, player)
  77. end
  78. end
  79. end
  80. return winners
  81. end
  82.  
  83. function gatesStart()
  84. if (getGlobalStorageValue(GATES_config.started_storage) ~= -1) then
  85. if (getGlobalStorageValue(GATES_config.times_storage) == GATES_config.warning_times) then
  86. for table, gates in ipairs(GATES_config.open_eventgates) do
  87. doSendMagicEffect(gates, GATES_config.removegates_effect)
  88. doRemoveItem(getTileItemById(gates, GATES_config.gates_itemid).uid)
  89. end
  90. doBroadcastMessage("[Castle of War]: Os portões do castle foram abertos!", 21)
  91. addEvent(gatesClose, GATES_config.event_duration)
  92. end
  93. end
  94. return true
  95. end
  96.  
  97. function warningStart()
  98. if (getGlobalStorageValue(GATES_config.times_storage) == GATES_config.warning_times) then
  99. gatesStart()
  100. return true
  101. end
  102. doBroadcastMessage("[Castle of War]: Será aberto em "..(GATES_config.warning_times - getGlobalStorageValue(GATES_config.times_storage)).." minuto(s).", 21)
  103. setGlobalStorageValue(GATES_config.times_storage, (getGlobalStorageValue(GATES_config.times_storage) + 1))
  104. return addEvent(warningStart, 1 * 60 * 1000)
  105. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement