Merge branch 'v1.4-fix-refresh-calendar' into 'v1.4'
Fix: re-tirage de dés sur reload See merge request LeRatierBretonnien/foundryvtt-reve-de-dragon!282
This commit is contained in:
commit
ac9a35cd63
@ -25,7 +25,7 @@
|
|||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async resetNombreAstraux() {
|
async resetNombreAstraux() {
|
||||||
game.system.rdd.calendrier.resetNombreAstral();
|
game.system.rdd.calendrier.resetNombreAstral();
|
||||||
await game.system.rdd.calendrier.rebuildListeNombreAstral( 'reset' );
|
await game.system.rdd.calendrier.rebuildListeNombreAstral();
|
||||||
|
|
||||||
game.system.rdd.calendrier.showAstrologieEditor();
|
game.system.rdd.calendrier.showAstrologieEditor();
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ export class RdDCalendrier extends Application {
|
|||||||
// nombre astral
|
// nombre astral
|
||||||
if (game.user.isGM) {
|
if (game.user.isGM) {
|
||||||
this.listeNombreAstral = this._loadListNombreAstral();
|
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);
|
console.log(this.calendrier, this.calendrierPos, this.listeNombreAstral);
|
||||||
}
|
}
|
||||||
@ -139,13 +139,15 @@ export class RdDCalendrier extends Application {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async ajouterNombreAstral(index, showdice = true) {
|
async ajouterNombreAstral(index, showDice = true) {
|
||||||
const nombreAstral = await RdDDice.rollTotal("1dh", { showDice: showdice, rollMode: "selfroll" });
|
const nombreAstral = await RdDDice.rollTotal("1dh", { showDice: showDice, hideDice: !showDice, rollMode: "selfroll" });
|
||||||
const dateFuture = this.getDateFromIndex(index);
|
const dateFuture = this.getDateFromIndex(index);
|
||||||
ChatMessage.create({
|
if (showDice) {
|
||||||
whisper: ChatMessage.getWhisperRecipients("GM"),
|
ChatMessage.create({
|
||||||
content: `Le chiffre astrologique du ${dateFuture} sera le ${nombreAstral}`
|
whisper: ChatMessage.getWhisperRecipients("GM"),
|
||||||
});
|
content: `Le chiffre astrologique du ${dateFuture} sera le ${nombreAstral}`
|
||||||
|
});
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
nombreAstral: nombreAstral,
|
nombreAstral: nombreAstral,
|
||||||
valeursFausses: [],
|
valeursFausses: [],
|
||||||
@ -183,7 +185,7 @@ export class RdDCalendrier extends Application {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async rebuildListeNombreAstral( raison = 'incjour', showDice = true) {
|
async rebuildListeNombreAstral(showDice = true) {
|
||||||
if (game.user.isGM) {
|
if (game.user.isGM) {
|
||||||
let jourCourant = this.getCurrentDayIndex();
|
let jourCourant = this.getCurrentDayIndex();
|
||||||
|
|
||||||
@ -198,8 +200,8 @@ export class RdDCalendrier extends Application {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log("SAVE list", newList, jourCourant);
|
console.log("SAVE list", newList, jourCourant);
|
||||||
game.settings.set("foundryvtt-reve-de-dragon", "liste-nombre-astral", this.listeNombreAstral);
|
|
||||||
this.listeNombreAstral = newList;
|
this.listeNombreAstral = newList;
|
||||||
|
game.settings.set("foundryvtt-reve-de-dragon", "liste-nombre-astral", this.listeNombreAstral);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -425,7 +427,7 @@ export class RdDCalendrier extends Application {
|
|||||||
this.calendrier.heureRdD = heuresList.findIndex(heure => heure === calendrierData.heureKey);; // Index dans heuresList
|
this.calendrier.heureRdD = heuresList.findIndex(heure => heure === calendrierData.heureKey);; // Index dans heuresList
|
||||||
game.settings.set("foundryvtt-reve-de-dragon", "calendrier", duplicate(this.calendrier));
|
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", {
|
game.socket.emit("system.foundryvtt-reve-de-dragon", {
|
||||||
msg: "msg_sync_time",
|
msg: "msg_sync_time",
|
||||||
|
@ -134,12 +134,14 @@ export class RdDDice {
|
|||||||
static async roll(formula, options = { showDice: false, rollMode: undefined }) {
|
static async roll(formula, options = { showDice: false, rollMode: undefined }) {
|
||||||
const roll = new Roll(formula);
|
const roll = new Roll(formula);
|
||||||
await roll.evaluate({ async: true });
|
await roll.evaluate({ async: true });
|
||||||
roll.showDice = options.showDice;
|
if (!options.hideDice) {
|
||||||
await RdDDice.show(roll, options.rollMode ?? game.settings.get("core", "rollMode"));
|
roll.showDice = options.showDice;
|
||||||
|
await RdDDice.show(roll, options.rollMode ?? game.settings.get("core", "rollMode"));
|
||||||
|
}
|
||||||
return roll;
|
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);
|
const roll = await RdDDice.roll(formula, options);
|
||||||
return roll.total;
|
return roll.total;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user