Better separation of concerns

This commit is contained in:
WBHarry 2026-01-12 09:53:32 +01:00
parent 4a027e8591
commit 93640e56be
9 changed files with 31 additions and 45 deletions

View file

@ -111,19 +111,18 @@ export default class DHWeapon extends AttachableItem {
}
/**@inheritdoc */
async getDescriptionData(options = {}) {
const baseDescription = await super.getDescriptionData();
async getDescriptionData() {
const baseDescription = this.description;
const allFeatures = CONFIG.DH.ITEM.allWeaponFeatures();
const features = this.weaponFeatures.map(x => allFeatures[x.value]);
if (!features.length) return baseDescription;
if (!features.length) return { prefix: null, value: baseDescription, suffix: null };
const prepend = await foundry.applications.handlebars.renderTemplate(
const prefix = await foundry.applications.handlebars.renderTemplate(
'systems/daggerheart/templates/sheets/items/weapon/description.hbs',
{ features, headerStyle: options.headerStyle }
{ features }
);
const mainDescription = baseDescription ? `\n<hr>\n${baseDescription}` : '';
return `${prepend}${mainDescription}`;
return { prefix, value: baseDescription, suffix: null };
}
prepareDerivedData() {