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(`
`) game.messages.filter(m => ChatUtility.getMessageData(m, 'attacker-roll') != undefined && ChatUtility.getMessageData(m, 'defender-roll') != undefined) @@ -291,7 +291,7 @@ export class RdDCombatManager extends Combat { /* -------------------------------------------- */ static processPremierRoundInit() { // Check if we have the whole init ! - if (Misc.isUniqueConnectedGM() && game.combat.current.round == 1) { + if (Misc.isFirstConnectedGM() && game.combat.current.round == 1) { let initMissing = game.combat.combatants.find(it => !it.initiative); if (!initMissing) { // Premier round ! for (let combatant of game.combat.combatants) { @@ -454,7 +454,7 @@ export class RdDCombat { /* -------------------------------------------- */ static combatNouveauTour(combat) { - if (Misc.isUniqueConnectedGM()) { + if (Misc.isFirstConnectedGM()) { let turn = combat.turns.find(t => t.token?.id == combat.current.tokenId); if (turn?.actor) { RdDCombat.displayActorCombatStatus(combat, turn.actor, turn.token.id); @@ -511,7 +511,7 @@ export class RdDCombat { /* -------------------------------------------- */ static onMsgDefense(msg) { let defenderToken = canvas.tokens.get(msg.defenderTokenId); - if (defenderToken && Misc.isUniqueConnectedGM()) { + if (defenderToken && Misc.isFirstConnectedGM()) { const rddCombat = RdDCombat.rddCombatForAttackerAndDefender(msg.attackerId, msg.defenderTokenId); rddCombat?.removeChatMessageActionsPasseArme(msg.defenderRoll.passeArme); rddCombat?._chatMessageDefense(msg.paramChatDefense, msg.defenderRoll); @@ -919,7 +919,7 @@ export class RdDCombat { dmg: attackerRoll.dmg, }; - if (Misc.isUniqueConnectedGM()) { + if (Misc.isFirstConnectedGM()) { await this._chatMessageDefense(paramChatDefense, defenderRoll); } else { diff --git a/module/rdd-main.js b/module/rdd-main.js index 18778107..e4c58875 100644 --- a/module/rdd-main.js +++ b/module/rdd-main.js @@ -278,7 +278,7 @@ export class SystemReveDeDragon { /* Foundry VTT Initialization */ /* -------------------------------------------- */ game.system.rdd.calendrier = new RdDCalendrier() - if (Misc.isUniqueConnectedGM()) { + if (Misc.isFirstConnectedGM()) { new Migrations().migrate() this.messageDeBienvenue() import("https://www.uberwald.me/fvtt_appcount/count-class-ready.js").then(moduleCounter => { diff --git a/module/sommeil/app-astrologie.js b/module/sommeil/app-astrologie.js index 0e33a748..e8727294 100644 --- a/module/sommeil/app-astrologie.js +++ b/module/sommeil/app-astrologie.js @@ -186,7 +186,7 @@ export class AppAstrologie extends Application { date: this.html.find('[name="joursAstrologie"]').val(), userId: game.user.id } - if (Misc.isUniqueConnectedGM()) { + if (Misc.isFirstConnectedGM()) { game.system.rdd.calendrier.requestNombreAstral(socketData); } else { game.socket.emit(SYSTEM_SOCKET_ID, { diff --git a/module/time/rdd-calendrier.js b/module/time/rdd-calendrier.js index b2a4129d..727599c2 100644 --- a/module/time/rdd-calendrier.js +++ b/module/time/rdd-calendrier.js @@ -48,7 +48,7 @@ export class RdDCalendrier extends Application { constructor() { super(); this.timestamp = RdDTimestamp.getWorldTime(); - if (Misc.isUniqueConnectedGM()) { // Uniquement si GM + if (Misc.isFirstConnectedGM()) { // Uniquement si GM RdDTimestamp.setWorldTime(this.timestamp); this.rebuildNombresAstraux(); // Ensure always up-to-date } @@ -258,7 +258,7 @@ export class RdDCalendrier extends Application { /* -------------------------------------------- */ async rebuildNombresAstraux() { - if (Misc.isUniqueConnectedGM()) { + if (Misc.isFirstConnectedGM()) { const nombresAstraux = this.getNombresAstraux() let newNombresAstraux = []; for (let i = 0; i < MAX_NOMBRE_ASTRAL; i++) { @@ -337,7 +337,7 @@ export class RdDCalendrier extends Application { /* -------------------------------------------- */ async requestNombreAstral(request) { const actor = game.actors.get(request.id); - if (Misc.isUniqueConnectedGM()) { // Only once + if (Misc.isFirstConnectedGM()) { // Only once console.log(request); let jourDiff = this.getLectureAstrologieDifficulte(request.date); let niveau = Number(request.astrologie.system.niveau) + Number(request.conditions) + Number(jourDiff) + Number(request.etat); diff --git a/system.json b/system.json index a92ba9db..580788f4 100644 --- a/system.json +++ b/system.json @@ -1,8 +1,8 @@ { "id": "foundryvtt-reve-de-dragon", "title": "Rêve de Dragon", - "version": "12.0.15", - "download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-12.0.15.zip", + "version": "12.0.16", + "download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/archive/foundryvtt-reve-de-dragon-12.0.16.zip", "manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/v11/system.json", "changelog": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/branch/v11/changelog.md", "compatibility": {