Compare commits

..

3 Commits

Author SHA1 Message Date
Vlyan
257a736c83 Release v1.12.2 2024-09-16 09:50:12 +02:00
Vlyan
33f2b372a4 Fix Character sheet errors when using a non-supported language (#56) 2024-09-16 09:22:29 +02:00
Vlyan
7a2587083b reverse token is now a drop-down, and some clean up 2024-08-07 09:30:09 +02:00
12 changed files with 83 additions and 22 deletions

View File

@@ -6,6 +6,10 @@ Date format : day/month/year
> - `foundry-version`: Stick to the major version of FoundryVTT.
> - `system-version`: System functionalities and Fixes.
## 1.12.2 - 16/09/2024 - Bugfixes
- Modified : The checkbox `reverseFatigueBar` is now a drop-down with `none`/`fatigue`/`strife`/`both`, and is now an client preference.
- Fixed : Character sheet errors when using a non-supported language (Thx to KitCat #56).
## 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`:

View File

@@ -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"

View File

@@ -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": {

View File

@@ -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"

View File

@@ -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": {

View File

@@ -86,7 +86,7 @@ export class CharacterSheetL5r5e extends BaseCharacterSheetL5r5e {
html,
"system.identity.family",
CONFIG.l5r5e.families.get(
Object.entries(game.i18n.translations.l5r5e.clans).find(
Object.entries(game.l5r5e.HelpersL5r5e.getLocalizedRawObject("l5r5e.clans")).find(
([k, v]) => v === this.actor.system.identity.clan
)?.[0]
)

View File

@@ -232,7 +232,7 @@ export class TwentyQuestionsDialog extends FormApplication {
html,
"step2.family",
CONFIG.l5r5e.families.get(
Object.entries(game.i18n.translations.l5r5e.clans).find(
Object.entries(game.l5r5e.HelpersL5r5e.getLocalizedRawObject("l5r5e.clans")).find(
([k, v]) => v === this.object.data.step1.clan
)?.[0]
)

View File

@@ -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 */

View File

@@ -84,7 +84,7 @@ export class HelpersL5r5e {
* @return {string[]}
*/
static getLocalizedClansList() {
return Object.entries(game.i18n.translations.l5r5e.clans)
return Object.entries(game.l5r5e.HelpersL5r5e.getLocalizedRawObject("l5r5e.clans"))
.filter(([k, v]) => !["title", "label"].includes(k))
.map(([k, v]) => v);
}
@@ -101,6 +101,20 @@ export class HelpersL5r5e {
return Array.from(comp.index).map((v) => v.name);
}
/**
* Get the raw object from localization, with fallback if the selected language is unknown
* @param {string} key
* @returns {*}
*/
static getLocalizedRawObject(key) {
let object = foundry.utils.getProperty(game.i18n.translations, key);
if (!!object) {
return object;
}
object = foundry.utils.getProperty(game.i18n._fallback, key);
return object ?? key;
}
/**
* Return the list of Roles
* @return {string[]}

View File

@@ -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;

View File

@@ -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 */

View File

@@ -7,14 +7,13 @@
"changelog": "https://gitlab.com/teaml5r/l5r5e/-/blob/master/CHANGELOG.md",
"license": "https://gitlab.com/teaml5r/l5r5e/-/blob/master/LICENSE.md",
"manifest": "https://gitlab.com/teaml5r/l5r5e/-/raw/master/system/system.json",
"download": "https://gitlab.com/teaml5r/l5r5e/-/jobs/artifacts/v1.12.1/raw/l5r5e.zip?job=build",
"version": "1.12.1",
"download": "https://gitlab.com/teaml5r/l5r5e/-/jobs/artifacts/v1.12.2/raw/l5r5e.zip?job=build",
"version": "1.12.2",
"compatibility": {
"minimum": "12",
"verified": "12",
"maximum": "12"
},
"manifestPlusVersion": "1.2.0",
"socket": true,
"authors": [
{