- 0
Juntar 2 Modules
-
Quem Está Navegando 0 membros estão online
- Nenhum usuário registrado visualizando esta página.
-
Conteúdo Similar
-
- 0 respostas
- 1282 visualizações
-
- 0 respostas
- 1256 visualizações
-
- 1 resposta
- 1065 visualizações
-
minimap Alguem Pode Exporta o MiniMap Pra Min Por Favor // Por Completo Todos Floor 0x15
Por Muvuka,
- 1 resposta
- 1937 visualizações
-
- 0 respostas
- 1565 visualizações
-
Pergunta
mkldoido 0
Ola galera, tudo bom com vocês?
Bom é o seguinte, eu andei mexendo no OtClient do Slicer esses dias, tentando aprender um pouco
e eu quis tentar juntar as barras de hp e mp com a janela Inventory(janela dos slots de backpack, orda, vara, etc..)
dai eu peguei o healthinfo.lua e coloquei quase tudo no inventory.lua, e arrumei os "possíveis" erros
o problema, é que não funcionou, e o otclient não manifesta nenhum tipo de erro em região especifica, isso complica muito, pois
não saber onde errou, é a pior coisa que tem.. Se alguém puder olhar os arquivos e me dizer se tem algo errado
ficaria muito agradecido!
Inventory.lua
Icons = {}
Icons[1] = { tooltip = tr('You are poisoned'), path = '/game_inventory/icons/poisoned.png', id = 'condition_poisoned' }
Icons[2] = { tooltip = tr('You are burning'), path = '/game_inventory/icons/burning.png', id = 'condition_burning' }
Icons[4] = { tooltip = tr('You are electrified'), path = '/game_inventory/icons/electrified.png', id = 'condition_electrified' }
Icons[8] = { tooltip = tr('You are drunk'), path = '/game_inventory/icons/drunk.png', id = 'condition_drunk' }
Icons[16] = { tooltip = tr('You are protected by a magic shield'), path = '/game_inventory/icons/magic_shield.png', id = 'condition_magic_shield' }
Icons[32] = { tooltip = tr('You are paralysed'), path = '/game_inventory/icons/slowed.png', id = 'condition_slowed' }
Icons[64] = { tooltip = tr('You are hasted'), path = '/game_inventory/icons/haste.png', id = 'condition_haste' }
Icons[128] = { tooltip = tr('You may not logout during a fight'), path = '/game_inventory/icons/logout_block.png', id = 'condition_logout_block' }
Icons[256] = { tooltip = tr('You are drowing'), path = '/game_inventory/icons/drowning.png', id = 'condition_drowning' }
Icons[512] = { tooltip = tr('You are freezing'), path = '/game_inventory/icons/freezing.png', id = 'condition_freezing' }
Icons[1024] = { tooltip = tr('You are dazzled'), path = '/game_inventory/icons/dazzled.png', id = 'condition_dazzled' }
Icons[2048] = { tooltip = tr('You are cursed'), path = '/game_inventory/icons/cursed.png', id = 'condition_cursed' }
Icons[4096] = { tooltip = tr('You are strengthened'), path = '/game_inventory/icons/strengthened.png', id = 'condition_strengthened' }
Icons[8192] = { tooltip = tr('You may not logout or enter a protection zone'), path = '/game_inventory/icons/protection_zone_block.png', id = 'condition_protection_zone_block' }
Icons[16384] = { tooltip = tr('You are within a protection zone'), path = '/game_inventory/icons/protection_zone.png', id = 'condition_protection_zone' }
Icons[32768] = { tooltip = tr('You are bleeding'), path = '/game_inventory/icons/bleeding.png', id = 'condition_bleeding' }
Icons[65536] = { tooltip = tr('You are hungry'), path = '/game_inventory/icons/hungry.png', id = 'condition_hungry' }
InventorySlotStyles = {
[inventorySlotHead] = "HeadSlot",
[inventorySlotNeck] = "NeckSlot",
[inventorySlotBack] = "BackSlot",
[inventorySlotBody] = "BodySlot",
[inventorySlotRight] = "RightSlot",
[inventorySlotLeft] = "LeftSlot",
[inventorySlotLeg] = "LegSlot",
[inventorySlotFeet] = "FeetSlot",
[inventorySlotFinger] = "FingerSlot",
[inventorySlotAmmo] = "AmmoSlot"
}
healthBar = nil
manaBar = nil
soulBar = nil
healthLabel = nil
manaLabel = nil
CatchsLabel = nil
PokesLabel = nil
inventoryWindow = nil
inventoryPanel = nil
inventoryButton = nil
function init()
connect(LocalPlayer, { onInventoryChange = onInventoryChange,
onHealthChange = onHealthChange,
onManaChange = onManaChange,
onStatesChange = onStatesChange,
onSoulChange = onSoulChange,
onFreeCapacityChange = onFreeCapacityChange })
connect(g_game, { onGameStart = refresh})
g_keyboard.bindKeyDown('Ctrl+I', toggle)
inventoryButton = TopMenu.addRightGameToggleButton('inventoryButton', tr('Inventory') .. ' (Ctrl+I)', 'inventory.png', toggle)
inventoryButton:setOn(true)
inventoryWindow = g_ui.loadUI('inventory.otui', modules.game_interface.getRightPanel())
inventoryWindow:disableResize()
inventoryPanel = inventoryWindow:getChildById('contentsPanel')
healthBar = inventoryWindow:recursiveGetChildById('healthBar')
manaBar = inventoryWindow:recursiveGetChildById('manaBar')
healthLabel = inventoryWindow:recursiveGetChildById('healthLabel')
manaLabel = inventoryWindow:recursiveGetChildById('manaLabel')
soulBar = inventoryWindow:recursiveGetChildById('soulBar')
CatchsLabel = inventoryWindow:recursiveGetChildById('CatchsLabel') --alterado
PokesLabel = inventoryWindow:recursiveGetChildById('PokesLabel') --alterado
if g_game.isOnline() then
local localPlayer = g_game.getLocalPlayer()
onHealthChange(localPlayer, localPlayer:getHealth(), localPlayer:getMaxHealth())
onManaChange(localPlayer, localPlayer:getMana(), localPlayer:getMaxMana())
onStatesChange(localPlayer, localPlayer:getStates(), 0)
onSoulChange(localPlayer, localPlayer:getSoul())
onFreeCapacityChange(localPlayer, localPlayer:getFreeCapacity())
end
refresh()
inventoryWindow:setup()
end
function terminate()
disconnect(LocalPlayer, { onInventoryChange = onInventoryChange
onHealthChange = onHealthChange,
onManaChange = onManaChange,
onStatesChange = onStatesChange,
onSoulChange = onSoulChange,
onFreeCapacityChange = onFreeCapacityChange })
disconnect(g_game, { onGameStart = refresh})
g_keyboard.unbindKeyDown('Ctrl+I')
healthBar = nil
manaBar = nil
soulBar = nil
healthLabel = nil
manaLabel = nil
CatchsLabel = nil --alterado
PokesLabel = nil --alterado
HealthInfo = nil
inventoryWindow:destroy()
inventoryButton:destroy()
end
function refresh()
local player = g_game.getLocalPlayer()
for i=InventorySlotFirst,InventorySlotLast do
if g_game.isOnline() then
onInventoryChange(player, i, player:getInventoryItem(i))
else
onInventoryChange(player, i, nil)
end
end
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
function onHealthChange(localPlayer, health, maxHealth)
healthLabel:setText(health .. ' / ' .. maxHealth)
healthBar:setPercent(health / maxHealth * 100)
end
function onManaChange(localPlayer, mana, maxMana)
manaLabel:setText(mana .. ' / ' .. maxMana)
local percent
if maxMana == 0 then
percent = 100
else
percent = (mana * 100)/maxMana
end
manaBar:setPercent(percent)
end
function onSoulChange(localPlayer, soul) --alterado \/
CatchsLabel:setText('Catchs' .. ': ' .. soul)
end
function onFreeCapacityChange(player, freeCapacity)
PokesLabel:setText('Pokes' .. ': ' .. freeCapacity)
end
function onStatesChange(localPlayer, now, old)
if now == old then return end
local bitsChanged = bit32.bxor(now, old)
for i = 1, 32 do
local pow = math.pow(2, i-1)
if pow > bitsChanged then break end
local bitChanged = bit32.band(bitsChanged, pow)
if bitChanged ~= 0 then
toggleIcon(bitChanged)
end
end
end
function toggleIcon(bitChanged)
local content = inventoryWindow:recursiveGetChildById('conditionPanel')
local icon = content:getChildById(Icons[bitChanged].id)
if icon then
icon:destroy()
else
icon = g_ui.createWidget('ConditionWidget', content)
icon:setId(Icons[bitChanged].id)
icon:setImageSource(Icons[bitChanged].path)
icon:setTooltip(Icons[bitChanged].tooltip)
end
end
-- hooked events
function onInventoryChange(player, slot, item, oldItem)
if slot >= InventorySlotPurse then return end
local itemWidget = inventoryPanel:getChildById('slot' .. slot)
if item then
itemWidget:setStyle('Item')
itemWidget:setItem(item)
else
itemWidget:setStyle(InventorySlotStyles[slot])
itemWidget:setItem(nil)
end
end
inventory.otui
InventoryItem < Item
HeadSlot < InventoryItem
id: slot1
image-source: /game_inventory/slots/head.png
&position: {x=65535, y=1, z=0}
BodySlot < InventoryItem
id: slot4
image-source: /game_inventory/slots/body.png
&position: {x=65535, y=4, z=0}
LegSlot < InventoryItem
id: slot7
image-source: /game_inventory/slots/legs.png
&position: {x=65535, y=7, z=0}
FeetSlot < InventoryItem
id: slot8
image-source: /game_inventory/slots/feet.png
&position: {x=65535, y=8, z=0}
NeckSlot < InventoryItem
id: slot2
image-source: /game_inventory/slots/neck.png
&position: {x=65535, y=2, z=0}
LeftSlot < InventoryItem
id: slot6
image-source: /game_inventory/slots/left-hand.png
&position: {x=65535, y=6, z=0}
FingerSlot < InventoryItem
id: slot9
image-source: /game_inventory/slots/finger.png
&position: {x=65535, y=9, z=0}
BackSlot < InventoryItem
id: slot3
image-source: /game_inventory/slots/back.png
&position: {x=65535, y=3, z=0}
RightSlot < InventoryItem
id: slot5
image-source: /game_inventory/slots/right-hand.png
&position: {x=65535, y=5, z=0}
AmmoSlot < InventoryItem
id: slot10
image-source: /game_inventory/slots/ammo.png
&position: {x=65535, y=10, z=0}
HealthBar < ProgressBar
id: healthBar
height: 15
background-color: #ff4444
anchors.top: slot6.bottom
anchors.left: slot6.left
anchors.right: slot9.right
ManaBar < ProgressBar
id: manaBar
height: 15
background-color: #4444ff
anchors.top: helthBar.bottom
anchors.left: helthBar.left
anchors.right: helthBar.right
margin-top: 4
HealthLabel < GameLabel
id: healthLabel
color: white
text-align: center
font: verdana-11px-rounded
anchors.fill: healthBar
margin-top: 2
text: 0 / 0
ManaLabel < GameLabel
id: manaLabel
color: white
text-align: center
font: verdana-11px-rounded
anchors.fill: manaBar
margin-top: 2
text: 0 / 0
CatchsLabel < GameLabel
id: CatchsLabel
text-align: right
color: white
font: verdana-11px-rounded
anchors.top: manaBar.bottom
anchors.right: manaBar.right
anchors.left: manaBar.horizontalCenter
margin-top: 5
margin-right: 3
text: Catchs:
PokesLabel < GameLabel
id: PokesLabel
color: white
font: verdana-11px-rounded
anchors.bottom: manaBar.bottom
anchors.left: manaBar.left
anchors.right: manaBar.horizontalCenter
margin-top: 5
margin-left: 3
text: Pokes:
ConditionWidget < UIWidget
size: 18 18
$!first:
margin-left: 2
MiniWindow
id: inventoryWindow
!text: tr('Inventory')
icon: inventory.png
height: 175
@onClose: modules.game_inventory.onMiniWindowClose()
&save: true
MiniWindowContents
HeadSlot
anchors.top: slot8.bottom
anchors.left: slot10.right
margin-left: 10
margin-top: 5
BodySlot
anchors.top: slot3.bottom
anchors.left: slot2.right
margin-left: 10
margin-top: 5
LegSlot
anchors.top: parent.top
anchors.left: parent.left
margin-top: 3
FeetSlot
anchors.top: prev.bottom
anchors.horizontalCenter: prev.horizontalCenter
margin-top: 2
NeckSlot
anchors.top: slot3.bottom
anchors.left: slot6.right
margin-left: 10
margin-top: 5
LeftSlot
anchors.top: slot3.bottom
anchors.left: slot3.left
margin-top: 5
FingerSlot
anchors.top: slot3.bottom
anchors.left: slot4.right
margin-left: 10
margin-top: 5
BackSlot
anchors.top: slot8.bottom
anchors.left: slot8.left
margin-top: 5
margin-left: 9
RightSlot
anchors.top: slot8.bottom
anchors.left: slot3.right
margin-left: 10
margin-top: 5
AmmoSlot
anchors.top: slot8.bottom
anchors.left: slot5.right
margin-left: 10
margin-top: 5
HealthBar
HealthLabel
ManaBar
ManaLabel
Panel
id: conditionPanel
layout:
type: horizontalBox
height: 22
margin-top: 4
padding: 2
anchors.top: prev.bottom
anchors.left: parent.left
anchors.right: parent.right
border-width: 1
border-color: #00000077
background-color: #ffffff11
CatchsLabel
PokesLabel
Link para o comentário
Compartilhar em outros sites
4 respostass a esta questão
Posts Recomendados