From 92f1cbd7c388dd923ae6715297dce9b7e287830d Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Fri, 25 Jun 2021 14:17:58 +0200 Subject: [PATCH 1/2] =?UTF-8?q?Fix:=20raison=20non=20utilis=C3=A9e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/rdd-astrologie-editeur.js | 2 +- module/rdd-calendrier.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/module/rdd-astrologie-editeur.js b/module/rdd-astrologie-editeur.js index 65ea242d..75913483 100644 --- a/module/rdd-astrologie-editeur.js +++ b/module/rdd-astrologie-editeur.js @@ -25,7 +25,7 @@ /* -------------------------------------------- */ async resetNombreAstraux() { game.system.rdd.calendrier.resetNombreAstral(); - await game.system.rdd.calendrier.rebuildListeNombreAstral( 'reset' ); + await game.system.rdd.calendrier.rebuildListeNombreAstral(); game.system.rdd.calendrier.showAstrologieEditor(); } diff --git a/module/rdd-calendrier.js b/module/rdd-calendrier.js index 26365cda..b711ff7f 100644 --- a/module/rdd-calendrier.js +++ b/module/rdd-calendrier.js @@ -78,7 +78,7 @@ export class RdDCalendrier extends Application { // nombre astral if (game.user.isGM) { this.listeNombreAstral = this._loadListNombreAstral(); - await this.rebuildListeNombreAstral(undefined, false); // Ensure always up-to-date + await this.rebuildListeNombreAstral(false); // Ensure always up-to-date } console.log(this.calendrier, this.calendrierPos, this.listeNombreAstral); } @@ -183,7 +183,7 @@ export class RdDCalendrier extends Application { } /* -------------------------------------------- */ - async rebuildListeNombreAstral( raison = 'incjour', showDice = true) { + async rebuildListeNombreAstral(showDice = true) { if (game.user.isGM) { let jourCourant = this.getCurrentDayIndex(); @@ -425,7 +425,7 @@ export class RdDCalendrier extends Application { this.calendrier.heureRdD = heuresList.findIndex(heure => heure === calendrierData.heureKey);; // Index dans heuresList game.settings.set("foundryvtt-reve-de-dragon", "calendrier", duplicate(this.calendrier)); - await this.rebuildListeNombreAstral( 'reset' ); + await this.rebuildListeNombreAstral(); game.socket.emit("system.foundryvtt-reve-de-dragon", { msg: "msg_sync_time", From 100e0b62abcc0d3b6ab8871da701f38fa4791292 Mon Sep 17 00:00:00 2001 From: Vincent Vandemeulebrouck Date: Fri, 25 Jun 2021 14:40:25 +0200 Subject: [PATCH 2/2] =?UTF-8?q?Fix:=20re-tirage=20de=20d=C3=A9s=20sur=20re?= =?UTF-8?q?load?= 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 | 16 +++++++++------- module/rdd-dice.js | 8 +++++--- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/module/rdd-calendrier.js b/module/rdd-calendrier.js index b711ff7f..c1acc7da 100644 --- a/module/rdd-calendrier.js +++ b/module/rdd-calendrier.js @@ -139,13 +139,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: [], @@ -198,8 +200,8 @@ export class RdDCalendrier extends Application { } } console.log("SAVE list", newList, jourCourant); - game.settings.set("foundryvtt-reve-de-dragon", "liste-nombre-astral", this.listeNombreAstral); this.listeNombreAstral = newList; + game.settings.set("foundryvtt-reve-de-dragon", "liste-nombre-astral", this.listeNombreAstral); } } 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; }