Fix: affichage de la fortune avec arrondis

Affichage en sols + deniers
This commit is contained in:
Vincent Vandemeulebrouck 2022-12-18 19:16:23 +01:00
parent f40dbd5d7b
commit 886307f24c
3 changed files with 10 additions and 2 deletions

View File

@ -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(),

View File

@ -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'];

View File

@ -1,4 +1,4 @@
<span class="item-name"><h4>Argent et Monnaies (fortune: {{calc.fortune}} sols)</h4></span>
<span class="item-name"><h4>Argent et Monnaies (fortune: {{calc.fortune.sols}} sols {{calc.fortune.deniers}} deniers)</h4></span>
<ul class="item-list alterne-list">
{{#each monnaie as |piece id|}}
<li class="item flexrow list-item" data-item-id="{{piece._id}}">