Skip to content

Commit

Permalink
WFRP4e: Add ReadWrite setting
Browse files Browse the repository at this point in the history
  • Loading branch information
mclemente committed Sep 7, 2024
1 parent f8588ce commit 0336635
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,12 @@
}
},
"WFRP4E": {
"LanguageSkills": "Language"
"LanguageSkills": "Language",
"ReadWrite": {
"hint": "The name of the Read/Write talent.",
"title": "Read/Write Talent",
"default": "Read/Write"
}
}
}
}
9 changes: 8 additions & 1 deletion src/module/providers/wfrp4e.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ export default class wfrp4eLanguageProvider extends LanguageProvider {
type: String,
default: game.i18n.localize("POLYGLOT.WFRP4E.LanguageSkills"),
},
ReadWrite: {
name: game.i18n.localize("POLYGLOT.WFRP4E.ReadWrite.title"),
hint: game.i18n.localize("POLYGLOT.WFRP4E.ReadWrite.hint"),
type: String,
default: game.i18n.localize("POLYGLOT.WFRP4E.ReadWrite.default"),
},
};
}

Expand Down Expand Up @@ -103,7 +109,8 @@ export default class wfrp4eLanguageProvider extends LanguageProvider {
getUserLanguages(actor) {
let knownLanguages = new Set();
let literateLanguages = new Set();
const isLiterate = actor.items.filter((item) => item.name === "Read/Write" && item.type === "talent").length > 0;
const readWrite = game.settings.get("polyglot", "ReadWrite");
const isLiterate = actor.items.find((item) => item.name === readWrite && item.type === "talent").length > 0;
let myRegex = new RegExp(`${game.settings.get("polyglot", "LanguageRegex")}\\s*\\((.+)\\)`, "i");
for (let item of actor.items) {
// adding only the descriptive language name, not "Language (XYZ)"
Expand Down

0 comments on commit 0336635

Please sign in to comment.