daggerheart/module/dialogs/damageDialog.mjs
Aurélien LEBOURGEOIS 385d414d7d g
2025-06-18 18:43:01 +02:00

47 lines
No EOL
1.3 KiB
JavaScript

const { ApplicationV2, HandlebarsApplicationMixin } = foundry.applications.api;
export default class DamageDialog extends HandlebarsApplicationMixin(ApplicationV2) {
constructor(config={}, options={}) {
super(options);
this.config = config;
}
static DEFAULT_OPTIONS = {
tag: 'form',
id: 'roll-selection',
classes: ['daggerheart', 'views', 'damage-selection'],
position: {
width: 400,
height: 'auto'
},
actions: {},
form: {
handler: this.updateRollConfiguration,
submitOnChange: true,
submitOnClose: false
}
};
/** @override */
static PARTS = {
damageSelection: {
id: 'damageSelection',
template: 'systems/daggerheart/templates/views/damageSelection.hbs'
}
};
async _prepareContext(_options) {
const context = await super._prepareContext(_options);
context.formula = this.config.formula;
return context;
}
static async configure(config={}) {
return new Promise(resolve => {
const app = new this(config);
app.addEventListener("close", () => resolve(app.config), { once: true });
app.render({ force: true });
});
}
}