Ir para conteúdo

[Encerrado] [Bugg]Otclient Pda By Slicer


HolyMaN

Posts Recomendados

Slicer, a CD Bar ou Move Bar (sei lah) funfa perdeitamente no PDA sem lvl system, porem no com level ela buga, ela pega informações do personagem (level) para atualizar o CD, e eh preciso o lvl do pokemon para atualizar isso, será que tem como arrumar?

Link para o comentário
Compartilhar em outros sites

xi.. kkk vlw pelo report... eu uso mais o serv sem lvl, dai nem percebi esse problema.. ;x segue como arrumar isso..

1* va em lib/cooldown bar.lua, apague oq tiver dentro e cole isso la..

 

function getPlayerPokeballs(cid)

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)

local ret = "p#,"

local balls = getPlayerPokeballs(cid)

local times = 0

for a = 1, #balls do

local item = balls[a]

local hp = math.ceil(getItemAttribute(item.uid, "hp") * 100)

local name = getItemAttribute(item.uid, "poke")

local port = getPlayerSlotItem(cid, CONST_SLOT_LEGS)

if fotos[name] >= 11137 and fotos[name] <= 11387 then

times = times + 1

local foto = fotos[name] - 911

doItemSetAttribute(item.uid, "ballorder", times)

ret = ret..""..foto..","..name..""..times..","..hp..","

elseif fotos[name] >= 12577 then --ainda ta com problema com os 2 novos portraits...

times = times + 1 --depois tento da um jeito... ;x coisa tensaaaaaaa

local foto = 11916 --alterado v2.4

doItemSetAttribute(item.uid, "ballorder", times)

ret = ret..""..foto..","..name..""..times..","..hp..","

else

times = times + 1

local foto = fotos[name] - 928

doItemSetAttribute(item.uid, "ballorder", times)

ret = ret..""..foto..","..name..""..times..","..hp..","

end

end

doPlayerSendCancel(cid, ret)

end

 

function getNewMoveTable(table, n)

if n == 1 and table.move1 then

return table.move1

elseif n == 2 and table.move2 then

return table.move2

elseif n == 3 and table.move3 then

return table.move3

elseif n == 4 and table.move4 then

return table.move4

elseif n == 5 and table.move5 then

return table.move5

elseif n == 6 and table.move6 then

return table.move6

elseif n == 7 and table.move7 then

return table.move7

elseif n == 8 and table.move8 then

return table.move8

elseif n == 9 and table.move9 then

return table.move9

elseif n == 10 and table.move10 then

return table.move10

elseif n == 11 and table.move11 then

return table.move11

elseif n == 12 and table.move12 then

return table.move12

else

return false

end

end

 

 

function doUpdateMoves(cid)

local summon = getCreatureSummons(cid)[1]

local ret = "12&,"

if not summon then

for a = 1, 12 do

ret = ret.."n/n,"

end

doPlayerSendCancel(cid, ret)

addEvent(doUpdateCooldowns, 100, cid)

return true

end

local ret = "12&,"

if getCreatureName(summon) == "Ditto" and pokes[getPlayerStorageValue(summon, 1010)] and getPlayerStorageValue(summon, 1010) ~= "Ditto" then

moves = movestable[getPlayerStorageValue(summon, 1010)]

else --alterado v2.6

moves = movestable[getCreatureName(summon)]

end

for a = 1, 12 do

local b = getNewMoveTable(moves, a)

if b then

ret = ret..""..b.name..","

else

ret = ret.."n/n,"

end

end

doPlayerSendCancel(cid, ret)

addEvent(doUpdateCooldowns, 100, cid)

end

 

function doUpdateCooldowns(cid)

local a = getPlayerSlotItem(cid, 8)

local ret = "12|,"

if a.uid <= 0 or #getCreatureSummons(cid) <= 0 then

for cds = 1, 12 do

ret = useOTClient and ret.."-1|0," or ret.."-1," --alterado v2.7

end

doPlayerSendCancel(cid, ret)

return true

end

for cds = 1, 12 do --alterado v2.7 \/\/

----

local summon = getCreatureSummons(cid)[1]

if summon and getPlayerStorageValue(summon, 212123) >= 1 then

cdzin = "cm_move"..cds

else --alterado v1.5

cdzin = "move"..cds

end

----

if getCreatureName(summon) == "Ditto" and pokes[getPlayerStorageValue(summon, 1010)] and getPlayerStorageValue(summon, 1010) ~= "Ditto" then

moves = movestable[getPlayerStorageValue(summon, 1010)]

else

moves = movestable[getCreatureName(summon)]

end

