several changes that were not properly split up

- Macro: Request fear check specialization macro
- Macro: Fear Table to call the new fearTable api endpoint
- API: rulesVersion property
- API: fearTable(actor) calls the relevant premium core rules module's fear
  table
- API: added requestFearRollFromTokens special helper
- Trait roll hooks for:
    - Glow/Shroud
    - Range modifiers
- added a summary chat message for the roll results to requested rolls.
- added a target number option to requested rolls.
This commit is contained in:
2023-12-23 22:50:15 -06:00
parent c43fafa7df
commit 6ed989c4bc
44 changed files with 514 additions and 95 deletions
+39
View File
@@ -0,0 +1,39 @@
const requestFearRollFromTokens = game.modules.get('swade-mb-helpers').api.requestRollFromTokens
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
}
const menuData = {
inputs: [
{ type: 'info', label: `Requesting Fear roll from ${tokens.map(t => t.name).join(', ')}` },
{ type: 'number', label: 'Fear Check Penalty', options: 0 }
],
buttons: [
{ label: 'Request roll', value: 'ok', default: true },
{ label: 'Cancel', value: 'cancel' }
]
}
const menuConfig = {
title: 'Request Fear roll...'
}
const result = await warpgate.menu(menuData, menuConfig)
if (result.buttons !== 'ok') {
return
}
console.log(result)
const fear = result.inputs[1] || 0
const targetNumber = 4
const options = { targetNumber, fear }
requestFearRollFromTokens(tokens, options)
}
main()
+4 -2
View File
@@ -19,7 +19,8 @@ async function main () {
options: []
},
{ type: 'number', label: 'Roll Modifier', options: 0 },
{ type: 'text', label: 'Roll Modifier Description', options: 'Roll Modifier' }
{ type: 'text', label: 'Roll Modifier Description', options: 'Roll Modifier' },
{ type: 'number', label: 'Target Number', options: 4 }
],
buttons: [
{ label: 'Request roll', value: 'ok', default: true },
@@ -59,7 +60,8 @@ async function main () {
const rollParts = result.inputs[1].split('|')
const rollType = (rollParts[0] === 'a' ? 'attribute' : 'skill')
const rollDesc = rollParts[1]
const options = {}
const targetNumber = result.inputs[4] || 4
const options = { targetNumber }
if (rollMod !== 0) {
options.mods = [{ label: rollModDesc, value: rollMod }]
}