From 4b26fd575aa9b4ba3af9ec33592a09694121d0fe Mon Sep 17 00:00:00 2001 From: sladecraven Date: Tue, 1 Jun 2021 21:58:40 +0200 Subject: [PATCH] Re-synchro d'affichage lors du tirage des nombres astro --- module/actor.js | 11 +++++++++++ module/rdd-astrologie-editeur.js | 4 ++-- module/rdd-calendrier.js | 5 +++++ system.json | 2 +- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/module/actor.js b/module/actor.js index ac1d7df3..b5536a47 100644 --- a/module/actor.js +++ b/module/actor.js @@ -53,6 +53,10 @@ export class RdDActor extends Actor { switch (sockmsg.msg) { case "msg_remote_actor_call": return RdDActor.onRemoteActorCall(sockmsg.data); + case "msg_reset_nombre_astral": + console.log("RESET ASTRAL", game.user.character); + game.user.character.resetNombreAstral(); + return; } } @@ -2892,6 +2896,13 @@ export class RdDActor extends Actor { } } + /* -------------------------------------------- */ + async resetNombreAstral(data) { + let toDelete = this.listItemsData('nombreastral'); + const deletions = toDelete.map(it => it._id); + await this.deleteEmbeddedDocuments("Item", deletions); + } + /* -------------------------------------------- */ async ajouteNombreAstral(data) { // Gestion expérience (si existante) diff --git a/module/rdd-astrologie-editeur.js b/module/rdd-astrologie-editeur.js index a79f45c1..75913483 100644 --- a/module/rdd-astrologie-editeur.js +++ b/module/rdd-astrologie-editeur.js @@ -23,9 +23,9 @@ } /* -------------------------------------------- */ - resetNombreAstraux() { + async resetNombreAstraux() { game.system.rdd.calendrier.resetNombreAstral(); - game.system.rdd.calendrier.rebuildListeNombreAstral(); + await game.system.rdd.calendrier.rebuildListeNombreAstral(); game.system.rdd.calendrier.showAstrologieEditor(); } diff --git a/module/rdd-calendrier.js b/module/rdd-calendrier.js index 1ee3a6d8..3be674a6 100644 --- a/module/rdd-calendrier.js +++ b/module/rdd-calendrier.js @@ -159,6 +159,11 @@ export class RdDCalendrier extends Application { resetNombreAstral() { this.listeNombreAstral = []; game.settings.set("foundryvtt-reve-de-dragon", "liste-nombre-astral", this.listeNombreAstral); + + game.socket.emit("system.foundryvtt-reve-de-dragon", { + msg: "msg_reset_nombre_astral", + data: {} + }); } /* -------------------------------------------- */ diff --git a/system.json b/system.json index 728f2ade..896af45a 100644 --- a/system.json +++ b/system.json @@ -2,7 +2,7 @@ "name": "foundryvtt-reve-de-dragon", "title": "Rêve de Dragon", "description": "Rêve de Dragon RPG for FoundryVTT", - "version": "1.4.17", + "version": "1.4.18", "manifestPlusVersion": "1.0.0", "minimumCoreVersion": "0.8.0", "compatibleCoreVersion": "0.8.5",