forked from public/foundryvtt-reve-de-dragon
Les commerces peuvent appliquer un pourcentage
This commit is contained in:
@ -3,6 +3,7 @@ import { RdDItem } from "../item.js";
|
||||
import { RdDSheetUtility } from "../rdd-sheet-utility.js";
|
||||
import { RdDUtility } from "../rdd-utility.js";
|
||||
import { RdDBaseActorSheet } from "./base-actor-sheet.js";
|
||||
import { RdDCommerce } from "./commerce.js";
|
||||
|
||||
/**
|
||||
* Extend the basic ActorSheet with some very simple modifications
|
||||
@ -67,7 +68,7 @@ export class RdDCommerceSheet extends RdDBaseActorSheet {
|
||||
quantiteIllimite: disponible == undefined,
|
||||
nbLots: disponible ?? 1,
|
||||
tailleLot: 1,
|
||||
prixLot: item.system.cout
|
||||
prixLot: item.calculerPrixCommercant()
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { Misc } from "../misc.js";
|
||||
import { RdDBaseActor } from "./base-actor.js";
|
||||
|
||||
export class RdDCommerce extends RdDBaseActor {
|
||||
@ -45,4 +46,8 @@ export class RdDCommerce extends RdDBaseActor {
|
||||
await super.decrementerQuantiteItem(itemVendu, quantite, {supprimerSiZero: false});
|
||||
}
|
||||
|
||||
calculerPrix(item) {
|
||||
const pourcentage = this.system.pourcentage ?? 100;
|
||||
return Misc.keepDecimals(Math.ceil(item.system.cout * pourcentage)/100, 2);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user