[Fix] 1699 - Trait Generalization For Descriptions (#1717)

* Fixed so that domaincard tooltips properly use the all domains including homebrew

* .

* Adjust spacing of compendium browser tags (#1720)

* Remove some vestigial inCompendiums

---------

Co-authored-by: Carlos Fernandez <CarlosFdez@users.noreply.github.com>
Co-authored-by: Carlos Fernandez <cfern1990@gmail.com>
This commit is contained in:
WBHarry 2026-03-10 00:10:21 +01:00 committed by GitHub
parent 83f6c940df
commit f920fa7ba2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 61 additions and 97 deletions

View file

@ -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));

View file

@ -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
}
);

View file

@ -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',

View file

@ -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 */

View file

@ -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 {

View file

@ -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 {

View file

@ -45,30 +45,20 @@ Parameters:
<span class="item-name">{{localize item.name}} {{#unless (or noExtensible (not item.system.description))}}<span class="expanded-icon"><i class="fa-solid fa-expand"></i></span>{{/unless}}</span>
{{!-- Tags Start --}}
{{#with item}}
{{#if (not ../hideTags)}}
<div class="item-tags">
{{#each this._getTags as |tag|}}
<div class="tag">
{{tag}}
</div>
{{/each}}
{{!-- Feature Form Tag Start --}}
{{#if (eq ../type 'feature')}}
{{#if (or (eq @root.document.type 'adversary') (eq @root.document.type 'environment'))}}
{{#if system.featureForm}}
<div class="tag feature-form">
<span class="recall-value">{{localize (concat "DAGGERHEART.CONFIG.FeatureForm." system.featureForm)}}</span>
</div>
{{#if (not ../hideTags)}}
{{#> "systems/daggerheart/templates/sheets/global/partials/item-tags.hbs" item }}
{{#if (eq ../type 'feature')}}
{{#if (or (eq @root.document.type 'adversary') (eq @root.document.type 'environment'))}}
{{#if system.featureForm}}
<div class="tag feature-form">
<span class="recall-value">{{localize (concat "DAGGERHEART.CONFIG.FeatureForm." system.featureForm)}}</span>
</div>
{{/if}}
{{/if}}
{{/if}}
{{/ "systems/daggerheart/templates/sheets/global/partials/item-tags.hbs"}}
{{/if}}
{{!-- Feature Form Tag End --}}
</div>
{{/if}}
{{/with}}
{{!--Tags End --}}
</div>

View file

@ -0,0 +1,8 @@
<div class="item-tags">
{{#each _getTags as |tag|}}
<div class="tag">
{{tag}}
</div>
{{/each}}
{{#if @partial-block}}{{> @partial-block}}{{/if}}
</div>

View file

@ -1,19 +1,6 @@
<div class="item-description-outer-container">
<div class="two-columns">
<div class="item-description-container">
<h4>{{localize "DAGGERHEART.ITEMS.Armor.baseThresholds.base"}}</h4>
<span>{{item.system.baseThresholds.major}}/{{item.system.baseThresholds.severe}}</span>
</div>
<div class="item-description-container">
<h4>{{localize "DAGGERHEART.ITEMS.Armor.baseScore"}}</h4>
<span>{{item.system.baseScore}}</span>
</div>
</div>
{{#if features.length}}
<div class="item-description-container">
<h4>{{localize "DAGGERHEART.GENERAL.features"}}</h4>
{{#each features as | feature |}}
<div><strong>{{localize feature.label}}</strong>: {{{localize feature.description}}}</div>
{{/each}}

View file

@ -1,36 +1,6 @@
<div class="item-description-outer-container">
<div class="three-columns">
<div class="item-description-container">
<h4>{{localize "DAGGERHEART.GENERAL.Tiers.singular"}}</h4>
<span>{{tier}}</span>
</div>
<div class="item-description-container">
<h4>{{localize "DAGGERHEART.GENERAL.Trait.single"}}</h4>
<span>{{trait}}</span>
</div>
<div class="item-description-container">
<h4>{{localize "DAGGERHEART.GENERAL.range"}}</h4>
<span>{{range}}</span>
</div>
</div>
<div class="three-columns">
<div class="item-description-container">
<h4>{{localize "DAGGERHEART.GENERAL.damage"}}</h4>
<span>{{damage}}</span>
</div>
<div class="item-description-container">
<h4>{{localize "DAGGERHEART.GENERAL.burden"}}</h4>
<span>{{burden}}</span>
</div>
</div>
{{#if features.length}}
<div class="item-description-container">
<h4>{{localize "DAGGERHEART.GENERAL.features"}}</h4>
{{#each features as | feature |}}
<div><strong>{{localize feature.label}}</strong>: {{{localize feature.description}}}</div>
{{/each}}

View file

@ -10,7 +10,10 @@
</div>
</div>
<div class="item-desc extensible">
<span class="wrapper">{{{system.enrichedDescription}}}</span>
<span class="wrapper">
{{{system.enrichedTags}}}
{{{system.enrichedDescription}}}
</span>
</div>
</div>
{{/each}}