From a530168e31b0eccdd9fb3f9c1751a1238b9b0ff3 Mon Sep 17 00:00:00 2001 From: mclemente Date: Thu, 6 Jan 2022 19:35:24 -0300 Subject: [PATCH] Scum and Villainy improvements https://github.com/mclemente/party-overview/issues/19 --- module/SystemProvider.js | 19 +++++++++---------- templates/scum-and-villainy.hbs | 14 +++++++------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/module/SystemProvider.js b/module/SystemProvider.js index ec6d39e..5539811 100644 --- a/module/SystemProvider.js +++ b/module/SystemProvider.js @@ -346,7 +346,7 @@ export class pf2eProvider extends SystemProvider { get template() { return "/modules/party-overview/templates/pf2e.hbs"; } - + get width() { return 600; } @@ -474,13 +474,11 @@ export class scumAndVillainyProvider extends SystemProvider { } getHarm(data) { - const light = game.i18n.localize("BITD.LessEffect"); - const medium = "-1D"; - const heavy = game.i18n.localize("BITD.NeedHelp"); - if (data.harm.heavy.one) return `${light}, ${medium}, ${heavy}`; - if (data.harm.medium.one || data.harm.medium.two) return `${light}, ${medium}`; - if (data.harm.light.one || data.harm.light.two) return `${light}`; - return ""; + let result = []; + if (data.harm.light.one || data.harm.light.two) result.push(game.i18n.localize("BITD.LessEffect")); + if (data.harm.medium.one || data.harm.medium.two) result.push("-1D"); + if (data.harm.heavy.one) result.push(game.i18n.localize("BITD.NeedHelp")); + return result.join(", "); } getActorDetails(actor) { @@ -489,12 +487,12 @@ export class scumAndVillainyProvider extends SystemProvider { id: actor.id, name: actor.name, type: actor.type, - coins: data.coins, }; if (actor.type == "character") { return { ...base, - stress: data.stress || { value: "-", max: "-" }, + stress: data.stress, + coins: data.coins, harm: this.getHarm(data), }; } else if (actor.type == "ship") { @@ -531,6 +529,7 @@ export class scumAndVillainyProvider extends SystemProvider { characters, { ships, + shipsNotVisible: !Object.keys(ships).length, }, ]; } diff --git a/templates/scum-and-villainy.hbs b/templates/scum-and-villainy.hbs index 891ea46..fc10139 100644 --- a/templates/scum-and-villainy.hbs +++ b/templates/scum-and-villainy.hbs @@ -1,7 +1,6 @@
- {{> "modules/party-overview/templates/parts/Tabs.html"}}
-
+
{{> "modules/party-overview/templates/parts/FilterButton.html"}}
{{localize "party-overview.NAME"}}
@@ -25,13 +24,14 @@
{{/each}}
- -
+ {{#if shipsNotVisible}} + {{else}} +
+

{{localize "BITD.Ship"}}

- {{> "modules/party-overview/templates/parts/FilterButton.html"}} +
{{localize "party-overview.NAME"}}
{{localize "BITD.Gambits"}}
-
{{localize "BITD.Coins"}}
{{localize "BITD.SystemsCrew"}}
@@ -45,10 +45,10 @@
{{ actor.shortestName }}
{{ actor.gambits.value }}/{{ actor.gambits.max }}
-
{{ actor.coins }}
{{ actor.crew.value }}/{{ actor.crew.max }}
{{/each}}
+ {{/if}}
\ No newline at end of file