Skip to content

Rest Recovery API

Adam Oresten edited this page Jun 8, 2022 · 8 revisions

Important note

All of the functions below should be preceded with game.restrecovery, see the examples below.

Examples:

Make actor sated of both food and water for the day

const actorD = game.actors.getName("Murderhobo McStabby");
await game.restrecovery.setActorConsumableValues(actorD, { food: 1, water: 1 });

Change the module profile to another one.

await game.restrecovery.setActiveProfile("Desert");

This is just an example, you would have to set up a module profile yourself.

This "Desert" module profile could for example set a higher water consumption per day, and limit short rests to 2 per long rest.

Functions

getAllProfiles()Array.<string>

Returns an array containing all the module profile names

getAllProfilesData()object

Returns the module profile object with each ones' settings

getProfileData(inProfileName)object

Returns a given module profile's data if it exists

getActiveProfile()string

Returns the name of the active module profile

getActiveProfileData()object

Returns the data for the active module profile

setActiveProfile(inProfileName)Promise.<object>

Sets the current active module profile

updateProfiles(inProfiles)Promise.<*>

Updates all module profiles with new settings. This may be a partial update (such as only updating some keys of some profiles).

updateProfile(inProfileName, inData)Promise.<*>

Applies new settings on a given module profile. This may be a partial update (such as only updating one key of a given profile).

setActorConsumableValues(actor, [food], [water], [starvation])Promise.<boolean>

Sets the food, water, and/or starvation levels of a given actor.

getAllProfiles() ⇒ Array.<string>

Returns an array containing all the module profile names

getAllProfilesData() ⇒ object

Returns the module profile object with each ones' settings

getProfileData(inProfileName) ⇒ object

Returns a given module profile's data if it exists

Param Type
inProfileName string

getActiveProfile() ⇒ string

Returns the name of the active module profile

getActiveProfileData() ⇒ object

Returns the data for the active module profile

setActiveProfile(inProfileName) ⇒ Promise.<object>

Sets the current active module profile

Param Type
inProfileName string

updateProfiles(inProfiles) ⇒ Promise.<*>

Updates all module profiles with new settings. This may be a partial update (such as only updating some keys of some profiles).

Param Type
inProfiles object

updateProfile(inProfileName, inData) ⇒ Promise.<*>

Applies new settings on a given module profile. This may be a partial update (such as only updating one key of a given profile).

Param Type
inProfileName string
inData object

setActorConsumableValues(actor, [food], [water], [starvation]) ⇒ Promise.<boolean>

Sets the food, water, and/or starvation levels of a given actor.

Param Type Description
actor Actor
[food] number \ null food
[water] number \ null water
[starvation] number \ null starvation