Ir para conteúdo

Featured Replies

Postado

.Qual servidor ou website você utiliza como base? 

TFS 0.4

Qual o motivo deste tópico? 

Gostaria de pedir a voces que me ajudassem a corrigir esse problema que esotu tendo.

Está surgindo algum erro? Se sim coloque-o aqui. 

Citar

Bom pessoal, bom dia a todos, estou tendo um problema com o evento War Of Emperium, famoso WOE, ele está funcionando perfeitamente exceto pelo detalhe de que ao finalizar o castelo ele reinicia tendo que aguardar mais 40 minutos (tempo cetado) para finalizar mais uma vez e ai sim concluir o evento. Se alguem puder dar uma força, acredito ser algo simples que corrija isso, agradeço a atenção de todos, obrigado!

 

 

  • Respostas 6
  • Visualizações 198
  • Created
  • Última resposta

Top Posters In This Topic

Postado
  • Autor

Var.woe

Spoiler

Castle, woe_config, stor = {}, {}, {}
    
--castle name (?)
Castle.name = 'Cyber Castle'

--aid of entry.
Castle.tiles = 3131

--aid for created portals.
Castle.portals = 3132

--aid of flags in castle.
Castle.banderas = 3133

--aid of empes bases.
Castle.bases = 3134

--uids in case you have decorations with info.
Castle.decoraciones = {}

--where you teleported from temple.
Castle.pos = {x = 55, y = 79, z = 7}

--where players are teleported when finished or castle owner change.
Castle._exit = {x = 1028, y = 1024, z = 7}

--where portal appears
Castle.desde = {x = 1023, y = 1026, z = 7, stackpos = 1}

--true / false
default_map = true
--if you will not use default map you should config all the pos.

--main empe pos => with this pos all castle pos will be calculated (default map only)
Castle.empePos = {x = 55, y = 34, z = 5, stackpos = 253}

if default_map then
    local pos = Castle.empePos
    
    --entry for guild by using flags.
    Castle.guildEntry = {x = pos.x - 9, y = pos.y + 4, z = pos.z}
    
    --each floor should be all floor.
    Castle.salas = 
        {
            a = {fromx = pos.x - 18, tox = pos.x + 18, fromy = pos.y - 10, toy =  pos.y + 28, z = pos.z + 2},
            b = {fromx = pos.x - 18, tox = pos.x + 18, fromy = pos.y - 10, toy =  pos.y + 28, z = pos.z + 1},
            c = {fromx = pos.x - 18, tox = pos.x + 18, fromy = pos.y - 10, toy =  pos.y + 28, z = pos.z}
        }

    --pre empes pos
    Castle.PreEmpes = 
        {
            {x = pos.x - 13, y = pos.y + 3, z = pos.z + 1, stackpos = 253}, 
            {x = pos.x + 13, y = pos.y + 3, z = pos.z + 1, stackpos = 253}
        }

    --when you kill pre empes new portals appears.
    Castle.PrePortalsPos = 
        {
            {x = pos.x - 4, y =  pos.y - 6, z = pos.z + 1, stackpos = 1},
            {x = pos.x + 4, y =  pos.y - 6, z = pos.z + 1, stackpos = 1}
        }

    Castle.PreToPos = 
        {
            [1] = {x = pos.x - 7, y =  pos.y + 26, z = pos.z},
            [2] = {x = pos.x + 7, y =  pos.y + 26, z = pos.z}
        }

else
--edit those if not using default map
--read above to know what is everything.
--break this comment to use [...]
--[[
    Castle.guildEntry = {x = 46, y = 38, z = 5}
            
    Castle.salas = 
        {
            a = {fromx=37, tox=73, fromy=24, toy=62, z=7},
            b = {fromx=37, tox=73, fromy=24, toy=62, z=6},
            c = {fromx=37, tox=73, fromy=24, toy=62, z=5}
        }

    Castle.PreEmpes = 
        {
            {x=42, y=37, z=6, stackpos=253}, 
            {x=68, y=37, z=6, stackpos=253}
        }

    Castle.PrePortalsPos = 
        {
            {x=51, y=28, z=6, stackpos=1},
            {x=59, y=28, z=6, stackpos=1}
        }

    Castle.PreToPos = 
        {
            [1] = {x = 48, y = 60, z = 5},
            [2] = {x = 62, y = 60, z = 5}
        }
]]
end

--duration
woe_config.timeToEnd = 40

--bc type
woe_config.bcType = MESSAGE_EVENT_ADVANCE

--days
woe_config.dias = {"tuesday", "thursday", "saturday"}

--time to start
woe_config.horaPartida = 20

--access to start
woe_config.accessToStar = 4

--recall delay
woe_config.recallTime = 3 * 60

--rewards for winners
woe_config.premios = true

--storage for register players    
stor.register = 8589

--recall delay stor
stor.recall = 23155

--global stor started
stor.Started = 7801

