From 36976e5123e06b4130d219cb78e66aa760405410 Mon Sep 17 00:00:00 2001 From: Oliver-Akins Date: Mon, 25 Mar 2024 21:33:14 -0600 Subject: [PATCH] Add the pet details (closes #135) --- module/handlebars.mjs | 1 + module/models/Item/Pet.mjs | 8 +- module/sheets/Actors/PC/PlayerSheetV2.mjs | 2 +- .../actor/char-sheet/v2/pages/inventory.scss | 2 +- .../v2/partials/inventory/items/pet.v2.pc.hbs | 97 +++++++++++++++++++ 5 files changed, 107 insertions(+), 3 deletions(-) create mode 100644 templates/actors/char-sheet/v2/partials/inventory/items/pet.v2.pc.hbs diff --git a/module/handlebars.mjs b/module/handlebars.mjs index 596f9dd..a5a2ab3 100644 --- a/module/handlebars.mjs +++ b/module/handlebars.mjs @@ -30,6 +30,7 @@ export const partials = [ `actors/char-sheet/v2/partials/inventory/items/untyped.v2.pc.hbs`, `actors/char-sheet/v2/partials/inventory/items/aspect.v2.pc.hbs`, `actors/char-sheet/v2/partials/inventory/items/weapon.v2.pc.hbs`, + `actors/char-sheet/v2/partials/inventory/items/pet.v2.pc.hbs`, ]; export const preAliasedPartials = { diff --git a/module/models/Item/Pet.mjs b/module/models/Item/Pet.mjs index 7d46e94..886e761 100644 --- a/module/models/Item/Pet.mjs +++ b/module/models/Item/Pet.mjs @@ -3,7 +3,13 @@ import { DescribedItemData } from "./DescribedItemData.mjs"; export class PetItemData extends DescribedItemData { static defineSchema() { const fields = foundry.data.fields; - return mergeObject(super.defineSchema(), { + const parentSchema = super.defineSchema(); + + delete parentSchema.quantity; + delete parentSchema.quantity_affects_used_capacity; + delete parentSchema.usage_cost; + + return mergeObject(parentSchema, { upkeep: new fields.NumberField({ initial: null, nullable: true }), pokeballd: new fields.BooleanField({ initial: true }), }); diff --git a/module/sheets/Actors/PC/PlayerSheetV2.mjs b/module/sheets/Actors/PC/PlayerSheetV2.mjs index 63fe44a..32d0ed9 100644 --- a/module/sheets/Actors/PC/PlayerSheetV2.mjs +++ b/module/sheets/Actors/PC/PlayerSheetV2.mjs @@ -117,7 +117,7 @@ export class PlayerSheetv2 extends GenericActorSheet { return stats; }; - _itemTypesHidden = new Set([`pet`, `armour`, `equipment`, `structure`, `service`]); + _itemTypesHidden = new Set([`armour`, `equipment`, `structure`, `service`]); toggleItemFilter(filterName) { if (this._itemTypesHidden.has(filterName)) { this._itemTypesHidden.delete(filterName); diff --git a/styles/sheets/actor/char-sheet/v2/pages/inventory.scss b/styles/sheets/actor/char-sheet/v2/pages/inventory.scss index 8581328..c301f04 100644 --- a/styles/sheets/actor/char-sheet/v2/pages/inventory.scss +++ b/styles/sheets/actor/char-sheet/v2/pages/inventory.scss @@ -218,7 +218,7 @@ } } - .untyped, .aspect, .weapon { + .untyped, .aspect, .weapon, .pet { @include material.elevate(1); padding: 8px; border-radius: 4px; diff --git a/templates/actors/char-sheet/v2/partials/inventory/items/pet.v2.pc.hbs b/templates/actors/char-sheet/v2/partials/inventory/items/pet.v2.pc.hbs new file mode 100644 index 0000000..9c83d45 --- /dev/null +++ b/templates/actors/char-sheet/v2/partials/inventory/items/pet.v2.pc.hbs @@ -0,0 +1,97 @@ +
+
+ +

+ {{item.name}} +

+
+
+
+
+
+ + +
+
+ Upkeep: + + {{dd-empty-state item.system.upkeep}} + +
+
+ Tier: + {{dd-i18n (concat "dotdungeon.rarity." item.system.tier)}} +
+ +

+ {{#if item.system.description}} + {{item.system.description}} + {{else}} + + This pet hasn't been described yet... + + {{/if}} +

+ + +
+
+