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 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/lang/de.json b/src/lang/de.json index f81a5f29..c1ea7a27 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", @@ -12,11 +15,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 +64,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 +128,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", @@ -144,9 +147,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", @@ -193,7 +196,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", diff --git a/src/lang/en.json b/src/lang/en.json index ee1927ee..6cd7c33a 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", @@ -144,9 +147,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", diff --git a/src/module/config.ts b/src/module/config.ts index cd927290..d023fc05 100644 --- a/src/module/config.ts +++ b/src/module/config.ts @@ -9,205 +9,310 @@ 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 + * resp. their localization keys. + * The localization is assumed to take place on each reload. */ - attackTypes: { - melee: "DS4.AttackTypeMelee", - ranged: "DS4.AttackTypeRanged", - meleeRanged: "DS4.AttackTypeMeleeRanged", + i18n: { + /** + * 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", + }, }, /** - * 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 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 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", + }, }, /** @@ -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..fc3a64e3 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.i18n.actorTypes; + CONFIG.Item.typeLabels = DS4.i18n.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.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])); - CONFIG.DS4[o] = localized.reduce((obj, e) => { + CONFIG.DS4.i18n[o] = localized.reduce((obj, e) => { obj[e[0]] = e[1]; return obj; }, {}); @@ -133,3 +103,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/module/item/item-data.ts b/src/module/item/item-data.ts index d7467f8a..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.itemTypes; +export type ItemType = keyof typeof DS4.i18n.itemTypes; export type DS4ItemDataType = | DS4Weapon 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" } diff --git a/src/templates/actor/character-sheet.hbs b/src/templates/actor/character-sheet.hbs index 0fb538f9..0d252d9b 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}} @@ -84,24 +84,28 @@ {{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}} - {{!-- 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/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..681a9a7d 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}} @@ -110,8 +109,8 @@ {{#each itemsByType.weapon as |item id|}} {{#> itemListEntry item=item}}
    - +
    {{ item.data.data.weaponBonus}}
    {{ item.data.data.opponentDefense}}
    @@ -135,11 +134,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/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. --}}
    - - + +
    diff --git a/src/templates/actor/partials/profile.hbs b/src/templates/actor/partials/profile.hbs index be95eeb5..06647b39 100644 --- a/src/templates/actor/partials/profile.hbs +++ b/src/templates/actor/partials/profile.hbs @@ -1,15 +1,21 @@
    {{#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'))}}
    + data-dtype="{{lookup ../config.i18n.characterProfileDTypes profile-data-key}}" />
    {{/if}} {{/each}} +
    + + +
    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..d9d72357 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}} @@ -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}} @@ -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|}}
  • @@ -71,8 +71,8 @@ data-property="name" title="{{localize 'DS4.ItemName'}}" /> {{!-- spell type --}}
    - +
    {{!-- spell bonus --}} {{/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}} diff --git a/src/templates/item/armor-sheet.hbs b/src/templates/item/armor-sheet.hbs index 5fd59feb..6c8e9540 100644 --- a/src/templates/item/armor-sheet.hbs +++ b/src/templates/item/armor-sheet.hbs @@ -5,7 +5,7 @@ {{#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 @@ - + @@ -10,7 +10,7 @@