local b = getNewMoveTable(moves, cds)

----

if getCD(a.uid, cdzin) > 0 then --alterado v2.8

ret = useOTClient and ret..""..(getCD(a.uid, cdzin)).."|"..b.level.."|".. getLevel(summon).."," or ret..""..(getCD(a.uid, cdzin) -1)..","

else

ret = (useOTClient and b) and ret.."0|"..b.level.."|".. getLevel(summon).."," or ret.."0," --alterado v2.8

end

end

doPlayerSendCancel(cid, ret) -- alterado v2.7 /\/\

end

 

function getBallsAttributes(item)

local t = {"boffense", "bdefense", "bagility", "bsattack", "offense", "defense", "speed", "level", "specialattack", "poke", "gender", "vitality", "nick",

"boost", "happy", "hunger", "hp", "description", "exp", "nextlevelexp", "transBegin", "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"} --alterado v2.7

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))

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))

end

end

 

 

2* vai em 'pasta do OTClient'/mods/cdBar/cdBar.lua, apague oq ta dentro e cole isso la..

 

--[[Coisas para saber!

local button = optionsWindow:recursiveGetChildById('Button'):setText("Fuu") == muda o nome do botao!

optionsWindow = g_ui.loadUI('bot.otui', modules.game_interface.getRightPanel()) == faz a janela ficar nos cantos!

local player = g_game.getLocalPlayer() == pega o player!

player:getInventoryItem(8):getId() == pega o id do item, id do .spr

]]

 

cdBar = {}

cdBar.options = {}

 

-- Private Variables

local optionsWindow_hori

local optionsWindow_vert

local optionsButton

local barra = 'Horizontal.otui'

local nameAtks = ""

local cdAtks = ""

 

local botoes = {

['Button1'] = {event = nil},

['Button2'] = {event = nil},

['Button3'] = {event = nil},

['Button4'] = {event = nil},

['Button5'] = {event = nil},

['Button6'] = {event = nil},

['Button7'] = {event = nil},

['Button8'] = {event = nil},

['Button9'] = {event = nil},

['Button10'] = {event = nil},

['Button11'] = {event = nil},

['Button12'] = {event = nil},

}

 

-- Private Functions

 

-- Public functions

function cdBar.init()

optionsWindow_hori = g_ui.displayUI(barra)

optionsWindow_vert = g_ui.displayUI('Vertical.otui')

optionsWindow_hori:setVisible(false)

optionsWindow_vert:setVisible(false)

 

------

local pos = {x = 10, y = 10}

optionsWindow_hori:setPosition(pos)

optionsWindow_vert:setPosition(pos)

------

optionsButton = TopMenu.addLeftButton('cdBarButton', 'cdBar', '/cdBar/cdBar.png', cdBar.toggle)

connect(g_game, { onGameStart = cdBar.online,

onGameEnd = cdBar.hide})

connect(g_game, 'onTextMessage', cdBar.barConfig)

 

cdBar.options = g_settings.getNode('cdBar') or {}

 

if g_game.isOnline() then

cdBar.online()

end

end

 

function cdBar.terminate()

disconnect(g_game, { onGameStart = cdBar.online,

onGameEnd = cdBar.hide})

disconnect(g_game, 'onTextMessage', cdBar.barConfig)

 

if g_game.isOnline() then

cdBar.offline()

end

 

optionsWindow_hori:destroy()

optionsWindow_hori = nil

optionsWindow_vert:destroy()

optionsWindow_vert = nil

optionsButton:destroy()

optionsButton = nil

 

cdBar.cleanEvents()

 

g_settings.setNode('cdBar', cdBar.options)

end

 

function cdBar.changeBar()

cdBar.hide()

if barra == 'Horizontal.otui' then

barra = 'Vertical.otui'

cdBar.show()

cdBar.toolTipChange()

g_game.talk('/reloadCDs')

elseif barra == 'Vertical.otui' then

barra = 'Horizontal.otui'

cdBar.show()

cdBar.toolTipChange()

g_game.talk('/reloadCDs')

end

end

 

function cdBar.barConfig(mode, text)

if not g_game.isOnline() then return end

if mode == MessageModes.Failure then

if string.find(text, '12//,') then

local t1 = text:explode(",")

if t1[2] == 'hide' then

cdBar.hide()

else

cdBar.show()

end

elseif string.find(text, '12|,') then

cdBar.atualizarCDs(text)

elseif string.find(text, '12&,') then

cdBar.toolTipChange(text)

end

end

end

 

 

function cdBar.barChange(but, num, lvl, lvlPoke)

if not g_game.isOnline() then return end

