Monnaie pour gérer la fortune
This commit is contained in:
parent
53a7230f1d
commit
d381191692
@ -45,7 +45,7 @@ export class RdDBaseActorSheet extends ActorSheet {
|
|||||||
|
|
||||||
RdDBaseActorSheet.filterItemsPerTypeForSheet(formData, this.actor.itemTypes);
|
RdDBaseActorSheet.filterItemsPerTypeForSheet(formData, this.actor.itemTypes);
|
||||||
formData.calc = {
|
formData.calc = {
|
||||||
fortune: this.toSolsDeniers(this.actor.getFortune()),
|
fortune: Monnaie.toSolsDeniers(this.actor.getFortune()),
|
||||||
prixTotalEquipement: this.actor.computePrixTotalEquipement(),
|
prixTotalEquipement: this.actor.computePrixTotalEquipement(),
|
||||||
encTotal: await this.actor.computeEncTotal(),
|
encTotal: await this.actor.computeEncTotal(),
|
||||||
}
|
}
|
||||||
@ -56,13 +56,6 @@ export class RdDBaseActorSheet extends ActorSheet {
|
|||||||
return formData;
|
return formData;
|
||||||
}
|
}
|
||||||
|
|
||||||
toSolsDeniers(fortune) {
|
|
||||||
return {
|
|
||||||
sols: Math.floor(fortune),
|
|
||||||
deniers: Math.round(100 * (fortune - Math.floor(fortune)))
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
static filterItemsPerTypeForSheet(formData, itemTypes) {
|
static filterItemsPerTypeForSheet(formData, itemTypes) {
|
||||||
formData.recettescuisine = Misc.arrayOrEmpty(itemTypes['recettecuisine']);
|
formData.recettescuisine = Misc.arrayOrEmpty(itemTypes['recettecuisine']);
|
||||||
|
@ -62,6 +62,13 @@ export class Monnaie {
|
|||||||
return deniers;
|
return deniers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static toSolsDeniers(fortune) {
|
||||||
|
return {
|
||||||
|
sols: Math.floor(fortune),
|
||||||
|
deniers: Math.round(100 * (fortune - Math.floor(fortune)))
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
static getFortune(monnaies) {
|
static getFortune(monnaies) {
|
||||||
return (monnaies??[])
|
return (monnaies??[])
|
||||||
.map(m => Number(m.system.cout) * Number(m.system.quantite))
|
.map(m => Number(m.system.cout) * Number(m.system.quantite))
|
||||||
|
Loading…
Reference in New Issue
Block a user