Echo Hollow

Because Pr0n is the Highest Form of Art.

User Tools

Site Tools


libecho:classes:inventory

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
libecho:classes:inventory [2022/05/22 12:11] – [onClose( config )] leelibecho:classes:inventory [2022/05/22 18:29] lee
Line 24: Line 24:
   * item: the thing to be added to the Inventory.   * item: the thing to be added to the Inventory.
   * actor: the (optional, can be null) Person that is doing the adding.   * actor: the (optional, can be null) Person that is doing the adding.
-  * force: if true, the item will be added regardless of the result of the pre- functions.+  * force: if true, the pre- and post- functions will not be called, and item will be added regardless.
  
   * Returns: true if the item was added or was already in the inventory, or false if the item could not be added to the inventory.   * Returns: true if the item was added or was already in the inventory, or false if the item could not be added to the inventory.
Line 34: Line 34:
   * item: the thing to be removed from the Inventory.   * item: the thing to be removed from the Inventory.
   * actor: the (optional, can be null) Person that is doing the removal.   * actor: the (optional, can be null) Person that is doing the removal.
-  * force: if true, the item will be removed regardless of the result of the pre- functions.+  * force: if true, the pre- and post- functions will not be called, and item will be removed regardless.
  
   * Returns: true if the item was removed or was not in the inventory to begin with, or false if the item could not be removed from the inventory.   * Returns: true if the item was removed or was not in the inventory to begin with, or false if the item could not be removed from the inventory.
Line 105: Line 105:
 ==== The Configuration Object ==== ==== The Configuration Object ====
  
-The configuration object can contain a number of fields.  The values of these fields can be a literal or a function.  In the case of a function it is called with the arguments of ( item, srcInventory, destInventory ), and the return value is used as the configuration value.+The configuration object can contain a number of fields.  The values of some of these fields can be a literal or a function.  In the case of a function it is called with the listed arguments and the return value is used as the configuration value.
  
 For more information, see the InventoryUI Macro source code. For more information, see the InventoryUI Macro source code.
Line 130: Line 130:
 Function to be called when inventory UI is closed.  The InventoryUI macro uses this to evaluate the tweecode in the contents of the macro body when the InventoryUI dialog is closed. Function to be called when inventory UI is closed.  The InventoryUI macro uses this to evaluate the tweecode in the contents of the macro body when the InventoryUI dialog is closed.
   * Type: Function   * Type: Function
-  * Return Value: Void+  * Returns: Void
   * //config//: The config object that was passed to InventoryIU.render().   * //config//: The config object that was passed to InventoryIU.render().
   * Default: undefined   * Default: undefined
Line 137: Line 137:
 === allowClose( config ) === === allowClose( config ) ===
 If this function returns a String, that value will be printed in place of the "Done" link at the bottom of the inventory modal (preventing the modal from being closed).  This can be used to prevent the inventory from being able to be closed until certain items have been taken or dropped, for example.  If the return value is a falsy value, the regular "Done" link will be displayed, allowing the modal to be closed. If this function returns a String, that value will be printed in place of the "Done" link at the bottom of the inventory modal (preventing the modal from being closed).  This can be used to prevent the inventory from being able to be closed until certain items have been taken or dropped, for example.  If the return value is a falsy value, the regular "Done" link will be displayed, allowing the modal to be closed.
-  * Type: Function (returning String)+  * Type: Function 
 +  * Returns: String
   * Default: undefined   * Default: undefined
   * Optional   * Optional
Line 149: Line 150:
 === leftAction === === leftAction ===
 The action label for moving item from left inventory. The action label for moving item from left inventory.
-  * Type: String+  * Type: String | Function(config) returning String
   * Default: "Drop"   * Default: "Drop"
   * Optional   * Optional
Line 155: Line 156:
 === leftActioned === === leftActioned ===
 The left action success word.  "ObjectName: dropped." The left action success word.  "ObjectName: dropped."
-  * Type: String+  * Type: String | Function(config) returning String
   * Default: "dropped"   * Default: "dropped"
   * Optional   * Optional
Line 161: Line 162:
 === rightAction === === rightAction ===
 The action label for moving item from right inventory. The action label for moving item from right inventory.
-  * Type: String+  * Type: String | Function(config) returning String
   * Default: "Take"   * Default: "Take"
   * Optional   * Optional
Line 167: Line 168:
 === rightActioned === === rightActioned ===
 The left action success word.  "ObjectName: taken." The left action success word.  "ObjectName: taken."
-  * Type: String+  * Type: String | Function(config) returning String
   * Default: "taken"   * Default: "taken"
   * Optional   * Optional
  
-=== canShowOnLeft ===+=== canShowOnLeft( item, config ) ===
 Called to check if the object will be displayed in left inventory at all. Called to check if the object will be displayed in left inventory at all.
-  * Type: Boolean+  * Type: Function 
 +  * Returns: Boolean 
 +  * //item//: The item which we are checking whether or not we should show. 
 +  * //config//: The config object that was passed to InventoryIU.render().
   * Default: true   * Default: true
   * Optional   * Optional
  
-=== canShowOnRight ===+=== canShowOnRight( item, config ) ===
 Called to check if the object will be displayed in right inventory at all. Called to check if the object will be displayed in right inventory at all.
-  * Type: Boolean+  * Type: Function 
 +  * Returns: Boolean 
 +  * //item//: The item which we are checking whether or not we should show. 
 +  * //config//: The config object that was passed to InventoryIU.render().
   * Default: true   * Default: true
   * Optional   * Optional
  
