mirror of
https://github.com/edubart/otclient.git
synced 2025-10-14 19:44:54 +02:00
restore inventory and healthbar
* make inventory/healthbar work again allowing reload * changes in top menu toggle buttons * all modules are now reloadable by default * fix warning when using fade in * remove some unused files
This commit is contained in:
@@ -5,15 +5,31 @@ local inventoryWindow
|
||||
local inventoryButton
|
||||
|
||||
-- public functions
|
||||
function Inventory.create()
|
||||
inventoryWindow = displayUI('inventory.otui', GameInterface.getRightPanel())
|
||||
inventoryButton = TopMenu.addGameButton('inventoryButton', 'Inventory (Ctrl+I)', 'inventory.png', Inventory.toggle)
|
||||
inventoryButton:setOn(true)
|
||||
function Inventory.init()
|
||||
connect(g_game, { onGameEnd = Inventory.clear,
|
||||
onInventoryChange = Inventory.onInventoryChange,
|
||||
onFreeCapacityChange = Inventory.onFreeCapacityChange,
|
||||
onSoulChange = Inventory.onSoulChange })
|
||||
|
||||
Keyboard.bindKeyDown('Ctrl+I', Inventory.toggle)
|
||||
|
||||
inventoryWindow = displayUI('inventory.otui', GameInterface.getRightPanel())
|
||||
inventoryButton = TopMenu.addGameToggleButton('inventoryButton', 'Inventory (Ctrl+I)', 'inventory.png', Inventory.toggle)
|
||||
inventoryButton:setOn(true)
|
||||
|
||||
if g_game.isOnline() then
|
||||
Inventory.reload()
|
||||
end
|
||||
end
|
||||
|
||||
function Inventory.destroy()
|
||||
function Inventory.terminate()
|
||||
connect(g_game, { onGameEnd = Inventory.clear,
|
||||
onInventoryChange = Inventory.onInventoryChange,
|
||||
onFreeCapacityChange = Inventory.onFreeCapacityChange,
|
||||
onSoulChange = Inventory.onSoulChange })
|
||||
|
||||
Keyboard.unbindKeyDown('Ctrl+I')
|
||||
|
||||
inventoryWindow:destroy()
|
||||
inventoryWindow = nil
|
||||
inventoryButton:destroy()
|
||||
@@ -26,6 +42,12 @@ function Inventory.toggle()
|
||||
inventoryButton:setOn(visible)
|
||||
end
|
||||
|
||||
function Inventory.clear()
|
||||
end
|
||||
|
||||
function Inventory.reload()
|
||||
end
|
||||
|
||||
-- hooked events
|
||||
function Inventory.onInventoryChange(slot, item)
|
||||
local itemWidget = inventoryWindow:getChildById('slot' .. slot)
|
||||
@@ -41,10 +63,3 @@ function Inventory.onSoulChange(soul)
|
||||
local widget = inventoryWindow:getChildById('soul')
|
||||
widget:setText("Soul:\n" .. soul)
|
||||
end
|
||||
|
||||
connect(g_game, { onGameStart = Inventory.create,
|
||||
onGameEnd = Inventory.destroy,
|
||||
onInventoryChange = Inventory.onInventoryChange,
|
||||
onFreeCapacityChange = Inventory.onFreeCapacityChange,
|
||||
onSoulChange = Inventory.onSoulChange })
|
||||
|
||||
|
Reference in New Issue
Block a user