From c138b52c3074b178e189b03de66cd9dfa93bf1c7 Mon Sep 17 00:00:00 2001 From: Vlyan Date: Sun, 24 Aug 2025 10:40:55 +0200 Subject: [PATCH] add chat migration --- README.md | 2 +- system/scripts/gm/gm-toolbox.js | 5 ++++- system/scripts/migration.js | 16 +++++++++++++++- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 131dfd5..9255ec9 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ![Banner Legend of the Five Rings](./l5rBan.jpg) [![Buy Me a Coffee](./tags-bymecoffee.svg)](https://ko-fi.com/vlyan) -[![FoundryVTT version](https://img.shields.io/badge/FVTT-v12-informational)](https://foundryvtt.com/) +[![FoundryVTT version](https://img.shields.io/badge/FVTT-v13-informational)](https://foundryvtt.com/) [![Forge Installs](https://img.shields.io/badge/dynamic/json?label=Forge%20Installs&query=package.installs&suffix=%25&url=https%3A%2F%2Fforge-vtt.com%2Fapi%2Fbazaar%2Fpackage%2Fl5r5e&colorB=4aa94a)](https://forge-vtt.com/bazaar#package=l5r5e) [![Foundry Hub Endorsements](https://img.shields.io/endpoint?logoColor=white&url=https%3A%2F%2Fwww.foundryvtt-hub.com%2Fwp-json%2Fhubapi%2Fv1%2Fpackage%2Fl5r5e%2Fshield%2Fendorsements)](https://www.foundryvtt-hub.com/package/l5r5e/) [![Foundry Hub Comments](https://img.shields.io/endpoint?logoColor=white&url=https%3A%2F%2Fwww.foundryvtt-hub.com%2Fwp-json%2Fhubapi%2Fv1%2Fpackage%2Fl5r5e%2Fshield%2Fcomments)](https://www.foundryvtt-hub.com/package/l5r5e/) diff --git a/system/scripts/gm/gm-toolbox.js b/system/scripts/gm/gm-toolbox.js index a5b19d2..d08d904 100644 --- a/system/scripts/gm/gm-toolbox.js +++ b/system/scripts/gm/gm-toolbox.js @@ -17,12 +17,15 @@ export class GmToolbox extends HandlebarsApplicationMixin(ApplicationV2) { actions: { open_gm_monitor: GmToolbox.#openGmMonitor, toggle_hide_difficulty: GmToolbox.#onToggleHideDifficulty, + // Buttons map (0: left, 1: middle, 2: right, 3: extra 1, 4: extra 2) + // Foundry v13 use middle (1) for popup and currently not bind it for custom + // See : https://github.com/foundryvtt/foundryvtt/issues/12531 change_difficulty: { buttons: [0, 1, 2], handler: GmToolbox.#onChangeDifficulty }, reset_void: { - buttons: [0, 1, 2, 3, 4], // all the buttons (left, middle, right, extra 1, extra 2) + buttons: [0, 1, 2, 3, 4], handler: GmToolbox.#onResetVoid }, sleep: { diff --git a/system/scripts/migration.js b/system/scripts/migration.js index 9397507..2bee991 100644 --- a/system/scripts/migration.js +++ b/system/scripts/migration.js @@ -6,7 +6,7 @@ export class MigrationL5r5e { * Minimum Version needed for migration stuff to trigger * @type {string} */ - static NEEDED_VERSION = "1.12.3"; + static NEEDED_VERSION = "1.13.0"; /** * Return true if the version need some updates @@ -358,7 +358,21 @@ export class MigrationL5r5e { updateData["content"] = ""; } } + // ***** End of 1.3.0 ***** + // ***** Start of 1.13.0 ***** + if (options?.force || MigrationL5r5e.needUpdate("1.13.0")) { + // Fix Roll messages + if (message.isRoll && message.content !== "") { + updateData["content"] = message.content + .replace('
', '
') + .replace(/
(?!<\/div>)/, '
') + .replace(/(?!<\/div>)