41 lines
1.0 KiB
JavaScript
41 lines
1.0 KiB
JavaScript
const requestFearRollFromTokens = game.modules.get('swade-mb-helpers').api.requestFearRollFromTokens;
|
|
|
|
async function main() {
|
|
let tokens = Array.from(game.user.targets);
|
|
if (tokens.length < 1) {
|
|
tokens = canvas.tokens.controlled;
|
|
}
|
|
if (tokens.length < 1) {
|
|
ui.notifications.error('Please target or select some tokens');
|
|
return;
|
|
}
|
|
|
|
new Dialog({
|
|
title: 'Request Fear roll...',
|
|
content: `
|
|
<form>
|
|
<p>Requesting Fear roll from ${tokens.map((t) => t.name).join(', ')}.</p>
|
|
<div class="form-group">
|
|
<label>Fear Check Penalty
|
|
<input type="number" value="0" name="fear">
|
|
</label>
|
|
</div>
|
|
</form>`,
|
|
buttons: {
|
|
ok: {
|
|
label: 'Request Roll',
|
|
callback: (html) => {
|
|
const fear = parseInt(html.find('input[name="fear"]').val()) || 0;
|
|
const options = { targetNumber: 4, fear };
|
|
requestFearRollFromTokens(tokens, options);
|
|
},
|
|
},
|
|
cancel: {
|
|
label: 'Cancel',
|
|
},
|
|
},
|
|
}).render(true);
|
|
}
|
|
|
|
main();
|