refactor: merge /spark command into /roll

Consolidate the `/spark` command into `/roll` to simplify the CLI.
The `/roll` command now handles both dice notation and spark table
slugs.

- Update `parseInput` to treat `/roll` arguments as a generic string.
- Update `dispatchCommand` to check for spark table matches before
  evaluating dice notation or variable expressions.
- Update command completions to show both dice and spark table
  suggestions under `/roll`.
- Update documentation and UI placeholders to reflect the change.
This commit is contained in:
2026-07-13 14:43:55 +08:00
parent c4038a5213
commit d74ba69fdf
8 changed files with 118 additions and 77 deletions
+25 -8
View File
@@ -1,27 +1,32 @@
---
tag: journal-roll
icon: 🎲
title: 掷骰命令
description: 在 Journal 中发送掷骰结果,支持标准骰子表达式。
syntax: '/roll 骰子表达式'
title: 掷骰与种子表命令
description: 在 Journal 中掷骰或随机生成种子表内容。优先匹配种子表,否则作为骰子表达式处理。
syntax: '/roll 骰子表达式 | 种子表键名'
props:
- name: 骰子表达式
- name: 参数
type: string
desc: 标准骰子表达式,如 3d6、2d8kh1、d20+5
desc: 骰子表达式(如 3d6、2d8kh1、d20+5)或已定义的种子表 slug
---
## 概述
`/roll` 命令用于在 Journal 流中掷骰并发布结果。结果会同步到所有连接的客户端。
`/roll` 命令用于掷骰或随机抽取种子表,并将结果同步到所有客户端。
- 如果参数匹配已定义的**种子表** slug,则抽取并发布对应种子表的结果。
- 否则,作为**骰子表达式**求值并发布掷骰结果。
## 语法
```
/roll 骰子表达式
/roll 骰子表达式 | 种子表键名
```
## 示例
### 掷骰
```
/roll d20
/roll 3d6
@@ -30,6 +35,14 @@ props:
/roll 4d6k3
```
### 种子表
```
/roll npc
/roll encounter
/roll loot
```
## 支持的骰子表达式
| 表达式 | 说明 |
@@ -40,8 +53,12 @@ props:
| `1d20+5` | 1 个 20 面骰加 5 |
| `4d6k3` | 4 个 6 面骰保留最高 3 个 |
## 种子表定义
种子表在文档中通过 `:spark[CSV路径]` 指令或 spark 形状的 markdown 表格定义,CSV 文件的第一列表头为骰子公式(如 d6、d20),后续列为数据列。
## 权限
- **GM**:可使用
- **玩家**:不可使用
- **观察者**:不可使用
- **观察者**:不可使用