From 58c6e8bdecdbc6595dda787a9e387becaefe02cd Mon Sep 17 00:00:00 2001 From: DC23 Date: Sat, 23 Nov 2024 16:07:07 +1100 Subject: [PATCH] Added localised settings for saving throw names #69 --- lang/en.json | 5 ++- lang/fr.json | 7 +++- module/settings/settings.mjs | 75 +++++++++++++++++++++++++++++++++++- 3 files changed, 83 insertions(+), 4 deletions(-) diff --git a/lang/en.json b/lang/en.json index 1bdd39a..e1ffd4e 100644 --- a/lang/en.json +++ b/lang/en.json @@ -159,6 +159,9 @@ "BASICFANTASYRPG.EffectToggle": "Toggle Effect", "BASICFANTASYRPG.EffectEdit": "Edit Effect", "BASICFANTASYRPG.EffectDelete": "Delete Effect", + "BASICFANTASYRPG.AutoRollTokenHP.name": "Automatically Roll Token HP", - "BASICFANTASYRPG.AutoRollTokenHP.hint": "Based on HD value. If this setting is turned off, HP will be set to TODO WORK OUT WHAT" + "BASICFANTASYRPG.AutoRollTokenHP.hint": "Based on HD value. If this setting is turned off, HP will be set to TODO WORK OUT WHAT", + + "BASICFANTASYRPG.SaveName.hint": "Custom name for this saving throw. The same name is used for all players." } \ No newline at end of file diff --git a/lang/fr.json b/lang/fr.json index 2be7934..c98ed24 100644 --- a/lang/fr.json +++ b/lang/fr.json @@ -158,5 +158,10 @@ "BASICFANTASYRPG.EffectCreate": "Créer un Effet", "BASICFANTASYRPG.EffectToggle": "Effet On/Off", "BASICFANTASYRPG.EffectEdit": "Modifier l'Effet", - "BASICFANTASYRPG.EffectDelete": "Supprimer l'Effet" + "BASICFANTASYRPG.EffectDelete": "Supprimer l'Effet", + + "BASICFANTASYRPG.AutoRollTokenHP.name": "Automatically Roll Token HP", + "BASICFANTASYRPG.AutoRollTokenHP.hint": "Based on HD value. If this setting is turned off, HP will be set to TODO WORK OUT WHAT", + + "BASICFANTASYRPG.SaveName.hint": "Custom name for this saving throw. The same name is used for all players." } diff --git a/module/settings/settings.mjs b/module/settings/settings.mjs index fe7e876..1d67835 100644 --- a/module/settings/settings.mjs +++ b/module/settings/settings.mjs @@ -2,7 +2,12 @@ * pseudo-enum to make setting ID references less error prone */ export const SETTINGS = { - AUTO_ROLL_TOKEN_HP: 'autoRollTokenHP' + 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 this internally for now. Refactoring the whole system is too big a job! @@ -21,6 +26,72 @@ export function registerSettings () { type: Boolean, default: true, requiresReload: false, - restricted: true, // GM-only setting + restricted: true // GM-only setting }) + + /** + * Saving throw customisation. + * If we get too many settings, these could be broken out into a submenu. + * It's more coding work, but keeps things together for the users. + */ + // Death Ray or Poison + game.settings.register(SYSTEM_ID, SETTINGS.SAVE_DEATH_NAME, { + name: 'BASICFANTASYRPG.SaveDeath', + hint: 'BASICFANTASYRPG.SaveName.hint', + scope: 'world', + config: true, + type: String, + default: game.i18n.localize('BASICFANTASYRPG.SaveDeath'), + requiresReload: true, // I assume this will need a reload to ensure everything is re-rendered + restricted: true // GM-only setting + }) + + // "BASICFANTASYRPG.SaveWands": "Magic Wands", + game.settings.register(SYSTEM_ID, SETTINGS.SAVE_WANDS_NAME, { + name: 'BASICFANTASYRPG.SaveWands', + hint: 'BASICFANTASYRPG.SaveName.hint', + scope: 'world', + config: true, + type: String, + default: game.i18n.localize('BASICFANTASYRPG.SaveWands'), + requiresReload: true, // I assume this will need a reload to ensure everything is re-rendered + restricted: true // GM-only setting + }) + + // "BASICFANTASYRPG.SaveParalysis": "Paralysis or Petrify", + game.settings.register(SYSTEM_ID, SETTINGS.SAVE_PARALYSIS_NAME, { + name: 'BASICFANTASYRPG.SaveParalysis', + hint: 'BASICFANTASYRPG.SaveName.hint', + scope: 'world', + config: true, + type: String, + default: game.i18n.localize('BASICFANTASYRPG.SaveParalysis'), + requiresReload: true, // I assume this will need a reload to ensure everything is re-rendered + restricted: true // GM-only setting + }) + + // "BASICFANTASYRPG.SaveBreath": "Dragon Breath", + game.settings.register(SYSTEM_ID, SETTINGS.SAVE_BREATH_NAME, { + name: 'BASICFANTASYRPG.SaveBreath', + hint: 'BASICFANTASYRPG.SaveName.hint', + scope: 'world', + config: true, + type: String, + default: game.i18n.localize('BASICFANTASYRPG.SaveBreath'), + requiresReload: true, // I assume this will need a reload to ensure everything is re-rendered + restricted: true // GM-only setting + }) + + // "BASICFANTASYRPG.SaveSpells": "Rods, Staves, and Spells", + game.settings.register(SYSTEM_ID, SETTINGS.SAVE_SPELLS_NAME, { + name: 'BASICFANTASYRPG.SaveSpells', + hint: 'BASICFANTASYRPG.SaveName.hint', + scope: 'world', + config: true, + type: String, + default: game.i18n.localize('BASICFANTASYRPG.SaveSpells'), + requiresReload: true, // I assume this will need a reload to ensure everything is re-rendered + restricted: true // GM-only setting + }) + }