Ir para conteúdo
  • Cadastre-se

Posts Recomendados

Estou com um problema onde eu gostaria de adicionar novos slots na pagina de inventário

Ex: 3 Ring Slots (sendo que 1 ja tem no OTClient)

Bracelete Slots

 

Tentei fazer com que o slot de ammo virasse outro slot de ring, pois no meu server não tera ataque a distancia. Mas o client n abre o inventario.

 

inventory.lua

Spoiler

InventorySlotStyles = {
  [InventorySlotHead] = "HeadSlot",
  [InventorySlotNeck] = "NeckSlot",
  [InventorySlotBack] = "BackSlot",
  [InventorySlotBody] = "BodySlot",
  [InventorySlotRight] = "RightSlot",
  [InventorySlotLeft] = "LeftSlot",
  [InventorySlotLeg] = "LegSlot",
  [InventorySlotFeet] = "FeetSlot",
  [InventorySlotFinger] = "FingerSlot",
  [InventorySlotFinger1] = "FingerSlot"
}

inventoryWindow = nil
inventoryPanel = nil
inventoryButton = nil
purseButton = nil

function init()
  connect(LocalPlayer, {
    onInventoryChange = onInventoryChange,
    onBlessingsChange = onBlessingsChange
  })
  connect(g_game, { onGameStart = refresh })

  g_keyboard.bindKeyDown('Ctrl+I', toggle)

  inventoryButton = modules.client_topmenu.addRightGameToggleButton('inventoryButton', tr('Inventory') .. ' (Ctrl+I)', '/images/topbuttons/inventory', toggle)
  inventoryButton:setOn(true)

  inventoryWindow = g_ui.loadUI('inventory', modules.game_interface.getRightPanel())
  inventoryWindow:disableResize()
  inventoryPanel = inventoryWindow:getChildById('contentsPanel')

  purseButton = inventoryPanel:getChildById('purseButton')
  local function purseFunction()
    local purse = g_game.getLocalPlayer():getInventoryItem(InventorySlotPurse)
    if purse then
      g_game.use(purse)
    end
  end
  purseButton.onClick = purseFunction

  refresh()
  inventoryWindow:setup()
end

function terminate()
  disconnect(LocalPlayer, {
    onInventoryChange = onInventoryChange,
    onBlessingsChange = onBlessingsChange
  })
  disconnect(g_game, { onGameStart = refresh })

  g_keyboard.unbindKeyDown('Ctrl+I')

  inventoryWindow:destroy()
  inventoryButton:destroy()
end

function toggleAdventurerStyle(hasBlessing)
  for slot = InventorySlotFirst, InventorySlotLast do
    local itemWidget = inventoryPanel:getChildById('slot' .. slot)
    if itemWidget then
      itemWidget:setOn(hasBlessing)
    end
  end
end

function refresh()
  local player = g_game.getLocalPlayer()
  for i = InventorySlotFirst, InventorySlotPurse do
    if g_game.isOnline() then
      onInventoryChange(player, i, player:getInventoryItem(i))
    else
      onInventoryChange(player, i, nil)
    end
    toggleAdventurerStyle(player and Bit.hasBit(player:getBlessings(), Blessings.Adventurer) or false)
  end

  purseButton:setVisible(g_game.getFeature(GamePurseSlot))
end

function toggle()
  if inventoryButton:isOn() then
    inventoryWindow:close()
    inventoryButton:setOn(false)
  else
    inventoryWindow:open()
    inventoryButton:setOn(true)
  end
end

function onMiniWindowClose()
  inventoryButton:setOn(false)
end

-- hooked events
function onInventoryChange(player, slot, item, oldItem)
  if slot > InventorySlotPurse then return end

  if slot == InventorySlotPurse then
    if g_game.getFeature(GamePurseSlot) then
      purseButton:setEnabled(item and true or false)
    end
    return
  end

  local itemWidget = inventoryPanel:getChildById('slot' .. slot)
  if item then
    itemWidget:setStyle('InventoryItem')
    itemWidget:setItem(item)
  else
    itemWidget:setStyle(InventorySlotStyles[slot])
    itemWidget:setItem(nil)
  end
end

function onBlessingsChange(player, blessings, oldBlessings)
  local hasAdventurerBlessing = Bit.hasBit(blessings, Blessings.Adventurer)
  if hasAdventurerBlessing ~= Bit.hasBit(oldBlessings, Blessings.Adventurer) then
    toggleAdventurerStyle(hasAdventurerBlessing)
  end
end

 

inventory.otui (sim eu gostaria de tirar o ammoslot)

Spoiler

InventoryItem < Item
  $on:
    image-source: /images/ui/item-blessed

HeadSlot < InventoryItem
  id: slot1
  image-source: /images/game/slots/head
  &position: {x=65535, y=1, z=0}
  $on:
    image-source: /images/game/slots/head-blessed

BodySlot < InventoryItem
  id: slot4
  image-source: /images/game/slots/body
  &position: {x=65535, y=4, z=0}
  $on:
    image-source: /images/game/slots/body-blessed

LegSlot < InventoryItem
  id: slot7
  image-source: /images/game/slots/legs
  &position: {x=65535, y=7, z=0}
  $on:
    image-source: /images/game/slots/legs-blessed

FeetSlot < InventoryItem
  id: slot8
  image-source: /images/game/slots/feet
  &position: {x=65535, y=8, z=0}
  $on:
    image-source: /images/game/slots/feet-blessed

NeckSlot < InventoryItem
  id: slot2
  image-source: /images/game/slots/neck
  &position: {x=65535, y=2, z=0}
  $on:
    image-source: /images/game/slots/neck-blessed

LeftSlot < InventoryItem
  id: slot6
  image-source: /images/game/slots/left-hand
  &position: {x=65535, y=6, z=0}
  $on:
    image-source: /images/game/slots/left-hand-blessed

FingerSlot < InventoryItem
  id: slot9
  image-source: /images/game/slots/finger
  &position: {x=65535, y=9, z=0}
  $on:
    image-source: /images/game/slots/finger-blessed

BackSlot < InventoryItem
  id: slot3
  image-source: /images/game/slots/back
  &position: {x=65535, y=3, z=0}
  $on:
    image-source: /images/game/slots/back-blessed

RightSlot < InventoryItem
  id: slot5
  image-source: /images/game/slots/right-hand
  &position: {x=65535, y=5, z=0}
  $on:
    image-source: /images/game/slots/right-hand-blessed

Finger1Slot < InventoryItem
  id: slot10
  image-source: /images/game/slots/finger
  &position: {x=65535, y=10, z=0}
  $on:
    image-source: /images/game/slots/finger-blessed

PurseButton < Button
  id: purseButton
  size: 26 26
  !tooltip: tr('Open purse')
  icon-source: /images/game/slots/purse
  icon-size: 24 24
  icon-offset: 1 1

MiniWindow
  id: inventoryWindow
  !text: tr('Inventory')
  icon: /images/topbuttons/inventory
  height: 175
  @onClose: modules.game_inventory.onMiniWindowClose()
  &save: true

  MiniWindowContents
    HeadSlot
      anchors.top: parent.top
      anchors.horizontalCenter: parent.horizontalCenter
      margin-top: 3

    BodySlot
      anchors.top: prev.bottom
      anchors.horizontalCenter: prev.horizontalCenter
      margin-top: 3

    LegSlot
      anchors.top: prev.bottom
      anchors.horizontalCenter: prev.horizontalCenter
      margin-top: 3

    FeetSlot
      anchors.top: prev.bottom
      anchors.horizontalCenter: prev.horizontalCenter
      margin-top: 3

    NeckSlot
      anchors.top: slot1.top
      anchors.right: slot1.left
      margin-top: 10
      margin-right: 5

    LeftSlot
      anchors.top: prev.bottom
      anchors.horizontalCenter: prev.horizontalCenter
      margin-top: 3

    FingerSlot
      anchors.top: prev.bottom
      anchors.horizontalCenter: prev.horizontalCenter
      margin-top: 3
    
    FingerSlot1
      anchors.top: prev.bottom
      anchors.horizontalCenter: prev.horizontalCenter
      margin-top: 3

    BackSlot
      anchors.top: slot1.top
      anchors.left: slot1.right
      margin-top: 10
      margin-left: 5

    RightSlot
      anchors.top: prev.bottom
      anchors.horizontalCenter: prev.horizontalCenter
      margin-top: 3

    PurseButton
      margin-top: 3
      anchors.top: prev.bottom
      anchors.horizontalCenter: prev.horizontalCenter

 

player.lua

Spoiler

-- @docclass Player

PlayerStates = {
  None = 0,
  Poison = 1,
  Burn = 2,
  Energy = 4,
  Drunk = 8,
  ManaShield = 16,
  Paralyze = 32,
  Haste = 64,
  Swords = 128,
  Drowning = 256,
  Freezing = 512,
  Dazzled = 1024,
  Cursed = 2048,
  PartyBuff = 4096,
  PzBlock = 8192,
  Pz = 16384,
  Bleeding = 32768,
  Hungry = 65536
}

InventorySlotOther = 0
InventorySlotHead = 1
InventorySlotNeck = 2
InventorySlotBack = 3
InventorySlotBody = 4
InventorySlotRight = 5
InventorySlotLeft = 6
InventorySlotLeg = 7
InventorySlotFeet = 8
InventorySlotFinger = 9
InventorySlotFinger1 = 10
InventorySlotPurse = 11

InventorySlotFirst = InventorySlotHead
InventorySlotLast = InventorySlotPurse

function Player:isPartyLeader()
  local shield = self:getShield()
  return (shield == ShieldWhiteYellow or
          shield == ShieldYellow or
          shield == ShieldYellowSharedExp or
          shield == ShieldYellowNoSharedExpBlink or
          shield == ShieldYellowNoSharedExp)
end

function Player:isPartyMember()
  local shield = self:getShield()
  return (shield == ShieldWhiteYellow or
          shield == ShieldYellow or
          shield == ShieldYellowSharedExp or
          shield == ShieldYellowNoSharedExpBlink or
          shield == ShieldYellowNoSharedExp or
          shield == ShieldBlueSharedExp or
          shield == ShieldBlueNoSharedExpBlink or
          shield == ShieldBlueNoSharedExp or
          shield == ShieldBlue)
end

function Player:isPartySharedExperienceActive()
  local shield = self:getShield()
  return (shield == ShieldYellowSharedExp or
          shield == ShieldYellowNoSharedExpBlink or
          shield == ShieldYellowNoSharedExp or
          shield == ShieldBlueSharedExp or
          shield == ShieldBlueNoSharedExpBlink or
          shield == ShieldBlueNoSharedExp)
end

function Player:hasVip(creatureName)
  for id, vip in pairs(g_game.getVips()) do
    if (vip[1] == creatureName) then return true end
  end
  return false
end

function Player:isMounted()
  local outfit = self:getOutfit()
  return outfit.mount ~= nil and outfit.mount > 0
end

function Player:toggleMount()
  if g_game.getFeature(GamePlayerMounts) then
    g_game.mount(not self:isMounted())
  end
end

function Player:mount()
  if g_game.getFeature(GamePlayerMounts) then
    g_game.mount(true)
  end
end

function Player:dismount()
  if g_game.getFeature(GamePlayerMounts) then
    g_game.mount(false)
  end
end

function Player:getItem(itemId, subType)
  return g_game.findPlayerItem(itemId, subType or -1)
end

function Player:getItems(itemId, subType)
  local subType = subType or -1

  local items = {}
  for i=InventorySlotFirst,InventorySlotLast do
    local item = self:getInventoryItem(i)
    if item and item:getId() == itemId and (subType == -1 or item:getSubType() == subType) then
      table.insert(items, item)
    end
  end

  for i, container in pairs(g_game.getContainers()) do
    for j, item in pairs(container:getItems()) do
      if item:getId() == itemId and (subType == -1 or item:getSubType() == subType) then
        item.container = container
        table.insert(items, item)
      end
    end
  end
  return items
end

function Player:getItemsCount(itemId)
  local items, count = self:getItems(itemId), 0
  for i=1,#items do
    count = count + items:getCount()
  end
  return count
end

function Player:hasState(state, states)
  if not states then
    states = self:getStates()
  end

  for i = 1, 32 do
    local pow = math.pow(2, i-1)
    if pow > states then break end

    local states = bit32.band(states, pow)
    if states == state then
      return true
    end
  end
  return false
end
 

 

Desculpa se está no local errado, se puder mover caso esteja.

 

Editado por Kenner Games (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
  • 7 months later...

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

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.


  • Conteúdo Similar

    • Por maikon1993
      Fala galerinha de boas ?
       
      Preciso de ajuda, preciso de um macro para otcV8, que faça um item dar use no outro.
      Exemplo: Tem um item no servidor "spellswand" e ela é usada para vender item, dando "use" nela e no item que quer vender, queria deixar isso automático, se alguém poder me ajudar agradeço.
    • Por AddroJhonny
      Andei buscando de tudo que é forma para que o minimap fique com a imagem já liberada, assim como é no PxG. Porém, não encontrei em nenhum lugar alguma instrução. Comecei a mexer no arquivo minimap.lua e consegui avançar em algo.
       
      Meu script ficou assim:
      function updateCameraPosition() local player = g_game.getLocalPlayer() if not player then return end local pos = player:getPosition() if not pos then return end if not minimapWidget:recursiveGetChildById('posLabel') then local minimap = g_ui.createWidget('Minimap', minimapWidget) minimapWidget:setImageSource('/mapa/pisos/piso1') minimapWidget:setId('posLabel') minimapWidget:setOpacity(0.3) minimapWidget:centerInPosition(map, {x = 1015, y=1012, z=7}) end if not minimapWidget:isDragging() then if not fullmapView then minimapWidget:setCameraPosition(player:getPosition()) end minimapWidget:setCrossPosition(player:getPosition()) end minimapPos = minimapWindow:recursiveGetChildById('posLabel') minimapPos:setText('X:'..pos.x..' Y:'..pos.y..' Z:'..pos.z) if minimapWidget:getCameraPosition().z ~= 7 then local minimap = minimapWidget:recursiveGetChildById('posLabel') minimap:setVisible(false) minimapWidget:setColor('black') end end  
      Agora a imagem realmente está aparecendo no minimap com transparência... e quase perfeito. Mas ainda falta conseguir fazer ela acompanhar a posição do player no lugar de ficar aberto por inteiro.
       
      Segue como ficou:
       

       
      Alguém consegue ajudar a melhor maneira de fazer isso? Ou se fiz errado também...
       
      Ty.
    • Por brunei
      Olá galera bom dia , boa tarde e boa noite a todos !
      venho trazer meu primeiro projeto para contribuir com o TK , se trata de um modulo bastante util 
      como é minha primeira vez trazendo algo aqui , talvez eu esqueça de algo , sem enrolação vamos la.

      o modulo é um Shiny Ditto Memory para PDA ,o melhor é que nao precisa de source e é bem simples de instalar !

      1° ponto - Adicionar o memory sistem por TalkAction do @zipter98 (fiz algumas correçoes e melhorias no script para funcionar de uma melhor forma com o modulo)

      em Talkactions.xml adicione a tag :  <talkaction words="/memory;!memory" event="script" value="sdittomemory.lua"/>
       
      2° - Em talkaction/script ,crie um arquivo sdittomemory.lua e cole esse script : 
       
      em : local cd = 2 (em segundos) mude para o numero que desejar como cooldown para efetuar a troca .
      Para efetuar a troca o pokemon precisa esta com os Moves 100% ,caso contrario ira mandar uma mensagem de bloqueio.
       

      3° - em somefunctions.lua adicione essas funçoes !

       
      tem umas correções q eu mesmo fiz no ditto system e shiny ditto system ,e é necessario pro modulo funcionar 100% .

      4° - extraia e adicione o arquivo na pasta Modulos do seu OTClient !

      pronto , com isso vai funcionar o modulo 
       

       
      1 - no icone salvar , vc consegue salvar o pokemon que o ditto esta transformado em cada slot (pokebola) e reverter o ditto.
      2 - no icone check , vc consegue remover uma memoria ou checar quais memorias o seu ditto esta usando.
      3 - e no icone transformar vc transforma em cada memoria salva no s.ditto e tbm consegue reverter para virar um pokemon novo sem usar a memori etc..

      entao é isso galera , espero que seja util .

      CREDITOS :
      @zipter98 
      @usoparagames Eu
      game_memory.rar
    • Por Gryffindori
      Já procurei à fundo mas não achei nada resolvido sobre isso, sempre que vou compilar acaba dando o erro. Alguém tem alguma solução?
       
      Problema - > . C2139 'OTMLNode': an undefined class is not allowed as an argument to compiler intrinsic type trait '__is_convertible_to' (compiling source file ..\src\client\localplayer.cpp) type_traits 325
       

    • Por JulianoZN
      Mobile Modificado sem arquivos data/modules etc
      >> o mesmo ja conta com o sistema de rotação de tela
      scan// https://www.virustotal.com/gui/file/596ea29e221af84af5771c94b6160531f681975f8727410060e2d474cd0ab679/detection

      --> Com extensão de tela sem bordas preta requer extensão de tela para mobile
      > http:// https://www.mediafire.com/file/jumo15q39gc9n4d/liberado+extendido.apk/file

      29/2 > 14
      17/2 > 8
       
      Possui cor nos nome procurando as tag \/ no nick do player
      0 [ADM], [GOD], [GM], [CM], [Tutor], [Help], [YT], [Youtuber]
       
      Cor nos nome dos monstro que possuir genero

      Male > Azul 
      Female > Rosa
      Indefinido > Amarelo

      --> Sem Extenção de tela Bordas Preta
      > https://www.mediafire.com/file/fnzhwciwws1om26/liberado.apk/file

      padrao do tibia 
      8
      6
       
      Possui cor nos nome procurando as tag \/ no nick do player
      0 [ADM], [GOD], [GM], [CM], [Tutor], [Help], [YT], [Youtuber]
       
      Cor nos nome dos monstro que possuir genero
      Male > Azul 
      Female > Rosa
      Indefinido > Amarelo
       

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo