From 090aeab75f7385b5df1ec48b78b3b70465cab5b6 Mon Sep 17 00:00:00 2001 From: Gesina Schwalbe <gesina.schwalbe@pheerai.de> Date: Sat, 9 Jan 2021 14:09:21 +0100 Subject: [PATCH 01/41] added type definitions and translations for spells --- src/lang/en.json | 29 ++++++++++++++++++++++++- src/module/config.ts | 42 ++++++++++++++++++++++++++++++++++++ src/module/item/item-data.ts | 27 +++++++++++++++++++++++ src/template.json | 20 +++++++++++++++++ 4 files changed, 117 insertions(+), 1 deletion(-) diff --git a/src/lang/en.json b/src/lang/en.json index 4f79f7ef..c0235a56 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -36,6 +36,8 @@ "DS4.ItemTypeArmorPlural": "Armor", "DS4.ItemTypeShield": "Shield", "DS4.ItemTypeShieldPlural": "Shields", + "DS4.ItemTypeSpell": "Spell", + "DS4.ItemTypeSpellPlural": "Spells", "DS4.ItemTypeTrinket": "Trinket", "DS4.ItemTypeTrinketPlural": "Trinkets", "DS4.ItemTypeEquipment": "Equipment", @@ -72,6 +74,17 @@ "DS4.ArmorMaterialTypeChainAbbr": "Chain", "DS4.ArmorMaterialTypePlate": "Plate", "DS4.ArmorMaterialTypePlateAbbr": "Plate", + "DS4.SpellType": "Spell Type", + "DS4.SpellTypeSpellcasting": "Spellcasting", + "DS4.SpellTypeTargetedSpell": "Targeted Spell", + "DS4.SpellCategory": "Spell Category", + "DS4.SpellCategoryHealing": "Healing", + "DS4.SpellCategoryFire": "Fire", + "DS4.SpellCategoryIce": "Ice", + "DS4.SpellCategoryLight": "Light", + "DS4.SpellCategoryDarkness": "Darkness", + "DS4.SpellCategoryMindAffecting": "Mind Affecting", + "DS4.SpellCategoryElectricity": "Electricity", "DS4.AttributeBody": "Body", "DS4.AttributeMobility": "Mobility", "DS4.AttributeMind": "Mind", @@ -115,5 +128,19 @@ "DS4.ProfileSpecialCharacteristics": "Special Characteristics", "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" + "DS4.ErrorExplodingRecursionLimitExceeded": "Maximum recursion depth for exploding dice roll exceeded", + "DS4.UnitRounds": "Rounds", + "DS4.UnitRoundsAbbr": "rnd", + "DS4.UnitMinutes": "Minutes", + "DS4.UnitMinutesAbbr": "min", + "DS4.UnitHours": "Hours", + "DS4.UnitHoursAbbr": "h", + "DS4.UnitDays": "Days", + "DS4.UnitDaysAbbr": "d", + "DS4.UnitMeters": "Meters", + "DS4.UnitMetersAbbr": "m", + "DS4.UnitKilometers": "Kilometers", + "DS4.UnitKilometersAbbr": "km", + "DS4.UnitCustom": "Custom", + "DS4.UnitCustomAbbr": "-" } diff --git a/src/module/config.ts b/src/module/config.ts index 03b2c9d5..88053370 100644 --- a/src/module/config.ts +++ b/src/module/config.ts @@ -46,6 +46,7 @@ export const DS4 = { weapon: "DS4.ItemTypeWeapon", armor: "DS4.ItemTypeArmor", shield: "DS4.ItemTypeShield", + spell: "DS4.ItemTypeSpell", trinket: "DS4.ItemTypeTrinket", equipment: "DS4.ItemTypeEquipment", talent: "DS4.ItemTypeTalent", @@ -96,6 +97,21 @@ export const DS4 = { plate: "DS4.ArmorMaterialTypePlateAbbr", }, + spellType: { + spellcasting: "DS4.SpellTypeSpellcasting", + targetedSpell: "DS4.SpellTypeTargetedSpell", + }, + + spellCategory: { + healing: "DS4.SpellCategoryHealing", + fire: "DS4.SpellCategoryFire", + ice: "DS4.SpellCategoryIce", + light: "DS4.SpellCategoryLight", + darkness: "DS4.SpellCategoryDarkness", + mindAffecting: "DS4.SpellCategoryMindAffecting", + electricity: "DS4.SpellCategoryElectricity", + }, + /** * Define the set of attributes a character has */ @@ -188,4 +204,30 @@ export const DS4 = { eyeColor: "String", specialCharacteristics: "String", }, + + /** + * Define translations for available units + */ + units: { + rounds: "DS4.UnitRounds", + minutes: "DS4.UnitMinutes", + hours: "DS4.UnitHours", + days: "DS4.UnitHours", + meter: "DS4.UnitMeters", + kilometer: "DS4.UnitKilometers", + custom: "DS4.UnitCustom", + }, + + /** + * Define abbreviations for available units + */ + unitsAbbr: { + rounds: "DS4.UnitRoundsAbbr", + minutes: "DS4.UnitMinutesAbbr", + hours: "DS4.UnitHoursAbbr", + days: "DS4.UnitHoursAbbr", + meter: "DS4.UnitMetersAbbr", + kilometer: "DS4.UnitKilometersAbbr", + custom: "DS4.UnitCustomAbbr", + }, }; diff --git a/src/module/item/item-data.ts b/src/module/item/item-data.ts index 23105eb6..e5be9081 100644 --- a/src/module/item/item-data.ts +++ b/src/module/item/item-data.ts @@ -4,6 +4,7 @@ export type DS4ItemDataType = | DS4Weapon | DS4Armor | DS4Shield + | DS4Spell | DS4Trinket | DS4Equipment | DS4Talent @@ -32,6 +33,25 @@ interface DS4TalentRank extends ModifiableData<number> { max: number; } +interface DS4Spell extends DS4ItemBase, DS4ItemEquipable { + spellType: "spellcasting" | "targetedSpell"; + bonus: string; + spellCategory: + | "healing" + | "fire" + | "ice" + | "light" + | "darkness" + | "mindAffecting" + | "electricity" + | "none" + | "unset"; + maxDistance: UnitData<DistanceUnit>; + effectRadius: UnitData<DistanceUnit>; + duration: UnitData<TemporalUnit>; + scrollPrice: number; +} + interface DS4Shield extends DS4ItemBase, DS4ItemPhysical, DS4ItemEquipable, DS4ItemProtective {} interface DS4Trinket extends DS4ItemBase, DS4ItemPhysical, DS4ItemEquipable {} interface DS4Equipment extends DS4ItemBase, DS4ItemPhysical {} @@ -62,3 +82,10 @@ interface DS4ItemEquipable { interface DS4ItemProtective { armorValue: number; } + +interface UnitData<UnitType> { + value: string; + unit: UnitType; +} +type TemporalUnit = "rounds" | "minutes" | "hours" | "days" | "custom"; +type DistanceUnit = "meter" | "kilometer" | "custom"; diff --git a/src/template.json b/src/template.json index eee8acee..17d2ceca 100644 --- a/src/template.json +++ b/src/template.json @@ -115,6 +115,7 @@ "weapon", "armor", "shield", + "spell", "trinket", "equipment", "talent", @@ -175,6 +176,25 @@ }, "alphabet": { "templates": ["base"] + }, + "spell": { + "templates": ["base", "equipable"], + "spellType": "spellcasting", + "bonus": "", + "spellCategory": "unset", + "maxDistance": { + "value": "", + "unit": "meter" + }, + "effectRadius": { + "value": "", + "unit": "meter" + }, + "duration": { + "value": "", + "unit": "custom" + }, + "scrollPrice": 0 } } } From a3032968281cfbd95bf3f76028e49c69d0aed583 Mon Sep 17 00:00:00 2001 From: Gesina Schwalbe <gesina.schwalbe@pheerai.de> Date: Sat, 9 Jan 2021 18:23:25 +0100 Subject: [PATCH 02/41] description and body templ accept partial-block --- src/templates/item/alphabet-sheet.hbs | 2 +- src/templates/item/armor-sheet.hbs | 4 +-- src/templates/item/equipment-sheet.hbs | 2 +- src/templates/item/language-sheet.hbs | 2 +- src/templates/item/partials/body.hbs | 4 ++- src/templates/item/partials/description.hbs | 6 +++++ src/templates/item/partials/details.hbs | 27 +++++++++++---------- src/templates/item/racialAbility-sheet.hbs | 2 +- src/templates/item/shield-sheet.hbs | 2 +- src/templates/item/talent-sheet.hbs | 2 +- src/templates/item/trinket-sheet.hbs | 2 +- src/templates/item/weapon-sheet.hbs | 2 +- 12 files changed, 33 insertions(+), 24 deletions(-) diff --git a/src/templates/item/alphabet-sheet.hbs b/src/templates/item/alphabet-sheet.hbs index cfd63f9e..5aabb9aa 100644 --- a/src/templates/item/alphabet-sheet.hbs +++ b/src/templates/item/alphabet-sheet.hbs @@ -3,6 +3,6 @@ {{/systems/ds4/templates/item/partials/sheet-header.hbs}} {{!-- Common Item body --}} - {{> systems/ds4/templates/item/partials/body.hbs}} + {{#> systems/ds4/templates/item/partials/body.hbs}}{{/systems/ds4/templates/item/partials/body.hbs}} </form> \ No newline at end of file diff --git a/src/templates/item/armor-sheet.hbs b/src/templates/item/armor-sheet.hbs index 1a2a14bf..5fd59feb 100644 --- a/src/templates/item/armor-sheet.hbs +++ b/src/templates/item/armor-sheet.hbs @@ -12,7 +12,7 @@ </select> </div> <div class="basic-property"> - <label>{{localize "DS4.ArmorMaterialType"}}</label> + <label for="data.armorMaterialType">{{localize "DS4.ArmorMaterialType"}}</label> <select name="data.armorMaterialType" data-type="String"> {{#select data.armorMaterialType}} {{#each config.armorMaterialTypes as |value key|}} @@ -30,5 +30,5 @@ {{/systems/ds4/templates/item/partials/sheet-header.hbs}} {{!-- Common Item body --}} - {{> systems/ds4/templates/item/partials/body.hbs}} + {{#> systems/ds4/templates/item/partials/body.hbs}}{{/systems/ds4/templates/item/partials/body.hbs}} </form> \ No newline at end of file diff --git a/src/templates/item/equipment-sheet.hbs b/src/templates/item/equipment-sheet.hbs index 3fa5d4a9..bbd66400 100644 --- a/src/templates/item/equipment-sheet.hbs +++ b/src/templates/item/equipment-sheet.hbs @@ -3,5 +3,5 @@ {{/systems/ds4/templates/item/partials/sheet-header.hbs}} {{!-- Common Item body --}} - {{> systems/ds4/templates/item/partials/body.hbs}} + {{#> systems/ds4/templates/item/partials/body.hbs}}{{/systems/ds4/templates/item/partials/body.hbs}} </form> \ No newline at end of file diff --git a/src/templates/item/language-sheet.hbs b/src/templates/item/language-sheet.hbs index cfd63f9e..5aabb9aa 100644 --- a/src/templates/item/language-sheet.hbs +++ b/src/templates/item/language-sheet.hbs @@ -3,6 +3,6 @@ {{/systems/ds4/templates/item/partials/sheet-header.hbs}} {{!-- Common Item body --}} - {{> systems/ds4/templates/item/partials/body.hbs}} + {{#> systems/ds4/templates/item/partials/body.hbs}}{{/systems/ds4/templates/item/partials/body.hbs}} </form> \ No newline at end of file diff --git a/src/templates/item/partials/body.hbs b/src/templates/item/partials/body.hbs index 1f465d9f..2a9eaecd 100644 --- a/src/templates/item/partials/body.hbs +++ b/src/templates/item/partials/body.hbs @@ -13,7 +13,9 @@ <section class="sheet-body"> {{!-- Description Tab --}} - {{> systems/ds4/templates/item/partials/description.hbs}} + {{#> systems/ds4/templates/item/partials/description.hbs}} + {{> @partial-block}} + {{/systems/ds4/templates/item/partials/description.hbs}} {{!-- Effects Tab --}} {{> systems/ds4/templates/item/partials/effects.hbs}} diff --git a/src/templates/item/partials/description.hbs b/src/templates/item/partials/description.hbs index d7088a30..b7139387 100644 --- a/src/templates/item/partials/description.hbs +++ b/src/templates/item/partials/description.hbs @@ -1,3 +1,8 @@ +{{!-- +Render a description tab. +Additional elements of the side-properties div can be handed over via the @partial-block. +--}} + <div class="tab flexrow" data-group="primary" data-tab="description"> <div class="side-properties"> {{#if isOwned}} @@ -24,6 +29,7 @@ {{else}} <span>{{localize "DS4.NotOwned"}}</span> {{/if}} + {{> @partial-block}} </div> <div class="description" title="{{localize 'DS4.HeadingDescription'}}"> {{editor content=data.description target="data.description" button=true owner=owner editable=editable}} diff --git a/src/templates/item/partials/details.hbs b/src/templates/item/partials/details.hbs index d4cfb918..0408641a 100644 --- a/src/templates/item/partials/details.hbs +++ b/src/templates/item/partials/details.hbs @@ -3,18 +3,19 @@ {{!-- As you add new fields, add them in here! --}} <div class="side-properties"> <div class="side-property"> - <label for="data.price">{{localize "DS4.PriceGold"}}</label> - <input type="number" min="0" data-dtype="Number" name="data.price" value="{{data.price}}" /> - </div> - <div class="side-property"> - <label for="data.availability">{{localize "DS4.ItemAvailability"}}</label> - <select name="data.availability" data-type="String"> - {{#select data.availability}} - {{#each config.itemAvailabilities as |value key|}} - <option value="{{key}}">{{value}}</option> - {{/each}} - {{/select}} - </select> - </div> + <label for="data.price">{{localize "DS4.PriceGold"}}</label> + <input type="number" min="0" max="99999" step="0.01" data-dtype="Number" + name="data.price" value="{{data.price}}" /> </div> + <div class="side-property"> + <label for="data.availability">{{localize "DS4.ItemAvailability"}}</label> + <select name="data.availability" data-type="String"> + {{#select data.availability}} + {{#each config.itemAvailabilities as |value key|}} + <option value="{{key}}">{{value}}</option> + {{/each}} + {{/select}} + </select> + </div> + </div> </div> \ No newline at end of file diff --git a/src/templates/item/racialAbility-sheet.hbs b/src/templates/item/racialAbility-sheet.hbs index 40771481..e69b5fc5 100644 --- a/src/templates/item/racialAbility-sheet.hbs +++ b/src/templates/item/racialAbility-sheet.hbs @@ -3,6 +3,6 @@ {{/systems/ds4/templates/item/partials/sheet-header.hbs}} {{!-- Common Item body --}} - {{> systems/ds4/templates/item/partials/body.hbs}} + {{#> systems/ds4/templates/item/partials/body.hbs}}{{/systems/ds4/templates/item/partials/body.hbs}} </form> diff --git a/src/templates/item/shield-sheet.hbs b/src/templates/item/shield-sheet.hbs index 1c1092c3..4ef9c9f9 100644 --- a/src/templates/item/shield-sheet.hbs +++ b/src/templates/item/shield-sheet.hbs @@ -10,5 +10,5 @@ {{/systems/ds4/templates/item/partials/sheet-header.hbs}} {{!-- Common Item body --}} - {{> systems/ds4/templates/item/partials/body.hbs}} + {{#> systems/ds4/templates/item/partials/body.hbs}}{{/systems/ds4/templates/item/partials/body.hbs}} </form> \ No newline at end of file diff --git a/src/templates/item/talent-sheet.hbs b/src/templates/item/talent-sheet.hbs index 1611beea..22257d81 100644 --- a/src/templates/item/talent-sheet.hbs +++ b/src/templates/item/talent-sheet.hbs @@ -27,6 +27,6 @@ {{/systems/ds4/templates/item/partials/sheet-header.hbs}} {{!-- Common Item body --}} - {{> systems/ds4/templates/item/partials/body.hbs}} + {{#> systems/ds4/templates/item/partials/body.hbs}}{{/systems/ds4/templates/item/partials/body.hbs}} </form> diff --git a/src/templates/item/trinket-sheet.hbs b/src/templates/item/trinket-sheet.hbs index 3fa5d4a9..bbd66400 100644 --- a/src/templates/item/trinket-sheet.hbs +++ b/src/templates/item/trinket-sheet.hbs @@ -3,5 +3,5 @@ {{/systems/ds4/templates/item/partials/sheet-header.hbs}} {{!-- Common Item body --}} - {{> systems/ds4/templates/item/partials/body.hbs}} + {{#> systems/ds4/templates/item/partials/body.hbs}}{{/systems/ds4/templates/item/partials/body.hbs}} </form> \ No newline at end of file diff --git a/src/templates/item/weapon-sheet.hbs b/src/templates/item/weapon-sheet.hbs index 69145376..b92bf97f 100644 --- a/src/templates/item/weapon-sheet.hbs +++ b/src/templates/item/weapon-sheet.hbs @@ -25,5 +25,5 @@ {{/systems/ds4/templates/item/partials/sheet-header.hbs}} {{!-- Common Item body --}} - {{> systems/ds4/templates/item/partials/body.hbs}} + {{#> systems/ds4/templates/item/partials/body.hbs}}{{/systems/ds4/templates/item/partials/body.hbs}} </form> \ No newline at end of file From 4de9d42ee38dc13efd987f23dfa57bb3227c921a Mon Sep 17 00:00:00 2001 From: Gesina Schwalbe <gesina.schwalbe@pheerai.de> Date: Sat, 9 Jan 2021 18:25:30 +0100 Subject: [PATCH 03/41] added spell cooldownDuration and more localization --- src/lang/en.json | 12 +++++++++--- src/module/config.ts | 35 ++++++++++++++++++++++++----------- src/module/ds4.ts | 6 ++++++ src/module/item/item-data.ts | 1 + src/template.json | 4 ++++ 5 files changed, 44 insertions(+), 14 deletions(-) diff --git a/src/lang/en.json b/src/lang/en.json index c0235a56..8e047af4 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -77,7 +77,7 @@ "DS4.SpellType": "Spell Type", "DS4.SpellTypeSpellcasting": "Spellcasting", "DS4.SpellTypeTargetedSpell": "Targeted Spell", - "DS4.SpellCategory": "Spell Category", + "DS4.SpellCategory": "Category", "DS4.SpellCategoryHealing": "Healing", "DS4.SpellCategoryFire": "Fire", "DS4.SpellCategoryIce": "Ice", @@ -85,6 +85,12 @@ "DS4.SpellCategoryDarkness": "Darkness", "DS4.SpellCategoryMindAffecting": "Mind Affecting", "DS4.SpellCategoryElectricity": "Electricity", + "DS4.SpellBonus": "Spell Bonus", + "DS4.SpellMaxDistance": "Range", + "DS4.SpellEffectRadius": "Radius", + "DS4.SpellDuration": "Duration", + "DS4.SpellCooldownDuration": "Cooldown", + "DS4.SpellScrollPriceGold": "Scroll Price (Gold)", "DS4.AttributeBody": "Body", "DS4.AttributeMobility": "Mobility", "DS4.AttributeMind": "Mind", @@ -100,8 +106,8 @@ "DS4.CombatValuesMovement": "Movement", "DS4.CombatValuesMeleeAttack": "Melee Attack", "DS4.CombatValuesRangedAttack": "Ranged Attack", - "DS4.CombatValuesSpellcasting": "Spellcasting", - "DS4.CombatValuesTargetedSpellcasting": "Targeted Spellcasting", + "DS4.CombatValuesSpellcasting": "Normal", + "DS4.CombatValuesTargetedSpellcasting": "Targeted", "DS4.BaseInfoRace": "Race", "DS4.BaseInfoClass": "Class", "DS4.BaseInfoHeroClass": "Hero Class", diff --git a/src/module/config.ts b/src/module/config.ts index 88053370..5ce89295 100644 --- a/src/module/config.ts +++ b/src/module/config.ts @@ -97,12 +97,12 @@ export const DS4 = { plate: "DS4.ArmorMaterialTypePlateAbbr", }, - spellType: { + spellTypes: { spellcasting: "DS4.SpellTypeSpellcasting", targetedSpell: "DS4.SpellTypeTargetedSpell", }, - spellCategory: { + spellCategories: { healing: "DS4.SpellCategoryHealing", fire: "DS4.SpellCategoryFire", ice: "DS4.SpellCategoryIce", @@ -206,28 +206,41 @@ export const DS4 = { }, /** - * Define translations for available units + * Define translations for available distance units */ - 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.UnitHours", - meter: "DS4.UnitMeters", - kilometer: "DS4.UnitKilometers", + days: "DS4.UnitDays", custom: "DS4.UnitCustom", }, /** * Define abbreviations for available units */ - unitsAbbr: { + temporalUnitsAbbr: { rounds: "DS4.UnitRoundsAbbr", minutes: "DS4.UnitMinutesAbbr", hours: "DS4.UnitHoursAbbr", - days: "DS4.UnitHoursAbbr", - meter: "DS4.UnitMetersAbbr", - kilometer: "DS4.UnitKilometersAbbr", + days: "DS4.UnitDaysAbbr", custom: "DS4.UnitCustomAbbr", }, }; diff --git a/src/module/ds4.ts b/src/module/ds4.ts index a9d46ac2..738912f4 100644 --- a/src/module/ds4.ts +++ b/src/module/ds4.ts @@ -76,6 +76,8 @@ Hooks.once("setup", function () { "armorMaterialTypes", "armorMaterialTypesAbbr", "armorMaterialTypes", + "spellTypes", + "spellCategories", "attributes", "traits", "combatValues", @@ -83,6 +85,10 @@ Hooks.once("setup", function () { "progression", "language", "profile", + "temporalUnits", + "temporalUnitsAbbr", + "distanceUnits", + "distanceUnitsAbbr", ]; // Exclude some from sorting where the default order matters diff --git a/src/module/item/item-data.ts b/src/module/item/item-data.ts index e5be9081..aa779163 100644 --- a/src/module/item/item-data.ts +++ b/src/module/item/item-data.ts @@ -49,6 +49,7 @@ interface DS4Spell extends DS4ItemBase, DS4ItemEquipable { maxDistance: UnitData<DistanceUnit>; effectRadius: UnitData<DistanceUnit>; duration: UnitData<TemporalUnit>; + cooldownDuration: UnitData<TemporalUnit>; scrollPrice: number; } diff --git a/src/template.json b/src/template.json index 17d2ceca..0d723909 100644 --- a/src/template.json +++ b/src/template.json @@ -194,6 +194,10 @@ "value": "", "unit": "custom" }, + "cooldownDuration": { + "value": "", + "unit": "custom" + }, "scrollPrice": 0 } } From 7d04ad2309b8793e2f0e8aca4131a8bbdfc3c251 Mon Sep 17 00:00:00 2001 From: Gesina Schwalbe <gesina.schwalbe@pheerai.de> Date: Sat, 9 Jan 2021 18:26:17 +0100 Subject: [PATCH 04/41] added spell sheet; reverted side-prop style change --- src/scss/components/_description.scss | 14 +++++- src/templates/item/spell-sheet.hbs | 72 +++++++++++++++++++++++++++ 2 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 src/templates/item/spell-sheet.hbs diff --git a/src/scss/components/_description.scss b/src/scss/components/_description.scss index cc4c1322..767fb516 100644 --- a/src/scss/components/_description.scss +++ b/src/scss/components/_description.scss @@ -9,12 +9,13 @@ .side-property { margin: 2px 0; display: grid; - grid-template-columns: minmax(30%, auto) auto; + grid-template-columns: 40% auto; justify-content: left; label { line-height: $default-input-height; font-weight: bold; + padding-right: 3pt; } input, @@ -30,6 +31,17 @@ height: 100%; margin: 0px; } + + .unit-data-pair { + display: flex; + flex-direction: row; + select { + width: 4em; + } + input { + max-width: 7em; + } + } } } diff --git a/src/templates/item/spell-sheet.hbs b/src/templates/item/spell-sheet.hbs new file mode 100644 index 00000000..4dd50f63 --- /dev/null +++ b/src/templates/item/spell-sheet.hbs @@ -0,0 +1,72 @@ +{{!-- ======================================================================== --}} +{{!-- INLINE PARTIAL DEFINITIONS --}} +{{!-- ======================================================================== --}} + + +{{#*inline "unitDatum" }} +<div class="side-property"> + <label>{{localize localizeString}}</label> + <div class="unit-data-pair"> + <input class="item-num-val" type="text" data-dtype="String" + name="data.{{property}}.value" value="{{lookup (lookup data property) 'value'}}" /> + <select name="data.{{property}}.unit" data-type="String"> + {{#select (lookup (lookup data property) 'unit')}} + {{#if (eq unitType 'temporal')}} + {{#each (lookup config 'temporalUnitsAbbr') as |value key|}}<option value="{{key}}">{{value}}</option>{{/each}} + {{else}} + {{#each (lookup config 'distanceUnitsAbbr') as |value key|}}<option value="{{key}}">{{value}}</option>{{/each}} + {{/if}} + {{/select}} + </select> + </div> +</div> +{{/inline}} + + +{{!-- ======================================================================== --}} + + +<form class="{{cssClass}}" autocomplete="off"> + {{#> systems/ds4/templates/item/partials/sheet-header.hbs}} + <div class="grid grid-4col basic-properties"> + <div class="basic-property"> + <label for="data.spellType">{{localize "DS4.SpellType"}}</label> + <select name="data.spellType" data-type="String"> + {{#select data.spellType}} + {{#each config.spellTypes as |value key|}} + <option value="{{key}}">{{value}}</option> + {{/each}} + {{/select}} + </select> + </div> + <div class="basic-property"> + <label for="data.bonus">{{localize "DS4.SpellBonus"}}</label> + <input type="number" name="data.bonus" value="{{data.bonus}}" placeholder="0" data-dtype="Number" /> + </div> + </div> + {{/systems/ds4/templates/item/partials/sheet-header.hbs}} + + {{!-- Common Item body --}} + {{#> systems/ds4/templates/item/partials/body.hbs}} + <div class="side-property"> + <label for="data.spellCategory">{{localize "DS4.SpellCategory"}}</label> + <select name="data.spellCategory" data-type="String"> + {{#select data.spellCategory}} + {{#each config.spellCategories as |value key|}} + <option value="{{key}}">{{value}}</option> + {{/each}} + {{/select}} + </select> + </div> + {{> unitDatum data=data property='maxDistance' localizeString='DS4.SpellMaxDistance' unitType='distance' }} + {{> unitDatum data=data property='effectRadius' localizeString='DS4.SpellEffectRadius' unitType='distance' }} + {{> unitDatum data=data property='duration' localizeString='DS4.SpellDuration' unitType='temporal' }} + {{> unitDatum data=data property='cooldownDurationj' localizeString='DS4.SpellCooldownDuration' unitType='temporal' }} + <div class="side-property"> + <label for="data.scrollPrice">{{localize "DS4.SpellScrollPriceGold"}}</label> + <input type="number" min="0" max="9999" step="0.01" data-dtype="Number" + name="data.scrollPrice" value="{{data.scrollPrice}}" /> + </div> + {{/systems/ds4/templates/item/partials/body.hbs}} + +</form> From 6820ce7c00c6e6daeea876b2141d82de0ee7d278 Mon Sep 17 00:00:00 2001 From: Johannes Loher <johannes.loher@fg4f.de> Date: Sat, 9 Jan 2021 22:51:46 +0100 Subject: [PATCH 05/41] 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<number>; - mind: ModifiableData<number>; -} +export type DS4ActorDataType = DS4ActorDataCharacter | DS4ActorDataCreature; export interface ModifiableData<T> { base: T; @@ -20,18 +6,27 @@ export interface ModifiableData<T> { total?: T; } -interface UsableResource<T> { - total: T; - used: T; -} - interface ResourceData<T> extends ModifiableData<T> { value: T; max?: T; } -// Blueprint in case we need more detailed differentiation -type BodyAttribute = ModifiableData<number>; +interface UsableResource<T> { + total: T; + used: T; +} + +interface DS4ActorDataBase { + attributes: DS4ActorDataAttributes; + traits: DS4ActorDataTraits; + combatValues: DS4ActorDataCombatValues; +} + +interface DS4ActorDataAttributes { + body: ModifiableData<number>; + mobility: ModifiableData<number>; + mind: ModifiableData<number>; +} interface DS4ActorDataTraits { strength: ModifiableData<number>; @@ -53,26 +48,33 @@ interface DS4ActorDataCombatValues { targetedSpellcasting: ModifiableData<number>; } -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<number>; progressPoints: UsableResource<number>; } -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 @@ <div class="flexrow basic-properties"> <div class="basic-property"> - <label class="basic-property-label" for="data.baseInfo.race">{{config.baseInfo.race}}</label> + <label class="basic-property-label" for="data.baseInfo.race">{{config.characterBaseInfo.race}}</label> <input type="text" name="data.baseInfo.race" value="{{data.baseInfo.race}}" data-dtype="String" /> </div> <div class="basic-property"> - <label class="basic-property-label" for="data.baseInfo.culture">{{config.baseInfo.culture}}</label> + <label class="basic-property-label" for="data.baseInfo.culture">{{config.characterBaseInfo.culture}}</label> <input type="text" name="data.baseInfo.culture" value="{{data.baseInfo.culture}}" data-dtype="String" /> </div> <div class="basic-property flex125"> <label class="basic-property-label" - for="data.progression.progressPoints.used">{{config.progression.progressPoints}}</label> + for="data.progression.progressPoints.used">{{config.characterProgression.progressPoints}}</label> <div class="flexrow"> <input type="number" name="data.progression.progressPoints.used" value="{{data.progression.progressPoints.used}}" data-dtype="Number" /><span @@ -29,7 +29,7 @@ </div> <div class="basic-property flex125"> <label class="basic-property-label" - for="data.progression.talentPoints.used">{{config.progression.talentPoints}}</label> + for="data.progression.talentPoints.used">{{config.characterProgression.talentPoints}}</label> <div class="flexrow"> <input type="number" name="data.progression.talentPoints.used" value="{{data.progression.talentPoints.used}}" data-dtype="Number" /><span @@ -39,12 +39,12 @@ </div> </div> <div class="basic-property"> - <label class="basic-property-label" for="data.baseInfo.class">{{config.baseInfo.class}}</label> + <label class="basic-property-label" for="data.baseInfo.class">{{config.characterBaseInfo.class}}</label> <input type="text" name="data.baseInfo.class" value="{{data.baseInfo.class}}" data-dtype="String" /> </div> <div class="basic-property"> <label class="basic-property-label" - for="data.baseInfo.heroClass">{{config.baseInfo.heroClass}}</label> + for="data.baseInfo.heroClass">{{config.characterBaseInfo.heroClass}}</label> <input type="text" name="data.baseInfo.heroClass" value="{{data.baseInfo.heroClass}}" data-dtype="String" /> </div> 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 @@ <div class="progression flexrow"> <div class="progression-entry"> - <h2 class="progression-label"><label for="data.progression.level">{{config.progression.level}}</label> + <h2 class="progression-label"><label for="data.progression.level">{{config.characterProgression.level}}</label> </h2> <input class="progression-value" type="number" name="data.progression.level" value="{{data.progression.level}}" data-dtype="Number" /> </div> <div class="progression-entry"> <h2 class="progression-label"><label - for="data.progression.experiencePoints">{{config.progression.experiencePoints}}</label> + for="data.progression.experiencePoints">{{config.characterProgression.experiencePoints}}</label> </h2> <input class="progression-value" type="number" name="data.progression.experiencePoints" value="{{data.progression.experiencePoints}}" data-dtype="Number" /> 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|}} <div class="profile-entry"> <label for="data.profile.{{profile-data-key}}"> - {{lookup ../config.profile profile-data-key}} + {{lookup ../config.characterProfile profile-data-key}} </label> <input type="text" name="data.profile.{{profile-data-key}}" value="{{profile-data-value}}" - data-dtype="{{lookup ../config/profileDTypes profile-data-key}}" /> + data-dtype="{{lookup ../config/characterProfileDTypes profile-data-key}}" /> </div> {{/each}} </div> From b01e0417ee96820aa83d16b437c79fb611291a91 Mon Sep 17 00:00:00 2001 From: Johannes Loher <johannes.loher@fg4f.de> Date: Sat, 9 Jan 2021 22:54:44 +0100 Subject: [PATCH 06/41] 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 <johannes.loher@fg4f.de> Date: Sat, 9 Jan 2021 22:55:38 +0100 Subject: [PATCH 07/41] 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 27c0ddbca125a0f2db69e79845b677b03b6ac04a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20R=C3=BCmpelein?= <oli_r@fg4f.de> Date: Sat, 9 Jan 2021 23:14:31 +0100 Subject: [PATCH 08/41] Make factory usable from Macros. This does not yet include any modal interface. --- package-lock.json | 2 +- src/module/ds4.ts | 2 + src/module/rolls/check-factory.ts | 93 +++++++++++++++++++++++++++++++ src/module/rolls/check.ts | 1 - 4 files changed, 96 insertions(+), 2 deletions(-) create mode 100644 src/module/rolls/check-factory.ts diff --git a/package-lock.json b/package-lock.json index ff2912b2..efb9982b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2702,7 +2702,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#5a2140620d5be1f42d90dec6c42b3b88ff165f19", "from": "git+https://git.f3l.de/dungeonslayers/foundry-pc-types.git#f3l-fixes", "dev": true, "requires": { diff --git a/src/module/ds4.ts b/src/module/ds4.ts index a9d46ac2..4da8a49c 100644 --- a/src/module/ds4.ts +++ b/src/module/ds4.ts @@ -5,6 +5,7 @@ import { DS4Item } from "./item/item"; import { DS4ItemSheet } from "./item/item-sheet"; import { DS4 } from "./config"; import { DS4Check } from "./rolls/check"; +import { createCheckRoll } from "./rolls/check-factory"; Hooks.once("init", async function () { console.log(`DS4 | Initializing the DS4 Game System\n${DS4.ASCII}`); @@ -13,6 +14,7 @@ Hooks.once("init", async function () { DS4Actor, DS4Item, DS4, + createCheckRoll, }; // Record configuration diff --git a/src/module/rolls/check-factory.ts b/src/module/rolls/check-factory.ts new file mode 100644 index 00000000..a7a718d9 --- /dev/null +++ b/src/module/rolls/check-factory.ts @@ -0,0 +1,93 @@ +// TODO: Rename to something sane. + +class DefaultCheckOptions implements CheckOptions { + maxCritSuccess = 1; + minCritFailure = 20; + useSlayingDice = false; + rollMode: RollMode = "roll"; + + mergeWith(other: Partial<CheckOptions>): CheckOptions { + return { ...this, ...other } as CheckOptions; + } +} + +class CheckFactory { + constructor( + private checkTargetValue: number, + private gmModifier: number, + passedOptions: Partial<CheckOptions> = {}, + ) { + this.checkOptions = new DefaultCheckOptions().mergeWith(passedOptions); + } + + private checkOptions: CheckOptions; + + async execute(): Promise<void> { + const rollCls: typeof Roll = CONFIG.Dice.rolls[0]; + + const formula = [ + "ds", + this.createTargetValueTerm(), + this.createCritTerm(), + this.createSlayingDiceTerm(), + ].filterJoin(""); + const roll = new rollCls(formula); + + const rollModeTemplate = this.checkOptions.rollMode; + return roll.toMessage({}, { rollMode: rollModeTemplate, create: true }); + } + + // Term generators + createTargetValueTerm(): string { + if (this.checkTargetValue != null) { + return "v" + this.checkTargetValue; + } else { + return null; + } + } + + createCritTerm(): string { + const minCritRequired = this.checkOptions.minCritFailure !== CheckFactory.defaultCheckOptions.minCritFailure; + const maxCritRequired = this.checkOptions.maxCritSuccess !== CheckFactory.defaultCheckOptions.maxCritSuccess; + + if (minCritRequired || maxCritRequired) { + return "c" + (this.checkOptions.maxCritSuccess ?? "") + "," + (this.checkOptions.minCritFailure ?? ""); + } else { + return null; + } + } + + createSlayingDiceTerm(): string { + return this.checkOptions.useSlayingDice ? "x" : null; + } + + static defaultCheckOptions = new DefaultCheckOptions(); +} + +// TODO: Figure out return of roll (void should be Ok, tough?) +export async function createCheckRoll(targetValue: number, options: Partial<CheckOptions>): Promise<void> { + // Ask for additional required data; + const gmModifier = await askGmModifier(); + + // Create Factory + const cf = new CheckFactory(targetValue, gmModifier, options); + + // Possibly additional processing + + // Execute roll + await cf.execute(); +} + +async function askGmModifier(): Promise<number> { + // Render model interface and return value + return 0; +} + +interface CheckOptions { + maxCritSuccess: number; + minCritFailure: number; + useSlayingDice: boolean; + rollMode: RollMode; +} + +type RollMode = "roll" | "gmroll" | "blindroll" | "selfroll"; diff --git a/src/module/rolls/check.ts b/src/module/rolls/check.ts index 5886813c..7911cded 100644 --- a/src/module/rolls/check.ts +++ b/src/module/rolls/check.ts @@ -132,7 +132,6 @@ export class DS4Check extends DiceTerm { static readonly DEFAULT_TARGET_VALUE = 10; static readonly DEFAULT_MAX_CRIT_SUCCESS = 1; static readonly DEFAULT_MIN_CRIT_FAILURE = 20; - // TODO: add to Type declarations static DENOMINATION = "s"; static MODIFIERS = { x: "explode", From c94ff4a67acaa457a87e32d19516a21874ef8e2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20R=C3=BCmpelein?= <oli_r@fg4f.de> Date: Sat, 9 Jan 2021 23:21:57 +0100 Subject: [PATCH 09/41] Rudimentary docs. --- src/module/rolls/check-factory.ts | 36 ++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/src/module/rolls/check-factory.ts b/src/module/rolls/check-factory.ts index a7a718d9..43b06927 100644 --- a/src/module/rolls/check-factory.ts +++ b/src/module/rolls/check-factory.ts @@ -1,26 +1,32 @@ // TODO: Rename to something sane. -class DefaultCheckOptions implements CheckOptions { +/** + * Provides default values for all arguments the `CheckFactory` expects. + */ +class DefaultCheckOptions implements DS4CheckFactoryOptions { maxCritSuccess = 1; minCritFailure = 20; useSlayingDice = false; - rollMode: RollMode = "roll"; + rollMode: DS4RollMode = "roll"; - mergeWith(other: Partial<CheckOptions>): CheckOptions { - return { ...this, ...other } as CheckOptions; + mergeWith(other: Partial<DS4CheckFactoryOptions>): DS4CheckFactoryOptions { + return { ...this, ...other } as DS4CheckFactoryOptions; } } +/** + * Most basic class responsible for generating the chat formula and passing it to the chat as roll. + */ class CheckFactory { constructor( private checkTargetValue: number, private gmModifier: number, - passedOptions: Partial<CheckOptions> = {}, + passedOptions: Partial<DS4CheckFactoryOptions> = {}, ) { this.checkOptions = new DefaultCheckOptions().mergeWith(passedOptions); } - private checkOptions: CheckOptions; + private checkOptions: DS4CheckFactoryOptions; async execute(): Promise<void> { const rollCls: typeof Roll = CONFIG.Dice.rolls[0]; @@ -65,7 +71,12 @@ class CheckFactory { } // TODO: Figure out return of roll (void should be Ok, tough?) -export async function createCheckRoll(targetValue: number, options: Partial<CheckOptions>): Promise<void> { +/** + * Asks the user for all unknown/necessary information and passes them on to perform a roll. + * @param targetValue {number} The Check Target Number ("CTN") + * @param options {Partial<DS4CheckFactoryOptions>} Options changing the behaviour of the roll and message. + */ +export async function createCheckRoll(targetValue: number, options: Partial<DS4CheckFactoryOptions>): Promise<void> { // Ask for additional required data; const gmModifier = await askGmModifier(); @@ -78,16 +89,21 @@ export async function createCheckRoll(targetValue: number, options: Partial<Chec await cf.execute(); } +/** + * Responsible for rendering the modal interface asking for the modifier specified by GM. + * + * @returns {Promise<number>} The number by the user. + */ async function askGmModifier(): Promise<number> { // Render model interface and return value return 0; } -interface CheckOptions { +export interface DS4CheckFactoryOptions { maxCritSuccess: number; minCritFailure: number; useSlayingDice: boolean; - rollMode: RollMode; + rollMode: DS4RollMode; } -type RollMode = "roll" | "gmroll" | "blindroll" | "selfroll"; +export type DS4RollMode = "roll" | "gmroll" | "blindroll" | "selfroll"; From 884327b156a74a368b219bc14c0ed311cb12e5cf Mon Sep 17 00:00:00 2001 From: Gesina Schwalbe <gesina.schwalbe@pheerai.de> Date: Sat, 9 Jan 2021 23:39:35 +0100 Subject: [PATCH 10/41] added spell tab and sorted tabs --- src/lang/en.json | 10 ++- src/module/actor/actor-sheet.ts | 2 +- src/module/config.ts | 8 ++ src/module/ds4.ts | 1 + src/templates/actor/actor-sheet.hbs | 24 +++--- .../actor/partials/items-overview.hbs | 6 +- .../actor/partials/spells-overview.hbs | 86 +++++++++++++++++++ .../actor/partials/talents-overview.hbs | 2 - src/templates/item/spell-sheet.hbs | 4 +- 9 files changed, 122 insertions(+), 21 deletions(-) create mode 100644 src/templates/actor/partials/spells-overview.hbs diff --git a/src/lang/en.json b/src/lang/en.json index 8e047af4..df1033d6 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -1,12 +1,13 @@ { "DS4.UserInteractionAddItem": "Add item", "DS4.NotOwned": "No owner", - "DS4.HeadingDescription": "Description", + "DS4.HeadingBiography": "Biography", "DS4.HeadingDetails": "Details", "DS4.HeadingEffects": "Effects", "DS4.HeadingInventory": "Inventory", "DS4.HeadingProfile": "Profile", "DS4.HeadingTalents": "Talents & Abilities", + "DS4.HeadingSpells": "Spells", "DS4.AttackType": "Attack Type", "DS4.AttackTypeAbbr": "AT", "DS4.WeaponBonus": "Weapon Bonus", @@ -20,6 +21,7 @@ "DS4.PriceGold": "Price (Gold)", "DS4.StorageLocation": "Stored at", "DS4.ItemEquipped": "Equipped", + "DS4.ItemEquippedAbbr": "E", "DS4.ItemOwner": "Owner", "DS4.ItemAvailability": "Availability", "DS4.ItemAvailabilityHamlet": "Hamlet", @@ -75,6 +77,7 @@ "DS4.ArmorMaterialTypePlate": "Plate", "DS4.ArmorMaterialTypePlateAbbr": "Plate", "DS4.SpellType": "Spell Type", + "DS4.SpellTypeAbbr": "T", "DS4.SpellTypeSpellcasting": "Spellcasting", "DS4.SpellTypeTargetedSpell": "Targeted Spell", "DS4.SpellCategory": "Category", @@ -86,6 +89,7 @@ "DS4.SpellCategoryMindAffecting": "Mind Affecting", "DS4.SpellCategoryElectricity": "Electricity", "DS4.SpellBonus": "Spell Bonus", + "DS4.SpellBonusAbbr": "SB", "DS4.SpellMaxDistance": "Range", "DS4.SpellEffectRadius": "Radius", "DS4.SpellDuration": "Duration", @@ -147,6 +151,6 @@ "DS4.UnitMetersAbbr": "m", "DS4.UnitKilometers": "Kilometers", "DS4.UnitKilometersAbbr": "km", - "DS4.UnitCustom": "Custom", - "DS4.UnitCustomAbbr": "-" + "DS4.UnitCustom": "Custom Unit", + "DS4.UnitCustomAbbr": " " } diff --git a/src/module/actor/actor-sheet.ts b/src/module/actor/actor-sheet.ts index 51eb9e65..caebd890 100644 --- a/src/module/actor/actor-sheet.ts +++ b/src/module/actor/actor-sheet.ts @@ -32,7 +32,7 @@ export class DS4ActorSheet extends ActorSheet<DS4ActorDataType, DS4Actor, DS4Ite template: "systems/ds4/templates/actor/actor-sheet.hbs", width: 725, height: 600, - tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "description" }], + tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "inventory" }], }); } diff --git a/src/module/config.ts b/src/module/config.ts index 5ce89295..4f862e86 100644 --- a/src/module/config.ts +++ b/src/module/config.ts @@ -26,6 +26,14 @@ export const DS4 = { ranged: "systems/ds4/assets/official/DS4-RAT.png", }, + /** + * Define the file paths to icon images + */ + spellTypesIcons: { + spellcasting: "systems/ds4/assets/official/DS4-SPC.png", + targetedSpell: "systems/ds4/assets/official/DS4-TSC.png", + }, + /** * Define the set of item availabilties */ diff --git a/src/module/ds4.ts b/src/module/ds4.ts index 738912f4..814bde54 100644 --- a/src/module/ds4.ts +++ b/src/module/ds4.ts @@ -48,6 +48,7 @@ async function registerHandlebarsPartials() { "systems/ds4/templates/item/partials/body.hbs", "systems/ds4/templates/actor/partials/items-overview.hbs", "systems/ds4/templates/actor/partials/talents-overview.hbs", + "systems/ds4/templates/actor/partials/spells-overview.hbs", "systems/ds4/templates/actor/partials/overview-add-button.hbs", "systems/ds4/templates/actor/partials/overview-control-buttons.hbs", "systems/ds4/templates/actor/partials/attributes-traits.hbs", diff --git a/src/templates/actor/actor-sheet.hbs b/src/templates/actor/actor-sheet.hbs index 8e3e5f54..6763e440 100644 --- a/src/templates/actor/actor-sheet.hbs +++ b/src/templates/actor/actor-sheet.hbs @@ -58,26 +58,30 @@ {{!-- Sheet Tab Navigation --}} <nav class="sheet-tabs tabs" data-group="primary"> - <a class="item" data-tab="description">{{localize 'DS4.HeadingDescription'}}</a> + <a class="item" data-tab="inventory">{{localize 'DS4.HeadingInventory'}}</a> + <a class="item" data-tab="spells">{{localize 'DS4.HeadingSpells'}}</a> <a class="item" data-tab="talents">{{localize 'DS4.HeadingTalents'}}</a> <a class="item" data-tab="profile">{{localize "DS4.HeadingProfile"}}</a> - <a class="item" data-tab="inventory">{{localize 'DS4.HeadingInventory'}}</a> + <a class="item" data-tab="biography">{{localize 'DS4.HeadingBiography'}}</a> </nav> {{!-- Sheet Body --}} <section class="sheet-body"> - {{!-- Biography Tab --}} - <div class="tab biography" data-group="primary" data-tab="description"> - {{editor content=data.biography target="data.biography" button=true owner=owner editable=editable}} - </div> + {{!-- Items Tab --}} + {{> systems/ds4/templates/actor/partials/items-overview.hbs}} - {{! Profile Tab --}} - {{> systems/ds4/templates/actor/partials/profile.hbs}} + {{!-- Spells Tab --}} + {{> systems/ds4/templates/actor/partials/spells-overview.hbs}} {{!-- Talents Tab --}} {{> systems/ds4/templates/actor/partials/talents-overview.hbs}} - {{!-- Items Tab --}} - {{> systems/ds4/templates/actor/partials/items-overview.hbs}} + {{! Profile Tab --}} + {{> systems/ds4/templates/actor/partials/profile.hbs}} + + {{!-- Biography Tab --}} + <div class="tab biography" data-group="primary" data-tab="biography"> + {{editor content=data.biography target="data.biography" button=true owner=owner editable=editable}} + </div> </section> </form> \ No newline at end of file diff --git a/src/templates/actor/partials/items-overview.hbs b/src/templates/actor/partials/items-overview.hbs index 676a9bfc..a27be471 100644 --- a/src/templates/actor/partials/items-overview.hbs +++ b/src/templates/actor/partials/items-overview.hbs @@ -37,7 +37,7 @@ <li class="item flexrow item-header"> {{!-- equipped --}} {{#if (ne dataType 'equipment')}} - <div class="flex05" title="{{localize 'DS4.ItemEquipped'}}">E</div> + <div class="flex05" title="{{localize 'DS4.ItemEquipped'}}">{{localize 'DS4.ItemEquippedAbbr'}}</div> {{/if}} {{!-- image --}} <div class="flex05 item-image"></div> @@ -78,10 +78,10 @@ </div> {{!-- amount --}} <input class="flex05 item-num-val item-change" type="number" min="0" step="1" value="{{item.data.data.quantity}}" data-dtype="Number" - data-property="data.quantity" title="{{localize 'DS4.Quantity'}}"> + data-property="data.quantity" title="{{localize 'DS4.Quantity'}}" /> {{!-- name --}} <input class="flex3 item-name item-change" type="text" value="{{item.name}}" data-dtype="String" - data-property="name" title="{{localize 'DS4.ItemName'}}"> + data-property="name" title="{{localize 'DS4.ItemName'}}" /> {{!-- item type specifics --}} {{> @partial-block}} {{!-- description --}} diff --git a/src/templates/actor/partials/spells-overview.hbs b/src/templates/actor/partials/spells-overview.hbs new file mode 100644 index 00000000..f8012780 --- /dev/null +++ b/src/templates/actor/partials/spells-overview.hbs @@ -0,0 +1,86 @@ +{{!-- ======================================================================== --}} +{{!-- INLINE PARTIAL DEFINITIONS --}} +{{!-- ======================================================================== --}} + + +{{!-- +!-- Two templates for displaying values with unit. +!-- @param unitDatum: the object to display; must have a value and a unit attribute +!-- @param localizationString +!-- @param config: the config object +--}} +{{#*inline "temporalUnit"}} +<div class="unit-data-pair item-num-val" + title="{{localize localizationString}} [{{lookup config.temporalUnits unitDatum.unit}}]" > + {{unitDatum.value}}{{lookup config.temporalUnitsAbbr unitDatum.unit}} +</div> +{{/inline}} + +{{#*inline "distanceUnit"}} +<div class="unit-data-pair item-num-val" + title="{{localize localizationString}} [{{lookup config.distanceUnits unitDatum.unit}}]" > + {{unitDatum.value}}{{lookup config.distanceUnitsAbbr unitDatum.unit}} +</div> +{{/inline}} + + +{{!-- ======================================================================== --}} + + +<div class="tab items" data-group="primary" data-tab="spells"> + <ol class="items-list"> + <li class="item flexrow item-header"> + {{!-- equipped --}} + <div class="flex05 item-image" title="{{localize 'DS4.ItemEquipped'}}">{{localize 'DS4.ItemEquippedAbbr'}}</div> + {{!-- image --}} + <div class="flex05 item-image"></div> + {{!-- name --}} + <div class="flex2 item-name">{{localize 'DS4.ItemName'}}</div> + {{!-- spell type --}} + <div class="item-image" title="{{localize 'DS4.SpellType'}}">{{localize 'DS4.SpellTypeAbbr'}}</div> + {{!-- spell bonus --}} + <div class="item-num-val" title="{{localize 'DS4.SpellBonus'}}">{{localize 'DS4.SpellBonusAbbr'}}</div> + {{!-- max. distance --}} + <div class="item-num-val" title="{{localize 'DS4.SpellMaxDistance'}}"><i class="fas fa-ruler"></i></div> + {{!-- duration --}} + <div class="item-num-val" title="{{localize 'DS4.SpellDuration'}}"><i class="far fa-clock"></i></div> + {{!-- cooldown duration --}} + <div class="item-num-val" title="{{localize 'DS4.SpellCooldownDuration'}}"><i class="fas fa-hourglass-half"></i></div> + {{!-- description --}} + {{!-- <div class="flex3">{{localize 'DS4.HeadingDescription'}}</div> --}} + {{!-- add button --}} + {{> systems/ds4/templates/actor/partials/overview-add-button.hbs dataType='spell' }} + </li> + {{#each itemsByType.spell as |item id|}} + <li class="item flexrow" data-item-id="{{item._id}}"> + <input class="flex05 item-image item-change" type="checkbox" {{checked item.data.data.equipped}} data-dtype="Boolean" + data-property="data.equipped" title="{{localize 'DS4.ItemEquipped'}}"> + {{!-- image --}} + <div class="flex05 item-image"> + <img src="{{item.img}}" title="{{item.name}}" width="24" height="24" /> + </div> + {{!-- name --}} + <input class="flex2 item-name item-change" type="text" value="{{item.name}}" data-dtype="String" + data-property="name" title="{{localize 'DS4.ItemName'}}" /> + {{!-- spell type --}} + <div class="flex05 item-image"> + <img src="{{lookup ../config.spellTypesIcons item.data.data.spellType}}" + title="{{lookup ../config.spellTypes item.data.data.spellType}}" width="24" height="24" /> + </div> + {{!-- spell bonus --}} + <input class="item-num-val item-change" type="text" data-dtype="String" + data-property="data.bonus" value="{{item.data.data.bonus}}" title="{{localize 'DS4.SpellBonus'}}" /> + {{!-- max. distance --}} + {{> distanceUnit localizationString='DS4.SpellMaxDistance' unitDatum=item.data.data.maxDistance config=../config}} + {{!-- duration --}} + {{> temporalUnit localizationString='DS4.SpellDuration' unitDatum=item.data.data.duration config=../config}} + {{!-- cooldown duration --}} + {{> temporalUnit localizationString='DS4.SpellCooldownDuration' unitDatum=item.data.data.cooldownDuration config=../config}} + {{!-- description --}} + {{!-- <div class="flex3 item-description">{{{item.data.data.description}}}</div> --}} + {{!-- control buttons --}} + {{> systems/ds4/templates/actor/partials/overview-control-buttons.hbs }} + </li> + {{/each}} + </ol> +</div> \ No newline at end of file diff --git a/src/templates/actor/partials/talents-overview.hbs b/src/templates/actor/partials/talents-overview.hbs index f4a06005..593955fa 100644 --- a/src/templates/actor/partials/talents-overview.hbs +++ b/src/templates/actor/partials/talents-overview.hbs @@ -1,8 +1,6 @@ {{!-- ======================================================================== --}} {{!-- INLINE PARTIAL DEFINITIONS --}} {{!-- ======================================================================== --}} -{{!-- TODO: remove duplicate add and delete button definition --}} - {{!-- diff --git a/src/templates/item/spell-sheet.hbs b/src/templates/item/spell-sheet.hbs index 4dd50f63..5f2c7a28 100644 --- a/src/templates/item/spell-sheet.hbs +++ b/src/templates/item/spell-sheet.hbs @@ -41,7 +41,7 @@ </div> <div class="basic-property"> <label for="data.bonus">{{localize "DS4.SpellBonus"}}</label> - <input type="number" name="data.bonus" value="{{data.bonus}}" placeholder="0" data-dtype="Number" /> + <input type="text" name="data.bonus" value="{{data.bonus}}" data-dtype="String" /> </div> </div> {{/systems/ds4/templates/item/partials/sheet-header.hbs}} @@ -61,7 +61,7 @@ {{> unitDatum data=data property='maxDistance' localizeString='DS4.SpellMaxDistance' unitType='distance' }} {{> unitDatum data=data property='effectRadius' localizeString='DS4.SpellEffectRadius' unitType='distance' }} {{> unitDatum data=data property='duration' localizeString='DS4.SpellDuration' unitType='temporal' }} - {{> unitDatum data=data property='cooldownDurationj' localizeString='DS4.SpellCooldownDuration' unitType='temporal' }} + {{> unitDatum data=data property='cooldownDuration' localizeString='DS4.SpellCooldownDuration' unitType='temporal' }} <div class="side-property"> <label for="data.scrollPrice">{{localize "DS4.SpellScrollPriceGold"}}</label> <input type="number" min="0" max="9999" step="0.01" data-dtype="Number" From 18a4e2005a255af2b9d27a2cb0c5a71fdf8e58dd Mon Sep 17 00:00:00 2001 From: Gesina Schwalbe <gesina.schwalbe@pheerai.de> Date: Sun, 10 Jan 2021 00:05:29 +0100 Subject: [PATCH 11/41] added German translation for spell stuff --- src/lang/de.json | 43 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/src/lang/de.json b/src/lang/de.json index d5e4d4f7..5b9ed87c 100644 --- a/src/lang/de.json +++ b/src/lang/de.json @@ -1,12 +1,13 @@ { "DS4.UserInteractionAddItem": "Neu", "DS4.NotOwned": "Nicht besessen", - "DS4.HeadingDescription": "Beschreibung", + "DS4.HeadingBiography": "Biografie", "DS4.HeadingDetails": "Details", "DS4.HeadingEffects": "Effekte", "DS4.HeadingInventory": "Inventar", "DS4.HeadingProfile": "Profil", "DS4.HeadingTalents": "Talente & Fähigkeiten", + "DS4.HeadingSpells": "Zaubersprüche", "DS4.AttackType": "Angriffs Typ", "DS4.AttackTypeAbbr": "AT", "DS4.WeaponBonus": "Waffen Bonus", @@ -20,7 +21,8 @@ "DS4.PriceGold": "Preis (Gold)", "DS4.StorageLocation": "Wo gelagert", "DS4.ItemEquipped": "Ausgerüstet", - "DS4.ItemOwner": "Eigentümer", + "DS4.ItemEquippedAbbr": "A", + "DS4.ItemOwner": "Besitzer", "DS4.ItemAvailability": "Verfügbarkeit", "DS4.ItemAvailabilityHamlet": "Dorf", "DS4.ItemAvailabilityVilage": "Kleinstadt", @@ -36,6 +38,8 @@ "DS4.ItemTypeArmorPlural": "Panzerungen", "DS4.ItemTypeShield": "Schild", "DS4.ItemTypeShieldPlural": "Schilde", + "DS4.ItemTypeSpell": "Zauberspruch", + "DS4.ItemTypeSpellPlural": "Zaubersprüche", "DS4.ItemTypeTrinket": "Schmuckstück", "DS4.ItemTypeTrinketPlural": "Schmuckstücke", "DS4.ItemTypeEquipment": "Ausrüstung", @@ -72,6 +76,25 @@ "DS4.ArmorMaterialTypeChainAbbr": "Ketten", "DS4.ArmorMaterialTypePlate": "Platten", "DS4.ArmorMaterialTypePlateAbbr": "Platten", + "DS4.SpellType": "Zauberspruchtyp", + "DS4.SpellTypeAbbr": "T", + "DS4.SpellTypeSpellcasting": "Zaubern", + "DS4.SpellTypeTargetedSpell": "Zielzaubern", + "DS4.SpellCategory": "Kategorie", + "DS4.SpellCategoryHealing": "Heilung", + "DS4.SpellCategoryFire": "Feuer", + "DS4.SpellCategoryIce": "Eis", + "DS4.SpellCategoryLight": "Licht", + "DS4.SpellCategoryDarkness": "Schatten", + "DS4.SpellCategoryMindAffecting": "Geistensbeeinflussend", + "DS4.SpellCategoryElectricity": "Elektrizität", + "DS4.SpellBonus": "Zauberbonus", + "DS4.SpellBonusAbbr": "ZB", + "DS4.SpellMaxDistance": "Reichweite", + "DS4.SpellEffectRadius": "Effektradius", + "DS4.SpellDuration": "Wirkdauer", + "DS4.SpellCooldownDuration": "Abklingzeit", + "DS4.SpellScrollPriceGold": "Schriftrollenpreis (Gold)", "DS4.AttributeBody": "Körper", "DS4.AttributeMobility": "Agilität", "DS4.AttributeMind": "Geist", @@ -115,5 +138,19 @@ "DS4.ProfileSpecialCharacteristics": "Besondere Eigenschaften", "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." + "DS4.ErrorExplodingRecursionLimitExceeded": "Die maximale Rekursionstiefe für slayende Würfelwürfe wurde überschritten.", + "DS4.UnitRounds": "Runden", + "DS4.UnitRoundsAbbr": "Rnd", + "DS4.UnitMinutes": "Minuten", + "DS4.UnitMinutesAbbr": "min", + "DS4.UnitHours": "Stunden", + "DS4.UnitHoursAbbr": "h", + "DS4.UnitDays": "Tage", + "DS4.UnitDaysAbbr": "d", + "DS4.UnitMeters": "Meter", + "DS4.UnitMetersAbbr": "m", + "DS4.UnitKilometers": "Kilometer", + "DS4.UnitKilometersAbbr": "km", + "DS4.UnitCustom": "individuell", + "DS4.UnitCustomAbbr": " " } From 0eb447d2795c8f414a9c18ca3178abfaa03d9555 Mon Sep 17 00:00:00 2001 From: Gesina Schwalbe <gesina.schwalbe@pheerai.de> Date: Sun, 10 Jan 2021 00:30:51 +0100 Subject: [PATCH 12/41] added German localization for spells - added missing German localizations - fixed some localizations - renamed targetedSpell -> targetedSpellcasting for consistency --- src/lang/de.json | 5 ++++- src/lang/en.json | 9 ++++++--- src/module/config.ts | 4 ++-- src/module/item/item-data.ts | 2 +- src/templates/actor/partials/items-overview.hbs | 2 +- src/templates/actor/partials/spells-overview.hbs | 2 +- src/templates/actor/partials/talents-overview.hbs | 4 ++-- src/templates/item/partials/body.hbs | 2 +- src/templates/item/partials/description.hbs | 2 +- 9 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/lang/de.json b/src/lang/de.json index 5b9ed87c..2b719286 100644 --- a/src/lang/de.json +++ b/src/lang/de.json @@ -1,5 +1,7 @@ { "DS4.UserInteractionAddItem": "Neu", + "DS4.UserInteractionEditItem": "Bearbeiten", + "DS4.UserInteractionDeleteItem": "Löschen", "DS4.NotOwned": "Nicht besessen", "DS4.HeadingBiography": "Biografie", "DS4.HeadingDetails": "Details", @@ -17,6 +19,7 @@ "DS4.AttackTypeMelee": "Schlagen", "DS4.AttackTypeRanged": "Schießen", "DS4.AttackTypeMeleeRanged": "Schlagen + Schießen", + "DS4.Description": "Beschreibung", "DS4.Quantity": "Menge", "DS4.PriceGold": "Preis (Gold)", "DS4.StorageLocation": "Wo gelagert", @@ -79,7 +82,7 @@ "DS4.SpellType": "Zauberspruchtyp", "DS4.SpellTypeAbbr": "T", "DS4.SpellTypeSpellcasting": "Zaubern", - "DS4.SpellTypeTargetedSpell": "Zielzaubern", + "DS4.SpellTypeTargetedSpellcasting": "Zielzaubern", "DS4.SpellCategory": "Kategorie", "DS4.SpellCategoryHealing": "Heilung", "DS4.SpellCategoryFire": "Feuer", diff --git a/src/lang/en.json b/src/lang/en.json index df1033d6..e6136a0f 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -1,5 +1,7 @@ { "DS4.UserInteractionAddItem": "Add item", + "DS4.UserInteractionEditItem": "Edit item", + "DS4.UserInteractionDeleteItem": "Delete item", "DS4.NotOwned": "No owner", "DS4.HeadingBiography": "Biography", "DS4.HeadingDetails": "Details", @@ -17,6 +19,7 @@ "DS4.AttackTypeMelee": "Melee", "DS4.AttackTypeRanged": "Ranged", "DS4.AttackTypeMeleeRanged": "Melee / Ranged", + "DS4.Description": "Description", "DS4.Quantity": "Quantity", "DS4.PriceGold": "Price (Gold)", "DS4.StorageLocation": "Stored at", @@ -79,7 +82,7 @@ "DS4.SpellType": "Spell Type", "DS4.SpellTypeAbbr": "T", "DS4.SpellTypeSpellcasting": "Spellcasting", - "DS4.SpellTypeTargetedSpell": "Targeted Spell", + "DS4.SpellTypeTargetedSpellcasting": "Targeted Spellcasting", "DS4.SpellCategory": "Category", "DS4.SpellCategoryHealing": "Healing", "DS4.SpellCategoryFire": "Fire", @@ -110,8 +113,8 @@ "DS4.CombatValuesMovement": "Movement", "DS4.CombatValuesMeleeAttack": "Melee Attack", "DS4.CombatValuesRangedAttack": "Ranged Attack", - "DS4.CombatValuesSpellcasting": "Normal", - "DS4.CombatValuesTargetedSpellcasting": "Targeted", + "DS4.CombatValuesSpellcasting": "Spellcasting", + "DS4.CombatValuesTargetedSpellcasting": "Targeted Spellcasting", "DS4.BaseInfoRace": "Race", "DS4.BaseInfoClass": "Class", "DS4.BaseInfoHeroClass": "Hero Class", diff --git a/src/module/config.ts b/src/module/config.ts index 4f862e86..d8f9b851 100644 --- a/src/module/config.ts +++ b/src/module/config.ts @@ -31,7 +31,7 @@ export const DS4 = { */ spellTypesIcons: { spellcasting: "systems/ds4/assets/official/DS4-SPC.png", - targetedSpell: "systems/ds4/assets/official/DS4-TSC.png", + targetedSpellcasting: "systems/ds4/assets/official/DS4-TSC.png", }, /** @@ -107,7 +107,7 @@ export const DS4 = { spellTypes: { spellcasting: "DS4.SpellTypeSpellcasting", - targetedSpell: "DS4.SpellTypeTargetedSpell", + targetedSpellcasting: "DS4.SpellTypeTargetedSpellcasting", }, spellCategories: { diff --git a/src/module/item/item-data.ts b/src/module/item/item-data.ts index aa779163..45622a6e 100644 --- a/src/module/item/item-data.ts +++ b/src/module/item/item-data.ts @@ -34,7 +34,7 @@ interface DS4TalentRank extends ModifiableData<number> { } interface DS4Spell extends DS4ItemBase, DS4ItemEquipable { - spellType: "spellcasting" | "targetedSpell"; + spellType: "spellcasting" | "targetedSpellcasting"; bonus: string; spellCategory: | "healing" diff --git a/src/templates/actor/partials/items-overview.hbs b/src/templates/actor/partials/items-overview.hbs index a27be471..4dbd269b 100644 --- a/src/templates/actor/partials/items-overview.hbs +++ b/src/templates/actor/partials/items-overview.hbs @@ -48,7 +48,7 @@ {{!-- item type specifics --}} {{> @partial-block }} {{!-- description --}} - <div class="flex4">{{localize 'DS4.HeadingDescription'}}</div> + <div class="flex4">{{localize 'DS4.Description'}}</div> {{!-- add button --}} {{> systems/ds4/templates/actor/partials/overview-add-button.hbs dataType=dataType }} </li> diff --git a/src/templates/actor/partials/spells-overview.hbs b/src/templates/actor/partials/spells-overview.hbs index f8012780..5338955c 100644 --- a/src/templates/actor/partials/spells-overview.hbs +++ b/src/templates/actor/partials/spells-overview.hbs @@ -47,7 +47,7 @@ {{!-- cooldown duration --}} <div class="item-num-val" title="{{localize 'DS4.SpellCooldownDuration'}}"><i class="fas fa-hourglass-half"></i></div> {{!-- description --}} - {{!-- <div class="flex3">{{localize 'DS4.HeadingDescription'}}</div> --}} + {{!-- <div class="flex3">{{localize 'DS4.Description'}}</div> --}} {{!-- add button --}} {{> systems/ds4/templates/actor/partials/overview-add-button.hbs dataType='spell' }} </li> diff --git a/src/templates/actor/partials/talents-overview.hbs b/src/templates/actor/partials/talents-overview.hbs index 593955fa..8ef93113 100644 --- a/src/templates/actor/partials/talents-overview.hbs +++ b/src/templates/actor/partials/talents-overview.hbs @@ -108,7 +108,7 @@ {{!-- name --}} <div class="flex1 item-name">{{localize 'DS4.ItemName'}}</div> {{!-- description --}} - <div class="flex3">{{localize 'DS4.HeadingDescription'}}</div> + <div class="flex3">{{localize 'DS4.Description'}}</div> {{!-- add button --}} {{> systems/ds4/templates/actor/partials/overview-add-button.hbs dataType=dataType }} </li> @@ -130,7 +130,7 @@ {{!-- rank info --}} <div class="flex3">{{localize 'DS4.TalentRank'}}</div> {{!-- description --}} - <div class="flex4">{{localize 'DS4.HeadingDescription'}}</div> + <div class="flex4">{{localize 'DS4.Description'}}</div> {{!-- add button --}} {{> systems/ds4/templates/actor/partials/overview-add-button.hbs dataType='talent' }} </li> diff --git a/src/templates/item/partials/body.hbs b/src/templates/item/partials/body.hbs index 2a9eaecd..a7ac4d72 100644 --- a/src/templates/item/partials/body.hbs +++ b/src/templates/item/partials/body.hbs @@ -2,7 +2,7 @@ {{!-- Sheet Tab Navigation --}} <nav class="sheet-tabs tabs" data-group="primary"> - <a class="item" data-tab="description">{{localize "DS4.HeadingDescription"}}</a> + <a class="item" data-tab="description">{{localize "DS4.Description"}}</a> <a class="item" data-tab="effects">{{localize "DS4.HeadingEffects"}}</a> {{#if isPhysical}} <a class="item" data-tab="details">{{localize "DS4.HeadingDetails"}}</a> diff --git a/src/templates/item/partials/description.hbs b/src/templates/item/partials/description.hbs index b7139387..95d50e52 100644 --- a/src/templates/item/partials/description.hbs +++ b/src/templates/item/partials/description.hbs @@ -31,7 +31,7 @@ Additional elements of the side-properties div can be handed over via the @parti {{/if}} {{> @partial-block}} </div> - <div class="description" title="{{localize 'DS4.HeadingDescription'}}"> + <div class="description" title="{{localize 'DS4.Description'}}"> {{editor content=data.description target="data.description" button=true owner=owner editable=editable}} </div> </div> \ No newline at end of file From 6db1d48033075c3443a8805632ba4d234cc1ebe9 Mon Sep 17 00:00:00 2001 From: Max Tharr <max.tharr@mayflower.de> Date: Sun, 10 Jan 2021 01:45:31 +0100 Subject: [PATCH 13/41] Add initiative formula --- src/system.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/system.json b/src/system.json index f576d87d..6584e451 100644 --- a/src/system.json +++ b/src/system.json @@ -29,5 +29,6 @@ "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.1.0/download?job=build", - "license": "MIT" + "license": "MIT", + "initiative": "@combatValues.initiative.total" } From 17d0213e62826b6665d831a89402910d594e78dd Mon Sep 17 00:00:00 2001 From: Johannes Loher <johannes.loher@fg4f.de> Date: Sun, 10 Jan 2021 02:05:30 +0100 Subject: [PATCH 14/41] 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<DS4ActorDataType, DS4Actor, DS4ItemDataType> { + /** @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<DS4ActorDataType, DS4Actor, DS4Ite return data; } - /** @override */ - static get defaultOptions(): FormApplicationOptions { - return mergeObject(super.defaultOptions, { - classes: ["ds4", "sheet", "actor"], - template: "systems/ds4/templates/actor/actor-sheet.hbs", - width: 745, - height: 600, - tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "inventory" }], - }); - } - /* -------------------------------------------- */ /** @override */ diff --git a/src/module/config.ts b/src/module/config.ts index 4a72b6d4..9be27b2a 100644 --- a/src/module/config.ts +++ b/src/module/config.ts @@ -187,6 +187,7 @@ export const DS4 = { * Define the profile info of a character */ characterProfile: { + biography: "DS4.CharacterProfileBiography", gender: "DS4.CharacterProfileGender", birthday: "DS4.CharacterProfileBirthday", birthplace: "DS4.CharacterProfileBirthplace", @@ -202,6 +203,7 @@ export const DS4 = { * Define the profile info types for hanndlebars of a character */ characterProfileDTypes: { + biography: "String", gender: "String", birthday: "String", birthplace: "String", @@ -246,6 +248,7 @@ export const DS4 = { creatureType: "DS4.CreatureBaseInfoCreatureType", sizeCategory: "DS4.CreatureBaseInfoSizeCategory", experiencePoints: "DS4.CreatureBaseInfoExperiencePoints", + description: "DS4.CreatureBaseInfoDescription", }, /** diff --git a/src/template.json b/src/template.json index 4d34dfa8..9354acdb 100644 --- a/src/template.json +++ b/src/template.json @@ -87,7 +87,8 @@ "foeFactor": 1, "creatureType": "humanoid", "sizeCategory": "normal", - "experiencePoints": 0 + "experiencePoints": 0, + "description": "" } }, "character": { @@ -111,6 +112,7 @@ } }, "profile": { + "biography": "", "gender": "", "birthday": "", "birthplace": "", diff --git a/src/templates/actor/actor-sheet.hbs b/src/templates/actor/character-sheet.hbs similarity index 88% rename from src/templates/actor/actor-sheet.hbs rename to src/templates/actor/character-sheet.hbs index 941b4ad2..6b9b1b82 100644 --- a/src/templates/actor/actor-sheet.hbs +++ b/src/templates/actor/character-sheet.hbs @@ -8,11 +8,13 @@ <div class="flexrow basic-properties"> <div class="basic-property"> - <label class="basic-property-label" for="data.baseInfo.race">{{config.characterBaseInfo.race}}</label> + <label class="basic-property-label" + for="data.baseInfo.race">{{config.characterBaseInfo.race}}</label> <input type="text" name="data.baseInfo.race" value="{{data.baseInfo.race}}" data-dtype="String" /> </div> <div class="basic-property"> - <label class="basic-property-label" for="data.baseInfo.culture">{{config.characterBaseInfo.culture}}</label> + <label class="basic-property-label" + for="data.baseInfo.culture">{{config.characterBaseInfo.culture}}</label> <input type="text" name="data.baseInfo.culture" value="{{data.baseInfo.culture}}" data-dtype="String" /> </div> @@ -39,7 +41,8 @@ </div> </div> <div class="basic-property"> - <label class="basic-property-label" for="data.baseInfo.class">{{config.characterBaseInfo.class}}</label> + <label class="basic-property-label" + for="data.baseInfo.class">{{config.characterBaseInfo.class}}</label> <input type="text" name="data.baseInfo.class" value="{{data.baseInfo.class}}" data-dtype="String" /> </div> <div class="basic-property"> @@ -81,7 +84,8 @@ {{!-- Biography Tab --}} <div class="tab biography" data-group="primary" data-tab="biography"> - {{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}} </div> </section> -</form> \ No newline at end of file +</form> 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 @@ +<form class="{{cssClass}} flexcol" autocomplete="off"> + {{!-- Sheet Header --}} + <header class="sheet-header"> + <img class="profile-img" src="{{actor.img}}" data-edit="img" title="{{actor.name}}" height="100" width="100" /> + <div class="header-fields flexrow"> + <h1 class="charname"><input name="name" type="text" value="{{actor.name}}" placeholder="Name" /></h1> + <div class="flexrow basic-properties"> + <div class="basic-property"> + <label>{{config.creatureBaseInfo.creatureType}}</label> + <select name="data.baseInfo.creatureType" data-type="String"> + {{#select data.baseInfo.creatureType}} + {{#each config.creatureTypes as |value key|}} + <option value="{{key}}">{{value}}</option> + {{/each}} + {{/select}} + </select> + </div> + <div class="basic-property"> + <label class="basic-property-label" + for="data.baseInfo.loot">{{config.creatureBaseInfo.loot}}</label> + <input type="text" name="data.baseInfo.loot" value="{{data.baseInfo.loot}}" data-dtype="String" /> + </div> + <div class="basic-property"> + <label class="basic-property-label" + for="data.baseInfo.foeFactor">{{config.creatureBaseInfo.foeFactor}}</label> + <input type="text" name="data.baseInfo.foeFactor" value="{{data.baseInfo.foeFactor}}" + data-dtype="Number" /> + </div> + <div class="basic-property"> + <label>{{config.creatureBaseInfo.sizeCategory}}</label> + <select name="data.baseInfo.sizeCategory" data-type="String"> + {{#select data.baseInfo.sizeCategory}} + {{#each config.creatureSizeCategories as |value key|}} + <option value="{{key}}">{{value}}</option> + {{/each}} + {{/select}} + </select> + </div> + <div class="basic-property"> + <label class="basic-property-label" + for="data.baseInfo.experiencePoints">{{config.creatureBaseInfo.experiencePoints}}</label> + <input type="text" name="data.baseInfo.experiencePoints" value="{{data.baseInfo.experiencePoints}}" + data-dtype="Number" /> + </div> + </div> + </div> + <div class="character-values"> + {{> systems/ds4/templates/actor/partials/attributes-traits.hbs}} + {{> systems/ds4/templates/actor/partials/combat-values.hbs}} + </div> + </header> + + {{!-- Sheet Tab Navigation --}} + <nav class="sheet-tabs tabs" data-group="primary"> + <a class="item" data-tab="inventory">{{localize 'DS4.HeadingInventory'}}</a> + <a class="item" data-tab="description">{{localize 'DS4.HeadingDescription'}}</a> + <a class="item" data-tab="spells">{{localize 'DS4.HeadingSpells'}}</a> + </nav> + + {{!-- Sheet Body --}} + <section class="sheet-body"> + {{!-- Items Tab --}} + {{> systems/ds4/templates/actor/partials/items-overview.hbs}} + + {{!-- Spells Tab --}} + {{> systems/ds4/templates/actor/partials/spells-overview.hbs}} + + {{!-- Description Tab --}} + <div class="tab description" data-group="primary" data-tab="description"> + {{editor content=data.baseInfo.description target="data.baseInfo.description" button=true owner=owner + editable=editable}} + </div> + </section> +</form> \ 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 @@ <div class="tab profile" data-group="primary" data-tab="profile"> <div class="grid grid-2col"> {{#each data.profile as |profile-data-value profile-data-key|}} + {{#if (neq profile-data-key 'biography')}} <div class="profile-entry"> <label for="data.profile.{{profile-data-key}}"> {{lookup ../config.characterProfile profile-data-key}} @@ -8,6 +9,7 @@ <input type="text" name="data.profile.{{profile-data-key}}" value="{{profile-data-value}}" data-dtype="{{lookup ../config/characterProfileDTypes profile-data-key}}" /> </div> + {{/if}} {{/each}} </div> -</div> \ No newline at end of file +</div> 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 --}} <nav class="sheet-tabs tabs" data-group="primary"> - <a class="item" data-tab="description">{{localize "DS4.Description"}}</a> + <a class="item" data-tab="description">{{localize "DS4.HeadingDescription"}}</a> <a class="item" data-tab="effects">{{localize "DS4.HeadingEffects"}}</a> {{#if isPhysical}} <a class="item" data-tab="details">{{localize "DS4.HeadingDetails"}}</a> diff --git a/src/templates/item/partials/description.hbs b/src/templates/item/partials/description.hbs index 95d50e52..b7139387 100644 --- a/src/templates/item/partials/description.hbs +++ b/src/templates/item/partials/description.hbs @@ -31,7 +31,7 @@ Additional elements of the side-properties div can be handed over via the @parti {{/if}} {{> @partial-block}} </div> - <div class="description" title="{{localize 'DS4.Description'}}"> + <div class="description" title="{{localize 'DS4.HeadingDescription'}}"> {{editor content=data.description target="data.description" button=true owner=owner editable=editable}} </div> </div> \ No newline at end of file From 0568afc32be83000ea9fdf909424446650b205a8 Mon Sep 17 00:00:00 2001 From: Johannes Loher <johannes.loher@fg4f.de> Date: Sun, 10 Jan 2021 02:35:48 +0100 Subject: [PATCH 15/41] 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 c2ad8f7fe1087c3486401b4b377a47e8919f91d2 Mon Sep 17 00:00:00 2001 From: Johannes Loher <johannes.loher@fg4f.de> Date: Sun, 10 Jan 2021 03:07:08 +0100 Subject: [PATCH 16/41] add test that english and german localization files have same keys --- package-lock.json | 15 +++++++++++++++ package.json | 1 + spec/support/localization/localization.spec.ts | 15 +++++++++++++++ 3 files changed, 31 insertions(+) create mode 100644 spec/support/localization/localization.spec.ts diff --git a/package-lock.json b/package-lock.json index ff2912b2..65951b1d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -110,6 +110,15 @@ "fastq": "^1.6.0" } }, + "@types/fs-extra": { + "version": "9.0.6", + "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-9.0.6.tgz", + "integrity": "sha512-ecNRHw4clCkowNOBJH1e77nvbPxHYnWIXMv1IAoG/9+MYGkgoyr3Ppxr7XYFNL41V422EDhyV4/4SSK8L2mlig==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, "@types/jasmine": { "version": "3.6.2", "resolved": "https://registry.npmjs.org/@types/jasmine/-/jasmine-3.6.2.tgz", @@ -131,6 +140,12 @@ "integrity": "sha512-3c+yGKvVP5Y9TYBEibGNR+kLtijnj7mYrXRg+WpFb2X9xm04g/DXYkfg4hmzJQosc9snFNUPkbYIhu+KAm6jJw==", "dev": true }, + "@types/node": { + "version": "14.14.20", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.20.tgz", + "integrity": "sha512-Y93R97Ouif9JEOWPIUyU+eyIdyRqQR0I8Ez1dzku4hDx34NWh4HbtIc3WNzwB1Y9ULvNGeu5B8h8bVL5cAk4/A==", + "dev": true + }, "@types/parse-json": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz", diff --git a/package.json b/package.json index 99a5f5d8..055a58db 100644 --- a/package.json +++ b/package.json @@ -40,6 +40,7 @@ "format": "prettier --write 'src/**/*.(ts|json|scss)'" }, "devDependencies": { + "@types/fs-extra": "^9.0.6", "@types/jasmine": "^3.6.2", "@typescript-eslint/eslint-plugin": "^4.11.1", "@typescript-eslint/parser": "^4.11.1", diff --git a/spec/support/localization/localization.spec.ts b/spec/support/localization/localization.spec.ts new file mode 100644 index 00000000..b289819c --- /dev/null +++ b/spec/support/localization/localization.spec.ts @@ -0,0 +1,15 @@ +import "jasmine"; +import * as fs from "fs-extra"; +import * as path from "path"; + +describe("English and german localization files", () => { + const localizationPath = "./src/lang/"; + const en: Record<string, unknown> = fs.readJSONSync(path.join(localizationPath, "en.json")); + const de: Record<string, unknown> = fs.readJSONSync(path.join(localizationPath, "de.json")); + + it("should have the same keys.", () => { + const deKeys = Object.keys(de); + const enKeys = Object.keys(en); + expect(deKeys).toEqual(enKeys); + }); +}); From a19a996d1d8d94265b1910592bd82f6a71cf5d12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20R=C3=BCmpelein?= <oli_r@fg4f.de> Date: Sun, 10 Jan 2021 16:40:11 +0100 Subject: [PATCH 17/41] Display (only!) selection options to the user. --- spec/support/ds4rolls/executor.spec.ts | 28 ++++++------ src/module/rolls/check-factory.ts | 62 ++++++++++++++++++++++---- src/module/rolls/check.ts | 2 +- src/module/rolls/roll-data.ts | 4 +- src/module/rolls/roll-executor.ts | 4 +- src/templates/roll/roll-options.hbs | 16 +++++++ 6 files changed, 88 insertions(+), 28 deletions(-) create mode 100644 src/templates/roll/roll-options.hbs diff --git a/spec/support/ds4rolls/executor.spec.ts b/spec/support/ds4rolls/executor.spec.ts index 705241a9..58997a98 100644 --- a/spec/support/ds4rolls/executor.spec.ts +++ b/spec/support/ds4rolls/executor.spec.ts @@ -65,37 +65,37 @@ describe("DS4 Rolls with one die and slaying dice, followup throw.", () => { describe("DS4 Rolls with one die and crit roll modifications.", () => { it("Should do a crit success on `1`.", () => { - expect(rollCheckSingleDie(4, { maxCritSuccess: 2, minCritFail: 19 }, [1])).toEqual( + expect(rollCheckSingleDie(4, { maxCritSuccess: 2, minCritFailure: 19 }, [1])).toEqual( new RollResult(4, RollResultStatus.CRITICAL_SUCCESS, [1]), ); }); it("Should do a crit success on `maxCritSucc`.", () => { - expect(rollCheckSingleDie(4, { maxCritSuccess: 2, minCritFail: 19 }, [2])).toEqual( + expect(rollCheckSingleDie(4, { maxCritSuccess: 2, minCritFailure: 19 }, [2])).toEqual( new RollResult(4, RollResultStatus.CRITICAL_SUCCESS, [2]), ); }); it("Should do a success on lower edge case `3`.", () => { - expect(rollCheckSingleDie(4, { maxCritSuccess: 2, minCritFail: 19 }, [3])).toEqual( + expect(rollCheckSingleDie(4, { maxCritSuccess: 2, minCritFailure: 19 }, [3])).toEqual( new RollResult(3, RollResultStatus.SUCCESS, [3]), ); }); it("Should do a success on upper edge case `18`.", () => { - expect(rollCheckSingleDie(4, { maxCritSuccess: 2, minCritFail: 19 }, [18])).toEqual( + expect(rollCheckSingleDie(4, { maxCritSuccess: 2, minCritFailure: 19 }, [18])).toEqual( new RollResult(0, RollResultStatus.FAILURE, [18]), ); }); - it("Should do a crit fail on `minCritFail`.", () => { - expect(rollCheckSingleDie(4, { maxCritSuccess: 2, minCritFail: 19 }, [19])).toEqual( + it("Should do a crit fail on `minCritFailure`.", () => { + expect(rollCheckSingleDie(4, { maxCritSuccess: 2, minCritFailure: 19 }, [19])).toEqual( new RollResult(0, RollResultStatus.CRITICAL_FAILURE, [19]), ); }); it("Should do a crit fail on `20`", () => { - expect(rollCheckSingleDie(4, { maxCritSuccess: 2, minCritFail: 19 }, [20])).toEqual( + expect(rollCheckSingleDie(4, { maxCritSuccess: 2, minCritFailure: 19 }, [20])).toEqual( new RollResult(0, RollResultStatus.CRITICAL_FAILURE, [20]), ); }); @@ -171,37 +171,37 @@ describe("DS4 Rolls with multiple dice and no modifiers.", () => { describe("DS4 Rolls with multiple dice and min/max modifiers.", () => { it("Should do a crit fail on `19` for first roll.", () => { - expect(rollCheckMultipleDice(48, { maxCritSuccess: 2, minCritFail: 19 }, [19, 15, 6])).toEqual( + expect(rollCheckMultipleDice(48, { maxCritSuccess: 2, minCritFailure: 19 }, [19, 15, 6])).toEqual( new RollResult(0, RollResultStatus.CRITICAL_FAILURE, [19, 15, 6]), ); }); it("Should succeed with all rolls crit successes (1 and 2).", () => { - expect(rollCheckMultipleDice(48, { maxCritSuccess: 2, minCritFail: 19 }, [2, 1, 2])).toEqual( + expect(rollCheckMultipleDice(48, { maxCritSuccess: 2, minCritFailure: 19 }, [2, 1, 2])).toEqual( new RollResult(48, RollResultStatus.CRITICAL_SUCCESS, [2, 1, 2]), ); }); it("Should succeed with the last roll not being sufficient.", () => { - expect(rollCheckMultipleDice(48, { maxCritSuccess: 2, minCritFail: 19 }, [15, 15, 15])).toEqual( + expect(rollCheckMultipleDice(48, { maxCritSuccess: 2, minCritFailure: 19 }, [15, 15, 15])).toEqual( new RollResult(30, RollResultStatus.SUCCESS, [15, 15, 15]), ); }); it("Should succeed with the last roll a crit success `2`.", () => { - expect(rollCheckMultipleDice(48, { maxCritSuccess: 2, minCritFail: 19 }, [15, 15, 2])).toEqual( + expect(rollCheckMultipleDice(48, { maxCritSuccess: 2, minCritFailure: 19 }, [15, 15, 2])).toEqual( new RollResult(38, RollResultStatus.SUCCESS, [15, 15, 2]), ); }); it("Should succeed with the last roll being `20` and one crit success '2'.", () => { - expect(rollCheckMultipleDice(48, { maxCritSuccess: 2, minCritFail: 19 }, [15, 2, 20])).toEqual( + expect(rollCheckMultipleDice(48, { maxCritSuccess: 2, minCritFailure: 19 }, [15, 2, 20])).toEqual( new RollResult(43, RollResultStatus.SUCCESS, [15, 2, 20]), ); }); it("Should succeed with the last roll being `19` and one crit success '2'.", () => { - expect(rollCheckMultipleDice(48, { maxCritSuccess: 2, minCritFail: 19 }, [15, 2, 19])).toEqual( + expect(rollCheckMultipleDice(48, { maxCritSuccess: 2, minCritFailure: 19 }, [15, 2, 19])).toEqual( new RollResult(42, RollResultStatus.SUCCESS, [15, 2, 19]), ); }); @@ -209,7 +209,7 @@ describe("DS4 Rolls with multiple dice and min/max modifiers.", () => { describe("DS4 Rolls with multiple dice and fail modifiers.", () => { it("Should do a crit fail on `19` for first roll.", () => { - expect(rollCheckMultipleDice(48, { minCritFail: 19 }, [19, 15, 6])).toEqual( + expect(rollCheckMultipleDice(48, { minCritFailure: 19 }, [19, 15, 6])).toEqual( new RollResult(0, RollResultStatus.CRITICAL_FAILURE, [19, 15, 6]), ); }); diff --git a/src/module/rolls/check-factory.ts b/src/module/rolls/check-factory.ts index 43b06927..24c563c0 100644 --- a/src/module/rolls/check-factory.ts +++ b/src/module/rolls/check-factory.ts @@ -14,6 +14,8 @@ class DefaultCheckOptions implements DS4CheckFactoryOptions { } } +const defaultCheckOptions = new DefaultCheckOptions(); + /** * Most basic class responsible for generating the chat formula and passing it to the chat as roll. */ @@ -53,8 +55,8 @@ class CheckFactory { } createCritTerm(): string { - const minCritRequired = this.checkOptions.minCritFailure !== CheckFactory.defaultCheckOptions.minCritFailure; - const maxCritRequired = this.checkOptions.maxCritSuccess !== CheckFactory.defaultCheckOptions.maxCritSuccess; + const minCritRequired = this.checkOptions.minCritFailure !== defaultCheckOptions.minCritFailure; + const maxCritRequired = this.checkOptions.maxCritSuccess !== defaultCheckOptions.maxCritSuccess; if (minCritRequired || maxCritRequired) { return "c" + (this.checkOptions.maxCritSuccess ?? "") + "," + (this.checkOptions.minCritFailure ?? ""); @@ -66,8 +68,6 @@ class CheckFactory { createSlayingDiceTerm(): string { return this.checkOptions.useSlayingDice ? "x" : null; } - - static defaultCheckOptions = new DefaultCheckOptions(); } // TODO: Figure out return of roll (void should be Ok, tough?) @@ -78,10 +78,10 @@ class CheckFactory { */ export async function createCheckRoll(targetValue: number, options: Partial<DS4CheckFactoryOptions>): Promise<void> { // Ask for additional required data; - const gmModifier = await askGmModifier(); + const gmModifierData = await askGmModifier(targetValue, options); // Create Factory - const cf = new CheckFactory(targetValue, gmModifier, options); + const cf = new CheckFactory(targetValue, gmModifierData.gmModifier, options); // Possibly additional processing @@ -92,11 +92,53 @@ export async function createCheckRoll(targetValue: number, options: Partial<DS4C /** * Responsible for rendering the modal interface asking for the modifier specified by GM. * + * @notes + * At the moment, this asks for more data than it will do after some iterations. + * * @returns {Promise<number>} The number by the user. */ -async function askGmModifier(): Promise<number> { +async function askGmModifier( + targetValue: number, + options: Partial<DS4CheckFactoryOptions>, + { template, title }: { template?: string; title?: string } = {}, +): Promise<GmModifierData> { // Render model interface and return value - return 0; + const usedTemplate = template ?? "systems/ds4/templates/roll/roll-options.hbs"; + const templateData = { + cssClass: "roll-option", + title: title ?? "Roll Options", + checkTargetValue: targetValue, + maxCritSuccess: options.maxCritSuccess ?? defaultCheckOptions.maxCritSuccess, + minCritFailure: options.minCritFailure ?? defaultCheckOptions.minCritFailure, + rollModes: rollModes, + }; + const renderedHtml = await renderTemplate(usedTemplate, templateData); + + // TODO: Localize + const dialogData: DialogData = { + title: title ?? "Roll Options", + close: (html) => null, + content: renderedHtml, + buttons: { + ok: { + label: "OK", + callback: (html) => null, + }, + cancel: { + label: "Cancel", + callback: (html) => null, + }, + }, + default: "ok", + }; + + const dialog = new Dialog(dialogData, {}).render(true); + + return { gmModifier: 0 }; +} + +interface GmModifierData { + gmModifier: number; } export interface DS4CheckFactoryOptions { @@ -106,4 +148,6 @@ export interface DS4CheckFactoryOptions { rollMode: DS4RollMode; } -export type DS4RollMode = "roll" | "gmroll" | "blindroll" | "selfroll"; +const rollModes = ["roll", "gmroll", "blindroll", "selfroll"] as const; +type DS4RollModeTuple = typeof rollModes; +export type DS4RollMode = DS4RollModeTuple[number]; diff --git a/src/module/rolls/check.ts b/src/module/rolls/check.ts index 7911cded..38773fb3 100644 --- a/src/module/rolls/check.ts +++ b/src/module/rolls/check.ts @@ -86,7 +86,7 @@ export class DS4Check extends DiceTerm { } else { return ds4roll(targetValueToUse, { maxCritSuccess: this.maxCritSuccess, - minCritFail: this.minCritFailure, + minCritFailure: this.minCritFailure, slayingDiceRepetition: slayingDiceRepetition, useSlayingDice: slayingDiceRepetition, }); diff --git a/src/module/rolls/roll-data.ts b/src/module/rolls/roll-data.ts index 964034c9..78329e44 100644 --- a/src/module/rolls/roll-data.ts +++ b/src/module/rolls/roll-data.ts @@ -1,13 +1,13 @@ export interface RollOptions { maxCritSuccess: number; - minCritFail: number; + minCritFailure: number; useSlayingDice: boolean; slayingDiceRepetition: boolean; } export class DefaultRollOptions implements RollOptions { public maxCritSuccess = 1; - public minCritFail = 20; + public minCritFailure = 20; public useSlayingDice = false; public slayingDiceRepetition = false; diff --git a/src/module/rolls/roll-executor.ts b/src/module/rolls/roll-executor.ts index 72e6b2c4..c7e187b1 100644 --- a/src/module/rolls/roll-executor.ts +++ b/src/module/rolls/roll-executor.ts @@ -48,7 +48,7 @@ export function rollCheckSingleDie( if (rolledDie <= usedOptions.maxCritSuccess) { return new RollResult(checkTargetValue, RollResultStatus.CRITICAL_SUCCESS, usedDice, true); - } else if (rolledDie >= usedOptions.minCritFail && !isSlayingDiceRepetition(usedOptions)) { + } else if (rolledDie >= usedOptions.minCritFailure && !isSlayingDiceRepetition(usedOptions)) { return new RollResult(0, RollResultStatus.CRITICAL_FAILURE, usedDice, true); } else { if (rolledDie <= checkTargetValue) { @@ -90,7 +90,7 @@ export function rollCheckMultipleDice( const slayingDiceRepetition = isSlayingDiceRepetition(usedOptions); // Slaying Dice require a different handling. - if (firstResult >= usedOptions.minCritFail && !slayingDiceRepetition) { + if (firstResult >= usedOptions.minCritFailure && !slayingDiceRepetition) { return new RollResult(0, RollResultStatus.CRITICAL_FAILURE, usedDice, true); } diff --git a/src/templates/roll/roll-options.hbs b/src/templates/roll/roll-options.hbs new file mode 100644 index 00000000..4cab330e --- /dev/null +++ b/src/templates/roll/roll-options.hbs @@ -0,0 +1,16 @@ +<form class="{{cssClass}} grid"> + <label for="ctv">Check Target Value</label> + <input id="ctv" type="number" name="ctv" value="{{checkTargetValue}}" /> + <label for="gmmod">Game Master Modifier</label> + <input id="gmmod" type="number" name="gmmod" value="0" /> + <label for="maxcoup">Coup to</label> + <input id="maxcoup" type="number" name="maxcoup" value="{{maxCritSuccess}}" /> + <label for="minfumble">Fumble from</label> + <input id="minfumble" type="number" name="minfumble" value="{{minCritFailure}}" /> + <label for="visibility">Visibility</label> + <select id="visibility" data-type="String"> + {{#each rollModes as |rollMode|}} + <option value="{{rollMode}}">{{rollMode}}</option> + {{/each}} + </select> +</form> From 516c04c8de4b8786a0bec20affc2158688577291 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20R=C3=BCmpelein?= <oli_r@fg4f.de> Date: Sun, 10 Jan 2021 21:03:11 +0100 Subject: [PATCH 18/41] First proper parsing without much "nice-ity". --- src/module/rolls/check-factory.ts | 81 +++++++++++++++++++++-------- src/templates/roll/roll-options.hbs | 8 +-- 2 files changed, 63 insertions(+), 26 deletions(-) diff --git a/src/module/rolls/check-factory.ts b/src/module/rolls/check-factory.ts index 24c563c0..8d560ea0 100644 --- a/src/module/rolls/check-factory.ts +++ b/src/module/rolls/check-factory.ts @@ -27,7 +27,6 @@ class CheckFactory { ) { this.checkOptions = new DefaultCheckOptions().mergeWith(passedOptions); } - private checkOptions: DS4CheckFactoryOptions; async execute(): Promise<void> { @@ -42,13 +41,14 @@ class CheckFactory { const roll = new rollCls(formula); const rollModeTemplate = this.checkOptions.rollMode; + console.log(rollModeTemplate); return roll.toMessage({}, { rollMode: rollModeTemplate, create: true }); } // Term generators createTargetValueTerm(): string { if (this.checkTargetValue != null) { - return "v" + this.checkTargetValue; + return "v" + (this.checkTargetValue + this.gmModifier); } else { return null; } @@ -80,8 +80,15 @@ export async function createCheckRoll(targetValue: number, options: Partial<DS4C // Ask for additional required data; const gmModifierData = await askGmModifier(targetValue, options); + const newOptions: Partial<DS4CheckFactoryOptions> = { + maxCritSuccess: gmModifierData.maxCritSuccess ?? options.maxCritSuccess ?? undefined, + minCritFailure: gmModifierData.minCritFailure ?? options.minCritFailure ?? undefined, + useSlayingDice: gmModifierData.useSlayingDice ?? options.useSlayingDice ?? undefined, + rollMode: gmModifierData.rollMode ?? options.rollMode ?? undefined, + }; + // Create Factory - const cf = new CheckFactory(targetValue, gmModifierData.gmModifier, options); + const cf = new CheckFactory(gmModifierData.checkTargetValue, gmModifierData.gmModifier, newOptions); // Possibly additional processing @@ -115,30 +122,60 @@ async function askGmModifier( const renderedHtml = await renderTemplate(usedTemplate, templateData); // TODO: Localize - const dialogData: DialogData = { - title: title ?? "Roll Options", - close: (html) => null, - content: renderedHtml, - buttons: { - ok: { - label: "OK", - callback: (html) => null, + const dialogPromise = new Promise<HTMLFormElement>((resolve) => { + new Dialog( + { + title: title ?? "Roll Options", + close: (html: JQuery) => resolve(null), + content: renderedHtml, + buttons: { + ok: { + label: "OK", + callback: (html: HTMLElement | JQuery) => { + if (!("jquery" in html)) { + throw new Error("Internal Type Error"); + } else { + const innerForm = html[0].querySelector("form"); + resolve(innerForm); + } + }, + }, + cancel: { + label: "Cancel", + callback: (html: JQuery) => resolve(null), + }, + }, + default: "ok", }, - cancel: { - label: "Cancel", - callback: (html) => null, - }, - }, - default: "ok", - }; - - const dialog = new Dialog(dialogData, {}).render(true); - - return { gmModifier: 0 }; + {}, + ).render(true); + }); + const dialogForm = await dialogPromise; + return parseDialogFormData(dialogForm, targetValue); } +function parseDialogFormData(formData: HTMLFormElement, targetValue: number): GmModifierData { + const parsedData = { + checkTargetValue: parseInt(formData["ctv"]?.value) ?? targetValue, + gmModifier: parseInt(formData["gmmod"]?.value) ?? 0, + maxCritSuccess: parseInt(formData["maxcoup"]?.value) ?? defaultCheckOptions.maxCritSuccess, + minCritFailure: parseInt(formData["minfumble"]?.value) ?? defaultCheckOptions.minCritFailure, + useSlayingDice: false, + rollMode: formData["visibility"]?.value ?? defaultCheckOptions.rollMode, + }; + console.log("Data", parsedData); + return parsedData; +} + +// TODO: Remove unnecessary data step by step interface GmModifierData { + checkTargetValue: number; gmModifier: number; + maxCritSuccess: number; + minCritFailure: number; + // TODO: In final version from system settings + useSlayingDice: boolean; + rollMode: DS4RollMode; } export interface DS4CheckFactoryOptions { diff --git a/src/templates/roll/roll-options.hbs b/src/templates/roll/roll-options.hbs index 4cab330e..9e2b320e 100644 --- a/src/templates/roll/roll-options.hbs +++ b/src/templates/roll/roll-options.hbs @@ -1,12 +1,12 @@ <form class="{{cssClass}} grid"> <label for="ctv">Check Target Value</label> - <input id="ctv" type="number" name="ctv" value="{{checkTargetValue}}" /> + <input id="ctv" data-type="Number" type="number" name="ctv" value="{{checkTargetValue}}" /> <label for="gmmod">Game Master Modifier</label> - <input id="gmmod" type="number" name="gmmod" value="0" /> + <input id="gmmod" data-type="Number" type="number" name="gmmod" value="0" /> <label for="maxcoup">Coup to</label> - <input id="maxcoup" type="number" name="maxcoup" value="{{maxCritSuccess}}" /> + <input id="maxcoup" data-type="Number" type="number" name="maxcoup" value="{{maxCritSuccess}}" /> <label for="minfumble">Fumble from</label> - <input id="minfumble" type="number" name="minfumble" value="{{minCritFailure}}" /> + <input id="minfumble" data-type="Number" type="number" name="minfumble" value="{{minCritFailure}}" /> <label for="visibility">Visibility</label> <select id="visibility" data-type="String"> {{#each rollModes as |rollMode|}} From 9bea9c63cdff0a1b4f3449d7fab8f452d1125e51 Mon Sep 17 00:00:00 2001 From: Siegfried Krug <siegfried@fg4f.de> Date: Sun, 10 Jan 2021 21:04:18 +0100 Subject: [PATCH 19/41] add spell category none --- src/lang/de.json | 1 + src/lang/en.json | 1 + src/module/config.ts | 1 + 3 files changed, 3 insertions(+) diff --git a/src/lang/de.json b/src/lang/de.json index 2b719286..6639e01a 100644 --- a/src/lang/de.json +++ b/src/lang/de.json @@ -91,6 +91,7 @@ "DS4.SpellCategoryDarkness": "Schatten", "DS4.SpellCategoryMindAffecting": "Geistensbeeinflussend", "DS4.SpellCategoryElectricity": "Elektrizität", + "DS4.SpellCategoryNone": "Keine", "DS4.SpellBonus": "Zauberbonus", "DS4.SpellBonusAbbr": "ZB", "DS4.SpellMaxDistance": "Reichweite", diff --git a/src/lang/en.json b/src/lang/en.json index e6136a0f..a7044a3a 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -91,6 +91,7 @@ "DS4.SpellCategoryDarkness": "Darkness", "DS4.SpellCategoryMindAffecting": "Mind Affecting", "DS4.SpellCategoryElectricity": "Electricity", + "DS4.SpellCategoryNone": "None", "DS4.SpellBonus": "Spell Bonus", "DS4.SpellBonusAbbr": "SB", "DS4.SpellMaxDistance": "Range", diff --git a/src/module/config.ts b/src/module/config.ts index d8f9b851..f567183b 100644 --- a/src/module/config.ts +++ b/src/module/config.ts @@ -118,6 +118,7 @@ export const DS4 = { darkness: "DS4.SpellCategoryDarkness", mindAffecting: "DS4.SpellCategoryMindAffecting", electricity: "DS4.SpellCategoryElectricity", + none: "DS4.SpellCategoryNone", }, /** From a2a7dc572ce6585500a13e4c38e1c132d9247b2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20R=C3=BCmpelein?= <oli_r@fg4f.de> Date: Sun, 10 Jan 2021 21:14:22 +0100 Subject: [PATCH 20/41] Try using full ts-node path --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 9ebc7bd8..80a7ebbd 100644 --- a/package.json +++ b/package.json @@ -35,8 +35,8 @@ "update": "npm install --save-dev git+https://git.f3l.de/dungeonslayers/foundry-pc-types.git#f3l-fixes", "lint": "eslint 'src/**/*.ts' --cache", "lint:fix": "eslint 'src/**/*.ts' --cache --fix", - "test": "ts-node ./node_modules/jasmine/bin/jasmine", - "test:ci": "ts-node ./node_modules/jasmine-xml-reporter/bin/jasmine --junitreport", + "test": "./node_modules/.bin/ts-node ./node_modules/jasmine/bin/jasmine", + "test:ci": "./node_modules/.bin/ts-node ./node_modules/jasmine-xml-reporter/bin/jasmine --junitreport", "format": "prettier --write 'src/**/*.(ts|json|scss)'" }, "devDependencies": { From 61098b31d64ab3ecdab537c0b99c1b1d79359e23 Mon Sep 17 00:00:00 2001 From: Siegfried Krug <siegfried@fg4f.de> Date: Sun, 10 Jan 2021 21:18:33 +0100 Subject: [PATCH 21/41] spell add default category --- src/lang/de.json | 1 + src/lang/en.json | 1 + src/module/config.ts | 1 + 3 files changed, 3 insertions(+) diff --git a/src/lang/de.json b/src/lang/de.json index 6639e01a..5c675015 100644 --- a/src/lang/de.json +++ b/src/lang/de.json @@ -92,6 +92,7 @@ "DS4.SpellCategoryMindAffecting": "Geistensbeeinflussend", "DS4.SpellCategoryElectricity": "Elektrizität", "DS4.SpellCategoryNone": "Keine", + "DS4.SpellCategoryUnset": "Nicht gesetzt", "DS4.SpellBonus": "Zauberbonus", "DS4.SpellBonusAbbr": "ZB", "DS4.SpellMaxDistance": "Reichweite", diff --git a/src/lang/en.json b/src/lang/en.json index a7044a3a..8ae1f6f8 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -92,6 +92,7 @@ "DS4.SpellCategoryMindAffecting": "Mind Affecting", "DS4.SpellCategoryElectricity": "Electricity", "DS4.SpellCategoryNone": "None", + "DS4.SpellCategoryUnset": "Unset", "DS4.SpellBonus": "Spell Bonus", "DS4.SpellBonusAbbr": "SB", "DS4.SpellMaxDistance": "Range", diff --git a/src/module/config.ts b/src/module/config.ts index f567183b..2c9514ef 100644 --- a/src/module/config.ts +++ b/src/module/config.ts @@ -119,6 +119,7 @@ export const DS4 = { mindAffecting: "DS4.SpellCategoryMindAffecting", electricity: "DS4.SpellCategoryElectricity", none: "DS4.SpellCategoryNone", + unset: "DS4.SpellCategoryUnset", }, /** From bbd4ce7c07cd637bd26a68cd9675f028547229dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20R=C3=BCmpelein?= <oli_r@fg4f.de> Date: Sun, 10 Jan 2021 21:22:27 +0100 Subject: [PATCH 22/41] Revert "Try using full ts-node path" --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 80a7ebbd..9ebc7bd8 100644 --- a/package.json +++ b/package.json @@ -35,8 +35,8 @@ "update": "npm install --save-dev git+https://git.f3l.de/dungeonslayers/foundry-pc-types.git#f3l-fixes", "lint": "eslint 'src/**/*.ts' --cache", "lint:fix": "eslint 'src/**/*.ts' --cache --fix", - "test": "./node_modules/.bin/ts-node ./node_modules/jasmine/bin/jasmine", - "test:ci": "./node_modules/.bin/ts-node ./node_modules/jasmine-xml-reporter/bin/jasmine --junitreport", + "test": "ts-node ./node_modules/jasmine/bin/jasmine", + "test:ci": "ts-node ./node_modules/jasmine-xml-reporter/bin/jasmine --junitreport", "format": "prettier --write 'src/**/*.(ts|json|scss)'" }, "devDependencies": { From 4196257fd5ce131ac4831d7286dd27bef1e45ae9 Mon Sep 17 00:00:00 2001 From: Siegfried Krug <siegfried@fg4f.de> Date: Sun, 10 Jan 2021 21:51:47 +0100 Subject: [PATCH 23/41] add author siggi --- LICENSE | 2 +- package.json | 4 ++++ src/system.json | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/LICENSE b/LICENSE index 4ea46065..5c296ab7 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright 2020 Johannes Loher, Gesina Schwalbe, Oliver Rümpelein +Copyright 2020 Johannes Loher, Gesina Schwalbe, Oliver Rümpelein, Siegfried Krug Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/package.json b/package.json index 055a58db..06841a62 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,10 @@ { "name": "Oliver Rümpelein", "email": "foundryvtt@pheerai.de" + }, + { + "name": "Siegfried Krug", + "email": "foundryvtt@asdil1991.de" } ], "scripts": { diff --git a/src/system.json b/src/system.json index 6584e451..6c742c7a 100644 --- a/src/system.json +++ b/src/system.json @@ -6,7 +6,7 @@ "minimumCoreVersion": "0.7.9", "compatibleCoreVersion": "0.7.9", "templateVersion": 2, - "author": "Johannes Loher, Gesina Schwalbe, Oliver Rümpelein", + "author": "Johannes Loher, Gesina Schwalbe, Oliver Rümpelein, Siegfried Krug", "esmodules": ["module/ds4.js"], "styles": ["ds4.css"], "scripts": [], From c422635d66414c860ea2c8abb36ce85dc5bc6aae Mon Sep 17 00:00:00 2001 From: Johannes Loher <johannes.loher@fg4f.de> Date: Mon, 11 Jan 2021 00:55:49 +0100 Subject: [PATCH 24/41] 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<T> { - base: T; - mod: T; - total?: T; -} - -interface ResourceData<T> extends ModifiableData<T> { - value: T; - max?: T; -} - -interface UsableResource<T> { - 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<DS4ActorDataType, DS4Actor, DS4Ite }); } } + + /** + * @override + */ + async _onDrop(event: DragEvent): Promise<boolean | unknown> { + const data = JSON.parse(event.dataTransfer?.getData("text/plain")) as { type?: string }; + if (data.type === "Item") { + const item = await Item.fromDropData(data as Parameters<typeof DS4Item.fromDropData>[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<DS4ActorDataType, DS4ItemDataType, DS4Item> { /** @override */ @@ -21,4 +22,37 @@ export class DS4Actor extends Actor<DS4ActorDataType, DS4ItemDataType, DS4Item> combatValues.hitPoints.max = combatValues.hitPoints.total; } + + /** + * The list of item types that can be owned by this actor. + */ + get ownableItemTypes(): Array<ItemType> { + 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<T> { + base: T; + mod: T; + total?: T; +} + +export interface ResourceData<T> extends ModifiableData<T> { + value: T; + max?: T; +} + +export interface UsableResource<T> { + 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 @@ <div class="tab profile" data-group="primary" data-tab="profile"> <div class="grid grid-2col"> {{#each data.profile as |profile-data-value profile-data-key|}} - {{#if (neq profile-data-key 'biography')}} + {{#if (ne profile-data-key 'biography')}} <div class="profile-entry"> <label for="data.profile.{{profile-data-key}}"> {{lookup ../config.characterProfile profile-data-key}} diff --git a/src/templates/item/specialCreatureAbility-sheet.hbs b/src/templates/item/specialCreatureAbility-sheet.hbs new file mode 100644 index 00000000..3f100c3d --- /dev/null +++ b/src/templates/item/specialCreatureAbility-sheet.hbs @@ -0,0 +1,15 @@ +<form class="{{cssClass}}" autocomplete="off"> + {{#> systems/ds4/templates/item/partials/sheet-header.hbs}} + <div class="grid grid-3col basic-properties"> + <div class="basic-property"> + <label>{{localize "DS4.SpecialCreatureAbilityExperiencePoints"}}</label> + <input type="number" name="data.experiencePoints" value="{{data.experiencePoints}}" placeholder="0" + data-dtype="Number" /> + </div> + </div> + {{/systems/ds4/templates/item/partials/sheet-header.hbs}} + + {{!-- Common Item body --}} + {{#> systems/ds4/templates/item/partials/body.hbs}}{{/systems/ds4/templates/item/partials/body.hbs}} + +</form> \ No newline at end of file From 2d809c955bb12afe690b1809ecded5490251760e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20R=C3=BCmpelein?= <oli_r@fg4f.de> Date: Wed, 13 Jan 2021 17:11:07 +0100 Subject: [PATCH 25/41] Make cancellable withour exception --- src/module/rolls/check-factory.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/module/rolls/check-factory.ts b/src/module/rolls/check-factory.ts index 8d560ea0..4be81ee7 100644 --- a/src/module/rolls/check-factory.ts +++ b/src/module/rolls/check-factory.ts @@ -27,6 +27,7 @@ class CheckFactory { ) { this.checkOptions = new DefaultCheckOptions().mergeWith(passedOptions); } + private checkOptions: DS4CheckFactoryOptions; async execute(): Promise<void> { @@ -126,7 +127,9 @@ async function askGmModifier( new Dialog( { title: title ?? "Roll Options", - close: (html: JQuery) => resolve(null), + close: () => { + // Don't do anything + }, content: renderedHtml, buttons: { ok: { @@ -142,7 +145,9 @@ async function askGmModifier( }, cancel: { label: "Cancel", - callback: (html: JQuery) => resolve(null), + callback: () => { + // Don't do anything + }, }, }, default: "ok", From e36f30a7872e31a2d66e41b1e927202613e306d0 Mon Sep 17 00:00:00 2001 From: Johannes Loher <johannes.loher@fg4f.de> Date: Wed, 13 Jan 2021 17:20:25 +0100 Subject: [PATCH 26/41] Add special abilities to creature sheet --- src/lang/de.json | 1 + src/lang/en.json | 1 + src/module/actor/actor.ts | 4 +- src/module/actor/{ => sheets}/actor-sheet.ts | 10 ++- src/module/actor/sheets/character-sheet.ts | 11 ++++ src/module/actor/sheets/creature-sheet.ts | 11 ++++ src/module/ds4.ts | 9 ++- src/templates/actor/creature-sheet.hbs | 6 +- .../actor/partials/items-overview.hbs | 2 +- .../special-creature-abilites-overview.hbs | 61 +++++++++++++++++++ .../actor/partials/spells-overview.hbs | 2 +- .../actor/partials/talents-overview.hbs | 4 +- 12 files changed, 107 insertions(+), 15 deletions(-) rename src/module/actor/{ => sheets}/actor-sheet.ts (96%) create mode 100644 src/module/actor/sheets/character-sheet.ts create mode 100644 src/module/actor/sheets/creature-sheet.ts create mode 100644 src/templates/actor/partials/special-creature-abilites-overview.hbs diff --git a/src/lang/de.json b/src/lang/de.json index ba6d5569..aafc8506 100644 --- a/src/lang/de.json +++ b/src/lang/de.json @@ -11,6 +11,7 @@ "DS4.HeadingTalents": "Talente & Fähigkeiten", "DS4.HeadingSpells": "Zaubersprüche", "DS4.HeadingDescription": "Beschreibung", + "DS4.HeadingSpecialCreatureAbilites": "Besondere Fähigkeiten", "DS4.AttackType": "Angriffs Typ", "DS4.AttackTypeAbbr": "AT", "DS4.WeaponBonus": "Waffen Bonus", diff --git a/src/lang/en.json b/src/lang/en.json index 3e6fdc93..2c74d9d9 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -11,6 +11,7 @@ "DS4.HeadingTalents": "Talents & Abilities", "DS4.HeadingSpells": "Spells", "DS4.HeadingDescription": "Description", + "DS4.HeadingSpecialCreatureAbilites": "Special Abilites", "DS4.AttackType": "Attack Type", "DS4.AttackTypeAbbr": "AT", "DS4.WeaponBonus": "Weapon Bonus", diff --git a/src/module/actor/actor.ts b/src/module/actor/actor.ts index 9d4ac8e0..29d80199 100644 --- a/src/module/actor/actor.ts +++ b/src/module/actor/actor.ts @@ -33,16 +33,16 @@ export class DS4Actor extends Actor<DS4ActorDataType, DS4ItemDataType, DS4Item> "weapon", "armor", "shield", - "spell", "trinket", "equipment", + "spell", "talent", "racialAbility", "language", "alphabet", ]; case "creature": - return ["weapon", "armor", "spell", "specialCreatureAbility"]; + return ["weapon", "armor", "shield", "trinket", "equipment", "spell", "specialCreatureAbility"]; default: []; } diff --git a/src/module/actor/actor-sheet.ts b/src/module/actor/sheets/actor-sheet.ts similarity index 96% rename from src/module/actor/actor-sheet.ts rename to src/module/actor/sheets/actor-sheet.ts index d8a3b6dc..bfb58b01 100644 --- a/src/module/actor/actor-sheet.ts +++ b/src/module/actor/sheets/actor-sheet.ts @@ -1,7 +1,7 @@ -import { DS4Item } from "../item/item"; -import { DS4ItemDataType, ItemType } from "../item/item-data"; -import { DS4Actor } from "./actor"; -import { DS4ActorDataType } from "./actor-data"; +import { DS4Item } from "../../item/item"; +import { DS4ItemDataType, ItemType } from "../../item/item-data"; +import { DS4Actor } from "../actor"; +import { DS4ActorDataType } from "../actor-data"; /** * Extend the basic ActorSheet with some very simple modifications @@ -14,7 +14,6 @@ export class DS4ActorSheet extends ActorSheet<DS4ActorDataType, DS4Actor, DS4Ite classes: ["ds4", "sheet", "actor"], width: 745, height: 600, - tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "inventory" }], }); } @@ -40,7 +39,6 @@ export class DS4ActorSheet extends ActorSheet<DS4ActorDataType, DS4Actor, DS4Ite // Add the items explicitly sorted by type to the data: itemsByType: this.actor.itemTypes, }; - console.log("Data:", data); return data; } diff --git a/src/module/actor/sheets/character-sheet.ts b/src/module/actor/sheets/character-sheet.ts new file mode 100644 index 00000000..a7f9d15e --- /dev/null +++ b/src/module/actor/sheets/character-sheet.ts @@ -0,0 +1,11 @@ +import { DS4ActorSheet } from "./actor-sheet"; + +export class DS4CharacterActorSheet extends DS4ActorSheet { + /** @override */ + static get defaultOptions(): FormApplicationOptions { + return mergeObject(super.defaultOptions, { + classes: ["ds4", "sheet", "actor", "character"], + tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "inventory" }], + }); + } +} diff --git a/src/module/actor/sheets/creature-sheet.ts b/src/module/actor/sheets/creature-sheet.ts new file mode 100644 index 00000000..a9103391 --- /dev/null +++ b/src/module/actor/sheets/creature-sheet.ts @@ -0,0 +1,11 @@ +import { DS4ActorSheet } from "./actor-sheet"; + +export class DS4CreatureActorSheet extends DS4ActorSheet { + /** @override */ + static get defaultOptions(): FormApplicationOptions { + return mergeObject(super.defaultOptions, { + classes: ["ds4", "sheet", "actor", "creature"], + tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "items" }], + }); + } +} diff --git a/src/module/ds4.ts b/src/module/ds4.ts index 8bd9ea53..e0e2a892 100644 --- a/src/module/ds4.ts +++ b/src/module/ds4.ts @@ -1,10 +1,11 @@ // Import Modules import { DS4Actor } from "./actor/actor"; -import { DS4ActorSheet } from "./actor/actor-sheet"; import { DS4Item } from "./item/item"; import { DS4ItemSheet } from "./item/item-sheet"; import { DS4 } from "./config"; import { DS4Check } from "./rolls/check"; +import { DS4CharacterActorSheet } from "./actor/sheets/character-sheet"; +import { DS4CreatureActorSheet } from "./actor/sheets/creature-sheet"; Hooks.once("init", async function () { console.log(`DS4 | Initializing the DS4 Game System\n${DS4.ASCII}`); @@ -36,7 +37,8 @@ Hooks.once("init", async function () { // Register sheet application classes Actors.unregisterSheet("core", ActorSheet); - Actors.registerSheet("ds4", DS4ActorSheet, { makeDefault: true }); + Actors.registerSheet("ds4", DS4CharacterActorSheet, { types: ["character"], makeDefault: true }); + Actors.registerSheet("ds4", DS4CreatureActorSheet, { types: ["creature"], makeDefault: true }); Items.unregisterSheet("core", ItemSheet); Items.registerSheet("ds4", DS4ItemSheet, { makeDefault: true }); @@ -59,6 +61,7 @@ async function registerHandlebarsPartials() { "systems/ds4/templates/actor/partials/combat-values.hbs", "systems/ds4/templates/actor/partials/profile.hbs", "systems/ds4/templates/actor/partials/character-progression.hbs", + "systems/ds4/templates/actor/partials/special-creature-abilites-overview.hbs", ]; return loadTemplates(templatePaths); } @@ -100,7 +103,7 @@ Hooks.once("setup", function () { ]; // Exclude some from sorting where the default order matters - const noSort = ["attributes", "traits", "combatValues"]; + const noSort = ["attributes", "traits", "combatValues", "creatureSizeCategories"]; // Localize and sort CONFIG objects for (const o of toLocalize) { diff --git a/src/templates/actor/creature-sheet.hbs b/src/templates/actor/creature-sheet.hbs index 40d5eaf4..2ebf5977 100644 --- a/src/templates/actor/creature-sheet.hbs +++ b/src/templates/actor/creature-sheet.hbs @@ -53,8 +53,9 @@ {{!-- Sheet Tab Navigation --}} <nav class="sheet-tabs tabs" data-group="primary"> <a class="item" data-tab="inventory">{{localize 'DS4.HeadingInventory'}}</a> - <a class="item" data-tab="description">{{localize 'DS4.HeadingDescription'}}</a> + <a class="item" data-tab="special-creature-abilites">{{localize 'DS4.HeadingSpecialCreatureAbilites'}}</a> <a class="item" data-tab="spells">{{localize 'DS4.HeadingSpells'}}</a> + <a class="item" data-tab="description">{{localize 'DS4.HeadingDescription'}}</a> </nav> {{!-- Sheet Body --}} @@ -62,6 +63,9 @@ {{!-- Items Tab --}} {{> systems/ds4/templates/actor/partials/items-overview.hbs}} + {{!-- Special Creature Abilities Tab --}} + {{> systems/ds4/templates/actor/partials/special-creature-abilites-overview.hbs}} + {{!-- Spells Tab --}} {{> systems/ds4/templates/actor/partials/spells-overview.hbs}} diff --git a/src/templates/actor/partials/items-overview.hbs b/src/templates/actor/partials/items-overview.hbs index 4dbd269b..a76c714e 100644 --- a/src/templates/actor/partials/items-overview.hbs +++ b/src/templates/actor/partials/items-overview.hbs @@ -1,5 +1,5 @@ {{!-- TODO: For items list: only show header, if list is not empty --}} - +{{!-- TODO: Refactor to avoid code duplication with special-creature-abilites-overview and talents-overview --}} {{!-- ======================================================================== --}} {{!-- INLINE PARTIAL DEFINITIONS --}} diff --git a/src/templates/actor/partials/special-creature-abilites-overview.hbs b/src/templates/actor/partials/special-creature-abilites-overview.hbs new file mode 100644 index 00000000..28637149 --- /dev/null +++ b/src/templates/actor/partials/special-creature-abilites-overview.hbs @@ -0,0 +1,61 @@ +{{!-- TODO: Refactor to avoid code duplication with items-overview and talents-overview --}} + +{{!-- ======================================================================== --}} +{{!-- INLINE PARTIAL DEFINITIONS --}} +{{!-- ======================================================================== --}} + +{{!-- +!-- Render a list row for a base item from a given item. +!-- Base item means it just has an image, a description, and a name (and effects). +!-- It is a flexbox with a child for each item value of interest. +!-- The partial assumes a variable item to be given in the context. +!-- +!-- @param item: hand over the item to the partial as hash parameter +--}} +{{#*inline "baseItemListEntry"}} +<li class="item flexrow" data-item-id="{{item._id}}"> + {{!-- image --}} + <div class="flex05 item-image"> + <img src="{{item.img}}" title="{{item.name}}" width="24" height="24" /> + </div> + {{!-- name --}} + <input class="flex1 item-name item-change" type="text" value="{{item.name}}" data-dtype="String" + data-property="name" title="{{localize 'DS4.ItemName'}}"> + {{!-- description --}} + <div class="flex3 item-description">{{{item.data.data.description}}}</div> + {{!-- control buttons --}} + {{> systems/ds4/templates/actor/partials/overview-control-buttons.hbs }} +</li> +{{/inline}} + +{{!-- +!-- Render a list header for a base item list entries 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 +--}} +{{#*inline "baseItemListHeader"}} +<li class="item flexrow item-header"> + {{!-- image --}} + <div class="flex05 item-image"></div> + {{!-- name --}} + <div class="flex1 item-name">{{localize 'DS4.ItemName'}}</div> + {{!-- description --}} + <div class="flex3">{{localize 'DS4.Description'}}</div> + {{!-- add button --}} + {{> systems/ds4/templates/actor/partials/overview-add-button.hbs dataType=dataType }} +</li> +{{/inline}} + + +{{!-- ======================================================================== --}} + + +<div class="tab special-creature-abilites" data-group="primary" data-tab="special-creature-abilites"> + <ol class="items-list"> + {{> baseItemListHeader dataType='specialCreatureAbility' }} + {{#each itemsByType.specialCreatureAbility as |item id|}} + {{> baseItemListEntry item=item}} + {{/each}} + </ol> +</div> \ 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 5338955c..f72af894 100644 --- a/src/templates/actor/partials/spells-overview.hbs +++ b/src/templates/actor/partials/spells-overview.hbs @@ -27,7 +27,7 @@ {{!-- ======================================================================== --}} -<div class="tab items" data-group="primary" data-tab="spells"> +<div class="tab spells" data-group="primary" data-tab="spells"> <ol class="items-list"> <li class="item flexrow item-header"> {{!-- equipped --}} diff --git a/src/templates/actor/partials/talents-overview.hbs b/src/templates/actor/partials/talents-overview.hbs index 8ef93113..96974d04 100644 --- a/src/templates/actor/partials/talents-overview.hbs +++ b/src/templates/actor/partials/talents-overview.hbs @@ -1,3 +1,5 @@ +{{!-- TODO: Refactor to avoid code duplication with creature-special-abilities-overview and talents-overview --}} + {{!-- ======================================================================== --}} {{!-- INLINE PARTIAL DEFINITIONS --}} {{!-- ======================================================================== --}} @@ -118,7 +120,7 @@ {{!-- ======================================================================== --}} -<div class="tab items" data-group="primary" data-tab="talents"> +<div class="tab talents" data-group="primary" data-tab="talents"> <h4 class="items-list-title">{{localize 'DS4.ItemTypeTalentPlural'}}</h4> {{#> ifHasItemOfType itemsArray=itemsByType.talent dataType='talent' }} <ol class="items-list"> From 9ea353101fed72e5240dbfbe0a2e4413f1c1dafc Mon Sep 17 00:00:00 2001 From: Johannes Loher <johannes.loher@fg4f.de> Date: Wed, 13 Jan 2021 17:23:06 +0100 Subject: [PATCH 27/41] rename talents tab to talents-abilities --- src/lang/de.json | 2 +- src/lang/en.json | 2 +- src/module/ds4.ts | 2 +- src/templates/actor/character-sheet.hbs | 4 ++-- .../{talents-overview.hbs => talents-abilities-overview.hbs} | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) rename src/templates/actor/partials/{talents-overview.hbs => talents-abilities-overview.hbs} (98%) diff --git a/src/lang/de.json b/src/lang/de.json index aafc8506..0a0cc843 100644 --- a/src/lang/de.json +++ b/src/lang/de.json @@ -8,7 +8,7 @@ "DS4.HeadingEffects": "Effekte", "DS4.HeadingInventory": "Inventar", "DS4.HeadingProfile": "Profil", - "DS4.HeadingTalents": "Talente & Fähigkeiten", + "DS4.HeadingTalentsAbilities": "Talente & Fähigkeiten", "DS4.HeadingSpells": "Zaubersprüche", "DS4.HeadingDescription": "Beschreibung", "DS4.HeadingSpecialCreatureAbilites": "Besondere Fähigkeiten", diff --git a/src/lang/en.json b/src/lang/en.json index 2c74d9d9..5b56e87a 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -8,7 +8,7 @@ "DS4.HeadingEffects": "Effects", "DS4.HeadingInventory": "Inventory", "DS4.HeadingProfile": "Profile", - "DS4.HeadingTalents": "Talents & Abilities", + "DS4.HeadingTalentsAbilities": "Talents & Abilities", "DS4.HeadingSpells": "Spells", "DS4.HeadingDescription": "Description", "DS4.HeadingSpecialCreatureAbilites": "Special Abilites", diff --git a/src/module/ds4.ts b/src/module/ds4.ts index e0e2a892..0de44654 100644 --- a/src/module/ds4.ts +++ b/src/module/ds4.ts @@ -53,7 +53,7 @@ async function registerHandlebarsPartials() { "systems/ds4/templates/item/partials/effects.hbs", "systems/ds4/templates/item/partials/body.hbs", "systems/ds4/templates/actor/partials/items-overview.hbs", - "systems/ds4/templates/actor/partials/talents-overview.hbs", + "systems/ds4/templates/actor/partials/talents-abilities-overview.hbs", "systems/ds4/templates/actor/partials/spells-overview.hbs", "systems/ds4/templates/actor/partials/overview-add-button.hbs", "systems/ds4/templates/actor/partials/overview-control-buttons.hbs", diff --git a/src/templates/actor/character-sheet.hbs b/src/templates/actor/character-sheet.hbs index 6b9b1b82..5c0b4358 100644 --- a/src/templates/actor/character-sheet.hbs +++ b/src/templates/actor/character-sheet.hbs @@ -63,7 +63,7 @@ <nav class="sheet-tabs tabs" data-group="primary"> <a class="item" data-tab="inventory">{{localize 'DS4.HeadingInventory'}}</a> <a class="item" data-tab="spells">{{localize 'DS4.HeadingSpells'}}</a> - <a class="item" data-tab="talents">{{localize 'DS4.HeadingTalents'}}</a> + <a class="item" data-tab="talents-abilities">{{localize 'DS4.HeadingTalentsAbilities'}}</a> <a class="item" data-tab="profile">{{localize "DS4.HeadingProfile"}}</a> <a class="item" data-tab="biography">{{localize 'DS4.HeadingBiography'}}</a> </nav> @@ -77,7 +77,7 @@ {{> systems/ds4/templates/actor/partials/spells-overview.hbs}} {{!-- Talents Tab --}} - {{> systems/ds4/templates/actor/partials/talents-overview.hbs}} + {{> systems/ds4/templates/actor/partials/talents-abilities-overview.hbs}} {{! Profile Tab --}} {{> systems/ds4/templates/actor/partials/profile.hbs}} diff --git a/src/templates/actor/partials/talents-overview.hbs b/src/templates/actor/partials/talents-abilities-overview.hbs similarity index 98% rename from src/templates/actor/partials/talents-overview.hbs rename to src/templates/actor/partials/talents-abilities-overview.hbs index 96974d04..e40b2aa7 100644 --- a/src/templates/actor/partials/talents-overview.hbs +++ b/src/templates/actor/partials/talents-abilities-overview.hbs @@ -120,7 +120,7 @@ {{!-- ======================================================================== --}} -<div class="tab talents" data-group="primary" data-tab="talents"> +<div class="tab talents-abilities" data-group="primary" data-tab="talents-abilities"> <h4 class="items-list-title">{{localize 'DS4.ItemTypeTalentPlural'}}</h4> {{#> ifHasItemOfType itemsArray=itemsByType.talent dataType='talent' }} <ol class="items-list"> From fec4280bec067b13bd54d2465357596a2f2f01a2 Mon Sep 17 00:00:00 2001 From: Johannes Loher <johannes.loher@fg4f.de> Date: Wed, 13 Jan 2021 17:43:20 +0100 Subject: [PATCH 28/41] fix typo --- src/module/actor/sheets/creature-sheet.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/module/actor/sheets/creature-sheet.ts b/src/module/actor/sheets/creature-sheet.ts index a9103391..8c86848f 100644 --- a/src/module/actor/sheets/creature-sheet.ts +++ b/src/module/actor/sheets/creature-sheet.ts @@ -5,7 +5,7 @@ export class DS4CreatureActorSheet extends DS4ActorSheet { static get defaultOptions(): FormApplicationOptions { return mergeObject(super.defaultOptions, { classes: ["ds4", "sheet", "actor", "creature"], - tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "items" }], + tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "inventory" }], }); } } From d6ddad67cc9cb96ebab8d7e2b54473af478e2684 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20R=C3=BCmpelein?= <oli_r@fg4f.de> Date: Wed, 13 Jan 2021 18:02:22 +0100 Subject: [PATCH 29/41] Implement localization (en only). --- src/lang/en.json | 15 ++++++++++++++- src/module/config.ts | 12 +++++++++++- src/module/ds4.ts | 1 + src/module/rolls/check-factory.ts | 23 +++++++++++++++-------- src/templates/roll/roll-options.hbs | 12 ++++++------ 5 files changed, 47 insertions(+), 16 deletions(-) diff --git a/src/lang/en.json b/src/lang/en.json index 4f79f7ef..4e90df36 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -115,5 +115,18 @@ "DS4.ProfileSpecialCharacteristics": "Special Characteristics", "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" + "DS4.ErrorExplodingRecursionLimitExceeded": "Maximum recursion depth for exploding dice roll exceeded", + "DS4.RollDialogDefaultTitle": "Roll Options", + "DS4.RollDialogOkButton": "Ok", + "DS4.RollDialogCancelButton": "Cancel", + "DS4.HtmlTypeError": "Type Error: Expected {exType}, got {realType}", + "DS4.RollDialogTargetLabel": "Check Target Number", + "DS4.RollDialogModifierLabel": "Game Master Modifier", + "DS4.RollDialogCoupLabel": "Coup to", + "DS4.RollDialogFumbleLabel": "Fumble from", + "DS4.RollDialogVisibilityLabel": "Visibility", + "DS4.ChatVisibilityRoll": "All", + "DS4.ChatVisibilityGmRoll": "Self & GM", + "DS4.ChatVisibilityBlindRoll": "GM only", + "DS4.ChatVisibilitySelfRoll": "Self only" } diff --git a/src/module/config.ts b/src/module/config.ts index 03b2c9d5..7997e44b 100644 --- a/src/module/config.ts +++ b/src/module/config.ts @@ -175,7 +175,7 @@ export const DS4 = { }, /** - * Define the profile info types for hanndlebars of a character + * Define the profile info types for handlebars of a character */ profileDTypes: { gender: "String", @@ -188,4 +188,14 @@ export const DS4 = { eyeColor: "String", specialCharacteristics: "String", }, + + /** + * 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 4da8a49c..a676b49b 100644 --- a/src/module/ds4.ts +++ b/src/module/ds4.ts @@ -85,6 +85,7 @@ Hooks.once("setup", function () { "progression", "language", "profile", + "chatVisibilities", ]; // Exclude some from sorting where the default order matters diff --git a/src/module/rolls/check-factory.ts b/src/module/rolls/check-factory.ts index 4be81ee7..90562dbf 100644 --- a/src/module/rolls/check-factory.ts +++ b/src/module/rolls/check-factory.ts @@ -1,5 +1,7 @@ // TODO: Rename to something sane. +import { DS4 } from "../config"; + /** * Provides default values for all arguments the `CheckFactory` expects. */ @@ -112,13 +114,15 @@ async function askGmModifier( ): Promise<GmModifierData> { // Render model interface and return value const usedTemplate = template ?? "systems/ds4/templates/roll/roll-options.hbs"; + const usedTitle = title ?? game.i18n.localize("DS4.RollDialogDefaultTitle"); const templateData = { cssClass: "roll-option", - title: title ?? "Roll Options", + title: usedTitle, checkTargetValue: targetValue, maxCritSuccess: options.maxCritSuccess ?? defaultCheckOptions.maxCritSuccess, minCritFailure: options.minCritFailure ?? defaultCheckOptions.minCritFailure, rollModes: rollModes, + config: DS4, }; const renderedHtml = await renderTemplate(usedTemplate, templateData); @@ -126,17 +130,22 @@ async function askGmModifier( const dialogPromise = new Promise<HTMLFormElement>((resolve) => { new Dialog( { - title: title ?? "Roll Options", + title: usedTitle, close: () => { // Don't do anything }, content: renderedHtml, buttons: { ok: { - label: "OK", + label: game.i18n.localize("DS4.RollDialogOkButton"), callback: (html: HTMLElement | JQuery) => { if (!("jquery" in html)) { - throw new Error("Internal Type Error"); + throw new Error( + game.i18n.format("DS4.HtmlTypeError", { + exType: "JQuery", + realType: "HTMLElement", + }), + ); } else { const innerForm = html[0].querySelector("form"); resolve(innerForm); @@ -144,7 +153,7 @@ async function askGmModifier( }, }, cancel: { - label: "Cancel", + label: game.i18n.localize("DS4.RollDialogCancelButton"), callback: () => { // Don't do anything }, @@ -160,7 +169,7 @@ async function askGmModifier( } function parseDialogFormData(formData: HTMLFormElement, targetValue: number): GmModifierData { - const parsedData = { + return { checkTargetValue: parseInt(formData["ctv"]?.value) ?? targetValue, gmModifier: parseInt(formData["gmmod"]?.value) ?? 0, maxCritSuccess: parseInt(formData["maxcoup"]?.value) ?? defaultCheckOptions.maxCritSuccess, @@ -168,8 +177,6 @@ function parseDialogFormData(formData: HTMLFormElement, targetValue: number): Gm useSlayingDice: false, rollMode: formData["visibility"]?.value ?? defaultCheckOptions.rollMode, }; - console.log("Data", parsedData); - return parsedData; } // TODO: Remove unnecessary data step by step diff --git a/src/templates/roll/roll-options.hbs b/src/templates/roll/roll-options.hbs index 9e2b320e..8c3e7dc3 100644 --- a/src/templates/roll/roll-options.hbs +++ b/src/templates/roll/roll-options.hbs @@ -1,16 +1,16 @@ <form class="{{cssClass}} grid"> - <label for="ctv">Check Target Value</label> + <label for="ctv">{{localize "DS4.RollDialogTargetLabel"}}</label> <input id="ctv" data-type="Number" type="number" name="ctv" value="{{checkTargetValue}}" /> - <label for="gmmod">Game Master Modifier</label> + <label for="gmmod">{{localize "DS4.RollDialogModifierLabel"}}</label> <input id="gmmod" data-type="Number" type="number" name="gmmod" value="0" /> - <label for="maxcoup">Coup to</label> + <label for="maxcoup">{{localize "DS4.RollDialogCoupLabel"}}</label> <input id="maxcoup" data-type="Number" type="number" name="maxcoup" value="{{maxCritSuccess}}" /> - <label for="minfumble">Fumble from</label> + <label for="minfumble">{{localize "DS4.RollDialogFumbleLabel"}}</label> <input id="minfumble" data-type="Number" type="number" name="minfumble" value="{{minCritFailure}}" /> - <label for="visibility">Visibility</label> + <label for="visibility">{{localize "DS4.RollDialogVisibilityLabel"}}</label> <select id="visibility" data-type="String"> {{#each rollModes as |rollMode|}} - <option value="{{rollMode}}">{{rollMode}}</option> + <option value="{{rollMode}}">{{lookup ../config.chatVisibilities rollMode}}</option> {{/each}} </select> </form> From 04bfe61f3fbf7a30fe35a5a9095d3d327a49bbab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20R=C3=BCmpelein?= <oli_r@fg4f.de> Date: Wed, 13 Jan 2021 18:56:19 +0100 Subject: [PATCH 30/41] Update localization, add docs. --- src/lang/de.json | 15 +++++++++- src/module/rolls/check-factory.ts | 48 ++++++++++++++++++++++++++----- 2 files changed, 55 insertions(+), 8 deletions(-) diff --git a/src/lang/de.json b/src/lang/de.json index 5c675015..cfccf49b 100644 --- a/src/lang/de.json +++ b/src/lang/de.json @@ -157,5 +157,18 @@ "DS4.UnitKilometers": "Kilometer", "DS4.UnitKilometersAbbr": "km", "DS4.UnitCustom": "individuell", - "DS4.UnitCustomAbbr": " " + "DS4.UnitCustomAbbr": " ", + "DS4.RollDialogDefaultTitle": "Probenwerte", + "DS4.RollDialogOkButton": "Ok", + "DS4.RollDialogCancelButton": "Abbrechen", + "DS4.HtmlTypeError": "Typfehler: Erwartet wurde {exType}, tatsächlich erhalten wurde {realType}", + "DS4.RollDialogTargetLabel": "Probenwert", + "DS4.RollDialogModifierLabel": "SL-Modifikator", + "DS4.RollDialogCoupLabel": "Immersieg bis", + "DS4.RollDialogFumbleLabel": "Patzer ab", + "DS4.RollDialogVisibilityLabel": "Sichtbarkeit", + "DS4.ChatVisibilityRoll": "Alle", + "DS4.ChatVisibilityGmRoll": "Selbst & SL", + "DS4.ChatVisibilityBlindRoll": "Nur SL", + "DS4.ChatVisibilitySelfRoll": "Nur selbst" } diff --git a/src/module/rolls/check-factory.ts b/src/module/rolls/check-factory.ts index 90562dbf..6ec836fc 100644 --- a/src/module/rolls/check-factory.ts +++ b/src/module/rolls/check-factory.ts @@ -16,6 +16,9 @@ class DefaultCheckOptions implements DS4CheckFactoryOptions { } } +/** + * Singleton reference for default value extraction. + */ const defaultCheckOptions = new DefaultCheckOptions(); /** @@ -73,7 +76,6 @@ class CheckFactory { } } -// TODO: Figure out return of roll (void should be Ok, tough?) /** * Asks the user for all unknown/necessary information and passes them on to perform a roll. * @param targetValue {number} The Check Target Number ("CTN") @@ -100,18 +102,18 @@ export async function createCheckRoll(targetValue: number, options: Partial<DS4C } /** - * Responsible for rendering the modal interface asking for the modifier specified by GM. + * Responsible for rendering the modal interface asking for the modifier specified by GM and (currently) additional data. * * @notes * At the moment, this asks for more data than it will do after some iterations. * - * @returns {Promise<number>} The number by the user. + * @returns {Promise<IntermediateGmModifierData>} The data given by the user. */ async function askGmModifier( targetValue: number, options: Partial<DS4CheckFactoryOptions>, { template, title }: { template?: string; title?: string } = {}, -): Promise<GmModifierData> { +): Promise<IntermediateGmModifierData> { // Render model interface and return value const usedTemplate = template ?? "systems/ds4/templates/roll/roll-options.hbs"; const usedTitle = title ?? game.i18n.localize("DS4.RollDialogDefaultTitle"); @@ -126,7 +128,6 @@ async function askGmModifier( }; const renderedHtml = await renderTemplate(usedTemplate, templateData); - // TODO: Localize const dialogPromise = new Promise<HTMLFormElement>((resolve) => { new Dialog( { @@ -168,7 +169,12 @@ async function askGmModifier( return parseDialogFormData(dialogForm, targetValue); } -function parseDialogFormData(formData: HTMLFormElement, targetValue: number): GmModifierData { +/** + * Extracts Dialog data from the returned DOM element. + * @param formData {HTMLFormElement} The filed dialog + * @param targetValue {number} The previously known target value (slated for removal once data automation is available) + */ +function parseDialogFormData(formData: HTMLFormElement, targetValue: number): IntermediateGmModifierData { return { checkTargetValue: parseInt(formData["ctv"]?.value) ?? targetValue, gmModifier: parseInt(formData["gmmod"]?.value) ?? 0, @@ -179,8 +185,30 @@ function parseDialogFormData(formData: HTMLFormElement, targetValue: number): Gm }; } -// TODO: Remove unnecessary data step by step +/** + * Contains data that needs retrieval from an interactive Dialog. + */ interface GmModifierData { + gmModifier: number; + rollMode: DS4RollMode; +} + +/** + * Contains *CURRENTLY* necessary Data for drafting a roll. + * + * @deprecated + * Quite a lot of this information is requested due to a lack of automation: + * - maxCritSuccess + * - minCritFailure + * - useSlayingDice + * - checkTargetValue + * + * They will and should be removed once effects and data retrieval is in place. + * If a "raw" roll dialog is necessary, create another pre-porcessing Dialog + * class asking for the required information. + * This interface should then be replaced with the `GmModifierData`. + */ +interface IntermediateGmModifierData extends GmModifierData { checkTargetValue: number; gmModifier: number; maxCritSuccess: number; @@ -190,6 +218,9 @@ interface GmModifierData { rollMode: DS4RollMode; } +/** + * The minimum behavioural options that need to be passed to the factory. + */ export interface DS4CheckFactoryOptions { maxCritSuccess: number; minCritFailure: number; @@ -197,6 +228,9 @@ export interface DS4CheckFactoryOptions { rollMode: DS4RollMode; } +/** + * Defines all possible roll modes, both for iterating and typing. + */ const rollModes = ["roll", "gmroll", "blindroll", "selfroll"] as const; type DS4RollModeTuple = typeof rollModes; export type DS4RollMode = DS4RollModeTuple[number]; From ebc9b95758d6e25a8cb6f2edeb8f5d89b1fccac3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20R=C3=BCmpelein?= <oli_r@fg4f.de> Date: Wed, 13 Jan 2021 20:12:37 +0100 Subject: [PATCH 31/41] Fix tests. --- src/lang/en.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lang/en.json b/src/lang/en.json index 0d4674b1..3c388407 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -143,6 +143,7 @@ "DS4.ProfileSpecialCharacteristics": "Special Characteristics", "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", "DS4.UnitRounds": "Rounds", "DS4.UnitRoundsAbbr": "rnd", "DS4.UnitMinutes": "Minutes", @@ -157,7 +158,6 @@ "DS4.UnitKilometersAbbr": "km", "DS4.UnitCustom": "Custom Unit", "DS4.UnitCustomAbbr": " ", - "DS4.ErrorExplodingRecursionLimitExceeded": "Maximum recursion depth for exploding dice roll exceeded", "DS4.RollDialogDefaultTitle": "Roll Options", "DS4.RollDialogOkButton": "Ok", "DS4.RollDialogCancelButton": "Cancel", From 6028f70da721606654becca9d4d1aa711c5fdb57 Mon Sep 17 00:00:00 2001 From: Johannes Loher <johannes.loher@fg4f.de> Date: Fri, 15 Jan 2021 17:42:10 +0100 Subject: [PATCH 32/41] remove unused type --- src/module/actor/actor-data.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/module/actor/actor-data.ts b/src/module/actor/actor-data.ts index 20c26741..883b6f5d 100644 --- a/src/module/actor/actor-data.ts +++ b/src/module/actor/actor-data.ts @@ -1,7 +1,4 @@ import { ModifiableData, ResourceData, UsableResource } from "../common/common-data"; -import { DS4 } from "../config"; - -export type ActorType = keyof typeof DS4.actorTypes; export type DS4ActorDataType = DS4ActorDataCharacter | DS4ActorDataCreature; From 358aab023f4475e1edf1b7e7e77fe220982c1c98 Mon Sep 17 00:00:00 2001 From: Johannes Loher <johannes.loher@fg4f.de> Date: Fri, 15 Jan 2021 17:43:27 +0100 Subject: [PATCH 33/41] add explicit return in _onDrop --- src/module/actor/sheets/actor-sheet.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/module/actor/sheets/actor-sheet.ts b/src/module/actor/sheets/actor-sheet.ts index bfb58b01..26f6bd8b 100644 --- a/src/module/actor/sheets/actor-sheet.ts +++ b/src/module/actor/sheets/actor-sheet.ts @@ -226,6 +226,6 @@ export class DS4ActorSheet extends ActorSheet<DS4ActorDataType, DS4Actor, DS4Ite return false; } } - super._onDrop(event); + return super._onDrop(event); } } From d8bee001303969373fa88d192f2e8650536973d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20R=C3=BCmpelein?= <oli_r@fg4f.de> Date: Fri, 15 Jan 2021 20:15:23 +0100 Subject: [PATCH 34/41] Update deps. --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3c38cde2..390b24ac 100644 --- a/package-lock.json +++ b/package-lock.json @@ -159,9 +159,9 @@ "dev": true }, "@types/socket.io-client": { - "version": "1.4.34", - "resolved": "https://registry.npmjs.org/@types/socket.io-client/-/socket.io-client-1.4.34.tgz", - "integrity": "sha512-Lzia5OTQFJZJ5R4HsEEldywiiqT9+W2rDbyHJiiTGqOcju89sCsQ8aUXDljY6Ls33wKZZGC0bfMhr/VpOyjtXg==", + "version": "1.4.35", + "resolved": "https://registry.npmjs.org/@types/socket.io-client/-/socket.io-client-1.4.35.tgz", + "integrity": "sha512-MI8YmxFS+jMkIziycT5ickBWK1sZwDwy16mgH/j99Mcom6zRG/NimNGQ3vJV0uX5G6g/hEw0FG3w3b3sT5OUGw==", "dev": true }, "@types/tinymce": { From f406f5bd83a211b1b27100339b1de00272c3e466 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20R=C3=BCmpelein?= <oli_r@fg4f.de> Date: Fri, 15 Jan 2021 20:18:31 +0100 Subject: [PATCH 35/41] Update deps. --- package-lock.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index c6f8a114..390b24ac 100644 --- a/package-lock.json +++ b/package-lock.json @@ -159,9 +159,9 @@ "dev": true }, "@types/socket.io-client": { - "version": "1.4.34", - "resolved": "https://registry.npmjs.org/@types/socket.io-client/-/socket.io-client-1.4.34.tgz", - "integrity": "sha512-Lzia5OTQFJZJ5R4HsEEldywiiqT9+W2rDbyHJiiTGqOcju89sCsQ8aUXDljY6Ls33wKZZGC0bfMhr/VpOyjtXg==", + "version": "1.4.35", + "resolved": "https://registry.npmjs.org/@types/socket.io-client/-/socket.io-client-1.4.35.tgz", + "integrity": "sha512-MI8YmxFS+jMkIziycT5ickBWK1sZwDwy16mgH/j99Mcom6zRG/NimNGQ3vJV0uX5G6g/hEw0FG3w3b3sT5OUGw==", "dev": true }, "@types/tinymce": { @@ -2717,7 +2717,7 @@ } }, "foundry-pc-types": { - "version": "git+https://git.f3l.de/dungeonslayers/foundry-pc-types.git#5a2140620d5be1f42d90dec6c42b3b88ff165f19", + "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": { From b06396c141b2028850a977488cee9734e8a63595 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20R=C3=BCmpelein?= <oli_r@fg4f.de> Date: Fri, 15 Jan 2021 20:46:26 +0100 Subject: [PATCH 36/41] Review comments: - Error prefix on localization key - Different name for Roll dialog title - Remove obsolete todos - Add some defaults to make args optional - Change return types of promises and term generators --- src/lang/de.json | 4 ++-- src/lang/en.json | 2 +- src/module/rolls/check-factory.ts | 21 +++++++++++---------- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/lang/de.json b/src/lang/de.json index cfccf49b..39a139ca 100644 --- a/src/lang/de.json +++ b/src/lang/de.json @@ -158,10 +158,10 @@ "DS4.UnitKilometersAbbr": "km", "DS4.UnitCustom": "individuell", "DS4.UnitCustomAbbr": " ", - "DS4.RollDialogDefaultTitle": "Probenwerte", + "DS4.RollDialogDefaultTitle": "Proben-Optionen", "DS4.RollDialogOkButton": "Ok", "DS4.RollDialogCancelButton": "Abbrechen", - "DS4.HtmlTypeError": "Typfehler: Erwartet wurde {exType}, tatsächlich erhalten wurde {realType}", + "DS4.ErrorUnexpectedHtmlType": "Typfehler: Erwartet wurde {exType}, tatsächlich erhalten wurde {realType}", "DS4.RollDialogTargetLabel": "Probenwert", "DS4.RollDialogModifierLabel": "SL-Modifikator", "DS4.RollDialogCoupLabel": "Immersieg bis", diff --git a/src/lang/en.json b/src/lang/en.json index 3c388407..20d06eef 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -161,7 +161,7 @@ "DS4.RollDialogDefaultTitle": "Roll Options", "DS4.RollDialogOkButton": "Ok", "DS4.RollDialogCancelButton": "Cancel", - "DS4.HtmlTypeError": "Type Error: Expected {exType}, got {realType}", + "DS4.ErrorUnexpectedHtmlType": "Type Error: Expected {exType}, got {realType}", "DS4.RollDialogTargetLabel": "Check Target Number", "DS4.RollDialogModifierLabel": "Game Master Modifier", "DS4.RollDialogCoupLabel": "Coup to", diff --git a/src/module/rolls/check-factory.ts b/src/module/rolls/check-factory.ts index 6ec836fc..066202d6 100644 --- a/src/module/rolls/check-factory.ts +++ b/src/module/rolls/check-factory.ts @@ -1,5 +1,3 @@ -// TODO: Rename to something sane. - import { DS4 } from "../config"; /** @@ -35,7 +33,7 @@ class CheckFactory { private checkOptions: DS4CheckFactoryOptions; - async execute(): Promise<void> { + async execute(): Promise<ChatMessage | any> { const rollCls: typeof Roll = CONFIG.Dice.rolls[0]; const formula = [ @@ -52,15 +50,15 @@ class CheckFactory { } // Term generators - createTargetValueTerm(): string { - if (this.checkTargetValue != null) { + createTargetValueTerm(): string | null { + if (this.checkTargetValue !== null) { return "v" + (this.checkTargetValue + this.gmModifier); } else { return null; } } - createCritTerm(): string { + createCritTerm(): string | null { const minCritRequired = this.checkOptions.minCritFailure !== defaultCheckOptions.minCritFailure; const maxCritRequired = this.checkOptions.maxCritSuccess !== defaultCheckOptions.maxCritSuccess; @@ -71,7 +69,7 @@ class CheckFactory { } } - createSlayingDiceTerm(): string { + createSlayingDiceTerm(): string | null { return this.checkOptions.useSlayingDice ? "x" : null; } } @@ -81,7 +79,10 @@ class CheckFactory { * @param targetValue {number} The Check Target Number ("CTN") * @param options {Partial<DS4CheckFactoryOptions>} Options changing the behaviour of the roll and message. */ -export async function createCheckRoll(targetValue: number, options: Partial<DS4CheckFactoryOptions>): Promise<void> { +export async function createCheckRoll( + targetValue: number, + options: Partial<DS4CheckFactoryOptions> = {}, +): Promise<ChatMessage | any> { // Ask for additional required data; const gmModifierData = await askGmModifier(targetValue, options); @@ -111,7 +112,7 @@ export async function createCheckRoll(targetValue: number, options: Partial<DS4C */ async function askGmModifier( targetValue: number, - options: Partial<DS4CheckFactoryOptions>, + options: Partial<DS4CheckFactoryOptions> = {}, { template, title }: { template?: string; title?: string } = {}, ): Promise<IntermediateGmModifierData> { // Render model interface and return value @@ -142,7 +143,7 @@ async function askGmModifier( callback: (html: HTMLElement | JQuery) => { if (!("jquery" in html)) { throw new Error( - game.i18n.format("DS4.HtmlTypeError", { + game.i18n.format("DS4.ErrorUnexpectedHtmlType", { exType: "JQuery", realType: "HTMLElement", }), From 4c902500c987e96948b7295238cb817d28fba4e8 Mon Sep 17 00:00:00 2001 From: Gesina Schwalbe <gesina.schwalbe@pheerai.de> Date: Sat, 16 Jan 2021 23:47:05 +0100 Subject: [PATCH 37/41] unit values only displayed if given --- .../actor/partials/spells-overview.hbs | 31 ++++++++++++------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/src/templates/actor/partials/spells-overview.hbs b/src/templates/actor/partials/spells-overview.hbs index 5338955c..e7e865f7 100644 --- a/src/templates/actor/partials/spells-overview.hbs +++ b/src/templates/actor/partials/spells-overview.hbs @@ -2,25 +2,32 @@ {{!-- INLINE PARTIAL DEFINITIONS --}} {{!-- ======================================================================== --}} - -{{!-- -!-- Two templates for displaying values with unit. +{{!-- +!-- Base template to display a value with unit. !-- @param unitDatum: the object to display; must have a value and a unit attribute !-- @param localizationString -!-- @param config: the config object +!-- @param unitNames: mapping of allowed unitDatum.unit values to localized unit name +!-- @param unitAbbrs: mapping of allowed unitDatum.unit values to unit abbreviation +--}} +{{#*inline "unit"}} +<div class="unit-data-pair item-num-val" + title="{{localize localizationString}} [{{lookup unitNames unitDatum.unit}}]" > + {{#if unitDatum.value }} + {{unitDatum.value}}{{lookup unitAbbrs unitDatum.unit}} + {{else}}-{{/if}} +</div> +{{/inline}} +{{!-- +!-- Two templates based on the "unit" template for displaying values with unit. +!-- Both accept a `config` object holding the unitNames and unitAbbr instead of +!-- directly handing over the latter two. --}} {{#*inline "temporalUnit"}} -<div class="unit-data-pair item-num-val" - title="{{localize localizationString}} [{{lookup config.temporalUnits unitDatum.unit}}]" > - {{unitDatum.value}}{{lookup config.temporalUnitsAbbr unitDatum.unit}} -</div> +{{> unit unitNames=config.temporalUnits unitAbbrs=config.temporalUnitsAbbr unitDatum=unitDatum localizationString=localizationString}} {{/inline}} {{#*inline "distanceUnit"}} -<div class="unit-data-pair item-num-val" - title="{{localize localizationString}} [{{lookup config.distanceUnits unitDatum.unit}}]" > - {{unitDatum.value}}{{lookup config.distanceUnitsAbbr unitDatum.unit}} -</div> +{{> unit unitNames=config.distanceUnits unitAbbrs=config.distanceUnitsAbbr unitDatum=unitDatum localizationString=localizationString}} {{/inline}} From fc144aa3f668c12f67c51c9dd9bf85ce4428fc98 Mon Sep 17 00:00:00 2001 From: Johannes Loher <johannes.loher@fg4f.de> Date: Mon, 18 Jan 2021 19:03:08 +0100 Subject: [PATCH 38/41] Apply 1 suggestion(s) to 1 file(s) --- src/module/actor/actor.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/module/actor/actor.ts b/src/module/actor/actor.ts index 29d80199..df3ad6d7 100644 --- a/src/module/actor/actor.ts +++ b/src/module/actor/actor.ts @@ -44,7 +44,7 @@ export class DS4Actor extends Actor<DS4ActorDataType, DS4ItemDataType, DS4Item> case "creature": return ["weapon", "armor", "shield", "trinket", "equipment", "spell", "specialCreatureAbility"]; default: - []; + return []; } } From 7e4c5059caa124b117e967bff811363e4c46e7df Mon Sep 17 00:00:00 2001 From: Johannes Loher <johannes.loher@fg4f.de> Date: Mon, 18 Jan 2021 19:11:13 +0100 Subject: [PATCH 39/41] address code review comments --- src/lang/de.json | 6 +++--- src/lang/en.json | 2 +- src/module/config.ts | 4 ++-- src/templates/actor/partials/items-overview.hbs | 1 - src/templates/item/specialCreatureAbility-sheet.hbs | 4 ++-- 5 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/lang/de.json b/src/lang/de.json index 0a0cc843..e1b11e81 100644 --- a/src/lang/de.json +++ b/src/lang/de.json @@ -57,8 +57,8 @@ "DS4.ItemTypeLanguagePlural": "Sprachen", "DS4.ItemTypeAlphabet": "Schriftzeichen", "DS4.ItemTypeAlphabetPlural": "Schriftzeichen", - "DS4.ItemTypeSpecialCreatureAbility": "Besondere Kreaturefähigkeit", - "DS4.ItemTypeSpecialCreatureAbilityPlural": "Besondere Kreaturefähigkeiten", + "DS4.ItemTypeSpecialCreatureAbility": "Besondere Kreaturenfähigkeit", + "DS4.ItemTypeSpecialCreatureAbilityPlural": "Besondere Kreaturenfähigkeiten", "DS4.ArmorType": "Panzerungstyp", "DS4.ArmorTypeAbbr": "PAT", "DS4.ArmorMaterialType": "Material Typ", @@ -145,7 +145,7 @@ "DS4.CharacterProfileBirthplace": "Geburtsort", "DS4.CharacterProfileAge": "Alter", "DS4.CharacterProfileHeight": "Größe", - "DS4.ProfilHairColor": "Haarfarbe", + "DS4.ProfilEHairColor": "Haarfarbe", "DS4.CharacterProfileWeight": "Gewicht", "DS4.CharacterProfileEyeColor": "Augenfarbe", "DS4.CharacterProfileSpecialCharacteristics": "Besondere Eigenschaften", diff --git a/src/lang/en.json b/src/lang/en.json index 5b56e87a..470dc609 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -145,7 +145,7 @@ "DS4.CharacterProfileBirthplace": "Birthplace", "DS4.CharacterProfileAge": "Age", "DS4.CharacterProfileHeight": "Height", - "DS4.ProfilHairColor": "Hair Color", + "DS4.ProfilEHairColor": "Hair Color", "DS4.CharacterProfileWeight": "Weight", "DS4.CharacterProfileEyeColor": "Eye Color", "DS4.CharacterProfileSpecialCharacteristics": "Special Characteristics", diff --git a/src/module/config.ts b/src/module/config.ts index 6f42ee13..63f22511 100644 --- a/src/module/config.ts +++ b/src/module/config.ts @@ -204,7 +204,7 @@ export const DS4 = { birthplace: "DS4.CharacterProfileBirthplace", age: "DS4.CharacterProfileAge", height: "DS4.CharacterProfileHeight", - hairColor: "DS4.ProfilHairColor", + hairColor: "DS4.ProfilEHairColor", weight: "DS4.CharacterProfileWeight", eyeColor: "DS4.CharacterProfileEyeColor", specialCharacteristics: "DS4.CharacterProfileSpecialCharacteristics", @@ -239,7 +239,7 @@ export const DS4 = { }, /** - * Define the different size categories a creatures fall into + * Define the different size categories creatures fall into */ creatureSizeCategories: { tiny: "DS4.CreatureSizeCategoryTiny", diff --git a/src/templates/actor/partials/items-overview.hbs b/src/templates/actor/partials/items-overview.hbs index a76c714e..4d7135aa 100644 --- a/src/templates/actor/partials/items-overview.hbs +++ b/src/templates/actor/partials/items-overview.hbs @@ -1,4 +1,3 @@ -{{!-- TODO: For items list: only show header, if list is not empty --}} {{!-- TODO: Refactor to avoid code duplication with special-creature-abilites-overview and talents-overview --}} {{!-- ======================================================================== --}} diff --git a/src/templates/item/specialCreatureAbility-sheet.hbs b/src/templates/item/specialCreatureAbility-sheet.hbs index 3f100c3d..086ba9a5 100644 --- a/src/templates/item/specialCreatureAbility-sheet.hbs +++ b/src/templates/item/specialCreatureAbility-sheet.hbs @@ -3,8 +3,8 @@ <div class="grid grid-3col basic-properties"> <div class="basic-property"> <label>{{localize "DS4.SpecialCreatureAbilityExperiencePoints"}}</label> - <input type="number" name="data.experiencePoints" value="{{data.experiencePoints}}" placeholder="0" - data-dtype="Number" /> + <input type="number" min="0" step="1" name="data.experiencePoints" value="{{data.experiencePoints}}" + placeholder="0" data-dtype="Number" /> </div> </div> {{/systems/ds4/templates/item/partials/sheet-header.hbs}} From a9725aa1c9febb7d0274f8f28f137a03ae9eaab1 Mon Sep 17 00:00:00 2001 From: Johannes Loher <johannes.loher@fg4f.de> Date: Mon, 18 Jan 2021 19:19:30 +0100 Subject: [PATCH 40/41] update dependencies --- package-lock.json | 206 +++++++++++++++++++++++++--------------------- package.json | 14 ++-- 2 files changed, 118 insertions(+), 102 deletions(-) diff --git a/package-lock.json b/package-lock.json index 390b24ac..447b66d0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -44,9 +44,9 @@ } }, "@eslint/eslintrc": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.2.2.tgz", - "integrity": "sha512-EfB5OHNYp1F4px/LI/FEnGylop7nOqkQ1LRzCM0KccA2U8tvV8w01KBv37LbO7nW4H+YhKyo2LcJhRwjjV17QQ==", + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.3.0.tgz", + "integrity": "sha512-1JTKgrOKAHVivSvOYw+sJOunkBjUOvjqWk1DPja7ZFhIS2mX/4EgTT8M7eTK9jrKhL/FvXXEbQwIs3pg1xp3dg==", "dev": true, "requires": { "ajv": "^6.12.4", @@ -56,7 +56,7 @@ "ignore": "^4.0.6", "import-fresh": "^3.2.1", "js-yaml": "^3.13.1", - "lodash": "^4.17.19", + "lodash": "^4.17.20", "minimatch": "^3.0.4", "strip-json-comments": "^3.1.1" }, @@ -174,15 +174,16 @@ } }, "@typescript-eslint/eslint-plugin": { - "version": "4.11.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.11.1.tgz", - "integrity": "sha512-fABclAX2QIEDmTMk6Yd7Muv1CzFLwWM4505nETzRHpP3br6jfahD9UUJkhnJ/g2m7lwfz8IlswcwGGPGiq9exw==", + "version": "4.14.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.14.0.tgz", + "integrity": "sha512-IJ5e2W7uFNfg4qh9eHkHRUCbgZ8VKtGwD07kannJvM5t/GU8P8+24NX8gi3Hf5jST5oWPY8kyV1s/WtfiZ4+Ww==", "dev": true, "requires": { - "@typescript-eslint/experimental-utils": "4.11.1", - "@typescript-eslint/scope-manager": "4.11.1", + "@typescript-eslint/experimental-utils": "4.14.0", + "@typescript-eslint/scope-manager": "4.14.0", "debug": "^4.1.1", "functional-red-black-tree": "^1.0.1", + "lodash": "^4.17.15", "regexpp": "^3.0.0", "semver": "^7.3.2", "tsutils": "^3.17.1" @@ -230,28 +231,28 @@ } }, "@typescript-eslint/experimental-utils": { - "version": "4.11.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.11.1.tgz", - "integrity": "sha512-mAlWowT4A6h0TC9F+J5pdbEhjNiEMO+kqPKQ4sc3fVieKL71dEqfkKgtcFVSX3cjSBwYwhImaQ/mXQF0oaI38g==", + "version": "4.14.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.14.0.tgz", + "integrity": "sha512-6i6eAoiPlXMKRbXzvoQD5Yn9L7k9ezzGRvzC/x1V3650rUk3c3AOjQyGYyF9BDxQQDK2ElmKOZRD0CbtdkMzQQ==", "dev": true, "requires": { "@types/json-schema": "^7.0.3", - "@typescript-eslint/scope-manager": "4.11.1", - "@typescript-eslint/types": "4.11.1", - "@typescript-eslint/typescript-estree": "4.11.1", + "@typescript-eslint/scope-manager": "4.14.0", + "@typescript-eslint/types": "4.14.0", + "@typescript-eslint/typescript-estree": "4.14.0", "eslint-scope": "^5.0.0", "eslint-utils": "^2.0.0" } }, "@typescript-eslint/parser": { - "version": "4.11.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.11.1.tgz", - "integrity": "sha512-BJ3jwPQu1jeynJ5BrjLuGfK/UJu6uwHxJ/di7sanqmUmxzmyIcd3vz58PMR7wpi8k3iWq2Q11KMYgZbUpRoIPw==", + "version": "4.14.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.14.0.tgz", + "integrity": "sha512-sUDeuCjBU+ZF3Lzw0hphTyScmDDJ5QVkyE21pRoBo8iDl7WBtVFS+WDN3blY1CH3SBt7EmYCw6wfmJjF0l/uYg==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "4.11.1", - "@typescript-eslint/types": "4.11.1", - "@typescript-eslint/typescript-estree": "4.11.1", + "@typescript-eslint/scope-manager": "4.14.0", + "@typescript-eslint/types": "4.14.0", + "@typescript-eslint/typescript-estree": "4.14.0", "debug": "^4.1.1" }, "dependencies": { @@ -273,29 +274,29 @@ } }, "@typescript-eslint/scope-manager": { - "version": "4.11.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.11.1.tgz", - "integrity": "sha512-Al2P394dx+kXCl61fhrrZ1FTI7qsRDIUiVSuN6rTwss6lUn8uVO2+nnF4AvO0ug8vMsy3ShkbxLu/uWZdTtJMQ==", + "version": "4.14.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.14.0.tgz", + "integrity": "sha512-/J+LlRMdbPh4RdL4hfP1eCwHN5bAhFAGOTsvE6SxsrM/47XQiPSgF5MDgLyp/i9kbZV9Lx80DW0OpPkzL+uf8Q==", "dev": true, "requires": { - "@typescript-eslint/types": "4.11.1", - "@typescript-eslint/visitor-keys": "4.11.1" + "@typescript-eslint/types": "4.14.0", + "@typescript-eslint/visitor-keys": "4.14.0" } }, "@typescript-eslint/types": { - "version": "4.11.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.11.1.tgz", - "integrity": "sha512-5kvd38wZpqGY4yP/6W3qhYX6Hz0NwUbijVsX2rxczpY6OXaMxh0+5E5uLJKVFwaBM7PJe1wnMym85NfKYIh6CA==", + "version": "4.14.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.14.0.tgz", + "integrity": "sha512-VsQE4VvpldHrTFuVPY1ZnHn/Txw6cZGjL48e+iBxTi2ksa9DmebKjAeFmTVAYoSkTk7gjA7UqJ7pIsyifTsI4A==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "4.11.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.11.1.tgz", - "integrity": "sha512-tC7MKZIMRTYxQhrVAFoJq/DlRwv1bnqA4/S2r3+HuHibqvbrPcyf858lNzU7bFmy4mLeIHFYr34ar/1KumwyRw==", + "version": "4.14.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.14.0.tgz", + "integrity": "sha512-wRjZ5qLao+bvS2F7pX4qi2oLcOONIB+ru8RGBieDptq/SudYwshveORwCVU4/yMAd4GK7Fsf8Uq1tjV838erag==", "dev": true, "requires": { - "@typescript-eslint/types": "4.11.1", - "@typescript-eslint/visitor-keys": "4.11.1", + "@typescript-eslint/types": "4.14.0", + "@typescript-eslint/visitor-keys": "4.14.0", "debug": "^4.1.1", "globby": "^11.0.1", "is-glob": "^4.0.1", @@ -346,12 +347,12 @@ } }, "@typescript-eslint/visitor-keys": { - "version": "4.11.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.11.1.tgz", - "integrity": "sha512-IrlBhD9bm4bdYcS8xpWarazkKXlE7iYb1HzRuyBP114mIaj5DJPo11Us1HgH60dTt41TCZXMaTCAW+OILIYPOg==", + "version": "4.14.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.14.0.tgz", + "integrity": "sha512-MeHHzUyRI50DuiPgV9+LxcM52FCJFYjJiWHtXlbyC27b80mfOwKeiKI+MHOTEpcpfmoPFm/vvQS88bYIx6PZTA==", "dev": true, "requires": { - "@typescript-eslint/types": "4.11.1", + "@typescript-eslint/types": "4.14.0", "eslint-visitor-keys": "^2.0.0" } }, @@ -570,9 +571,9 @@ "dev": true }, "archiver": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/archiver/-/archiver-5.1.0.tgz", - "integrity": "sha512-iKuQUP1nuKzBC2PFlGet5twENzCfyODmvkxwDV0cEFXavwcLrIW5ssTuHi9dyTPvpWr6Faweo2eQaQiLIwyXTA==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/archiver/-/archiver-5.2.0.tgz", + "integrity": "sha512-QEAKlgQuAtUxKeZB9w5/ggKXh21bZS+dzzuQ0RPBC20qtDCbTyzqmisoeJP46MP39fg4B4IcyvR+yeyEBdblsQ==", "dev": true, "requires": { "archiver-utils": "^2.1.0", @@ -1969,13 +1970,13 @@ "dev": true }, "eslint": { - "version": "7.17.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.17.0.tgz", - "integrity": "sha512-zJk08MiBgwuGoxes5sSQhOtibZ75pz0J35XTRlZOk9xMffhpA9BTbQZxoXZzOl5zMbleShbGwtw+1kGferfFwQ==", + "version": "7.18.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-7.18.0.tgz", + "integrity": "sha512-fbgTiE8BfUJZuBeq2Yi7J3RB3WGUQ9PNuNbmgi6jt9Iv8qrkxfy19Ds3OpL1Pm7zg3BtTVhvcUZbIRQ0wmSjAQ==", "dev": true, "requires": { "@babel/code-frame": "^7.0.0", - "@eslint/eslintrc": "^0.2.2", + "@eslint/eslintrc": "^0.3.0", "ajv": "^6.10.0", "chalk": "^4.0.0", "cross-spawn": "^7.0.2", @@ -1999,7 +2000,7 @@ "js-yaml": "^3.13.1", "json-stable-stringify-without-jsonify": "^1.0.1", "levn": "^0.4.1", - "lodash": "^4.17.19", + "lodash": "^4.17.20", "minimatch": "^3.0.4", "natural-compare": "^1.4.0", "optionator": "^0.9.1", @@ -2111,9 +2112,9 @@ "dev": true }, "eslint-plugin-prettier": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-3.3.0.tgz", - "integrity": "sha512-tMTwO8iUWlSRZIwS9k7/E4vrTsfvsrcM5p1eftyuqWH25nKsz/o6/54I7jwQ/3zobISyC7wMy9ZsFwgTxOcOpQ==", + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-3.3.1.tgz", + "integrity": "sha512-Rq3jkcFY8RYeQLgk2cCwuc0P7SEFwDravPhsJZOQ5N4YI4DSg50NyqJ/9gdZHzQlHf8MvafSesbNJCcP/FF6pQ==", "dev": true, "requires": { "prettier-linter-helpers": "^1.0.0" @@ -2452,9 +2453,9 @@ "dev": true }, "fast-glob": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.4.tgz", - "integrity": "sha512-kr/Oo6PX51265qeuCYsyGypiO5uJFgBS0jksyG7FUeCyQzNwYnzrNIMR1NXfkZXsMYXYLRAHgISHBz8gQcxKHQ==", + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.5.tgz", + "integrity": "sha512-2DtFcgT68wiTTiwZ2hNdJfcHNke9XOfnwmBRWXhmeKM8rF0TGwmC/Qto3S7RoZKp5cilZbxzO5iTNTQsJ+EeDg==", "dev": true, "requires": { "@nodelib/fs.stat": "^2.0.2", @@ -2599,12 +2600,12 @@ } }, "find-versions": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/find-versions/-/find-versions-3.2.0.tgz", - "integrity": "sha512-P8WRou2S+oe222TOCHitLy8zj+SIsVJh52VP4lvXkaFVnOFFdoWv1H1Jjvel1aI6NCFOAaeAVm8qrI0odiLcww==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/find-versions/-/find-versions-4.0.0.tgz", + "integrity": "sha512-wgpWy002tA+wgmO27buH/9KzyEOQnKsG/R0yrcjPT9BOFm0zRBVQbZ95nRGXWMywS8YR5knRbpohio0bcJABxQ==", "dev": true, "requires": { - "semver-regex": "^2.0.0" + "semver-regex": "^3.1.2" } }, "findup-sync": { @@ -2985,9 +2986,9 @@ } }, "globby": { - "version": "11.0.1", - "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.1.tgz", - "integrity": "sha512-iH9RmgwCmUJHi2z5o2l3eTtGBtXek1OYlHrbcxOYugyHLmAsZrPj43OtHThd62Buh/Vv6VyCBD2bdyWcGNQqoQ==", + "version": "11.0.2", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.2.tgz", + "integrity": "sha512-2ZThXDvvV8fYFRVIxnrMQBipZQDr7MxKAmQK1vujaj9/7eF0efG7BPUKJ7jP7G5SLF37xKDXvO4S/KKLj/Z0og==", "dev": true, "requires": { "array-union": "^2.1.0", @@ -3393,18 +3394,18 @@ "dev": true }, "husky": { - "version": "4.3.6", - "resolved": "https://registry.npmjs.org/husky/-/husky-4.3.6.tgz", - "integrity": "sha512-o6UjVI8xtlWRL5395iWq9LKDyp/9TE7XMOTvIpEVzW638UcGxTmV5cfel6fsk/jbZSTlvfGVJf2svFtybcIZag==", + "version": "4.3.8", + "resolved": "https://registry.npmjs.org/husky/-/husky-4.3.8.tgz", + "integrity": "sha512-LCqqsB0PzJQ/AlCgfrfzRe3e3+NvmefAdKQhRYpxS4u6clblBoDdzzvHi8fmxKRzvMxPY/1WZWzomPZww0Anow==", "dev": true, "requires": { "chalk": "^4.0.0", "ci-info": "^2.0.0", "compare-versions": "^3.6.0", "cosmiconfig": "^7.0.0", - "find-versions": "^3.2.0", + "find-versions": "^4.0.0", "opencollective-postinstall": "^2.0.2", - "pkg-dir": "^4.2.0", + "pkg-dir": "^5.0.0", "please-upgrade-node": "^3.2.0", "slash": "^3.0.0", "which-pm-runs": "^1.0.0" @@ -5170,40 +5171,49 @@ } }, "pkg-dir": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", - "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-5.0.0.tgz", + "integrity": "sha512-NPE8TDbzl/3YQYY7CSS228s3g2ollTFnc+Qi3tqmqJp9Vg2ovUpixcJEo2HJScN2Ez+kEaal6y70c0ehqJBJeA==", "dev": true, "requires": { - "find-up": "^4.0.0" + "find-up": "^5.0.0" }, "dependencies": { "find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", "dev": true, "requires": { - "locate-path": "^5.0.0", + "locate-path": "^6.0.0", "path-exists": "^4.0.0" } }, "locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", "dev": true, "requires": { - "p-locate": "^4.1.0" + "p-locate": "^5.0.0" + } + }, + "p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "requires": { + "yocto-queue": "^0.1.0" } }, "p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", "dev": true, "requires": { - "p-limit": "^2.2.0" + "p-limit": "^3.0.2" } }, "path-exists": { @@ -5663,9 +5673,9 @@ "dev": true }, "sass": { - "version": "1.32.0", - "resolved": "https://registry.npmjs.org/sass/-/sass-1.32.0.tgz", - "integrity": "sha512-fhyqEbMIycQA4blrz/C0pYhv2o4x2y6FYYAH0CshBw3DXh5D5wyERgxw0ptdau1orc/GhNrhF7DFN2etyOCEng==", + "version": "1.32.4", + "resolved": "https://registry.npmjs.org/sass/-/sass-1.32.4.tgz", + "integrity": "sha512-N0BT0PI/t3+gD8jKa83zJJUb7ssfQnRRfqN+GIErokW6U4guBpfYl8qYB+OFLEho+QvnV5ZH1R9qhUC/Z2Ch9w==", "dev": true, "requires": { "chokidar": ">=2.0.0 <4.0.0" @@ -5849,9 +5859,9 @@ } }, "semver-regex": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/semver-regex/-/semver-regex-2.0.0.tgz", - "integrity": "sha512-mUdIBBvdn0PLOeP3TEkMH7HHeUP3GjsXCwKarjv/kGmUFOYg1VqEemKhoQpWMu6X2I8kHeuVdGibLGkVK+/5Qw==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/semver-regex/-/semver-regex-3.1.2.tgz", + "integrity": "sha512-bXWyL6EAKOJa81XG1OZ/Yyuq+oT0b2YLlxx7c+mrdYPaPbnj6WgVULXhinMIeZGufuUBu/eVRqXEhiv4imfwxA==", "dev": true }, "set-blocking": { @@ -6406,9 +6416,9 @@ } }, "table": { - "version": "6.0.6", - "resolved": "https://registry.npmjs.org/table/-/table-6.0.6.tgz", - "integrity": "sha512-OInCtPmDNieVBkVFi6C8RwU2S2H0h8mF3e3TQK4nreaUNCpooQUkI+A/KuEkm5FawfhWIfNqG+qfelVVR+V00g==", + "version": "6.0.7", + "resolved": "https://registry.npmjs.org/table/-/table-6.0.7.tgz", + "integrity": "sha512-rxZevLGTUzWna/qBLObOe16kB2RTnnbhciwgPbMMlazz1yZGVEgnZK762xyVdVznhqxrfCeBMmMkgOOaPwjH7g==", "dev": true, "requires": { "ajv": "^7.0.2", @@ -6487,9 +6497,9 @@ } }, "tar-stream": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.1.4.tgz", - "integrity": "sha512-o3pS2zlG4gxr67GmFYBLlq+dM8gyRGUOvsrHclSkvtVtQbjV0s/+ZE8OpICbaj8clrX3tjeHngYGP7rweaBnuw==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz", + "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==", "dev": true, "requires": { "bl": "^4.0.3", @@ -6657,9 +6667,9 @@ "dev": true }, "tsutils": { - "version": "3.17.1", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.17.1.tgz", - "integrity": "sha512-kzeQ5B8H3w60nFY2g8cJIuH7JDpsALXySGtwGJ0p2LSjLgay3NdIpqq5SoOBe46bKDW2iq25irHCr8wjomUS2g==", + "version": "3.19.1", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.19.1.tgz", + "integrity": "sha512-GEdoBf5XI324lu7ycad7s6laADfnAqCw6wLGI+knxvw9vsIYBaJfYdmeCEG3FMMUiSm3OGgNb+m6utsWf5h9Vw==", "dev": true, "requires": { "tslib": "^1.8.1" @@ -7250,6 +7260,12 @@ "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", "dev": true }, + "yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true + }, "zip-stream": { "version": "4.0.4", "resolved": "https://registry.npmjs.org/zip-stream/-/zip-stream-4.0.4.tgz", diff --git a/package.json b/package.json index 06841a62..b6d11272 100644 --- a/package.json +++ b/package.json @@ -46,13 +46,13 @@ "devDependencies": { "@types/fs-extra": "^9.0.6", "@types/jasmine": "^3.6.2", - "@typescript-eslint/eslint-plugin": "^4.11.1", - "@typescript-eslint/parser": "^4.11.1", - "archiver": "^5.1.0", + "@typescript-eslint/eslint-plugin": "^4.14.0", + "@typescript-eslint/parser": "^4.14.0", + "archiver": "^5.2.0", "chalk": "^4.1.0", - "eslint": "^7.17.0", + "eslint": "^7.18.0", "eslint-config-prettier": "^7.1.0", - "eslint-plugin-prettier": "^3.3.0", + "eslint-plugin-prettier": "^3.3.1", "foundry-pc-types": "git+https://git.f3l.de/dungeonslayers/foundry-pc-types.git#f3l-fixes", "fs-extra": "^9.0.1", "gulp": "^4.0.2", @@ -60,13 +60,13 @@ "gulp-less": "^4.0.1", "gulp-sass": "^4.1.0", "gulp-typescript": "^6.0.0-alpha.1", - "husky": "^4.3.6", + "husky": "^4.3.8", "jasmine": "^3.6.3", "jasmine-xml-reporter": "^1.2.1", "json-stringify-pretty-compact": "^2.0.0", "lint-staged": "^10.5.3", "prettier": "^2.2.1", - "sass": "^1.32.0", + "sass": "^1.32.4", "ts-node": "^9.1.1", "typescript": "^4.1.3", "yargs": "^16.2.0" From ab6e02a7a6a8515232cc28522805c6e977c76d49 Mon Sep 17 00:00:00 2001 From: Johannes Loher <johannes.loher@fg4f.de> Date: Mon, 18 Jan 2021 19:34:03 +0100 Subject: [PATCH 41/41] fix typo --- src/lang/de.json | 2 +- src/lang/en.json | 2 +- src/module/config.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lang/de.json b/src/lang/de.json index c457a382..50c3ff9e 100644 --- a/src/lang/de.json +++ b/src/lang/de.json @@ -145,7 +145,7 @@ "DS4.CharacterProfileBirthplace": "Geburtsort", "DS4.CharacterProfileAge": "Alter", "DS4.CharacterProfileHeight": "Größe", - "DS4.ProfilEHairColor": "Haarfarbe", + "DS4.ProfileHairColor": "Haarfarbe", "DS4.CharacterProfileWeight": "Gewicht", "DS4.CharacterProfileEyeColor": "Augenfarbe", "DS4.CharacterProfileSpecialCharacteristics": "Besondere Eigenschaften", diff --git a/src/lang/en.json b/src/lang/en.json index c1f9b2fb..42e267aa 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -145,7 +145,7 @@ "DS4.CharacterProfileBirthplace": "Birthplace", "DS4.CharacterProfileAge": "Age", "DS4.CharacterProfileHeight": "Height", - "DS4.ProfilEHairColor": "Hair Color", + "DS4.ProfileHairColor": "Hair Color", "DS4.CharacterProfileWeight": "Weight", "DS4.CharacterProfileEyeColor": "Eye Color", "DS4.CharacterProfileSpecialCharacteristics": "Special Characteristics", diff --git a/src/module/config.ts b/src/module/config.ts index 83b1ca79..1d5740a6 100644 --- a/src/module/config.ts +++ b/src/module/config.ts @@ -204,7 +204,7 @@ export const DS4 = { birthplace: "DS4.CharacterProfileBirthplace", age: "DS4.CharacterProfileAge", height: "DS4.CharacterProfileHeight", - hairColor: "DS4.ProfilEHairColor", + hairColor: "DS4.ProfileHairColor", weight: "DS4.CharacterProfileWeight", eyeColor: "DS4.CharacterProfileEyeColor", specialCharacteristics: "DS4.CharacterProfileSpecialCharacteristics",