diff --git a/src/module/settings/RulsetSettings.ts b/src/module/settings/RulsetSettings.ts index 8ba6a3fdb..b6677f856 100644 --- a/src/module/settings/RulsetSettings.ts +++ b/src/module/settings/RulsetSettings.ts @@ -70,6 +70,13 @@ export default class RulesetSettings extends AdvancedSettings { settings.characteristics.push(booleanSetting('showContaminationBelowLifeblood', true)); settings.characteristics.push(booleanSetting('showHeroPoints', false)); settings.characteristics.push(stringChoiceSetting('showAlternativeCharacteristics', "base", false, TWODSIX.CharacteristicDisplayTypes)); + settings.characteristics.push(stringSetting("shortSTR", "TWODSIX.Items.Skills.STR", false, "world", updateSTRShortLabel, true)); + settings.characteristics.push(stringSetting("shortDEX", "TWODSIX.Items.Skills.DEX", false, "world", updateDEXShortLabel, true)); + settings.characteristics.push(stringSetting("shortEND", "TWODSIX.Items.Skills.END", false, "world", updateENDShortLabel, true)); + settings.characteristics.push(stringSetting("shortINT", "TWODSIX.Items.Skills.INT", false, "world", updateINTShortLabel, true)); + settings.characteristics.push(stringSetting("shortEDU", "TWODSIX.Items.Skills.EDU", false, "world", updateEDUShortLabel, true)); + settings.characteristics.push(stringSetting("shortSOC", "TWODSIX.Items.Skills.SOC", false, "world", updateSOCShortLabel, true)); + settings.characteristics.push(stringSetting("shortPSI", "TWODSIX.Items.Skills.PSI", false, "world", updatePSIShortLabel, true)); settings.characteristics.push(stringSetting("alternativeShort1", "ALT1")); settings.characteristics.push(stringSetting("alternativeShort2", "ALT2")); settings.ship.push(numberSetting('maxComponentHits', 3)); @@ -115,3 +122,45 @@ export const checkManualDamageSetting = function () { ui.notifications.warn(game.i18n.localize("TWODSIX.Warnings.ResetEffectForManualDamage")); } }; + +export const updateSTRShortLabel = function (value:string) { + if (!value) { + game.settings.set('twodsix', "shortSTR", "TWODSIX.Items.Skills.STR"); + } +}; + +export const updateDEXShortLabel = function (value:string) { + if (!value) { + game.settings.set('twodsix', "shortDEX", "TWODSIX.Items.Skills.DEX"); + } +}; + +export const updateENDShortLabel = function (value:string) { + if (!value) { + game.settings.set('twodsix', "shortEND", "TWODSIX.Items.Skills.END"); + } +}; + +export const updateINTShortLabel = function (value:string) { + if (!value) { + game.settings.set('twodsix', "shortINT", "TWODSIX.Items.Skills.INT"); + } +}; + +export const updateEDUShortLabel = function (value:string) { + if (!value) { + game.settings.set('twodsix', "shortEDU", "TWODSIX.Items.Skills.EDU"); + } +}; + +export const updateSOCShortLabel = function (value:string) { + if (!value) { + game.settings.set('twodsix', "shortSOC", "TWODSIX.Items.Skills.SOC"); + } +}; + +export const updatePSIShortLabel = function (value:string) { + if (!value) { + game.settings.set('twodsix', "shortPSI", "TWODSIX.Items.Skills.PSI"); + } +}; diff --git a/src/module/settings/settingsUtils.ts b/src/module/settings/settingsUtils.ts index c2e81d70c..62e69139a 100644 --- a/src/module/settings/settingsUtils.ts +++ b/src/module/settings/settingsUtils.ts @@ -3,11 +3,11 @@ function registerSetting(key, scope, config, defaultValue, type, onChange, choices?, localize?) { const settingData = { - name: game.i18n.localize(`TWODSIX.Settings.${key}.name`), + name: game.i18n.localize(`TWODSIX.Settings.${key}.name`), //localization doesn't function at this point FVTT automatically localizes later hint: game.i18n.localize(`TWODSIX.Settings.${key}.hint`), scope: scope, config: config, - default: defaultValue, + default: localize ? game.i18n.localize(defaultValue) : defaultValue, type: type, onChange: onChange, choices: choices, @@ -31,8 +31,8 @@ export function stringChoiceSetting(key: string, defaultValue: string, localize return key; } -export function stringSetting(key: string, defaultValue: string, config = false, scope = 'world', onChange?: ((value: string) => void) | undefined): string { - registerSetting(key.replace('.', ''), scope, config, defaultValue, String, onChange); +export function stringSetting(key: string, defaultValue: string, config = false, scope = 'world', onChange?: ((value: string) => void) | undefined, localize?:boolean): string { + registerSetting(key.replace('.', ''), scope, config, defaultValue, String, onChange, undefined, localize); return key; } diff --git a/src/module/utils/enrichers.ts b/src/module/utils/enrichers.ts index 806d1549c..b252ba67d 100644 --- a/src/module/utils/enrichers.ts +++ b/src/module/utils/enrichers.ts @@ -135,7 +135,7 @@ function displayTable(uuid: string, table:any, tableName: string): string { } } html += ` -