Amantezinho 18 Postado Outubro 9, 2015 Share Postado Outubro 9, 2015 Acabei de passar por uma dificil imigração do sistema de Cooldown bar do Erodino para meu projeto, porém há um erro no cdBar.lua do client, creio eu! IMAGEM Legenda: É a Cooldown Bar com os ícones, está funcionando direito as funções m1-m12 por ela. Porém, sem girar aquele reloginho. É o Cooldown (ou será exhaustion?) dos moves rodando. É o que me aparece no Terminal do OTClient. PS: Na executável do server não aparece nada sobre erro do reloginho cdBar.lua do OTclient: -- Privates variables local cdBarWin = nil local isIn = 'H' --[[ 'H' = horizontal; 'V' = vertical ]]-- local namesAtks = '' local icons = {} -- End privates variables -- Public functions function init() cdBarWin = g_ui.displayUI('cdBar', modules.game_interface.getRootPanel()) cdBarWin:setVisible(false) cdBarWin:move(250,50) connect(g_game, 'onTextMessage', getParams) connect(g_game, { onGameEnd = hide } ) connect(LocalPlayer, { onLevelChange = onLevelChange }) g_mouse.bindPress(cdBarWin, function() createMenu() end, MouseRightButton) createIcons() end function terminate() disconnect(g_game, { onGameEnd = hide }) disconnect(g_game, 'onTextMessage', getParams) disconnect(LocalPlayer, { onLevelChange = onLevelChange }) destroyIcons() cdBarWin:destroy() end function onLevelChange(localPlayer, value, percent) g_game.talk("!cd") end function getParams(mode, text) if not g_game.isOnline() then return end if mode == MessageModes.Failure then if string.find(text, '12//,') then if string.find(text, 'hide') then hide() else show() end elseif string.find(text, '12|,') then atualizarCDs(text) elseif string.find(text, '12&,') then FixTooltip(text) end end end function atualizarCDs(text) if not g_game.isOnline() then return end if not cdBarWin:isVisible() then return end local t = text:explode(",") table.remove(t, 1) for i = 1, 12 do local t2 = t:explode("|") barChange(i, tonumber(t2[1]), tonumber(t2[2]), tonumber(t2[3])) end end function changePercent(progress, icon, perc, num, init) if not cdBarWin:isVisible() then return end if init then progress:setPercent(0) else progress:setPercent(progress:getPercent()+perc) end if progress:getPercent() >= 100 then progress:setText("") return end progress:setText(num) icons[icon:getId()].event = scheduleEvent(function() changePercent(progress, icon, perc, num-1) end, 1000) end function barChange(ic, num, lvl, lvlPoke) if not g_game.isOnline() then return end if not cdBarWin:isVisible() then return end local icon = icons['Icon'..ic].icon local progress = icons['Icon'..ic].progress if not progress:getTooltip() then return end local player = g_game.getLocalPlayer() local pathOn = "moves_icon/"..progress:getTooltip().."_on.png" icon:setImageSource(pathOn) if num and num >= 1 then cleanEvents('Icon'..ic) changePercent(progress, icon, 100/num, num, true) else if (lvlPoke and lvlPoke < lvl) or player:getLevel() < lvl then progress:setPercent(0) progress:setText('L.'.. lvl) progress:setColor('#FF0000') else progress:setPercent(100) progress:setText("") end end end function FixTooltip(text) cdBarWin:setHeight(isIn == 'H' and 416 or 40) cdBarWin:setWidth(isIn == 'H' and 40 or 416) if not text then text = namesAtks else namesAtks = text end local t2 = text:explode(",") local count = 0 for j = 2, 13 do local ic = icons['Icon'..(j-1)] ic.icon:setMarginLeft(isIn == 'H' and 4 or ic.dist) ic.icon:setMarginTop(isIn == 'H' and ic.dist or 4) if t2[j] == 'n/n' then ic.icon:hide() count = count+1 else ic.icon:show() ic.progress:setTooltip(t2[j]) ic.progress:setVisible(true) end end if count > 0 and count ~= 12 then if isIn == "H" then cdBarWin:setHeight(416 - (count*34)) else cdBarWin:setWidth(416 - (count*34)) end elseif count == 12 then cdBarWin:setHeight(40) cdBarWin:setWidth(40) local p = icons['Icon1'].progress p:setTooltip(false) p:setVisible(false) end end function createIcons() local d = 38 for i = 1, 12 do local icon = g_ui.createWidget('SpellIcon', cdBarWin) local progress = g_ui.createWidget('SpellProgress', cdBarWin) icon:setId('Icon'..i) progress:setId('Progress' ..i) icons['Icon'..i] = {icon = icon, progress = progress, dist = (i == 1 and 5 or i == 2 and 38 or d + ((i-2)*34)), event = nil} icon:setMarginTop(icons['Icon'..i].dist) icon:setMarginLeft(4) progress:fill(icon:getId()) progress.onClick = function() g_game.talk('m'..i) end end end function destroyIcons() for i = 1, 12 do icons['Icon'..i].icon:destroy() icons['Icon'..i].progress:destroy() end cleanEvents() icons = {} end function cleanEvents(icon) local e = icons[icon] if icon then if e and e.event ~= nil then removeEvent(e.event) e.event = nil end else for i = 1, 12 do e = icons['Icon'..i] cleanEvents('Icon'..i) e.progress:setPercent(100) e.progress:setText("") end end end function createMenu() local menu = g_ui.createWidget('PopupMenu') menu:addOption("Set "..(isIn == 'H' and 'Vertical' or 'Horizontal'), function() toggle() end) menu:display() end function toggle() if not cdBarWin:isVisible() then return end cdBarWin:setVisible(false) if isIn == 'H' then isIn = 'V' else isIn = 'H' end FixTooltip() show() end function hide() cleanEvents() cdBarWin:setVisible(false) end function show() cdBarWin:setVisible(true) end -- End public functions Link para o comentário https://xtibia.com/forum/topic/237250-encerrado-cooldown-n%C3%A3o-conta-tempo-no-client/ Compartilhar em outros sites More sharing options...
Deadpool 862 Postado Outubro 10, 2015 Share Postado Outubro 10, 2015 você tem o cooldownbar na lib? Link para o comentário https://xtibia.com/forum/topic/237250-encerrado-cooldown-n%C3%A3o-conta-tempo-no-client/#findComment-1672138 Compartilhar em outros sites More sharing options...
Amantezinho 18 Postado Outubro 10, 2015 Autor Share Postado Outubro 10, 2015 você tem o cooldownbar na lib? Ei, você sabe se esse KDPO.dll tem que estar na pasta do server? useOTClient = true useKpdoDlls = true -- coloque true pra usar as barras de cooldown. function isTransformed(cid) return isCreature(cid) and not isInArray({-1, "Ditto", "Shiny Ditto"}, getPlayerStorageValue(cid, 1010)) --alterado v1.9 end function getPlayerPokeballs(cid) --alterado v1.9 \/ local ret = {} local container = 0 if isCreature(cid) then container = getPlayerSlotItem(cid, 3).uid local myball = getPlayerSlotItem(cid, 8) if myball.uid > 0 then table.insert(ret, myball) end else container = cid end if isContainer(container) and getContainerSize(container) > 0 then for slot = 0, (getContainerSize(container) - 1) do local item = getContainerItem(container, slot) if isContainer(item.uid) then local itemsbag = getPlayerPokeballs(item.uid) if itemsbag and #itemsbag > 0 then for i = 0, #itemsbag do table.insert(ret, itemsbag) end end elseif isPokeball(item.itemid) then table.insert(ret, item) end end end return ret end function doUpdatePokemonsBar(cid) if not isCreature(cid) then return true end if getPlayerStorageValue(cid, 656494) > 0 then return true end setPlayerStorageValue(cid, 656494, 1000) addEvent(setPlayerStorageValue, 100, cid, 656494, -1) local ret = {} table.insert(ret, "p#,") local balls = getPlayerPokeballs(cid) local times = 0 for a = 1, #balls do local item = balls[a] times = times + 1 local name = getItemAttribute(item.uid, "poke") doItemSetAttribute(item.uid, "ballorder", times) table.insert(ret, name..",") end doPlayerSendCancel(cid, table.concat(ret)) end function getNewMoveTable(table, n) if table == nil or not n then return false end local moves = {table.move1, table.move2, table.move3, table.move4, table.move5, table.move6, table.move7, table.move8, table.move9, table.move10, table.move11, table.move12} return moves[n] or false end function doUpdateMoves(cid) if not isCreature(cid) then return true end local summon = getCreatureSummons(cid)[1] local ret = {} table.insert(ret, "12&,") if not summon then for a = 1, 12 do table.insert(ret, "n/n,") end doPlayerSendCancel(cid, table.concat(ret)) addEvent(doUpdateCooldowns, 100, cid) return true end if isTransformed(summon) then --alterado v1.9 moves = movestable[getPlayerStorageValue(summon, 1010)] else moves = movestable[getCreatureName(summon)] end for a = 1, 12 do local b = getNewMoveTable(moves, a) if b then table.insert(ret, b.name..",") else table.insert(ret, "n/n,") end end doPlayerSendCancel(cid, table.concat(ret)) addEvent(doUpdateCooldowns, 100, cid) end function ControlMoves(cid) doPlayerSendCancel(cid, '12//,hide') local ret = {} table.insert(ret, "12&,") for a = 1, 12 do table.insert(ret, "moves"..a..",") end doPlayerSendCancel(cid, table.concat(ret)) end function doUpdateCooldowns(cid) if not isCreature(cid) then return true end local a = getPlayerSlotItem(cid, 8) local ret = {} table.insert(ret, "12|,") if a.uid <= 0 or #getCreatureSummons(cid) <= 0 then for cds = 1, 12 do if useOTClient then table.insert(ret, "-1|0,") else table.insert(ret, "-1,") end end doPlayerSendCancel(cid, table.concat(ret)) return true end for cds = 1, 12 do ---- local summon = getCreatureSummons(cid)[1] if summon and getPlayerStorageValue(summon, 212123) >= 1 then cdzin = "cm_move"..cds else cdzin = "move"..cds end ---- if isTransformed(summon) then --alterado v1.9 moves = movestable[getPlayerStorageValue(summon, 1010)] else moves = movestable[getCreatureName(summon)] end local b = getNewMoveTable(moves, cds) if not b then for cds = 1, 12 do if useOTClient then table.insert(ret, "-1|0,") else table.insert(ret, "-1,") end --alterado v1.9 end doPlayerSendCancel(cid, table.concat(ret)) return true end ---- if getCD(a.uid, cdzin) > 0 then if (useOTClient and b) then table.insert(ret, (getCD(a.uid, cdzin)).."|"..b.level..",") else table.insert(ret, (getCD(a.uid, cdzin))..",") end else if (useOTClient and b) then table.insert(ret, "0|"..b.level..",") else table.insert(ret, "0,") end end end doPlayerSendCancel(cid, table.concat(ret)) end function getBallsAttributes(item) local t = {"poke", "gender", "nick", "maxhealth", "boost", "happy", "hp", "addon", "description", "atualLife", "transBegin", "hunger", "transLeft", "transTurn", "transOutfit", "transName", "trans", "light", "blink", "move1", "move2", "move3", "move4", "move5", "move6", "move7", "move8", "move9", "move10", "move11", "move12", "ballorder", "hands", "aura", "burn", "burndmg", "poison", "poisondmg", "confuse", "sleep", "miss", "missSpell", "missEff", "fear", "fearSkill", "silence", "silenceEff", "stun", "stunEff", "stunSpell", "paralyze", "paralyzeEff", "slow", "slowEff", "leech", "leechdmg", "Buff1", "Buff2", "Buff3", "Buff1skill", "Buff2skill", "Buff3skill", "control", "unique", "task", "lock"} local ret = {} for a = 1, #t do if getItemAttribute(item, t[a]) == "hands" then return end ret[t[a]] = getItemAttribute(item, t[a]) or false end return ret end function doChangeBalls(cid, item1, item2) if not isCreature(cid) then return true end if item1.uid == item2.uid then if #getCreatureSummons(cid) <= 0 then doGoPokemon(cid, getPlayerSlotItem(cid, 8)) else doReturnPokemon(cid, getCreatureSummons(cid)[1], getPlayerSlotItem(cid, 8), pokeballs[getPokeballType(getPlayerSlotItem(cid, 8).itemid)].effect) end return true end if item1.uid > 0 and item2.uid > 0 then local io = getBallsAttributes(item1.uid) local it = getBallsAttributes(item2.uid) for a, b in pairs (io) do if b then doItemSetAttribute(item2.uid, a, b) else doItemEraseAttribute(item2.uid, a) end end for a, b in pairs (it) do if b then doItemSetAttribute(item1.uid, a, b) else doItemEraseAttribute(item1.uid, a) end end local id = item2.itemid doTransformItem(item2.uid, item1.itemid) doTransformItem(item1.uid, id) doGoPokemon(cid, getPlayerSlotItem(cid, 8), pokeballs[getPokeballType(getPlayerSlotItem(cid, 8).itemid)].effect) else local id = item2.itemid local b = getBallsAttributes(item2.uid) local a = doPlayerAddItem(cid, 2643, false) for c, d in pairs (b) do if d then doItemSetAttribute(a, c, d) else doItemEraseAttribute(a, c) end end doRemoveItem(item2.uid, 1) doTransformItem(a, id) doGoPokemon(cid, getPlayerSlotItem(cid, 8), pokeballs[getPokeballType(getPlayerSlotItem(cid, 8).itemid)].effect) end end Link para o comentário https://xtibia.com/forum/topic/237250-encerrado-cooldown-n%C3%A3o-conta-tempo-no-client/#findComment-1672140 Compartilhar em outros sites More sharing options...
Deadpool 862 Postado Outubro 10, 2015 Share Postado Outubro 10, 2015 Tem sim, na lib Link para o comentário https://xtibia.com/forum/topic/237250-encerrado-cooldown-n%C3%A3o-conta-tempo-no-client/#findComment-1672142 Compartilhar em outros sites More sharing options...
Amantezinho 18 Postado Outubro 10, 2015 Autor Share Postado Outubro 10, 2015 Tem sim, na lib Data/lib? Link para o comentário https://xtibia.com/forum/topic/237250-encerrado-cooldown-n%C3%A3o-conta-tempo-no-client/#findComment-1672147 Compartilhar em outros sites More sharing options...
Stigal 585 Postado Abril 21, 2018 Share Postado Abril 21, 2018 A questão neste tópico de suporte foi encerrada por falta de respostas. Este tópico está fechado e foi movido para Suporte - Tópicos Sem Resposta. + Caso a dúvida não tenha sido resolvida você poderá criar outro tópico solicitando ajuda. * Lembre-se que é permitido dar UP no tópico a cada 24 horas para assim o destacar e manter movimentado. Link para o comentário https://xtibia.com/forum/topic/237250-encerrado-cooldown-n%C3%A3o-conta-tempo-no-client/#findComment-1736804 Compartilhar em outros sites More sharing options...
Posts Recomendados