Ajout de confirmation pour refoulement

This commit is contained in:
Vincent Vandemeulebrouck
2022-10-21 02:27:16 +02:00
parent 362fd964d0
commit 32af9bf1b4
2 changed files with 19 additions and 6 deletions

View File

@ -1426,9 +1426,21 @@ export class RdDActor extends Actor {
/* -------------------------------------------- */
async actionRefoulement(item) {
const refoulement = item?.system.refoulement ?? 0;
if (refoulement>0){
await this.ajouterRefoulement(refoulement);
await item.delete();
if (refoulement>0) {
RdDConfirm.confirmer({
settingConfirmer: "confirmation-refouler",
content: `<p>Prennez-vous le risque de refouler ${item.name} pour ${refoulement} points de refoulement ?</p>`,
title: 'Confirmer la refoulement',
buttonLabel: 'Refouler',
onAction: async () => {
ChatMessage.create({
whisper: ChatUtility.getWhisperRecipientsAndGMs(this.name),
content: `${this.name} a refoulé une queue ${item.nname} pour ${refoulement} points de refoulement`
});
await this.ajouterRefoulement(refoulement);
await item.delete();
}
})
}
}
@ -3703,7 +3715,7 @@ export class RdDActor extends Actor {
system: mergeObject(vente.item.system, { quantite: isItemEmpilable ? achat.quantiteTotal : undefined }),
}
let listeAchat = isItemEmpilable ? [achatData] : Array.from({ length: achat.quantiteTotal }, (_, i) => achatData)
let items = await acheteur.createEmbeddedDocuments("Item", listeAchat)
let items = await acheteur.createEmbeddedDocuments("Item", listeAchat);
if (achat.choix.consommer && vente.item.type == 'nourritureboisson') {
achat.choix.doses = achat.choix.nombreLots;
await acheteur.consommerNourritureboisson(items[0], achat.choix);