Melee attacks
This commit is contained in:
parent
9a6fab6014
commit
1d5328a9f1
5 changed files with 45 additions and 3 deletions
|
|
@ -10,7 +10,7 @@
|
|||
],
|
||||
"url": "This is auto replaced",
|
||||
"flags": {},
|
||||
"version": "0.0.68",
|
||||
"version": "0.0.72",
|
||||
"compatibility": {
|
||||
"minimum": "11",
|
||||
"verified": "11.351"
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
|
|||
|
|
@ -31,6 +31,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' },
|
||||
melee: { id: 'melee', name: 'tokenActionHud.gurps.melee', 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' },
|
||||
|
|
@ -48,6 +49,7 @@ export const GROUP = {
|
|||
export const ITEM_TYPE = {
|
||||
attributes: { groupId: 'attributes' },
|
||||
skills: { groupId: 'skills' },
|
||||
melee: { groupId: 'melee' },
|
||||
armor: { groupId: 'armor' },
|
||||
backpack: { groupId: 'containers' },
|
||||
consumable: { groupId: 'consumables' },
|
||||
|
|
|
|||
|
|
@ -31,6 +31,14 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => {
|
|||
{ ...groups.skills, nestId: 'skills_skills' }
|
||||
]
|
||||
},
|
||||
{
|
||||
nestId: 'melee',
|
||||
id: 'melee',
|
||||
name: coreModule.api.Utils.i18n('GURPS.meleeWeapons'),
|
||||
groups: [
|
||||
{ ...groups.melee, nestId: 'melee_melee' }
|
||||
]
|
||||
},
|
||||
{
|
||||
nestId: 'inventory',
|
||||
id: 'inventory',
|
||||
|
|
|
|||
|
|
@ -85,7 +85,10 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => {
|
|||
case 'skills':
|
||||
this.#handleSkillAction(actor, actionId)
|
||||
break
|
||||
}
|
||||
case 'melee':
|
||||
this.#handleMeleeAction(actor, actionId)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue