Improved the EffectDisplay tooltip of the beastform effect to show the info about the active beastform

This commit is contained in:
WBHarry 2026-03-25 20:29:52 +01:00
parent a4fff56461
commit 42b344dc8c
12 changed files with 222 additions and 163 deletions

View file

@ -31,12 +31,34 @@ export default class DhTooltipManager extends foundry.helpers.interaction.Toolti
this.#bordered = true;
let effect = {};
if (element.dataset.uuid) {
const effectData = (await foundry.utils.fromUuid(element.dataset.uuid)).toObject();
const effectItem = await foundry.utils.fromUuid(element.dataset.uuid);
const effectData = effectItem.toObject();
effect = {
...effectData,
name: game.i18n.localize(effectData.name),
description: game.i18n.localize(effectData.description ?? effectData.parent.system.description)
name: game.i18n.localize(effectData.name)
};
if (effectData.type === 'beastform') {
const beastformData = {
features: effectItem.parent.items.filter(x => effectItem.system.featureIds.includes(x.id)),
advantageOn: effectData.system.advantageOn,
beastformAttackData: game.system.api.data.items.DHBeastform.getBeastformAttackData(effectItem)
};
for (const feature of beastformData.features) {
feature.enrichedDescription = await feature.system.getEnrichedDescription();
}
effect.description = await foundry.applications.handlebars.renderTemplate(
'systems/daggerheart/templates/ui/tooltip/parts/beastformData.hbs',
{
item: { system: beastformData }
}
);
} else {
effect.description = game.i18n.localize(
effectData.description ?? effectData.parent.system.description
);
}
} else {
const conditions = CONFIG.DH.GENERAL.conditions();
const condition = conditions[element.dataset.condition];