Methods
canHold(obj) → {boolean}
Returns true if the item may have contents.
Parameters:
Name | Type | Description |
---|---|---|
obj |
object | The in-game item |
- Source:
Returns:
true
if the item is a container, surface, or NPC
- Type
- boolean
disableItemLink(el)
Disables the item link class. (Used when an item is out of scope.)
Parameters:
Name | Type | Description |
---|---|---|
el |
object | The item link class to be disabled |
- Source:
enableItemLinks(el)
Enables the item link class. (Used when an item is in scope.)
Parameters:
Name | Type | Description |
---|---|---|
el |
object | The item link class to enable |
- Source:
getAllChildren(item, isRoomopt) → {array}
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
item |
object | The in-game item |
|
isRoom |
boolean |
<optional> |
Set to |
- Source:
Returns:
An array of items
- Type
- array
getAllChildrenLinks(item) → {string}
Used for NPCs. (Containers use getContentsLink.)
Parameters:
Name | Type | Description |
---|---|---|
item |
object | The in-game item |
- Source:
Returns:
- String to display list of item's contents' links
- Type
- string
getArticle(item, type) → {string}
Returns 'a', 'an', or 'the' when type is set to INDEFINITE or DEFINITE.
Returns false
otherwise.
Parameters:
Name | Type | Description |
---|---|---|
item |
object | The in-game item |
type |
number | DEFINITE or INDEFINITE |
- Source:
- To Do:
-
- Should this simply
return
rather thanreturn false
if no type is requested?
- Should this simply
Returns:
'a', 'an', or 'the' (or false
)
- Type
- string
getContentsLink(o) → {string}
Used for containers. (NPCs use getAllChildrenLinks.)
Parameters:
Name | Type | Description |
---|---|---|
o |
object | The in-game item |
- Source:
Returns:
A string, which contains item links of the item's contents
- Type
- string
getDirectChildren(item) → {array}
Returns an array of the item's direct children.
To return a recursive list, use getAllChildren.
Parameters:
Name | Type | Description |
---|---|---|
item |
object | The in-game item |
- Source:
Returns:
Array of items
- Type
- array
getDisplayAliasLink(item, optionsopt, capopt) → {string}
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
item |
object | The in-game item |
|
options |
object |
<optional> |
Includes options such as 'article' (@see getArticle) |
cap |
boolean |
<optional> |
If |
- Source:
Returns:
- The item's link
- Type
- string
getItemLink(obj, idopt, capitaliseopt) → {string}
Uses getName
to return a link for the item.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
obj |
object | The in-game item |
|
id |
string |
<optional> |
Optional display alias. This parameter is not required. |
capitalise |
boolean |
<optional> |
Option to capitalize the first letter in the string. Not required. Default is |
- Source:
Returns:
The item's link
- Type
- string
getRoomContents(room) → {array}
Parameters:
Name | Type | Description |
---|---|---|
room |
object | The room item |
- Source:
- See:
Returns:
An array of items in the room
- Type
- array
getVerbsLinks(obj) → {string}
Returns a string containing all available verbs for the item.
Parameters:
Name | Type | Description |
---|---|---|
obj |
object | The in-game item |
- Source:
- See:
Returns:
String list of verb links available for the item.
- Type
- string
handleExamineHolder(params)
Used by npcs and containers to print a list of contents.
Must be manually added to an item's examine
attribute.
Parameters:
Name | Type | Description |
---|---|---|
params |
object | Actually, this function does nothing with |
- Source:
- To Do:
-
- Learn about name modifiers, because this code may be reinventing the wheel.
handleObjLnkClick(cmd)
Handles item link actions passed via clicking
Parameters:
Name | Type | Description |
---|---|---|
cmd |
string | The command to be parsed |
- Source:
hasChildren(item) → {boolean}
Parameters:
Name | Type | Description |
---|---|---|
item |
object | The in-game item |
- Source:
Returns:
true
if the item is containing or carrying items.
- Type
- boolean
toggleDropdown(element)
Toggles the display of the element
Parameters:
Name | Type | Description |
---|---|---|
element |
object | The HTML element |
- Source:
updateAllItemLinkVerbs()
Updates all verb links in items' dropdown menus
- Source:
- See:
updateExitLinks()
Updates all the exit links, making sure only available exits have enabled links.
- Source:
- See:
updateItemLinkVerbs(obj)
Sets the current available verbs in the item link dropdown menu
Parameters:
Name | Type | Description |
---|---|---|
obj |
object | The in-game item |
- Source:
- See: