From c13ebb0b7689276f32000f607c815a26f8f5731a Mon Sep 17 00:00:00 2001 From: Gesina Schwalbe Date: Sat, 23 Jan 2021 23:44:49 +0100 Subject: [PATCH 01/15] add buttons in overviews now on bottom --- src/templates/actor/partials/items-overview.hbs | 7 +++---- .../partials/special-creature-abilites-overview.hbs | 5 +++-- src/templates/actor/partials/spells-overview.hbs | 6 ++++-- .../actor/partials/talents-abilities-overview.hbs | 13 ++++++------- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/templates/actor/partials/items-overview.hbs b/src/templates/actor/partials/items-overview.hbs index 55b34411..b51a97cb 100644 --- a/src/templates/actor/partials/items-overview.hbs +++ b/src/templates/actor/partials/items-overview.hbs @@ -15,9 +15,8 @@ {{#*inline "ifHasItemOfType"}} {{#if (and (ne itemsArray undefined) (gt itemsArray.length 0))}} {{> @partial-block}} -{{else}} -{{> systems/ds4/templates/actor/partials/overview-add-button.hbs dataType=dataType }} {{/if}} +{{> systems/ds4/templates/actor/partials/overview-add-button.hbs dataType=dataType }} {{/inline}} @@ -48,8 +47,8 @@ {{> @partial-block }} {{!-- description --}}
{{localize 'DS4.Description'}}
- {{!-- add button --}} - {{> systems/ds4/templates/actor/partials/overview-add-button.hbs dataType=dataType }} + {{!-- control buttons placeholder --}} +
{{/inline}} diff --git a/src/templates/actor/partials/special-creature-abilites-overview.hbs b/src/templates/actor/partials/special-creature-abilites-overview.hbs index 28637149..078fa287 100644 --- a/src/templates/actor/partials/special-creature-abilites-overview.hbs +++ b/src/templates/actor/partials/special-creature-abilites-overview.hbs @@ -42,8 +42,8 @@
{{localize 'DS4.ItemName'}}
{{!-- description --}}
{{localize 'DS4.Description'}}
- {{!-- add button --}} - {{> systems/ds4/templates/actor/partials/overview-add-button.hbs dataType=dataType }} + {{!-- control buttons placeholder --}} +
{{/inline}} @@ -58,4 +58,5 @@ {{> baseItemListEntry item=item}} {{/each}} + {{> systems/ds4/templates/actor/partials/overview-add-button.hbs dataType='specialCreatureAbility' }} \ No newline at end of file diff --git a/src/templates/actor/partials/spells-overview.hbs b/src/templates/actor/partials/spells-overview.hbs index 8bcd33e3..e19e863f 100644 --- a/src/templates/actor/partials/spells-overview.hbs +++ b/src/templates/actor/partials/spells-overview.hbs @@ -55,8 +55,8 @@
{{!-- description --}} {{!--
{{localize 'DS4.Description'}}
--}} - {{!-- add button --}} - {{> systems/ds4/templates/actor/partials/overview-add-button.hbs dataType='spell' }} + {{!-- control buttons placeholder --}} +
{{#each itemsByType.spell as |item id|}}
  • @@ -90,4 +90,6 @@
  • {{/each}} + {{!-- add button --}} + {{> systems/ds4/templates/actor/partials/overview-add-button.hbs dataType='spell' }} \ No newline at end of file diff --git a/src/templates/actor/partials/talents-abilities-overview.hbs b/src/templates/actor/partials/talents-abilities-overview.hbs index e40b2aa7..19bac512 100644 --- a/src/templates/actor/partials/talents-abilities-overview.hbs +++ b/src/templates/actor/partials/talents-abilities-overview.hbs @@ -15,9 +15,8 @@ {{#*inline "ifHasItemOfType"}} {{#if (and (ne itemsArray undefined) (gt itemsArray.length 0))}} {{> @partial-block}} -{{else}} - {{> systems/ds4/templates/actor/partials/overview-add-button.hbs dataType=dataType }} {{/if}} +{{> systems/ds4/templates/actor/partials/overview-add-button.hbs dataType=dataType }} {{/inline}} @@ -98,7 +97,7 @@ {{/inline}} {{!-- -!-- Render a list header for a base item list entries from a given item. +!-- Render a list header for a base item list entry from a given item. !-- The partial assumes a variable dataType to be given in the context. !-- !-- @param dataType: the string item type for the list @@ -111,8 +110,8 @@
    {{localize 'DS4.ItemName'}}
    {{!-- description --}}
    {{localize 'DS4.Description'}}
    - {{!-- add button --}} - {{> systems/ds4/templates/actor/partials/overview-add-button.hbs dataType=dataType }} + {{!-- control buttons placeholder --}} +
    {{/inline}} @@ -133,8 +132,8 @@
    {{localize 'DS4.TalentRank'}}
    {{!-- description --}}
    {{localize 'DS4.Description'}}
    - {{!-- add button --}} - {{> systems/ds4/templates/actor/partials/overview-add-button.hbs dataType='talent' }} + {{!-- control buttons placeholder --}} +
    {{#each itemsByType.talent as |item id|}} {{> talentListEntry item=item}} From 4c8bd29e2e068b08ee96266d7f9972e9e96eecc0 Mon Sep 17 00:00:00 2001 From: Gesina Schwalbe Date: Sat, 23 Jan 2021 23:49:45 +0100 Subject: [PATCH 02/15] added unit to char height & weigt title --- src/lang/de.json | 4 ++-- src/lang/en.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lang/de.json b/src/lang/de.json index f81a5f29..a2ce52d7 100644 --- a/src/lang/de.json +++ b/src/lang/de.json @@ -144,9 +144,9 @@ "DS4.CharacterProfileBirthday": "Geburtstag", "DS4.CharacterProfileBirthplace": "Geburtsort", "DS4.CharacterProfileAge": "Alter", - "DS4.CharacterProfileHeight": "Größe", + "DS4.CharacterProfileHeight": "Größe [cm]", "DS4.CharacterProfileHairColor": "Haarfarbe", - "DS4.CharacterProfileWeight": "Gewicht", + "DS4.CharacterProfileWeight": "Gewicht [kg]", "DS4.CharacterProfileEyeColor": "Augenfarbe", "DS4.CharacterProfileSpecialCharacteristics": "Besondere Eigenschaften", "DS4.CharacterCurrencyGold": "Gold", diff --git a/src/lang/en.json b/src/lang/en.json index ee1927ee..8c754fbd 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -144,9 +144,9 @@ "DS4.CharacterProfileBirthday": "Birthday", "DS4.CharacterProfileBirthplace": "Birthplace", "DS4.CharacterProfileAge": "Age", - "DS4.CharacterProfileHeight": "Height", + "DS4.CharacterProfileHeight": "Height [m]", "DS4.CharacterProfileHairColor": "Hair Color", - "DS4.CharacterProfileWeight": "Weight", + "DS4.CharacterProfileWeight": "Weight [kg]", "DS4.CharacterProfileEyeColor": "Eye Color", "DS4.CharacterProfileSpecialCharacteristics": "Special Characteristics", "DS4.CharacterCurrencyGold": "Gold", From b1e7f61ed57bd48761d58ecf38be97a2972b8bea Mon Sep 17 00:00:00 2001 From: Gesina Schwalbe Date: Sun, 24 Jan 2021 01:20:55 +0100 Subject: [PATCH 03/15] changed char special characteristics to textarea --- src/templates/actor/character-sheet.hbs | 32 ++++++++++++------------ src/templates/actor/partials/profile.hbs | 8 +++++- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/src/templates/actor/character-sheet.hbs b/src/templates/actor/character-sheet.hbs index 0fb538f9..d425326c 100644 --- a/src/templates/actor/character-sheet.hbs +++ b/src/templates/actor/character-sheet.hbs @@ -84,24 +84,24 @@ {{localize 'DS4.HeadingBiography'}} - {{!-- Sheet Body --}} -
    - {{!-- Items Tab --}} - {{> systems/ds4/templates/actor/partials/character-inventory.hbs}} +{{!-- Sheet Body (remove indentation to avoid annoying Handlebars auto-indent) --}} +
    +{{!-- Items Tab --}} +{{> systems/ds4/templates/actor/partials/character-inventory.hbs}} - {{!-- Spells Tab --}} - {{> systems/ds4/templates/actor/partials/spells-overview.hbs}} +{{!-- Spells Tab --}} +{{> systems/ds4/templates/actor/partials/spells-overview.hbs}} - {{!-- Talents Tab --}} - {{> systems/ds4/templates/actor/partials/talents-abilities-overview.hbs}} +{{!-- Talents Tab --}} +{{> systems/ds4/templates/actor/partials/talents-abilities-overview.hbs}} - {{! Profile Tab --}} - {{> systems/ds4/templates/actor/partials/profile.hbs}} +{{! Profile Tab --}} +{{> systems/ds4/templates/actor/partials/profile.hbs owner=owner}} - {{!-- Biography Tab --}} -
    - {{editor content=data.profile.biography target="data.profile.biography" button=true owner=owner - editable=editable}} -
    -
    +{{!-- Biography Tab --}} +
    +{{editor content=data.profile.biography target="data.profile.biography" button=true owner=owner +editable=editable}} +
    +
    diff --git a/src/templates/actor/partials/profile.hbs b/src/templates/actor/partials/profile.hbs index be95eeb5..2359d8fb 100644 --- a/src/templates/actor/partials/profile.hbs +++ b/src/templates/actor/partials/profile.hbs @@ -1,7 +1,7 @@
    {{#each data.profile as |profile-data-value profile-data-key|}} - {{#if (ne profile-data-key 'biography')}} + {{#if (and (ne profile-data-key 'biography') (ne profile-data-key 'specialCharacteristics'))}}
    {{/if}} {{/each}} +
    + + +
    From a8158894ddda1e4886e4dc8dc3cc58a848f03b57 Mon Sep 17 00:00:00 2001 From: Gesina Schwalbe Date: Sun, 24 Jan 2021 11:06:07 +0100 Subject: [PATCH 04/15] added thin space between value and unit in spells --- src/templates/actor/partials/spells-overview.hbs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/templates/actor/partials/spells-overview.hbs b/src/templates/actor/partials/spells-overview.hbs index e19e863f..356ef30d 100644 --- a/src/templates/actor/partials/spells-overview.hbs +++ b/src/templates/actor/partials/spells-overview.hbs @@ -13,7 +13,7 @@
    {{#if unitDatum.value }} - {{unitDatum.value}}{{lookup unitAbbrs unitDatum.unit}} + {{unitDatum.value}} {{lookup unitAbbrs unitDatum.unit}} {{else}}-{{/if}}
    {{/inline}} From 0b1c342ecfc0302306aa753a09c71f1cb0a4d1b2 Mon Sep 17 00:00:00 2001 From: Gesina Schwalbe Date: Sun, 24 Jan 2021 13:11:08 +0100 Subject: [PATCH 05/15] select text of input fields when focused - the content of input fields of relevant sheets and dialogs are now selected upon focus - autofocus the Gamemaster roll modifier in the roll dialog --- src/module/ds4.ts | 18 ++++++++++++++++++ src/templates/roll/roll-options.hbs | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/module/ds4.ts b/src/module/ds4.ts index 81115a4c..a20f18e5 100644 --- a/src/module/ds4.ts +++ b/src/module/ds4.ts @@ -133,3 +133,21 @@ Hooks.once("setup", function () { Hooks.once("ready", function () { migration.migrate(); }); + +/** + * Select the text of input elements in given sheets via onfocus listener. + * The hook names are of the form "render"+sheet_superclassname and are called within + * the render() method of the foundry Application class. + * Note: The render hooks of all classes in the class hierarchy are called, + * so e.g. for a Dialog, both "renderDialog" and "renderApplication" are called + * (in this order). + */ +["renderApplication", "renderActorSheet", "renderItemSheet"].forEach((hookName: string) => { + Hooks.on(hookName, (app: Dialog, html: JQueryStatic, data: any) => { + $(html) + .find("input") + .on("focus", (ev: JQuery.FocusEvent) => { + ev.currentTarget.select(); + }); + }); +}); diff --git a/src/templates/roll/roll-options.hbs b/src/templates/roll/roll-options.hbs index 8c3e7dc3..153d463d 100644 --- a/src/templates/roll/roll-options.hbs +++ b/src/templates/roll/roll-options.hbs @@ -2,7 +2,7 @@ - + From 867c417737c0f415b973ff9e0c3ad059307f42f5 Mon Sep 17 00:00:00 2001 From: Gesina Schwalbe Date: Sun, 24 Jan 2021 16:11:59 +0100 Subject: [PATCH 06/15] removed unnecessary partial arg in char sheet The argument was accidentally introduced before. --- src/templates/actor/character-sheet.hbs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/templates/actor/character-sheet.hbs b/src/templates/actor/character-sheet.hbs index d425326c..75be93ff 100644 --- a/src/templates/actor/character-sheet.hbs +++ b/src/templates/actor/character-sheet.hbs @@ -96,7 +96,7 @@ {{> systems/ds4/templates/actor/partials/talents-abilities-overview.hbs}} {{! Profile Tab --}} -{{> systems/ds4/templates/actor/partials/profile.hbs owner=owner}} +{{> systems/ds4/templates/actor/partials/profile.hbs}} {{!-- Biography Tab --}}
    From 3ddabcaaac797287b0bdcae342210501ac652cdb Mon Sep 17 00:00:00 2001 From: Gesina Schwalbe Date: Sun, 24 Jan 2021 17:39:11 +0100 Subject: [PATCH 07/15] fixed some German translations --- src/lang/de.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/lang/de.json b/src/lang/de.json index f81a5f29..455c97c4 100644 --- a/src/lang/de.json +++ b/src/lang/de.json @@ -12,11 +12,11 @@ "DS4.HeadingSpells": "Zaubersprüche", "DS4.HeadingDescription": "Beschreibung", "DS4.HeadingSpecialCreatureAbilites": "Besondere Fähigkeiten", - "DS4.AttackType": "Angriffs Typ", + "DS4.AttackType": "Angriffstyp", "DS4.AttackTypeAbbr": "AT", - "DS4.WeaponBonus": "Waffen Bonus", + "DS4.WeaponBonus": "Waffenbonus", "DS4.WeaponBonusAbbr": "WB", - "DS4.OpponentDefense": "Gegner Abwehr", + "DS4.OpponentDefense": "Gegnerabwehr", "DS4.OpponentDefenseAbbr": "GA", "DS4.AttackTypeMelee": "Schlagen", "DS4.AttackTypeRanged": "Schießen", @@ -61,9 +61,9 @@ "DS4.ItemTypeSpecialCreatureAbilityPlural": "Besondere Kreaturenfähigkeiten", "DS4.ArmorType": "Panzerungstyp", "DS4.ArmorTypeAbbr": "PAT", - "DS4.ArmorMaterialType": "Material Typ", + "DS4.ArmorMaterialType": "Materialtyp", "DS4.ArmorMaterialTypeAbbr": "Mat.", - "DS4.ArmorValue": "Panzerungs Wert", + "DS4.ArmorValue": "Panzerungswert", "DS4.ArmorValueAbbr": "PA", "DS4.ArmorTypeBody": "Körper", "DS4.ArmorTypeBodyAbbr": "Körper", @@ -125,7 +125,7 @@ "DS4.CombatValuesTargetedSpellcasting": "Zielzaubern", "DS4.CharacterBaseInfoRace": "Volk", "DS4.CharacterBaseInfoClass": "Klasse", - "DS4.CharacterBaseInfoHeroClass": "Helden Klasse", + "DS4.CharacterBaseInfoHeroClass": "Heldenklasse", "DS4.CharacterBaseInfoCulture": "Kultur", "DS4.CharacterProgressionLevel": "Stufe", "DS4.CharacterProgressionExperiencePoints": "Erfahrungspunkte", @@ -193,7 +193,7 @@ "DS4.UnitCustom": "individuell", "DS4.UnitCustomAbbr": " ", "DS4.RollDialogDefaultTitle": "Proben-Optionen", - "DS4.RollDialogOkButton": "Ok", + "DS4.RollDialogOkButton": "OK", "DS4.RollDialogCancelButton": "Abbrechen", "DS4.ErrorUnexpectedHtmlType": "Typfehler: Erwartet wurde {exType}, tatsächlich erhalten wurde {realType}", "DS4.RollDialogTargetLabel": "Probenwert", From 3ba5c0d6409950681ccb72a09c53ae0cbff53ad3 Mon Sep 17 00:00:00 2001 From: Gesina Schwalbe Date: Sun, 24 Jan 2021 17:40:08 +0100 Subject: [PATCH 08/15] localized effect control buttons --- src/lang/de.json | 3 +++ src/lang/en.json | 3 +++ src/templates/item/partials/effects.hbs | 10 ++++++---- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/lang/de.json b/src/lang/de.json index 455c97c4..d7cb9c9d 100644 --- a/src/lang/de.json +++ b/src/lang/de.json @@ -2,6 +2,9 @@ "DS4.UserInteractionAddItem": "Neu", "DS4.UserInteractionEditItem": "Bearbeiten", "DS4.UserInteractionDeleteItem": "Löschen", + "DS4.UserInteractionAddEffect": "Neuer Effekt", + "DS4.UserInteractionEditEffect": "Effekt bearbeiten", + "DS4.UserInteractionDeleteEffect": "Effekt löschen", "DS4.NotOwned": "Nicht besessen", "DS4.HeadingBiography": "Biografie", "DS4.HeadingDetails": "Details", diff --git a/src/lang/en.json b/src/lang/en.json index ee1927ee..b3b7af82 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -2,6 +2,9 @@ "DS4.UserInteractionAddItem": "Add item", "DS4.UserInteractionEditItem": "Edit item", "DS4.UserInteractionDeleteItem": "Delete item", + "DS4.UserInteractionAddEffect": "Add Effect", + "DS4.UserInteractionEditEffect": "Edit Effect", + "DS4.UserInteractionDeleteEffect": "Delete Effect", "DS4.NotOwned": "No owner", "DS4.HeadingBiography": "Biography", "DS4.HeadingDetails": "Details", diff --git a/src/templates/item/partials/effects.hbs b/src/templates/item/partials/effects.hbs index b829bfac..a064313e 100644 --- a/src/templates/item/partials/effects.hbs +++ b/src/templates/item/partials/effects.hbs @@ -5,16 +5,18 @@
    Name
    {{#each item.effects as |effect id|}}
  • {{effect.label}}

    - - + + + +
  • {{/each}} From a5d91eca71b7f0df6790ccc6ed0b2887a698ec44 Mon Sep 17 00:00:00 2001 From: Gesina Schwalbe Date: Sun, 24 Jan 2021 17:45:39 +0100 Subject: [PATCH 09/15] localized edit & delete item buttons --- src/templates/actor/partials/overview-control-buttons.hbs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/templates/actor/partials/overview-control-buttons.hbs b/src/templates/actor/partials/overview-control-buttons.hbs index d10dbc3f..2c85899f 100644 --- a/src/templates/actor/partials/overview-control-buttons.hbs +++ b/src/templates/actor/partials/overview-control-buttons.hbs @@ -3,6 +3,6 @@ !-- The current item is defined by the data-item-id HTML property of the parent li element. --}}
    - - + +
    From d831f376e1b6c92929788f45d54816add4dd6f98 Mon Sep 17 00:00:00 2001 From: Gesina Schwalbe Date: Sun, 24 Jan 2021 17:47:47 +0100 Subject: [PATCH 10/15] moved localization mappings in CONFIG.DS4.i18nKeys - moved all mappings in CONFIG.DS4 that belong to localization into common parent CONFIG.DS4.i18nKeys - adapted logic in ds4.ts to not overwrite entries in CONFIG.DS4.i18nKeys - adapted calls to config in templates --- src/module/config.ts | 561 +++++++++--------- src/module/ds4.ts | 40 +- src/module/item/item-data.ts | 2 +- src/templates/actor/character-sheet.hbs | 12 +- src/templates/actor/creature-sheet.hbs | 14 +- .../actor/partials/attributes-traits.hbs | 4 +- .../actor/partials/character-inventory.hbs | 6 +- .../actor/partials/character-progression.hbs | 4 +- .../actor/partials/combat-values.hbs | 2 +- .../actor/partials/items-overview.hbs | 10 +- src/templates/actor/partials/profile.hbs | 4 +- .../actor/partials/spells-overview.hbs | 6 +- src/templates/item/armor-sheet.hbs | 4 +- src/templates/item/partials/details.hbs | 2 +- src/templates/item/partials/sheet-header.hbs | 2 +- src/templates/item/spell-sheet.hbs | 8 +- src/templates/item/weapon-sheet.hbs | 2 +- src/templates/roll/roll-options.hbs | 2 +- 18 files changed, 333 insertions(+), 352 deletions(-) diff --git a/src/module/config.ts b/src/module/config.ts index cd927290..5654c189 100644 --- a/src/module/config.ts +++ b/src/module/config.ts @@ -9,12 +9,293 @@ export const DS4 = { =============================================================================================`, /** - * Define the set of acttack types that can be performed with weapon items + * A dictionary of dictionaries each mapping keys to localized strings. + * To be filled with the localizations derived from i18nKeys. */ - attackTypes: { - melee: "DS4.AttackTypeMelee", - ranged: "DS4.AttackTypeRanged", - meleeRanged: "DS4.AttackTypeMeleeRanged", + i18n: { + // to be filled with the localized mappings from i18nKeys + }, + /** + * A dictionary of dictionaries each mapping keys to localization keys. + */ + i18nKeys: { + /** + * Define the set of acttack types that can be performed with weapon items + */ + attackTypes: { + melee: "DS4.AttackTypeMelee", + ranged: "DS4.AttackTypeRanged", + meleeRanged: "DS4.AttackTypeMeleeRanged", + }, + + /** + * Define the set of item availabilties + */ + itemAvailabilities: { + unset: "DS4.ItemAvailabilityUnset", + hamlet: "DS4.ItemAvailabilityHamlet", + village: "DS4.ItemAvailabilityVilage", + city: "DS4.ItemAvailabilityCity", + elves: "DS4.ItemAvailabilityElves", + dwarves: "DS4.ItemAvailabilityDwarves", + nowhere: "DS4.ItemAvailabilityNowhere", + }, + + /** + * Define the set of item types + */ + itemTypes: { + weapon: "DS4.ItemTypeWeapon", + armor: "DS4.ItemTypeArmor", + shield: "DS4.ItemTypeShield", + spell: "DS4.ItemTypeSpell", + trinket: "DS4.ItemTypeTrinket", + equipment: "DS4.ItemTypeEquipment", + talent: "DS4.ItemTypeTalent", + racialAbility: "DS4.ItemTypeRacialAbility", + language: "DS4.ItemTypeLanguage", + alphabet: "DS4.ItemTypeAlphabet", + specialCreatureAbility: "DS4.ItemTypeSpecialCreatureAbility", + }, + + /** + * Define the set of armor types, a character may only wear one item of each at any given time + */ + armorTypes: { + body: "DS4.ArmorTypeBody", + helmet: "DS4.ArmorTypeHelmet", + vambrace: "DS4.ArmorTypeVambrace", + greaves: "DS4.ArmorTypeGreaves", + vambraceGreaves: "DS4.ArmorTypeVambraceGreaves", + }, + + /** + * Define abbreviations for the armor types + */ + armorTypesAbbr: { + body: "DS4.ArmorTypeBodyAbbr", + helmet: "DS4.ArmorTypeHelmetAbbr", + vambrace: "DS4.ArmorTypeVambraceAbbr", + greaves: "DS4.ArmorTypeGreavesAbbr", + vambraceGreaves: "DS4.ArmorTypeVambraceGreavesAbbr", + }, + + /** + * Define the set of armor materials, used to determine if a characer may wear the armor without additional penalties + */ + armorMaterialTypes: { + cloth: "DS4.ArmorMaterialTypeCloth", + leather: "DS4.ArmorMaterialTypeLeather", + chain: "DS4.ArmorMaterialTypeChain", + plate: "DS4.ArmorMaterialTypePlate", + }, + + /** + * Define the abbreviations of armor materials + */ + armorMaterialTypesAbbr: { + cloth: "DS4.ArmorMaterialTypeClothAbbr", + leather: "DS4.ArmorMaterialTypeLeatherAbbr", + chain: "DS4.ArmorMaterialTypeChainAbbr", + plate: "DS4.ArmorMaterialTypePlateAbbr", + }, + + spellTypes: { + spellcasting: "DS4.SpellTypeSpellcasting", + targetedSpellcasting: "DS4.SpellTypeTargetedSpellcasting", + }, + + spellCategories: { + healing: "DS4.SpellCategoryHealing", + fire: "DS4.SpellCategoryFire", + ice: "DS4.SpellCategoryIce", + light: "DS4.SpellCategoryLight", + darkness: "DS4.SpellCategoryDarkness", + mindAffecting: "DS4.SpellCategoryMindAffecting", + electricity: "DS4.SpellCategoryElectricity", + none: "DS4.SpellCategoryNone", + unset: "DS4.SpellCategoryUnset", + }, + + /** + * Define the set of actor types + */ + actorTypes: { + character: "DS4.ActorTypeCharacter", + creature: "DS4.ActorTypeCreature", + }, + + /** + * Define the set of attributes an actor has + */ + attributes: { + body: "DS4.AttributeBody", + mobility: "DS4.AttributeMobility", + mind: "DS4.AttributeMind", + }, + + /** + * Define the set of traits an actor has + */ + traits: { + strength: "DS4.TraitStrength", + agility: "DS4.TraitAgility", + intellect: "DS4.TraitIntellect", + constitution: "DS4.TraitConstitution", + dexterity: "DS4.TraitDexterity", + aura: "DS4.TraitAura", + }, + + /** + * Define the set of combat values an actor has + */ + combatValues: { + hitPoints: "DS4.CombatValuesHitPoints", + defense: "DS4.CombatValuesDefense", + initiative: "DS4.CombatValuesInitiative", + movement: "DS4.CombatValuesMovement", + meleeAttack: "DS4.CombatValuesMeleeAttack", + rangedAttack: "DS4.CombatValuesRangedAttack", + spellcasting: "DS4.CombatValuesSpellcasting", + targetedSpellcasting: "DS4.CombatValuesTargetedSpellcasting", + }, + + /** + * Define the base info of a character + */ + characterBaseInfo: { + race: "DS4.CharacterBaseInfoRace", + class: "DS4.CharacterBaseInfoClass", + heroClass: "DS4.CharacterBaseInfoHeroClass", + culture: "DS4.CharacterBaseInfoCulture", + }, + + /** + * Define the progression info of a character + */ + characterProgression: { + level: "DS4.CharacterProgressionLevel", + experiencePoints: "DS4.CharacterProgressionExperiencePoints", + talentPoints: "DS4.CharacterProgressionTalentPoints", + progressPoints: "DS4.CharacterProgressionProgressPoints", + }, + + /** + * Define the language info of a character + */ + characterLanguage: { + languages: "DS4.CharacterLanguageLanguages", + alphabets: "DS4.CharacterLanguageAlphabets", + }, + + /** + * Define the profile info of a character + */ + characterProfile: { + biography: "DS4.CharacterProfileBiography", + gender: "DS4.CharacterProfileGender", + birthday: "DS4.CharacterProfileBirthday", + birthplace: "DS4.CharacterProfileBirthplace", + age: "DS4.CharacterProfileAge", + height: "DS4.CharacterProfileHeight", + hairColor: "DS4.CharacterProfileHairColor", + weight: "DS4.CharacterProfileWeight", + eyeColor: "DS4.CharacterProfileEyeColor", + specialCharacteristics: "DS4.CharacterProfileSpecialCharacteristics", + }, + /** + * Define currency elements of a character + */ + characterCurrency: { + gold: "DS4.CharacterCurrencyGold", + silver: "DS4.CharacterCurrencySilver", + copper: "DS4.CharacterCurrencyCopper", + }, + + /** + * Define the different creature types a creature can be + */ + creatureTypes: { + animal: "DS4.CreatureTypeAnimal", + construct: "DS4.CreatureTypeConstruct", + humanoid: "DS4.CreatureTypeHumanoid", + magicalEntity: "DS4.CreatureTypeMagicalEntity", + plantBeing: "DS4.CreatureTypePlantBeing", + undead: "DS4.CreatureTypeUndead", + }, + + /** + * Define the different size categories creatures fall into + */ + creatureSizeCategories: { + tiny: "DS4.CreatureSizeCategoryTiny", + small: "DS4.CreatureSizeCategorySmall", + normal: "DS4.CreatureSizeCategoryNormal", + large: "DS4.CreatureSizeCategoryLarge", + huge: "DS4.CreatureSizeCategoryHuge", + colossal: "DS4.CreatureSizeCategoryColossal", + }, + + /** + * Define the base info of a creature + */ + creatureBaseInfo: { + loot: "DS4.CreatureBaseInfoLoot", + foeFactor: "DS4.CreatureBaseInfoFoeFactor", + creatureType: "DS4.CreatureBaseInfoCreatureType", + sizeCategory: "DS4.CreatureBaseInfoSizeCategory", + experiencePoints: "DS4.CreatureBaseInfoExperiencePoints", + description: "DS4.CreatureBaseInfoDescription", + }, + + /** + * Define translations for available distance units + */ + distanceUnits: { + meter: "DS4.UnitMeters", + kilometer: "DS4.UnitKilometers", + custom: "DS4.UnitCustom", + }, + /** + * Define abbreviations for available distance units + */ + distanceUnitsAbbr: { + meter: "DS4.UnitMetersAbbr", + kilometer: "DS4.UnitKilometersAbbr", + custom: "DS4.UnitCustomAbbr", + }, + + /** + * Define translations for available distance units + */ + temporalUnits: { + rounds: "DS4.UnitRounds", + minutes: "DS4.UnitMinutes", + hours: "DS4.UnitHours", + days: "DS4.UnitDays", + custom: "DS4.UnitCustom", + }, + + /** + * Define abbreviations for available units + */ + temporalUnitsAbbr: { + rounds: "DS4.UnitRoundsAbbr", + minutes: "DS4.UnitMinutesAbbr", + hours: "DS4.UnitHoursAbbr", + days: "DS4.UnitDaysAbbr", + custom: "DS4.UnitCustomAbbr", + }, + + /** + * Define localization strings for Chat Visibility + */ + chatVisibilities: { + roll: "DS4.ChatVisibilityRoll", + gmroll: "DS4.ChatVisibilityGmRoll", + blindroll: "DS4.ChatVisibilityBlindRoll", + selfroll: "DS4.ChatVisibilitySelfRoll", + }, }, /** @@ -34,182 +315,6 @@ export const DS4 = { targetedSpellcasting: "systems/ds4/assets/icons/official/combat-values/targeted-spellcasting.png", }, - /** - * Define the set of item availabilties - */ - itemAvailabilities: { - unset: "DS4.ItemAvailabilityUnset", - hamlet: "DS4.ItemAvailabilityHamlet", - village: "DS4.ItemAvailabilityVilage", - city: "DS4.ItemAvailabilityCity", - elves: "DS4.ItemAvailabilityElves", - dwarves: "DS4.ItemAvailabilityDwarves", - nowhere: "DS4.ItemAvailabilityNowhere", - }, - - /** - * Define the set of item types - */ - itemTypes: { - weapon: "DS4.ItemTypeWeapon", - armor: "DS4.ItemTypeArmor", - shield: "DS4.ItemTypeShield", - spell: "DS4.ItemTypeSpell", - trinket: "DS4.ItemTypeTrinket", - equipment: "DS4.ItemTypeEquipment", - talent: "DS4.ItemTypeTalent", - racialAbility: "DS4.ItemTypeRacialAbility", - language: "DS4.ItemTypeLanguage", - alphabet: "DS4.ItemTypeAlphabet", - specialCreatureAbility: "DS4.ItemTypeSpecialCreatureAbility", - }, - - /** - * Define the set of armor types, a character may only wear one item of each at any given time - */ - armorTypes: { - body: "DS4.ArmorTypeBody", - helmet: "DS4.ArmorTypeHelmet", - vambrace: "DS4.ArmorTypeVambrace", - greaves: "DS4.ArmorTypeGreaves", - vambraceGreaves: "DS4.ArmorTypeVambraceGreaves", - }, - - /** - * Define abbreviations for the armor types - */ - armorTypesAbbr: { - body: "DS4.ArmorTypeBodyAbbr", - helmet: "DS4.ArmorTypeHelmetAbbr", - vambrace: "DS4.ArmorTypeVambraceAbbr", - greaves: "DS4.ArmorTypeGreavesAbbr", - vambraceGreaves: "DS4.ArmorTypeVambraceGreavesAbbr", - }, - - /** - * Define the set of armor materials, used to determine if a characer may wear the armor without additional penalties - */ - armorMaterialTypes: { - cloth: "DS4.ArmorMaterialTypeCloth", - leather: "DS4.ArmorMaterialTypeLeather", - chain: "DS4.ArmorMaterialTypeChain", - plate: "DS4.ArmorMaterialTypePlate", - }, - - /** - * Define the abbreviations of armor materials - */ - armorMaterialTypesAbbr: { - cloth: "DS4.ArmorMaterialTypeClothAbbr", - leather: "DS4.ArmorMaterialTypeLeatherAbbr", - chain: "DS4.ArmorMaterialTypeChainAbbr", - plate: "DS4.ArmorMaterialTypePlateAbbr", - }, - - spellTypes: { - spellcasting: "DS4.SpellTypeSpellcasting", - targetedSpellcasting: "DS4.SpellTypeTargetedSpellcasting", - }, - - spellCategories: { - healing: "DS4.SpellCategoryHealing", - fire: "DS4.SpellCategoryFire", - ice: "DS4.SpellCategoryIce", - light: "DS4.SpellCategoryLight", - darkness: "DS4.SpellCategoryDarkness", - mindAffecting: "DS4.SpellCategoryMindAffecting", - electricity: "DS4.SpellCategoryElectricity", - none: "DS4.SpellCategoryNone", - unset: "DS4.SpellCategoryUnset", - }, - - /** - * Define the set of actor types - */ - actorTypes: { - character: "DS4.ActorTypeCharacter", - creature: "DS4.ActorTypeCreature", - }, - - /** - * Define the set of attributes an actor has - */ - attributes: { - body: "DS4.AttributeBody", - mobility: "DS4.AttributeMobility", - mind: "DS4.AttributeMind", - }, - - /** - * Define the set of traits an actor has - */ - traits: { - strength: "DS4.TraitStrength", - agility: "DS4.TraitAgility", - intellect: "DS4.TraitIntellect", - constitution: "DS4.TraitConstitution", - dexterity: "DS4.TraitDexterity", - aura: "DS4.TraitAura", - }, - - /** - * Define the set of combat values an actor has - */ - combatValues: { - hitPoints: "DS4.CombatValuesHitPoints", - defense: "DS4.CombatValuesDefense", - initiative: "DS4.CombatValuesInitiative", - movement: "DS4.CombatValuesMovement", - meleeAttack: "DS4.CombatValuesMeleeAttack", - rangedAttack: "DS4.CombatValuesRangedAttack", - spellcasting: "DS4.CombatValuesSpellcasting", - targetedSpellcasting: "DS4.CombatValuesTargetedSpellcasting", - }, - - /** - * Define the base info of a character - */ - characterBaseInfo: { - race: "DS4.CharacterBaseInfoRace", - class: "DS4.CharacterBaseInfoClass", - heroClass: "DS4.CharacterBaseInfoHeroClass", - culture: "DS4.CharacterBaseInfoCulture", - }, - - /** - * Define the progression info of a character - */ - characterProgression: { - level: "DS4.CharacterProgressionLevel", - experiencePoints: "DS4.CharacterProgressionExperiencePoints", - talentPoints: "DS4.CharacterProgressionTalentPoints", - progressPoints: "DS4.CharacterProgressionProgressPoints", - }, - - /** - * Define the language info of a character - */ - characterLanguage: { - languages: "DS4.CharacterLanguageLanguages", - alphabets: "DS4.CharacterLanguageAlphabets", - }, - - /** - * Define the profile info of a character - */ - characterProfile: { - biography: "DS4.CharacterProfileBiography", - gender: "DS4.CharacterProfileGender", - birthday: "DS4.CharacterProfileBirthday", - birthplace: "DS4.CharacterProfileBirthplace", - age: "DS4.CharacterProfileAge", - height: "DS4.CharacterProfileHeight", - hairColor: "DS4.CharacterProfileHairColor", - weight: "DS4.CharacterProfileWeight", - eyeColor: "DS4.CharacterProfileEyeColor", - specialCharacteristics: "DS4.CharacterProfileSpecialCharacteristics", - }, - /** * Define the profile info types for handlebars of a character */ @@ -225,98 +330,4 @@ export const DS4 = { eyeColor: "String", specialCharacteristics: "String", }, - - /** - * Define currency elements of a character - */ - characterCurrency: { - gold: "DS4.CharacterCurrencyGold", - silver: "DS4.CharacterCurrencySilver", - copper: "DS4.CharacterCurrencyCopper", - }, - - /** - * Define the different creature types a creature can be - */ - creatureTypes: { - animal: "DS4.CreatureTypeAnimal", - construct: "DS4.CreatureTypeConstruct", - humanoid: "DS4.CreatureTypeHumanoid", - magicalEntity: "DS4.CreatureTypeMagicalEntity", - plantBeing: "DS4.CreatureTypePlantBeing", - undead: "DS4.CreatureTypeUndead", - }, - - /** - * Define the different size categories creatures fall into - */ - creatureSizeCategories: { - tiny: "DS4.CreatureSizeCategoryTiny", - small: "DS4.CreatureSizeCategorySmall", - normal: "DS4.CreatureSizeCategoryNormal", - large: "DS4.CreatureSizeCategoryLarge", - huge: "DS4.CreatureSizeCategoryHuge", - colossal: "DS4.CreatureSizeCategoryColossal", - }, - - /** - * Define the base info of a creature - */ - creatureBaseInfo: { - loot: "DS4.CreatureBaseInfoLoot", - foeFactor: "DS4.CreatureBaseInfoFoeFactor", - creatureType: "DS4.CreatureBaseInfoCreatureType", - sizeCategory: "DS4.CreatureBaseInfoSizeCategory", - experiencePoints: "DS4.CreatureBaseInfoExperiencePoints", - description: "DS4.CreatureBaseInfoDescription", - }, - - /** - * Define translations for available distance units - */ - distanceUnits: { - meter: "DS4.UnitMeters", - kilometer: "DS4.UnitKilometers", - custom: "DS4.UnitCustom", - }, - /** - * Define abbreviations for available distance units - */ - distanceUnitsAbbr: { - meter: "DS4.UnitMetersAbbr", - kilometer: "DS4.UnitKilometersAbbr", - custom: "DS4.UnitCustomAbbr", - }, - - /** - * Define translations for available distance units - */ - temporalUnits: { - rounds: "DS4.UnitRounds", - minutes: "DS4.UnitMinutes", - hours: "DS4.UnitHours", - days: "DS4.UnitDays", - custom: "DS4.UnitCustom", - }, - - /** - * Define abbreviations for available units - */ - temporalUnitsAbbr: { - rounds: "DS4.UnitRoundsAbbr", - minutes: "DS4.UnitMinutesAbbr", - hours: "DS4.UnitHoursAbbr", - days: "DS4.UnitDaysAbbr", - custom: "DS4.UnitCustomAbbr", - }, - - /** - * Define localization strings for Chat Visibility - */ - chatVisibilities: { - roll: "DS4.ChatVisibilityRoll", - gmroll: "DS4.ChatVisibilityGmRoll", - blindroll: "DS4.ChatVisibilityBlindRoll", - selfroll: "DS4.ChatVisibilitySelfRoll", - }, }; diff --git a/src/module/ds4.ts b/src/module/ds4.ts index 81115a4c..a2f6ff2f 100644 --- a/src/module/ds4.ts +++ b/src/module/ds4.ts @@ -29,8 +29,8 @@ Hooks.once("init", async function () { CONFIG.Item.entityClass = DS4Item as typeof Item; // Define localized type labels - CONFIG.Actor.typeLabels = DS4.actorTypes; - CONFIG.Item.typeLabels = DS4.itemTypes; + CONFIG.Actor.typeLabels = DS4.i18nKeys.actorTypes; + CONFIG.Item.typeLabels = DS4.i18nKeys.itemTypes; // Configure Dice CONFIG.Dice.types = [Die, DS4Check]; @@ -84,46 +84,16 @@ async function registerHandlebarsPartials() { * This function runs after game data has been requested and loaded from the servers, so entities exist */ Hooks.once("setup", function () { - // Localize CONFIG objects once up-front - const toLocalize = [ - "attackTypes", - "itemAvailabilities", - "itemTypes", - "armorTypes", - "armorTypesAbbr", - "armorMaterialTypes", - "armorMaterialTypesAbbr", - "armorMaterialTypes", - "spellTypes", - "spellCategories", - "attributes", - "traits", - "combatValues", - "characterBaseInfo", - "characterProgression", - "characterLanguage", - "characterProfile", - "characterCurrency", - "creatureTypes", - "creatureSizeCategories", - "creatureBaseInfo", - "temporalUnits", - "temporalUnitsAbbr", - "distanceUnits", - "distanceUnitsAbbr", - "chatVisibilities", - ]; - // Exclude some from sorting where the default order matters const noSort = ["attributes", "traits", "combatValues", "creatureSizeCategories"]; // Localize and sort CONFIG objects - for (const o of toLocalize) { - const localized = Object.entries(CONFIG.DS4[o]).map((e) => { + for (const o of Object.keys(CONFIG.DS4.i18nKeys)) { + const localized = Object.entries(CONFIG.DS4.i18nKeys[o]).map((e) => { return [e[0], game.i18n.localize(e[1] as string)]; }); if (!noSort.includes(o)) localized.sort((a, b) => a[1].localeCompare(b[1])); - CONFIG.DS4[o] = localized.reduce((obj, e) => { + CONFIG.DS4.i18n[o] = localized.reduce((obj, e) => { obj[e[0]] = e[1]; return obj; }, {}); diff --git a/src/module/item/item-data.ts b/src/module/item/item-data.ts index d7467f8a..63951e46 100644 --- a/src/module/item/item-data.ts +++ b/src/module/item/item-data.ts @@ -1,7 +1,7 @@ import { ModifiableData } from "../common/common-data"; import { DS4 } from "../config"; -export type ItemType = keyof typeof DS4.itemTypes; +export type ItemType = keyof typeof DS4.i18nKeys.itemTypes; export type DS4ItemDataType = | DS4Weapon diff --git a/src/templates/actor/character-sheet.hbs b/src/templates/actor/character-sheet.hbs index 0fb538f9..d63758e3 100644 --- a/src/templates/actor/character-sheet.hbs +++ b/src/templates/actor/character-sheet.hbs @@ -13,20 +13,20 @@
    + for="data.baseInfo.race">{{config.i18n.characterBaseInfo.race}}
    + for="data.baseInfo.culture">{{config.i18n.characterBaseInfo.culture}}
    + for="data.progression.progressPoints.used">{{config.i18n.characterProgression.progressPoints}}
    + for="data.progression.talentPoints.used">{{config.i18n.characterProgression.talentPoints}}
    + for="data.baseInfo.class">{{config.i18n.characterBaseInfo.class}}
    + for="data.baseInfo.heroClass">{{config.i18n.characterBaseInfo.heroClass}} diff --git a/src/templates/actor/creature-sheet.hbs b/src/templates/actor/creature-sheet.hbs index 7571eaba..424dbcc2 100644 --- a/src/templates/actor/creature-sheet.hbs +++ b/src/templates/actor/creature-sheet.hbs @@ -6,10 +6,10 @@

    - +
    + for="data.baseInfo.foeFactor">{{config.i18n.creatureBaseInfo.foeFactor}}
    - +
    diff --git a/src/templates/actor/partials/attributes-traits.hbs b/src/templates/actor/partials/attributes-traits.hbs index 14fece65..9c12a6ae 100644 --- a/src/templates/actor/partials/attributes-traits.hbs +++ b/src/templates/actor/partials/attributes-traits.hbs @@ -42,11 +42,11 @@ {{!-- ======================================================================== --}}
    - {{#each config.attributes as |attribute-label attribute-key|}} + {{#each config.i18n.attributes as |attribute-label attribute-key|}} {{> attribute attribute-label=attribute-label attribute-key=attribute-key attribute-data=(lookup ../data.attributes attribute-key)}} {{/each}} - {{#each config.traits as |trait-label trait-key|}} + {{#each config.i18n.traits as |trait-label trait-key|}} {{> trait trait-label=trait-label trait-key=trait-key trait-data=(lookup ../data.traits trait-key)}} {{/each}}
    diff --git a/src/templates/actor/partials/character-inventory.hbs b/src/templates/actor/partials/character-inventory.hbs index 19a4009d..b27fff63 100644 --- a/src/templates/actor/partials/character-inventory.hbs +++ b/src/templates/actor/partials/character-inventory.hbs @@ -4,13 +4,13 @@

    {{localize 'DS4.CharacterCurrency'}}

    1. - + - + - +
    2. diff --git a/src/templates/actor/partials/character-progression.hbs b/src/templates/actor/partials/character-progression.hbs index fd0a3932..e890a024 100644 --- a/src/templates/actor/partials/character-progression.hbs +++ b/src/templates/actor/partials/character-progression.hbs @@ -1,6 +1,6 @@
      -

      +

      + for="data.progression.experiencePoints">{{config.i18n.characterProgression.experiencePoints}}

      - {{#each config.combatValues as |combat-value-label combat-value-key|}} + {{#each config.i18n.combatValues as |combat-value-label combat-value-key|}} {{> combat-value combat-value-key=combat-value-key combat-value-data=(lookup ../data.combatValues combat-value-key)}} {{/each}} diff --git a/src/templates/actor/partials/items-overview.hbs b/src/templates/actor/partials/items-overview.hbs index 55b34411..f8ca7d8f 100644 --- a/src/templates/actor/partials/items-overview.hbs +++ b/src/templates/actor/partials/items-overview.hbs @@ -111,7 +111,7 @@ {{#> itemListEntry item=item}}
      + title="{{lookup ../../config.i18n.attackTypes item.data.data.attackType}}" width="24" height="24" />
      {{ item.data.data.weaponBonus}}
      {{ item.data.data.opponentDefense}}
      @@ -135,11 +135,11 @@ {{/itemListHeader}} {{#each itemsByType.armor as |item id|}} {{#> itemListEntry item=item }} -
      - {{lookup ../../config.armorMaterialTypesAbbr item.data.data.armorMaterialType}} +
      + {{lookup ../../config.i18n.armorMaterialTypesAbbr item.data.data.armorMaterialType}}
      -
      - {{lookup ../../config.armorTypesAbbr item.data.data.armorType}} +
      + {{lookup ../../config.i18n.armorTypesAbbr item.data.data.armorType}}
      {{ item.data.data.armorValue}}
      {{/itemListEntry}} diff --git a/src/templates/actor/partials/profile.hbs b/src/templates/actor/partials/profile.hbs index be95eeb5..2a520d8b 100644 --- a/src/templates/actor/partials/profile.hbs +++ b/src/templates/actor/partials/profile.hbs @@ -4,10 +4,10 @@ {{#if (ne profile-data-key 'biography')}}
      + data-dtype="{{lookup ../config.i18n.characterProfileDTypes profile-data-key}}" />
      {{/if}} {{/each}} diff --git a/src/templates/actor/partials/spells-overview.hbs b/src/templates/actor/partials/spells-overview.hbs index 8bcd33e3..f82237ff 100644 --- a/src/templates/actor/partials/spells-overview.hbs +++ b/src/templates/actor/partials/spells-overview.hbs @@ -23,11 +23,11 @@ !-- directly handing over the latter two. --}} {{#*inline "temporalUnit"}} -{{> unit unitNames=config.temporalUnits unitAbbrs=config.temporalUnitsAbbr unitDatum=unitDatum localizationString=localizationString}} +{{> unit unitNames=config.i18n.temporalUnits unitAbbrs=config.i18n.temporalUnitsAbbr unitDatum=unitDatum localizationString=localizationString}} {{/inline}} {{#*inline "distanceUnit"}} -{{> unit unitNames=config.distanceUnits unitAbbrs=config.distanceUnitsAbbr unitDatum=unitDatum localizationString=localizationString}} +{{> unit unitNames=config.i18n.distanceUnits unitAbbrs=config.i18n.distanceUnitsAbbr unitDatum=unitDatum localizationString=localizationString}} {{/inline}} @@ -72,7 +72,7 @@ {{!-- spell type --}}
      + title="{{lookup ../config.i18n.spellTypes item.data.data.spellType}}" width="24" height="24" />
      {{!-- spell bonus --}} {{localize "DS4.ArmorType"}} {{#select data.armorMaterialType}} - {{#each config.armorMaterialTypes as |value key|}} + {{#each config.i18n.armorMaterialTypes as |value key|}} {{/each}} {{/select}} diff --git a/src/templates/item/partials/details.hbs b/src/templates/item/partials/details.hbs index 0408641a..69f7526a 100644 --- a/src/templates/item/partials/details.hbs +++ b/src/templates/item/partials/details.hbs @@ -11,7 +11,7 @@ -

      {{localize (lookup config.itemTypes item.type)}}

      +

      {{lookup config.i18n.itemTypes item.type}}

      {{> @partial-block}}
      \ No newline at end of file diff --git a/src/templates/item/spell-sheet.hbs b/src/templates/item/spell-sheet.hbs index 4e180755..4fdd6dc1 100644 --- a/src/templates/item/spell-sheet.hbs +++ b/src/templates/item/spell-sheet.hbs @@ -12,9 +12,9 @@ @@ -33,7 +33,7 @@ {{#select data.spellCategory}} - {{#each config.spellCategories as |value key|}} + {{#each config.i18n.spellCategories as |value key|}} {{/each}} {{/select}} diff --git a/src/templates/item/weapon-sheet.hbs b/src/templates/item/weapon-sheet.hbs index b92bf97f..65005984 100644 --- a/src/templates/item/weapon-sheet.hbs +++ b/src/templates/item/weapon-sheet.hbs @@ -5,7 +5,7 @@ {{#each rollModes as |rollMode|}} - + {{/each}} From 62ab89f83bb4d951366c223b44a784635bd2b638 Mon Sep 17 00:00:00 2001 From: Gesina Schwalbe Date: Sun, 24 Jan 2021 17:56:32 +0100 Subject: [PATCH 11/15] moved icon mappings in CONFIG.DS4.icons --- src/module/config.ts | 29 +++++++++++-------- .../actor/partials/items-overview.hbs | 2 +- .../actor/partials/spells-overview.hbs | 2 +- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/src/module/config.ts b/src/module/config.ts index 5654c189..0f1bd1e0 100644 --- a/src/module/config.ts +++ b/src/module/config.ts @@ -299,20 +299,25 @@ export const DS4 = { }, /** - * Define the file paths to icon images + * A dictionary of dictionaries mapping keys to icon file paths. */ - attackTypesIcons: { - melee: "systems/ds4/assets/icons/official/combat-values/melee-attack.png", - meleeRanged: "systems/ds4/assets/icons/official/combat-values/melee-ranged-attack.png", - ranged: "systems/ds4/assets/icons/official/combat-values/ranged-attack.png", - }, + icons: { + /** + * Define the file paths to icon images + */ + attackTypes: { + melee: "systems/ds4/assets/icons/official/combat-values/melee-attack.png", + meleeRanged: "systems/ds4/assets/icons/official/combat-values/melee-ranged-attack.png", + ranged: "systems/ds4/assets/icons/official/combat-values/ranged-attack.png", + }, - /** - * Define the file paths to icon images - */ - spellTypesIcons: { - spellcasting: "systems/ds4/assets/icons/official/combat-values/spellcasting.png", - targetedSpellcasting: "systems/ds4/assets/icons/official/combat-values/targeted-spellcasting.png", + /** + * Define the file paths to icon images + */ + spellTypes: { + spellcasting: "systems/ds4/assets/icons/official/combat-values/spellcasting.png", + targetedSpellcasting: "systems/ds4/assets/icons/official/combat-values/targeted-spellcasting.png", + }, }, /** diff --git a/src/templates/actor/partials/items-overview.hbs b/src/templates/actor/partials/items-overview.hbs index f8ca7d8f..b7d5fbf7 100644 --- a/src/templates/actor/partials/items-overview.hbs +++ b/src/templates/actor/partials/items-overview.hbs @@ -110,7 +110,7 @@ {{#each itemsByType.weapon as |item id|}} {{#> itemListEntry item=item}}
      -
      {{ item.data.data.weaponBonus}}
      diff --git a/src/templates/actor/partials/spells-overview.hbs b/src/templates/actor/partials/spells-overview.hbs index f82237ff..819cb45a 100644 --- a/src/templates/actor/partials/spells-overview.hbs +++ b/src/templates/actor/partials/spells-overview.hbs @@ -71,7 +71,7 @@ data-property="name" title="{{localize 'DS4.ItemName'}}" /> {{!-- spell type --}}
      -
      {{!-- spell bonus --}} From f4f7c471ac880b12d90f2e28a9b213b0b17fc146 Mon Sep 17 00:00:00 2001 From: ghost Date: Mon, 25 Jan 2021 00:35:58 +0000 Subject: [PATCH 12/15] release version 0.2.1 --- package-lock.json | 2 +- package.json | 2 +- src/system.json | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 70e4ebaa..d04c3937 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "test", - "version": "0.2.0", + "version": "0.2.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 1ab23503..02fa5092 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "private": true, "name": "test", "description": "An implementation of the Dungeonslayers 4 game system for Foundry Virtual Tabletop.", - "version": "0.2.0", + "version": "0.2.1", "license": "MIT", "homepage": "https://git.f3l.de/dungeonslayers/ds4", "repository": { diff --git a/src/system.json b/src/system.json index badc3e57..369b033f 100644 --- a/src/system.json +++ b/src/system.json @@ -2,7 +2,7 @@ "name": "ds4", "title": "Dungeonslayers 4", "description": "The Dungeonslayers 4 system for FoundryVTT. Dungeonslayers (© Christian Kennig) is licensed under CC BY-NC-SA 3.0 (https://creativecommons.org/licenses/by-nc-sa/3.0/de/deed.en).", - "version": "0.2.0", + "version": "0.2.1", "minimumCoreVersion": "0.7.9", "compatibleCoreVersion": "0.7.9", "templateVersion": 2, @@ -43,7 +43,7 @@ "primaryTokenAttribute": "combatValues.hitPoints", "url": "https://git.f3l.de/dungeonslayers/ds4", "manifest": "https://git.f3l.de/dungeonslayers/ds4/-/raw/latest/src/system.json?inline=false", - "download": "https://git.f3l.de/dungeonslayers/ds4/-/jobs/artifacts/0.2.0/download?job=build", + "download": "https://git.f3l.de/dungeonslayers/ds4/-/jobs/artifacts/0.2.1/download?job=build", "license": "MIT", "initiative": "@combatValues.initiative.total" } From 21706b7e130f5a03343d42c165fa382f689ff91c Mon Sep 17 00:00:00 2001 From: Johannes Loher Date: Mon, 25 Jan 2021 14:16:14 +0100 Subject: [PATCH 13/15] fix spelling mistakes in README --- README.md | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index be9e3eb5..ea6aae88 100644 --- a/README.md +++ b/README.md @@ -3,9 +3,8 @@ An implementation of the Dungeonslayers 4 game system for [Foundry Virtual Tabletop](http://foundryvtt.com). -This system provides character sheet support for Actors and Items and mechanical -support for dice and rules necessary to -play games of Dungeponslayers 4. +This system provides sheet support for Actors and Items and mechanical support +for dice and rules necessary to play games of Dungeonslayers 4. ## Installation @@ -17,7 +16,7 @@ https://git.f3l.de/dungeonslayers/ds4/-/raw/latest/src/system.json?inline=false ## Development -### Prerequisits +### Prerequisites In order to build this system, recent versions of `node` and `npm` are required. We recommend using the latest lts version of `node`, which is `v14.15.4` at the @@ -83,16 +82,18 @@ npm test ## Contributing Code and content contributions are accepted. Please feel free to submit issues -to the issue tracker or submit merge requests for code changes. To create an issue send a mail to [git+dungeonslayers-ds4-155-issue-@git.f3l.de](mailto:git+dungeonslayers-ds4-155-issue-@git.f3l.de). +to the issue tracker or submit merge requests for code changes. To create an +issue, send a mail to [git+dungeonslayers-ds4-155-issue-@git.f3l.de](mailto:git+dungeonslayers-ds4-155-issue-@git.f3l.de). ## Licensing -[Dungeonslayers](http://dungeonslayers.de/) (© Christian Kennig) is licensed under [CC BY-NC-SA 3.0](https://creativecommons.org/licenses/by-nc-sa/3.0/de/deed.en). +[Dungeonslayers](http://dungeonslayers.de/) (© Christian Kennig) is licensed +under [CC BY-NC-SA 3.0](https://creativecommons.org/licenses/by-nc-sa/3.0/de/deed.en). -The icons in [src/assets/icons/official](src/assets/icons/official) are slightly modifed -versions of original Dungeonslayers icons, which have also been published under -CC BY-NC-SA 3.0. Hence the modified icons are also published under this -license. A copy of this license can be found under +The icons in [src/assets/icons/official](src/assets/icons/official) are slightly +modified versions of original Dungeonslayers icons, which have also been +published under CC BY-NC-SA 3.0. Hence the modified icons are also published +under this license. A copy of this license can be found under [src/assets/icons/official/LICENSE](src/assets/icons/official/LICENSE). Similarly, the compendium packs found in [src/packs](src/packs) are based on From f5117623658f4e38bd1f739c3747f8ebed8db801 Mon Sep 17 00:00:00 2001 From: Gesina Schwalbe Date: Tue, 26 Jan 2021 20:30:53 +0100 Subject: [PATCH 14/15] Apply 1 suggestion(s) to 1 file(s) --- src/templates/actor/character-sheet.hbs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/templates/actor/character-sheet.hbs b/src/templates/actor/character-sheet.hbs index 75be93ff..0d0382c3 100644 --- a/src/templates/actor/character-sheet.hbs +++ b/src/templates/actor/character-sheet.hbs @@ -84,6 +84,8 @@ {{localize 'DS4.HeadingBiography'}} + + {{!-- Sheet Body (remove indentation to avoid annoying Handlebars auto-indent) --}}
      {{!-- Items Tab --}} @@ -104,4 +106,6 @@ editable=editable}}
      + + From 0b70bbf9b90987e34df756fd2742e4586fcc144f Mon Sep 17 00:00:00 2001 From: Gesina Schwalbe Date: Tue, 26 Jan 2021 20:47:28 +0100 Subject: [PATCH 15/15] merged i18n and i18nKeys --- src/module/config.ts | 11 +++-------- src/module/ds4.ts | 8 ++++---- src/module/item/item-data.ts | 2 +- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/module/config.ts b/src/module/config.ts index 0f1bd1e0..d023fc05 100644 --- a/src/module/config.ts +++ b/src/module/config.ts @@ -9,16 +9,11 @@ export const DS4 = { =============================================================================================`, /** - * A dictionary of dictionaries each mapping keys to localized strings. - * To be filled with the localizations derived from i18nKeys. + * A dictionary of dictionaries each mapping keys to localized strings + * resp. their localization keys. + * The localization is assumed to take place on each reload. */ i18n: { - // to be filled with the localized mappings from i18nKeys - }, - /** - * A dictionary of dictionaries each mapping keys to localization keys. - */ - i18nKeys: { /** * Define the set of acttack types that can be performed with weapon items */ diff --git a/src/module/ds4.ts b/src/module/ds4.ts index a2f6ff2f..63a2dec4 100644 --- a/src/module/ds4.ts +++ b/src/module/ds4.ts @@ -29,8 +29,8 @@ Hooks.once("init", async function () { CONFIG.Item.entityClass = DS4Item as typeof Item; // Define localized type labels - CONFIG.Actor.typeLabels = DS4.i18nKeys.actorTypes; - CONFIG.Item.typeLabels = DS4.i18nKeys.itemTypes; + CONFIG.Actor.typeLabels = DS4.i18n.actorTypes; + CONFIG.Item.typeLabels = DS4.i18n.itemTypes; // Configure Dice CONFIG.Dice.types = [Die, DS4Check]; @@ -88,8 +88,8 @@ Hooks.once("setup", function () { const noSort = ["attributes", "traits", "combatValues", "creatureSizeCategories"]; // Localize and sort CONFIG objects - for (const o of Object.keys(CONFIG.DS4.i18nKeys)) { - const localized = Object.entries(CONFIG.DS4.i18nKeys[o]).map((e) => { + for (const o of Object.keys(CONFIG.DS4.i18n)) { + const localized = Object.entries(CONFIG.DS4.i18n[o]).map((e) => { return [e[0], game.i18n.localize(e[1] as string)]; }); if (!noSort.includes(o)) localized.sort((a, b) => a[1].localeCompare(b[1])); diff --git a/src/module/item/item-data.ts b/src/module/item/item-data.ts index 63951e46..b1cc26ef 100644 --- a/src/module/item/item-data.ts +++ b/src/module/item/item-data.ts @@ -1,7 +1,7 @@ import { ModifiableData } from "../common/common-data"; import { DS4 } from "../config"; -export type ItemType = keyof typeof DS4.i18nKeys.itemTypes; +export type ItemType = keyof typeof DS4.i18n.itemTypes; export type DS4ItemDataType = | DS4Weapon