Optional
rng: RngInterface | SeedProtected
conditionsGlobal conditions that can be used by loot table pools and entries.
The keys in the object are the function identifier used in the table entries/pools
Protected
Optional
defaultDefault RNG source when none is given
Protected
functionsGlobal functions that can be used by loot table entries.
The keys in the object are the function identifier used in the table entries
Protected
Optional
rngRNG source given by the end user
Protected
Optional
rngRNG Constructor for making new RNGs
Whether to throw errors when conditions are missing, otherwise just does console.error
Whether to throw errors when functions are missing, otherwise just does console.error
Static
versionCreate an entry for a loot pool, either with object definition or from a loot table
Create a loot pool for use in a loot table
Protected
finishProtected
finishProtected
getAs we dont expose the class as default, in browser it would be nice if there was a way to create new instances. This can be done using this function.
Optional
rng: RngInterface | SeedProtected
isUsed for Typescript type guarding and parameter checking
Protected
isUsed for Typescript type guarding and parameter checking
Protected
isUsed for Typescript type guarding and parameter checking
Optional
rng: anyLoad a table from a file.
The file can be local or a url. If running in browser, it's always treated as a URL. When run in node, it will only treat it as a URL if it's prefixed with http.
This function expects a single table to be located in the file, as the base object.
Loads a table from a local file
Loads a table from a url
Load serialized tables from a file.
This is just a wrapper around unserializing json contents of a file.
Loads serialized tables from a local file
Load serialized tables from a url
Optional
rng: RngInterface | SeedProtected
pathTurns a JSON representation into a LootTable, and does the same for all nested tables inside pools recursively.
Serializes a LootTable ready for converting to text, e.g. JSON
Returns a key value object, where the keys are the loot table filenames/ids
Optional
had?: Set<any>Optional
includeOptional
key?: string | numberconst result = await ultraloot.serialize(table);
result = {
kitchen_cupboard: {
fn: 'kitchen_cupboard',
pools: [
{
entries: [
{
type: 'table',
item: 'vegetables'
},
{
type: 'table',
item: 'fruit'
}
]
}
]
},
fruit_bowl: {
fn: 'fruit_bowl',
pools: [
{
entries: [
{
type: 'table',
item: 'fruit'
}
]
}
]
},
vegetables: {
fn: 'vegetables',
pools: [
{
entries: [
{
id: 'carrot'
},
{
id: 'cabbage'
},
]
}
]
},
fruit: {
fn: 'fruit',
pools: [
{
entries: [
{
id: 'apple'
},
{
id: 'pear'
},
]
}
]
}
}
Convert a LootTable to JSON
The table to serialize
Options
Optional
includeWhether to include the RNG seed in the serialized tables
The resulting LootTable representation in a JSON string
Protected
transformProtected
transformUnserializes tables serialized with the "serialize" function
Record of tables serialized using the "serialize" function
A key/value pairing of tables
Todo
detect recursively required tables
Example