diff --git a/scripts/helpers/settingsConfigForm.js b/scripts/helpers/settingsConfigForm.js
index 2a84134..9261671 100644
--- a/scripts/helpers/settingsConfigForm.js
+++ b/scripts/helpers/settingsConfigForm.js
@@ -1,4 +1,4 @@
-import { getSetting } from "./misc.js";
+import { getSetting, MODULE_ID } from "./misc.js";
export class SettingsConfigForm extends FormApplication {
// lots of other things...
@@ -12,7 +12,7 @@ export class SettingsConfigForm extends FormApplication {
return mergeObject(super.defaultOptions, {
classes: ['form'],
popOut: true,
- template: `modules/pf2e-rpg-numbers/templates/pf2e-rpg-settings-config.hbs`,
+ template: `modules/pf2e-rpg-numbers/templates/settings/pf2e-rpg-settings-config.hbs`,
id: 'pf2e-rpg-numbers-settings-form',
title: 'Pf2e RPG #s Config Menu',
width: 800,
@@ -97,10 +97,10 @@ export class SettingsConfigForm extends FormApplication {
scaleOnSize: getSetting("rotate-on-attack.scale-on-size"),
},
critical: {
- critical: getSetting("critical.enabled"),
- style: getSetting("critical.type"),
- checksOrAttacks: getSetting("critical.show-on"),
- pcOrNPC: getSetting("critical.show-on-token-type"),
+ enabled: getSetting("critical.enabled"),
+ style: convertChoicesGivenSetting("critical.type"),
+ checksOrAttacks: convertChoicesGivenSetting("critical.show-on"),
+ pcOrNPC: convertChoicesGivenSetting("critical.show-on-token-type"),
defImage: getSetting("critical.default-img"),
duration: getSetting("critical.duration"),
sound: getSetting("critical.sound"),
@@ -189,4 +189,10 @@ export class SettingsConfigForm extends FormApplication {
const data = expandObject(formData);
//game.settings.set('myModuleName', 'myComplexSettingName', data);
}
+}
+
+function convertChoicesGivenSetting(settingPath) {
+ const choices = game.settings.settings.get(MODULE_ID + "." + settingPath)?.choices;
+ const value = getSetting(settingPath);
+ return Object.entries(choices).map(([id, label]) => ({ id, label, selected: id === value }))
}
\ No newline at end of file
diff --git a/templates/settings/pf2e-rpg-settings-config.hbs b/templates/settings/pf2e-rpg-settings-config.hbs
index 2bc2a64..8d27905 100644
--- a/templates/settings/pf2e-rpg-settings-config.hbs
+++ b/templates/settings/pf2e-rpg-settings-config.hbs
@@ -6,47 +6,33 @@
{{/each}}
-
- Fixed header
- {{header}}
-
-
{{#each tabs as |tab|}}
- Fixed content for tab {{tab.title}}
{{#if home}}
- {{> 'modules/pf2e-rpg-numbers/templates/settings/tabs/home.hbs' this}}
+ {{> 'modules/pf2e-rpg-numbers/templates/settings/tabs/home.hbs' this}}
{{/if}}
{{#if rolls}}
- {{> 'modules/pf2e-rpg-numbers/templates/settings/tabs/rolls.hbs' this}}
+ {{> 'modules/pf2e-rpg-numbers/templates/settings/tabs/rolls.hbs' this}}
{{/if}}
{{#if token}}
- {{> 'modules/pf2e-rpg-numbers/templates/settings/tabs/token.hbs' this}}
+ {{> 'modules/pf2e-rpg-numbers/templates/settings/tabs/token.hbs' this}}
{{/if}}
{{#if critical}}
- {{> 'modules/pf2e-rpg-numbers/templates/settings/tabs/critical.hbs' this}}
+ {{> 'modules/pf2e-rpg-numbers/templates/settings/tabs/critical.hbs' this}}
{{/if}}
{{#if text}}
- {{> 'modules/pf2e-rpg-numbers/templates/settings/tabs/text.hbs' this}}
+ {{> 'modules/pf2e-rpg-numbers/templates/settings/tabs/text.hbs' this}}
{{/if}}
{{#if misc}}
- {{> 'modules/pf2e-rpg-numbers/templates/settings/tabs/misc.hbs' this}}
+ {{> 'modules/pf2e-rpg-numbers/templates/settings/tabs/misc.hbs' this}}
{{/if}}
{{/each}}
-
-
- Fixed header
- {{header}}
-
- Fixed content
- {{{content}}}
-
- Fixed footer
- {{footer}}
-
-
-
+
\ No newline at end of file
diff --git a/templates/settings/tabs/critical.hbs b/templates/settings/tabs/critical.hbs
index a864c15..9466cb8 100644
--- a/templates/settings/tabs/critical.hbs
+++ b/templates/settings/tabs/critical.hbs
@@ -1,5 +1,46 @@
\ No newline at end of file
diff --git a/templates/settings/tabs/home.hbs b/templates/settings/tabs/home.hbs
index 88a4525..7bd196b 100644
--- a/templates/settings/tabs/home.hbs
+++ b/templates/settings/tabs/home.hbs
@@ -1,9 +1,8 @@