Skills working
This commit is contained in:
parent
b6c3da1127
commit
9a6fab6014
5 changed files with 63 additions and 10 deletions
|
|
@ -44,7 +44,9 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => {
|
|||
* @private
|
||||
*/
|
||||
#buildCharacterActions () {
|
||||
debugger;
|
||||
this._get_attributes({id: "attributes", type:"system"})
|
||||
this._get_skills({id: "skills", type:"system"})
|
||||
this.#buildInventory()
|
||||
}
|
||||
|
||||
|
|
@ -75,6 +77,34 @@ 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),
|
||||
description: coreModule.api.Utils.i18n('GURPS.Skills'),
|
||||
encodedValue: [macroType, otf].join(this.delimiter),
|
||||
})
|
||||
|
||||
|
||||
});
|
||||
this.addActions(actions, parent)
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Build multiple token actions
|
||||
* @private
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ export const ACTION_TYPE = {
|
|||
*/
|
||||
export const GROUP = {
|
||||
attributes: { id: 'attributes', name: 'tokenActionHud.gurps.attributes', type: 'system' },
|
||||
skills: { id: 'skills', name: 'tokenActionHud.gurps.skills', 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' },
|
||||
|
|
@ -46,6 +47,7 @@ export const GROUP = {
|
|||
*/
|
||||
export const ITEM_TYPE = {
|
||||
attributes: { groupId: 'attributes' },
|
||||
skills: { groupId: 'skills' },
|
||||
armor: { groupId: 'armor' },
|
||||
backpack: { groupId: 'containers' },
|
||||
consumable: { groupId: 'consumables' },
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => {
|
|||
group.listName = `Group: ${coreModule.api.Utils.i18n(group.listName ?? group.name)}`
|
||||
})
|
||||
const groupsArray = Object.values(groups)
|
||||
//debugger;
|
||||
// debugger;
|
||||
DEFAULTS = {
|
||||
layout: [
|
||||
{
|
||||
|
|
@ -23,6 +23,14 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => {
|
|||
{ ...groups.attributes, nestId: 'attributes_attributes' }
|
||||
]
|
||||
},
|
||||
{
|
||||
nestId: 'skills',
|
||||
id: 'skills',
|
||||
name: coreModule.api.Utils.i18n('GURPS.skills'),
|
||||
groups: [
|
||||
{ ...groups.skills, nestId: 'skills_skills' }
|
||||
]
|
||||
},
|
||||
{
|
||||
nestId: 'inventory',
|
||||
id: 'inventory',
|
||||
|
|
@ -47,14 +55,6 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => {
|
|||
{ ...groups.utility, nestId: 'utility_utility' }
|
||||
]
|
||||
},
|
||||
{
|
||||
nestId: 'attributes',
|
||||
id: 'attributes',
|
||||
name: coreModule.api.Utils.i18n('GURPS.attributes'),
|
||||
groups: [
|
||||
{ ...groups.attributes, nestId: 'attributes_attributes' }
|
||||
]
|
||||
}
|
||||
],
|
||||
groups: groupsArray
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
import {doRoll} from "/systems/gurps/module/dierolls/dieroll.js"
|
||||
|
||||
// Do we need to use executeOTF?
|
||||
|
||||
export let RollHandler = null
|
||||
|
||||
Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => {
|
||||
|
|
@ -79,6 +81,10 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => {
|
|||
break
|
||||
case 'attributes':
|
||||
this.#handleAttributeAction(actor, actionId)
|
||||
break
|
||||
case 'skills':
|
||||
this.#handleSkillAction(actor, actionId)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -129,5 +135,20 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => {
|
|||
|
||||
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 })
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue