mirror of
https://github.com/edubart/otclient.git
synced 2025-10-14 03:24:55 +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 })
|
||||
|
||||
|
@@ -4,5 +4,13 @@ Module
|
||||
author: OTClient team
|
||||
website: https://github.com/edubart/otclient
|
||||
|
||||
dependecies:
|
||||
- game
|
||||
|
||||
@onLoad: |
|
||||
dofile 'inventory'
|
||||
Inventory.init()
|
||||
|
||||
@onUnload: |
|
||||
Inventory.terminate()
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
UIWindow
|
||||
BorderlessGameWindow
|
||||
id: inventoryWindow
|
||||
width: 192
|
||||
height: 154
|
||||
margin-top: 10
|
||||
@@ -93,9 +94,7 @@ UIWindow
|
||||
anchors.left: slot9.left
|
||||
anchors.right: slot9.right
|
||||
margin-top: 5
|
||||
|
||||
text-align: center
|
||||
|
||||
image-source: /core_styles/styles/images/panel_flat.png
|
||||
image-border: 1
|
||||
|
||||
@@ -106,9 +105,7 @@ UIWindow
|
||||
anchors.left: slot10.left
|
||||
anchors.right: slot10.right
|
||||
margin-top: 5
|
||||
|
||||
text-align: center
|
||||
|
||||
image-source: /core_styles/styles/images/panel_flat.png
|
||||
image-border: 1
|
||||
|
||||
|
Reference in New Issue
Block a user