From 6820ce7c00c6e6daeea876b2141d82de0ee7d278 Mon Sep 17 00:00:00 2001 From: Johannes Loher Date: Sat, 9 Jan 2021 22:51:46 +0100 Subject: [PATCH 01/15] Add creature actor to config, i18n, template.json, types --- src/lang/de.json | 53 ++++-- src/lang/en.json | 53 ++++-- src/module/actor/actor-data.ts | 70 +++++--- src/module/config.ts | 78 +++++--- src/module/ds4.ts | 8 +- src/template.json | 169 ++++++++++-------- src/templates/actor/actor-sheet.hbs | 12 +- .../actor/partials/character-progression.hbs | 4 +- src/templates/actor/partials/profile.hbs | 4 +- 9 files changed, 271 insertions(+), 180 deletions(-) diff --git a/src/lang/de.json b/src/lang/de.json index d5e4d4f7..238ab636 100644 --- a/src/lang/de.json +++ b/src/lang/de.json @@ -89,30 +89,47 @@ "DS4.CombatValuesRangedAttack": "Schießen", "DS4.CombatValuesSpellcasting": "Zaubern", "DS4.CombatValuesTargetedSpellcasting": "Zielzaubern", - "DS4.BaseInfoRace": "Volk", - "DS4.BaseInfoClass": "Klasse", - "DS4.BaseInfoHeroClass": "Helden Klasse", - "DS4.BaseInfoCulture": "Kultur", - "DS4.ProgressionLevel": "Stufe", - "DS4.ProgressionExperiencePoints": "Erfahrungspunkte", - "DS4.ProgressionTalentPoints": "Talentpunkte", - "DS4.ProgressionProgressPoints": "Lernpunkte", + "DS4.CharacterBaseInfoRace": "Volk", + "DS4.CharacterBaseInfoClass": "Klasse", + "DS4.CharacterBaseInfoHeroClass": "Helden Klasse", + "DS4.CharacterBaseInfoCulture": "Kultur", + "DS4.CharacterProgressionLevel": "Stufe", + "DS4.CharacterProgressionExperiencePoints": "Erfahrungspunkte", + "DS4.CharacterProgressionTalentPoints": "Talentpunkte", + "DS4.CharacterProgressionProgressPoints": "Lernpunkte", "DS4.TalentRank": "Rang", "DS4.TalentRankBase": "Erworbener Rang", "DS4.TalentRankMax": "Maximaler Rang", "DS4.TalentRankMod": "Zusätzlicher Rang", "DS4.TalentRankTotal": "Gesamter Rang", - "DS4.LanguageLanguages": "Sprachen", - "DS4.LanguageAlphabets": "Schriftzeichen", - "DS4.ProfileGender": "Geschlecht", - "DS4.ProfileBirthday": "Geburtstag", - "DS4.ProfileBirthplace": "Geburtsort", - "DS4.ProfileAge": "Alter", - "DS4.ProfileHeight": "Größe", + "DS4.CharacterLanguageLanguages": "Sprachen", + "DS4.CharacterLanguageAlphabets": "Schriftzeichen", + "DS4.CharacterProfileGender": "Geschlecht", + "DS4.CharacterProfileBirthday": "Geburtstag", + "DS4.CharacterProfileBirthplace": "Geburtsort", + "DS4.CharacterProfileAge": "Alter", + "DS4.CharacterProfileHeight": "Größe", "DS4.ProfilHairColor": "Haarfarbe", - "DS4.ProfileWeight": "Gewicht", - "DS4.ProfileEyeColor": "Augenfarbe", - "DS4.ProfileSpecialCharacteristics": "Besondere Eigenschaften", + "DS4.CharacterProfileWeight": "Gewicht", + "DS4.CharacterProfileEyeColor": "Augenfarbe", + "DS4.CharacterProfileSpecialCharacteristics": "Besondere Eigenschaften", + "DS4.CreatureTypeAnimal": "Tier", + "DS4.CreatureTypeConstruct": "Konstrukt", + "DS4.CreatureTypeHumanoid": "Humanoid", + "DS4.CreatureTypeMagicalEntity": "Magisches Wesen", + "DS4.CreatureTypePlantBeing": "Pflanzenwesen", + "DS4.CreatureTypeUndead": "Untot", + "DS4.CreatureSizeCategoryTiny": "Winzig", + "DS4.CreatureSizeCategorySmall": "Klein", + "DS4.CreatureSizeCategoryNormal": "Normal", + "DS4.CreatureSizeCategoryLarge": "Groß", + "DS4.CreatureSizeCategoryHuge": "Riesig", + "DS4.CreatureSizeCategoryColossal": "Gewaltig", + "DS4.CreatureBaseInfoLoot": "Beute", + "DS4.CreatureBaseInfoFoeFactor": "Gegnerhärte", + "DS4.CreatureBaseInfoCreatureType": "Kreaturengruppe", + "DS4.CreatureBaseInfoSizeCategory": "Größenkategorie", + "DS4.CreatureBaseInfoExperiencePoints": "Erfahrungspunkte", "DS4.WarningManageActiveEffectOnOwnedItem": "Das Verwalten von aktiven Effekten innerhalb eines besessen Items wird derzeit nicht unterstützt und wird in einem nachfolgenden Update hinzugefügt.", "DS4.ErrorDiceCritOverlap": "Es gibt eine Überlappung zwischen Patzern und Immersiegen.", "DS4.ErrorExplodingRecursionLimitExceeded": "Die maximale Rekursionstiefe für slayende Würfelwürfe wurde überschritten." diff --git a/src/lang/en.json b/src/lang/en.json index 4f79f7ef..3ad1cabc 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -89,30 +89,47 @@ "DS4.CombatValuesRangedAttack": "Ranged Attack", "DS4.CombatValuesSpellcasting": "Spellcasting", "DS4.CombatValuesTargetedSpellcasting": "Targeted Spellcasting", - "DS4.BaseInfoRace": "Race", - "DS4.BaseInfoClass": "Class", - "DS4.BaseInfoHeroClass": "Hero Class", - "DS4.BaseInfoCulture": "Culture", - "DS4.ProgressionLevel": "Level", - "DS4.ProgressionExperiencePoints": "Experience Points", - "DS4.ProgressionTalentPoints": "Talent Points", - "DS4.ProgressionProgressPoints": "Progress Points", + "DS4.CharacterBaseInfoRace": "Race", + "DS4.CharacterBaseInfoClass": "Class", + "DS4.CharacterBaseInfoHeroClass": "Hero Class", + "DS4.CharacterBaseInfoCulture": "Culture", + "DS4.CharacterProgressionLevel": "Level", + "DS4.CharacterProgressionExperiencePoints": "Experience Points", + "DS4.CharacterProgressionTalentPoints": "Talent Points", + "DS4.CharacterProgressionProgressPoints": "Progress Points", "DS4.TalentRank": "Rank", "DS4.TalentRankBase": "Acquired Ranks", "DS4.TalentRankMax": "Maximum Ranks", "DS4.TalentRankMod": "Additional Ranks", "DS4.TalentRankTotal": "Total Ranks", - "DS4.LanguageLanguages": "Languages", - "DS4.LanguageAlphabets": "Alphabets", - "DS4.ProfileGender": "Gender", - "DS4.ProfileBirthday": "Birthday", - "DS4.ProfileBirthplace": "Birthplace", - "DS4.ProfileAge": "Age", - "DS4.ProfileHeight": "Height", + "DS4.CharacterLanguageLanguages": "Languages", + "DS4.CharacterLanguageAlphabets": "Alphabets", + "DS4.CharacterProfileGender": "Gender", + "DS4.CharacterProfileBirthday": "Birthday", + "DS4.CharacterProfileBirthplace": "Birthplace", + "DS4.CharacterProfileAge": "Age", + "DS4.CharacterProfileHeight": "Height", "DS4.ProfilHairColor": "Hair Color", - "DS4.ProfileWeight": "Weight", - "DS4.ProfileEyeColor": "Eye Color", - "DS4.ProfileSpecialCharacteristics": "Special Characteristics", + "DS4.CharacterProfileWeight": "Weight", + "DS4.CharacterProfileEyeColor": "Eye Color", + "DS4.CharacterProfileSpecialCharacteristics": "Special Characteristics", + "DS4.CreatureTypeAnimal": "Animal", + "DS4.CreatureTypeConstruct": "Construct", + "DS4.CreatureTypeHumanoid": "Humanoid", + "DS4.CreatureTypeMagicalEntity": "Magical Entity", + "DS4.CreatureTypePlantBeing": "Plant Being", + "DS4.CreatureTypeUndead": "Undead", + "DS4.CreatureSizeCategoryTiny": "Tiny", + "DS4.CreatureSizeCategorySmall": "Small", + "DS4.CreatureSizeCategoryNormal": "Normal", + "DS4.CreatureSizeCategoryLarge": "Large", + "DS4.CreatureSizeCategoryHuge": "Huge", + "DS4.CreatureSizeCategoryColossal": "Colossal", + "DS4.CreatureBaseInfoLoot": "Loot", + "DS4.CreatureBaseInfoFoeFactor": "Foe Factor", + "DS4.CreatureBaseInfoCreatureType": "Creature Type", + "DS4.CreatureBaseInfoSizeCategory": "Size Category", + "DS4.CreatureBaseInfoExperiencePoints": "Experience Points", "DS4.WarningManageActiveEffectOnOwnedItem": "Managing Active Effects within an Owned Item is not currently supported and will be added in a subsequent update.", "DS4.ErrorDiceCritOverlap": "There's an overlap between Fumbles and Coups", "DS4.ErrorExplodingRecursionLimitExceeded": "Maximum recursion depth for exploding dice roll exceeded" diff --git a/src/module/actor/actor-data.ts b/src/module/actor/actor-data.ts index a3ac75b9..1a935841 100644 --- a/src/module/actor/actor-data.ts +++ b/src/module/actor/actor-data.ts @@ -1,18 +1,4 @@ -export interface DS4ActorDataType { - attributes: DS4ActorDataAttributes; - traits: DS4ActorDataTraits; - combatValues: DS4ActorDataCombatValues; - baseInfo: DS4ActorDataBaseInfo; - progression: DS4ActorDataProgression; - language: DS4ActorDataLanguage; - profile: DS4ActorDataProfile; -} - -interface DS4ActorDataAttributes { - body: BodyAttribute; - mobility: ModifiableData; - mind: ModifiableData; -} +export type DS4ActorDataType = DS4ActorDataCharacter | DS4ActorDataCreature; export interface ModifiableData { base: T; @@ -20,18 +6,27 @@ export interface ModifiableData { total?: T; } -interface UsableResource { - total: T; - used: T; -} - interface ResourceData extends ModifiableData { value: T; max?: T; } -// Blueprint in case we need more detailed differentiation -type BodyAttribute = ModifiableData; +interface UsableResource { + total: T; + used: T; +} + +interface DS4ActorDataBase { + attributes: DS4ActorDataAttributes; + traits: DS4ActorDataTraits; + combatValues: DS4ActorDataCombatValues; +} + +interface DS4ActorDataAttributes { + body: ModifiableData; + mobility: ModifiableData; + mind: ModifiableData; +} interface DS4ActorDataTraits { strength: ModifiableData; @@ -53,26 +48,33 @@ interface DS4ActorDataCombatValues { targetedSpellcasting: ModifiableData; } -interface DS4ActorDataBaseInfo { +interface DS4ActorDataCharacter extends DS4ActorDataBase { + baseInfo: DS4ActorDataCharacterBaseInfo; + progression: DS4ActorDataCharacterProgression; + language: DS4ActorDataCharacterLanguage; + profile: DS4ActorDataCharacterProfile; +} + +interface DS4ActorDataCharacterBaseInfo { race: string; class: string; heroClass: string; culture: string; } -interface DS4ActorDataProgression { +interface DS4ActorDataCharacterProgression { level: number; experiencePoints: number; talentPoints: UsableResource; progressPoints: UsableResource; } -interface DS4ActorDataLanguage { +interface DS4ActorDataCharacterLanguage { languages: string; alphabets: string; } -interface DS4ActorDataProfile { +interface DS4ActorDataCharacterProfile { gender: string; birthday: string; birthplace: string; @@ -83,3 +85,19 @@ interface DS4ActorDataProfile { eyeColor: string; specialCharacteristics: string; } + +interface DS4ActorDataCreature extends DS4ActorDataBase { + baseInfo: DS4ActorDataCreatureBaseInfo; +} + +type CreatureType = "animal" | "construct" | "humanoid" | "magicalEntity" | "plantBeing" | "undead"; + +type SizeCategory = "tiny" | "small" | "normal" | "large" | "huge" | "colossal"; + +interface DS4ActorDataCreatureBaseInfo { + loot: string; + foeFactor: number; + creatureType: CreatureType; + sizeCategory: SizeCategory; + experiencePoints: number; +} diff --git a/src/module/config.ts b/src/module/config.ts index 03b2c9d5..86f82d6e 100644 --- a/src/module/config.ts +++ b/src/module/config.ts @@ -97,7 +97,7 @@ export const DS4 = { }, /** - * Define the set of attributes a character has + * Define the set of attributes an actor has */ attributes: { body: "DS4.AttributeBody", @@ -106,7 +106,7 @@ export const DS4 = { }, /** - * Define the set of traits a character has + * Define the set of traits an actor has */ traits: { strength: "DS4.TraitStrength", @@ -118,7 +118,7 @@ export const DS4 = { }, /** - * Define the set of combat values a character has + * Define the set of combat values an actor has */ combatValues: { hitPoints: "DS4.CombatValuesHitPoints", @@ -134,50 +134,50 @@ export const DS4 = { /** * Define the base info of a character */ - baseInfo: { - race: "DS4.BaseInfoRace", - class: "DS4.BaseInfoClass", - heroClass: "DS4.BaseInfoHeroClass", - culture: "DS4.BaseInfoCulture", + characterBaseInfo: { + race: "DS4.CharacterBaseInfoRace", + class: "DS4.CharacterBaseInfoClass", + heroClass: "DS4.CharacterBaseInfoHeroClass", + culture: "DS4.CharacterBaseInfoCulture", }, /** * Define the progression info of a character */ - progression: { - level: "DS4.ProgressionLevel", - experiencePoints: "DS4.ProgressionExperiencePoints", - talentPoints: "DS4.ProgressionTalentPoints", - progressPoints: "DS4.ProgressionProgressPoints", + characterProgression: { + level: "DS4.CharacterProgressionLevel", + experiencePoints: "DS4.CharacterProgressionExperiencePoints", + talentPoints: "DS4.CharacterProgressionTalentPoints", + progressPoints: "DS4.CharacterProgressionProgressPoints", }, /** * Define the language info of a character */ - language: { - languages: "DS4.LanguageLanguages", - alphabets: "DS4.LanguageAlphabets", + characterLanguage: { + languages: "DS4.CharacterLanguageLanguages", + alphabets: "DS4.CharacterLanguageAlphabets", }, /** * Define the profile info of a character */ - profile: { - gender: "DS4.ProfileGender", - birthday: "DS4.ProfileBirthday", - birthplace: "DS4.ProfileBirthplace", - age: "DS4.ProfileAge", - height: "DS4.ProfileHeight", + characterProfile: { + gender: "DS4.CharacterProfileGender", + birthday: "DS4.CharacterProfileBirthday", + birthplace: "DS4.CharacterProfileBirthplace", + age: "DS4.CharacterProfileAge", + height: "DS4.CharacterProfileHeight", hairColor: "DS4.ProfilHairColor", - weight: "DS4.ProfileWeight", - eyeColor: "DS4.ProfileEyeColor", - specialCharacteristics: "DS4.ProfileSpecialCharacteristics", + weight: "DS4.CharacterProfileWeight", + eyeColor: "DS4.CharacterProfileEyeColor", + specialCharacteristics: "DS4.CharacterProfileSpecialCharacteristics", }, /** * Define the profile info types for hanndlebars of a character */ - profileDTypes: { + characterProfileDTypes: { gender: "String", birthday: "String", birthplace: "String", @@ -188,4 +188,30 @@ export const DS4 = { eyeColor: "String", specialCharacteristics: "String", }, + + creatureTypes: { + animal: "DS4.CreatureTypeAnimal", + construct: "DS4.CreatureTypeConstruct", + humanoid: "DS4.CreatureTypeHumanoid", + magicalEntity: "DS4.CreatureTypeMagicalEntity", + plantBeing: "DS4.CreatureTypePlantBeing", + undead: "DS4.CreatureTypeUndead", + }, + + creatureSizeCategories: { + tiny: "DS4.CreatureSizeCategoryTiny", + small: "DS4.CreatureSizeCategorySmall", + normal: "DS4.CreatureSizeCategoryNormal", + large: "DS4.CreatureSizeCategoryLarge", + huge: "DS4.CreatureSizeCategoryHuge", + colossal: "DS4.CreatureSizeCategoryColossal", + }, + + creatureBaseInfo: { + loot: "DS4.CreatureBaseInfoLoot", + foeFactor: "DS4.CreatureBaseInfoFoeFactor", + creatureType: "DS4.CreatureBaseInfoCreatureType", + sizeCategory: "DS4.CreatureBaseInfoSizeCategory", + experiencePoints: "DS4.CreatureBaseInfoExperiencePoints", + }, }; diff --git a/src/module/ds4.ts b/src/module/ds4.ts index a9d46ac2..70eae0cc 100644 --- a/src/module/ds4.ts +++ b/src/module/ds4.ts @@ -79,10 +79,10 @@ Hooks.once("setup", function () { "attributes", "traits", "combatValues", - "baseInfo", - "progression", - "language", - "profile", + "characterBaseInfo", + "characterProgression", + "characterLanguage", + "characterProfile", ]; // Exclude some from sorting where the default order matters diff --git a/src/template.json b/src/template.json index eee8acee..d13f154d 100644 --- a/src/template.json +++ b/src/template.json @@ -1,84 +1,97 @@ { "Actor": { - "types": ["character"], - "templates": {}, + "types": ["character", "creature"], + "templates": { + "base": { + "attributes": { + "body": { + "base": 0, + "mod": 0 + }, + "mobility": { + "base": 0, + "mod": 0 + }, + "mind": { + "base": 0, + "mod": 0 + } + }, + "traits": { + "strength": { + "base": 0, + "mod": 0 + }, + "constitution": { + "base": 0, + "mod": 0 + }, + "agility": { + "base": 0, + "mod": 0 + }, + "dexterity": { + "base": 0, + "mod": 0 + }, + "intellect": { + "base": 0, + "mod": 0 + }, + "aura": { + "base": 0, + "mod": 0 + } + }, + "combatValues": { + "hitPoints": { + "base": 0, + "mod": 0, + "value": 0 + }, + "defense": { + "base": 0, + "mod": 0 + }, + "initiative": { + "base": 0, + "mod": 0 + }, + "movement": { + "base": 0, + "mod": 0 + }, + "meleeAttack": { + "base": 0, + "mod": 0 + }, + "rangedAttack": { + "base": 0, + "mod": 0 + }, + "spellcasting": { + "base": 0, + "mod": 0 + }, + "targetedSpellcasting": { + "base": 0, + "mod": 0 + } + } + } + }, + "creature": { + "templates": ["base"], + "baseInfo": { + "loot": "", + "foeFactor": 1, + "creatureType": "humanoid", + "sizeCategory": "normal", + "experiencePoints": 0 + } + }, "character": { - "templates": [], - "attributes": { - "body": { - "base": 0, - "mod": 0 - }, - "mobility": { - "base": 0, - "mod": 0 - }, - "mind": { - "base": 0, - "mod": 0 - } - }, - "traits": { - "strength": { - "base": 0, - "mod": 0 - }, - "constitution": { - "base": 0, - "mod": 0 - }, - "agility": { - "base": 0, - "mod": 0 - }, - "dexterity": { - "base": 0, - "mod": 0 - }, - "intellect": { - "base": 0, - "mod": 0 - }, - "aura": { - "base": 0, - "mod": 0 - } - }, - "combatValues": { - "hitPoints": { - "base": 0, - "mod": 0, - "value": 0 - }, - "defense": { - "base": 0, - "mod": 0 - }, - "initiative": { - "base": 0, - "mod": 0 - }, - "movement": { - "base": 0, - "mod": 0 - }, - "meleeAttack": { - "base": 0, - "mod": 0 - }, - "rangedAttack": { - "base": 0, - "mod": 0 - }, - "spellcasting": { - "base": 0, - "mod": 0 - }, - "targetedSpellcasting": { - "base": 0, - "mod": 0 - } - }, + "templates": ["base"], "baseInfo": { "race": "", "class": "", diff --git a/src/templates/actor/actor-sheet.hbs b/src/templates/actor/actor-sheet.hbs index 8e3e5f54..2dec0fb8 100644 --- a/src/templates/actor/actor-sheet.hbs +++ b/src/templates/actor/actor-sheet.hbs @@ -8,17 +8,17 @@
- +
- +
+ for="data.progression.progressPoints.used">{{config.characterProgression.progressPoints}}
+ for="data.progression.talentPoints.used">{{config.characterProgression.talentPoints}}
- +
+ for="data.baseInfo.heroClass">{{config.characterBaseInfo.heroClass}}
diff --git a/src/templates/actor/partials/character-progression.hbs b/src/templates/actor/partials/character-progression.hbs index f22376f0..8990656c 100644 --- a/src/templates/actor/partials/character-progression.hbs +++ b/src/templates/actor/partials/character-progression.hbs @@ -1,13 +1,13 @@
-

+

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

diff --git a/src/templates/actor/partials/profile.hbs b/src/templates/actor/partials/profile.hbs index b0034128..05d51146 100644 --- a/src/templates/actor/partials/profile.hbs +++ b/src/templates/actor/partials/profile.hbs @@ -3,10 +3,10 @@ {{#each data.profile as |profile-data-value profile-data-key|}}
+ data-dtype="{{lookup ../config/characterProfileDTypes profile-data-key}}" />
{{/each}}
From b01e0417ee96820aa83d16b437c79fb611291a91 Mon Sep 17 00:00:00 2001 From: Johannes Loher Date: Sat, 9 Jan 2021 22:54:44 +0100 Subject: [PATCH 02/15] add doc strings to new config objects --- src/module/config.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/module/config.ts b/src/module/config.ts index 86f82d6e..3e8102d0 100644 --- a/src/module/config.ts +++ b/src/module/config.ts @@ -189,6 +189,9 @@ export const DS4 = { specialCharacteristics: "String", }, + /** + * Define the different creature types a creature can be + */ creatureTypes: { animal: "DS4.CreatureTypeAnimal", construct: "DS4.CreatureTypeConstruct", @@ -198,6 +201,9 @@ export const DS4 = { undead: "DS4.CreatureTypeUndead", }, + /** + * Define the different size categories a creatures fall into + */ creatureSizeCategories: { tiny: "DS4.CreatureSizeCategoryTiny", small: "DS4.CreatureSizeCategorySmall", @@ -207,6 +213,9 @@ export const DS4 = { colossal: "DS4.CreatureSizeCategoryColossal", }, + /** + * Define the base info of a creature + */ creatureBaseInfo: { loot: "DS4.CreatureBaseInfoLoot", foeFactor: "DS4.CreatureBaseInfoFoeFactor", From bc6930675cba41b9d83a9e47dd6423d8d776e734 Mon Sep 17 00:00:00 2001 From: Johannes Loher Date: Sat, 9 Jan 2021 22:55:38 +0100 Subject: [PATCH 03/15] localize creature parts of config --- src/module/ds4.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/module/ds4.ts b/src/module/ds4.ts index 70eae0cc..a1cb6feb 100644 --- a/src/module/ds4.ts +++ b/src/module/ds4.ts @@ -83,6 +83,9 @@ Hooks.once("setup", function () { "characterProgression", "characterLanguage", "characterProfile", + "creatureTypes", + "creatureSizeCategories", + "creatureBaseInfo", ]; // Exclude some from sorting where the default order matters From 17d0213e62826b6665d831a89402910d594e78dd Mon Sep 17 00:00:00 2001 From: Johannes Loher Date: Sun, 10 Jan 2021 02:05:30 +0100 Subject: [PATCH 04/15] add basic creature sheet --- src/lang/de.json | 3 + src/lang/en.json | 3 + src/module/actor/actor-data.ts | 2 + src/module/actor/actor-sheet.ts | 29 +++++--- src/module/config.ts | 3 + src/template.json | 4 +- .../{actor-sheet.hbs => character-sheet.hbs} | 14 ++-- src/templates/actor/creature-sheet.hbs | 74 +++++++++++++++++++ src/templates/actor/partials/profile.hbs | 4 +- src/templates/item/partials/body.hbs | 2 +- src/templates/item/partials/description.hbs | 2 +- 11 files changed, 120 insertions(+), 20 deletions(-) rename src/templates/actor/{actor-sheet.hbs => character-sheet.hbs} (88%) create mode 100644 src/templates/actor/creature-sheet.hbs diff --git a/src/lang/de.json b/src/lang/de.json index e52673cc..fc973952 100644 --- a/src/lang/de.json +++ b/src/lang/de.json @@ -10,6 +10,7 @@ "DS4.HeadingProfile": "Profil", "DS4.HeadingTalents": "Talente & Fähigkeiten", "DS4.HeadingSpells": "Zaubersprüche", + "DS4.HeadingDescription": "Beschreibung", "DS4.AttackType": "Angriffs Typ", "DS4.AttackTypeAbbr": "AT", "DS4.WeaponBonus": "Waffen Bonus", @@ -130,6 +131,7 @@ "DS4.TalentRankTotal": "Gesamter Rang", "DS4.CharacterLanguageLanguages": "Sprachen", "DS4.CharacterLanguageAlphabets": "Schriftzeichen", + "DS4.CharacterProfileBiography": "Biographie", "DS4.CharacterProfileGender": "Geschlecht", "DS4.CharacterProfileBirthday": "Geburtstag", "DS4.CharacterProfileBirthplace": "Geburtsort", @@ -156,6 +158,7 @@ "DS4.CreatureBaseInfoCreatureType": "Kreaturengruppe", "DS4.CreatureBaseInfoSizeCategory": "Größenkategorie", "DS4.CreatureBaseInfoExperiencePoints": "Erfahrungspunkte", + "DS4.CreatureBaseInfoDescription": "Beschreibung", "DS4.WarningManageActiveEffectOnOwnedItem": "Das Verwalten von aktiven Effekten innerhalb eines besessen Items wird derzeit nicht unterstützt und wird in einem nachfolgenden Update hinzugefügt.", "DS4.ErrorDiceCritOverlap": "Es gibt eine Überlappung zwischen Patzern und Immersiegen.", "DS4.ErrorExplodingRecursionLimitExceeded": "Die maximale Rekursionstiefe für slayende Würfelwürfe wurde überschritten.", diff --git a/src/lang/en.json b/src/lang/en.json index 23a382c5..f3b4e8a1 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -10,6 +10,7 @@ "DS4.HeadingProfile": "Profile", "DS4.HeadingTalents": "Talents & Abilities", "DS4.HeadingSpells": "Spells", + "DS4.HeadingDescription": "Description", "DS4.AttackType": "Attack Type", "DS4.AttackTypeAbbr": "AT", "DS4.WeaponBonus": "Weapon Bonus", @@ -130,6 +131,7 @@ "DS4.TalentRankTotal": "Total Ranks", "DS4.CharacterLanguageLanguages": "Languages", "DS4.CharacterLanguageAlphabets": "Alphabets", + "DS4.CharacterProfileBiography": "Biography", "DS4.CharacterProfileGender": "Gender", "DS4.CharacterProfileBirthday": "Birthday", "DS4.CharacterProfileBirthplace": "Birthplace", @@ -156,6 +158,7 @@ "DS4.CreatureBaseInfoCreatureType": "Creature Type", "DS4.CreatureBaseInfoSizeCategory": "Size Category", "DS4.CreatureBaseInfoExperiencePoints": "Experience Points", + "DS4.CreatureBaseInfoDescription": "Description", "DS4.WarningManageActiveEffectOnOwnedItem": "Managing Active Effects within an Owned Item is not currently supported and will be added in a subsequent update.", "DS4.ErrorDiceCritOverlap": "There's an overlap between Fumbles and Coups", "DS4.ErrorExplodingRecursionLimitExceeded": "Maximum recursion depth for exploding dice roll exceeded", diff --git a/src/module/actor/actor-data.ts b/src/module/actor/actor-data.ts index 1a935841..edacb2c2 100644 --- a/src/module/actor/actor-data.ts +++ b/src/module/actor/actor-data.ts @@ -75,6 +75,7 @@ interface DS4ActorDataCharacterLanguage { } interface DS4ActorDataCharacterProfile { + biography: string; gender: string; birthday: string; birthplace: string; @@ -100,4 +101,5 @@ interface DS4ActorDataCreatureBaseInfo { creatureType: CreatureType; sizeCategory: SizeCategory; experiencePoints: number; + description: string; } diff --git a/src/module/actor/actor-sheet.ts b/src/module/actor/actor-sheet.ts index ca14fd0d..3e711d30 100644 --- a/src/module/actor/actor-sheet.ts +++ b/src/module/actor/actor-sheet.ts @@ -7,6 +7,24 @@ import { DS4ActorDataType } from "./actor-data"; * @extends {ActorSheet} */ export class DS4ActorSheet extends ActorSheet { + /** @override */ + static get defaultOptions(): FormApplicationOptions { + return mergeObject(super.defaultOptions, { + classes: ["ds4", "sheet", "actor"], + width: 745, + height: 600, + tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "inventory" }], + }); + } + + /** @override */ + get template(): string { + const path = "systems/ds4/templates/actor"; + return `${path}/${this.actor.data.type}-sheet.hbs`; + } + + /* -------------------------------------------- */ + /** * This method returns the data for the template of the actor sheet. * It explicitly adds the items of the object sorted by type in the @@ -25,17 +43,6 @@ export class DS4ActorSheet extends ActorSheet
- +
- +
@@ -39,7 +41,8 @@
- +
@@ -81,7 +84,8 @@ {{!-- Biography Tab --}}
- {{editor content=data.biography target="data.biography" button=true owner=owner editable=editable}} + {{editor content=data.profile.biography target="data.profile.biography" button=true owner=owner + editable=editable}}
- \ No newline at end of file + diff --git a/src/templates/actor/creature-sheet.hbs b/src/templates/actor/creature-sheet.hbs new file mode 100644 index 00000000..40d5eaf4 --- /dev/null +++ b/src/templates/actor/creature-sheet.hbs @@ -0,0 +1,74 @@ +
+ {{!-- Sheet Header --}} +
+ +
+

+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+
+ {{> systems/ds4/templates/actor/partials/attributes-traits.hbs}} + {{> systems/ds4/templates/actor/partials/combat-values.hbs}} +
+
+ + {{!-- Sheet Tab Navigation --}} + + + {{!-- Sheet Body --}} +
+ {{!-- Items Tab --}} + {{> systems/ds4/templates/actor/partials/items-overview.hbs}} + + {{!-- Spells Tab --}} + {{> systems/ds4/templates/actor/partials/spells-overview.hbs}} + + {{!-- Description Tab --}} +
+ {{editor content=data.baseInfo.description target="data.baseInfo.description" button=true owner=owner + editable=editable}} +
+
+
\ No newline at end of file diff --git a/src/templates/actor/partials/profile.hbs b/src/templates/actor/partials/profile.hbs index 05d51146..ea62c70a 100644 --- a/src/templates/actor/partials/profile.hbs +++ b/src/templates/actor/partials/profile.hbs @@ -1,6 +1,7 @@
{{#each data.profile as |profile-data-value profile-data-key|}} + {{#if (neq profile-data-key 'biography')}}
+ {{/if}} {{/each}}
-
\ No newline at end of file +
diff --git a/src/templates/item/partials/body.hbs b/src/templates/item/partials/body.hbs index a7ac4d72..2a9eaecd 100644 --- a/src/templates/item/partials/body.hbs +++ b/src/templates/item/partials/body.hbs @@ -2,7 +2,7 @@ {{!-- Sheet Tab Navigation --}}
-
+
{{editor content=data.description target="data.description" button=true owner=owner editable=editable}}
\ No newline at end of file From 0568afc32be83000ea9fdf909424446650b205a8 Mon Sep 17 00:00:00 2001 From: Johannes Loher Date: Sun, 10 Jan 2021 02:35:48 +0100 Subject: [PATCH 05/15] Add localization of actor and item type labels --- src/lang/de.json | 2 ++ src/lang/en.json | 2 ++ src/module/config.ts | 8 ++++++++ src/module/ds4.ts | 4 ++++ 4 files changed, 16 insertions(+) diff --git a/src/lang/de.json b/src/lang/de.json index fc973952..a457b768 100644 --- a/src/lang/de.json +++ b/src/lang/de.json @@ -99,6 +99,8 @@ "DS4.SpellDuration": "Wirkdauer", "DS4.SpellCooldownDuration": "Abklingzeit", "DS4.SpellScrollPriceGold": "Schriftrollenpreis (Gold)", + "DS4.ActorTypeCharacter": "Charakter", + "DS4.ActorTypeCreature": "Kreatur", "DS4.AttributeBody": "Körper", "DS4.AttributeMobility": "Agilität", "DS4.AttributeMind": "Geist", diff --git a/src/lang/en.json b/src/lang/en.json index f3b4e8a1..50ef84c6 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -99,6 +99,8 @@ "DS4.SpellDuration": "Duration", "DS4.SpellCooldownDuration": "Cooldown", "DS4.SpellScrollPriceGold": "Scroll Price (Gold)", + "DS4.ActorTypeCharacter": "Character", + "DS4.ActorTypeCreature": "Creature", "DS4.AttributeBody": "Body", "DS4.AttributeMobility": "Mobility", "DS4.AttributeMind": "Mind", diff --git a/src/module/config.ts b/src/module/config.ts index 9be27b2a..0f977d84 100644 --- a/src/module/config.ts +++ b/src/module/config.ts @@ -120,6 +120,14 @@ export const DS4 = { electricity: "DS4.SpellCategoryElectricity", }, + /** + * Define the set of actor types + */ + actorTypes: { + character: "DS4.ActorTypeCharacter", + creature: "DS4.ActorTypeCreature", + }, + /** * Define the set of attributes an actor has */ diff --git a/src/module/ds4.ts b/src/module/ds4.ts index 3465ea7d..8bd9ea53 100644 --- a/src/module/ds4.ts +++ b/src/module/ds4.ts @@ -22,6 +22,10 @@ Hooks.once("init", async function () { CONFIG.Actor.entityClass = DS4Actor as typeof Actor; CONFIG.Item.entityClass = DS4Item as typeof Item; + // Define localized type labels + CONFIG.Actor.typeLabels = DS4.actorTypes; + CONFIG.Item.typeLabels = DS4.itemTypes; + // Configure Dice CONFIG.Dice.types = [Die, DS4Check]; CONFIG.Dice.terms = { From c422635d66414c860ea2c8abb36ce85dc5bc6aae Mon Sep 17 00:00:00 2001 From: Johannes Loher Date: Mon, 11 Jan 2021 00:55:49 +0100 Subject: [PATCH 06/15] add special creature ability as item type --- package-lock.json | 2 +- src/lang/de.json | 4 ++ src/lang/en.json | 4 ++ src/module/actor/actor-data.ts | 21 +++------- src/module/actor/actor-sheet.ts | 25 +++++++++++- src/module/actor/actor.ts | 38 ++++++++++++++++++- src/module/common/common-data.ts | 15 ++++++++ src/module/config.ts | 1 + src/module/item/item-data.ts | 11 +++++- src/template.json | 7 +++- src/templates/actor/partials/profile.hbs | 2 +- .../item/specialCreatureAbility-sheet.hbs | 15 ++++++++ 12 files changed, 121 insertions(+), 24 deletions(-) create mode 100644 src/module/common/common-data.ts create mode 100644 src/templates/item/specialCreatureAbility-sheet.hbs diff --git a/package-lock.json b/package-lock.json index 65951b1d..3c38cde2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2717,7 +2717,7 @@ } }, "foundry-pc-types": { - "version": "git+https://git.f3l.de/dungeonslayers/foundry-pc-types.git#f84074f63d1aeeb9229e441e8c3ccaa9cba64142", + "version": "git+https://git.f3l.de/dungeonslayers/foundry-pc-types.git#5fcca4e4327b558d5eeeb962f05470c994a394be", "from": "git+https://git.f3l.de/dungeonslayers/foundry-pc-types.git#f3l-fixes", "dev": true, "requires": { diff --git a/src/lang/de.json b/src/lang/de.json index a457b768..118ec7bb 100644 --- a/src/lang/de.json +++ b/src/lang/de.json @@ -56,6 +56,8 @@ "DS4.ItemTypeLanguagePlural": "Sprachen", "DS4.ItemTypeAlphabet": "Schriftzeichen", "DS4.ItemTypeAlphabetPlural": "Schriftzeichen", + "DS4.ItemTypeSpecialCreatureAbility": "Besondere Kreaturefähigkeit", + "DS4.ItemTypeSpecialCreatureAbilityPlural": "Besondere Kreaturefähigkeiten", "DS4.ArmorType": "Panzerungstyp", "DS4.ArmorTypeAbbr": "PAT", "DS4.ArmorMaterialType": "Material Typ", @@ -133,6 +135,7 @@ "DS4.TalentRankTotal": "Gesamter Rang", "DS4.CharacterLanguageLanguages": "Sprachen", "DS4.CharacterLanguageAlphabets": "Schriftzeichen", + "DS4.SpecialCreatureAbilityExperiencePoints": "Erfahrungspunkte", "DS4.CharacterProfileBiography": "Biographie", "DS4.CharacterProfileGender": "Geschlecht", "DS4.CharacterProfileBirthday": "Geburtstag", @@ -162,6 +165,7 @@ "DS4.CreatureBaseInfoExperiencePoints": "Erfahrungspunkte", "DS4.CreatureBaseInfoDescription": "Beschreibung", "DS4.WarningManageActiveEffectOnOwnedItem": "Das Verwalten von aktiven Effekten innerhalb eines besessen Items wird derzeit nicht unterstützt und wird in einem nachfolgenden Update hinzugefügt.", + "DS4.WarningActorCannotOwnItem": "Der Aktor '{actorName}' vom Typ '{actorType}' kann das Item '{itemName}' vom Typ '{itemType}' nicht besitzen.", "DS4.ErrorDiceCritOverlap": "Es gibt eine Überlappung zwischen Patzern und Immersiegen.", "DS4.ErrorExplodingRecursionLimitExceeded": "Die maximale Rekursionstiefe für slayende Würfelwürfe wurde überschritten.", "DS4.UnitRounds": "Runden", diff --git a/src/lang/en.json b/src/lang/en.json index 50ef84c6..4a587075 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -56,6 +56,8 @@ "DS4.ItemTypeLanguagePlural": "Languages", "DS4.ItemTypeAlphabet": "Alphabet", "DS4.ItemTypeAlphabetPlural": "Alphabets", + "DS4.ItemTypeSpecialCreatureAbility": "Special Creature Ability", + "DS4.ItemTypeSpecialCreatureAbilityPlural": "Special Creature Abilities", "DS4.ArmorType": "Armor Type", "DS4.ArmorTypeAbbr": "AT", "DS4.ArmorMaterialType": "Material Type", @@ -133,6 +135,7 @@ "DS4.TalentRankTotal": "Total Ranks", "DS4.CharacterLanguageLanguages": "Languages", "DS4.CharacterLanguageAlphabets": "Alphabets", + "DS4.SpecialCreatureAbilityExperiencePoints": "Experience Points", "DS4.CharacterProfileBiography": "Biography", "DS4.CharacterProfileGender": "Gender", "DS4.CharacterProfileBirthday": "Birthday", @@ -162,6 +165,7 @@ "DS4.CreatureBaseInfoExperiencePoints": "Experience Points", "DS4.CreatureBaseInfoDescription": "Description", "DS4.WarningManageActiveEffectOnOwnedItem": "Managing Active Effects within an Owned Item is not currently supported and will be added in a subsequent update.", + "DS4.WarningActorCannotOwnItem": "The actor '{actorName}' of type '{actorType}' cannot own the item '{itemName}' of type '{itemType}'.", "DS4.ErrorDiceCritOverlap": "There's an overlap between Fumbles and Coups", "DS4.ErrorExplodingRecursionLimitExceeded": "Maximum recursion depth for exploding dice roll exceeded", "DS4.UnitRounds": "Rounds", diff --git a/src/module/actor/actor-data.ts b/src/module/actor/actor-data.ts index edacb2c2..20c26741 100644 --- a/src/module/actor/actor-data.ts +++ b/src/module/actor/actor-data.ts @@ -1,21 +1,10 @@ +import { ModifiableData, ResourceData, UsableResource } from "../common/common-data"; +import { DS4 } from "../config"; + +export type ActorType = keyof typeof DS4.actorTypes; + export type DS4ActorDataType = DS4ActorDataCharacter | DS4ActorDataCreature; -export interface ModifiableData { - base: T; - mod: T; - total?: T; -} - -interface ResourceData extends ModifiableData { - value: T; - max?: T; -} - -interface UsableResource { - total: T; - used: T; -} - interface DS4ActorDataBase { attributes: DS4ActorDataAttributes; traits: DS4ActorDataTraits; diff --git a/src/module/actor/actor-sheet.ts b/src/module/actor/actor-sheet.ts index 3e711d30..d8a3b6dc 100644 --- a/src/module/actor/actor-sheet.ts +++ b/src/module/actor/actor-sheet.ts @@ -1,4 +1,5 @@ -import { DS4ItemDataType } from "../item/item-data"; +import { DS4Item } from "../item/item"; +import { DS4ItemDataType, ItemType } from "../item/item-data"; import { DS4Actor } from "./actor"; import { DS4ActorDataType } from "./actor-data"; @@ -207,4 +208,26 @@ export class DS4ActorSheet extends ActorSheet { + const data = JSON.parse(event.dataTransfer?.getData("text/plain")) as { type?: string }; + if (data.type === "Item") { + const item = await Item.fromDropData(data as Parameters[0]); + if (item && !this.actor.canOwnItemType(item.data.type as ItemType)) { + ui.notifications.warn( + game.i18n.format("DS4.WarningActorCannotOwnItem", { + actorName: this.actor.name, + actorType: this.actor.data.type, + itemName: item.name, + itemType: item.data.type, + }), + ); + return false; + } + } + super._onDrop(event); + } } diff --git a/src/module/actor/actor.ts b/src/module/actor/actor.ts index 7f2f8209..9d4ac8e0 100644 --- a/src/module/actor/actor.ts +++ b/src/module/actor/actor.ts @@ -1,6 +1,7 @@ +import { ModifiableData } from "../common/common-data"; import { DS4Item } from "../item/item"; -import { DS4ItemDataType } from "../item/item-data"; -import { DS4ActorDataType, ModifiableData } from "./actor-data"; +import { DS4ItemDataType, ItemType } from "../item/item-data"; +import { DS4ActorDataType } from "./actor-data"; export class DS4Actor extends Actor { /** @override */ @@ -21,4 +22,37 @@ export class DS4Actor extends Actor combatValues.hitPoints.max = combatValues.hitPoints.total; } + + /** + * The list of item types that can be owned by this actor. + */ + get ownableItemTypes(): Array { + switch (this.data.type) { + case "character": + return [ + "weapon", + "armor", + "shield", + "spell", + "trinket", + "equipment", + "talent", + "racialAbility", + "language", + "alphabet", + ]; + case "creature": + return ["weapon", "armor", "spell", "specialCreatureAbility"]; + default: + []; + } + } + + /** + * Checks whether or not the given item type can be owned by the actor. + * @param itemType the item type to check + */ + canOwnItemType(itemType: ItemType): boolean { + return this.ownableItemTypes.includes(itemType); + } } diff --git a/src/module/common/common-data.ts b/src/module/common/common-data.ts new file mode 100644 index 00000000..41bfc3c4 --- /dev/null +++ b/src/module/common/common-data.ts @@ -0,0 +1,15 @@ +export interface ModifiableData { + base: T; + mod: T; + total?: T; +} + +export interface ResourceData extends ModifiableData { + value: T; + max?: T; +} + +export interface UsableResource { + total: T; + used: T; +} diff --git a/src/module/config.ts b/src/module/config.ts index 0f977d84..9d3dcc8c 100644 --- a/src/module/config.ts +++ b/src/module/config.ts @@ -61,6 +61,7 @@ export const DS4 = { racialAbility: "DS4.ItemTypeRacialAbility", language: "DS4.ItemTypeLanguage", alphabet: "DS4.ItemTypeAlphabet", + specialCreatureAbility: "DS4.ItemTypeSpecialCreatureAbility", }, /** diff --git a/src/module/item/item-data.ts b/src/module/item/item-data.ts index 45622a6e..64ee17f2 100644 --- a/src/module/item/item-data.ts +++ b/src/module/item/item-data.ts @@ -1,4 +1,7 @@ -import { ModifiableData } from "../actor/actor-data"; +import { ModifiableData } from "../common/common-data"; +import { DS4 } from "../config"; + +export type ItemType = keyof typeof DS4.itemTypes; export type DS4ItemDataType = | DS4Weapon @@ -10,7 +13,8 @@ export type DS4ItemDataType = | DS4Talent | DS4RacialAbility | DS4Language - | DS4Alphabet; + | DS4Alphabet + | DS4SpecialCreatureAbility; // types @@ -59,6 +63,9 @@ interface DS4Equipment extends DS4ItemBase, DS4ItemPhysical {} type DS4RacialAbility = DS4ItemBase; type DS4Language = DS4ItemBase; type DS4Alphabet = DS4ItemBase; +interface DS4SpecialCreatureAbility extends DS4ItemBase { + experiencePoints: number; +} // templates diff --git a/src/template.json b/src/template.json index 9354acdb..ca9b4ee5 100644 --- a/src/template.json +++ b/src/template.json @@ -136,7 +136,8 @@ "talent", "racialAbility", "language", - "alphabet" + "alphabet", + "specialCreatureAbility" ], "templates": { "base": { @@ -214,6 +215,10 @@ "unit": "custom" }, "scrollPrice": 0 + }, + "specialCreatureAbility": { + "templates": ["base"], + "experiencePoints": 0 } } } diff --git a/src/templates/actor/partials/profile.hbs b/src/templates/actor/partials/profile.hbs index ea62c70a..be95eeb5 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 (neq profile-data-key 'biography')}} + {{#if (ne profile-data-key 'biography')}}