Compare commits
No commits in common. "eab44e1dd10473710fe6da718427a3ac13a31707" and "6df95256b0dbee38a98d5ebf04d4d9bfde8ce0dc" have entirely different histories.
eab44e1dd1
...
6df95256b0
5 changed files with 68 additions and 132 deletions
|
|
@ -10,7 +10,7 @@
|
||||||
],
|
],
|
||||||
"url": "https://git.evatt.ingenious.com.au/neillc/token-action-hud-gurps",
|
"url": "https://git.evatt.ingenious.com.au/neillc/token-action-hud-gurps",
|
||||||
"flags": {},
|
"flags": {},
|
||||||
"version": "0.0.100",
|
"version": "0.0.99",
|
||||||
"compatibility": {
|
"compatibility": {
|
||||||
"minimum": "11",
|
"minimum": "11",
|
||||||
"verified": "11.351"
|
"verified": "11.351"
|
||||||
|
|
@ -63,9 +63,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"socket": false,
|
"socket": false,
|
||||||
"readme": "https://git.evatt.ingenious.com.au/neillc/token-action-hud-gurps/releases/download/0.0.100/readme.md",
|
"readme": "https://git.evatt.ingenious.com.au/neillc/token-action-hud-gurps/releases/download/0.0.99/readme.md",
|
||||||
"manifest": "https://git.evatt.ingenious.com.au/neillc/token-action-hud-gurps/releases/download/0.0.100/module.json",
|
"manifest": "https://git.evatt.ingenious.com.au/neillc/token-action-hud-gurps/releases/download/0.0.99/module.json",
|
||||||
"download": "https://git.evatt.ingenious.com.au/neillc/token-action-hud-gurps/releases/download/0.0.100/fvtt-token-action-hud-gurps.zip",
|
"download": "https://git.evatt.ingenious.com.au/neillc/token-action-hud-gurps/releases/download/0.0.99/fvtt-token-action-hud-gurps.zip",
|
||||||
"protected": false,
|
"protected": false,
|
||||||
"coreTranslation": false,
|
"coreTranslation": false,
|
||||||
"library": false
|
"library": false
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ This should be considered beta software at the moment. I think it's safe to use,
|
||||||
|
|
||||||
# Features
|
# Features
|
||||||
- Make rolls directly from the HUD instead of opening your character sheet.
|
- Make rolls directly from the HUD instead of opening your character sheet.
|
||||||
|
- Use items from the HUD or right-click an item to open its sheet.
|
||||||
- Move the HUD and choose to expand the menus up or down.
|
- Move the HUD and choose to expand the menus up or down.
|
||||||
- Unlock the HUD to customise layout and groups per user, and actions per actor.
|
- Unlock the HUD to customise layout and groups per user, and actions per actor.
|
||||||
- Add your own macros, journal entries and roll table compendiums.
|
- Add your own macros, journal entries and roll table compendiums.
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.actorType === 'character') {
|
if (this.actorType === 'character') {
|
||||||
|
//debugger;
|
||||||
this.#buildCharacterActions()
|
this.#buildCharacterActions()
|
||||||
} else if (!this.actor) {
|
} else if (!this.actor) {
|
||||||
this.#buildMultipleTokenActions()
|
this.#buildMultipleTokenActions()
|
||||||
|
|
@ -43,6 +44,7 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => {
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
#buildCharacterActions () {
|
#buildCharacterActions () {
|
||||||
|
// debugger;
|
||||||
this._get_attributes({id: "attributes", type:"system"})
|
this._get_attributes({id: "attributes", type:"system"})
|
||||||
this._get_skills({id: "skills", type:"system"})
|
this._get_skills({id: "skills", type:"system"})
|
||||||
this._get_spells({id: "spells", type:"system"})
|
this._get_spells({id: "spells", type:"system"})
|
||||||
|
|
@ -79,6 +81,7 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
_get_melee_attacks(parent) {
|
_get_melee_attacks(parent) {
|
||||||
|
// debugger;
|
||||||
const macroType = "melee";
|
const macroType = "melee";
|
||||||
let actions = [];
|
let actions = [];
|
||||||
|
|
||||||
|
|
@ -109,6 +112,7 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
_get_ranged_attacks(parent) {
|
_get_ranged_attacks(parent) {
|
||||||
|
// debugger;
|
||||||
const macroType = "ranged";
|
const macroType = "ranged";
|
||||||
let actions = [];
|
let actions = [];
|
||||||
|
|
||||||
|
|
@ -139,146 +143,57 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
_get_skills(parent) {
|
_get_skills(parent) {
|
||||||
|
// debugger;
|
||||||
const macroType = "skills";
|
const macroType = "skills";
|
||||||
let actions = [];
|
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) + " - test",
|
|
||||||
// description: coreModule.api.Utils.i18n('GURPS.Skills'),
|
|
||||||
// encodedValue: [macroType, otf].join(this.delimiter),
|
|
||||||
// })
|
|
||||||
|
|
||||||
|
|
||||||
// });
|
|
||||||
let skills = Object.entries(this.actor.system.skills)
|
let skills = Object.entries(this.actor.system.skills)
|
||||||
// let map = this._get_contents(skills)
|
skills.forEach((a) => {
|
||||||
let map = this._get_contents(skills, macroType)
|
const key = a[1].name;
|
||||||
let names = Array.from(map.keys()).sort()
|
const value = a[1].level
|
||||||
names.forEach((a)=> {
|
// img
|
||||||
actions.push({
|
|
||||||
id: a,
|
|
||||||
name: map.get(a).name,
|
|
||||||
description: map.get(a).description,
|
|
||||||
encodedValue: map.get(a).encodedValue
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
|
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)
|
this.addActions(actions, parent)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_get_contents(spells, macroType, result= new Map()) {
|
|
||||||
console.debug(spells);
|
|
||||||
console.debug(macroType);
|
|
||||||
console.debug(result)
|
|
||||||
|
|
||||||
if (spells instanceof Array) {
|
|
||||||
for (const spell in spells) {
|
|
||||||
let _contains = spells[spell][1].contains;
|
|
||||||
|
|
||||||
if (Reflect.has(_contains,"00000")) {
|
|
||||||
for( const i in _contains) {
|
|
||||||
result = this._get_contents(_contains[i], macroType, result)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
let name = spells[spell][1].name;
|
|
||||||
let level = spells[spell][1].level;
|
|
||||||
let otf_type = null;
|
|
||||||
|
|
||||||
if (macroType === "skills") {
|
|
||||||
otf_type = 'Sk'
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
otf_type = 'Sp'
|
|
||||||
}
|
|
||||||
|
|
||||||
let otf = otf_type + ':"' + name + '"';
|
|
||||||
|
|
||||||
if (level) {
|
|
||||||
result.set(
|
|
||||||
name,
|
|
||||||
{
|
|
||||||
id: name,
|
|
||||||
name: coreModule.api.Utils.i18n(name),
|
|
||||||
description: coreModule.api.Utils.i18n('GURPS.Spells'),
|
|
||||||
encodedValue: [macroType, otf].join(this.delimiter),
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (spells.uuid) {
|
|
||||||
let _contains = spells.contains;
|
|
||||||
if (Reflect.has(_contains,"00000")) {
|
|
||||||
for( const i in _contains) {
|
|
||||||
result = this._get_contents(_contains[i], macroType, result)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
let spell = spells;
|
|
||||||
|
|
||||||
let name = spell.name;
|
|
||||||
let level = spell.level;
|
|
||||||
let otf_type = null;
|
|
||||||
|
|
||||||
if (macroType === "skills") {
|
|
||||||
otf_type = 'Sk'
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
otf_type = 'Sp'
|
|
||||||
}
|
|
||||||
|
|
||||||
let otf = otf_type + ':"' + name + '"';
|
|
||||||
|
|
||||||
|
|
||||||
if (level) {
|
|
||||||
result.set(
|
|
||||||
name,
|
|
||||||
{
|
|
||||||
id: name,
|
|
||||||
name: coreModule.api.Utils.i18n(name),
|
|
||||||
description: coreModule.api.Utils.i18n('GURPS.Spells'),
|
|
||||||
encodedValue: [macroType, otf].join(this.delimiter),
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
_get_spells(parent) {
|
_get_spells(parent) {
|
||||||
|
// debugger;
|
||||||
const macroType = "spells";
|
const macroType = "spells";
|
||||||
let actions = [];
|
let actions = [];
|
||||||
let spells = Object.entries(this.actor.system.spells)
|
|
||||||
let spell_map = this._get_contents(spells, macroType)
|
|
||||||
let spell_names = Array.from(spell_map.keys()).sort()
|
|
||||||
spell_names.forEach((a)=> {
|
|
||||||
actions.push({
|
|
||||||
id: a,
|
|
||||||
name: spell_map.get(a).name,
|
|
||||||
description: spell_map.get(a).description,
|
|
||||||
encodedValue: spell_map.get(a).encodedValue
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
|
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)
|
this.addActions(actions, parent)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -341,4 +256,3 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => {
|
||||||
group.listName = `Group: ${coreModule.api.Utils.i18n(group.listName ?? group.name)}`
|
group.listName = `Group: ${coreModule.api.Utils.i18n(group.listName ?? group.name)}`
|
||||||
})
|
})
|
||||||
const groupsArray = Object.values(groups)
|
const groupsArray = Object.values(groups)
|
||||||
|
// debugger;
|
||||||
DEFAULTS = {
|
DEFAULTS = {
|
||||||
layout: [
|
layout: [
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -130,6 +130,7 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => {
|
||||||
|
|
||||||
if ( actionId == "WILL" ) actionId = "Will";
|
if ( actionId == "WILL" ) actionId = "Will";
|
||||||
if ( actionId == "PER" ) actionId = "Per";
|
if ( actionId == "PER" ) actionId = "Per";
|
||||||
|
// debugger;
|
||||||
let formula = '3d6';
|
let formula = '3d6';
|
||||||
let targetmods = null;
|
let targetmods = null;
|
||||||
let prefix = "Rolls vs" // should be i18n of 'GURPS.rollVs'
|
let prefix = "Rolls vs" // should be i18n of 'GURPS.rollVs'
|
||||||
|
|
@ -147,6 +148,8 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => {
|
||||||
async #handleMeleeAction(actor, actionId) {
|
async #handleMeleeAction(actor, actionId) {
|
||||||
/* Melee attacks are done using the otf method. Grab the otf and pass it to the function. */
|
/* Melee attacks are done using the otf method. Grab the otf and pass it to the function. */
|
||||||
let GURPS = globalThis.GURPS;
|
let GURPS = globalThis.GURPS;
|
||||||
|
|
||||||
|
// debugger;
|
||||||
let otf = actionId;
|
let otf = actionId;
|
||||||
GURPS.executeOTF(otf, actor=actor);
|
GURPS.executeOTF(otf, actor=actor);
|
||||||
}
|
}
|
||||||
|
|
@ -154,22 +157,39 @@ Hooks.once('tokenActionHudCoreApiReady', async (coreModule) => {
|
||||||
async #handleRangedAction(actor, actionId) {
|
async #handleRangedAction(actor, actionId) {
|
||||||
/* Melee attacks are done using the otf method. Grab the otf and pass it to the function. */
|
/* Melee attacks are done using the otf method. Grab the otf and pass it to the function. */
|
||||||
let GURPS = globalThis.GURPS;
|
let GURPS = globalThis.GURPS;
|
||||||
|
|
||||||
|
// debugger;
|
||||||
let otf = actionId;
|
let otf = actionId;
|
||||||
GURPS.executeOTF(otf, actor=actor);
|
GURPS.executeOTF(otf, actor=actor);
|
||||||
|
|
||||||
|
|
||||||
|
// doRoll({ actor, formula, targetmods, prefix, thing, chatthing, origtarget: target, optionalArgs: opt })
|
||||||
}
|
}
|
||||||
|
|
||||||
async #handleSkillAction(actor, actionId) {
|
async #handleSkillAction(actor, actionId) {
|
||||||
/* Skills are done using the otf method. Grab the otf and pass it to the function. */
|
/* Skills are done using the otf method. Grab the otf and pass it to the function. */
|
||||||
let GURPS = globalThis.GURPS;
|
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;
|
let otf = actionId;
|
||||||
GURPS.executeOTF(otf, actor=actor);
|
GURPS.executeOTF(otf, actor=actor);
|
||||||
|
|
||||||
|
|
||||||
|
// doRoll({ actor, formula, targetmods, prefix, thing, chatthing, origtarget: target, optionalArgs: opt })
|
||||||
}
|
}
|
||||||
|
|
||||||
async #handleSpellAction(actor, actionId) {
|
async #handleSpellAction(actor, actionId) {
|
||||||
/* Spells are done using the otf method. Grab the otf and pass it to the function. */
|
/* Spells are done using the otf method. Grab the otf and pass it to the function. */
|
||||||
let GURPS = globalThis.GURPS;
|
let GURPS = globalThis.GURPS;
|
||||||
|
|
||||||
|
// debugger;
|
||||||
let otf = actionId;
|
let otf = actionId;
|
||||||
GURPS.executeOTF(otf, actor=actor);
|
GURPS.executeOTF(otf, actor=actor);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue