Fix: Nourriture consommée par le bon user

This commit is contained in:
Vincent Vandemeulebrouck
2022-11-13 21:56:23 +01:00
parent 2fe6b472a2
commit ccb6709f5b
3 changed files with 39 additions and 23 deletions

View File

@ -22,6 +22,7 @@ export class DialogItemAchat extends Dialog {
const prixLot = Monnaie.arrondiDeniers(button.attributes['data-prixLot']?.value ?? 0);
return {
item: json ? JSON.parse(json) : undefined,
actingUserId: game.user.id,
vendeurId: vendeurId,
vendeur: vendeur,
acheteur: acheteur,
@ -39,6 +40,7 @@ export class DialogItemAchat extends Dialog {
chatMessageIdVente: RdDUtility.findChatMessageId(button)
};
}
static async onAcheter(venteData) {
const html = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/dialog-item-achat.html`, venteData);
const dialog = new DialogItemAchat(html, venteData);
@ -52,7 +54,7 @@ export class DialogItemAchat extends Dialog {
const actionAchat = venteData.prixLot > 0 ? "Acheter" : "Prendre";
const buttons = {};
if (isConsommable) {
buttons["consommer"] = { label: venteData.item.system.boisson ? "Boire" : "Manger", callback: it => { this.onAchatConsommer(); } }
buttons["consommer"] = { label: venteData.item.system.boisson ? "Boire" : "Manger", callback: it => this.onAchatConsommer() }
}
buttons[actionAchat] = { label: actionAchat, callback: it => { this.onAchat(); } };
buttons["decliner"] = { label: "Décliner", callback: it => { } };
@ -76,7 +78,8 @@ export class DialogItemAchat extends Dialog {
acheteurId: this.venteData.acheteur?.id,
prixTotal: this.venteData.prixTotal,
chatMessageIdVente: this.venteData.chatMessageIdVente,
choix: this.venteData.choix
choix: this.venteData.choix,
vente: this.venteData
});
}