forked from public/foundryvtt-reve-de-dragon
Commandes pour jet de dés
This commit is contained in:
@ -10,16 +10,17 @@ import { RdDResolutionTable } from "./rdd-resolution-table.js";
|
||||
export class RdDRollResolution extends Dialog {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async open() {
|
||||
let rollData = RdDRollResolution._prepareDefaultOptions();
|
||||
static async open(rollData = {selectedCarac:10}) {
|
||||
RdDRollResolution._setDefaultOptions(rollData);
|
||||
let html = await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/dialog-roll-resolution.html', rollData);
|
||||
const dialog = new RdDRollResolution(rollData, html);
|
||||
dialog.render(true);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static _prepareDefaultOptions() {
|
||||
let rollData = {
|
||||
static _setDefaultOptions(rollData) {
|
||||
|
||||
let defRollData = {
|
||||
ajustementsConditions: CONFIG.RDD.ajustementsConditions,
|
||||
difficultesLibres: CONFIG.RDD.difficultesLibres,
|
||||
etat: 0,
|
||||
@ -29,11 +30,14 @@ export class RdDRollResolution extends Dialog {
|
||||
diffConditions: 0,
|
||||
diffLibre: 0
|
||||
}
|
||||
mergeObject(rollData, defRollData, {overwrite: false});
|
||||
for (let i = 1; i < 21; i++) {
|
||||
rollData.carac[i] = { type: "number", value: i, label: i }
|
||||
if (rollData.selectedCarac == i) {
|
||||
rollData.selectedCarac = rollData.carac[i];
|
||||
}
|
||||
|
||||
}
|
||||
rollData.selectedCarac = rollData.carac[10];
|
||||
return rollData;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
Reference in New Issue
Block a user