restart #1

Merged
neillc merged 5 commits from restart into main 2024-05-06 11:41:02 +10:00
5 changed files with 45 additions and 5 deletions
Showing only changes of commit fcdd31567d - Show all commits

4
.gitignore vendored
View file

@ -1,2 +1,4 @@
node_modules/*
*zip
.vscode/
mkzip.sh
*.zip

View file

@ -1,6 +1,6 @@
{
"id": "token-action-hud-gurps",
"title": "Token Action HUD GURPS",
"title": "Token Action HUD for GURPS",
"description": "Token Action HUD is a repositionable HUD of actions for a selected token",
"authors": [
{
@ -10,10 +10,10 @@
],
"url": "This is auto replaced",
"flags": {},
"version": "0.0.2",
"version": "0.0.37",
"compatibility": {
"minimum": "11",
"verified": "11.313"
"verified": "11.351"
},
"esmodules": [
"./scripts/init.js"
@ -63,7 +63,8 @@
}
},
"socket": false,
"readme": "https://github.com/Larkinabout/fvtt-token-action-hud-template#readme",
"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",
"protected": false,
"coreTranslation": false,

View file

@ -28,9 +28,11 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => {
let items = this.actor.items
items = coreModule.api.Utils.sortItemsByName(items)
this.items = items
}
if (this.actorType === 'character') {
debugger;
this.#buildCharacterActions()
} else if (!this.actor) {
this.#buildMultipleTokenActions()
@ -42,9 +44,33 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => {
* @private
*/
#buildCharacterActions () {
this._get_attributes({id: "attributes", type:"system"})
this.#buildInventory()
}
_get_attributes(parent) {
const macroType = "attributes";
let actions = [];
let attributes = Object.entries(this.actor.system.attributes)
attributes.forEach((a) => {
const key = a[0];
const value = a[1].value
// img
actions.push({
id: key,
name: coreModule.api.Utils.i18n(key),
description: coreModule.api.Utils.i18n('GURPS.Attributes'),
encodedValue: [macroType, key].join(this.delimiter),
})
});
this.addActions(actions, parent)
}
/**
* Build multiple token actions
* @private

View file

@ -29,6 +29,7 @@ export const ACTION_TYPE = {
* Groups
*/
export const GROUP = {
attributes: { id: 'attributes', name: 'tokenActionHud.gurps.attributes', type: 'system' },
armor: { id: 'armor', name: 'tokenActionHud.template.armor', type: 'system' },
equipment: { id: 'equipment', name: 'tokenActionHud.template.equipment', type: 'system' },
consumables: { id: 'consumables', name: 'tokenActionHud.template.consumables', type: 'system' },
@ -44,6 +45,7 @@ export const GROUP = {
* Item types
*/
export const ITEM_TYPE = {
attributes: { groupId: 'attributes' },
armor: { groupId: 'armor' },
backpack: { groupId: 'containers' },
consumable: { groupId: 'consumables' },

View file

@ -12,6 +12,7 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => {
group.listName = `Group: ${coreModule.api.Utils.i18n(group.listName ?? group.name)}`
})
const groupsArray = Object.values(groups)
debugger;
DEFAULTS = {
layout: [
{
@ -37,6 +38,14 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => {
{ ...groups.rests, nestId: 'utility_rests' },
{ ...groups.utility, nestId: 'utility_utility' }
]
},
{
nestId: 'attributes',
id: 'attributes',
name: coreModule.api.Utils.i18n('GURPS.attributes'),
groups: [
{ ...groups.attributes, nestId: 'attributes_attributes' }
]
}
],
groups: groupsArray