Add charmes/tours management

This commit is contained in:
2023-11-29 22:04:17 +01:00
parent 06d0d9b24d
commit 3e394734ce
63 changed files with 334 additions and 252 deletions

View File

@@ -3,35 +3,51 @@ import { WastelandUtility } from "./wasteland-utility.js";
export class WastelandRollDialog extends Dialog {
/* -------------------------------------------- */
static async create(actor, rollData ) {
static async create(actor, rollData) {
let options = { classes: ["WastelandDialog"], width: 340, height: 'fit-content', 'z-index': 99999 };
let html = await renderTemplate('systems/fvtt-wasteland/templates/roll-dialog-generic.html', rollData);
return new WastelandRollDialog(actor, rollData, html, options );
return new WastelandRollDialog(actor, rollData, html, options);
}
/* -------------------------------------------- */
constructor(actor, rollData, html, options, close = undefined) {
let 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() }
}
}
if (rollData.charme) {
buttons = {
roll: {
icon: '<i class="fas fa-check"></i>',
label: "Lancer",
callback: () => { this.roll() }
},
cancel: {
icon: '<i class="fas fa-times"></i>',
label: "Annuler",
callback: () => { this.close() }
}
}
}
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() }
} },
buttons: buttons,
close: close
}
@@ -42,9 +58,9 @@ export class WastelandRollDialog extends Dialog {
}
/* -------------------------------------------- */
roll ( dice) {
roll(dice) {
this.rollData.mainDice = dice
WastelandUtility.rollWasteland( this.rollData )
WastelandUtility.rollWasteland(this.rollData)
}
@@ -56,24 +72,28 @@ export class WastelandRollDialog extends Dialog {
function onLoad() {
}
$(function () { onLoad(); });
html.find('#modificateur').change(async (event) => {
html.find('#modificateur').change(async (event) => {
this.rollData.modificateur = Number(event.currentTarget.value)
})
html.find('#difficulte').change(async (event) => {
html.find('#difficulte').change(async (event) => {
this.rollData.difficulte = Number(event.currentTarget.value)
})
html.find('#attrKey').change(async (event) => {
html.find('#attrKey').change(async (event) => {
this.rollData.attrKey = String(event.currentTarget.value)
})
html.find('#runemode').change(async (event) => {
})
html.find('#runemode').change(async (event) => {
this.rollData.runemode = String(event.currentTarget.value)
})
html.find('#runeame').change(async (event) => {
})
html.find('#runeame').change(async (event) => {
this.rollData.runeame = Number(event.currentTarget.value)
})
html.find('#doubleD20').change(async (event) => {
})
html.find('#doubleD20').change(async (event) => {
this.rollData.doubleD20 = event.currentTarget.checked
})
})
html.find('#charmeDice').change(async (event) => {
this.rollData.charmeDice = String(event.currentTarget.value)
})
}
}