From 0263fa5e2fb1938fed15682391a55350d69a505e Mon Sep 17 00:00:00 2001 From: The Happy Anarchist Date: Sat, 5 Sep 2020 01:02:19 -1000 Subject: [PATCH] Rounding error in item cost Fixed rounding errors on character sheet. --- src/module/helpers.js | 4 ++++ src/templates/actors/partials/character-inventory-tab.html | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/module/helpers.js b/src/module/helpers.js index 6b8f88d..073919f 100644 --- a/src/module/helpers.js +++ b/src/module/helpers.js @@ -33,6 +33,10 @@ export const registerHelpers = async function () { Handlebars.registerHelper("mult", function (lh, rh) { return parseFloat(lh) * parseFloat(rh); }); + + Handlebars.registerHelper("multround", function (lh, rh) { + return Math.round((parseFloat(lh) * parseFloat(rh)) * 100) / 100; + }) Handlebars.registerHelper("roundWeight", function (weight) { return Math.round(parseFloat(weight) / 100) / 10; diff --git a/src/templates/actors/partials/character-inventory-tab.html b/src/templates/actors/partials/character-inventory-tab.html index 44ef401..01a0f29 100644 --- a/src/templates/actors/partials/character-inventory-tab.html +++ b/src/templates/actors/partials/character-inventory-tab.html @@ -176,7 +176,7 @@ -
{{mult item.data.quantity.value item.data.cost}}
+
{{multround item.data.quantity.value item.data.cost}}
{{#if item.data.quantity.max}}/{{item.data.quantity.max}}{{/if}}