From 7a2587083b629b4adb794160e56321a209c38373 Mon Sep 17 00:00:00 2001 From: Vlyan Date: Wed, 7 Aug 2024 09:30:09 +0200 Subject: [PATCH] reverse token is now a drop-down, and some clean up --- CHANGELOG.md | 3 +++ system/lang/en-en.json | 9 +++++++- system/lang/es-es.json | 13 +++++++++++- system/lang/fr-fr.json | 9 +++++++- system/lang/it-it.json | 13 +++++++++++- system/scripts/dice/dietype/l5r-base-die.js | 6 +++--- system/scripts/main-l5r5e.js | 3 ++- system/scripts/settings.js | 23 ++++++++++++++------- system/system.json | 1 - 9 files changed, 63 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index af2da85..918e8a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ Date format : day/month/year > - `foundry-version`: Stick to the major version of FoundryVTT. > - `system-version`: System functionalities and Fixes. +## 1.12.2 - ??/08/2024 - ??? +- Modified : The checkbox "reverseFatigueBar" is now a drop-down with `none`/`fatigue`/`strife`/`both`, and is now an client preference. + ## 1.12.1 - 19/06/2024 - Compendium update (mostly french) - Updated the names and pages number from the official French translation of `Celestial Realms` and `Fields of Victory`. - Added some missing from `Celestial Realms` and `Celestial Realms - Deathly Turns`: diff --git a/system/lang/en-en.json b/system/lang/en-en.json index 55cfe70..1bead11 100644 --- a/system/lang/en-en.json +++ b/system/lang/en-en.json @@ -5,7 +5,14 @@ }, "SETTINGS": { "None": "No option", - "ReverseFatigueBar": "Reverse token fatigue bar", + "ReverseTokenBars": { + "Title": "Reverse tokens bar", + "Hint": "Change the order in which the bars under the tokens are filled in", + "None": "None", + "Fatigue": "Fatigue only", + "Strife": "Strife", + "Both": "Both Fatigue and Strife" + }, "RollNKeep": { "DeleteOldMessage": "RnK Delete previous chat message", "DeleteOldMessageHint": "Choose to keep or delete the previous message for a RnK series" diff --git a/system/lang/es-es.json b/system/lang/es-es.json index 11aaccd..4f7bb7f 100644 --- a/system/lang/es-es.json +++ b/system/lang/es-es.json @@ -5,7 +5,14 @@ }, "SETTINGS": { "None": "Sin opción", - "ReverseFatigueBar": "Invertir la barra de fatiga de los token", + "ReverseTokenBars": { + "Title": "Reverse tokens bar", + "Hint": "Change the order in which the bars under the tokens are filled in", + "None": "None", + "Fatigue": "Fatigue only", + "Strife": "Strife", + "Both": "Both Fatigue and Strife" + }, "RollNKeep": { "DeleteOldMessage": "TyG Eliminar el mensaje anterior del chat", "DeleteOldMessageHint": "Elige si mantener o borrar el mensaje anterior de la serie TyG" @@ -22,6 +29,10 @@ "Title": "Custom Compendium Name", "Hint": "For advanced users that want to change the name of the custom compendiums (Used to disables the embedded ones).", "Notification": "Unable set Custom Compendium: '{name}'. Is it activated and registered with Babele?" + }, + "CustomItemsHeight": { + "Title": "Default items windows height", + "Hint": "Set the default height for 'Items' windows types (techniques, weapons...), in pixels" } }, "TYPES": { diff --git a/system/lang/fr-fr.json b/system/lang/fr-fr.json index ba5bb5b..69bcfd6 100644 --- a/system/lang/fr-fr.json +++ b/system/lang/fr-fr.json @@ -5,7 +5,14 @@ }, "SETTINGS": { "None": "Aucune option", - "ReverseFatigueBar": "Inverser la barre de fatigue des token", + "ReverseTokenBars": { + "Title": "Inverser la barre des tokens", + "Hint": "Change l'ordre de remplissage des barres sous les tokens", + "None": "Aucun", + "Fatigue": "Fatigue uniquement", + "Strife": "Conflit uniquement", + "Both": "Les deux (Fatigue et Conflit)" + }, "RollNKeep": { "DeleteOldMessage": "RnK Supprime le précédent message du chat", "DeleteOldMessageHint": "Si coché, on supprime le message précédent pour la série de jets via le RnK" diff --git a/system/lang/it-it.json b/system/lang/it-it.json index 955f1e1..ff6ff45 100644 --- a/system/lang/it-it.json +++ b/system/lang/it-it.json @@ -5,7 +5,14 @@ }, "SETTINGS": { "None": "Niente", - "ReverseFatigueBar": "Inverti barra della Stanchezza", + "ReverseTokenBars": { + "Title": "Reverse tokens bar", + "Hint": "Change the order in which the bars under the tokens are filled in", + "None": "None", + "Fatigue": "Fatigue only", + "Strife": "Strife", + "Both": "Both Fatigue and Strife" + }, "RollNKeep": { "DeleteOldMessage": "Il Tira e Tieni cancella il messaggio in chat precedente", "DeleteOldMessageHint": "Scegli se mantenere o eliminare il messaggio precedente in una serie di Tira e Tieni" @@ -22,6 +29,10 @@ "Title": "Custom Compendium Name", "Hint": "For advanced users that want to change the name of the custom compendiums (Used to disables the embedded ones).", "Notification": "Unable set Custom Compendium: '{name}'. Is it activated and registered with Babele?" + }, + "CustomItemsHeight": { + "Title": "Default items windows height", + "Hint": "Set the default height for 'Items' windows types (techniques, weapons...), in pixels" } }, "TYPES": { diff --git a/system/scripts/dice/dietype/l5r-base-die.js b/system/scripts/dice/dietype/l5r-base-die.js index a4ced2e..42cd231 100644 --- a/system/scripts/dice/dietype/l5r-base-die.js +++ b/system/scripts/dice/dietype/l5r-base-die.js @@ -1,11 +1,11 @@ /** * L5R5e Base Die */ -export class L5rBaseDie extends DiceTerm { - /** Need to be override */ +export class L5rBaseDie extends foundry.dice.terms.DiceTerm { + /** Need to be overridden */ static DENOMINATION = ""; - /** Need to be override */ + /** Need to be overridden */ static FACES = {}; /** @override */ diff --git a/system/scripts/main-l5r5e.js b/system/scripts/main-l5r5e.js index a1a5e53..396eeae 100644 --- a/system/scripts/main-l5r5e.js +++ b/system/scripts/main-l5r5e.js @@ -208,7 +208,8 @@ Hooks.once("init", async () => { // Override the default Token _drawBar function to allow fatigue bar reversing. Token.prototype._drawBar = function (number, bar, data) { - const reverseBar = data.attribute === "fatigue" && game.settings.get(L5R5E.namespace, "token-reverseFatigueBar"); + const barSettings = game.settings.get(L5R5E.namespace, "token-reverse-token-bars"); + const reverseBar = barSettings === 'both' || barSettings === data.attribute; // Bar value const pct = Math.clamp(Number(data.value), 0, data.max) / data.max; diff --git a/system/scripts/settings.js b/system/scripts/settings.js index 9f538ef..4dfc9a8 100644 --- a/system/scripts/settings.js +++ b/system/scripts/settings.js @@ -23,13 +23,6 @@ export const RegisterSettings = function () { type: Boolean, default: true, }); - game.settings.register(CONFIG.l5r5e.namespace, "token-reverseFatigueBar", { - name: "SETTINGS.ReverseFatigueBar", - scope: "world", - config: true, - type: Boolean, - default: false, - }); game.settings.register(CONFIG.l5r5e.namespace, "techniques-customs", { name: "SETTINGS.CustomTechniques.Title", hint: "SETTINGS.CustomTechniques.Hint", @@ -47,7 +40,7 @@ export const RegisterSettings = function () { type: String, default: "l5r5e-custom-compendiums", onChange: (name) => { - if (!Babele.get().modules.find((module) => module.module === name)) { + if (game.babele && !game.babele.modules.find((module) => module.module === name)) { ui.notifications.warn(game.i18n.format("SETTINGS.CustomCompendiumName.Notification", { name }), { permanent: true }); } } @@ -70,6 +63,20 @@ export const RegisterSettings = function () { }, default: 800, }); + game.settings.register(CONFIG.l5r5e.namespace, "token-reverse-token-bars", { + name: "SETTINGS.ReverseTokenBars.Title", + hint: "SETTINGS.ReverseTokenBars.Hint", + scope: "client", + config: true, + default: "none", + choices: { + "none": "SETTINGS.ReverseTokenBars.None", + "fatigue": "SETTINGS.ReverseTokenBars.Fatigue", + "strife": "SETTINGS.ReverseTokenBars.Strife", + "both": "SETTINGS.ReverseTokenBars.Both" + }, + type: String, + }); /* ------------------------------------ */ /* Update */ diff --git a/system/system.json b/system/system.json index 1ff10d7..84b1660 100644 --- a/system/system.json +++ b/system/system.json @@ -14,7 +14,6 @@ "verified": "12", "maximum": "12" }, - "manifestPlusVersion": "1.2.0", "socket": true, "authors": [ {