From 31d494bb9c75a589d9a7a5365b9c0cb5629cbd08 Mon Sep 17 00:00:00 2001 From: Martin Date: Mon, 7 Nov 2022 12:05:30 +0000 Subject: [PATCH] Update to work with cyphersystem V2.0.x --- module/SystemProvider.js | 38 ++++++++++++++++---------------------- templates/cyphersystem.hbs | 12 ++++++------ 2 files changed, 22 insertions(+), 28 deletions(-) diff --git a/module/SystemProvider.js b/module/SystemProvider.js index 2962f5a..6b76063 100644 --- a/module/SystemProvider.js +++ b/module/SystemProvider.js @@ -1346,35 +1346,29 @@ export class cyphersystemProvider extends SystemProvider { id: actor.id, name: actor.name, type: actor.type, - might: data.pools?.might, - speed: data.pools?.speed, - intellect: data.pools?.intellect, - additional: data.pools?.additional, - additionalPool: data.additionalPool, - mightEdge: data.pools?.mightEdge, - speedEdge: data.pools?.speedEdge, - intellectEdge: data.pools?.intellectEdge, - tier: data.basic?.tier, - effort: data.basic?.effort, - xp: data.basic?.xp, - armorValueTotal: data.armor?.armorValueTotal, - speedCostTotal: data.armor?.speedCostTotal, - damageTrack: data.damage?.damageTrack, + might: data.pools.might, + speed: data.pools.speed, + intellect: data.pools.intellect, + additional: data.pools.additional, + additionalPool: { + active: data.settings.general.additionalPool.active, + name: data.settings.general.additionalPool.label, + pool: data.pools.additionalPool, + }, + tier: data.basic.tier, + effort: data.basic.effort, + xp: data.basic.xp, + armorValueTotal: data.combat.armor.ratingTotal, + speedCostTotal: data.combat.armor.costTotal, + damageTrack: data.combat.damageTrack.state, }; } getUpdate(actors) { - let showAdditional = false; - for (let actor of actors) { - if (actor.additionalPool?.active) { - showAdditional = true; - break; - } - } return [ actors, { - showAdditional: showAdditional, + showAdditional: actors.some(actor => actor.additionalPool.active), }, ]; } diff --git a/templates/cyphersystem.hbs b/templates/cyphersystem.hbs index b92e07d..4e0d870 100644 --- a/templates/cyphersystem.hbs +++ b/templates/cyphersystem.hbs @@ -18,20 +18,20 @@ {{#each actors as | actor | }} - {{#if (eq actor.type 'PC')}} + {{#if (eq actor.type 'pc')}}
{{> "modules/party-overview/templates/parts/ToggleVisibilityButton.html" actor=actor}}
{{ actor.shortestName }}
-
{{ actor.might.value }}/{{ actor.might.max }} ({{actor.mightEdge}})
-
{{ actor.speed.value }}/{{ actor.speed.max }} ({{actor.speedEdge}})
-
{{ actor.intellect.value }}/{{ actor.intellect.max }} ({{actor.intellectEdge}})
+
{{ actor.might.value }}/{{ actor.might.max }} ({{actor.might.edge}})
+
{{ actor.speed.value }}/{{ actor.speed.max }} ({{actor.speed.edge}})
+
{{ actor.intellect.value }}/{{ actor.intellect.max }} ({{actor.intellect.edge}})
{{#if ../showAdditional}} {{#if actor.additionalPool.active}} - {{#if (eq actor.additionalPool.additionalPoolName "")}} + {{#if (eq actor.additionalPool.name "")}}
{{ actor.additional.value }}/{{ actor.additional.max }}
{{else}} -
{{ actor.additional.value }}/{{ actor.additional.max }}
+
{{ actor.additional.value }}/{{ actor.additional.max }}
{{/if}} {{else}}
-