Spells and ranged attacks. Partial cleanup of i18n
This commit is contained in:
parent
1d5328a9f1
commit
4619b787e5
5 changed files with 139 additions and 12 deletions
|
|
@ -47,7 +47,9 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => {
|
|||
// debugger;
|
||||
this._get_attributes({id: "attributes", type:"system"})
|
||||
this._get_skills({id: "skills", type:"system"})
|
||||
this._get_spells({id: "spells", type:"system"})
|
||||
this._get_melee_attacks({id: "melee", type:"system"})
|
||||
this._get_ranged_attacks({id: "ranged", type:"system"})
|
||||
this.#buildInventory()
|
||||
}
|
||||
|
||||
|
|
@ -68,7 +70,7 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => {
|
|||
actions.push({
|
||||
id: actionId,
|
||||
name: coreModule.api.Utils.i18n("GURPS.attributes" + key),
|
||||
description: coreModule.api.Utils.i18n('GURPS.Attributes'),
|
||||
description: coreModule.api.Utils.i18n('GURPS.attributes'),
|
||||
encodedValue: [macroType, key].join(this.delimiter),
|
||||
})
|
||||
|
||||
|
|
@ -79,13 +81,16 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => {
|
|||
}
|
||||
|
||||
_get_melee_attacks(parent) {
|
||||
debugger;
|
||||
// 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 + ")";
|
||||
let key = a[1].name;
|
||||
if (a[1].mode) {
|
||||
key += ` (${a[1].mode})`;
|
||||
}
|
||||
const value = a[1].level
|
||||
// img
|
||||
|
||||
|
|
@ -106,8 +111,39 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => {
|
|||
|
||||
}
|
||||
|
||||
_get_ranged_attacks(parent) {
|
||||
// debugger;
|
||||
const macroType = "ranged";
|
||||
let actions = [];
|
||||
|
||||
let ranged_attacks = Object.entries(this.actor.system.ranged)
|
||||
ranged_attacks.forEach((a) => {
|
||||
let key = a[1].name;
|
||||
if (a[1].mode) {
|
||||
key += ` (${a[1].mode})`;
|
||||
}
|
||||
const value = a[1].level
|
||||
// img
|
||||
|
||||
let actionId = key;
|
||||
let otf = 'R:"' + 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.rangedWeapons'),
|
||||
encodedValue: [macroType, otf].join(this.delimiter),
|
||||
})
|
||||
|
||||
|
||||
});
|
||||
this.addActions(actions, parent)
|
||||
|
||||
}
|
||||
|
||||
_get_skills(parent) {
|
||||
debugger;
|
||||
// debugger;
|
||||
const macroType = "skills";
|
||||
let actions = [];
|
||||
|
||||
|
|
@ -134,6 +170,34 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => {
|
|||
|
||||
}
|
||||
|
||||
_get_spells(parent) {
|
||||
// debugger;
|
||||
const macroType = "spells";
|
||||
let actions = [];
|
||||
|
||||
let spells = Object.entries(this.actor.system.spells)
|
||||
spells.forEach((a) => {
|
||||
const key = a[1].name;
|
||||
const value = a[1].level
|
||||
// img
|
||||
|
||||
let actionId = key;
|
||||
let otf = 'Sp:"' + 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.Spells'),
|
||||
encodedValue: [macroType, otf].join(this.delimiter),
|
||||
})
|
||||
|
||||
|
||||
});
|
||||
this.addActions(actions, parent)
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Build multiple token actions
|
||||
* @private
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue