From 29d34daa9a9c8a6015c99cc2330e5e38f556d9b0 Mon Sep 17 00:00:00 2001 From: Gesina Schwalbe Date: Wed, 30 Dec 2020 23:50:27 +0100 Subject: [PATCH 1/3] added equipped and owner to item sheet Additions: - added equipped checkbox to item sheet - added item owner to item properties list - added some translations - added some TODOs Changes: - item properties owner, equipped, quantity, storageLocation are only shown if item is owned by an actor - moved item properties price and availability to details tab - shortened ItemEquipped translation - added item.actor and item.isOwned property values to data returned from DS4ItemSheet.getData (properties aren't accessible in Handlebars) --- src/lang/en.json | 3 +- src/module/item/item-sheet.ts | 2 +- src/templates/actor/partials/items.hbs | 4 ++- src/templates/item/partials/description.hbs | 36 +++++++++++---------- src/templates/item/partials/details.hbs | 17 +++++++++- 5 files changed, 41 insertions(+), 21 deletions(-) diff --git a/src/lang/en.json b/src/lang/en.json index 601ffc37..5abf614c 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -16,7 +16,8 @@ "DS4.Quantity": "Quantity", "DS4.PriceGold": "Price (Gold)", "DS4.StorageLocation": "Stored at", - "DS4.ItemEquipped": "Item equipped?", + "DS4.ItemEquipped": "Equipped?", + "DS4.ItemOwner": "Owner", "DS4.ItemAvailability": "Availability", "DS4.ItemAvailabilityHamlet": "Hamlet", "DS4.ItemAvailabilityVilage": "Village", diff --git a/src/module/item/item-sheet.ts b/src/module/item/item-sheet.ts index b060341e..ac8197aa 100644 --- a/src/module/item/item-sheet.ts +++ b/src/module/item/item-sheet.ts @@ -26,7 +26,7 @@ export class DS4ItemSheet extends ItemSheet { /** @override */ getData(): ItemSheetData { - const data = { ...super.getData(), config: CONFIG.DS4 }; + const data = { ...super.getData(), config: CONFIG.DS4, isOwned: this.item.isOwned, actor: this.item.actor }; console.log(data); return data; } diff --git a/src/templates/actor/partials/items.hbs b/src/templates/actor/partials/items.hbs index 1c72cd46..28f8be43 100644 --- a/src/templates/actor/partials/items.hbs +++ b/src/templates/actor/partials/items.hbs @@ -1,4 +1,6 @@ -{{!-- TODO: Where possible use icons with complete names as hovers instead of long names --}} +{{!-- TODO: For items list: only show header, if list is not empty --}} +{{!-- TODO: Reduce code duplications --}} +{{!-- TODO: Change from flex layout to grid layout --}} {{!-- Tab with overview and quick-actions on owned items --}}
diff --git a/src/templates/item/partials/description.hbs b/src/templates/item/partials/description.hbs index 56c8fdd2..64197ea4 100644 --- a/src/templates/item/partials/description.hbs +++ b/src/templates/item/partials/description.hbs @@ -1,27 +1,29 @@
+ {{#if isOwned}}
- + + {{actor.name}} +
+ {{#if (ne data.equipped undefined)}}
+ + +
+ {{/if}} +
+
- +
-
- - -
-
- - -
+ {{else}} +

Item isn't owned.

+ {{/if}} +
+
+ {{editor content=data.description target="data.description" button=true owner=owner editable=editable}}
- {{editor content=data.description target="data.description" button=true owner=owner editable=editable}}
\ No newline at end of file diff --git a/src/templates/item/partials/details.hbs b/src/templates/item/partials/details.hbs index 2d5b3f0c..0e57a780 100644 --- a/src/templates/item/partials/details.hbs +++ b/src/templates/item/partials/details.hbs @@ -1,5 +1,20 @@ {{!-- The item tab for details. --}}
{{!-- As you add new fields, add them in here! --}} -

Nothing to see yet.

+
+
+ + +
+
+ + +
+
\ No newline at end of file From 445febf4783b237fa5f4bf43f173bc2bd7ee98d1 Mon Sep 17 00:00:00 2001 From: Gesina Schwalbe Date: Thu, 31 Dec 2020 01:18:50 +0100 Subject: [PATCH 2/3] localized "not owned" hint --- src/lang/en.json | 1 + src/templates/item/partials/description.hbs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lang/en.json b/src/lang/en.json index 5abf614c..e0e916f5 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -1,5 +1,6 @@ { "DS4.UserInteractionAddItem": "Add item", + "DS4.NotOwned": "No owner", "DS4.Description": "Description", "DS4.DescriptionAbbr": "Desc", "DS4.Details": "Details", diff --git a/src/templates/item/partials/description.hbs b/src/templates/item/partials/description.hbs index 64197ea4..fdfe6754 100644 --- a/src/templates/item/partials/description.hbs +++ b/src/templates/item/partials/description.hbs @@ -20,7 +20,7 @@
{{else}} -

Item isn't owned.

+ {{localize "DS4.NotOwned"}} {{/if}}
From 80e6fd26ae2c44dd0b3cd0ab3c1d78099a674b34 Mon Sep 17 00:00:00 2001 From: Gesina Schwalbe Date: Thu, 31 Dec 2020 16:35:41 +0100 Subject: [PATCH 3/3] Apply 1 suggestion(s) to 1 file(s) --- 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 28764b4d..de17c09b 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -17,7 +17,7 @@ "DS4.Quantity": "Quantity", "DS4.PriceGold": "Price (Gold)", "DS4.StorageLocation": "Stored at", - "DS4.ItemEquipped": "Equipped?", + "DS4.ItemEquipped": "Equipped", "DS4.ItemOwner": "Owner", "DS4.ItemAvailability": "Availability", "DS4.ItemAvailabilityHamlet": "Hamlet",