diff --git a/modules/hero6-actor-sheet.js b/modules/hero6-actor-sheet.js index c774ca3..cae244c 100644 --- a/modules/hero6-actor-sheet.js +++ b/modules/hero6-actor-sheet.js @@ -66,6 +66,7 @@ export class Hero6ActorSheet extends ActorSheet { notes5: await TextEditor.enrichHTML(this.object.system.biodata.notes5, {async: true}), containersTree: this.actor.containersTree, encCurrent: this.actor.encCurrent, + totalValue: this.actor.totalValue, options: this.options, owner: this.document.isOwner, editScore: this.options.editScore, diff --git a/modules/hero6-actor.js b/modules/hero6-actor.js index 5652135..6feabe1 100644 --- a/modules/hero6-actor.js +++ b/modules/hero6-actor.js @@ -323,13 +323,18 @@ export class Hero6Actor extends Actor { buildContainerTree() { let equipments = duplicate(this.items.filter(item => item.type == "equipment") || []); let enc = 0 + let value = 0 for (let equip1 of equipments) { if (Number(equip1.system.weight) && Number(equip1.system.quantity)) { enc += equip1.system.weight * equip1.system.quantity } + if (Number(equip1.system.value) && Number(equip1.system.quantity)) { + value += equip1.system.value * equip1.system.quantity + } } // Store local values this.encCurrent = enc + this.totalValue = value } /* -------------------------------------------- */ @@ -427,7 +432,7 @@ export class Hero6Actor extends Actor { /* -------------------------------------------- */ prepareCharacValues(charac) { charac.total = charac.value - charac.roll = 9 + Math.floor((charac.value) / 5) + charac.roll = 9 + Math.round((charac.value) / 5) } prepareCharac() { let characs = duplicate(this.system.characteristics) @@ -579,6 +584,7 @@ export class Hero6Actor extends Actor { let rollData = this.getCommonRollData() rollData.mode = "damage" rollData.item = duplicate(item) + rollData.title = item.name rollData.diceFormula = Hero6Utility.convertRollHeroSyntax(item.system.damage) let myRoll = new Roll(rollData.diceFormula).roll({ async: false }) await Hero6Utility.showDiceSoNice(myRoll, game.settings.get("core", "rollMode")) @@ -587,9 +593,13 @@ export class Hero6Actor extends Actor { rollData.result = myRoll.total rollData.bodyValue = Hero6Utility.computeBodyValue(myRoll) - let msg = await Hero6Utility.createChatWithRollMode(rollData.alias, { - content: await renderTemplate(`systems/fvtt-hero-system-6/templates/chat/chat-damage-result.hbs`, rollData) + let msgFlavor = await renderTemplate(`systems/fvtt-hero-system-6/templates/chat/chat-damage-result.hbs`, rollData) + let msg = await rollData.roll.toMessage({ + user: game.user.id, + rollMode: game.settings.get("core", "rollMode"), + flavor: msgFlavor }) + rollData.roll = duplicate(rollData.roll) // Convert to object msg.setFlag("world", "rolldata", rollData) console.log("Rolldata result", rollData) } diff --git a/modules/hero6-utility.js b/modules/hero6-utility.js index 85088dd..f24dbf1 100644 --- a/modules/hero6-utility.js +++ b/modules/hero6-utility.js @@ -41,7 +41,7 @@ export class Hero6Utility { return list.length > 0; }) Handlebars.registerHelper('mul', function (a, b) { - return parseInt(a) * parseInt(b); + return Number(a) * Number(b); }) Handlebars.registerHelper('locationLabel', function (key) { return __locationNames[key] @@ -390,9 +390,12 @@ export class Hero6Utility { let hasHalfDice = "" if (hero6Formula.match("1/2d6")) { hero6Formula = hero6Formula.replace("1/2d6", "d6") - hasHalfDice = "+round(1d6)" + hasHalfDice = "+round(1d6/2)" + } + if (hero6Formula.match(".5")) { + hero6Formula = hero6Formula.replace(".5", "") + hasHalfDice = "+round(1d6/2)" } - let foundryFormula = hero6Formula + hasHalfDice foundryFormula = foundryFormula.replace(' ', '') console.log("Parsed formula : ", hero6Formula, foundryFormula) diff --git a/system.json b/system.json index f881882..9d140a8 100644 --- a/system.json +++ b/system.json @@ -91,7 +91,7 @@ "styles": [ "styles/simple.css" ], - "version": "10.0.40", + "version": "10.0.41", "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.40.zip", + "download": "https://www.uberwald.me/gitea/uberwald/fvtt-hero-system-6/archive/fvtt-hero-system-6-v10.0.41.zip", "url": "https://www.uberwald.me/gitea/uberwald/", "background": "images/ui/hro6_welcome_page.webp", "id": "fvtt-hero-system-6" diff --git a/templates/actors/actor-sheet.hbs b/templates/actors/actor-sheet.hbs index 4b63247..964f6ab 100644 --- a/templates/actors/actor-sheet.hbs +++ b/templates/actors/actor-sheet.hbs @@ -129,22 +129,9 @@ - -
  • - -
  • -
  • - - {{system.biodata.presenceattack.displayFormula}} +
  • @@ -193,6 +180,12 @@
  • + + + + + {{system.biodata.presenceattack.displayFormula}} +
  • @@ -604,6 +597,7 @@

    Encumbrance

    Current : {{encCurrent}} Capacity : {{encCapacity}} + Total value : {{totalValue}} {{> systems/fvtt-hero-system-6/templates/partials/partial-actor-equipment-section.hbs title="Weapons" items=weapons}} diff --git a/templates/chat/chat-damage-result.hbs b/templates/chat/chat-damage-result.hbs index db78acd..76168a5 100644 --- a/templates/chat/chat-damage-result.hbs +++ b/templates/chat/chat-damage-result.hbs @@ -18,10 +18,9 @@
    diff --git a/templates/partials/partial-actor-equipment-section.hbs b/templates/partials/partial-actor-equipment-section.hbs index d8f9aef..2af425c 100644 --- a/templates/partials/partial-actor-equipment-section.hbs +++ b/templates/partials/partial-actor-equipment-section.hbs @@ -3,6 +3,9 @@ + + + diff --git a/templates/partials/partial-actor-equipment.hbs b/templates/partials/partial-actor-equipment.hbs index 3d028bf..b2bae8a 100644 --- a/templates/partials/partial-actor-equipment.hbs +++ b/templates/partials/partial-actor-equipment.hbs @@ -1,5 +1,8 @@
  • + + + {{equip.name}}
  • - +

    {{charac.label}}

    - +

    {{charac.base}}

    - + {{#if charac.hasroll}} -

    {{charac.roll}}-

    +

    {{charac.roll}}-

    {{else}}

     

    {{/if}} - + {{#if charac.lift}} -

      

    -

    {{charac.lift}}

    -

    {{charac.liftDice}}

    +

      

    +

    {{charac.lift}}

    +

    {{charac.liftDice}}

    + + + {{/if}}
  • \ No newline at end of file