Initial work on attributes
This commit is contained in:
parent
3ab2643f31
commit
fcdd31567d
5 changed files with 45 additions and 5 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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' },
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue