Fix table résolution
This commit is contained in:
parent
3ee1b593c8
commit
d524dc35ce
@ -70,44 +70,44 @@ export class RdDRollResolutionTable extends Dialog {
|
||||
|
||||
this.bringToTop();
|
||||
|
||||
var rollData = this.rollData;
|
||||
var dialog = this;
|
||||
|
||||
function updateRollResult(rollData) {
|
||||
rollData.caracValue = parseInt(rollData.selectedCarac.value)
|
||||
rollData.finalLevel = dialog._computeFinalLevel(rollData);
|
||||
|
||||
// Mise à jour valeurs
|
||||
$("#carac").val(rollData.caracValue);
|
||||
$("#roll-param").text(rollData.selectedCarac.value + " / " + Misc.toSignedString(rollData.finalLevel));
|
||||
$(".table-resolution").remove();
|
||||
$("#resolutionTable").append(RdDResolutionTable.buildHTMLTable(rollData.caracValue, rollData.finalLevel, 1, 20, -10, 10));
|
||||
$(".table-proba-reussite").remove();
|
||||
$("#tableProbaReussite").append(RdDResolutionTable.buildHTMLResults(rollData.caracValue, rollData.finalLevel));
|
||||
}
|
||||
|
||||
// Setup everything onload
|
||||
$(function () {
|
||||
$("#diffLibre").val(Misc.toInt(rollData.diffLibre));
|
||||
$("#diffConditions").val(Misc.toInt(rollData.diffConditions));
|
||||
updateRollResult(rollData);
|
||||
});
|
||||
|
||||
function onLoad(){
|
||||
$("#diffLibre").val(Misc.toInt(dialog.rollData.diffLibre));
|
||||
$("#diffConditions").val(Misc.toInt(dialog.rollData.diffConditions));
|
||||
dialog.updateRollResult();
|
||||
}
|
||||
$(function () { onLoad();});
|
||||
|
||||
// Update !
|
||||
html.find('#diffLibre').change((event) => {
|
||||
rollData.diffLibre = Misc.toInt(event.currentTarget.value);
|
||||
updateRollResult(rollData);
|
||||
this.rollData.diffLibre = Misc.toInt(event.currentTarget.value);
|
||||
this.updateRollResult();
|
||||
});
|
||||
html.find('#diffConditions').change((event) => {
|
||||
rollData.diffConditions = Misc.toInt(event.currentTarget.value);
|
||||
updateRollResult(rollData);
|
||||
this.updateRollResult();
|
||||
});
|
||||
html.find('#carac').change((event) => {
|
||||
let caracKey = event.currentTarget.value;
|
||||
this.rollData.selectedCarac = rollData.carac[caracKey];
|
||||
updateRollResult(rollData);
|
||||
this.rollData.selectedCarac = this.rollData.carac[caracKey];
|
||||
this.updateRollResult();
|
||||
});
|
||||
}
|
||||
async updateRollResult() {
|
||||
let rollData = this.rollData;
|
||||
rollData.caracValue = parseInt(rollData.selectedCarac.value)
|
||||
rollData.finalLevel = this._computeFinalLevel(rollData);
|
||||
|
||||
// Mise à jour valeurs
|
||||
$("#carac").val(rollData.caracValue);
|
||||
$("#roll-param").text(rollData.selectedCarac.value + " / " + Misc.toSignedString(rollData.finalLevel));
|
||||
$(".table-resolution").remove();
|
||||
$(".table-proba-reussite").remove();
|
||||
$("#tableResolution").append(RdDResolutionTable.buildHTMLTable(rollData.caracValue, rollData.finalLevel));
|
||||
$("#tableProbaReussite").append(RdDResolutionTable.buildHTMLResults(rollData.caracValue, rollData.finalLevel));
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
_computeFinalLevel(rollData) {
|
||||
|
@ -28,8 +28,6 @@
|
||||
{{/select}}
|
||||
</select>
|
||||
</div>
|
||||
<div id="tableAjustements">
|
||||
</div>
|
||||
<div id="tableResolution">
|
||||
</div>
|
||||
<div id="tableProbaReussite">
|
||||
|
Loading…
Reference in New Issue
Block a user