Files
foundryvtt-reve-de-dragon/module/rdd-tmr-rencontre-dialog.js
T
fabres 25e3df1f5d Migration Foundry v14 : classes V1→V2, corrections CSS et bugs
- 21 classes Dialog → DialogV2
- 2 classes Application → ApplicationV2 + HandlebarsApplicationMixin
- 1 classe FormApplication → ApplicationV2
- 10 appels new Dialog() → DialogV2 (rdd-confirm, rdd-commands, etc.)
- base-actor-sheet.mjs : 3 appels new Dialog → DialogV2
- Sheet journal : JournalTextPageSheet → JournalEntryPageProseMirrorSheet
- CSS : backdrop-filter, box-shadow, bordures V2 supprimes pour calendar/astrologie
- FenetreRechercheTirage : _getWindowControls + dragDrop ajoutes
- HtmlUtility.showControlWhen : compat jQuery + DOM natif
- rdd-main.js : init calendrier en setTimeout
- Constantes : duplicate → deepClone, _id → id
- renderTemplate global → foundry.applications.handlebars.renderTemplate
2026-07-22 00:29:56 +02:00

47 lines
1.5 KiB
JavaScript

export class RdDTMRRencontreDialog extends foundry.applications.api.DialogV2 {
constructor(actor, rencontre, tmr) {
const buttons = [
{ label: "Se dérober", action: "derober", callback: () => this.onButtonAction("derober") },
{ label: "Maîtriser", action: "maitriser", callback: () => this.onButtonAction("maitriser") }
]
if ((rencontre.system.refoulement ?? 0) == 0) {
buttons.push({ label: "Ignorer", action: "ignorer", callback: () => this.onButtonAction("ignorer") })
}
else {
buttons.push({ label: "Refouler", action: "refouler", callback: () => this.onButtonAction("refouler") })
}
super({
title: "Rencontre en TMR!",
content: "Vous rencontrez un " + rencontre.name + " de force " + rencontre.system.force + "<br>",
buttons,
classes: ["tmrrencdialog"],
position: { width: 320, height: 'fit-content' }
})
this.toClose = false
this.tmr = tmr
this.actor = actor
this.rencontre = rencontre
}
async onButtonAction(action) {
this.toClose = true
await this.actor.tmrApp?.restoreTMRAfterAction()
this.actor.tmrApp?.onActionRencontre(action, this.tmr, this.rencontre)
}
async close() {
if (this.actor.tmrApp) {
if (this.toClose) {
return await super.close()
}
else {
ui.notifications.info("Vous devez résoudre la rencontre.")
return this.actor.tmrApp.forceTMRContinueAction()
}
}
else {
return await super.close()
}
}
}