From 2813e5a6948f836c20331c0d57bc71126cb5fa35 Mon Sep 17 00:00:00 2001 From: LeRatierBretonnien Date: Mon, 20 Mar 2023 21:01:00 +0100 Subject: [PATCH] some re-org --- modules/warhero-actor-sheet.js | 3 + modules/warhero-actor.js | 18 ++++ system.json | 4 +- template.json | 49 ++++++---- templates/actor-sheet.html | 163 ++++++++++++++++++++++----------- 5 files changed, 164 insertions(+), 73 deletions(-) diff --git a/modules/warhero-actor-sheet.js b/modules/warhero-actor-sheet.js index b9e4850..9d0b7ca 100644 --- a/modules/warhero-actor-sheet.js +++ b/modules/warhero-actor-sheet.js @@ -51,6 +51,9 @@ export class WarheroActorSheet extends ActorSheet { conditions: this.actor.checkAndPrepareEquipments( duplicate(this.actor.getConditions()) ), armors: this.actor.checkAndPrepareEquipments( duplicate(this.actor.getArmors())), shields: this.actor.checkAndPrepareEquipments( duplicate(this.actor.getShields())), + equippedWeapons: this.actor.checkAndPrepareEquipments( duplicate(this.actor.getEquippedWeapons())), + equippedArmors: this.actor.checkAndPrepareEquipments( duplicate(this.actor.getEquippedArmors())), + equippedShields: this.actor.checkAndPrepareEquipments( duplicate(this.actor.getEquippedShields())), powers: this.actor.sortPowers(), subActors: duplicate(this.actor.getSubActors()), competency: this.actor.getCompetency(), diff --git a/modules/warhero-actor.js b/modules/warhero-actor.js index 6e7ed5a..c27d983 100644 --- a/modules/warhero-actor.js +++ b/modules/warhero-actor.js @@ -123,6 +123,11 @@ export class WarheroActor extends Actor { return comp; } /* -------------------------------------------- */ + getEquippedArmors() { + let comp = duplicate(this.items.filter(item => item.type == 'armor' && item.system.slotlocation == 'armor') || []); + WarheroUtility.sortArrayObjectsByName(comp) + return comp; + } getArmors() { let comp = duplicate(this.items.filter(item => item.type == 'armor') || []); WarheroUtility.sortArrayObjectsByName(comp) @@ -147,6 +152,11 @@ export class WarheroActor extends Actor { return schools } /* -------------------------------------------- */ + getEquippedShields() { + let comp = duplicate(this.items.filter(item => item.type == 'shield' && item.system.slotlocation == "shield") || []); + WarheroUtility.sortArrayObjectsByName(comp) + return comp; + } getShields() { let comp = duplicate(this.items.filter(item => item.type == 'shield') || []); WarheroUtility.sortArrayObjectsByName(comp) @@ -282,6 +292,14 @@ export class WarheroActor extends Actor { weapon.damageFormula = formula } /* -------------------------------------------- */ + getEquippedWeapons() { + let comp = duplicate(this.items.filter(item => item.type == 'weapon' && (item.system.slotlocation == "weapon1" || item.system.slotlocation == "weapon2") ) || []); + for (let weapon of comp) { + this.prepareWeapon(weapon) + } + WarheroUtility.sortArrayObjectsByName(comp) + return comp; + } getWeapons() { let comp = duplicate(this.items.filter(item => item.type == 'weapon') || []); for (let weapon of comp) { diff --git a/system.json b/system.json index ca6d263..d5c3dae 100644 --- a/system.json +++ b/system.json @@ -107,7 +107,7 @@ "styles": [ "styles/simple.css" ], - "version": "10.0.41", + "version": "10.0.43", "compatibility": { "minimum": "10", "verified": "10", @@ -115,7 +115,7 @@ }, "title": "Warhero RPG", "manifest": "https://www.uberwald.me/gitea/public/fvtt-warhero/raw/branch/master/system.json", - "download": "https://www.uberwald.me/gitea/uberwald/fvtt-warhero/archive/fvtt-warhero-10.0.41.zip", + "download": "https://www.uberwald.me/gitea/uberwald/fvtt-warhero/archive/fvtt-warhero-10.0.43.zip", "url": "https://www.uberwald.me/gitea/public/fvtt-warhero", "background": "images/ui/warhero_welcome_page.webp", "id": "fvtt-warhero" diff --git a/template.json b/template.json index 13e6452..73de2bb 100644 --- a/template.json +++ b/template.json @@ -62,8 +62,8 @@ "style": "edit", "hasmax": true, "isheader": true, - "max": 1, - "value": 1 + "max": 30, + "value": 30 }, "knowledge": { "label": "WH.ui.Knowledge", @@ -71,15 +71,16 @@ "style": "edit", "hasmax": false, "roll": true, - "max": 1, - "value": 1 + "max": 0, + "value": 0 }, "def": { "label": "WH.ui.Defence", "abbrev": "def", "style": "edit", - "max": 1, - "value": 1 + "iscombat": true, + "max": 12, + "value": 12 }, "txcm": { "label": "WH.ui.Throw2HitM", @@ -87,8 +88,9 @@ "istxc": true, "style": "edit", "roll": true, - "max": 1, - "value": 1 + "iscombat": true, + "max": 0, + "value": 0 }, "txcr": { "label": "WH.ui.Throw2HitR", @@ -96,8 +98,9 @@ "istxc": true, "style": "edit", "roll": true, - "max": 1, - "value": 1 + "iscombat": true, + "max": 0, + "value": 0 }, "mana": { "label": "WH.ui.Mana", @@ -105,37 +108,38 @@ "style": "edit", "hasmax": true, "isheader": true, - "max": 1, - "value": 1 + "max": 3, + "value": 3 }, "ini": { "label": "WH.ui.Initiative", "abbrev": "ini", "style": "edit", + "iscombat": true, "roll": true, - "max": 1, - "value": 1 + "max": 0, + "value": 0 }, "movearth": { "label": "WH.ui.Movement", "abbrev": "mov", "style": "edit", - "max": 1, - "value": 1 + "max": 6, + "value": 6 }, "movswim": { "label": "WH.ui.MovementSwim", "abbrev": "mov", "style": "edit", - "max": 1, - "value": 1 + "max": 0, + "value": 0 }, "movfly": { "label": "WH.ui.MovementFly", "abbrev": "mov", "style": "edit", - "max": 1, - "value": 1 + "max": 0, + "value": 0 } }, "secondary": { @@ -149,6 +153,7 @@ "malusmultiweapon": { "label": "WH.ui.malusmultiweapon", "abbrev": "malusmultiweapon", + "iscombat": true, "style": "edit", "value": 0 }, @@ -156,6 +161,7 @@ "label": "WH.ui.drbonus", "abbrev": "drbonus", "style": "edit", + "iscombat": true, "value": 0 }, "drbonustotal": { @@ -163,12 +169,14 @@ "abbrev": "drbonustotal", "disabled": true, "style": "edit", + "iscombat": true, "value": 0 }, "parrybonus": { "label": "WH.ui.parrybonus", "abbrev": "parrybonus", "isparrybonus": true, + "iscombat": true, "style": "edit", "value": 0 }, @@ -177,6 +185,7 @@ "abbrev": "parrybonustotal", "disabled": true, "style": "edit", + "iscombat": true, "roll": true, "value": 0 }, diff --git a/templates/actor-sheet.html b/templates/actor-sheet.html index bcb666d..bba5539 100644 --- a/templates/actor-sheet.html +++ b/templates/actor-sheet.html @@ -27,7 +27,8 @@ - {{#each classes as |class idx|}} + {{#if (count classes)}} + {{#each classes as |class idx|}}
  • @@ -36,7 +37,17 @@
  • - {{/each}} + {{/each}} + {{else}} +
  • + + + +
    + +
    +
  • + {{/if}}
  • @@ -85,56 +96,13 @@
      {{#each system.attributes as |attr key|}} + {{#if (not attr.iscombat)}} {{#if (not attr.isheader)}} {{> systems/fvtt-warhero/templates/partial-actor-stat-block.html stat=attr key=key path="attributes" fieldClass="item-field-label-vlong"}} {{/if}} + {{/if}} {{/each}}
    - -
    -
      -
    • - -

      -
      -
    • - {{#each competency.weapons as |cdata key|}} - {{#if cdata}} -
    • - {{localize "WH.ui.weapons"}} {{localize cdata.label}} -
    • - {{/if}} - {{/each}} - {{#each competency.shields as |cdata key|}} - {{#if cdata}} -
    • - {{localize "WH.ui.shields"}} {{localize cdata.label}} -
    • - {{/if}} - {{/each}} - {{#each competency.armors as |cdata key|}} - {{#if cdata}} -
    • - {{localize "WH.ui.armors"}} {{localize cdata.label}} -
    • - {{/if}} - {{/each}} - - {{#each compentencyItems as |comp key|}} -
    • - - {{comp.name}} - -
       
      -
      - -
      -
    • - {{/each}} - -
    -
    @@ -151,7 +119,9 @@ {{#each system.secondary as |second key|}} - {{> systems/fvtt-warhero/templates/partial-actor-stat-block.html stat=second key=key path="secondary" fieldClass="item-field-label-vlong"}} + {{#if (not second.iscombat)}} + {{> systems/fvtt-warhero/templates/partial-actor-stat-block.html stat=second key=key path="secondary" fieldClass="item-field-label-vlong"}} + {{/if}} {{/each}} @@ -186,8 +156,28 @@ {{!-- Combat Tab --}}
    +
    +
    +
      + {{#with system.attributes.def as |stat|}} + {{> systems/fvtt-warhero/templates/partial-actor-stat-block.html stat=stat key="def" path="attributes" fieldClass="item-field-label-vlong"}} + {{/with}} + {{#with system.attributes.ini as |stat|}} + {{> systems/fvtt-warhero/templates/partial-actor-stat-block.html stat=stat key="ini" path="attributes" fieldClass="item-field-label-vlong"}} + {{/with}} +
    +
      + {{#with system.attributes.txcm as |stat|}} + {{> systems/fvtt-warhero/templates/partial-actor-stat-block.html stat=stat key="txcm" path="attributes" fieldClass="item-field-label-vlong"}} + {{/with}} + {{#with system.attributes.txcr as |stat|}} + {{> systems/fvtt-warhero/templates/partial-actor-stat-block.html stat=stat key="txch" path="attributes" fieldClass="item-field-label-vlong"}} + {{/with}} +
    +
    +
    • @@ -201,7 +191,7 @@
    • - {{#each weapons as |weapon key|}} + {{#each equippedWeapons as |weapon key|}}
    • @@ -228,6 +218,19 @@
    +
    +
      + {{#with system.secondary.parrybonus as |stat|}} + {{> systems/fvtt-warhero/templates/partial-actor-stat-block.html stat=stat key="parrybonus" path="secondary" fieldClass="item-field-label-vlong"}} + {{/with}} +
    +
      + {{#with system.secondary.parrybonustotal as |stat|}} + {{> systems/fvtt-warhero/templates/partial-actor-stat-block.html stat=stat key="parrybonustotal" path="secondary" fieldClass="item-field-label-vlong"}} + {{/with}} +
    +
    +
    • @@ -241,7 +244,7 @@
    • - {{#each shields as |shield key|}} + {{#each equippedShields as |shield key|}}
    • @@ -259,6 +262,19 @@ {{/each}}
    + +
    +
      + {{#with system.secondary.drbonus as |stat|}} + {{> systems/fvtt-warhero/templates/partial-actor-stat-block.html stat=stat key="drbonus" path="secondary" fieldClass="item-field-label-vlong"}} + {{/with}} +
    +
      + {{#with system.secondary.drbonustotal as |stat|}} + {{> systems/fvtt-warhero/templates/partial-actor-stat-block.html stat=stat key="drbonustotal" path="secondary" fieldClass="item-field-label-vlong"}} + {{/with}} +
    +
      @@ -273,7 +289,7 @@ - {{#each armors as |armor key|}} + {{#each equippedArmors as |armor key|}}
    • @@ -292,6 +308,51 @@
    +
    +
      +
    • + +

      +
      +
    • + {{#each competency.weapons as |cdata key|}} + {{#if cdata}} +
    • + {{localize "WH.ui.weapons"}} {{localize cdata.label}} +
    • + {{/if}} + {{/each}} + {{#each competency.shields as |cdata key|}} + {{#if cdata}} +
    • + {{localize "WH.ui.shields"}} {{localize cdata.label}} +
    • + {{/if}} + {{/each}} + {{#each competency.armors as |cdata key|}} + {{#if cdata}} +
    • + {{localize "WH.ui.armors"}} {{localize cdata.label}} +
    • + {{/if}} + {{/each}} + + {{#each compentencyItems as |comp key|}} +
    • + + {{comp.name}} + +
       
      +
      + +
      +
    • + {{/each}} + +
    +
    +