feat: add stat-modifiers role for automatic stat generation

Introduces a new `stat-modifiers` CSV role that simplifies the
creation of template stats and their associated modifier stats.
A single CSV block now automatically generates:
- A template stat definition.
- Multiple modifier stat definitions (prefixed with the template ID).
- The corresponding template table.

This reduces the need for manual YAML definitions for every
modifier associated with a template.
This commit is contained in:
2026-07-09 11:16:39 +08:00
parent d83256e049
commit ef71a43f0a
4 changed files with 183 additions and 19 deletions
+9
View File
@@ -19,6 +19,7 @@ import {
parseStatYaml,
parseStatCsv,
parseTemplateCsv,
parseStatModifiers,
} from "../../cli/completions/stat-parser";
import type { StatDef, StatTemplate } from "../../cli/completions/stat-parser";
import {
@@ -153,6 +154,14 @@ async function scanClientSide(): Promise<JournalCompletions> {
statTemplates.push(parseTemplateCsv(body, filePath, name));
}
if (attrs.role === "stat-modifiers") {
const id = attrs.id || `_mod_${filePath}_${stats.length}`;
const result = parseStatModifiers(body, filePath, id);
stats.push(result.statDef);
stats.push(...result.modifierDefs);
statTemplates.push(result.template);
}
if (attrs.role === "spark-table") {
const parsed = parseSparkTableCsv(body, filePath, slugger);
if (parsed) sparkTables.push(parsed);