feat: add support for stat templates

Introduces a new `template` stat type that allows for table-based
lookups via CSV blocks in markdown files. When a template stat is
rolled, it uses a dice expression defined in the template to select
an entry, applies a label, and automatically updates associated
modifier stats using relative values.
This commit is contained in:
2026-07-09 10:26:54 +08:00
parent 19c66640b5
commit 1c69bf394c
10 changed files with 384 additions and 15 deletions
+3
View File
@@ -6,6 +6,7 @@ import { diceSource } from "./sources/dice.js";
import { linksSource } from "./sources/links.js";
import { sparkTablesSource } from "./sources/spark-tables.js";
import { statsSource } from "./sources/stats.js";
import { templatesSource } from "./sources/templates.js";
import type { CompletionSource, CompletionsPayload } from "./types.js";
export type {
@@ -14,6 +15,7 @@ export type {
LinkCompletion,
SparkTableCompletion,
StatDef,
StatTemplate,
} from "./types.js";
/** Registered sources — open for extension */
@@ -22,6 +24,7 @@ const sources: CompletionSource[] = [
linksSource,
sparkTablesSource,
statsSource,
templatesSource,
];
/**