Skip to content

Commit

Permalink
Added localised settings for saving throw names
Browse files Browse the repository at this point in the history
  • Loading branch information
DC23 committed Nov 23, 2024
1 parent 06dcdeb commit 58c6e8b
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 4 deletions.
5 changes: 4 additions & 1 deletion lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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."
}
7 changes: 6 additions & 1 deletion lang/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -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."
}
75 changes: 73 additions & 2 deletions module/settings/settings.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand All @@ -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
})

}

0 comments on commit 58c6e8b

Please sign in to comment.