2021-12-22 05:12:40 +01:00
|
|
|
import { BoLUtility } from "./bol-utility.js";
|
2021-11-01 00:28:42 +01:00
|
|
|
|
|
|
|
export class BoLRollDialog extends Dialog {
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
static async create(actor, rollData ) {
|
|
|
|
|
2021-11-08 14:40:29 +01:00
|
|
|
let options = { classes: ["bol", "dialog"], width: 600, height: 320, 'z-index': 99999 };
|
|
|
|
// let html = await renderTemplate(`systems/bol/templates/roll/roll-dialog-${rollData.mode}.hbs`, rollData);
|
|
|
|
let html = await renderTemplate(`systems/bol/templates/roll/roll-dialog.hbs`, rollData);
|
2021-11-01 00:28:42 +01:00
|
|
|
return new BoLRollDialog(actor, rollData, html, options );
|
|
|
|
}
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
constructor(actor, rollData, html, options, close = undefined) {
|
|
|
|
let conf = {
|
|
|
|
title: rollData.title,
|
|
|
|
content: html,
|
|
|
|
buttons: {
|
|
|
|
roll: {
|
|
|
|
icon: '<i class="fas fa-check"></i>',
|
2021-11-01 22:23:43 +01:00
|
|
|
label: game.i18n.localize("Roll"),
|
2021-11-01 00:28:42 +01:00
|
|
|
callback: () => { this.roll() }
|
|
|
|
},
|
|
|
|
cancel: {
|
|
|
|
icon: '<i class="fas fa-times"></i>',
|
2021-11-01 22:23:43 +01:00
|
|
|
label: game.i18n.localize("Cancel"),
|
2021-11-01 00:28:42 +01:00
|
|
|
callback: () => { this.close() }
|
|
|
|
} },
|
|
|
|
default: "roll",
|
|
|
|
close: close
|
|
|
|
}
|
|
|
|
|
|
|
|
super(conf, options);
|
|
|
|
|
|
|
|
console.log("ROLLDATA ", rollData);
|
|
|
|
this.actor = actor;
|
|
|
|
this.rollData = rollData;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
roll () {
|
|
|
|
BoLUtility.rollBoL( this.rollData )
|
|
|
|
}
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
activateListeners(html) {
|
|
|
|
super.activateListeners(html);
|
|
|
|
|
2021-12-22 05:12:40 +01:00
|
|
|
let dialog = this;
|
2021-11-01 00:28:42 +01:00
|
|
|
function onLoad() {
|
|
|
|
}
|
|
|
|
$(function () { onLoad(); });
|
|
|
|
|
|
|
|
html.find('#bonusMalus').change((event) => {
|
|
|
|
this.rollData.bonusMalus = Number(event.currentTarget.value);
|
|
|
|
});
|
|
|
|
html.find('#d6Bonus').change((event) => {
|
|
|
|
this.rollData.d6Bonus = Number(event.currentTarget.value);
|
|
|
|
});
|
|
|
|
html.find('#d6Malus').change((event) => {
|
|
|
|
this.rollData.d6Malus = Number(event.currentTarget.value);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|