Skip to content
This repository was archived by the owner on Sep 10, 2025. It is now read-only.

Latest commit

 

History

History
179 lines (101 loc) · 6.43 KB

File metadata and controls

179 lines (101 loc) · 6.43 KB

The api is reachable from the variable game.modules.get('downtime-dnd5e').api or from the socket libary socketLib on the variable game.modules.get('downtime-dnd5e').socket if present and active.

The documentation can be out of sync with the API code checkout the code if you want to dig up API

You can find some javascript examples here => macros <=

[DEPRECATED] updateActivityProgress(actor, activityName, newProgress) ⇒ Promise<void>

updateActivity(actor, activityName, newProgress) ⇒ Promise<void>

This method will update the selected Tracked Item, replacing the value of the progress property with the value provided.

Returns: Promise<void> - Return nothing

Param Type Description Note
actor Actor or string The reference to the actor can be the Actor object or the id or the uuid or the name of the actor (it is advisable to not use the name it will remain for retro compatibility)
activityName string The activity name, is a string that matches the name of the Tracked Item you'd like to update. It's case sensitive.
newProgress number or string The progress to apply is an integer. This is the value you'd like to set the item's progress to. (can be a number on string format too)

Example basic:

await game.modules.get('downtime-dnd5e').api.updateActivityProgress("Nazir", "Smithing Proficiency", 75)

or

await game.modules.get('downtime-dnd5e').api.updateActivity("Nazir", "Smithing Proficiency", 75)

[DEPRECATED] getActivitiesForActor(actor) ⇒ Activity[]

getActivities(actor) ⇒ Activity[]

Return all the activities on the actor

Returns: Activity[] - Return all the activities on the actor

Param Type Description Note
actor Actor or string The reference to the actor can be the Actor object or the id or the uuid or the name of the actor (it is advisable to not use the name it will remain for retro compatibility)

Example basic:

game.modules.get('downtime-dnd5e').api.getActivitiesForActor("Nazir")

or

game.modules.get('downtime-dnd5e').api.getActivities("Nazir")

getActivity(actor, activityName) ⇒ Activity

Return a specific activity on the actor

Returns: Activity - Return a specific activity

Param Type Description Note
actor Actor or string The reference to the actor can be the Actor object or the id or the uuid or the name of the actor (it is advisable to not use the name it will remain for retro compatibility)
activityName string The activity name, is a string that matches the name of the Tracked Item you'd like to update. It's case sensitive.

Example basic:

game.modules.get('downtime-dnd5e').api.getActivity("Nazir", "Smithing Proficiency")

getCategories(actor) ⇒ Category[]

Return all the categories on the actor

Returns: Category[] - Return all the categories on the actor

Param Type Description Note
actor Actor or string The reference to the actor can be the Actor object or the id or the uuid or the name of the actor (it is advisable to not use the name it will remain for retro compatibility)

Example basic:

game.modules.get('downtime-dnd5e').api.getCategories("Nazir")

[DEPRECATED] updateWorldActivityProgress(activityName, newProgress, explicitActor) ⇒ Promise<void>

updateWorldActivity(activityName, newProgress, explicitActor) ⇒ Promise<void>

This method will update the selected Tracked Item, replacing the value of the progress property with the value provided.

Returns: Promise<void> - Return nothing

Param Type Description Note
activityName string The activity name, is a string that matches the name of the Tracked Item you'd like to update. It's case sensitive.
newProgress number or string The progress to apply is an integer. This is the value you'd like to set the item's progress to. (can be a number on string format too)
explicitActor Actor or string OPTIONAL: The reference to a explicit actor can be the Actor object or the id or the uuid or the name of the actor (it is advisable to not use the name it will remain for retro compatibility) ATTENTION: If no explicit actor is benn set the actor connected to the player will be used

Example basic:

await game.modules.get('downtime-dnd5e').api.updateWorldActivityProgress("Smithing Proficiency", 75, "Nazir")

or

await game.modules.get('downtime-dnd5e').api.updateWorldActivity("Smithing Proficiency", 75, "Nazir")

getWorldActivities() ⇒ Activity[]

Return all the world activities on the actor

Returns: Activity[] - Return all the activities of the world

Param Type Description Note

Example basic:

game.modules.get('downtime-dnd5e').api.getWorldActivities()

getWorldActivity(activityName) ⇒ Activity

Return a specific activity world

Returns: Activity - Return a specific activity

Param Type Description Note
activityName string The activity name, is a string that matches the name of the Tracked Item you'd like to update. It's case sensitive.

Example basic:

game.modules.get('downtime-dnd5e').api.getWorldActivity("Smithing Proficiency");

getWorldCategories() ⇒ Category[]

Return all the world categories on the actor

Returns: Category[] - Return all the categories of the world

Param Type Description Note

Example basic:

game.modules.get('downtime-dnd5e').api.getWorldCategories()