Lancer un sort avec RdDRoll

This commit is contained in:
2020-12-08 23:07:41 +01:00
parent e46bcce2da
commit f1fbf3549a
4 changed files with 128 additions and 111 deletions

View File

@ -75,6 +75,9 @@ export class RdDRoll extends Dialog {
async onAction(action, html) {
await RdDResolutionTable.rollData(this.rollData);
console.log("RdDRoll -=>", this.rollData, this.rollData.rolled);
if (action.callbacks)
for (let callback of action.callbacks) {
if (callback.condition == undefined || callback.condition(this.rollData)) {
@ -102,6 +105,7 @@ export class RdDRoll extends Dialog {
// Sort management
if (rollData.selectedSort) {
rollData.bonus = RdDItemSort.getCaseBonus( rollData.selectedSort, rollData.coord ),
//console.log("Toggle show/hide", rollData.selectedSort);
HtmlUtility._showControlWhen("#div-sort-difficulte", RdDItemSort.isDifficulteVariable(rollData.selectedSort))
HtmlUtility._showControlWhen("#div-sort-ptreve", RdDItemSort.isCoutVariable(rollData.selectedSort))
@ -154,6 +158,7 @@ export class RdDRoll extends Dialog {
html.find('#sort').change((event) => {
let sortKey = Misc.toInt(event.currentTarget.value);
this.rollData.selectedSort = rollData.sortList[sortKey]; // Update the selectedCarac
this.rollData.bonus = RdDItemSort.getCaseBonus( rollData.selectedSort, rollData.coord );
RdDItemSort.setCoutReveReel(rollData.selectedSort);
//console.log("RdDRollSelectDialog - Sort selection", rollData.selectedSort);
updateRollResult(rollData);