mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-03-09 20:51:21 +01:00
merged with main
This commit is contained in:
commit
0aa08deaa3
41 changed files with 805 additions and 446 deletions
|
|
@ -1,9 +1,10 @@
|
|||
const { ApplicationV2, HandlebarsApplicationMixin } = foundry.applications.api;
|
||||
|
||||
export default class DamageDialog extends HandlebarsApplicationMixin(ApplicationV2) {
|
||||
constructor(config={}, options={}) {
|
||||
constructor(roll, config = {}, options = {}) {
|
||||
super(options);
|
||||
|
||||
this.roll = roll;
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
|
|
@ -36,24 +37,24 @@ export default class DamageDialog extends HandlebarsApplicationMixin(Application
|
|||
async _prepareContext(_options) {
|
||||
const context = await super._prepareContext(_options);
|
||||
context.title = this.config.title;
|
||||
context.formula = this.config.formula;
|
||||
context.formula = this.config.roll.formula;
|
||||
return context;
|
||||
}
|
||||
|
||||
static async submitRoll() {
|
||||
await this.close({ submitted: true });
|
||||
await this.close({ submitted: true });
|
||||
}
|
||||
|
||||
/** @override */
|
||||
_onClose(options={}) {
|
||||
if ( !options.submitted ) this.config = false;
|
||||
_onClose(options = {}) {
|
||||
if (!options.submitted) this.config = false;
|
||||
}
|
||||
|
||||
static async configure(config={}) {
|
||||
static async configure(roll, config = {}) {
|
||||
return new Promise(resolve => {
|
||||
const app = new this(config);
|
||||
app.addEventListener("close", () => resolve(app.config), { once: true });
|
||||
const app = new this(roll, config);
|
||||
app.addEventListener('close', () => resolve(app.config), { once: true });
|
||||
app.render({ force: true });
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue