From 886307f24c138838dc1c1ee4d28311400e05cd22 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Sun, 18 Dec 2022 19:16:23 +0100 Subject: [PATCH 01/15] Fix: affichage de la fortune avec arrondis Affichage en sols + deniers --- module/actor-sheet.js | 2 +- module/item-monnaie.js | 8 ++++++++ templates/actor/inventaire-monnaie.html | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/module/actor-sheet.js b/module/actor-sheet.js index a8ef1ab5..1163025a 100644 --- a/module/actor-sheet.js +++ b/module/actor-sheet.js @@ -57,7 +57,7 @@ export class RdDActorSheet extends ActorSheet { notes: await TextEditor.enrichHTML(this.object.system.notes, { async: true }), notesmj: await TextEditor.enrichHTML(this.object.system.notesmj, { async: true }), calc: { - fortune: Monnaie.getFortune(this.actor), + fortune: Monnaie.getFortuneSolsDeniers(this.actor), encTotal: await this.actor.computeEncombrementTotalEtMalusArmure(), surenc: this.actor.computeMalusSurEncombrement(), prixTotalEquipement: this.actor.computePrixTotalEquipement(), diff --git a/module/item-monnaie.js b/module/item-monnaie.js index be030cbd..d766c0af 100644 --- a/module/item-monnaie.js +++ b/module/item-monnaie.js @@ -72,6 +72,14 @@ export class Monnaie { return 0; } + static getFortuneSolsDeniers(actor) { + const fortune = Monnaie.getFortune(actor); + return { + sols: Math.floor(fortune), + deniers: Math.round(100 * (fortune - Math.floor(fortune))) + }; + } + static async optimiserFortune(actor, fortune) { let resteEnDeniers = Math.round(fortune * 100); let monnaies = actor.itemTypes['monnaie']; diff --git a/templates/actor/inventaire-monnaie.html b/templates/actor/inventaire-monnaie.html index d0bc788f..851d2188 100644 --- a/templates/actor/inventaire-monnaie.html +++ b/templates/actor/inventaire-monnaie.html @@ -1,4 +1,4 @@ -

Argent et Monnaies (fortune: {{calc.fortune}} sols)

+

Argent et Monnaies (fortune: {{calc.fortune.sols}} sols {{calc.fortune.deniers}} deniers)