Methods
(static) checkCondition(operation) → {Boolean}
Given the operation and data, returns whether the condition is satisfied.
If the operator requires numbers, and either operand is not, this function returns false.
Valid operators: gte, lte, lt, gt, eq, seq, has (binary), !has (binary)
Parameters:
| Name | Type | Description |
|---|---|---|
operation |
Operation |
- Source:
Returns:
- Type
- Boolean
(static) inventoryFilter(item, data) → {Object|null}
Returns the item if the condition is met, otherwise returns null.
Parameters:
| Name | Type | Description |
|---|---|---|
item |
String | |
data |
Object |
- Source:
Returns:
- Type
- Object | null
(static) linkFilter(link, data) → {Link|null}
Returns the link if the condition in the link is met, otherwise null.
Link conditions use || to separate the link name from its condition.
Parameters:
| Name | Type | Description |
|---|---|---|
link |
Link | |
data |
Object |
- Source:
Returns:
- Type
- Link | null
(inner) checkConditionString(conditionStr, data) → {Boolean}
Parses the condition string, and returns whether the condition is satisfied
A condition string is trinary, e.g. varName lte 10 checks whether data.varName is less than or equal to 10
There are two binary operators, has and !has. e.g. has coin checks whether data.inventory contains a coin.
Parameters:
| Name | Type | Description |
|---|---|---|
conditionStr |
String | |
data |
Object |
- Source:
Returns:
- Type
- Boolean
Type Definitions
Operation
Properties:
| Name | Type | Description |
|---|---|---|
data |
Object | The source data to check against |
variable |
String | The variable in the data to check |
operator |
String | |
ref |
String | The value to compare |
- Source: