Advertisement
Guest User

DESERT

a guest
May 27th, 2015
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.61 KB | None | 0 0
  1. GATESEXP_config = {
  2. --// Apenas mexa aqui, CONFIGS -- // ]]
  3. warningexp_times = 1, -- Tempo até iniciar o evento, exemplo: (19:50 > 20:00 = 10);
  4. eventexp_duration = 60000, -- Duração do evento (Padrão 1 hora.);
  5. eventexp_closewin = 80000, -- Duração do evento (Padrão 1 hora.);
  6. removegatesexp_effect = 3, -- Effect ao remover os portões;
  7. creategatesexp_effect = 5, -- Effect ao criar os portões;
  8. timeexp_winnersopen = 1 * 1000, -- Tempo para abrir o portão dos vencedores;
  9. timeexp_winnersclose = 1 * 1000, -- Tempo pra fechar o portão dos perdedores;
  10. gatesexp_itemid = 1544, -- ItemID dos portões;
  11. gatesexp_itemidstone = 1561, -- ItemID da pedra do trono;
  12. datesexp_start = {"Sunday-07:18", "Tuesday-10:50", "Monday-10:50", "Wednesday-07:32", "Thursday-10:50", "Friday-10:50", "Saturday-23:50"}, -- Datas do evento;
  13. openexp_eventgates = { -- // Abaixo as posições dos portões do evento;
  14. {x = 9744, y = 10135, z = 4, stackpos = 1},
  15. {x = 9745, y = 10135, z = 4, stackpos = 1},
  16. {x = 9746, y = 10135, z = 4, stackpos = 1},
  17. {x = 9747, y = 10135, z = 4, stackpos = 1},
  18. {x = 9748, y = 10135, z = 4, stackpos = 1},
  19. {x = 9749, y = 10135, z = 4, stackpos = 1},
  20. {x = 9750, y = 10135, z = 4, stackpos = 1},
  21. {x = 9751, y = 10135, z = 4, stackpos = 1},
  22. {x = 9752, y = 10135, z = 4, stackpos = 1},
  23. {x = 9753, y = 10135, z = 4, stackpos = 1},
  24. {x = 9754, y = 10135, z = 4, stackpos = 1},
  25. {x = 9847, y = 10022, z = 4, stackpos = 1},
  26. },
  27. open_eventstone = { -- // Abaixo as posições dos portões que abre qdo o evento termina;
  28. {x = 9847, y = 10021, z = 4, stackpos = 1},
  29. {x = 9847, y = 10020, z = 4, stackpos = 1},
  30. },
  31. openexp_winnersgates = { -- Abaixo as posições dos portões dos vencedores;
  32. {x = 1095, y = 1023, z = 7, stackpos = 1},
  33. },
  34. --// Não mexa daqui para baixo em NADA! -- // ]]
  35. timesexp_storage = 120491,
  36. startedexp_storage = 120492,
  37. tileexp_storage = 120493,
  38. }
  39.  
  40. function gatesCloseExp()
  41. for table, gates in ipairs(GATESEXP_config.openexp_eventgates) do
  42. doSendMagicEffect(gates, GATESEXP_config.creategatesexp_effect)
  43. doCreateItem(GATESEXP_config.gatesexp_itemid, 1, gates)
  44. end
  45. for cid, player in ipairs(getGateWinnersExp()) do
  46. doSendMagicEffect(getThingPos(player), 13)
  47. doTeleportThing(player, GATESEXP_config.positionexp_winners, true)
  48. end
  49. addEvent(gatesWinnersOpenExp, GATESEXP_config.timeexp_winnersopen)
  50. addEvent(gatesWinnersCloseEXP, GATESEXP_config.timeexp_winnersclose)
  51. addEvent(setGlobalStorageValue, 5 * 1000, GATESEXP_config.startedexp_storage, -1)
  52. addEvent(setGlobalStorageValue, 5 * 1000, GATESEXP_config.timesexp_storage, -1)
  53. doBroadcastMessage("[Desert Exp]: Os portões do desert foram trancados!", 21)
  54. return true
  55. end
  56.  
  57. function gatesWinnersOpenExp()
  58. for table, gates in ipairs(GATESEXP_config.openexp_winnersgates) do
  59. doSendMagicEffect(gates, GATESEXP_config.removegatesexp_effect)
  60. doRemoveItem(getTileItemById(gates, GATESEXP_config.gatesexp_itemid).uid)
  61. end
  62. return true
  63. end
  64.  
  65. function gatesWinnersCloseExp()
  66. for table, gates in ipairs(GATESEXP_config.openexp_winnersgates) do
  67. doSendMagicEffect(gates, GATESEXP_config.creategatesexp_effect)
  68. doCreateItem(GATESEXP_config.gatesexp_itemid, 1, gates)
  69. end
  70. return true
  71. end
  72.  
  73. function getGateWinnersExp()
  74. local winners = {}
  75. for cid, player in ipairs(getPlayersOnline()) do
  76. if isPlayer(player) then
  77. if (getPlayerStorageValue(player, GATESEXP_config.tileexp_storage) ~= -1) then
  78. table.insert(winners, player)
  79. end
  80. end
  81. end
  82. return winners
  83. end
  84.  
  85. function gatesCloseWinExp()
  86. for table, gates in ipairs(GATESEXP_config.openexp_eventstone) do
  87. doSendMagicEffect(gates, GATESEXP_config.creategatesexp_effect)
  88. doCreateItem(GATESEXP_config.gatesexp_itemidstone, 1, gates)
  89. end
  90. return true
  91. end
  92.  
  93. function gatesStartWinExp()
  94. for table, gates in ipairs(GATESEXP_config.openexp_eventstone) do
  95. doSendMagicEffect(gates, GATESEXP_config.removegatesexp_effect)
  96. doRemoveItem(getTileItemById(gates, GATESEXP_config.gatesexp_itemidstone).uid)
  97. end
  98. return true
  99. end
  100. function gatesStartExp()
  101. if (getGlobalStorageValue(GATESEXP_config.startedexp_storage) ~= -1) then
  102. if (getGlobalStorageValue(GATESEXP_config.timesexp_storage) == GATESEXP_config.warningexp_times) then
  103. for table, gates in ipairs(GATESEXP_config.openexp_eventgates) do
  104. doSendMagicEffect(gates, GATESEXP_config.removegatesexp_effect)
  105. doRemoveItem(getTileItemById(gates, GATESEXP_config.gatesexp_itemid).uid)
  106. end
  107. doBroadcastMessage("[Desert Exp]: Os portões foram abertos!", 21)
  108. addEvent(gatesCloseExp, GATESEXP_config.eventexp_duration)
  109. addEvent(gatesStartWinExp, GATESEXP_config.eventexp_duration)
  110. addEvent(gatesCloseWinExp, GATESEXP_config.eventexp_closewin)
  111. end
  112. end
  113. return true
  114. end
  115.  
  116. function warningStartExp()
  117. if (getGlobalStorageValue(GATESEXP_config.timesexp_storage) == GATESEXP_config.warningexp_times) then
  118. gatesStartExp()
  119. return true
  120. end
  121. doBroadcastMessage("[Desert Exp]: Os portões serão abertos em "..(GATESEXP_config.warningexp_times - getGlobalStorageValue(GATESEXP_config.timesexp_storage)).." minuto(s)!", 21)
  122. setGlobalStorageValue(GATESEXP_config.timesexp_storage, (getGlobalStorageValue(GATESEXP_config.timesexp_storage) + 1))
  123. return addEvent(warningStartExp, 1 * 30 * 1000)
  124. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement