Ir para conteúdo
  • 0

auguem pode me ajudar aki


Strogman

Pergunta

bom galera, eu queria fazer uma outra opção de addon, de quando click no proprio character

 

tipo a do pxg, uma do poke ai retirei o mounts, e agora eu queria trocar o nome de outfit pra outfitpoke, só que não to conseguindo aqui, para o script poder fucionar o que eu devo mudar.

 

aki o .lua

 

 

 

ADDON_SETS = {
  [1] = { 1 },
  [2] = { 2 },
  [3] = { 1, 2 },
  [4] = { 3 },
  [5] = { 1, 3 },
  [6] = { 2, 3 },
  [7] = { 1, 2, 3 }
}

outfitWindow = nil
outfit = nil
outfits = nil
outfitCreature = nil
currentOutfit = 1

addons = nil
currentColorBox = nil
currentClotheButtonBox = nil
colorBoxes = {}

function init()
  connect(g_game, { onOpenOutfitWindow = create,
                    onGameEnd = destroy })
end

function terminate()
  disconnect(g_game, { onOpenOutfitWindow = create,
                       onGameEnd = destroy })
  destroy()
end

function create(creatureOutfit, outfitList, creatureMount)
  if outfitWindow and not outfitWindow:isHidden() then
    return
  end
 
  outfitCreature = creatureOutfit
  outfits = outfitList
  destroy()

  outfitWindow = g_ui.displayUI('outfitwindow')
  local colorBoxPanel = outfitWindow:getChildById('colorBoxPanel')

  -- setup outfit/mount display boxs
  local outfitCreatureBox = outfitWindow:getChildById('outfitCreatureBox')
  if outfitCreature then
    outfit = outfitCreature:getOutfit()
    outfitCreatureBox:setCreature(outfitCreature)
  else
    outfitCreatureBox:hide()
    outfitWindow:getChildById('outfitName'):hide()
    outfitWindow:getChildById('outfitNextButton'):hide()
    outfitWindow:getChildById('outfitPrevButton'):hide()
  end

 -- set addons
  addons = {
    [1] = {widget = outfitWindow:getChildById('addon1'), value = 1},
    [2] = {widget = outfitWindow:getChildById('addon2'), value = 2},
    [3] = {widget = outfitWindow:getChildById('addon3'), value = 4}
  }

  for _, addon in pairs(addons) do
    addon.widget.onCheckChange = function(self) onAddonCheckChange(self, addon.value) end
  end

  if outfit.addons > 0 then
    for _, i in pairs(ADDON_SETS[outfit.addons]) do
      addons[i].widget:setChecked(true)
    end
  end

 -- hook outfit sections
  currentClotheButtonBox = outfitWindow:getChildById('head')
  outfitWindow:getChildById('head').onCheckChange = onClotheCheckChange
  outfitWindow:getChildById('primary').onCheckChange = onClotheCheckChange
  outfitWindow:getChildById('secondary').onCheckChange = onClotheCheckChange
  outfitWindow:getChildById('detail').onCheckChange = onClotheCheckChange

  -- populate color panel
  for j=0,6 do
    for i=0,18 do
      local colorBox = g_ui.createWidget('ColorBox', colorBoxPanel)
      local outfitColor = getOufitColor(j*19 + i)
      colorBox:setImageColor(outfitColor)
      colorBox:setId('colorBox' .. j*19+i)
      colorBox.colorId = j*19 + i

      if j*19 + i == outfit.head then
        currentColorBox = colorBox
        colorBox:setChecked(true)
      end
      colorBox.onCheckChange = onColorCheckChange
      colorBoxes[#colorBoxes+1] = colorBox
    end
  end

  currentOutfit = 1
  for i=1,#outfitList do
    if outfit and outfitList[i][1] == outfit.type then
      currentOutfit = i
      break
    end
  end

  updateOutfit()
end

function destroy()
  if outfitWindow then
    outfitWindow:destroy()
    outfitWindow = nil
    outfitCreature = nil
    mountCreature = nil
    currentColorBox = nil
    currentClotheButtonBox = nil
    colorBoxes = {}
    addons = {}
  end
end

function randomize()
  local outfitTemplate = {
    outfitWindow:getChildById('head'),
    outfitWindow:getChildById('primary'),
    outfitWindow:getChildById('secondary'),
    outfitWindow:getChildById('detail')
  }

  for i = 1, #outfitTemplate do
    outfitTemplate[i]:setChecked(true)
    colorBoxes[math.random(1, #colorBoxes)]:setChecked(true)
    outfitTemplate[i]:setChecked(false)
  end
  outfitTemplate[1]:setChecked(true)
end

function accept()
  if mount then outfit.mount = mount.type end
  g_game.changeOutfit(outfit)
  destroy()
end

function nextOutfitType()
  if not outfits then
    return
  end
  currentOutfit = currentOutfit + 1
  if currentOutfit > #outfits then
    currentOutfit = 1
  end
  updateOutfit()
end

function previousOutfitType()
  if not outfits then
    return
  end
  currentOutfit = currentOutfit - 1
  if currentOutfit <= 0 then
    currentOutfit = #outfits
  end
  updateOutfit()
end

function onAddonCheckChange(addon, value)
  if addon:isChecked() then
    outfit.addons = outfit.addons + value
  else
    outfit.addons = outfit.addons - value
  end
  outfitCreature:setOutfit(outfit)
end

function onColorCheckChange(colorBox)
  if colorBox == currentColorBox then
    colorBox.onCheckChange = nil
    colorBox:setChecked(true)
    colorBox.onCheckChange = onColorCheckChange
  else
    currentColorBox.onCheckChange = nil
    currentColorBox:setChecked(false)
    currentColorBox.onCheckChange = onColorCheckChange

    currentColorBox = colorBox

    if currentClotheButtonBox:getId() == 'head' then
      outfit.head = currentColorBox.colorId
    elseif currentClotheButtonBox:getId() == 'primary' then
      outfit.body = currentColorBox.colorId
    elseif currentClotheButtonBox:getId() == 'secondary' then
      outfit.legs = currentColorBox.colorId
    elseif currentClotheButtonBox:getId() == 'detail' then
      outfit.feet = currentColorBox.colorId
    end

   outfitCreature:setOutfit(outfit)
  end
end

function onClotheCheckChange(clotheButtonBox)
  if clotheButtonBox == currentClotheButtonBox then
    clotheButtonBox.onCheckChange = nil
    clotheButtonBox:setChecked(true)
    clotheButtonBox.onCheckChange = onClotheCheckChange
  else
    currentClotheButtonBox.onCheckChange = nil
    currentClotheButtonBox:setChecked(false)
    currentClotheButtonBox.onCheckChange = onClotheCheckChange

    currentClotheButtonBox = clotheButtonBox

    local colorId = 0
    if currentClotheButtonBox:getId() == 'head' then
      colorId = outfit.head
    elseif currentClotheButtonBox:getId() == 'primary' then
      colorId = outfit.body
    elseif currentClotheButtonBox:getId() == 'secondary' then
      colorId = outfit.legs
    elseif currentClotheButtonBox:getId() == 'detail' then
      colorId = outfit.feet
    end
    outfitWindow:recursiveGetChildById('colorBox' .. colorId):setChecked(true)
  end
end

function updateOutfit()
  if table.empty(outfits) or not outfit then
    return
  end
  local nameWidget = outfitWindow:getChildById('outfitName')
  nameWidget:setText(outfits[currentOutfit][2])

  local availableAddons = outfits[currentOutfit][3]

  local prevAddons = {}
  for k, addon in pairs(addons) do
    prevAddons[k] = addon.widget:isChecked()
    addon.widget:setChecked(false)
    addon.widget:setEnabled(false)
  end

  if availableAddons > 0 then
    for _, i in pairs(ADDON_SETS[availableAddons]) do
      addons[i].widget:setEnabled(true)
    end
  end

  outfit.addons = 0
  for i = 1, #prevAddons do
    local addon = prevAddons[i]
    if addon and addons[i].widget:isEnabled() then
      addons[i].widget:setChecked(true)
    end
  end

  outfit.type = outfits[currentOutfit][1]
  outfitCreature:setOutfit(outfit)
end

 

 

 

aki o .otui

 

 

 

NextOutfitButton < NextButton
PrevOutfitButton < PreviousButton

MainWindow
  !text: tr('Select Outfit')
  size: 338 375

  @onEnter: modules.game_outfit.accept()
  @onEscape: modules.game_outfit.destroy()

  // Creature Boxes
  Creature
    id: outfitCreatureBox
    anchors.top: parent.top
    anchors.left: parent.left
    margin-top: 15
    margin-left: 22
    padding: 4 4 4 4
    fixed-creature-size: true

  Label
    id: outfitName
    !text: tr('No Outfit')
    width: 115
    anchors.bottom: prev.top
    anchors.left: prev.left
    margin-bottom: 2

  NextOutfitButton
    id: outfitNextButton
    anchors.left: outfitCreatureBox.right
    anchors.verticalCenter: outfitCreatureBox.verticalCenter
    margin-left: 3
    enabled: true
    @onClick: modules.game_outfit.nextOutfitType()

  PrevOutfitButton
    id: outfitPrevButton
    anchors.right: outfitCreatureBox.left
    anchors.verticalCenter: outfitCreatureBox.verticalCenter
    margin-right: 3
    enabled: true
    @onClick: modules.game_outfit.previousOutfitType()

  // Addon Check Boxes

  CheckBox
    id: addon1
    !text: tr('Addon 1')
    width: 80
    anchors.top: outfitCreatureBox.bottom
    anchors.left: parent.left
    margin-top: 6
    margin-left: 2
    enabled: false

  CheckBox
    id: addon2
    !text: tr('Addon 2')
    width: 80
    anchors.top: prev.top
    anchors.left: prev.right
    enabled: false

  CheckBox
    id: addon3
    !text: tr('Addon 3')
    width: 80
    anchors.top: prev.top
    anchors.left: prev.right
    enabled: false

  // Body Selection Buttons

  ButtonBox
    id: head
    !text: tr('Head')
    anchors.top: addon1.bottom
    anchors.left: addon1.left
    margin-top: 5
    checked: true
    width: 76

  ButtonBox
    id: primary
    !text: tr('Primary')
    anchors.top: prev.top
    anchors.left: prev.right
    width: 76

  ButtonBox
    id: secondary
    !text: tr('Secondary')
    anchors.top: prev.top
    anchors.left: prev.right
    width: 76

  ButtonBox
    id: detail
    !text: tr('Detail')
    anchors.top: prev.top
    anchors.left: prev.right
    width: 76

  // Color Panel

  Panel
    id: colorBoxPanel
    anchors.top: head.bottom
    anchors.left: head.left
    margin-top: 3
    margin-right: 20
    width: 302
    height: 119
    layout:
      type: grid
      cell-size: 14 14
      cell-spacing: 2
      num-columns: 19
      num-lines: 7

  // Action Button Section

  Button
    id: randomizeButton
    !text: tr('Randomize')
    !tooltip: tr('Randomize characters outfit')
    width: 75
    anchors.left: prev.left
    anchors.top: prev.bottom
    margin-right: 16
    @onClick: modules.game_outfit.randomize()

  HorizontalSeparator
    anchors.left: parent.left
    anchors.right: parent.right
    anchors.bottom: next.top
    margin-bottom: 10
    margin-top: 5

  Button
    id: outfitOkButton
    !text: tr('Ok')
    width: 64
    anchors.right: next.left
    anchors.bottom: parent.bottom
    margin-right: 16
    @onClick: modules.game_outfit.accept()

  Button
    id: outfitCancelButton
    !text: tr('Cancel')
    width: 64
    anchors.right: parent.right
    anchors.bottom: parent.bottom
    @onClick: modules.game_outfit.destroy()

 

 

 

aki o .otmod

 

 

 

Module
  name: game_outfitpoke
  description: Change local player outfit
  author: baxnie, edubart
  website: www.otclient.info
  sandboxed: true
  scripts: [ outfitpoke ]
  @onLoad: init()
  @onUnload: terminate()

 

 

 

o .lua ta com o nome de outfitpoke.lua e o .otui ta com o nome de outfitpokewindow.otui e o .otmod ta com o nome de outfitpoke.otmod

Editado por gristony
Link para o comentário
Compartilhar em outros sites

5 respostass a esta questão

Posts Recomendados

  • 0
 Mano vc copio outfits pra playrs e que por pra fica pra pokes ne ou seja ficara 2 opçoes?

sim mais so basta eu saber como colocar pra ficar as duas opçoes o resto eu tento fazer pois nao to conseguindo colocar pra ficar as duas opçoes que no caso ai como ainda nao fiz pra ser a do pokemon iria as duas opçoes abrir a outfit do player mais ai depois irei tenta colocar pra se a do poke em umas das opcoes

 kkkk vou rir vei depois dessa eu paro de jogar pokemon  

nao entedir mais pra mi vc so veio aki pra fazer flood

Editado por gristony
Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...