forked from public/foundryvtt-reve-de-dragon
Cleanup roll windows
- permettre plusieurs fenêtres de jets en même temps en éliminant les id dans le html et les jquery sur id pour éviter les interactions - génération de la table par handlebars
This commit is contained in:
@ -15,7 +15,7 @@ export class RdDRollDialogEthylisme extends Dialog {
|
||||
default: "rollButton",
|
||||
buttons: { "rollButton": { label: "Test d'éthylisme", callback: html => this.onButton(html) } }
|
||||
};
|
||||
let dialogOptions = { classes: ["rdddialog"], width: 400, height: 'fit-content', 'z-index': 99999 }
|
||||
let dialogOptions = { classes: ["rdd-roll-dialog"], width: 400, height: 'fit-content', 'z-index': 99999 }
|
||||
super(dialogConf, dialogOptions)
|
||||
|
||||
//console.log("ETH", rollData);
|
||||
@ -39,20 +39,20 @@ export class RdDRollDialogEthylisme extends Dialog {
|
||||
|
||||
// Setup everything onload
|
||||
$(function () {
|
||||
$("#forceAlcool").val(Misc.toInt(rollData.forceAlcool));
|
||||
html.find(".force-alcool").val(Misc.toInt(rollData.forceAlcool));
|
||||
dialog.updateRollResult();
|
||||
});
|
||||
|
||||
// Update !
|
||||
html.find('#forceAlcool').change((event) => {
|
||||
rollData.forceAlcool = Misc.toInt(event.currentTarget.value); // Update the selected bonus/malus
|
||||
html.find(".force-alcool").change((event) => {
|
||||
rollData.forceAlcool = Misc.toInt(event.currentTarget.value);
|
||||
dialog.updateRollResult();
|
||||
});
|
||||
}
|
||||
async updateRollResult() {
|
||||
|
||||
// Mise à jour valeurs
|
||||
$("#roll-param").text(this.rollData.vie + " / " + Misc.toSignedString(Number(this.rollData.etat) + Number(this.rollData.forceAlcool) + this.rollData.diffNbDoses));
|
||||
$(".roll-ethylisme").text(this.rollData.vie + " / " + Misc.toSignedString(Number(this.rollData.etat) + Number(this.rollData.forceAlcool) + this.rollData.diffNbDoses));
|
||||
$(".table-resolution").remove();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user