This commit is contained in:
WBHarry 2026-03-09 14:18:27 +01:00
parent 708056713b
commit 0e3f2fe632
11 changed files with 51 additions and 99 deletions

View file

@ -53,14 +53,14 @@ export default class DHArmor extends AttachableItem {
}
/**@inheritdoc */
async getDescriptionData() {
async getDescriptionData({ inCompendium }) {
const baseDescription = this.description;
const allFeatures = CONFIG.DH.ITEM.allArmorFeatures();
const features = this.armorFeatures.map(x => allFeatures[x.value]).filter(x => x);
const prefix = await foundry.applications.handlebars.renderTemplate(
'systems/daggerheart/templates/sheets/items/armor/description.hbs',
{ item: this.parent, features }
{ item: this.parent, inCompendium, features }
);
return { prefix, value: baseDescription, suffix: null };

View file

@ -138,10 +138,10 @@ export default class BaseDataItem extends foundry.abstract.TypeDataModel {
* @param {object} [options] - Options that modify the styling of the rendered template. { headerStyle: undefined|'none'|'large' }
* @returns {string}
*/
async getEnrichedDescription() {
async getEnrichedDescription(options = { inCompendium: false }) {
if (!this.metadata.hasDescription) return '';
const { prefix, value, suffix } = await this.getDescriptionData();
const { prefix, value, suffix } = await this.getDescriptionData(options);
const fullDescription = [prefix, value, suffix].filter(p => !!p).join('\n<hr>\n');
return await foundry.applications.ux.TextEditor.implementation.enrichHTML(fullDescription, {

View file

@ -109,27 +109,18 @@ export default class DHWeapon extends AttachableItem {
}
/**@inheritdoc */
async getDescriptionData() {
async getDescriptionData({ inCompendium }) {
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,
inCompendium,
features
}
);