Files
foundryvtt-reve-de-dragon/module/rdd-roll-ethylisme.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

40 lines
1.3 KiB
JavaScript

import { Misc } from "./misc.js";
export class RdDRollDialogEthylisme extends foundry.applications.api.DialogV2 {
constructor(html, rollData, actor, onRoll) {
super({
title: "Test d'éthylisme",
content: html,
classes: ["rdd-roll-dialog"],
position: { width: 400, height: 'fit-content' },
buttons: [
{ label: "Test d'éthylisme", action: "rollButton", callback: () => onRoll(this.rollData) }
]
})
this.rollData = rollData
this.actor = actor
}
_onRender(context) {
super._onRender(context)
this.bringToFront()
const el = this.element
el.querySelector(".force-alcool")?.addEventListener("change", event => {
this.rollData.forceAlcool = Misc.toInt(event.currentTarget.value)
this.updateRollResult()
})
const fa = el.querySelector(".force-alcool")
if (fa) fa.value = Misc.toInt(this.rollData.forceAlcool)
this.updateRollResult()
}
async updateRollResult() {
const el = this.element
const textEl = el.querySelector(".roll-ethylisme")
if (textEl) {
textEl.textContent = this.rollData.vie + " / " + Misc.toSignedString(Number(this.rollData.etat) + Number(this.rollData.forceAlcool) + this.rollData.diffNbDoses)
}
el.querySelector(".table-resolution")?.remove()
}
}