KarlKalvin 112 Postado Agosto 27, 2016 Share Postado Agosto 27, 2016 (editado) Não fiz muitos ajustes e também não fiz muitos testes mas está ai para quem já quer começar, começa do básico. O nome do tópico já diz tudo então primeiramente seu OTc tem que ter opcodes, após adicionar o opcode... modules/gamelib/opcodes.lua function doMessageCheck(msg, keyword) local a, b = string.find(msg, keyword) if(a and b) then return true end return false end function canBlockMessageOldClient(msg) if doMessageCheck(msg, "#") then return true end return false end Após isso vá até a pasta modules e crie uma pasta chamada game_spellm nela você vai ter que criar 4 arquivos 1ª: configs.lua foldsToBuy = 42 images = { "/images/folds/knight/", "/images/folds/paladin/", "/images/folds/sorcerer/", "/images/folds/druid/" } spellInfos = { { {name = "Exura", level = 1}, {name = "Light", level = 5}, {name = "Utevo Lux", level = 120} }, { {name = "Meleca", level = 1}, {name = "Boletin", level = 5}, {name = "Saldanha Lux", level = 120} }, { {name = "Teste1", level = 1}, {name = "Teste13", level = 5}, {name = "Teste1 Lux", level = 120} }, { {name = "Teste1125", level = 1}, {name = "Teste1125", level = 5}, {name = "Teste1125 Lux", level = 120} } } spellm.lua dofile("/modules/gamelib/opcodes.lua") infos = { vocation = 1, hotkey = "Ctrl+F", spells = {}, currentEvents = {}, maxNumberSpells = 16, buy = {} } function string.explode(str, sep, limit) local i, pos, tmp, t = 0, 1, "", {} for s, e in function() return string.find(str, sep, pos) end do tmp = str:sub(pos, s - 1):trim() table.insert(t, tmp) pos = e + 1 i = i + 1 if(limit ~= nil and i == limit) then break end end tmp = str:sub(pos):trim() table.insert(t, tmp) return t end function getPrimaryAndSecondary(msg) local strings = string.explode(msg, "#") if doMessageCheck(strings[3], ",") then local number = string.explode(strings[3], ",") return {tonumber(number[1]), tonumber(number[2])} else return {tonumber(strings[3])} end end function checkIsFoldMsg(msg) local containsM = doMessageCheck(msg, "#m#") local containsV = doMessageCheck(msg, "#v#") local containsJ = doMessageCheck(msg, "#j#") local Ms = {} if containsM or containsV or containsJ then local strings = string.explode(msg, ";") for x = 1, #strings do if doMessageCheck(strings[x], "#m#") then local a = getPrimaryAndSecondary(strings[x]) infos.spells[a[1]] = a[2] table.insert(Ms, a[1]) elseif doMessageCheck(strings[x], "#v#") then local vocationId = getPrimaryAndSecondary(strings[x])[1] if vocationId > 0 and vocationId < 5 then infos.vocation = vocationId end elseif doMessageCheck(strings[x], "#j#") then local a = getPrimaryAndSecondary(strings[x]) infos.buy[a[1]] = true end end if containsV then configureFolds(infos.vocation) end if containsM then refreshCDs(Ms) end if containsJ then checkBuys() end return true end return false end function doRefleshClient() local protocolGame = g_game.getProtocolGame() if protocolGame then protocolGame:sendExtendedOpcode(2) --manda pro server, mandar todas spells protocolGame:sendExtendedOpcode(40) end end function refreshCDs(CDs) local level = g_game.getLocalPlayer():getLevel() for x = 1, #CDs do local a, currentLevel = CDs[x], 0 if spellInfos[infos.vocation][a] then currentLevel = spellInfos[infos.vocation][a].level end if level >= currentLevel then local delay = infos.spells[a] local progress = miniWindow:getChildById("p"..a) if progress then cancelEventFold(a) progress:setColor("gray") if delay == 0 then progress:setPercent(100) progress:setText() elseif delay > 0 then progress:setPercent(0) progress:setText(delay) for y = 1, delay do local event = scheduleEvent(function() if y < delay then progress:setText(delay-y) infos.spells[a] = delay-y else progress:setText() progress:setPercent(100) infos.spells[a] = 0 end end, 1000*y) table.insert(infos.currentEvents[a], event) end elseif delay < 0 then progress:setPercent(0) end end end end end function checkBuys() local playerLevel = g_game.getLocalPlayer():getLevel() for x = 10, #spellInfos[infos.vocation] do local current = spellInfos[infos.vocation][x] local progress = miniWindow:getChildById("p"..x) if not infos.buy[x] then progress:setText("BUY") progress:setColor("gray") progress:setPercent(0) else if progress:getText() == "BUY" and infos.spells[x] == 0 then if playerLevel >= current.level then progress:setText() progress:setPercent(100) else progress:setText("L"..current.level) progress:setColor("pink") end end end end end function refreshLevel() local level = g_game.getLocalPlayer():getLevel() for x = 1, #spellInfos[infos.vocation] do local progress = miniWindow:getChildById("p"..x) if level >= spellInfos[infos.vocation][x].level then if infos.spells[x] == 0 then progress:setText() progress:setPercent(100) end else progress:setText("L"..spellInfos[infos.vocation][x].level) progress:setColor("pink") progress:setPercent(0) end end checkBuys() end function cancelEventFold(id) if infos.currentEvents[id] then if #infos.currentEvents[id] > 0 then for x = 1, #infos.currentEvents[id] do infos.currentEvents[id][x]:cancel() end end end infos.currentEvents[id] = {} end function configureFolds(voc) infos.buy = {} for x = 1, #spellInfos[voc] do cancelEventFold(x) local current = miniWindow:getChildById("m"..x) local progress = miniWindow:getChildById("p"..x) local levelFold = spellInfos[voc][x].level current:setImageSource(images[voc]..x) progress:setTooltip(spellInfos[voc][x].name..", lv. "..levelFold) progress.name = spellInfos[voc][x].name progress.onClick = function(self) g_game.talk(self.name) end if spellInfos[voc][x].var then progress.var = spellInfos[voc][x].var progress.onMouseRelease = function(self, mousePosition, mouseButton) if mouseButton == MouseRightButton then if self.var then g_game.talk(self.var) end end end else progress.var = nil end end refreshLevel() end function toggle() if not foldsButton:isOn() then doOpen() else doClose() end end function doOpen() foldsButton:setOn(true) miniWindow:show() end function doClose() foldsButton:setOn(false) miniWindow:hide() end function init() miniWindow = g_ui.loadUI('folds', modules.game_interface.getRightPanel()) miniWindow:disableResize() connect(g_game, {onGameStart = doRefleshClient}) connect(LocalPlayer, {onLevelChange = refreshLevel}) g_keyboard.bindKeyDown(infos.hotkey, toggle) foldsButton = modules.client_topmenu.addRightGameToggleButton('foldsButton', tr('Folds (Ctrl+F)'), '/images/topbuttons/battle', toggle) miniWindow:setup() end function terminate() miniWindow:destroy() foldsButton:destroy() g_keyboard.unbindKeyDown(infos.hotkey) disconnect(g_game, {onGameStart = doRefleshClient}) disconnect(LocalPlayer, {onLevelChange = refreshLevel}) end spellm.otui SpellProgress < UIProgressRect background: #585858AA percent: 100 focusable: false font: verdana-11px-rounded image-source: /images/folds/moldura anchors.left: parent.left anchors.top: parent.top size: 32 32 text-align: center Folds < UIButton size: 32 32 anchors.top: parent.top anchors.left: parent.left MiniWindow icon: /images/topbuttons/cooldowns id: foldWindow !text: tr('Spells') height: 233 @onClose: doClose() Folds id: m1 margin-left: 26 margin-top: 34 Folds id: m2 margin-left: 62 margin-top: 34 Folds id: m3 margin-left: 98 margin-top: 34 Folds id: m4 margin-left: 134 margin-top: 34 SpellProgress id: p1 margin-left: 26 margin-top: 34 SpellProgress id: p2 margin-left: 62 margin-top: 34 SpellProgress id: p3 margin-left: 98 margin-top: 34 SpellProgress id: p4 margin-left: 134 margin-top: 34 MiniWindowContents Finalmente spellm.otmod Module name: game_folds description: View Folds Info author: Hundanger/Kalvin website: nothing sandboxed: true scripts: [ configs, folds ] @onLoad: init() @onUnload: terminate() Lembrando: Para fazer a principal edição, você vai editar no configs.lua, está de acordo com as vocations. E quando quiser adicionar mais quadros de spells, tem que adicionar no OTUI. Print: Créditos: Hundanger - Criador Kalvin - Edição Editado Agosto 27, 2016 por KarlKalvin Editei Link para o comentário https://xtibia.com/forum/topic/241913-spell-bar-moves-otc/ Compartilhar em outros sites More sharing options...
Hi im Mell 35 Postado Agosto 27, 2016 Share Postado Agosto 27, 2016 (editado) Vou testar aqui e vejo se haverá bugs, mas já deixei meu Rep. Sistema muito foda e fácil, qualquer um pode configurar Edit. Não sei se esse erro é normal, pq eu nunca vi ele kjkjjk Editado Agosto 27, 2016 por Hi im Mell Link para o comentário https://xtibia.com/forum/topic/241913-spell-bar-moves-otc/#findComment-1702784 Compartilhar em outros sites More sharing options...
KarlKalvin 112 Postado Agosto 27, 2016 Autor Share Postado Agosto 27, 2016 Seu .exe não tem opcodes ou está desabilitado. Link para o comentário https://xtibia.com/forum/topic/241913-spell-bar-moves-otc/#findComment-1702826 Compartilhar em outros sites More sharing options...
Hi im Mell 35 Postado Agosto 28, 2016 Share Postado Agosto 28, 2016 Eu como eu faço pra habilitar ou pegar um com opcodes? Link para o comentário https://xtibia.com/forum/topic/241913-spell-bar-moves-otc/#findComment-1702868 Compartilhar em outros sites More sharing options...
garep 14 Postado Setembro 21, 2016 Share Postado Setembro 21, 2016 faltou a parte do server ;x nao ? Link para o comentário https://xtibia.com/forum/topic/241913-spell-bar-moves-otc/#findComment-1704478 Compartilhar em outros sites More sharing options...
Deadpool 862 Postado Setembro 21, 2016 Share Postado Setembro 21, 2016 Em 28/08/2016 at 11:11, Hi im Mell disse: Eu como eu faço pra habilitar ou pegar um com opcodes? Aqui: Opcodes Se der erro posso te ajudar uhae, só chamar no skype ou wpp Link para o comentário https://xtibia.com/forum/topic/241913-spell-bar-moves-otc/#findComment-1704482 Compartilhar em outros sites More sharing options...
deadkiller 2 Postado Outubro 3, 2016 Share Postado Outubro 3, 2016 Mano, por um exemplo, "Está de acordo coma s Vocations", poderia explicar melhor? Porque gostaria de implementar em um servidor que terá, bastante vocações, eu teria que Criar, Um pra cada? Seria igual DBO, Vocs = Versão 1 / Versão 1.2 / VERSÃO 1.3 E ETC! spellInfos = { { {name = "Exura", level = 1}, {name = "Light", level = 5}, {name = "Utevo Lux", level = 120} }, E nesta Parte, esse seria Vocação 1? Ou só irá mostrar de acordo com as Vocações que podem usar esta Habilidade? Obrigado cara!!! Link para o comentário https://xtibia.com/forum/topic/241913-spell-bar-moves-otc/#findComment-1705448 Compartilhar em outros sites More sharing options...
Hi im Mell 35 Postado Outubro 9, 2016 Share Postado Outubro 9, 2016 Se eu colocar uma spell de transform ele não atualiza, teria que deslogar e logar novamente certo? Teria como colocar para ele atualizar a vocation e as spells? Link para o comentário https://xtibia.com/forum/topic/241913-spell-bar-moves-otc/#findComment-1705988 Compartilhar em outros sites More sharing options...
kamus9629 8 Postado Março 13, 2017 Share Postado Março 13, 2017 Em 27/08/2016 at 05:06, KarlKalvin disse: E se eu quizer Que personagem solta magia falando M1 como eu faria isso tipo Fala m1 solta Chidori Link para o comentário https://xtibia.com/forum/topic/241913-spell-bar-moves-otc/#findComment-1713792 Compartilhar em outros sites More sharing options...
VelhoBarreiro 52 Postado Março 13, 2017 Share Postado Março 13, 2017 Em 21/09/2016 at 14:48, Deadpool disse: Aqui: Opcodes Se der erro posso te ajudar uhae, só chamar no skype ou wpp Eu vou querer ajuda!!! Link para o comentário https://xtibia.com/forum/topic/241913-spell-bar-moves-otc/#findComment-1713796 Compartilhar em outros sites More sharing options...
UmSerQualquer 0 Postado Outubro 19, 2018 Share Postado Outubro 19, 2018 Não estou conseguindo adicionar as imagens, alguém pode me ajudar? Em 31/03/2017 em 15:39, robinpah disse: @KarlKalvin eae eu instalei mais não esta aparecendo as imagens.. coloquei as imagens nesta pasta data\images\folds .. data\images\folds\mago consegue me ajuda? Conseguiu resolver @robinpah ? Link para o comentário https://xtibia.com/forum/topic/241913-spell-bar-moves-otc/#findComment-1744757 Compartilhar em outros sites More sharing options...
S3mpr3 0 Postado Setembro 1, 2022 Share Postado Setembro 1, 2022 Em 27/08/2016 em 05:06, KarlKalvin disse: Não fiz muitos ajustes e também não fiz muitos testes mas está ai para quem já quer começar, começa do básico. O nome do tópico já diz tudo então primeiramente seu OTc tem que ter opcodes, após adicionar o opcode... modules/gamelib/opcodes.lua Mostrar conteúdo oculto function doMessageCheck(msg, keyword) local a, b = string.find(msg, keyword) if(a and b) then return true end return false end function canBlockMessageOldClient(msg) if doMessageCheck(msg, "#") then return true end return false end Após isso vá até a pasta modules e crie uma pasta chamada game_spellm nela você vai ter que criar 4 arquivos 1ª: configs.lua Mostrar conteúdo oculto foldsToBuy = 42 images = { "/images/folds/knight/", "/images/folds/paladin/", "/images/folds/sorcerer/", "/images/folds/druid/" } spellInfos = { { {name = "Exura", level = 1}, {name = "Light", level = 5}, {name = "Utevo Lux", level = 120} }, { {name = "Meleca", level = 1}, {name = "Boletin", level = 5}, {name = "Saldanha Lux", level = 120} }, { {name = "Teste1", level = 1}, {name = "Teste13", level = 5}, {name = "Teste1 Lux", level = 120} }, { {name = "Teste1125", level = 1}, {name = "Teste1125", level = 5}, {name = "Teste1125 Lux", level = 120} } } spellm.lua Mostrar conteúdo oculto dofile("/modules/gamelib/opcodes.lua") infos = { vocation = 1, hotkey = "Ctrl+F", spells = {}, currentEvents = {}, maxNumberSpells = 16, buy = {} } function string.explode(str, sep, limit) local i, pos, tmp, t = 0, 1, "", {} for s, e in function() return string.find(str, sep, pos) end do tmp = str:sub(pos, s - 1):trim() table.insert(t, tmp) pos = e + 1 i = i + 1 if(limit ~= nil and i == limit) then break end end tmp = str:sub(pos):trim() table.insert(t, tmp) return t end function getPrimaryAndSecondary(msg) local strings = string.explode(msg, "#") if doMessageCheck(strings[3], ",") then local number = string.explode(strings[3], ",") return {tonumber(number[1]), tonumber(number[2])} else return {tonumber(strings[3])} end end function checkIsFoldMsg(msg) local containsM = doMessageCheck(msg, "#m#") local containsV = doMessageCheck(msg, "#v#") local containsJ = doMessageCheck(msg, "#j#") local Ms = {} if containsM or containsV or containsJ then local strings = string.explode(msg, ";") for x = 1, #strings do if doMessageCheck(strings[x], "#m#") then local a = getPrimaryAndSecondary(strings[x]) infos.spells[a[1]] = a[2] table.insert(Ms, a[1]) elseif doMessageCheck(strings[x], "#v#") then local vocationId = getPrimaryAndSecondary(strings[x])[1] if vocationId > 0 and vocationId < 5 then infos.vocation = vocationId end elseif doMessageCheck(strings[x], "#j#") then local a = getPrimaryAndSecondary(strings[x]) infos.buy[a[1]] = true end end if containsV then configureFolds(infos.vocation) end if containsM then refreshCDs(Ms) end if containsJ then checkBuys() end return true end return false end function doRefleshClient() local protocolGame = g_game.getProtocolGame() if protocolGame then protocolGame:sendExtendedOpcode(2) --manda pro server, mandar todas spells protocolGame:sendExtendedOpcode(40) end end function refreshCDs(CDs) local level = g_game.getLocalPlayer():getLevel() for x = 1, #CDs do local a, currentLevel = CDs[x], 0 if spellInfos[infos.vocation][a] then currentLevel = spellInfos[infos.vocation][a].level end if level >= currentLevel then local delay = infos.spells[a] local progress = miniWindow:getChildById("p"..a) if progress then cancelEventFold(a) progress:setColor("gray") if delay == 0 then progress:setPercent(100) progress:setText() elseif delay > 0 then progress:setPercent(0) progress:setText(delay) for y = 1, delay do local event = scheduleEvent(function() if y < delay then progress:setText(delay-y) infos.spells[a] = delay-y else progress:setText() progress:setPercent(100) infos.spells[a] = 0 end end, 1000*y) table.insert(infos.currentEvents[a], event) end elseif delay < 0 then progress:setPercent(0) end end end end end function checkBuys() local playerLevel = g_game.getLocalPlayer():getLevel() for x = 10, #spellInfos[infos.vocation] do local current = spellInfos[infos.vocation][x] local progress = miniWindow:getChildById("p"..x) if not infos.buy[x] then progress:setText("BUY") progress:setColor("gray") progress:setPercent(0) else if progress:getText() == "BUY" and infos.spells[x] == 0 then if playerLevel >= current.level then progress:setText() progress:setPercent(100) else progress:setText("L"..current.level) progress:setColor("pink") end end end end end function refreshLevel() local level = g_game.getLocalPlayer():getLevel() for x = 1, #spellInfos[infos.vocation] do local progress = miniWindow:getChildById("p"..x) if level >= spellInfos[infos.vocation][x].level then if infos.spells[x] == 0 then progress:setText() progress:setPercent(100) end else progress:setText("L"..spellInfos[infos.vocation][x].level) progress:setColor("pink") progress:setPercent(0) end end checkBuys() end function cancelEventFold(id) if infos.currentEvents[id] then if #infos.currentEvents[id] > 0 then for x = 1, #infos.currentEvents[id] do infos.currentEvents[id][x]:cancel() end end end infos.currentEvents[id] = {} end function configureFolds(voc) infos.buy = {} for x = 1, #spellInfos[voc] do cancelEventFold(x) local current = miniWindow:getChildById("m"..x) local progress = miniWindow:getChildById("p"..x) local levelFold = spellInfos[voc][x].level current:setImageSource(images[voc]..x) progress:setTooltip(spellInfos[voc][x].name..", lv. "..levelFold) progress.name = spellInfos[voc][x].name progress.onClick = function(self) g_game.talk(self.name) end if spellInfos[voc][x].var then progress.var = spellInfos[voc][x].var progress.onMouseRelease = function(self, mousePosition, mouseButton) if mouseButton == MouseRightButton then if self.var then g_game.talk(self.var) end end end else progress.var = nil end end refreshLevel() end function toggle() if not foldsButton:isOn() then doOpen() else doClose() end end function doOpen() foldsButton:setOn(true) miniWindow:show() end function doClose() foldsButton:setOn(false) miniWindow:hide() end function init() miniWindow = g_ui.loadUI('folds', modules.game_interface.getRightPanel()) miniWindow:disableResize() connect(g_game, {onGameStart = doRefleshClient}) connect(LocalPlayer, {onLevelChange = refreshLevel}) g_keyboard.bindKeyDown(infos.hotkey, toggle) foldsButton = modules.client_topmenu.addRightGameToggleButton('foldsButton', tr('Folds (Ctrl+F)'), '/images/topbuttons/battle', toggle) miniWindow:setup() end function terminate() miniWindow:destroy() foldsButton:destroy() g_keyboard.unbindKeyDown(infos.hotkey) disconnect(g_game, {onGameStart = doRefleshClient}) disconnect(LocalPlayer, {onLevelChange = refreshLevel}) end spellm.otui Mostrar conteúdo oculto SpellProgress < UIProgressRect background: #585858AA percent: 100 focusable: false font: verdana-11px-rounded image-source: /images/folds/moldura anchors.left: parent.left anchors.top: parent.top size: 32 32 text-align: center Folds < UIButton size: 32 32 anchors.top: parent.top anchors.left: parent.left MiniWindow icon: /images/topbuttons/cooldowns id: foldWindow !text: tr('Spells') height: 233 @onClose: doClose() Folds id: m1 margin-left: 26 margin-top: 34 Folds id: m2 margin-left: 62 margin-top: 34 Folds id: m3 margin-left: 98 margin-top: 34 Folds id: m4 margin-left: 134 margin-top: 34 SpellProgress id: p1 margin-left: 26 margin-top: 34 SpellProgress id: p2 margin-left: 62 margin-top: 34 SpellProgress id: p3 margin-left: 98 margin-top: 34 SpellProgress id: p4 margin-left: 134 margin-top: 34 MiniWindowContents Finalmente spellm.otmod Mostrar conteúdo oculto Module name: game_folds description: View Folds Info author: Hundanger/Kalvin website: nothing sandboxed: true scripts: [ configs, folds ] @onLoad: init() @onUnload: terminate() Lembrando: Para fazer a principal edição, você vai editar no configs.lua, está de acordo com as vocations. E quando quiser adicionar mais quadros de spells, tem que adicionar no OTUI. Print: Créditos: Hundanger - Criador Kalvin - Edição No meu caso, peguei uma base com esse sistema já existente, porém com um sistema de ataque. Assim que eu uso o ataque mostra na Spellbar quanto tempo falta pra usar novamente, porém se eu for na spell.xml e modificar o exhausted, digamos, diminuir, vai ficar desregulado com a SpellBar, pois ela vai estar mostrando um numero diferente da modificação na spell.xml... Como posso modificar esse time? Link para o comentário https://xtibia.com/forum/topic/241913-spell-bar-moves-otc/#findComment-1767920 Compartilhar em outros sites More sharing options...
Posts Recomendados