Skip to content
Open
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
16 changes: 12 additions & 4 deletions src/module/system/text-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -449,15 +449,21 @@ class TextEditorPF2e extends foundry.applications.ux.TextEditor {
// statistic
const statistic = (params["statistic"] || params["stat"] || params["skill"])?.trim();

if ((dc && showDC) || statistic) {
// "false" or "never" to never show
const showStatisticOverride = (params["show-statistic"] || params["show-stat"] || params["show-skill"])
?.trim()
.toLowerCase();
const showStatistic = statistic && !(showStatisticOverride === "false" || showStatisticOverride === "never");

if ((dc && showDC) || showStatistic) {
element.appendChild(document.createTextNode(" "));

const details = document.createElement("span");
if (dc && showDC) {
if (!Number.isNumeric(dc)) {
// (Statistic vs Defense DC)
const defense = game.i18n.localize(`PF2E.Check.DC.Specific.${dc}`);
const text = statistic
const text = showStatistic
? game.i18n.format("PF2E.InlineAction.Check.StatisticVsDefense", {
defense,
statistic: ActionMacroHelpers.getSimpleCheckLabel(statistic) || statistic,
Expand All @@ -470,15 +476,17 @@ class TextEditorPF2e extends foundry.applications.ux.TextEditor {
dataset: { visibility },
children: [game.i18n.format("PF2E.InlineAction.Check.DC", { dc })],
});
const end = statistic ? ` ${ActionMacroHelpers.getSimpleCheckLabel(statistic) || statistic})` : ")";
const end = showStatistic
? ` ${ActionMacroHelpers.getSimpleCheckLabel(statistic) || statistic})`
: ")";
details.append("(", span, end);
} else {
// <span data-visibility="...">(DC #)</span>
details.dataset.visibility = visibility;
details.innerText = `(${game.i18n.format("PF2E.InlineAction.Check.DC", { dc })})`;
}
} else {
// (Statistic)
// (showStatistic)
const text = ActionMacroHelpers.getSimpleCheckLabel(statistic) || statistic;
details.innerText = `(${text})`;
}
Expand Down