Members
(constant) getDataHelpers
Returns a list of helpers to use when updating data upon following a link.
- Source:
(constant) getPassageHelpers
Returns a list of helpers to use in parsing passage text.
- Source:
(constant) updateData
Updates data
in place with info from newData
- Source:
(constant) updateInventory
Updates data
in place to add/remove items
based on the given delta
.
This will create the inventory on the data object if it does not already exist.
This will also prevent any item's quantity from going below zero.
If there is an object within items
with a key condition
, it will be considered before adding/removing the item.
- Source:
Methods
followLinkReducer(state, action) → {Object}
Updates the state to point currentPassage to action.link (if action.type === ACTIONS.FOLLOW_LINK.type)
This will also check if the link is valid, apply any data to the state from the new passage, and request prompts for the passage as indicated.
Parameters:
Name | Type | Description |
---|---|---|
state |
Object | |
action |
Object |
- Source:
Throws:
Returns:
- Type
- Object
inventoryHasHelper(handlebarsOptions, options) → {String}
Returns context.fn(options.genmo.getData())
if we have all the items in context.hash.items
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
handlebarsOptions |
Object | Handlebars context object |
|||||||||
options |
Object | Options to process inventoryHas Properties
|
- Source:
Returns:
- Type
- String
promptAnswerReducer(state, action) → {Object}
If action.type === ACTION.PROMPT_ANSWER.type
, this will take action.key
and set it to action.value
,
as well as updating the needsPrompt
key in the passage to indicate that this prompt has been fulfilled.
Parameters:
Name | Type | Description |
---|---|---|
state |
Object | |
action |
Object |
- Source:
Returns:
- Type
- Object
setDataHelper(handlebarsOptions, options) → {Object}
Will go through the Handlebars context, taking all key/value attributes
and updating options.data
with their values (overwriting)
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
handlebarsOptions |
Object | Handlebars Context Object |
|||||||||
options |
Object | additional parameters Properties
|
- Source:
Returns:
- Type
- Object
setDataReducer(state, action) → {Object}
If action.type === ACTIONS.SET_DATA.type, takes action.data
and sets it to state.data
Parameters:
Name | Type | Description |
---|---|---|
state |
Object | |
action |
Object |
- Source:
Returns:
- Type
- Object
updateInventoryReducer(state, action) → {Object}
If action.type === ACTIONS.UPDATE_INVENTORY.type, updates the inventory with an inventory list in action.data
Parameters:
Name | Type | Description |
---|---|---|
state |
Object | |
action |
Object |
- Source:
Returns:
- Type
- Object
Type Definitions
ConditionalInventoryItem
Type:
- Object
Properties:
Name | Type | Description |
---|---|---|
condition |
String | |
name |
String |
- Source:
GenmoOptions
Type:
- Object
Properties:
Name | Type | Description |
---|---|---|
outputFunction |
function | |
errorFunction |
function |
Link
Type:
- Object
Properties:
Name | Type | Description |
---|---|---|
name |
String | The display text for the link |
link |
String | Name of the passage this link links to |
pid |
Pid |
Passage
Type:
- Object
Properties:
Name | Type | Attributes | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
text |
String | Full text for the passage |
||||||||||
passageText |
String | The main text for the passage |
||||||||||
links |
Array.<Link> | |||||||||||
name |
String | |||||||||||
pid |
Pid | |||||||||||
position |
Object |
Properties
|
||||||||||
needsPrompt |
Array.<Prompt> |
<optional> |
Pid
Number string identifier for a passage
Type:
- String
Prompt
Type:
- Object
Properties:
Name | Type | Description |
---|---|---|
key |
String | |
complete |
Boolean |
Snapshot
Properties:
Name | Type | Description |
---|---|---|
beforeState |
Object | |
afterState |
Object | |
action |
Object |
- Source:
StoryData
Type:
- Object
Properties:
Name | Type | Description |
---|---|---|
passages |
Array.<Passage> | |
name |
String | |
startnode |
Pid | |
creator |
String | |
creator-version |
String | |
ifid |
String |