diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f09a41..5cef06f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ # Changelog Date format : day/month/year +## 1.9.0 - ??/??/2022 - Foundry v10 Compatibility +- Updated the System to FoundryVTT v10. +- Added a `game.user.isFirstGM` property for some traitements (socket and migration) to prevent multiple executions with multiple GM connected. + ## 1.8.2 - 24/06/2022 - Unofficial Italian translation - Added Unofficial Italian translation (Corebook only for compendiums), all thanks to EldritchTranslator. - Added French translation for Tables. diff --git a/system/scripts/dice/roll-n-keep-dialog.js b/system/scripts/dice/roll-n-keep-dialog.js index 907666f..dcce4a3 100644 --- a/system/scripts/dice/roll-n-keep-dialog.js +++ b/system/scripts/dice/roll-n-keep-dialog.js @@ -676,7 +676,7 @@ export class RollnKeepDialog extends FormApplication { // Delete old chat message related to this series if (game.settings.get("l5r5e", "rnk-deleteOldMessage")) { - if (game.user.isGM) { + if (game.user.isFirstGM) { const message = game.messages.get(msgOldId); if (message) { message.delete(); diff --git a/system/scripts/hooks.js b/system/scripts/hooks.js index 75bd5cc..970ef92 100644 --- a/system/scripts/hooks.js +++ b/system/scripts/hooks.js @@ -16,6 +16,13 @@ export default class HooksL5r5e { * Do anything once the system is ready */ static async ready() { + // If multiple GM connected, tag the 1st alive, useful for some traitements + Object.defineProperty(game.user, "isFirstGM", { + get: function () { + return game.user.isGM && game.user.id === game.users.find((u) => u.active && u.isGM)?.id; + }, + }); + // Migration stuff if (game.l5r5e.migrations.needUpdate(game.l5r5e.migrations.NEEDED_VERSION)) { game.l5r5e.migrations.migrateWorld({ force: false }); diff --git a/system/scripts/migration.js b/system/scripts/migration.js index 8c70890..bcb6ef1 100644 --- a/system/scripts/migration.js +++ b/system/scripts/migration.js @@ -24,7 +24,7 @@ export class MigrationL5r5e { * @return {Promise} A Promise which resolves once the migration is completed */ static async migrateWorld(options = { force: false }) { - if (!game.user.isGM) { + if (!game.user.isFirstGM) { return; } diff --git a/system/scripts/socket-handler.js b/system/scripts/socket-handler.js index e5512ea..e063d44 100644 --- a/system/scripts/socket-handler.js +++ b/system/scripts/socket-handler.js @@ -44,9 +44,9 @@ export class SocketHandlerL5r5e { }); } _onDeleteChatMessage(data) { - // Only delete the message if the user is a GM (otherwise it have no real effect) + // Only delete the message if the user is a GM (otherwise it has no real effect) // Currently only used in RnK - if (!game.user.isGM || !game.settings.get("l5r5e", "rnk-deleteOldMessage")) { + if (!game.user.isFirstGM || !game.settings.get("l5r5e", "rnk-deleteOldMessage")) { return; } const message = game.messages.get(data.messageId); diff --git a/system/system.json b/system/system.json index 3a17190..e54c09c 100644 --- a/system/system.json +++ b/system/system.json @@ -6,8 +6,8 @@ "readme": "https://gitlab.com/teaml5r/l5r5e/-/blob/master/README.md", "changelog": "https://gitlab.com/teaml5r/l5r5e/-/blob/master/CHANGELOG.md", "manifest": "https://gitlab.com/teaml5r/l5r5e/-/raw/master/system/system.json", - "download": "https://gitlab.com/teaml5r/l5r5e/-/jobs/artifacts/v1.8.2/raw/l5r5e.zip?job=build", - "version": "1.8.2", + "download": "https://gitlab.com/teaml5r/l5r5e/-/jobs/artifacts/v1.9.0/raw/l5r5e.zip?job=build", + "version": "1.9.0", "minimumCoreVersion": "9", "compatibleCoreVersion": "9", "manifestPlusVersion": "1.2.0",