diff --git a/src/lang/en.json b/src/lang/en.json index 6f8526d1..b7c84f1d 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -1,5 +1,7 @@ { + "DS4.UserInteractionAddItem": "Add item", "DS4.Description": "Description", + "DS4.DescriptionAbbr": "Desc", "DS4.Details": "Details", "DS4.Effects": "Effects", "DS4.AttackType": "Attack Type", @@ -14,6 +16,7 @@ "DS4.Quantity": "Quantity", "DS4.PriceGold": "Price (Gold)", "DS4.StorageLocation": "Stored at", + "DS4.ItemEquipped": "Item equipped?", "DS4.ItemAvailability": "Availability", "DS4.ItemAvailabilityHamlet": "Hamlet", "DS4.ItemAvailabilityVilage": "Village", @@ -22,14 +25,18 @@ "DS4.ItemAvailabilityDwarves": "Dwarves", "DS4.ItemAvailabilityUnset": "Unset", "DS4.ItemAvailabilityNowhere": "Nowhere", + "DS4.ItemName": "Name", "DS4.ItemTypeWeapon": "Weapon", "DS4.ItemTypeArmor": "Armor", "DS4.ItemTypeShield": "Shield", "DS4.ItemTypeTrinket": "Trinket", "DS4.ItemTypeEquipment": "Equipment", "DS4.ArmorType": "Armor Type", + "DS4.ArmorTypeAbbr": "AT", "DS4.ArmorMaterialType": "Material Type", + "DS4.ArmorMaterialTypeAbbr": "Mat.", "DS4.ArmorValue": "Armor Value", + "DS4.ArmorValueAbbr": "AV", "DS4.ArmorTypeBody": "Body", "DS4.ArmorTypeHelmet": "Helmet", "DS4.ArmorTypeVambrace": "Vambrace", diff --git a/src/module/actor/actor-sheet.ts b/src/module/actor/actor-sheet.ts index a45371d7..5ca03bfe 100644 --- a/src/module/actor/actor-sheet.ts +++ b/src/module/actor/actor-sheet.ts @@ -7,11 +7,29 @@ import { DS4ActorDataType } from "./actor-data"; * @extends {ActorSheet} */ export class DS4ActorSheet extends ActorSheet { + /** + * 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 + * object itemsByType. + * @returns the data fed to the template of the actor sheet + */ + getData(): ActorSheetData { + const data = { + ...super.getData(), + // Add the localization config to the data: + config: CONFIG.DS4, + // Add the items explicitly sorted by type to the data: + itemsByType: this.actor.itemTypes, + }; + console.log("Data:", data); + return data; + } + /** @override */ static get defaultOptions(): FormApplicationOptions { return mergeObject(super.defaultOptions, { classes: ["ds4", "sheet", "actor"], - template: "systems/ds4/templates/actor/actor-sheet.html", + template: "systems/ds4/templates/actor/actor-sheet.hbs", width: 600, height: 600, tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "description" }], diff --git a/src/module/ds4.ts b/src/module/ds4.ts index baa0beb5..09899c42 100644 --- a/src/module/ds4.ts +++ b/src/module/ds4.ts @@ -36,6 +36,7 @@ async function registerHandlebarsPartials() { "systems/ds4/templates/item/partials/details.hbs", "systems/ds4/templates/item/partials/effects.hbs", "systems/ds4/templates/item/partials/body.hbs", + "systems/ds4/templates/actor/partials/items.hbs", ]; return loadTemplates(templatePaths); } diff --git a/src/module/item/item-sheet.ts b/src/module/item/item-sheet.ts index 1e69b3c9..b060341e 100644 --- a/src/module/item/item-sheet.ts +++ b/src/module/item/item-sheet.ts @@ -26,8 +26,8 @@ export class DS4ItemSheet extends ItemSheet { /** @override */ getData(): ItemSheetData { - console.log(this); const data = { ...super.getData(), config: CONFIG.DS4 }; + console.log(data); return data; } diff --git a/src/scss/components/_apps.scss b/src/scss/components/_apps.scss index 3f8ba623..f305ef33 100644 --- a/src/scss/components/_apps.scss +++ b/src/scss/components/_apps.scss @@ -7,9 +7,15 @@ overflow: hidden; } + .sheet-body { + overflow-y: auto; + } .tab { height: 100%; - overflow-y: auto; + overflow-y: visible; align-content: flex-start; + ol { + overflow-y: visible; + } } } diff --git a/src/scss/components/_items.scss b/src/scss/components/_items.scss index 7a2d860b..9c725e83 100644 --- a/src/scss/components/_items.scss +++ b/src/scss/components/_items.scss @@ -32,4 +32,32 @@ flex: 0 0 86px; text-align: right; } + + .item-num-val { + text-align: center; + } + + .item-description { + font-size: 75%; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + p { + text-overflow: ellipsis; + overflow: hidden; + } + p:first-child { + margin-top: 0px; + padding-top: 0px; + } + + } } + +.items-list-title { + margin-top: 2em; + margin-bottom: 0px; + padding-left: 1em; + border-bottom: 2px groove $c-border-groove; + font-weight: bold; +} \ No newline at end of file diff --git a/src/scss/global/_flex.scss b/src/scss/global/_flex.scss index af5108e5..4027bbc7 100644 --- a/src/scss/global/_flex.scss +++ b/src/scss/global/_flex.scss @@ -12,9 +12,15 @@ flex: 1; } + .flex05 { + flex: 0.5; + } .flex1 { flex: 1; } + .flex15 { + flex: 1.5; + } .flex2 { flex: 2; } @@ -35,9 +41,15 @@ flex: 1; } + .flex05 { + flex: 0.5; + } .flex1 { flex: 1; } + .flex15 { + flex: 1.5; + } .flex2 { flex: 2; } diff --git a/src/templates/actor/actor-sheet.html b/src/templates/actor/actor-sheet.hbs similarity index 73% rename from src/templates/actor/actor-sheet.html rename to src/templates/actor/actor-sheet.hbs index 55dbbf83..4aa0540d 100644 --- a/src/templates/actor/actor-sheet.html +++ b/src/templates/actor/actor-sheet.hbs @@ -60,31 +60,7 @@ {{editor content=data.biography target="data.biography" button=true owner=owner editable=editable}} - {{!-- Owned Items Tab --}} -
-
    -
  1. -
    -
    Name
    - -
  2. - {{#each actor.items as |item id|}} -
  3. -
    - -
    -

    {{item.name}}

    -
    - - -
    -
  4. - {{/each}} -
-
+ {{!-- Items Tab --}} + {{> systems/ds4/templates/actor/partials/items.hbs}} diff --git a/src/templates/actor/partials/items.hbs b/src/templates/actor/partials/items.hbs new file mode 100644 index 00000000..2e773eba --- /dev/null +++ b/src/templates/actor/partials/items.hbs @@ -0,0 +1,262 @@ +{{!-- TODO: Where possible use icons with complete names as hovers instead of long names --}} +{{!-- Tab with overview and quick-actions on owned items --}} +
+ + {{!-- WEAPONS --}} +

{{localize "DS4.ItemTypeWeapon"}}

{{!-- SPECIFIC --}} +
    +
  1. +
    +
    E
    {{!-- equipped --}} {{!-- SPECIFIC --}} +
    +
    #
    {{!-- amount --}} +
    +
    {{localize "DS4.ItemName"}}
    +
    {{localize "DS4.AttackTypeAbbr"}}
    {{!-- SPECIFIC --}} +
    +
    {{localize "DS4.WeaponBonusAbbr"}}
    {{!-- SPECIFIC --}} +
    {{localize "DS4.OpponentDefenseAbbr"}}
    {{!-- SPECIFIC --}} +
    +
    {{localize "DS4.Description"}}
    + {{!-- add button --}} + +
  2. + {{#each itemsByType.weapon as |item id|}} {{!-- SPECIFIC --}} + {{#with item.data.data as |itemData|}} +
  3. +
    + {{!-- equipped? --}} + {{#if itemData.equipped}} + {{else}} + {{/if}} {{!--SPECIFIC --}} + {{!-- image --}} +
    + +
    + {{!-- amount --}} +
    {{itemData.quantity}}
    +
    + {{!-- name --}} +

    {{item.name}}

    + {{!-- item specifics --}} +
    {{lookup ../../config.attackTypes itemData.attackType}}
    {{!-- SPECIFIC --}} +
    +
    {{itemData.weaponBonus}}
    {{!-- SPECIFIC --}} +
    {{itemData.opponentDefense}}
    {{!-- SPECIFIC --}} +
    + {{!-- description --}} +
    {{{itemData.description}}}
    + {{!-- edit & delete buttons --}} +
    + + +
    +
  4. + {{/with}} + {{/each}} +
+ + {{!-- ARMOR --}} +

{{localize "DS4.ItemTypeArmor"}}

{{!-- SPECIFIC --}} +
    +
  1. +
    +
    E
    {{!-- equipped --}} {{!-- SPECIFIC --}} +
    +
    #
    {{!-- amount --}} +
    +
    {{localize "DS4.ItemName"}}
    +
    {{localize "DS4.ArmorMaterialTypeAbbr"}}
    {{!-- SPECIFIC --}} +
    {{localize "DS4.ArmorTypeAbbr"}}
    {{!-- SPECIFIC --}} +
    {{localize "DS4.ArmorValueAbbr"}}
    {{!-- SPECIFIC --}} +
    {{localize "DS4.Description"}}
    + {{!-- add button --}} + +
  2. + {{#each itemsByType.armor as |item id|}} {{!-- SPECIFIC --}} + {{#with item.data.data as |itemData|}} +
  3. +
    + {{!-- equipped? --}} + {{#if itemData.equipped}} + {{else}} + {{/if}} {{!--SPECIFIC --}} + {{!-- image --}} +
    + +
    + {{!-- amount --}} +
    {{itemData.quantity}}
    +
    + {{!-- name --}} +

    {{item.name}}

    + {{!-- item specifics --}} +
    {{lookup ../../config.armorMaterialTypes itemData.armorMaterialType}}
    {{!-- SPECIFIC --}} +
    {{lookup ../../config.armorTypes itemData.armorType}}
    {{!-- SPECIFIC --}} +
    {{itemData.armorValue}}
    {{!-- SPECIFIC --}} + {{!-- description --}} +
    {{{itemData.description}}}
    + {{!-- edit & delete buttons --}} +
    + + +
    +
  4. + {{/with}} + {{/each}} +
+ + + {{!-- SHIELD --}} +

{{localize "DS4.ItemTypeShield"}}

{{!-- SPECIFIC --}} +
    +
  1. +
    +
    E
    {{!-- equipped --}} {{!-- SPECIFIC --}} +
    +
    #
    {{!-- amount --}} +
    +
    {{localize "DS4.ItemName"}}
    +
    {{localize "DS4.ArmorValueAbbr"}}
    {{!-- SPECIFIC --}} +
    {{localize "DS4.Description"}}
    + {{!-- add button --}} + +
  2. + {{#each itemsByType.shield as |item id|}} {{!-- SPECIFIC --}} + {{#with item.data.data as |itemData|}} +
  3. +
    + {{!-- equipped? --}} + {{#if itemData.equipped}} + {{else}} + {{/if}} {{!--SPECIFIC --}} + {{!-- image --}} +
    + +
    + {{!-- amount --}} +
    {{itemData.quantity}}
    +
    + {{!-- name --}} +

    {{item.name}}

    + {{!-- item specifics --}} +
    {{itemData.armorValue}}
    {{!-- SPECIFIC --}} + {{!-- description --}} +
    {{{itemData.description}}}
    + {{!-- edit & delete buttons --}} +
    + + +
    +
  4. + {{/with}} + {{/each}} +
+ + {{!-- TRINKET --}} +

{{localize "DS4.ItemTypeTrinket"}}

{{!-- SPECIFIC --}} +
    +
  1. +
    +
    E
    {{!-- equipped --}} {{!-- SPECIFIC --}} +
    +
    #
    {{!-- amount --}} +
    +
    {{localize "DS4.ItemName"}}
    +
    {{localize "DS4.StorageLocation"}}
    {{!-- SPECIFIC --}} +
    {{localize "DS4.Description"}}
    + {{!-- add button --}} + +
  2. + {{#each itemsByType.trinket as |item id|}} {{!-- SPECIFIC --}} + {{#with item.data.data as |itemData|}} +
  3. +
    + {{!-- equipped? --}} + {{#if itemData.equipped}} + {{else}} + {{/if}} {{!--SPECIFIC --}} + {{!-- image --}} +
    + +
    + {{!-- amount --}} +
    {{itemData.quantity}}
    +
    + {{!-- name --}} +

    {{item.name}}

    + {{!-- storage location --}} +
    {{{itemData.storageLocation}}}
    {{!-- SPECIFIC --}} + {{!-- description --}} +
    {{{itemData.description}}}
    + {{!-- edit & delete buttons --}} +
    + + +
    +
  4. + {{/with}} + {{/each}} +
+ + {{!-- EQUIPMENT --}} +

{{localize "DS4.ItemTypeEquipment"}}

{{!-- SPECIFIC --}} +
    +
  1. +
    +
    +
    #
    {{!-- amount --}} +
    +
    {{localize "DS4.ItemName"}}
    +
    {{localize "DS4.StorageLocation"}}
    {{!-- SPECIFIC --}} +
    {{localize "DS4.Description"}}
    + {{!-- add button --}} + +
  2. + {{#each itemsByType.equipment as |item id|}} {{!-- SPECIFIC --}} + {{#with item.data.data as |itemData|}} +
  3. +
    + {{!-- image --}} +
    + +
    + {{!-- amount --}} +
    {{itemData.quantity}}
    +
    + {{!-- name --}} +

    {{item.name}}

    + {{!-- storage location --}} +
    {{{itemData.storageLocation}}}
    {{!-- SPECIFIC --}} + {{!-- description --}} +
    {{{itemData.description}}}
    + {{!-- edit & delete buttons --}} +
    + + +
    +
  4. + {{/with}} + {{/each}} +
+
\ No newline at end of file diff --git a/src/templates/item/weapon-sheet.hbs b/src/templates/item/weapon-sheet.hbs index 37c0aa2c..7a7efcfd 100644 --- a/src/templates/item/weapon-sheet.hbs +++ b/src/templates/item/weapon-sheet.hbs @@ -17,12 +17,12 @@
-
-