creature square init, inventory improvements

This commit is contained in:
Henrique
2011-11-13 20:23:21 -02:00
parent 5f34648c0e
commit fd80589c7b
7 changed files with 91 additions and 25 deletions

View File

@@ -29,7 +29,7 @@ function Inventory.destroy()
end
-- hooked events
function Game.onInventoryChange(slot, item)
function Inventory.onInventoryChange(slot, item)
local slotId
if slot == InventorySlotHead then
slotId = 'head'
@@ -57,5 +57,18 @@ function Game.onInventoryChange(slot, item)
itemWidget:setItem(item)
end
function Inventory.onFreeCapacityChange(freeCapacity)
local widget = window:getChildById('capacity')
widget:setText("Cap:\n" .. freeCapacity)
end
function Inventory.onSoulChange(soul)
local widget = window:getChildById('soul')
widget:setText("Soul:\n" .. soul)
end
connect(Game, { onLogin = Inventory.create,
onLogout = Inventory.destroy })
onLogout = Inventory.destroy,
onInventoryChange = Inventory.onInventoryChange,
onFreeCapacityChange = Inventory.onFreeCapacityChange,
onSoulChange = Inventory.onSoulChange })