Nouvelle fenêtre de jets de dés

This commit is contained in:
2025-09-05 01:09:32 +02:00
parent 652c435833
commit 1ff32697f4
134 changed files with 4025 additions and 400 deletions

View File

@@ -0,0 +1,32 @@
import { ROLLDIALOG_SECTION, RollPart } from "./roll-part.mjs"
const ROLLMODE = "rollmode"
export class RollPartRollMode extends RollPart {
get code() { return ROLLMODE }
get section() { return ROLLDIALOG_SECTION.CONDITIONS }
loadRefs(rollData) {
const refs = this.getRefs(rollData)
refs.rollmodes = Object.entries(CONFIG.Dice.rollModes).map(([k, v]) => { return { key: k, label: v.label, icon: v.icon } })
}
restore(rollData) {
this.setCurrent(rollData, { key: this.getSaved(rollData)?.key ?? game.settings.get("core", "rollMode") })
}
store(rollData, targetData) {
this.setSaved(targetData, { key: this.getCurrent(rollData).key })
}
async _onRender(rollDialog, context, options) {
const rollvisibilityButtons = rollDialog.element.querySelectorAll(`button[name="roll-rollmode"]`)
rollvisibilityButtons?.forEach(it => it.addEventListener(
"click", e => {
e.preventDefault()
this.getCurrent(rollDialog.rollData).key = e.currentTarget.dataset.key
rollDialog.render()
}))
}
}