From 80802249c0481252f7514fa2d796a635b5ca4c88 Mon Sep 17 00:00:00 2001 From: Matheus Clemente Date: Mon, 2 Jan 2023 21:46:49 -0300 Subject: [PATCH] Update SystemProvider.js Fix https://github.com/mclemente/party-overview/issues/60 --- module/SystemProvider.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/module/SystemProvider.js b/module/SystemProvider.js index 5e5c5fd..0d41b70 100644 --- a/module/SystemProvider.js +++ b/module/SystemProvider.js @@ -815,6 +815,16 @@ export class pf2eProvider extends SystemProvider { return currency.cp / 100 + currency.sp / 10 + currency.gp + currency.pp * 10; } + getLanguages(data) { + let langs = data.traits.languages.value.map((code) => game.i18n.localize(CONFIG.PF2E.languages[code])); + if (data.traits.languages.custom) { + for (let lang of data.traits.languages.custom.split(/[,;]/g)) { + langs.push(lang.trim()); + } + } + return langs; + } + getLore(data) { const lore = data.items.filter((a) => a.type == "lore").map((a) => a.name); return lore; @@ -883,7 +893,7 @@ export class pf2eProvider extends SystemProvider { reflex: data.saves?.reflex?.value || 0, will: data.saves?.will?.value || 0, }, - languages: data.traits?.languages ? data.traits.languages.value.map((code) => game.i18n.localize(CONFIG.PF2E.languages[code])) : [], + languages: data.traits?.languages ? this.getLanguages(data) : [], currency: currency, itemsValue: itemsValue, sumItemsGP: sumItemsGP, @@ -1519,7 +1529,6 @@ export class shinobigamiProvider extends SystemProvider { health[i] = dirty[i] ? dirty[i] : health[i]; } - return { id: actor.id, name: actor.name, @@ -1539,4 +1548,4 @@ export class shinobigamiProvider extends SystemProvider { get template() { return "/modules/party-overview/templates/shinobigami.hbs"; } -} \ No newline at end of file +}