From a6a1efe7f2483c63a3e7c09b505778b792f90952 Mon Sep 17 00:00:00 2001 From: Idle <651462+reonZ@users.noreply.github.com> Date: Sun, 24 Nov 2024 23:12:09 +0100 Subject: [PATCH] add RK skill name to the token hud - closes #58 --- src/hud/shared/advanced.ts | 18 ++++++++++++++++-- templates/token/hud.hbs | 9 ++------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/hud/shared/advanced.ts b/src/hud/shared/advanced.ts index 955500a..3668cd4 100644 --- a/src/hud/shared/advanced.ts +++ b/src/hud/shared/advanced.ts @@ -8,6 +8,7 @@ import { getFlag, getItemWithSourceId, getSetting, + getSkillLabel, localize, } from "module-helpers"; import { IWR_DATA, StatsSpeed, StatsStatistic, getSpeeds, getStatistics } from "./base"; @@ -197,8 +198,22 @@ function getAdvancedStats(actor: ActorPF2e, hud: AdvancedHUD): StatsAdvanced { ?.map((speed) => ` ${speed.total}`) .join(""); + const recall = (() => { + if (!isNPC) return; + + const skills = actor.identificationDCs.skills.map((skill) => getSkillLabel(skill)); + const label = game.i18n.localize("PF2E.RecallKnowledge.Label"); + const tooltip = `${label} (${skills.join(", ")})`; + + return { + tooltip, + dc: actor.identificationDCs.standard.dc, + }; + })(); + const data: StatsAdvanced = { isNPC, + recall, isArmy, isHazard, isVehicle, @@ -209,7 +224,6 @@ function getAdvancedStats(actor: ActorPF2e, hud: AdvancedHUD): StatsAdvanced { level: actor.level, dying: isCharacter ? actor.attributes.dying : undefined, wounded: isCharacter ? actor.attributes.wounded : undefined, - recall: isNPC ? actor.identificationDCs.standard.dc : undefined, heroPoints: isCharacter ? actor.heroPoints : undefined, statistics: getStatistics(actor), otherSpeeds: otherSpeeds || undefined, @@ -253,7 +267,7 @@ type StatsAdvanced = { isCharacter: boolean; isCombatant: boolean; alliance?: ThreeStep; - recall: { dc: number; skills: string } | undefined; + recall: { dc: number; tooltip: string } | undefined; dying: ValueAndMax | undefined; wounded: ValueAndMax | undefined; heroPoints: ValueAndMax | undefined; diff --git a/templates/token/hud.hbs b/templates/token/hud.hbs index 4ea185c..892b1d6 100644 --- a/templates/token/hud.hbs +++ b/templates/token/hud.hbs @@ -32,15 +32,10 @@ {{> (@root.partial 'three-steps') step=alliance}} {{/if}} {{#if isNPC}} -
+
- {{recall}} + {{recall.dc}}
- {{!-- - - {{recall}} - --}} {{/if}}
{{/if}}