From d381191692184f20af62c3f82c4aa5ff27954f4c Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Sat, 28 Jan 2023 16:35:45 +0100 Subject: [PATCH] =?UTF-8?q?Monnaie=20pour=20g=C3=A9rer=20la=20fortune?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/actor/base-actor-sheet.js | 9 +-------- module/item-monnaie.js | 7 +++++++ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/module/actor/base-actor-sheet.js b/module/actor/base-actor-sheet.js index 1af09f3f..e0d92bd1 100644 --- a/module/actor/base-actor-sheet.js +++ b/module/actor/base-actor-sheet.js @@ -45,7 +45,7 @@ export class RdDBaseActorSheet extends ActorSheet { RdDBaseActorSheet.filterItemsPerTypeForSheet(formData, this.actor.itemTypes); formData.calc = { - fortune: this.toSolsDeniers(this.actor.getFortune()), + fortune: Monnaie.toSolsDeniers(this.actor.getFortune()), prixTotalEquipement: this.actor.computePrixTotalEquipement(), encTotal: await this.actor.computeEncTotal(), } @@ -56,13 +56,6 @@ export class RdDBaseActorSheet extends ActorSheet { return formData; } - toSolsDeniers(fortune) { - return { - sols: Math.floor(fortune), - deniers: Math.round(100 * (fortune - Math.floor(fortune))) - }; - } - /* -------------------------------------------- */ static filterItemsPerTypeForSheet(formData, itemTypes) { formData.recettescuisine = Misc.arrayOrEmpty(itemTypes['recettecuisine']); diff --git a/module/item-monnaie.js b/module/item-monnaie.js index 5e091b7f..610ee2d9 100644 --- a/module/item-monnaie.js +++ b/module/item-monnaie.js @@ -62,6 +62,13 @@ export class Monnaie { return deniers; } + static toSolsDeniers(fortune) { + return { + sols: Math.floor(fortune), + deniers: Math.round(100 * (fortune - Math.floor(fortune))) + }; + } + static getFortune(monnaies) { return (monnaies??[]) .map(m => Number(m.system.cout) * Number(m.system.quantite))