From 12e16f8ae87eae2ca30c60d7accca2155a858fcd Mon Sep 17 00:00:00 2001 From: Neill Cox Date: Tue, 7 May 2024 19:16:43 +1000 Subject: [PATCH 1/6] 0.0.98 release --- module.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/module.json b/module.json index 99f4d35..e70b271 100644 --- a/module.json +++ b/module.json @@ -10,7 +10,7 @@ ], "url": "This is auto replaced", "flags": {}, - "version": "0.0.97", + "version": "0.0.98", "compatibility": { "minimum": "11", "verified": "11.351" @@ -63,9 +63,9 @@ } }, "socket": false, - "readme": "http://172.23.0.17:8000/module.json", - "manifest": "http://172.23.0.17:8000/module.json", - "download": "http://172.23.0.17:8000/fvtt-token-action-hud-gurps.zip", + "readme": "https://git.evatt.ingenious.com.au/neillc/token-action-hud-gurps/releases/download/0.0.98/readme.md", + "manifest": "https://git.evatt.ingenious.com.au/neillc/token-action-hud-gurps/releases/download/0.0.98/module.json", + "download": "https://git.evatt.ingenious.com.au/neillc/token-action-hud-gurps/releases/download/0.0.98/fvtt-token-action-hud-gurps.zip", "protected": false, "coreTranslation": false, "library": false From 83b75673322d56cb480acf11bf38c88950f74dc3 Mon Sep 17 00:00:00 2001 From: Neill Cox Date: Tue, 7 May 2024 19:37:56 +1000 Subject: [PATCH 2/6] Packaging release --- module.json | 10 +++++----- readme.md | 17 ++++++----------- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/module.json b/module.json index e70b271..a547662 100644 --- a/module.json +++ b/module.json @@ -8,9 +8,9 @@ "url": "https://git.evatt.ingenious.com.au/neillc" } ], - "url": "This is auto replaced", + "url": "https://git.evatt.ingenious.com.au/neillc/token-action-hud-gurps", "flags": {}, - "version": "0.0.98", + "version": "0.0.99", "compatibility": { "minimum": "11", "verified": "11.351" @@ -63,9 +63,9 @@ } }, "socket": false, - "readme": "https://git.evatt.ingenious.com.au/neillc/token-action-hud-gurps/releases/download/0.0.98/readme.md", - "manifest": "https://git.evatt.ingenious.com.au/neillc/token-action-hud-gurps/releases/download/0.0.98/module.json", - "download": "https://git.evatt.ingenious.com.au/neillc/token-action-hud-gurps/releases/download/0.0.98/fvtt-token-action-hud-gurps.zip", + "readme": "https://git.evatt.ingenious.com.au/neillc/token-action-hud-gurps/releases/download/0.0.99/readme.md", + "manifest": "https://git.evatt.ingenious.com.au/neillc/token-action-hud-gurps/releases/download/0.0.99/module.json", + "download": "https://git.evatt.ingenious.com.au/neillc/token-action-hud-gurps/releases/download/0.0.99/fvtt-token-action-hud-gurps.zip", "protected": false, "coreTranslation": false, "library": false diff --git a/readme.md b/readme.md index 2995a9c..eb27f87 100644 --- a/readme.md +++ b/readme.md @@ -1,14 +1,9 @@ -![Downloads](https://img.shields.io/github/downloads/Larkinabout/fvtt-token-action-hud-template/latest/module.zip?color=2b82fc&label=DOWNLOADS&style=for-the-badge) [![Forge Installs](https://img.shields.io/badge/dynamic/json?label=Forge%20Installs&query=package.installs&suffix=%25&url=https%3A%2F%2Fforge-vtt.com%2Fapi%2Fbazaar%2Fpackage%2Ftoken-action-hud-template&colorB=448d34&style=for-the-badge)](https://forge-vtt.com/bazaar#package=token-action-hud-template) +# Token Action HUD for GURPS -# Token Action HUD Template - -Token Action HUD is a repositionable HUD of actions for a selected token. - -![Token Action HUD](.github/readme/token-action-hud.gif) +Token Action HUD is a repositionable HUD of actions for a selected token for the GURPS game system. # Features - Make rolls directly from the HUD instead of opening your character sheet. -- Use items from the HUD or right-click an item to open its sheet. - Move the HUD and choose to expand the menus up or down. - Unlock the HUD to customise layout and groups per user, and actions per actor. - Add your own macros, journal entries and roll table compendiums. @@ -18,18 +13,18 @@ Token Action HUD is a repositionable HUD of actions for a selected token. ## Method 1 1. On Foundry VTT's **Configuration and Setup** screen, go to **Add-on Modules** 2. Click **Install Module** -3. Search for **Token Action HUD Pathfinder 2** +3. Search for **Token Action HUD for GURPS** 4. Click **Install** next to the module listing ## Method 2 1. On Foundry VTT's **Configuration and Setup** screen, go to **Add-on Modules** 2. Click **Install Module** -3. In the Manifest URL field, paste: `https://github.com/Larkinabout/fvtt-token-action-hud-template/releases/latest/download/module.json` +3. In the Manifest URL field, paste: `https://git.evatt.ingenious.com.au/neillc/token-action-hud-gurps/releases/download/latest/module.json` 4. Click **Install** next to the pasted Manifest URL ## Required Modules -**IMPORTANT** - Token Action HUD Template requires the [Token Action HUD Core](https://foundryvtt.com/packages/token-action-hud-core) module to be installed. +**IMPORTANT** - Token Action HUD for GURPS requires the [Token Action HUD Core](https://foundryvtt.com/packages/token-action-hud-core) module to be installed. ## Recommended Modules Token Action HUD uses the [Color Picker](https://foundryvtt.com/packages/color-picker) library module for its color picker settings. @@ -38,7 +33,7 @@ Token Action HUD uses the [Color Picker](https://foundryvtt.com/packages/color-p For a guide on using Token Action HUD, go to: [How to Use Token Action HUD](https://github.com/Larkinabout/fvtt-token-action-hud-core/wiki/How-to-Use-Token-Action-HUD) -For questions, feature requests or bug reports, please open an issue [here](https://github.com/Larkinabout/fvtt-token-action-hud-core/issues). +For questions, feature requests or bug reports, please open an issue [here](https://git.evatt.ingenious.com.au/neillc/token-action-hud-gurps/issues). Pull requests are welcome. Please include a reason for the request or create an issue before starting one. From e1b155f1f8b21e4236dba4b6e388ccb4a5871ea1 Mon Sep 17 00:00:00 2001 From: Neill Cox Date: Tue, 7 May 2024 19:52:27 +1000 Subject: [PATCH 3/6] Update readme --- readme.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/readme.md b/readme.md index eb27f87..fd10e89 100644 --- a/readme.md +++ b/readme.md @@ -2,6 +2,8 @@ Token Action HUD is a repositionable HUD of actions for a selected token for the GURPS game system. +This should be considered beta software at the moment. I think it's safe to use, but be careful. + # Features - Make rolls directly from the HUD instead of opening your character sheet. - Move the HUD and choose to expand the menus up or down. From fd29caa7f631f38362ceb20e26fc030b14a39913 Mon Sep 17 00:00:00 2001 From: Neill Cox Date: Tue, 7 May 2024 19:56:36 +1000 Subject: [PATCH 4/6] Update readme --- readme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/readme.md b/readme.md index fd10e89..b62f0ef 100644 --- a/readme.md +++ b/readme.md @@ -2,7 +2,7 @@ Token Action HUD is a repositionable HUD of actions for a selected token for the GURPS game system. -This should be considered beta software at the moment. I think it's safe to use, but be careful. +This should be considered beta software at the moment. I think it's safe to use, but be careful! # Features - Make rolls directly from the HUD instead of opening your character sheet. @@ -45,4 +45,4 @@ Thank you to the Community Helpers on Foundry's Discord who provide tireless sup # License -This Foundry VTT module is licensed under a [Creative Commons Attribution 4.0 International License](https://creativecommons.org/licenses/by/4.0/) and this work is licensed under [Foundry Virtual Tabletop EULA - Limited License Agreement for module development](https://foundryvtt.com/article/license/). \ No newline at end of file +This Foundry VTT module is licensed under a [Creative Commons Attribution 4.0 International License](https://creativecommons.org/licenses/by/4.0/) and this work is licensed under [Foundry Virtual Tabletop EULA - Limited License Agreement for module development](https://foundryvtt.com/article/license/). From 6df95256b0dbee38a98d5ebf04d4d9bfde8ce0dc Mon Sep 17 00:00:00 2001 From: Neill Cox Date: Tue, 7 May 2024 20:19:51 +1000 Subject: [PATCH 5/6] packaging update --- module.json | 10 +++++----- readme.md | 18 ++++++++---------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/module.json b/module.json index 99f4d35..a547662 100644 --- a/module.json +++ b/module.json @@ -8,9 +8,9 @@ "url": "https://git.evatt.ingenious.com.au/neillc" } ], - "url": "This is auto replaced", + "url": "https://git.evatt.ingenious.com.au/neillc/token-action-hud-gurps", "flags": {}, - "version": "0.0.97", + "version": "0.0.99", "compatibility": { "minimum": "11", "verified": "11.351" @@ -63,9 +63,9 @@ } }, "socket": false, - "readme": "http://172.23.0.17:8000/module.json", - "manifest": "http://172.23.0.17:8000/module.json", - "download": "http://172.23.0.17:8000/fvtt-token-action-hud-gurps.zip", + "readme": "https://git.evatt.ingenious.com.au/neillc/token-action-hud-gurps/releases/download/0.0.99/readme.md", + "manifest": "https://git.evatt.ingenious.com.au/neillc/token-action-hud-gurps/releases/download/0.0.99/module.json", + "download": "https://git.evatt.ingenious.com.au/neillc/token-action-hud-gurps/releases/download/0.0.99/fvtt-token-action-hud-gurps.zip", "protected": false, "coreTranslation": false, "library": false diff --git a/readme.md b/readme.md index 2995a9c..6a56f92 100644 --- a/readme.md +++ b/readme.md @@ -1,10 +1,8 @@ -![Downloads](https://img.shields.io/github/downloads/Larkinabout/fvtt-token-action-hud-template/latest/module.zip?color=2b82fc&label=DOWNLOADS&style=for-the-badge) [![Forge Installs](https://img.shields.io/badge/dynamic/json?label=Forge%20Installs&query=package.installs&suffix=%25&url=https%3A%2F%2Fforge-vtt.com%2Fapi%2Fbazaar%2Fpackage%2Ftoken-action-hud-template&colorB=448d34&style=for-the-badge)](https://forge-vtt.com/bazaar#package=token-action-hud-template) +# Token Action HUD for GURPS -# Token Action HUD Template +Token Action HUD is a repositionable HUD of actions for a selected token for the GURPS game system. -Token Action HUD is a repositionable HUD of actions for a selected token. - -![Token Action HUD](.github/readme/token-action-hud.gif) +This should be considered beta software at the moment. I think it's safe to use, but be careful! # Features - Make rolls directly from the HUD instead of opening your character sheet. @@ -18,18 +16,18 @@ Token Action HUD is a repositionable HUD of actions for a selected token. ## Method 1 1. On Foundry VTT's **Configuration and Setup** screen, go to **Add-on Modules** 2. Click **Install Module** -3. Search for **Token Action HUD Pathfinder 2** +3. Search for **Token Action HUD for GURPS** 4. Click **Install** next to the module listing ## Method 2 1. On Foundry VTT's **Configuration and Setup** screen, go to **Add-on Modules** 2. Click **Install Module** -3. In the Manifest URL field, paste: `https://github.com/Larkinabout/fvtt-token-action-hud-template/releases/latest/download/module.json` +3. In the Manifest URL field, paste: `https://git.evatt.ingenious.com.au/neillc/token-action-hud-gurps/releases/download/latest/module.json` 4. Click **Install** next to the pasted Manifest URL ## Required Modules -**IMPORTANT** - Token Action HUD Template requires the [Token Action HUD Core](https://foundryvtt.com/packages/token-action-hud-core) module to be installed. +**IMPORTANT** - Token Action HUD for GURPS requires the [Token Action HUD Core](https://foundryvtt.com/packages/token-action-hud-core) module to be installed. ## Recommended Modules Token Action HUD uses the [Color Picker](https://foundryvtt.com/packages/color-picker) library module for its color picker settings. @@ -38,7 +36,7 @@ Token Action HUD uses the [Color Picker](https://foundryvtt.com/packages/color-p For a guide on using Token Action HUD, go to: [How to Use Token Action HUD](https://github.com/Larkinabout/fvtt-token-action-hud-core/wiki/How-to-Use-Token-Action-HUD) -For questions, feature requests or bug reports, please open an issue [here](https://github.com/Larkinabout/fvtt-token-action-hud-core/issues). +For questions, feature requests or bug reports, please open an issue [here](https://git.evatt.ingenious.com.au/neillc/token-action-hud-gurps/issues). Pull requests are welcome. Please include a reason for the request or create an issue before starting one. @@ -48,4 +46,4 @@ Thank you to the Community Helpers on Foundry's Discord who provide tireless sup # License -This Foundry VTT module is licensed under a [Creative Commons Attribution 4.0 International License](https://creativecommons.org/licenses/by/4.0/) and this work is licensed under [Foundry Virtual Tabletop EULA - Limited License Agreement for module development](https://foundryvtt.com/article/license/). \ No newline at end of file +This Foundry VTT module is licensed under a [Creative Commons Attribution 4.0 International License](https://creativecommons.org/licenses/by/4.0/) and this work is licensed under [Foundry Virtual Tabletop EULA - Limited License Agreement for module development](https://foundryvtt.com/article/license/). From e66a425e22edb10bdd430e64b92046a54c165014 Mon Sep 17 00:00:00 2001 From: Neill Cox Date: Sat, 18 May 2024 19:31:09 +1000 Subject: [PATCH 6/6] Handle skills/spells in containers --- module.json | 8 +- scripts/action-handler.js | 160 +++++++++++++++++++++++++++++--------- scripts/defaults.js | 1 - scripts/roll-handler.js | 20 ----- 4 files changed, 127 insertions(+), 62 deletions(-) diff --git a/module.json b/module.json index a547662..3ab37c3 100644 --- a/module.json +++ b/module.json @@ -10,7 +10,7 @@ ], "url": "https://git.evatt.ingenious.com.au/neillc/token-action-hud-gurps", "flags": {}, - "version": "0.0.99", + "version": "0.0.100", "compatibility": { "minimum": "11", "verified": "11.351" @@ -63,9 +63,9 @@ } }, "socket": false, - "readme": "https://git.evatt.ingenious.com.au/neillc/token-action-hud-gurps/releases/download/0.0.99/readme.md", - "manifest": "https://git.evatt.ingenious.com.au/neillc/token-action-hud-gurps/releases/download/0.0.99/module.json", - "download": "https://git.evatt.ingenious.com.au/neillc/token-action-hud-gurps/releases/download/0.0.99/fvtt-token-action-hud-gurps.zip", + "readme": "https://git.evatt.ingenious.com.au/neillc/token-action-hud-gurps/releases/download/0.0.100/readme.md", + "manifest": "https://git.evatt.ingenious.com.au/neillc/token-action-hud-gurps/releases/download/0.0.100/module.json", + "download": "https://git.evatt.ingenious.com.au/neillc/token-action-hud-gurps/releases/download/0.0.100/fvtt-token-action-hud-gurps.zip", "protected": false, "coreTranslation": false, "library": false diff --git a/scripts/action-handler.js b/scripts/action-handler.js index afc5d70..5bf7861 100644 --- a/scripts/action-handler.js +++ b/scripts/action-handler.js @@ -32,7 +32,6 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => { } if (this.actorType === 'character') { - //debugger; this.#buildCharacterActions() } else if (!this.actor) { this.#buildMultipleTokenActions() @@ -44,7 +43,6 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => { * @private */ #buildCharacterActions () { - // debugger; this._get_attributes({id: "attributes", type:"system"}) this._get_skills({id: "skills", type:"system"}) this._get_spells({id: "spells", type:"system"}) @@ -81,7 +79,6 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => { } _get_melee_attacks(parent) { - // debugger; const macroType = "melee"; let actions = []; @@ -112,7 +109,6 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => { } _get_ranged_attacks(parent) { - // debugger; const macroType = "ranged"; let actions = []; @@ -143,57 +139,146 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => { } _get_skills(parent) { - // debugger; const macroType = "skills"; let actions = []; + // let skills = Object.entries(this.actor.system.skills) + // skills.forEach((a) => { + // const key = a[1].name; + // const value = a[1].level + // // img + + // let actionId = key; + // let otf = 'Sk:"' + key + '"'; // This is going to end badly if the delimiter is set to ":" + + + // actions.push({ + // id: actionId, + // name: coreModule.api.Utils.i18n(key) + " - test", + // description: coreModule.api.Utils.i18n('GURPS.Skills'), + // encodedValue: [macroType, otf].join(this.delimiter), + // }) + + + // }); let skills = Object.entries(this.actor.system.skills) - skills.forEach((a) => { - const key = a[1].name; - const value = a[1].level - // img - - let actionId = key; - let otf = 'Sk:"' + key + '"'; // This is going to end badly if the delimiter is set to ":" - - + // let map = this._get_contents(skills) + let map = this._get_contents(skills, macroType) + let names = Array.from(map.keys()).sort() + names.forEach((a)=> { actions.push({ - id: actionId, - name: coreModule.api.Utils.i18n(key), - description: coreModule.api.Utils.i18n('GURPS.Skills'), - encodedValue: [macroType, otf].join(this.delimiter), + id: a, + name: map.get(a).name, + description: map.get(a).description, + encodedValue: map.get(a).encodedValue }) + }) - - }); this.addActions(actions, parent) } + _get_contents(spells, macroType, result= new Map()) { + console.debug(spells); + console.debug(macroType); + console.debug(result) + + if (spells instanceof Array) { + for (const spell in spells) { + let _contains = spells[spell][1].contains; + + if (Reflect.has(_contains,"00000")) { + for( const i in _contains) { + result = this._get_contents(_contains[i], macroType, result) + } + } + else { + let name = spells[spell][1].name; + let level = spells[spell][1].level; + let otf_type = null; + + if (macroType === "skills") { + otf_type = 'Sk' + } + else { + otf_type = 'Sp' + } + + let otf = otf_type + ':"' + name + '"'; + + if (level) { + result.set( + name, + { + id: name, + name: coreModule.api.Utils.i18n(name), + description: coreModule.api.Utils.i18n('GURPS.Spells'), + encodedValue: [macroType, otf].join(this.delimiter), + } + ) + } + } + } + } + else { + if (spells.uuid) { + let _contains = spells.contains; + if (Reflect.has(_contains,"00000")) { + for( const i in _contains) { + result = this._get_contents(_contains[i], macroType, result) + } + } + else { + let spell = spells; + + let name = spell.name; + let level = spell.level; + let otf_type = null; + + if (macroType === "skills") { + otf_type = 'Sk' + } + else { + otf_type = 'Sp' + } + + let otf = otf_type + ':"' + name + '"'; + + + if (level) { + result.set( + name, + { + id: name, + name: coreModule.api.Utils.i18n(name), + description: coreModule.api.Utils.i18n('GURPS.Spells'), + encodedValue: [macroType, otf].join(this.delimiter), + } + ) + } + + } + } + } + return result; + } + + _get_spells(parent) { - // debugger; const macroType = "spells"; let actions = []; - let spells = Object.entries(this.actor.system.spells) - spells.forEach((a) => { - const key = a[1].name; - const value = a[1].level - // img - - let actionId = key; - let otf = 'Sp:"' + key + '"'; // This is going to end badly if the delimiter is set to ":" - - + let spell_map = this._get_contents(spells, macroType) + let spell_names = Array.from(spell_map.keys()).sort() + spell_names.forEach((a)=> { actions.push({ - id: actionId, - name: coreModule.api.Utils.i18n(key), - description: coreModule.api.Utils.i18n('GURPS.Spells'), - encodedValue: [macroType, otf].join(this.delimiter), + id: a, + name: spell_map.get(a).name, + description: spell_map.get(a).description, + encodedValue: spell_map.get(a).encodedValue }) + }) - - }); this.addActions(actions, parent) } @@ -256,3 +341,4 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => { } } }) + diff --git a/scripts/defaults.js b/scripts/defaults.js index c8a92bd..bf3afa4 100644 --- a/scripts/defaults.js +++ b/scripts/defaults.js @@ -12,7 +12,6 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => { group.listName = `Group: ${coreModule.api.Utils.i18n(group.listName ?? group.name)}` }) const groupsArray = Object.values(groups) - // debugger; DEFAULTS = { layout: [ { diff --git a/scripts/roll-handler.js b/scripts/roll-handler.js index 23799af..2bf0689 100644 --- a/scripts/roll-handler.js +++ b/scripts/roll-handler.js @@ -130,7 +130,6 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => { if ( actionId == "WILL" ) actionId = "Will"; if ( actionId == "PER" ) actionId = "Per"; - // debugger; let formula = '3d6'; let targetmods = null; let prefix = "Rolls vs" // should be i18n of 'GURPS.rollVs' @@ -148,8 +147,6 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => { async #handleMeleeAction(actor, actionId) { /* Melee attacks are done using the otf method. Grab the otf and pass it to the function. */ let GURPS = globalThis.GURPS; - - // debugger; let otf = actionId; GURPS.executeOTF(otf, actor=actor); } @@ -157,39 +154,22 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => { async #handleRangedAction(actor, actionId) { /* Melee attacks are done using the otf method. Grab the otf and pass it to the function. */ let GURPS = globalThis.GURPS; - - // debugger; let otf = actionId; GURPS.executeOTF(otf, actor=actor); - - - // doRoll({ actor, formula, targetmods, prefix, thing, chatthing, origtarget: target, optionalArgs: opt }) } async #handleSkillAction(actor, actionId) { /* Skills are done using the otf method. Grab the otf and pass it to the function. */ let GURPS = globalThis.GURPS; - // actor, formula, targetmods, prefix = '', thing = '', chatthing = '', origtarget = -1, optionalArgs = {}, - - // executeOTF(inputstring, priv = false, event = null, actor = null) { - - // debugger; let otf = actionId; GURPS.executeOTF(otf, actor=actor); - - - // doRoll({ actor, formula, targetmods, prefix, thing, chatthing, origtarget: target, optionalArgs: opt }) } async #handleSpellAction(actor, actionId) { /* Spells are done using the otf method. Grab the otf and pass it to the function. */ let GURPS = globalThis.GURPS; - - // debugger; let otf = actionId; GURPS.executeOTF(otf, actor=actor); - - } } })