Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempt to use compendium indexes to get names of self-applied effects in item summaries #18112

Merged
merged 1 commit into from
Jan 25, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading