adrianoswatt

Woe 01 - ClassicBrTibia

Oct 19th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 2.16 KB | None | 0 0
  1. dofile("./_woe.lua")
  2. local config = woe_config
  3. local guildGlobalSto = 25666
  4. local reward = 100000 -- 1kk
  5.  
  6. local function EndWoe()
  7.     Woe.getInfo()        
  8.     setGlobalStorageValue(stor.Started, 0)
  9.     setGlobalStorageValue(stor.WoeTime, 0)    
  10.     Woe.expulsar(infoLua[2], Castle.salas.a.fromx, Castle.salas.a.tox, Castle.salas.a.fromy, Castle.salas.a.toy, Castle.salas.a.z, Castle._exit)
  11.     Woe.expulsar(infoLua[2], Castle.salas.b.fromx, Castle.salas.b.tox, Castle.salas.b.fromy, Castle.salas.b.toy, Castle.salas.b.z, Castle._exit)
  12.     Woe.expulsar(infoLua[2], Castle.salas.c.fromx, Castle.salas.c.tox, Castle.salas.c.fromy, Castle.salas.c.toy, Castle.salas.c.z, Castle._exit)    
  13.     doBroadcastMessage("WoE is finished", config.bcType)
  14.     doBroadcastMessage("The castle " .. Castle.name .. " is owned by ".. Woe.guildName() ..".", config.bcType)    
  15.     if isCreature(getThingFromPos(Castle.empePos).uid) then
  16.         doRemoveCreature(getThingFromPos(Castle.empePos).uid)
  17.     end    
  18.     Woe.removePre()
  19.     Woe.removePortals()    
  20.     doRemoveItem(getThingFromPos(Castle.desde).uid)    
  21.     Woe.save()    
  22.     for _, cid in ipairs(getPlayersOnline()) do
  23.         if getGlobalStorageValue(guildGlobalSto) == getPlayerGuildId(cid) and getPlayerLevel(cid) >= 80 then
  24.             doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Congratulations, you have received "..reward.." gold coins.")
  25.             doPlayerAddMoney(cid, reward)
  26.         end
  27.     end
  28.     Woe.remove()
  29.     setGlobalStorageValue(24503, -1)
  30.    
  31. end
  32.  
  33. function onThink(interval, lastExecution)
  34.     Woe.getInfo()
  35.     if Woe.isTime() then
  36.         if not Woe.isStarted() then
  37.             doSummonCreature("empe", Castle.empePos)
  38.             doSummonCreature("pre1", Castle.PreEmpes[1])
  39.             doSummonCreature("pre2", Castle.PreEmpes[2])
  40.             doBroadcastMessage("War has started...", config.bcType)
  41.             setGlobalStorageValue(stor.Started, 1)
  42.             Woe.updateInfo({os.time(), infoLua[2], infoLua[3], infoLua[4]})
  43.             doCreateTeleport(1387, Castle.pos, Castle.desde)
  44.             addEvent(EndWoe, config.timeToEnd * 60 * 1000)
  45.         end
  46.     end
  47.     return true
  48. end
Add Comment
Please, Sign In to add comment