Melee attacks

This commit is contained in:
Neill Cox 2024-05-06 11:33:00 +10:00
parent 9a6fab6014
commit 1d5328a9f1
5 changed files with 45 additions and 3 deletions

View file

@ -44,9 +44,10 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => {
* @private
*/
#buildCharacterActions () {
debugger;
// debugger;
this._get_attributes({id: "attributes", type:"system"})
this._get_skills({id: "skills", type:"system"})
this._get_melee_attacks({id: "melee", type:"system"})
this.#buildInventory()
}
@ -77,6 +78,34 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => {
}
_get_melee_attacks(parent) {
debugger;
const macroType = "melee";
let actions = [];
let melee_attacks = Object.entries(this.actor.system.melee)
melee_attacks.forEach((a) => {
const key = a[1].name + " (" + a[1].mode + ")";
const value = a[1].level
// img
let actionId = key;
let otf = 'M:"' + 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.meleeWeapons'),
encodedValue: [macroType, otf].join(this.delimiter),
})
});
this.addActions(actions, parent)
}
_get_skills(parent) {
debugger;
const macroType = "skills";