Corrections et quelques améliorations #557

Merged
uberwald merged 10 commits from VincentVk/foundryvtt-reve-de-dragon:v10 into v10 2022-09-24 09:57:44 +02:00
Showing only changes of commit e2ff813226 - Show all commits

View File

@ -56,7 +56,7 @@ export class DialogItemAchat extends Dialog {
static prepareVenteData(buttonAcheter, vendeurId, vendeur, acheteur) {
const jsondata = buttonAcheter.attributes['data-jsondata']?.value;
const prixLot = parseInt(buttonAcheter.attributes['data-prixLot']?.value ?? 0);
let venteData = {
return {
item: JSON.parse(jsondata),
vendeurId: vendeurId,
vendeur: vendeur,
@ -73,7 +73,6 @@ export class DialogItemAchat extends Dialog {
prixTotal: prixLot,
isVente: prixLot > 0
};
return venteData;
}
async onAchat() {
@ -106,8 +105,12 @@ export class DialogItemAchat extends Dialog {
}
setNombreLots(nombreLots) {
this.venteData.choix.nombreLots = nombreLots;
if (nombreLots > this.venteData.quantiteNbLots) {
ui.notifications.warn(`Seulement ${this.venteData.quantiteNbLots} lots disponibles, vous ne pouvez pas en prendre ${nombreLots}`)
}
this.venteData.choix.nombreLots = Math.min(nombreLots, this.venteData.quantiteNbLots);
this.venteData.prixTotal = (nombreLots * this.venteData.prixLot).toFixed(2);
$(".nombreLots").val(this.venteData.choix.nombreLots);
$(".prixTotal").text(this.venteData.prixTotal);
}