diff --git a/module/applications/ui/itemBrowser.mjs b/module/applications/ui/itemBrowser.mjs index 2d882eba..f6235101 100644 --- a/module/applications/ui/itemBrowser.mjs +++ b/module/applications/ui/itemBrowser.mjs @@ -251,6 +251,12 @@ export class ItemBrowser extends HandlebarsApplicationMixin(ApplicationV2) { /* If any noticeable slowdown occurs, consider replacing with enriching description on clicking to expand descriptions */ for (const item of this.items) { + if (["weapon", "armor"].includes(item.type)) { + item.system.enrichedTags = await foundry.applications.handlebars.renderTemplate( + 'systems/daggerheart/templates/sheets/global/partials/item-tags.hbs', + item.system, + ); + } item.system.enrichedDescription = (await item.system.getEnrichedDescription?.()) ?? (await foundry.applications.ux.TextEditor.implementation.enrichHTML(item.description)); diff --git a/module/data/item/weapon.mjs b/module/data/item/weapon.mjs index 051fd42d..bb7fde0a 100644 --- a/module/data/item/weapon.mjs +++ b/module/data/item/weapon.mjs @@ -112,24 +112,14 @@ export default class DHWeapon extends AttachableItem { async getDescriptionData() { const baseDescription = this.description; - const tier = game.i18n.localize(`DAGGERHEART.GENERAL.Tiers.${this.tier}`); - const trait = game.i18n.localize(CONFIG.DH.ACTOR.abilities[this.attack.roll.trait].label); - const range = game.i18n.localize(`DAGGERHEART.CONFIG.Range.${this.attack.range}.name`); - const damage = Roll.replaceFormulaData(this.attack.damageFormula, this.parent.parent ?? this.parent); - const burden = game.i18n.localize(CONFIG.DH.GENERAL.burden[this.burden].label); - const allFeatures = CONFIG.DH.ITEM.allWeaponFeatures(); const features = this.weaponFeatures.map(x => allFeatures[x.value]).filter(x => x); const prefix = await foundry.applications.handlebars.renderTemplate( 'systems/daggerheart/templates/sheets/items/weapon/description.hbs', { - features, - tier, - trait, - range, - damage, - burden + item: this, + features } ); diff --git a/module/systemRegistration/handlebars.mjs b/module/systemRegistration/handlebars.mjs index de085221..9ccb16f4 100644 --- a/module/systemRegistration/handlebars.mjs +++ b/module/systemRegistration/handlebars.mjs @@ -17,9 +17,10 @@ export const preloadHandlebarsTemplates = async function () { 'systems/daggerheart/templates/sheets/global/partials/resource-section/dice-value.hbs', 'systems/daggerheart/templates/sheets/global/partials/resource-section/die.hbs', 'systems/daggerheart/templates/sheets/global/partials/resource-bar.hbs', + 'systems/daggerheart/templates/sheets/global/partials/feature-section-item.hbs', + 'systems/daggerheart/templates/sheets/global/partials/item-tags.hbs', 'systems/daggerheart/templates/components/card-preview.hbs', 'systems/daggerheart/templates/levelup/parts/selectable-card-preview.hbs', - 'systems/daggerheart/templates/sheets/global/partials/feature-section-item.hbs', 'systems/daggerheart/templates/ui/combatTracker/combatTrackerSection.hbs', 'systems/daggerheart/templates/actionTypes/damage.hbs', 'systems/daggerheart/templates/actionTypes/resource.hbs', diff --git a/styles/less/global/global.less b/styles/less/global/global.less index fb995b8c..b9af67c0 100644 --- a/styles/less/global/global.less +++ b/styles/less/global/global.less @@ -73,6 +73,24 @@ } } } + + .item-tags { + display: flex; + gap: 10px; + + .tag { + align-items: center; + background: light-dark(@dark-15, @beige-15); + border-radius: 3px; + border: 1px solid light-dark(@dark, @beige); + display: flex; + flex-direction: row; + flex-wrap: wrap; + font-size: var(--font-size-12); + justify-content: start; + padding: 3px 5px; + } + } } /* TODO: Remove me when this issue is resolved https://github.com/foundryvtt/foundryvtt/issues/13734 */ diff --git a/styles/less/global/inventory-item.less b/styles/less/global/inventory-item.less index d703d189..4bd4d0bb 100644 --- a/styles/less/global/inventory-item.less +++ b/styles/less/global/inventory-item.less @@ -138,24 +138,6 @@ display: none; } } - - .item-tags { - display: flex; - gap: 10px; - - .tag { - align-items: center; - background: light-dark(@dark-15, @beige-15); - border-radius: 3px; - border: 1px solid light-dark(@dark, @beige); - display: flex; - flex-direction: row; - flex-wrap: wrap; - font-size: var(--font-size-12); - justify-content: start; - padding: 3px 5px; - } - } } .item-resource { diff --git a/styles/less/ui/item-browser/item-browser.less b/styles/less/ui/item-browser/item-browser.less index b395f8c8..f558a0ba 100644 --- a/styles/less/ui/item-browser/item-browser.less +++ b/styles/less/ui/item-browser/item-browser.less @@ -304,7 +304,15 @@ padding: 0 0 0 50px; display: flex; flex-direction: column; - gap: 5px; + + .item-description-outer-container:has(div, p) { + margin-top: 8px; + } + + /* Some items don't include an outer container, so we attempt a catch-all */ + > *:last-child { + padding-bottom: 6px; + } h1 { font-size: var(--font-size-32); @@ -350,6 +358,7 @@ .filter-content, .item-desc { display: grid; + opacity: 0; grid-template-rows: 0fr; transition: all 0.3s ease-in-out; width: 100%; @@ -378,8 +387,8 @@ } .expanded + .extensible { + opacity: 1; grid-template-rows: 1fr; - padding-top: 10px; } .welcome-message { diff --git a/templates/sheets/global/partials/inventory-item-V2.hbs b/templates/sheets/global/partials/inventory-item-V2.hbs index e496ce4b..86d2e2d3 100644 --- a/templates/sheets/global/partials/inventory-item-V2.hbs +++ b/templates/sheets/global/partials/inventory-item-V2.hbs @@ -45,30 +45,20 @@ Parameters: {{localize item.name}} {{#unless (or noExtensible (not item.system.description))}}{{/unless}} {{!-- Tags Start --}} - {{#with item}} - {{#if (not ../hideTags)}} -
- {{/if}} - {{/with}} {{!--Tags End --}} diff --git a/templates/sheets/global/partials/item-tags.hbs b/templates/sheets/global/partials/item-tags.hbs new file mode 100644 index 00000000..b30fcbf2 --- /dev/null +++ b/templates/sheets/global/partials/item-tags.hbs @@ -0,0 +1,8 @@ + \ No newline at end of file diff --git a/templates/sheets/items/armor/description.hbs b/templates/sheets/items/armor/description.hbs index c234fa10..af2698ef 100644 --- a/templates/sheets/items/armor/description.hbs +++ b/templates/sheets/items/armor/description.hbs @@ -1,19 +1,6 @@