2022-10-22 11:09:48 +02:00
|
|
|
import { HawkmoonUtility } from "./hawkmoon-utility.js";
|
|
|
|
|
|
|
|
export class HawkmoonRollDialog extends Dialog {
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
static async create(actor, rollData ) {
|
|
|
|
|
2022-11-29 10:54:56 +01:00
|
|
|
let options = { classes: ["HawkmoonDialog"], width: 320, height: 'fit-content', 'z-index': 99999 };
|
2022-10-22 11:09:48 +02:00
|
|
|
let html = await renderTemplate('systems/fvtt-hawkmoon-cyd/templates/roll-dialog-generic.html', rollData);
|
|
|
|
|
|
|
|
return new HawkmoonRollDialog(actor, rollData, html, options );
|
|
|
|
}
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
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",
|
2022-10-25 17:54:13 +02:00
|
|
|
callback: () => { this.roll("d10") }
|
2022-10-22 11:09:48 +02:00
|
|
|
},
|
|
|
|
rolld20: {
|
|
|
|
icon: '<i class="fas fa-check"></i>',
|
|
|
|
label: "Lancer 1d20",
|
2022-10-25 17:54:13 +02:00
|
|
|
callback: () => { this.roll("d20") }
|
2022-10-22 11:09:48 +02:00
|
|
|
},
|
|
|
|
cancel: {
|
|
|
|
icon: '<i class="fas fa-times"></i>',
|
|
|
|
label: "Annuler",
|
|
|
|
callback: () => { this.close() }
|
|
|
|
} },
|
|
|
|
close: close
|
|
|
|
}
|
|
|
|
|
|
|
|
super(conf, options);
|
|
|
|
|
|
|
|
this.actor = actor
|
|
|
|
this.rollData = rollData
|
|
|
|
}
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
roll ( dice) {
|
|
|
|
this.rollData.mainDice = dice
|
|
|
|
HawkmoonUtility.rollHawkmoon( this.rollData )
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
activateListeners(html) {
|
|
|
|
super.activateListeners(html);
|
|
|
|
|
|
|
|
var dialog = this;
|
|
|
|
function onLoad() {
|
|
|
|
}
|
|
|
|
$(function () { onLoad(); });
|
|
|
|
|
|
|
|
html.find('#modificateur').change(async (event) => {
|
|
|
|
this.rollData.modificateur = Number(event.currentTarget.value)
|
|
|
|
})
|
2024-05-02 09:27:16 +02:00
|
|
|
html.find('#difficulte').change( (event) => {
|
|
|
|
console.log("Difficulte: " + event.currentTarget.value)
|
2022-10-22 11:09:48 +02:00
|
|
|
this.rollData.difficulte = Number(event.currentTarget.value)
|
|
|
|
})
|
|
|
|
html.find('#attrKey').change(async (event) => {
|
|
|
|
this.rollData.attrKey = String(event.currentTarget.value)
|
|
|
|
})
|
2023-12-28 18:40:46 +01:00
|
|
|
html.find('#attrKey2').change(async (event) => {
|
|
|
|
this.rollData.attrKey2 = String(event.currentTarget.value)
|
|
|
|
})
|
2022-10-25 17:54:13 +02:00
|
|
|
html.find('#select-maitrise').change(async (event) => {
|
|
|
|
this.rollData.maitriseId = String(event.currentTarget.value)
|
2022-10-28 21:44:49 +02:00
|
|
|
})
|
|
|
|
html.find('#competence-talents').change((event) => {
|
2022-11-29 10:54:56 +01:00
|
|
|
this.rollData.selectedTalents = $('#competence-talents').val()
|
2022-10-28 21:44:49 +02:00
|
|
|
})
|
2023-04-24 22:20:47 +02:00
|
|
|
html.find('#taille-cible').change((event) => {
|
|
|
|
this.rollData.tailleCible = String(event.currentTarget.value)
|
|
|
|
})
|
|
|
|
html.find('#tireur-deplacement').change((event) => {
|
|
|
|
this.rollData.tireurDeplacement = String(event.currentTarget.value)
|
|
|
|
})
|
|
|
|
html.find('#cible-couvert').change((event) => {
|
|
|
|
this.rollData.cibleCouvert = String(event.currentTarget.value)
|
|
|
|
})
|
|
|
|
html.find('#distance-tir').change((event) => {
|
|
|
|
this.rollData.distanceTir = String(event.currentTarget.value)
|
|
|
|
})
|
2022-11-29 10:54:56 +01:00
|
|
|
html.find('#bonus-malus-context').change((event) => {
|
|
|
|
this.rollData.bonusMalusContext = Number(event.currentTarget.value)
|
|
|
|
})
|
2023-04-24 22:20:47 +02:00
|
|
|
html.find('#defenseur-au-sol').change((event) => {
|
|
|
|
this.rollData.defenseurAuSol = event.currentTarget.checked
|
|
|
|
})
|
2024-04-01 22:48:18 +02:00
|
|
|
html.find('#ambidextre-1').change((event) => {
|
|
|
|
this.rollData.ambidextre1 = event.currentTarget.checked
|
|
|
|
})
|
|
|
|
html.find('#ambidextre-2').change((event) => {
|
|
|
|
this.rollData.ambidextre2 = event.currentTarget.checked
|
|
|
|
})
|
|
|
|
html.find('#attaque-monte').change((event) => {
|
|
|
|
this.rollData.attqueMonte = event.currentTarget.checked
|
|
|
|
})
|
2023-04-24 22:20:47 +02:00
|
|
|
html.find('#defenseur-aveugle').change((event) => {
|
|
|
|
this.rollData.defenseurAveugle = event.currentTarget.checked
|
|
|
|
})
|
|
|
|
html.find('#defenseur-de-dos').change((event) => {
|
|
|
|
this.rollData.defenseurDeDos = event.currentTarget.checked
|
|
|
|
})
|
|
|
|
html.find('#defenseur-restreint').change((event) => {
|
|
|
|
this.rollData.defenseurRestreint = event.currentTarget.checked
|
|
|
|
})
|
|
|
|
html.find('#defenseur-immobilise').change((event) => {
|
|
|
|
this.rollData.defenseurImmobilise = event.currentTarget.checked
|
|
|
|
})
|
2023-05-25 07:23:25 +02:00
|
|
|
html.find('#attaque-charge').change((event) => {
|
|
|
|
this.rollData.attaqueCharge = event.currentTarget.checked
|
|
|
|
})
|
2024-04-01 22:48:18 +02:00
|
|
|
html.find('#charge-cavalerie').change((event) => {
|
|
|
|
this.rollData.chargeCavalerie = event.currentTarget.checked
|
|
|
|
})
|
|
|
|
html.find('#attaquants-multiple').change((event) => {
|
|
|
|
this.rollData.attaquantsMultiples = event.currentTarget.checked
|
|
|
|
})
|
|
|
|
html.find('#soutiens').change((event) => {
|
|
|
|
this.rollData.soutiens = Number(event.currentTarget.value)
|
|
|
|
})
|
|
|
|
html.find('#feinte').change((event) => {
|
|
|
|
this.rollData.feinte = event.currentTarget.checked
|
|
|
|
})
|
|
|
|
html.find('#contenir').change((event) => {
|
|
|
|
this.rollData.contenir = event.currentTarget.checked
|
|
|
|
})
|
2023-05-25 07:23:25 +02:00
|
|
|
html.find('#attaque-desarme').change((event) => {
|
|
|
|
this.rollData.attaqueDesarme = event.currentTarget.checked
|
|
|
|
})
|
2023-04-24 22:20:47 +02:00
|
|
|
|
2023-05-25 07:23:25 +02:00
|
|
|
|
2022-10-22 11:09:48 +02:00
|
|
|
}
|
|
|
|
}
|