-=== canMoveFromLeft ===+=== canMoveFromLeft( item, config ) ===
 The item will be shown in the left inventory, but will we show the control to move it to the right inventory? The item will be shown in the left inventory, but will we show the control to move it to the right inventory?
-  * Type: Boolean+  * Type: Function 
 +  * Returns: Boolean 
 +  * //item//: The item which we are checking whether or not we should show. 
 +  * //config//: The config object that was passed to InventoryIU.render().
   * Default: true   * Default: true
   * Optional   * Optional
  
-=== canMoveFromRight ===+=== canMoveFromRight( item, config ) ===
 The item will be shown in the right inventory, but will we show the control to move it to the right inventory? The item will be shown in the right inventory, but will we show the control to move it to the right inventory?
-  * Type: Boolean+  * Type: Function 
 +  * Returns: Boolean 
 +  * //item//: The item which we are checking whether or not we should show. 
 +  * //config//: The config object that was passed to InventoryIU.render().
   * Default: true   * Default: true
   * Optional   * Optional
  
-=== getSortCategory ===+=== getSortCategory( item, inventory, config ) ===
 Return object category for the sort selector. Return object category for the sort selector.
-  * Type: String+  * Type: Function 
 +  * Returns: String 
 +  * //item//: The item which we are checking whether or not we should show. 
 +  * //inventory//: The item which we are checking whether or not we should show. 
 +  * //config//: The config object that was passed to InventoryIU.render().
   * Default: item.inventoryCategory | "Other"   * Default: item.inventoryCategory | "Other"
   * Optional   * Optional
Line 203: Line 220:
 === canShowLeftSelector === === canShowLeftSelector ===
 Will the left selector be shown? Will the left selector be shown?
-  * Type: Boolean+  * Type: Boolean | or Function(config) returning Boolean
   * Default: true   * Default: true
   * Optional   * Optional
Line 209: Line 226:
 === canShowRightSelector === === canShowRightSelector ===
 Will the right selector be shown? Will the right selector be shown?
-  * Type: Boolean+  * Type: Boolean | or Function(config) returning Boolean
   * Default: true   * Default: true
   * Optional   * Optional
  
-=== moveFromLeft ===+=== moveFromLeft( item, config ) ===
 Function to call to move item from left to right inventory. If undefined, the built-in implementation will be used. Function to call to move item from left to right inventory. If undefined, the built-in implementation will be used.
-  * Type: Function (returning void+  * Type: Function 
-  * Default: undefined+  * Returns: Void 
 +  * //item//: The item which we are checking whether or not we should show. 
 +  * //config//: The config object that was passed to InventoryIU.render(). 
 +  * Default: the builtin implementation is used if none is defined in the config object
   * Optional   * Optional
  
-=== moveFromRight ===+=== moveFromRight( item, config ) ===
 Function to call to move item from right to left inventory. If undefined, the built-in implementation will be used. Function to call to move item from right to left inventory. If undefined, the built-in implementation will be used.
-  * Type: Function (returning void+  * Type: Function 
-  * Default: undefined+  * Returns: Void 
 +  * //item//: The item which we are checking whether or not we should show. 
 +  * //config//: The config object that was passed to InventoryIU.render(). 
 +  * Default: the builtin implementation is used if none is defined in the config object 
 +  * Optional 
 + 
 +=== leftTitle === 
 +Override the left title. 
 +  * Type: String | Function(config) returning String 
 +  * Default: if the left inventory is a Person then "Soandso (Inventory)", otherwise leftInventory.AName. 
 +  * Optional 
 + 
 +=== rightTitle === 
 +Override the right title. 
 +  * Type: String | Function(config) returning String 
 +  * Default: if the right inventory is a Person then "Soandso (Inventory)", otherwise rightInventory.AName. 
 +  * Optional 
 + 
 +=== leftName( item, config ) === 
 +Override the left label for item. 
 +  * Type: Function 
 +  * Returns: String 
 +  * //item//: The item which we are checking whether or not we should show. 
 +  * //config//: The config object that was passed to InventoryIU.render(). 
 +  * Default: the item's AName 
 +  * Optional 
 + 
 +=== rightName( item, config ) === 
 +Override the right label for item. 
 +  * Type: Function 
 +  * Returns: String 
 +  * //item//: The item which we are checking whether or not we should show. 
 +  * //config//: The config object that was passed to InventoryIU.render(). 
 +  * Default: the item's AName
   * Optional   * Optional
  
 === outerTpl === === outerTpl ===
 Override the builtin outer HTML template. Override the builtin outer HTML template.
-  * Type: String+  * Type: String | Function(config) returning String
   * Default: undefined   * Default: undefined
   * Optional   * Optional
Line 233: Line 286:
 === listitemTplLeft === === listitemTplLeft ===
 Override the builtin left list item HTML template. Override the builtin left list item HTML template.
-  * Type: String+  * Type: String | Function(config) returning String
   * Default: undefined   * Default: undefined
   * Optional   * Optional
Line 239: Line 292:
 === listitemTplRight === === listitemTplRight ===
 Override the builtin right list item HTML template. Override the builtin right list item HTML template.
-  * Type: String+  * Type: String | Function(config) returning String
   * Default: undefined   * Default: undefined
   * Optional   * Optional
  
-=== leftTitle === +=== detailsTpl === 
-Override the left title+Override the builtin item details HTML template
-  * Type: String +  * Type: String | Function(config) returning String
-  * Default: undefined +
-  * Optional +
- +
-=== rightTitle === +
-Override the right title. +
-  * Type: String+
   * Default: undefined   * Default: undefined
   * Optional   * Optional