From de690b1451e033c0eada82bf7fac592e79581065 Mon Sep 17 00:00:00 2001 From: Mike Bloy Date: Mon, 20 Nov 2023 21:53:35 -0600 Subject: [PATCH] add changelog --- CHANGELOG.md | 11 +++++++++++ macros/requestDialog.js | 21 +++++++++++++++++++-- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a10a0ac..b9b472f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added + +- Power Effect for Havoc +- Power Effect Macro for Havoc +- Power Effect Action for Havoc +- New Macro: Request Roll + - NEW DEPENDENCY: socketlib +- Documentation: + - API Documentation + - Request Roll macro documentation + ## 2.1.0 ### Changed diff --git a/macros/requestDialog.js b/macros/requestDialog.js index a550b76..4372f1a 100644 --- a/macros/requestDialog.js +++ b/macros/requestDialog.js @@ -1,3 +1,5 @@ +const requestRollFromTokens = game.modules.get('swade-mb-helpers').api.requestRollFromTokens + async function main () { let tokens = Array.from(game.user.targets) if (tokens.length < 1) { @@ -29,7 +31,7 @@ async function main () { } for (const attribute of ['Agility', 'Smarts', 'Spirit', 'Strength', 'Vigor']) { menuData.inputs[1].options.push( - { html: `Attribute | ${attribute}`, value: `a|${attribute.toLowerCase()}` } + { html: `Attribute | ${attribute}`, value: `a|${attribute}` } ) } const skillSet = new Set() @@ -42,12 +44,27 @@ async function main () { } for (const skill of Array.from(skillSet).sort()) { menuData.inputs[1].options.push( - { html: `Skill | ${skill}`, value: `s|${skill.toLowerCase()}` }) + { html: `Skill | ${skill}`, value: `s|${skill}` }) } menuData.inputs[1].options.push( { html: 'Skill | Untrained', value: 's|NOSKILL' }) const result = await warpgate.menu(menuData, menuConfig) + + if (result.buttons !== 'ok') { + return + } console.log(result) + const rollMod = result.inputs[2] + const rollModDesc = result.inputs[3] + const rollParts = result.inputs[1].split('|') + const rollType = (rollParts[0] === 'a' ? 'attribute' : 'skill') + const rollDesc = rollParts[1] + const options = {} + if (rollMod !== 0) { + options.mods = [{ label: rollModDesc, value: rollMod }] + } + + requestRollFromTokens(tokens, rollType, rollDesc, options) } main()