From b06018d252f09f95362998bce82d01e5f6e72820 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Fri, 25 Jun 2021 14:40:25 +0200 Subject: [PATCH] =?UTF-8?q?Fix:=20re-tirage=20de=20d=C3=A9s=20sur=20reload?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - ajout d'une option pour explicitement masquer les dés - si showDice=false dans rdd-calendar, masquer les dés - sauvegarde de la nouvelle liste plutôt que l'ancienne --- module/rdd-calendrier.js | 14 ++++++++------ module/rdd-dice.js | 8 +++++--- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/module/rdd-calendrier.js b/module/rdd-calendrier.js index e387312c..e4479202 100644 --- a/module/rdd-calendrier.js +++ b/module/rdd-calendrier.js @@ -148,13 +148,15 @@ export class RdDCalendrier extends Application { } /* -------------------------------------------- */ - async ajouterNombreAstral(index, showdice = true) { - const nombreAstral = await RdDDice.rollTotal("1dh", { showDice: showdice, rollMode: "selfroll" }); + async ajouterNombreAstral(index, showDice = true) { + const nombreAstral = await RdDDice.rollTotal("1dh", { showDice: showDice, hideDice: !showDice, rollMode: "selfroll" }); const dateFuture = this.getDateFromIndex(index); - ChatMessage.create({ - whisper: ChatMessage.getWhisperRecipients("GM"), - content: `Le chiffre astrologique du ${dateFuture} sera le ${nombreAstral}` - }); + if (showDice) { + ChatMessage.create({ + whisper: ChatMessage.getWhisperRecipients("GM"), + content: `Le chiffre astrologique du ${dateFuture} sera le ${nombreAstral}` + }); + } return { nombreAstral: nombreAstral, valeursFausses: [], diff --git a/module/rdd-dice.js b/module/rdd-dice.js index ec3afc10..cc4121c4 100644 --- a/module/rdd-dice.js +++ b/module/rdd-dice.js @@ -134,12 +134,14 @@ export class RdDDice { static async roll(formula, options = { showDice: false, rollMode: undefined }) { const roll = new Roll(formula); await roll.evaluate({ async: true }); - roll.showDice = options.showDice; - await RdDDice.show(roll, options.rollMode ?? game.settings.get("core", "rollMode")); + if (!options.hideDice) { + roll.showDice = options.showDice; + await RdDDice.show(roll, options.rollMode ?? game.settings.get("core", "rollMode")); + } return roll; } - static async rollTotal(formula, options = { showDice: false }) { + static async rollTotal(formula, options = { showDice: false, hideDice: false }) { const roll = await RdDDice.roll(formula, options); return roll.total; }