Skip to content

Commit

Permalink
Attempt to use compendium indexes to get names of self-applied effect…
Browse files Browse the repository at this point in the history
…s in item summaries (#18112)
  • Loading branch information
stwlam authored Jan 25, 2025
1 parent 5b1a83d commit 1bd20a0
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/module/actor/sheet/item-summary-renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,17 +97,21 @@ export class ItemSummaryRenderer<TActor extends ActorPF2e, TSheet extends Applic
chatData: RawItemChatData,
): Promise<void> {
const isEffect = item instanceof AbstractEffectPF2e;
const effectLinkText =
item.isOfType("action", "feat") && item.system.selfEffect ? `@UUID[${item.system.selfEffect.uuid}]` : null;
const selfEffect = effectLinkText && (await TextEditor.enrichHTML(effectLinkText));
const selfEffectLink = (() => {
if (!item.isOfType("action", "feat") || !item.system.selfEffect) return null;
const uuid = item.system.selfEffect.uuid;
const effectItem = fromUuidSync(uuid);
const name = effectItem?.name ?? item.system.selfEffect.name;
return `@UUID[${uuid}]{${name}}`;
})();

const summary = await renderTemplate("systems/pf2e/templates/actors/partials/item-summary.hbs", {
item,
description: chatData.description,
identified: game.user.isGM || !(item.isOfType("physical") || isEffect) || item.isIdentified,
isCreature: item.actor?.isOfType("creature"),
chatData,
selfEffect,
selfEffect: selfEffectLink && (await TextEditor.enrichHTML(selfEffectLink)),
});

container.innerHTML = summary;
Expand Down

0 comments on commit 1bd20a0

Please sign in to comment.