Skip to content

Instantly share code, notes, and snippets.

@teddy-dev
Created August 3, 2020 23:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save teddy-dev/78b0444ff685447f8cc4e3d72933b1d7 to your computer and use it in GitHub Desktop.
Save teddy-dev/78b0444ff685447f8cc4e3d72933b1d7 to your computer and use it in GitHub Desktop.
FoundryVTT - Offer short or long rest to all player controlled tokens
let type = 0;
let choice = new Dialog({
title: 'Offer Rest',
content: '<p>Do you want to offer all players a short or long rest?</p>',
buttons: {
short: {
label: 'Short',
callback: () => {
type = 1;
}
},
long: {
label: 'Long',
callback: () => {
type = 2;
}
}
},
default: "short",
close: () => {
for (let token of canvas.tokens.controlled) {
if (token.inCombat === false && token.actor) {
if (type === 1) token.actor.shortRest();
else if (type === 2) token.actor.longRest();
}
}
}
});
choice.render(true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment