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

Provide a subtitle with actions when using lores #17223

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/module/system/action-macros/basic/escape.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function escapeCheckContext<ItemType extends ItemPF2e<ActorPF2e>>(
);

if (highest) {
const { checkType, stat: slug, subtitle } = ActionMacroHelpers.resolveStat(highest.statistic.slug);
const { checkType, stat: slug, subtitle } = ActionMacroHelpers.resolveStat(highest.statistic.slug, opts.actor);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure how this is related?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In order to get access to the skill label, I added the actor as an argument to ActionMacroHelpers.resolveStat(). This is the one other call site of this function.

return {
modifiers: data.modifiers,
rollOptions: highest.rollOptions,
Expand Down
12 changes: 9 additions & 3 deletions src/module/system/action-macros/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ import type {
} from "./types.ts";

class ActionMacroHelpers {
static resolveStat(stat: string): {
static resolveStat(
stat: string,
actor: ActorPF2e,
): {
checkType: CheckType;
property: string;
stat: string;
Expand All @@ -54,11 +57,14 @@ class ActionMacroHelpers {
default: {
const slug = sluggify(stat);
const property = `skills.${slug}`;
const subtitle = `PF2E.ActionsCheck.${stat}`;
return {
checkType: "skill-check",
property,
stat,
subtitle: `PF2E.ActionsCheck.${stat}`,
subtitle: game.i18n.has(subtitle)
? subtitle
: game.i18n.format("PF2E.ActionsCheck.x", { type: actor.skills?.[stat]?.label ?? null }),
};
}
}
Expand All @@ -68,7 +74,7 @@ class ActionMacroHelpers {
options: CheckContextOptions<ItemType>,
data: CheckContextData<ItemType>,
): CheckMacroContext<ItemType> | undefined {
const { checkType: type, property, stat: slug, subtitle } = this.resolveStat(data.slug);
const { checkType: type, property, stat: slug, subtitle } = this.resolveStat(data.slug, options.actor);
const statistic =
options.actor.getStatistic(data.slug) ?? (fu.getProperty(options.actor, property) as StrikeData);
if (!statistic) {
Expand Down
Loading