diff --git a/changelog.md b/changelog.md index ad50c309..583aa09a 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,7 @@ # 12.0 +## 12.0.16 - Le secret d'Astrobazzarh +- Fix: les jets envoyés messages uniquement au MJ ne sont plus envoyés à tous les autres joueurs (et dupliqués) + ## 12.0.15 - Le messager d'Astrobazzarh - Correction des faces de dés personalisés dice-so-nice - Les messages de maladies ne sont plus publics diff --git a/module/actor.js b/module/actor.js index 73c21990..b8e6cd10 100644 --- a/module/actor.js +++ b/module/actor.js @@ -1548,7 +1548,7 @@ export class RdDActor extends RdDBaseActorSang { /* -------------------------------------------- */ async appliquerAjoutExperience(rollData, hideChatMessage = 'show') { - if (!Misc.firstConnectedGM()){ + if (!Misc.isFirstConnectedGM()){ return } hideChatMessage = hideChatMessage == 'hide' || (Misc.isRollModeHiddenToPlayer() && !game.user.isGM) @@ -3011,7 +3011,7 @@ export class RdDActor extends RdDBaseActorSang { /* -------------------------------------------- */ async onCreateOwnedDraconique(item, options, id) { - if (Misc.isUniqueConnectedGM()) { + if (Misc.isFirstConnectedGM()) { let draconique = Draconique.all().find(it => it.match(item)); if (draconique) { await draconique.onActorCreateOwned(this, item) @@ -3023,7 +3023,7 @@ export class RdDActor extends RdDBaseActorSang { /* -------------------------------------------- */ async onDeleteOwnedDraconique(item, options, id) { - if (Misc.isUniqueConnectedGM()) { + if (Misc.isFirstConnectedGM()) { let draconique = Draconique.all().find(it => it.match(item)); if (draconique) { await draconique.onActorDeleteOwned(this, item) @@ -3033,7 +3033,7 @@ export class RdDActor extends RdDBaseActorSang { /* -------------------------------------------- */ async onDeleteOwnedCaseTmr(item, options, id) { - if (Misc.isUniqueConnectedGM()) { + if (Misc.isFirstConnectedGM()) { let draconique = Draconique.all().find(it => it.isCase(item)); if (draconique) { await draconique.onActorDeleteCaseTmr(this, item) diff --git a/module/actor/base-actor.js b/module/actor/base-actor.js index 57fbcb07..c92b8318 100644 --- a/module/actor/base-actor.js +++ b/module/actor/base-actor.js @@ -218,7 +218,7 @@ export class RdDBaseActor extends Actor { } async creerObjetParMJ(object) { - if (!Misc.isUniqueConnectedGM()) { + if (!Misc.isFirstConnectedGM()) { RdDBaseActor.remoteActorCall({ tokenId: this.token?.id, actorId: this.id, @@ -335,7 +335,7 @@ export class RdDBaseActor extends Actor { ui.notifications.info("Inutile de se vendre à soi-même"); return; } - if (!Misc.isUniqueConnectedGM()) { + if (!Misc.isFirstConnectedGM()) { RdDBaseActor.remoteActorCall({ actorId: achat.vendeurId ?? achat.acheteurId, method: 'achatVente', diff --git a/module/chat-utility.js b/module/chat-utility.js index 76792c86..5f515ce8 100644 --- a/module/chat-utility.js +++ b/module/chat-utility.js @@ -49,7 +49,7 @@ export class ChatUtility { /* -------------------------------------------- */ static onRemoveMessages(socketData) { - if (Misc.isUniqueConnectedGM()) { + if (Misc.isFirstConnectedGM()) { if (socketData.part) { const toDelete = game.messages.filter(it => it.content.includes(socketData.part)); toDelete.forEach(it => it.delete()); @@ -63,7 +63,7 @@ export class ChatUtility { /* -------------------------------------------- */ static removeMessages(socketData) { - if (Misc.isUniqueConnectedGM()) { + if (Misc.isFirstConnectedGM()) { ChatUtility.onRemoveMessages(socketData); } else { @@ -161,7 +161,7 @@ export class ChatUtility { /* -------------------------------------------- */ static handleGMChatMessage(socketData) { console.log("blindMessageToGM", socketData); - if (Misc.firstConnectedGM()) { + if (Misc.isFirstConnectedGM()) { ChatMessage.create({ user: game.user.id, whisper: ChatUtility.getGMs(), diff --git a/module/misc.js b/module/misc.js index c22fe21e..a3f5f43d 100644 --- a/module/misc.js +++ b/module/misc.js @@ -195,7 +195,7 @@ export class Misc { return document } } - else if (Misc.isUniqueConnectedGM() || (Misc.connectedGMs().length == 0 && Misc.isOwnerPlayer(document))) { + else if (Misc.isFirstConnectedGM() || (Misc.connectedGMs().length == 0 && Misc.isOwnerPlayer(document))) { return document } return undefined @@ -206,14 +206,14 @@ export class Misc { } static isOwnerPlayerOrUniqueConnectedGM(actor) { - return Misc.isOwnerPlayer(actor) ?? Misc.isUniqueConnectedGM(); + return Misc.isOwnerPlayer(actor) ?? Misc.isFirstConnectedGM(); } /** * @returns true pour un seul utilisateur: le premier GM connecté par ordre d'id */ - static isUniqueConnectedGM() { - return game.user.id == Misc.firstConnectedGMId(); + static isFirstConnectedGM() { + return game.user == Misc.firstConnectedGM(); } static firstConnectedGMId() { diff --git a/module/rdd-combat.js b/module/rdd-combat.js index 68947438..f31f3554 100644 --- a/module/rdd-combat.js +++ b/module/rdd-combat.js @@ -53,7 +53,7 @@ export class RdDCombatManager extends Combat { /* -------------------------------------------- */ async onPreDeleteCombat() { - if (Misc.isUniqueConnectedGM()) { + if (Misc.isFirstConnectedGM()) { await this.finDeRound({ terminer: true }) ChatUtility.removeChatMessageContaining(`