Migration datamodels !
This commit is contained in:
@@ -1,56 +1,56 @@
|
||||
import { MournbladeUtility } from "./mournblade-utility.js";
|
||||
|
||||
export class MournbladeRollDialog extends Dialog {
|
||||
export class MournbladeRollDialog extends Application {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async create(actor, rollData ) {
|
||||
|
||||
let options = { classes: ["MournbladeDialog"], width: 340, height: 'fit-content', 'z-index': 99999 };
|
||||
let html = await foundry.applications.handlebars.renderTemplate('systems/fvtt-mournblade/templates/roll-dialog-generic.html', rollData);
|
||||
|
||||
return new MournbladeRollDialog(actor, rollData, html, options );
|
||||
return new MournbladeRollDialog(actor, rollData);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
constructor(actor, rollData, html, options, close = undefined) {
|
||||
let conf = {
|
||||
title: "Test de Capacité",
|
||||
content: html,
|
||||
buttons: {
|
||||
rolld10: {
|
||||
icon: '<i class="fas fa-check"></i>',
|
||||
label: "Lancer 1d10",
|
||||
callback: () => { this.roll("1d10") }
|
||||
},
|
||||
rolld20: {
|
||||
icon: '<i class="fas fa-check"></i>',
|
||||
label: "Lancer 1d20",
|
||||
callback: () => { this.roll("1d20") }
|
||||
},
|
||||
cancel: {
|
||||
icon: '<i class="fas fa-times"></i>',
|
||||
label: "Annuler",
|
||||
callback: () => { this.close() }
|
||||
} },
|
||||
close: close
|
||||
constructor(actor, rollData, options = {}) {
|
||||
super(options);
|
||||
this.actor = actor;
|
||||
this.rollData = rollData;
|
||||
}
|
||||
|
||||
static get defaultOptions() {
|
||||
return foundry.utils.mergeObject(super.defaultOptions, {
|
||||
classes: ["fvtt-mournblade", "sheet", "item"],
|
||||
template: "systems/fvtt-mournblade/templates/roll-dialog-generic.hbs",
|
||||
width: 400,
|
||||
height: "auto",
|
||||
title: "Test de Capacité"
|
||||
});
|
||||
}
|
||||
|
||||
getData() {
|
||||
const data = foundry.utils.duplicate(this.rollData);
|
||||
if (!data.config) {
|
||||
data.config = game.system.mournblade.config;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
super(conf, options);
|
||||
|
||||
this.actor = actor
|
||||
this.rollData = rollData
|
||||
_onCancel() {
|
||||
this.close();
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
roll ( dice) {
|
||||
this.rollData.mainDice = dice
|
||||
MournbladeUtility.rollMournblade( this.rollData )
|
||||
_onRoll(dice) {
|
||||
this.rollData.mainDice = dice;
|
||||
MournbladeUtility.rollMournblade(this.rollData);
|
||||
this.close();
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
activateListeners(html) {
|
||||
super.activateListeners(html);
|
||||
|
||||
// Roll buttons
|
||||
html.find(".rolld10").click(this._onRoll.bind(this, "1d10"));
|
||||
html.find(".rolld20").click(this._onRoll.bind(this, "1d20"));
|
||||
html.find(".cancel").click(this._onCancel.bind(this));
|
||||
|
||||
function onLoad() {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user