From ab8d95d7f9cadf9489fac26562ba05698340b01f Mon Sep 17 00:00:00 2001 From: Jakub Robaczewski Date: Mon, 1 May 2023 21:24:30 +0200 Subject: [PATCH] Added new weapons tab to wfrp --- module/systemProviders/wfrp4eProvider.js | 26 ++++- templates/wfrp4e.hbs | 141 ++++++++++++++++------- 2 files changed, 122 insertions(+), 45 deletions(-) diff --git a/module/systemProviders/wfrp4eProvider.js b/module/systemProviders/wfrp4eProvider.js index 15424e7..db6a57e 100644 --- a/module/systemProviders/wfrp4eProvider.js +++ b/module/systemProviders/wfrp4eProvider.js @@ -9,7 +9,8 @@ export class wfrp4eProvider extends SystemProvider { return { currencies: { id: "currencies", visible: true, localization: "Money" }, skills: { id: "skills", visible: true, localization: "Skills" }, - talents: { id: "talents", visible: true, localization: "Talents" }, + talents: { id: "talents", visible: true, localization: "Talents"}, + equipment: { id: "equipment", visible: true, localization: "Trappings" }, }; } @@ -17,6 +18,10 @@ export class wfrp4eProvider extends SystemProvider { return "/modules/party-overview/templates/wfrp4e.hbs"; } + get width() { + return 700; + } + getCurrency(actor) { const money = actor.getItemTypes("money").map(m => m.toObject()); const currency = { @@ -85,6 +90,16 @@ export class wfrp4eProvider extends SystemProvider { otherAdvanced: otherAdvanced } } + getWeapons(actor) { + let weapons = actor.getItemTypes("weapon") + .map(weapon => ({ + name: weapon.name, + category: WFRP4E.weaponGroups[weapon.system.weaponGroup.value] + })) + weapons.sort((a,b) => a.name.localeCompare(b.name)) + + return weapons + } getActorDetails(actor) { const data = actor.system; @@ -106,8 +121,17 @@ export class wfrp4eProvider extends SystemProvider { max: data.status.corruption.max, }, status: data.details.status.value, + encumbrance: { + value: data.status.encumbrance.current, + max: data.status.encumbrance.max, + }, + exp: { + value: data.details.experience.total - data.details.experience.spent, + total: data.details.experience.total + }, skills: this.getSkills(actor), talents: this.getTalents(actor), + weapons: this.getWeapons(actor), currency: this.getCurrency(actor) }; } diff --git a/templates/wfrp4e.hbs b/templates/wfrp4e.hbs index d817878..77893c3 100644 --- a/templates/wfrp4e.hbs +++ b/templates/wfrp4e.hbs @@ -8,9 +8,11 @@
+
+
{{#each actors as | actor | }} @@ -20,9 +22,11 @@
{{ actor.wounds.value }}/{{ actor.wounds.max }}
{{ actor.advantage }}
{{ actor.movement }}
+
{{ actor.encumbrance.value }}/{{ actor.corruption.max }}
{{ actor.corruption.value }}/{{ actor.corruption.max }}
{{ actor.fortune }}/{{ actor.fate }}
{{ actor.resolve }}/{{ actor.resilience }}
+
{{ actor.exp.value }}/{{ actor.exp.total }}
{{/each}} @@ -52,7 +56,7 @@ {{/each}}
-
Total
+
Total
{{totalCurrency.bp}}
{{totalCurrency.ss}}
{{totalCurrency.gc}}
@@ -65,73 +69,122 @@
{{> "modules/party-overview/templates/parts/FilterButton.html"}}
{{localize "party-overview.NAME"}}
-
Melee & Ranged
-
Languages
-
Lore
-
Trade
-
Other Basic
-
Other Advanced
+ {{#each actors as | actor | }} + {{> "modules/party-overview/templates/parts/ToggleVisibilityButton.html" actor=actor}} +
{{actor.shortestName}}
+ {{/each}} +
+ +
+
Melee & Ranged
+ {{#each actors as | actor | }} +
+ {{#each actor.skills.meleeRanged as | skill | }} + {{skill.nameSpec}} {{skill.total}}
+ {{/each}} +
+ {{/each}} +
+
+
Languages
+ {{#each actors as | actor | }} +
+ {{#each actor.skills.languages as | skill | }} + {{skill.nameSpec}} {{skill.total}}
+ {{/each}} +
+ {{/each}} +
+
+
Lore
+ {{#each actors as | actor | }} +
+ {{#each actor.skills.lore as | skill | }} + {{skill.nameSpec}} {{skill.total}}
+ {{/each}} +
+ {{/each}} +
+
+
Trade
+ {{#each actors as | actor | }} +
+ {{#each actor.skills.trade as | skill | }} + {{skill.nameSpec}} {{skill.total}}
+ {{/each}} +
+ {{/each}} +
+
+
Other Basic
+ {{#each actors as | actor | }} +
+ {{#each actor.skills.otherBasic as | skill | }} + {{skill.name}} {{skill.total}}
+ {{/each}} +
+ {{/each}} +
+
+
Other Advanced
+ {{#each actors as | actor | }} +
+ {{#each actor.skills.otherAdvanced as | skill | }} + {{skill.name}} {{skill.total}}
+ {{/each}} +
+ {{/each}} +
+
+ + +
+
+ {{> "modules/party-overview/templates/parts/FilterButton.html"}} +
{{localize "party-overview.NAME"}}
+
Talent
+
Test
{{#each actors as | actor | }}
{{> "modules/party-overview/templates/parts/ToggleVisibilityButton.html" actor=actor}} -
{{ actor.shortestName }}
-
- {{#each actor.skills.meleeRanged as | skill | }} - {{skill.nameSpec}} {{skill.total}}
+
{{ actor.shortestName }}
+
+ {{#each actor.talents as | talent | }} + {{talent.name}}
{{/each}}
-
- {{#each actor.skills.languages as | skill | }} - {{skill.nameSpec}} {{skill.total}}
- {{/each}} -
-
- {{#each actor.skills.lore as | skill | }} - {{skill.nameSpec}} {{skill.total}}
- {{/each}} -
-
- {{#each actor.skills.trade as | skill | }} - {{skill.nameSpec}} {{skill.total}}
- {{/each}} -
-
- {{#each actor.skills.otherBasic as | skill | }} - {{skill.name}} {{skill.total}}
- {{/each}} -
-
- {{#each actor.skills.otherAdvanced as | skill | }} - {{skill.name}} {{skill.total}}
+
+ {{#each actor.talents as | talent | }} + {{talent.test}}
{{/each}}
{{/each}}
- -
+ +
{{> "modules/party-overview/templates/parts/FilterButton.html"}}
{{localize "party-overview.NAME"}}
-
Name
-
Test
+
BroĊ„
+
Kategoria
{{#each actors as | actor | }}
{{> "modules/party-overview/templates/parts/ToggleVisibilityButton.html" actor=actor}}
{{ actor.shortestName }}
-
- {{#each actor.talents as | talents | }} - {{talents.name}}
+
+ {{#each actor.weapons as | weapon | }} + {{weapon.name}}
{{/each}}
-
- {{#each actor.talents as | talents | }} - {{talents.test}}
+
+ {{#each actor.weapons as | weapon | }} + {{weapon.category}}
{{/each}}