Skip to content

Commit

Permalink
implementing setting names
Browse files Browse the repository at this point in the history
  • Loading branch information
DC23 committed Nov 26, 2024
1 parent c6f32f4 commit 1c41b18
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
16 changes: 10 additions & 6 deletions module/settings/settings.mjs
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
import { BASICFANTASYRPG } from "../helpers/config.mjs"

/**
* pseudo-enum to make setting ID references less error prone
*/
export const SETTINGS = {
// AUTO_ROLL_TOKEN_HP: 'autoRollTokenHP',
SAVE_DEATH_NAME: 'saveDeathName',
SAVE_WANDS_NAME: 'saveWandsName',
SAVE_PARALYSIS_NAME: 'saveParalysisName',
SAVE_BREATH_NAME: 'saveBreathName',
SAVE_SPELLS_NAME: 'saveSpellsName',
// use the saves keys as the setting ID to make retrieval easy.
// So long as the system.key is unique, it's fine.
SAVE_DEATH_NAME: 'death',
SAVE_WANDS_NAME: 'wands',
SAVE_PARALYSIS_NAME: 'paralysis',
SAVE_BREATH_NAME: 'breath',
SAVE_SPELLS_NAME: 'spells',
}

// Use this internally for now. Refactoring the whole system is too big a job!
const SYSTEM_ID = 'basicfantasyrpg'
export const SYSTEM_ID = 'basicfantasyrpg'

/**
* Array of setting IDs for the settings that should be hidden from
Expand Down
3 changes: 2 additions & 1 deletion module/sheets/actor-sheet.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {successChatMessage} from '../helpers/chat.mjs';
import {onManageActiveEffect, prepareActiveEffectCategories} from '../helpers/effects.mjs';
import { SYSTEM_ID } from '../settings/settings.mjs';

/**
* Extend the basic ActorSheet with some very simple modifications
Expand Down Expand Up @@ -85,7 +86,7 @@ export class BasicFantasyRPGActorSheet extends ActorSheet {
_prepareActorData(context) {
// Handle saves.
for (let [k, v] of Object.entries(context.data.saves)) {
v.label = game.i18n.localize(CONFIG.BASICFANTASYRPG.saves[k]) ?? k;
v.label = game.settings.get(SYSTEM_ID, k) ?? k
}
}

Expand Down

0 comments on commit 1c41b18

Please sign in to comment.