Module ...

Handles actors stats

Functions

_M:addObject (inven_id, o) Adds an object to an inventory
_M:canAddToInven (id) Tells if an inventory still has room left
_M:canWearObject (o, try_slot) Can we wear this item?
_M:defineInventory (short_name, name, is_worn, desc, show_equip, infos) Defines stats Static!
_M:dropFloor (inven, item, vocal, all) Drop an object on the floor
_M:findInAllInventories (name, getname) Finds an object by name in all the actor's inventories
_M:findInAllInventoriesBy (prop, value) Finds an object by property in all the actor's inventories
_M:findInInventory (inven, name, getname) Finds an object by name in an inventory
_M:findInInventoryBy (inven, prop, value) Finds an object by property in an inventory
_M:getInven (id) Returns the content of an inventory as a table
_M:getObjectOffslot (o) Returns the possible offslot
_M:init (t) Initialises inventories with default values if needed
_M:inventoryApply (inven, fct) Applies fct over all items
_M:inventoryApplyAll (fct, inven) Applies fct over all items in all inventories
_M:itemPosition (inven, o) Returns the position of an item in the given inventory, or nil
_M:onAddObject (o) Called upon adding an object
_M:onDropObject (o) Called upon dropping an object
_M:onRemoveObject (o) Called upon removing an object
_M:onTakeoff (o) Call when an object is taken off
_M:onWear (o) Call when an object is worn
_M:pickupFloor (i, vocal, no_sort) Picks an object from the floor
_M:removeObject (inven, item, no_unstack) Removes an object from inventory
_M:showEquipInven (title, filter, action, on_select, inven) Show combined equipment/inventory dialog
_M:showEquipment (title, filter, action) Show equipment dialog
_M:showInventory (title, inven, filter, action) Show inventory dialog
_M:showPickupFloor (title, filter, action) Show floor pickup dialog
_M:sortInven (inven) Re-order inventory, sorting and stacking it
_M:takeoffObject (inven, item) Takeoff item
_M:wearObject (o, replace, vocal) Wear/wield an item


Functions

_M:addObject (inven_id, o)
Adds an object to an inventory

Parameters

  • inven_id:
  • o:

Return value:

false if the object could not be added otherwise true and the inventory index where it is now
_M:canAddToInven (id)
Tells if an inventory still has room left

Parameters

  • id:
_M:canWearObject (o, try_slot)
Can we wear this item?

Parameters

  • o:
  • try_slot:
_M:defineInventory (short_name, name, is_worn, desc, show_equip, infos)
Defines stats Static!

Parameters

  • short_name:
  • name:
  • is_worn:
  • desc:
  • show_equip:
  • infos:
_M:dropFloor (inven, item, vocal, all)
Drop an object on the floor

Parameters

  • inven: the inventory to drop from
  • item: the item id to drop
  • vocal:
  • all:

Return value:

the object removed or nil if no item existed
_M:findInAllInventories (name, getname)
Finds an object by name in all the actor's inventories

Parameters

  • name: the name to look for
  • getname: the parameters to pass to getName(), if nil the default is {no_count=true, force_id=true}
_M:findInAllInventoriesBy (prop, value)
Finds an object by property in all the actor's inventories

Parameters

  • prop: the property to look for
  • value: the value to look for, can be a function
_M:findInInventory (inven, name, getname)
Finds an object by name in an inventory

Parameters

  • inven: the inventory to look into
  • name: the name to look for
  • getname: the parameters to pass to getName(), if nil the default is {no_count=true, force_id=true}
_M:findInInventoryBy (inven, prop, value)
Finds an object by property in an inventory

Parameters

  • inven: the inventory to look into
  • prop: the property to look for
  • value: the value to look for, can be a function
_M:getInven (id)
Returns the content of an inventory as a table

Parameters

  • id:
_M:getObjectOffslot (o)
Returns the possible offslot

Parameters

  • o:
_M:init (t)
Initialises inventories with default values if needed

Parameters

  • t:
_M:inventoryApply (inven, fct)
Applies fct over all items

Parameters

  • inven: the inventory to look into
  • fct: the function to be called. It will receive three parameters: inven, item, object
_M:inventoryApplyAll (fct, inven)
Applies fct over all items in all inventories

Parameters

  • fct: the function to be called. It will receive three parameters: inven, item, object
  • inven: the inventory to look into
_M:itemPosition (inven, o)
Returns the position of an item in the given inventory, or nil

Parameters

  • inven:
  • o:
_M:onAddObject (o)
Called upon adding an object

Parameters

  • o:
_M:onDropObject (o)
Called upon dropping an object

Parameters

  • o:
_M:onRemoveObject (o)
Called upon removing an object

Parameters

  • o:
_M:onTakeoff (o)
Call when an object is taken off

Parameters

  • o:
_M:onWear (o)
Call when an object is worn

Parameters

  • o:
_M:pickupFloor (i, vocal, no_sort)
Picks an object from the floor

Parameters

  • i:
  • vocal:
  • no_sort:
_M:removeObject (inven, item, no_unstack)
Removes an object from inventory

Parameters

  • inven: the inventory to drop from
  • item: the item id to drop
  • no_unstack: if the item was a stack takes off the whole stack if true

Return value:

the object removed or nil if no item existed and a boolean saying if there is no more objects
_M:showEquipInven (title, filter, action, on_select, inven)
Show combined equipment/inventory dialog

Parameters

  • title:
  • filter: nil or a function that filters the objects to list
  • action: a function called when an object is selected
  • on_select:
  • inven: the inventory (from self:getInven())
_M:showEquipment (title, filter, action)
Show equipment dialog

Parameters

  • title:
  • filter: nil or a function that filters the objects to list
  • action: a function called when an object is selected
_M:showInventory (title, inven, filter, action)
Show inventory dialog

Parameters

  • title:
  • inven: the inventory (from self:getInven())
  • filter: nil or a function that filters the objects to list
  • action: a function called when an object is selected
_M:showPickupFloor (title, filter, action)
Show floor pickup dialog

Parameters

  • title:
  • filter: nil or a function that filters the objects to list
  • action: a function called when an object is selected
_M:sortInven (inven)
Re-order inventory, sorting and stacking it

Parameters

  • inven:
_M:takeoffObject (inven, item)
Takeoff item

Parameters

  • inven:
  • item:
_M:wearObject (o, replace, vocal)
Wear/wield an item

Parameters

  • o:
  • replace:
  • vocal:

Valid XHTML 1.0!