Manage game systems

This commit is contained in:
2024-08-07 17:27:08 +02:00
parent 8be95c20bd
commit 534fcb04fb
15 changed files with 68 additions and 27 deletions

View File

@ -8,8 +8,12 @@ export class RFRPUtility {
/* -------------------------------------------- */
static async ready() {
this.registerSettings();
this.gameSystem = game.settings.get("fvtt-rolemaster-frp", "game_system");
const skillCategories = await RFRPUtility.loadCompendium("fvtt-rolemaster-frp.skill_categories")
this.skillCategories = skillCategories.map(i => i.toObject())
this.skillCategories = skillCategories.map(i => i.toObject()).filter( i => i.system.game_system == "common" || i.system.game_system == this.gameSystem);
}
/* -------------------------------------------- */
@ -17,6 +21,23 @@ export class RFRPUtility {
return this.skillCategories
}
/* -------------------------------------------- */
static registerSettings() {
game.settings.register("fvtt-rolemaster-frp", "game_system", {
name: "Game System",
hint: "List of Game Systems",
scope: "world",
default: "rmfrp",
requiresReload: true,
type: String,
config: true,
choices: {
rmfrp: "Rolemaster Fantasy Role Playing (RMFRP)",
merp: "Middle Earth Role Playing (MERP)"
}
});
}
/* -------------------------------------------- */
static async loadCompendiumData(compendium) {
const pack = game.packs.get(compendium);