From 42a5af6bda5c28d5e2e41e3ead61c8cfd83ab719 Mon Sep 17 00:00:00 2001 From: Fallayn Date: Sat, 3 Jul 2021 00:46:22 +0200 Subject: [PATCH] Version 1.1 --- README.md | 9 +++++---- dnd5e-de.js | 25 +++++++++++++------------ module.json | 4 ++-- src/config.js | 5 ++--- src/converters.js | 3 +++ 5 files changed, 25 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 614dcd5..ba5ed99 100644 --- a/README.md +++ b/README.md @@ -44,10 +44,11 @@ The module also depends on [Babele](https://foundryvtt.com/packages/babele) for Also see the [releases page](https://github.com/League-of-Foundry-Developers/foundryvtt-dnd5e-lang-de/releases). -### Version 1.0.1 -- update the Module to Foundry Version 0.8.6 and DND 5E system version 1.3.3 -- include sorted alphabetically for D&D 5e OGL Character Sheet. [Project page](https://foundryvtt.com/packages/5e-ogl-character-sheet) -- new option to active the alphabetically sorted for 5e OGL Character Sheet +### Version 1.1.0 + +- Update to Foundry Version 0.8.8 and D&D 5E system version 1.3.6 +- Support skill sorting for the [D&D 5e OGL Character Sheet](https://foundryvtt.com/packages/5e-ogl-character-sheet). (thanks @stilldev) +- Small translation improvements/fixes ### Version 1.0.0 diff --git a/dnd5e-de.js b/dnd5e-de.js index 97fc926..541d33c 100644 --- a/dnd5e-de.js +++ b/dnd5e-de.js @@ -33,12 +33,19 @@ Hooks.once('init', () => { }); Converters(module_id); } - + // Sort skills alphabetically // Thanks to Elvis Pereira for the polish translation // Fixed in upstream 1.3.0 (https://gitlab.com/foundrynet/dnd5e/-/issues/1070) - if (!isNewerVersion(game.system.data.version, '1.3.3')) { - async function sortSkillsAlpha() { + if (game.i18n.lang === module_lang && + game.system.id === module_sys && + (!isNewerVersion(game.system.data.version, '1.2.4') || + game.modules.get('5e-ogl-character-sheet')?.active)) { + // Activate sorting if correct system and language AND + // either using a system version <= 1.2.4, where sorting wasn't + // done correctly in translations OR if using the OGL sheet + + async function sortSkillsAlpha() { const lists = document.getElementsByClassName('skills-list'); for (let list of lists) { const competences = list.childNodes; @@ -58,17 +65,11 @@ Hooks.once('init', () => { } Hooks.on('renderActorSheet', async function () { - // Sort the skills from 5e OGL Character Sheet - if (game.modules.get('5e-ogl-character-sheet')?.active && - game.i18n.lang === module_lang && - game.system.id === module_sys && - game.settings.get(module_id, 'oglOverrideSkillSortAlpha')) { - sortSkillsAlpha(); - } - if (game.i18n.lang === module_lang && game.system.id === module_sys && - game.settings.get(module_id, 'overrideSkillSortAlpha')) { + (game.settings.get(module_id, 'overrideSkillSortAlpha') || + game.modules.get('5e-ogl-character-sheet')?.active && + game.settings.get(module_id, 'oglOverrideSkillSortAlpha'))) { sortSkillsAlpha(); } }); diff --git a/module.json b/module.json index de34d74..2ba9442 100644 --- a/module.json +++ b/module.json @@ -2,9 +2,9 @@ "name": "FoundryVTT-dnd5e-DE", "title": "DnD5e German Translation (Deutsch)", "description": "German language support for the D&D5e system", - "version": "1.0.1", + "version": "1.1.0", "minimumCoreVersion": "0.7.5", - "compatibleCoreVersion": "0.8.6", + "compatibleCoreVersion": "0.8.8", "author": "Fallayn#6414, Hydroxi#0366, Smicman#1404, ThoGri#6692, Morvar#0915, crash#7509", "esmodules": [ "dnd5e-de.js" diff --git a/src/config.js b/src/config.js index 47975c6..7c9358e 100644 --- a/src/config.js +++ b/src/config.js @@ -1,7 +1,7 @@ export default [ { name: 'overrideSkillSortAlpha', - onlyUntilSystemVersionIncluding: '1.3.3', + onlyUntilSystemVersionIncluding: '1.2.4', data: { name: 'Fertigkeiten alphabetisch sortieren', hint: 'Sortiert die Fertigkeitenliste alphabetisch.', @@ -13,9 +13,8 @@ export default [ }, { name: 'oglOverrideSkillSortAlpha', - onlyUntilSystemVersionIncluding: '1.3.3', data: { - name: 'Fertigkeiten alphabetisch sortieren im 5e OGL Character Sheet', + name: 'Fertigkeiten alphabetisch sortieren (5e OGL Character Sheet)', hint: 'Sortiert die Fertigkeitenliste alphabetisch.', scope: 'client', type: Boolean, diff --git a/src/converters.js b/src/converters.js index c5ed74d..32614c1 100644 --- a/src/converters.js +++ b/src/converters.js @@ -140,6 +140,9 @@ var types = { } function convertType(t) { + if (!t) { + return t; + } return types[t.toString().toLowerCase()] ? types[t.toString().toLowerCase()] : t; }