if not cdBar.getWindow():isVisible() then return end

 

local player = g_game.getLocalPlayer()

 

if num and num >= 1 then

 

local button = cdBar.getWindow():recursiveGetChildById('Button' ..but)

local pathOff = "/cdBar/imagens/"..button:getTooltip().."_off.png"

 

button:setImageSource(pathOff)

button:setText(num)

button:setColor('#FF0000') --#000080(azul) #006400(verde)

 

botoes['Button'..but].event = scheduleEvent(function() cdBar.barChange(but, num-1) end, 1000)

else

if botoes['Button' ..but] then

 

local button = cdBar.getWindow():recursiveGetChildById('Button' ..but)

if button:getTooltip() then

 

local pathOn = "/cdBar/imagens/"..button:getTooltip().."_on.png"

local pathOff = "/cdBar/imagens/"..button:getTooltip().."_off.png"

 

if tonumber(lvl) ~= nil and tonumber(lvlPoke) ~= nil and lvlPoke < lvl then

button:setImageSource(pathOff)

button:setText(lvl)

button:setColor('#FF0000')

elseif tonumber(lvl) ~= nil and player:getLevel() < lvl then

button:setImageSource(pathOff)

button:setText(lvl)

button:setColor('#FF0000')

else

button:setImageSource(pathOn)

button:setText("")

end

 

end

end

end

end

 

function cdBar.atualizarCDs(text)

if not g_game.isOnline() then return end

if not cdBar.getWindow():isVisible() then return end

 

local t = text:explode(",")

table.remove(t, 1)

 

local table = {}

for j = 1, 12 do

local t2 = t[j]:explode("|")

if tonumber(t2[3]) ~= nil then

table[j] = {t2[1], t2[2], t2[3]} --alterado v2.8

else

table[j] = {t2[1], t2[2]}

end

end

 

for i = 1, #table do

if tonumber(table[3]) ~= nil then

cdBar.barChange(i, tonumber(table[1]), tonumber(table[2]), tonumber(table[3])) --alterado v2.8

else

cdBar.barChange(i, tonumber(table[1]), tonumber(table[2]))

end

end

end

 

function cdBar.toolTipChange(text)

if barra == "Horizontal.otui" then

cdBar.getWindow():setHeight(490)

cdBar.getWindow():setWidth(65)

else

cdBar.getWindow():setWidth(480)

cdBar.getWindow():setHeight(80)

end

if not text then

text = nameAtks

else

nameAtks = text

end

 

local t2 = text:explode(",")

local count = 0

for i = 2, 13 do

if t2 == 'n/n' then

button = cdBar.getWindow():recursiveGetChildById('Button' ..(i-1)):hide()

count = count+1

else

button = cdBar.getWindow():recursiveGetChildById('Button' ..(i-1)):show()

button = cdBar.getWindow():recursiveGetChildById('Button' ..(i-1)):setTooltip(t2)

end

end

if count > 0 and count ~= 12 then

if barra == "Horizontal.otui" then

cdBar.getWindow():setHeight(490 - (count*38))

else

cdBar.getWindow():setWidth(480 - (count*38))

end

elseif count == 12 then

cdBar.getWindow():setHeight(40)

cdBar.getWindow():setWidth(50)

end

end

 

function cdBar.cleanEvents(button)

if button then

if botoes[button] then

if botoes[button].event ~= nil then

removeEvent(botoes[button].event)

botoes[button].event = nil

end

end

else

for i = 1, 12 do

removeEvent(botoes['Button'..i].event)

botoes['Button'..i].event = nil

end

end

end

 

function cdBar.getWindow()

if barra == 'Vertical.otui' then

return optionsWindow_vert

else

return optionsWindow_hori

end

end

 

function cdBar.toggle()

if cdBar.getWindow():isVisible() then

cdBar.changeBar()

end

end

 

function cdBar.show()

if g_game.isOnline() then

cdBar.getWindow():show()

end

end

 

function cdBar.hide()

scheduleEvent(cdBar.cleanEvents(), 100)

cdBar.getWindow():hide()

end

 

function cdBar.online()

if not g_game.isOnline() then

cdBar.hide()

end

end

 

function cdBar.offline()

if not g_game.isOnline() then

cdBar.hide()

end

end

 

 

deu e vlw ae ^^

Link para o comentário
Compartilhar em outros sites

@Slicer, funciono perfeitamente..

pela logica n tem como, mais tem como adaptar esses 2 scripts do server/cliente para usar com os 2 servidores com e sem lvl system?..

Link para o comentário
Compartilhar em outros sites

  • 5 years later...
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
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...