Fix: affichage de la fortune avec arrondis
Affichage en sols + deniers
This commit is contained in:
parent
f40dbd5d7b
commit
886307f24c
@ -57,7 +57,7 @@ export class RdDActorSheet extends ActorSheet {
|
|||||||
notes: await TextEditor.enrichHTML(this.object.system.notes, { async: true }),
|
notes: await TextEditor.enrichHTML(this.object.system.notes, { async: true }),
|
||||||
notesmj: await TextEditor.enrichHTML(this.object.system.notesmj, { async: true }),
|
notesmj: await TextEditor.enrichHTML(this.object.system.notesmj, { async: true }),
|
||||||
calc: {
|
calc: {
|
||||||
fortune: Monnaie.getFortune(this.actor),
|
fortune: Monnaie.getFortuneSolsDeniers(this.actor),
|
||||||
encTotal: await this.actor.computeEncombrementTotalEtMalusArmure(),
|
encTotal: await this.actor.computeEncombrementTotalEtMalusArmure(),
|
||||||
surenc: this.actor.computeMalusSurEncombrement(),
|
surenc: this.actor.computeMalusSurEncombrement(),
|
||||||
prixTotalEquipement: this.actor.computePrixTotalEquipement(),
|
prixTotalEquipement: this.actor.computePrixTotalEquipement(),
|
||||||
|
@ -72,6 +72,14 @@ export class Monnaie {
|
|||||||
return 0;
|
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) {
|
static async optimiserFortune(actor, fortune) {
|
||||||
let resteEnDeniers = Math.round(fortune * 100);
|
let resteEnDeniers = Math.round(fortune * 100);
|
||||||
let monnaies = actor.itemTypes['monnaie'];
|
let monnaies = actor.itemTypes['monnaie'];
|
||||||
|
@ -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">
|
<ul class="item-list alterne-list">
|
||||||
{{#each monnaie as |piece id|}}
|
{{#each monnaie as |piece id|}}
|
||||||
<li class="item flexrow list-item" data-item-id="{{piece._id}}">
|
<li class="item flexrow list-item" data-item-id="{{piece._id}}">
|
||||||
|
Loading…
Reference in New Issue
Block a user