Skip to content

Commit

Permalink
Fix for Unavailable languages on actors
Browse files Browse the repository at this point in the history
  • Loading branch information
mclemente committed Jan 31, 2024
1 parent 1bb4600 commit 560befa
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions src/module/providers/pf2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,21 +310,16 @@ export default class pf2eLanguageProvider extends LanguageProvider {
getUserLanguages(actor) {
let knownLanguages = new Set();
let literateLanguages = new Set();
if (actor.system?.details?.languages) {
for (let lang of actor.system.details.languages.value) {
if (lang === "common") {
const common = game.settings.get("pf2e", "homebrew.languageRarities").commonLanguage;
knownLanguages.add(common);
} else if (lang in CONFIG.PF2E.languages) {
const languageRarities = game.settings.get("pf2e", "homebrew.languageRarities");
const actorLanguages = actor.system?.details?.languages;
if (actorLanguages) {
for (let lang of actorLanguages.value) {
if (lang === "common" && languageRarities.commonLanguage) {
knownLanguages.add(languageRarities.commonLanguage);
} else if (lang in CONFIG.PF2E.languages && !languageRarities.unavailable.has(lang)) {
knownLanguages.add(lang);
}
}
if (actor.system.details.languages.custom) {
for (let lang of actor.system.details.languages.custom.split(/[,;]/)) {
const key = lang.trim().toLowerCase();
knownLanguages.add(key);
}
}
}
return [knownLanguages, literateLanguages];
}
Expand Down

0 comments on commit 560befa

Please sign in to comment.