Initial work on attributes

This commit is contained in:
Neill Cox 2024-05-06 11:22:00 +10:00
parent 3ab2643f31
commit fcdd31567d
5 changed files with 45 additions and 5 deletions

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