Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- GATES_config = {
- --// Apenas mexa aqui, CONFIGS -- // ]]
- warning_times = 2, -- Tempo até iniciar o evento, exemplo: (19:50 > 20:00 = 10);
- event_duration = 60000, -- Duração do evento (Padrão 1 hora.);
- removegates_effect = 3, -- Effect ao remover os portões;
- creategates_effect = 11, -- Effect ao criar os portões;
- time_winnersopen = 2 * 1000, -- Tempo para abrir o portão dos vencedores;
- time_winnersclose = 2 * 1000, -- Tempo pra fechar o portão dos perdedores;
- gates_itemid = 1544, -- ItemID dos portões;
- 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;
- position_tilewin = {x = 1739, y = 1492, z = 3}, -- Position do TILE pra ganhar o evento;
- position_winners = {x = 1739, y = 1484, z = 3}, -- Position aonde os vencedores vão após vencerem;
- open_eventgates = { -- // Abaixo as posições dos portões do evento;
- {x = 1675, y = 1478, z = 4, stackpos = 1},
- {x = 1676, y = 1478, z = 4, stackpos = 1},
- {x = 1677, y = 1478, z = 4, stackpos = 1},
- {x = 1678, y = 1478, z = 4, stackpos = 1},
- {x = 1679, y = 1478, z = 4, stackpos = 1},
- {x = 1680, y = 1478, z = 4, stackpos = 1},
- {x = 1675, y = 1482, z = 5, stackpos = 1},
- {x = 1676, y = 1482, z = 5, stackpos = 1},
- {x = 1677, y = 1482, z = 5, stackpos = 1},
- {x = 1678, y = 1482, z = 5, stackpos = 1},
- {x = 1679, y = 1482, z = 5, stackpos = 1},
- {x = 1739, y = 1492, z = 3, stackpos = 1},
- {x = 1740, y = 1492, z = 3, stackpos = 1},
- },
- open_winnersgates = { -- Abaixo as posições dos portões dos vencedores;
- {x = 1700, y = 1516, z = 5, stackpos = 1},
- {x = 1701, y = 1516, z = 5, stackpos = 1},
- },
- --// Não mexa daqui para baixo em NADA! -- // ]]
- times_storage = 181491,
- started_storage = 181492,
- tile_storage = 181493,
- }
- function gatesClose()
- for table, gates in ipairs(GATES_config.open_eventgates) do
- doSendMagicEffect(gates, GATES_config.creategates_effect)
- doCreateItem(GATES_config.gates_itemid, 1, gates)
- end
- for cid, player in ipairs(getGateWinners()) do
- doSendMagicEffect(getThingPos(player), 13)
- doTeleportThing(player, GATES_config.position_winners, true)
- end
- addEvent(gatesWinnersOpen, GATES_config.time_winnersopen)
- addEvent(gatesWinnersClose, GATES_config.time_winnersclose)
- addEvent(setGlobalStorageValue, 5 * 1000, GATES_config.started_storage, -1)
- addEvent(setGlobalStorageValue, 5 * 1000, GATES_config.times_storage, -1)
- doBroadcastMessage("[Castle of War]: Os portões do castle foram trancados!", 21)
- return true
- end
- function gatesWinnersOpen()
- for table, gates in ipairs(GATES_config.open_winnersgates) do
- doSendMagicEffect(gates, GATES_config.removegates_effect)
- doRemoveItem(getTileItemById(gates, GATES_config.gates_itemid).uid)
- end
- return true
- end
- function gatesWinnersClose()
- for table, gates in ipairs(GATES_config.open_winnersgates) do
- doSendMagicEffect(gates, GATES_config.creategates_effect)
- doCreateItem(GATES_config.gates_itemid, 1, gates)
- end
- return true
- end
- function getGateWinners()
- local winners = {}
- for cid, player in ipairs(getPlayersOnline()) do
- if isPlayer(player) then
- if (getPlayerStorageValue(player, GATES_config.tile_storage) ~= -1) then
- table.insert(winners, player)
- end
- end
- end
- return winners
- end
- function gatesStart()
- if (getGlobalStorageValue(GATES_config.started_storage) ~= -1) then
- if (getGlobalStorageValue(GATES_config.times_storage) == GATES_config.warning_times) then
- for table, gates in ipairs(GATES_config.open_eventgates) do
- doSendMagicEffect(gates, GATES_config.removegates_effect)
- doRemoveItem(getTileItemById(gates, GATES_config.gates_itemid).uid)
- end
- doBroadcastMessage("[Castle of War]: Os portões do castle foram abertos!", 21)
- addEvent(gatesClose, GATES_config.event_duration)
- end
- end
- return true
- end
- function warningStart()
- if (getGlobalStorageValue(GATES_config.times_storage) == GATES_config.warning_times) then
- gatesStart()
- return true
- end
- doBroadcastMessage("[Castle of War]: Será aberto em "..(GATES_config.warning_times - getGlobalStorageValue(GATES_config.times_storage)).." minuto(s).", 21)
- setGlobalStorageValue(GATES_config.times_storage, (getGlobalStorageValue(GATES_config.times_storage) + 1))
- return addEvent(warningStart, 1 * 60 * 1000)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement