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 += ` - ${subTable?.description} @DisplayTable[RollTable.${result.documentId}]{${subTableName}} + ${subTable?.description} @UUID[RollTable.${result.documentId}]{${subTableName}} `; } else { html += ` diff --git a/src/module/utils/utils.ts b/src/module/utils/utils.ts index c6d79a407..fec2f9f34 100644 --- a/src/module/utils/utils.ts +++ b/src/module/utils/utils.ts @@ -45,8 +45,12 @@ export function getCharShortName(char: string): string { return game.settings.get('twodsix', 'alternativeShort1'); case "ALT2": return game.settings.get('twodsix', 'alternativeShort2'); - default: + case "LFB": + case "STA": + case "HIT": return game.i18n.localize("TWODSIX.Items.Skills." + char); + default: + return game.i18n.localize(game.settings.get('twodsix', 'short' + char)); } } diff --git a/static/lang/en.json b/static/lang/en.json index 5b4047391..ed8711e20 100644 --- a/static/lang/en.json +++ b/static/lang/en.json @@ -414,7 +414,7 @@ "ValueCr": "Value in Cr" }, "Component": { - "Ammunition":"Ammuniton", + "Ammunition":"Ammunition", "componentName": "Component", "accomodations": "accommodations", "armament": "armament", @@ -857,6 +857,34 @@ "hint": "Defaults to 99, which means that effect is ignored.", "name": "What effect is required for a throw to be considered a critical success/failure (i.e. be colored green/red)." }, + "shortSTR": { + "hint": "Short name for strength characteristic. It should be four characters or fewer.", + "name": "Short name for strength characteristic" + }, + "shortDEX": { + "hint": "Short name for dexterity characteristic. It should be four characters or fewer.", + "name": "Short name for dexterity characteristic" + }, + "shortEND": { + "hint": "Short name for endurance characteristic. It should be four characters or fewer.", + "name": "Short name for endurance characteristic" + }, + "shortINT": { + "hint": "Short name for intelligence characteristic. It should be four characters or fewer.", + "name": "Short name for intelligence characteristic" + }, + "shortSOC": { + "hint": "Short name for social standing characteristic. It should be four characters or fewer.", + "name": "Short name for social standing characteristic" + }, + "shortEDU": { + "hint": "Short name for education characteristic. It should be four characters or fewer.", + "name": "Short name for education characteristic" + }, + "shortPSI": { + "hint": "Short name for psionic strength characteristic. It should be four characters or fewer.", + "name": "Short name for psionic strength characteristic" + }, "alternativeShort1": { "hint": "Short name for first alternative characteristic. It should be four characters or fewer.", "name": "Short name for alternative characteristic 1" diff --git a/static/templates/misc/setting-partial.html b/static/templates/misc/setting-partial.html index a0ea1e9d2..102a27e5f 100644 --- a/static/templates/misc/setting-partial.html +++ b/static/templates/misc/setting-partial.html @@ -6,7 +6,11 @@ {{/iff}} {{#iff setting.htmlType "===" "String"}} - + {{#if setting.localize}} + + {{else}} + + {{/if}} {{/iff}} {{#iff setting.htmlType "===" "Textarea"}}