mirror of
https://github.com/edubart/otclient.git
synced 2025-10-14 03:24:55 +02:00
fix use with, improve move, change icons, improve topbar
This commit is contained in:
@@ -1,31 +1,42 @@
|
||||
Inventory = {}
|
||||
|
||||
-- private variables
|
||||
local window = nil
|
||||
local inventoryWindow
|
||||
local inventoryButton
|
||||
|
||||
-- public functions
|
||||
function Inventory.create()
|
||||
window = displayUI('inventory.otui', { parent = Game.gameRightPanel })
|
||||
inventoryWindow = displayUI('inventory.otui', { parent = Game.gameRightPanel })
|
||||
inventoryButton = TopMenu.addGameButton('inventoryButton', 'Skills (Ctrl+I)', 'inventory.png', Inventory.toggle)
|
||||
inventoryButton:setOn(true)
|
||||
end
|
||||
|
||||
function Inventory.destroy()
|
||||
window:destroy()
|
||||
window = nil
|
||||
inventoryWindow:destroy()
|
||||
inventoryWindow = nil
|
||||
inventoryButton:destroy()
|
||||
inventoryButton = nil
|
||||
end
|
||||
|
||||
function Inventory.toggle()
|
||||
local visible = not inventoryWindow:isExplicitlyVisible()
|
||||
inventoryWindow:setVisible(visible)
|
||||
inventoryButton:setOn(visible)
|
||||
end
|
||||
|
||||
-- hooked events
|
||||
function Inventory.onInventoryChange(slot, item)
|
||||
local itemWidget = window:getChildById('slot' .. slot)
|
||||
local itemWidget = inventoryWindow:getChildById('slot' .. slot)
|
||||
itemWidget:setItem(item)
|
||||
end
|
||||
|
||||
function Inventory.onFreeCapacityChange(freeCapacity)
|
||||
local widget = window:getChildById('capacity')
|
||||
local widget = inventoryWindow:getChildById('capacity')
|
||||
widget:setText("Cap:\n" .. freeCapacity)
|
||||
end
|
||||
|
||||
function Inventory.onSoulChange(soul)
|
||||
local widget = window:getChildById('soul')
|
||||
local widget = inventoryWindow:getChildById('soul')
|
||||
widget:setText("Soul:\n" .. soul)
|
||||
end
|
||||
|
||||
|
BIN
modules/game_inventory/inventory.png
Normal file
BIN
modules/game_inventory/inventory.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 753 B |
Reference in New Issue
Block a user