--global stor [...]
stor.WoeTime = 7802
 

 

woe.lua (talkaction)

Spoiler

dofile("./_woe.lua")

local config = woe_config

function onSay(cid, words, param)

    if words == "/woe" and param == "/!/SETUP" then
        Woe.setup()
        return true
    end
    
    Woe.getInfo()
    
    local myTable = {}
    
    for _, i in ipairs({"%d", "%B", "%Y", "%X"}) do
        table.insert(myTable, os.date(i, infoLua[4]))
    end
    
    if Woe.isStarted() then
        text = "time left = " ..  Woe.timeToEnd().mins .. ":" .. Woe.timeToEnd().secs .. "\nAtualmente o " .. Castle.name .. " pertence a " .. Woe.guildName() .. ".\n" .. Woe.breakerName() .. " broke the empe at "..myTable[1].." / "..myTable[2].." / "..myTable[3].." at time "..myTable[4].."."
    else
        text = "O ultimo castelo foi conquistado por " .. Woe.guildName() .. ".\n" .. Woe.breakerName() .. " broke the empe at "..myTable[1].." / "..myTable[2].." / "..myTable[3].." at time "..myTable[4].."."
    end

    if words == "/woe" then
        if getPlayerAccess(cid) >= config.accessToStar then
            if param == "on" then
                if Woe.isTime() ~= true then
                    doBroadcastMessage("A luta pelo castelo se iniciou!", config.bcType)
                    doBroadcastMessage("E tera a duracao de " .. config.timeToEnd .. " minutos.", config.bcType)
                    setGlobalStorageValue(stor.WoeTime, 1)
                else
                    doPlayerSendCancel(cid, "A luta pelo castelo esta acontencendo!")
                end
            elseif param == "off" then
                if Woe.isTime() == true then
                    doBroadcastMessage("A luta pelo castelo foi cancelada...", config.bcType)
                    setGlobalStorageValue(stor.WoeTime, 0)
                    setGlobalStorageValue(stor.Started, 0)
                    if isCreature(getThingFromPos(Castle.empePos).uid) == TRUE then
                        doRemoveCreature(getThingFromPos(Castle.empePos).uid)
                    end
                    if getThingFromPos(Castle.desde).itemid > 0 then
                        doRemoveItem(getThingFromPos(Castle.desde).uid)
                    end
                    Woe.removePre()
                    Woe.removePortals()
                else
                    doPlayerSendCancel(cid, "A luta pelo castelo nao esta acontencendo.")
                end
            elseif param == "empe" then
                doSummonCreature("empe", Castle.empePos)
            elseif param == "go" then
                local newPos = Castle.empePos
                newPos.y = newPos.y + 1
                doTeleportThing(cid, newPos, FALSE)
            elseif param == "info" then
                doPlayerPopupFYI(cid, text)
            else
                doPlayerSendCancel(cid, "Parametro invalido.")
            end
        elseif getPlayerAccess(cid) < config.accessToStar then
            if param == "info" then
                doPlayerPopupFYI(cid, text)
            end
        else
            doPlayerSendCancel(cid, "Nao e possivel.")
        end    
    elseif words == "!recall" then
        if Woe.isStarted() == true then
            if getPlayerGuildLevel(cid) == GUILDLEVEL_LEADER then
                if Woe.isInCastle(cid) == true then
                    local members = Woe.getGuildMembers(getPlayerGuildId(cid))
                    if #members > 1 then
                        if(exhaust(cid, stor.recall, config.recallTime) == 1) then
                            for _, i in ipairs(members) do
                                if getPlayerGuildLevel(i) ~= GUILDLEVEL_LEADER then
                                    local pos = getClosestFreeTile(cid, getCreaturePosition(cid), FALSE, TRUE)
                                    doTeleportThing(i, pos, FALSE)
                                end
                            end
                            doCreatureSay(cid, "Emergency Recall", TALKTYPE_SAY)
                        else
                            doPlayerSendCancel(cid, "you can only use this every " .. config.recallTime / 60 .. " minutes.")
                        end        
                    else
                        doPlayerSendCancel(cid, "Nao ha membros online.")
                    end
                else
                    doPlayerSendCancel(cid, "So pode ser usado no castelo.")
                end
            else
                doPlayerSendCancel(cid, "Voce nao e o leader.")
            end
        else
            doPlayerSendCancel(cid, "A luta pelo castelo nao esta acontecendo.")
        end
    end
    return true
end
 

 

woetiles.lua (movements)
 

Spoiler

dofile("./_woe.lua")

function onStepIn(cid, item, position, fromPosition)
    if item.actionid == Castle.tiles then
        Woe.getInfo()
        if isPlayer(cid) then
            if Woe.isTime() then
                if getPlayerGuildId(cid) ~= 0 then
                    if Woe.isRegistered(cid) then
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Boa sorte ".. getCreatureName(cid) .."!")
                    else
                        Woe.moveBack(cid, fromPosition, "Voce nao esta registrado, utilize o comando !guild")
                    end            
                else
                    Woe.moveBack(cid, fromPosition, "Apenas players com guild podem disputar o castelo.")
                end
            elseif getPlayerGuildId(cid) == infoLua[2] then
                if Woe.isRegistered(cid) then
                    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Bem vindo ".. getCreatureName(cid) ..".")
                else
                    Woe.moveBack(cid, fromPosition, "Voce nao esta registrado, utilize o comando !guild")
                end            
            else
                Woe.moveBack(cid, fromPosition, "O castelo nao esta em disputa e voce nao e membro da ".. Woe.guildName() ..".")
            end
        end
    elseif item.actionid == Castle.portals then
        doTeleportThing(cid, Castle.PreToPos[math.random(1, 2)], false)
    elseif item.actionid == Castle.bases then
        if isPlayer(cid) then
            Woe.moveBack(cid, fromPosition, "you cant step there.")
        end
    end
    return true
end

function onAddItem(moveitem, tileitem, position)
    doRemoveItem(moveitem.uid, moveitem.type > 0 and moveitem.type or 1)
    return true
end
 

 

woe.lua (globalevents)
 

Spoiler

dofile("./_woe.lua")

local config = woe_config

local reward = 200000 -- 200k

local function EndWoe()
    Woe.getInfo()
        
    setGlobalStorageValue(stor.Started, 0)
    setGlobalStorageValue(stor.WoeTime, 0)
    
    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)
    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)
    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)
    
    doBroadcastMessage("A luta pelo castelo acabou!", config.bcType)
    doBroadcastMessage("O " .. Castle.name .. " pertence a ".. Woe.guildName() ..".", config.bcType)
    
    if isCreature(getThingFromPos(Castle.empePos).uid) then
        doRemoveCreature(getThingFromPos(Castle.empePos).uid)
    end
    
    Woe.removePre()
    Woe.removePortals()
    
    doRemoveItem(getThingFromPos(Castle.desde).uid)
    
    Woe.save()
    
    for _, cid in ipairs(getPlayersOnline()) do
        if infoLua[2] == getPlayerGuildId(cid) then
            doPlayerAddMoney(cid, reward)
        end
    end
    
    Woe.remove()
    setGlobalStorageValue(24503, -1)
    
end

function onThink(interval, lastExecution)
    Woe.getInfo()
    if Woe.isTime() then
        if not Woe.isStarted() then
            doSummonCreature("empe", Castle.empePos)
            doSummonCreature("pre1", Castle.PreEmpes[1])
            doSummonCreature("pre2", Castle.PreEmpes[2])
            doBroadcastMessage("War has started...", config.bcType)
            setGlobalStorageValue(stor.Started, 1)
            Woe.updateInfo({os.time(), infoLua[2], infoLua[3], infoLua[4]})
            doCreateTeleport(1387, Castle.pos, Castle.desde)
            addEvent(EndWoe, config.timeToEnd * 60 * 1000)
        end
    end
    return true
end     

 

woe.lua (actions)

Spoiler

dofile("./_woe.lua")

local delays = 60

local guards_price = 30000    --30k

function onUse(cid, item, fromPosition, itemEx, toPosition)
    Woe.getInfo()
    if item.actionid == Castle.banderas then
        if Woe.isTime() then
            if Woe.isStarted() then
                if infoLua[2] == getPlayerGuildId(cid) then
                    doTeleportThing(cid, Castle.guildEntry, false)
                else
                    doPlayerSendCancel(cid, "Voce nao e membro da ".. Woe.guildName() ..".")
                end
            end
        else
            if infoLua[2] == getPlayerGuildId(cid) then
                doTeleportThing(cid, Castle.guildEntry, false)
            else
                doPlayerSendCancel(cid, "Voce nao e membro da ".. Woe.guildName() ..".")
            end
        end
    elseif (item.uid == 3134) then
        if not Woe.isStarted() or (infoLua[2] ~= getPlayerGuildId(cid)) or (getPlayerGuildLevel(cid) ~= GUILDLEVEL_LEADER) then
            return true
        end
        if (getPlayerMoney(cid) < guards_price) then
            return doPlayerSendCancel(cid, "Dinheiro insuficiente.")
        end
        local varDelay = getGlobalStorageValue(24503)
        if (varDelay < 0) or ((os.time() - varDelay) >= delays) then
            if Woe.check() then
                Woe.summon()
                doPlayerRemoveMoney(cid, guards_price)
            else
                doPlayerSendCancel(cid, "Ainda ha guardas vivos.")
            end
        else
            doPlayerSendCancel(cid, "Delay no listo.")
        end
    end
    return true
end 
 


Se puder ajudar, o evento inicia sempre as 20:00 e termina as 20:41 o problema é que ao terminar, ele reinicia o evento e começa tudo novamente, dai nessa segunda vez ao finalizar ele realmente encerra.

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo