From 0fe4202098e3742905069f3f02dc2337846af72a Mon Sep 17 00:00:00 2001 From: LeRatierBretonnien Date: Tue, 14 Feb 2023 15:34:37 +0100 Subject: [PATCH] Enhance sheets --- modules/hero6-actor-sheet.js | 22 +- modules/hero6-actor.js | 32 +- modules/hero6-utility.js | 7 + styles/simple.css | 5 + system.json | 4 +- template.json | 23 +- templates/actors/actor-sheet.hbs | 315 ++++++++++++++---- templates/apps/roll-dialog-generic.hbs | 19 ++ templates/chat/chat-generic-result.hbs | 11 +- .../partial-actor-characteristic-block.hbs | 9 +- .../partials/partial-actor-full-charac.hbs | 13 + 11 files changed, 374 insertions(+), 86 deletions(-) create mode 100644 templates/partials/partial-actor-full-charac.hbs diff --git a/modules/hero6-actor-sheet.js b/modules/hero6-actor-sheet.js index 40efebc..6afe073 100644 --- a/modules/hero6-actor-sheet.js +++ b/modules/hero6-actor-sheet.js @@ -38,6 +38,10 @@ export class Hero6ActorSheet extends ActorSheet { characteristics: this.actor.prepareCharac(), limited: this.object.limited, skills: this.actor.getSkills( ), + perks: this.actor.getPerks( ), + powers: this.actor.getPowers( ), + talents: this.actor.getTalents( ), + complications: this.actor.getComplications( ), weapons: this.actor.checkAndPrepareEquipments( duplicate(this.actor.getWeapons()) ), armors: this.actor.checkAndPrepareEquipments( duplicate(this.actor.getArmors())), shields: this.actor.checkAndPrepareEquipments( duplicate(this.actor.getShields())), @@ -50,7 +54,16 @@ export class Hero6ActorSheet extends ActorSheet { moneys: duplicate(this.actor.getMoneys()), encCapacity: this.actor.getEncumbranceCapacity(), description: await TextEditor.enrichHTML(this.object.system.biodata.description, {async: true}), - notes: await TextEditor.enrichHTML(this.object.system.biodata.notes, {async: true}), + motivation: await TextEditor.enrichHTML(this.object.system.biodata.motivation, {async: true}), + quote: await TextEditor.enrichHTML(this.object.system.biodata.quote, {async: true}), + tactics: await TextEditor.enrichHTML(this.object.system.biodata.tactics, {async: true}), + campaignuse: await TextEditor.enrichHTML(this.object.system.biodata.campaignuse, {async: true}), + appearance: await TextEditor.enrichHTML(this.object.system.biodata.appearance, {async: true}), + notes1: await TextEditor.enrichHTML(this.object.system.biodata.notes1, {async: true}), + notes2: await TextEditor.enrichHTML(this.object.system.biodata.notes2, {async: true}), + notes3: await TextEditor.enrichHTML(this.object.system.biodata.notes3, {async: true}), + notes4: await TextEditor.enrichHTML(this.object.system.biodata.notes4, {async: true}), + notes5: await TextEditor.enrichHTML(this.object.system.biodata.notes5, {async: true}), containersTree: this.actor.containersTree, encCurrent: this.actor.encCurrent, options: this.options, @@ -139,7 +152,12 @@ export class Hero6ActorSheet extends ActorSheet { const characKey = $(event.currentTarget).data("charac-key"); this.actor.rollCharac(characKey); }); - + html.find('.roll-item').click((event) => { + const li = $(event.currentTarget).parents(".item"); + let itemId = li.data("item-id") + this.actor.rollItem(itemId); + }); + html.find('.roll-weapon').click((event) => { const li = $(event.currentTarget).parents(".item"); const skillId = li.data("item-id") diff --git a/modules/hero6-actor.js b/modules/hero6-actor.js index eea72ed..f17bedb 100644 --- a/modules/hero6-actor.js +++ b/modules/hero6-actor.js @@ -170,6 +170,26 @@ export class Hero6Actor extends Actor { Hero6Utility.sortArrayObjectsByName(comp) return comp } + getPerks() { + let comp = duplicate(this.items.filter(item => item.type == 'perk') || []) + Hero6Utility.sortArrayObjectsByName(comp) + return comp + } + getPowers() { + let comp = duplicate(this.items.filter(item => item.type == 'power') || []) + Hero6Utility.sortArrayObjectsByName(comp) + return comp + } + getTalents() { + let comp = duplicate(this.items.filter(item => item.type == 'talent') || []) + Hero6Utility.sortArrayObjectsByName(comp) + return comp + } + getComplications() { + let comp = duplicate(this.items.filter(item => item.type == 'complication') || []) + Hero6Utility.sortArrayObjectsByName(comp) + return comp + } /* -------------------------------------------- */ async equipItem(itemId) { @@ -341,8 +361,8 @@ export class Hero6Actor extends Actor { /* -------------------------------------------- */ prepareCharacValues( charac) { - charac.total = charac.base+charac.value - charac.roll = 9 + Math.floor((charac.base+charac.value)/5) + charac.total = charac.value + charac.roll = 9 + Math.floor((charac.value)/5) } prepareCharac() { let characs = duplicate(this.system.characteristics) @@ -444,6 +464,14 @@ export class Hero6Actor extends Actor { } this.startRoll(rollData) } + /* -------------------------------------------- */ + rollItem(itemId) { + let item = this.items.get( itemId) + let rollData = this.getCommonRollData() + rollData.mode = "item" + rollData.item = duplicate(item) + this.startRoll(rollData) + } /* -------------------------------------------- */ rollSkill(skillId) { diff --git a/modules/hero6-utility.js b/modules/hero6-utility.js index 5f79b19..e4d2ab7 100644 --- a/modules/hero6-utility.js +++ b/modules/hero6-utility.js @@ -154,6 +154,7 @@ export class Hero6Utility { 'systems/fvtt-hero-system-6/templates/partials/editor-notes-gm.hbs', 'systems/fvtt-hero-system-6/templates/partials/partial-roll-select.hbs', 'systems/fvtt-hero-system-6/templates/partials/partial-actor-characteristic-block.hbs', + 'systems/fvtt-hero-system-6/templates/partials/partial-actor-full-charac.hbs', 'systems/fvtt-hero-system-6/templates/partials/partial-actor-status.hbs', 'systems/fvtt-hero-system-6/templates/partials/partial-options-abilities.hbs', 'systems/fvtt-hero-system-6/templates/partials/partial-item-nav.hbs', @@ -301,6 +302,9 @@ export class Hero6Utility { if (rollData.charac) { target = rollData.charac.roll } + if (rollData.item) { + target = rollData.item.system.roll + } // Performs roll console.log("Roll formula", diceFormula) @@ -323,6 +327,9 @@ export class Hero6Utility { if ( myRoll.terms[0].total == 18) { // Always a failure rollData.isSuccess = false } + if (rollData.isSuccess ) { + rollData.margin = target - rollData.result + } let msg = await this.createChatWithRollMode(rollData.alias, { content: await renderTemplate(`systems/fvtt-hero-system-6/templates/chat/chat-generic-result.hbs`, rollData) diff --git a/styles/simple.css b/styles/simple.css index d57239b..f1c9c5f 100644 --- a/styles/simple.css +++ b/styles/simple.css @@ -1420,6 +1420,11 @@ Focus FOC: #ff0084 max-width: 8rem; min-width: 8rem; } +.item-field-label-long2 { + flex-grow:1; + max-width: 16rem; + min-width: 16rem; +} .item-control-end { align-self: flex-end; } diff --git a/system.json b/system.json index 5325daf..164f948 100644 --- a/system.json +++ b/system.json @@ -91,7 +91,7 @@ "styles": [ "styles/simple.css" ], - "version": "10.0.9", + "version": "10.0.10", "compatibility": { "minimum": "10", "verified": "10", @@ -99,7 +99,7 @@ }, "title": "Hero System v6 for FoundrtVTT (Official)", "manifest": "https://www.uberwald.me/gitea/uberwald/fvtt-hero-system-6/raw/branch/main/system.json", - "download": "https://www.uberwald.me/gitea/uberwald/fvtt-hero-system-6/archive/fvtt-hero-system-6-v10.0.9.zip", + "download": "https://www.uberwald.me/gitea/uberwald/fvtt-hero-system-6/archive/fvtt-hero-system-6-v10.0.10.zip", "url": "https://www.uberwald.me/gitea/uberwald/", "background": "images/ui/hro6_welcome_page.webp", "id": "fvtt-hero-system-6" diff --git a/template.json b/template.json index f2c07ae..d564e73 100644 --- a/template.json +++ b/template.json @@ -8,12 +8,21 @@ "biodata": { "species": "", "age": 0, + "campaign":"", + "alternateids":"", + "player": "", + "gm": "", "gender": 0, "character": "", "religion": "", "weight": "", "height": "", "background": "", + "motivation": "", + "quote" : "", + "tactics": "", + "campaignuse": "", + "appearance": "", "description": "", "notes": "", "gmnotes": "" @@ -23,7 +32,7 @@ "characteristics": { "str": { "label": "Strength", - "value": 0, + "value": 10, "base": 10, "category": "main", "realcost": 0, @@ -31,32 +40,32 @@ }, "dex": { "label": "Dexterity", - "value": 0, + "value": 10, "base": 10, "category": "main" }, "con": { "label": "Constitution", "category": "main", - "value": 0, + "value": 10, "base": 10 }, "int": { "label": "Intelligence", "category": "main", - "value": 0, + "value": 10, "base": 10 }, "ego": { "label": "Ego", "category": "main", - "value": 0, + "value": 10, "base": 10 }, "pre": { "label": "Presence", "category": "main", - "value": 0, + "value": 10, "base": 10 }, "ocv": { @@ -120,7 +129,7 @@ "base": 4 }, "end": { - "label": "REC", + "label": "END", "value": 20, "max": 20 }, diff --git a/templates/actors/actor-sheet.hbs b/templates/actors/actor-sheet.hbs index 77e4066..034fbe0 100644 --- a/templates/actors/actor-sheet.hbs +++ b/templates/actors/actor-sheet.hbs @@ -30,21 +30,22 @@ {{!-- Sheet Tab Navigation --}} {{!-- Sheet Body --}}
- {{!-- Main Tab --}} -
- -
{{!-- Combat Tab --}}
@@ -117,30 +118,42 @@
-
-
    -
  • - -

    -
    -
  • - {{#each conditions as |condition key|}} -
  • - - {{condition.name}} -
     
    -
    - -
    -
  • - {{/each}} -
-
- + {{!-- Char Tab --}} +
+ +
+
    +
  • + +

    +
    + + + + + + + + + + + + +
     
    + +
  • + + {{#each characteristics as |charac key|}} + {{> systems/fvtt-hero-system-6/templates/partials/partial-actor-full-charac.hbs charac=charac key=key}} + {{/each}} +
+
+ +
+ {{!-- Skills Tab --}}
@@ -150,20 +163,20 @@

- + +
 
{{#each skills as |skill key|}}
  • - {{skill.name}} + {{skill.name}} {{upper skill.system.characteristic}} - {{skill.system.base}} -  -  + {{skill.system.base}}-
     
    @@ -173,7 +186,100 @@
    - {{!-- Skills Tab --}} + {{!-- Perks Tab --}} +
    + +
      +
    • + +

      +
      + + + +
    • + {{#each perks as |perk key|}} +
    • + + {{perk.name}} + {{#if perk.system.hasroll}} + {{perk.system.roll}}- + {{else}} +   + {{/if}} +
       
      +
      + +
      +
    • + {{/each}} +
    +
    + + {{!-- Talents Tab --}} +
    + +
      +
    • + +

      +
      + + + +
    • + {{#each talents as |talent key|}} +
    • + + {{talent.name}} + {{#if talent.system.hasroll}} + {{talent.system.roll}}- + {{else}} +   + {{/if}} +
       
      +
      + +
      +
    • + {{/each}} +
    +
    + + {{!-- Martial Tab --}} +
    + +
      +
    • + +

      +
      + + + +
    • + {{#each talents as |talent key|}} +
    • + + {{talent.name}} + {{#if talent.system.hasroll}} + {{talent.system.roll}}- + {{else}} +   + {{/if}} +
       
      +
      + +
      +
    • + {{/each}} +
    +
    + + {{!-- Powers Tab --}}
      @@ -181,9 +287,6 @@

      - - - @@ -192,10 +295,43 @@
    • - {{power.name}} - {{upper power.system.ability}} - {{power.system.skilldice}} -  -  + {{power.name}} + {{#if power.system.hasroll}} + {{power.system.roll}}- + {{else}} +   + {{/if}} +
       
      +
      + +
      +
    • + {{/each}} +
    +
    + + {{!-- Complications Tab --}} +
    + +
      +
    • + +

      +
      + + + +
    • + {{#each complications as |comp key|}} +
    • + + {{comp.name}} + {{#if comp.system.hasroll}} + {{comp.system.roll}}- + {{else}} +   + {{/if}}
       
      @@ -395,8 +531,8 @@
      • - - Alternate IDs +
      • @@ -420,51 +556,96 @@
        • - - + +
        • - - + +
        • - - Player +
        • -
        • - - - +
        • + +
      - -
      -

      Background :

      +

      Background/History :

      {{editor description target="system.biodata.description" button=true owner=owner editable=editable}}

      -

      Notes :

      +

      Personality/Motivation :

      - {{editor notes target="system.biodata.notes" button=true owner=owner editable=editable}} + {{editor motivation target="system.biodata.motivation" button=true owner=owner + editable=editable}}

      - +

      Quote :

      +
      + {{editor quote target="system.biodata.quote" button=true owner=owner + editable=editable}} +
      +

      Powers/Tactics :

      +
      + {{editor tactics target="system.biodata.tactics" button=true owner=owner + editable=editable}} +
      +

      Campaign Use :

      +
      + {{editor campaignuse target="system.biodata.campaignuse" button=true owner=owner + editable=editable}} +
      +

      Appearance :

      +
      + {{editor appearance target="system.biodata.appearance" button=true owner=owner + editable=editable}} +
      + {{!-- Notes Tab --}} +
      +

      Notes 1 :

      +
      + {{editor notes1 target="system.biodata.notes1" button=true owner=owner + editable=editable}} +
      +
      +

      Notes 2 :

      +
      + {{editor notes2 target="system.biodata.notes2" button=true owner=owner + editable=editable}} +
      +
      +

      Notes 3 :

      +
      + {{editor notes3 target="system.biodata.notes3" button=true owner=owner + editable=editable}} +
      +
      +

      Notes 4 :

      +
      + {{editor notes4 target="system.biodata.notes4" button=true owner=owner + editable=editable}} +
      +
      +

      Notes 5 :

      +
      + {{editor notes5 target="system.biodata.notes5" button=true owner=owner + editable=editable}} +
      + +
      + +
    +
  • \ No newline at end of file diff --git a/templates/apps/roll-dialog-generic.hbs b/templates/apps/roll-dialog-generic.hbs index e20a917..3a2cf1e 100644 --- a/templates/apps/roll-dialog-generic.hbs +++ b/templates/apps/roll-dialog-generic.hbs @@ -15,10 +15,23 @@ {{/if}} + {{#if item}} +
    + {{upperFirst item.type}} : + {{item.system.roll}}- +
    + {{/if}} +
    Bonus/Malus :
    diff --git a/templates/chat/chat-generic-result.hbs b/templates/chat/chat-generic-result.hbs index b5d49eb..0ce5356 100644 --- a/templates/chat/chat-generic-result.hbs +++ b/templates/chat/chat-generic-result.hbs @@ -22,13 +22,20 @@ {{#if charac}} -
  • Charac : {{charac.label}} -
  • +
  • CHAR : {{charac.label}}
  • {{/if}} + + {{#if item}} +
  • {{item.name}} ({{upperFirst item.type}})
  • + {{/if}} +
  • Bonus/Malus : {{bonusMalus}}
  • Result : {{result}} ({{#if isSuccess}}Success!!{{else}}Failure!{{/if}})
  • + {{#if isSuccess}} +
  • Margin : {{margin}} + {{/if}} diff --git a/templates/partials/partial-actor-characteristic-block.hbs b/templates/partials/partial-actor-characteristic-block.hbs index 94a3ab6..4d98be5 100644 --- a/templates/partials/partial-actor-characteristic-block.hbs +++ b/templates/partials/partial-actor-characteristic-block.hbs @@ -1,8 +1,9 @@
  • -

    {{charac.label}}

    +

    {{charac.label}}

    - -

    {{charac.total}}

    -

    {{charac.roll}}-

    + +   + +

    {{charac.roll}}-

  • \ No newline at end of file diff --git a/templates/partials/partial-actor-full-charac.hbs b/templates/partials/partial-actor-full-charac.hbs new file mode 100644 index 0000000..7fa2a22 --- /dev/null +++ b/templates/partials/partial-actor-full-charac.hbs @@ -0,0 +1,13 @@ +
  • + +

    {{charac.label}}

    +
    + {{#if (eq charac.category "main")}} +

    {{charac.base}}

    + {{else}} + + {{/if}} +  

    {{charac.base}}

    +

    {{charac.total}}

    + +
  • \ No newline at end of file