forked from public/foundryvtt-reve-de-dragon
Fix: vente de service avec quantité
This commit is contained in:
@ -3776,7 +3776,7 @@ export class RdDActor extends Actor {
|
||||
const vente = achat.vente;
|
||||
const quantite = (achat.choix.nombreLots ?? 1) * (vente.tailleLot);
|
||||
const itemVendu = vendeur?.getObjet(vente.item._id) ?? (await RdDItem.getCorrespondingItem(vente.item));
|
||||
if (!this.verifierQuantite(service, vendeur, itemVendu, quantite)) {
|
||||
if (!this.verifierQuantite(service, vente.serviceSubItem, vendeur, itemVendu, quantite)) {
|
||||
ChatUtility.notifyUser(achat.userId, 'warn', `Le vendeur n'a pas assez de ${itemVendu.name} !`);
|
||||
return
|
||||
}
|
||||
@ -3828,8 +3828,8 @@ export class RdDActor extends Actor {
|
||||
}
|
||||
}
|
||||
|
||||
verifierQuantite(service, vendeur, item, quantiteTotal) {
|
||||
const disponible = service ? service.getQuantiteDisponible(item, quantiteTotal) : (vendeur ? (item?.getQuantite() ?? 0) : quantiteTotal);
|
||||
verifierQuantite(service, serviceSubItem, vendeur, item, quantiteTotal) {
|
||||
const disponible = service ? service.getQuantiteDisponible(serviceSubItem, quantiteTotal) : (vendeur ? (item?.getQuantite() ?? 0) : quantiteTotal);
|
||||
return disponible >= quantiteTotal;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user