Advertisement
Guest User

asdASd

a guest
May 29th, 2015
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.06 KB | None | 0 0
  1. GATES_config = {
  2. --// Apenas mexa aqui, CONFIGS -- // ]]
  3. warning_times = 5, -- Tempo até iniciar o evento, exemplo: (19:50 > 20:00 = 10);
  4. event_duration = 3600000, -- Duração do evento (Padrão 1 hora.);
  5. eventguild_duration = 7200000, -- Duração do evento (Padrão 2 horas pra começar.);
  6. eventguildclose_duration = 10800000, -- Duração do evento (Padrão 3 horas pra fechar.);
  7. eventguildvencedor_duration = 10820000, -- Duração do evento (Padrão 3 horas pra fechar portão do vencedor.);
  8. event_closewin = 3620000, -- Duração do evento (Padrão 1 hora e 20 segundos.);
  9. removegates_effect = 3, -- Effect ao remover os portões;
  10. creategates_effect = 5, -- Effect ao criar os portões;
  11. time_winnersopen = 2 * 1000, -- Tempo para abrir o portão dos vencedores;
  12. time_winnersclose = 2 * 1000, -- Tempo pra fechar o portão dos perdedores;
  13. gates_itemid = 1544, -- ItemID dos portões;
  14. gates_itemidstone = 1561, -- ItemID da pedra do trono;
  15. dates_start = {"Sunday-19:55", "Tuesday-19:55", "Monday-19:55", "Wednesday-19:55", "Thursday-19:55", "Friday-19:55", "Saturday-19:55"}, -- Datas do evento;
  16. open_eventgates = { -- // Abaixo as posições dos portões do evento;
  17. {x = 9744, y = 10135, z = 4, stackpos = 1},
  18. {x = 9745, y = 10135, z = 4, stackpos = 1},
  19. {x = 9746, y = 10135, z = 4, stackpos = 1},
  20. {x = 9747, y = 10135, z = 4, stackpos = 1},
  21. {x = 9748, y = 10135, z = 4, stackpos = 1},
  22. {x = 9749, y = 10135, z = 4, stackpos = 1},
  23. {x = 9750, y = 10135, z = 4, stackpos = 1},
  24. {x = 9751, y = 10135, z = 4, stackpos = 1},
  25. {x = 9752, y = 10135, z = 4, stackpos = 1},
  26. {x = 9753, y = 10135, z = 4, stackpos = 1},
  27. {x = 9754, y = 10135, z = 4, stackpos = 1},
  28. {x = 9847, y = 10022, z = 4, stackpos = 1},
  29. {x = 9848, y = 10022, z = 4, stackpos = 1},
  30. },
  31. open_eventgatesguild = { -- // Abaixo as posições dos portões do evento guildcastle;
  32. {x = 9744, y = 10135, z = 4, stackpos = 1},
  33. {x = 9745, y = 10135, z = 4, stackpos = 1},
  34. {x = 9746, y = 10135, z = 4, stackpos = 1},
  35. {x = 9747, y = 10135, z = 4, stackpos = 1},
  36. {x = 9748, y = 10135, z = 4, stackpos = 1},
  37. {x = 9749, y = 10135, z = 4, stackpos = 1},
  38. {x = 9750, y = 10135, z = 4, stackpos = 1},
  39. {x = 9751, y = 10135, z = 4, stackpos = 1},
  40. {x = 9752, y = 10135, z = 4, stackpos = 1},
  41. {x = 9753, y = 10135, z = 4, stackpos = 1},
  42. {x = 9754, y = 10135, z = 4, stackpos = 1},
  43. {x = 9847, y = 10022, z = 4, stackpos = 1},
  44. {x = 9848, y = 10022, z = 4, stackpos = 1},
  45. },
  46. open_eventstone = { -- // Abaixo as posições dos portões que abre qdo o evento termina;
  47. {x = 9847, y = 10021, z = 4, stackpos = 1},
  48. {x = 9847, y = 10020, z = 4, stackpos = 1},
  49. },
  50. open_eventstoneguild = { -- // Abaixo as posições dos portões que abre qdo o evento termina guild castle;
  51. {x = 9847, y = 10021, z = 4, stackpos = 1},
  52. {x = 9847, y = 10020, z = 4, stackpos = 1},
  53. },
  54. open_winnersgates = { -- Abaixo as posições dos portões dos vencedores;
  55. {x = 9919, y = 10013, z = 4, stackpos = 1},
  56. },
  57. --// Não mexa daqui para baixo em NADA! -- // ]]
  58. times_storage = 191491,
  59. started_storage = 191492,
  60. tile_storage = 191493,
  61. }
  62.  
  63. function gatesClose()
  64. for table, gates in ipairs(GATES_config.open_eventgates) do
  65. doSendMagicEffect(gates, GATES_config.creategates_effect)
  66. doCreateItem(GATES_config.gates_itemid, 1, gates)
  67. end
  68. for cid, player in ipairs(getGateWinners()) do
  69. doSendMagicEffect(getThingPos(player), 13)
  70. doTeleportThing(player, GATES_config.position_winners, true)
  71. end
  72. addEvent(gatesWinnersOpen, GATES_config.time_winnersopen)
  73. addEvent(gatesWinnersClose, GATES_config.time_winnersclose)
  74. addEvent(setGlobalStorageValue, 5 * 1000, GATES_config.started_storage, -1)
  75. addEvent(setGlobalStorageValue, 5 * 1000, GATES_config.times_storage, -1)
  76. doBroadcastMessage("[Desert Exp]: Os portões do desert foram trancados!", 21)
  77. return true
  78. end
  79.  
  80. function gatesWinnersOpen()
  81. for table, gates in ipairs(GATES_config.open_winnersgates) do
  82. doSendMagicEffect(gates, GATES_config.removegates_effect)
  83. doRemoveItem(getTileItemById(gates, GATES_config.gates_itemid).uid)
  84. end
  85. return true
  86. end
  87.  
  88. function gatesWinnersClose()
  89. for table, gates in ipairs(GATES_config.open_winnersgates) do
  90. doSendMagicEffect(gates, GATES_config.creategates_effect)
  91. doCreateItem(GATES_config.gates_itemid, 1, gates)
  92. end
  93. return true
  94. end
  95.  
  96. function getGateWinners()
  97. local winners = {}
  98. for cid, player in ipairs(getPlayersOnline()) do
  99. if isPlayer(player) then
  100. if (getPlayerStorageValue(player, GATES_config.tile_storage) ~= -1) then
  101. table.insert(winners, player)
  102. end
  103. end
  104. end
  105. return winners
  106. end
  107.  
  108. function gatesCloseWin()
  109. for table, gates in ipairs(GATES_config.open_eventstone) do
  110. doSendMagicEffect(gates, GATES_config.creategates_effect)
  111. doCreateItem(GATES_config.gates_itemidstone, 1, gates)
  112. doBroadcastMessage("[Desert Exp]: Os pilares foram Criados novamente!", 21)
  113. end
  114. return true
  115. end
  116.  
  117. function gatesStartWin()
  118. for table, gates in ipairs(GATES_config.open_eventstone) do
  119. doSendMagicEffect(gates, GATES_config.removegates_effect)
  120. doRemoveItem(getTileItemById(gates, GATES_config.gates_itemidstone).uid)
  121. doBroadcastMessage("[Desert Exp]: Os pilares foram removidos, aparecerão em 20 segundos!", 21)
  122. end
  123. return true
  124. end
  125.  
  126.  
  127. function gatesStartGuild()
  128. for table, gates in ipairs(GATES_config.open_eventgatesguild) do
  129. doSendMagicEffect(gates, GATES_config.removegates_effect)
  130. doRemoveItem(getTileItemById(gates, GATES_config.gates_itemid).uid)
  131. end
  132. return true
  133. end
  134.  
  135. function gatesCloseGuild()
  136. for table, gates in ipairs(GATES_config.open_eventgatesguild) do
  137. doSendMagicEffect(gates, GATES_config.creategates_effect)
  138. doCreateItem(GATES_config.gates_itemid, 1, gates)
  139. end
  140. return true
  141. end
  142.  
  143. function gatesStartWinGuild()
  144. for table, gates in ipairs(GATES_config.open_eventstoneguild) do
  145. doSendMagicEffect(gates, GATES_config.removegates_effect)
  146. doRemoveItem(getTileItemById(gates, GATES_config.gates_itemid).uid)
  147. end
  148. return true
  149. end
  150.  
  151. function gatesCloseWinGuild()
  152. for table, gates in ipairs(GATES_config.open_eventstoneguild) do
  153. doSendMagicEffect(gates, GATES_config.creategates_effect)
  154. doCreateItem(GATES_config.gates_itemid, 1, gates)
  155. end
  156. return true
  157. end
  158.  
  159. function gatesStart()
  160. if (getGlobalStorageValue(GATES_config.started_storage) ~= -1) then
  161. if (getGlobalStorageValue(GATES_config.times_storage) == GATES_config.warning_times) then
  162. for table, gates in ipairs(GATES_config.open_eventgates) do
  163. doSendMagicEffect(gates, GATES_config.removegates_effect)
  164. doRemoveItem(getTileItemById(gates, GATES_config.gates_itemid).uid)
  165. end
  166. doBroadcastMessage("[Desert Exp]: Os portões foram abertos!", 21)
  167. addEvent(gatesClose, GATES_config.event_duration)
  168. addEvent(gatesStartWin, GATES_config.event_duration)
  169. addEvent(gatesCloseWin, GATES_config.event_closewin)
  170. addEvent(gatesStartGuild, GATES_config.eventguild_duration)
  171. addEvent(gatesCloseGuild, GATES_config.eventguildclose_duration)
  172. addEvent(gatesStartWinGuild, GATES_config.eventguildclose_duration)
  173. addEvent(gatesCloseWinGuild, GATES_config.eventguildvencedor_duration)
  174. end
  175. end
  176. return true
  177. end
  178.  
  179. function warningStart()
  180. if (getGlobalStorageValue(GATES_config.times_storage) == GATES_config.warning_times) then
  181. gatesStart()
  182. return true
  183. end
  184. doBroadcastMessage("[Desert Exp]: Os portões serão abertos em "..(GATES_config.warning_times - getGlobalStorageValue(GATES_config.times_storage)).." minuto(s)!", 21)
  185. setGlobalStorageValue(GATES_config.times_storage, (getGlobalStorageValue(GATES_config.times_storage) + 1))
  186. return addEvent(warningStart, 1 * 30 * 1000)
  187. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement