Initial import
This commit is contained in:
84
modules/pegasus-roll-dialog.js
Normal file
84
modules/pegasus-roll-dialog.js
Normal file
@ -0,0 +1,84 @@
|
||||
import { PegasusUtility } from "./pegasus-utility.js";
|
||||
|
||||
export class PegasusRollDialog extends Dialog {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async create(actor, rollData ) {
|
||||
|
||||
let html
|
||||
let options = { classes: ["WotGdialog"], width: 420, height: 320, 'z-index': 99999 };
|
||||
if ( rollData.mode == "skill") {
|
||||
html = await renderTemplate('systems/fvtt-pegasus-rpg/templates/roll-dialog-skill.html', rollData);
|
||||
options.height = 360;
|
||||
} else if (rollData.mode == "chidamage") {
|
||||
html = await renderTemplate('systems/fvtt-pegasus-rpg/templates/roll-dialog-damage-chi.html', rollData);
|
||||
options.height = 380;
|
||||
} else if (rollData.mode == "technique") {
|
||||
html = await renderTemplate('systems/fvtt-pegasus-rpg/templates/roll-dialog-technique.html', rollData);
|
||||
options.height = 380;
|
||||
} else if (rollData.mode == "weapon") {
|
||||
html = await renderTemplate('systems/fvtt-pegasus-rpg/templates/roll-dialog-weapon.html', rollData);
|
||||
options.height = 460;
|
||||
} else {
|
||||
html = await renderTemplate('systems/fvtt-pegasus-rpg/templates/roll-dialog-skill.html', rollData);
|
||||
}
|
||||
return new PegasusRollDialog(actor, rollData, html, options );
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
constructor(actor, rollData, html, options, close = undefined) {
|
||||
let conf = {
|
||||
title: (rollData.mode == "skill") ? "Skill" : "Roll",
|
||||
content: html,
|
||||
buttons: {
|
||||
roll: {
|
||||
icon: '<i class="fas fa-check"></i>',
|
||||
label: "Roll !",
|
||||
callback: () => { this.roll() }
|
||||
},
|
||||
cancel: {
|
||||
icon: '<i class="fas fa-times"></i>',
|
||||
label: "Cancel",
|
||||
callback: () => { this.close() }
|
||||
} },
|
||||
default: "roll",
|
||||
close: close
|
||||
}
|
||||
|
||||
super(conf, options);
|
||||
|
||||
this.actor = actor;
|
||||
this.rollData = rollData;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
roll () {
|
||||
PegasusUtility.rollWotG( this.rollData )
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
activateListeners(html) {
|
||||
super.activateListeners(html);
|
||||
|
||||
var dialog = this;
|
||||
function onLoad() {
|
||||
}
|
||||
$(function () { onLoad(); });
|
||||
|
||||
html.find('#negativeModifier').change((event) => {
|
||||
this.rollData.negativeModifier = Number(event.currentTarget.value);
|
||||
});
|
||||
html.find('#positiveModifier').change((event) => {
|
||||
this.rollData.positiveModifier = Number(event.currentTarget.value);
|
||||
});
|
||||
html.find('#specialtiesBonus').change((event) => {
|
||||
this.rollData.specialtiesBonus = Number(event.currentTarget.value);
|
||||
});
|
||||
html.find('#selectedChi').change((event) => {
|
||||
this.rollData.selectedChi = Number(event.currentTarget.value);
|
||||
});
|
||||
html.find('#bonusMalus').change((event) => {
|
||||
this.rollData.bonusMalus = Number(event.currentTarget.value);
|
||||
});
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user