Skip to content

Commit 4fa2104

Browse files
committed
Document MatrixShop refresh foundation
1 parent cfb1a3c commit 4fa2104

2 files changed

Lines changed: 150 additions & 0 deletions

File tree

docs/matrixshop/shop-types/system-shop.mdx

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,84 @@ lore:
220220

221221
> 兼容说明:旧版 `SystemShop/shops/*.yml` 中直接内联 `goods.<id>` 的写法仍然可读取,但新配置应优先拆到 `SystemShop/goods/*.yml`。
222222

223+
## `SystemShop/goods/starter_weapons.yml`
224+
225+
商品组用于把多个 goods 组合成一个可复用引用:
226+
227+
```yaml
228+
id: starter_weapons
229+
Kind: group
230+
entries:
231+
- wooden_sword
232+
- iron_sword
233+
- bow
234+
```
235+
236+
商店中可直接写:
237+
238+
```yaml
239+
goods:
240+
- starter_weapons
241+
- arrow_bundle
242+
```
243+
244+
## `SystemShop/goods/weapon_refresh_pool_example.yml`
245+
246+
随机池用于给刷新区域提供候选商品:
247+
248+
```yaml
249+
id: weapon_refresh_pool_example
250+
Kind: pool
251+
entries:
252+
iron_sword_offer:
253+
goods: iron_sword
254+
weight: 10
255+
price: 99
256+
buy-max: 3
257+
```
258+
259+
## 刷新区域
260+
261+
当前已经有 SystemShop 刷新基础能力,配置位置在 `icons.<char>.refresh`。
262+
263+
最小示例:
264+
265+
```yaml
266+
icons:
267+
'g':
268+
material: 'AIR'
269+
mode: 'goods'
270+
refresh:
271+
Enabled: true
272+
Cron: '0 0 6 * * ?'
273+
Timezone: 'Asia/Shanghai'
274+
Same-For-Players-In-Group: true
275+
groups:
276+
default:
277+
Enabled: true
278+
Random-Refresh: true
279+
Pick: 2
280+
Pool-Ref: 'weapon_refresh_pool_example'
281+
```
282+
283+
### 刷新字段解释
284+
285+
| 字段 | 说明 |
286+
| --- | --- |
287+
| `Cron` | Quartz 风格 cron 表达式。 |
288+
| `Timezone` | 该刷新区域的时区。 |
289+
| `Same-For-Players-In-Group` | 同组是否共享同一份刷新结果。 |
290+
| `groups.<id>.Match-Script` | Kether 脚本,决定玩家是否命中该组。 |
291+
| `groups.<id>.Random-Refresh` | 是否从随机池抽取商品。 |
292+
| `groups.<id>.Pick` | 随机抽取数量。 |
293+
| `groups.<id>.Pool-Ref` | 引用 `goods` 目录中的随机池。 |
294+
| `groups.<id>.goods` | 非随机模式下直接引用静态商品或商品组。 |
295+
296+
### 后台命令
297+
298+
- `/matrixshopadmin refresh list [category]`
299+
- `/matrixshopadmin refresh run <category> [icon]`
300+
223301
## 当前货币优先级
224302

225303
`SystemShop` 当前采用:

docs/matrixshop/system-shop.mdx

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,33 @@ name: '&f铁剑'
7272
- `lore`
7373
- `currency`
7474

75+
`goods` 目录当前还支持两种可复用资源:
76+
77+
- 商品组
78+
- 随机池
79+
80+
示例:
81+
82+
```yaml
83+
# SystemShop/goods/starter_weapons.yml
84+
id: starter_weapons
85+
Kind: group
86+
entries:
87+
- wooden_sword
88+
- iron_sword
89+
```
90+
91+
```yaml
92+
# SystemShop/goods/weapon_refresh_pool_example.yml
93+
id: weapon_refresh_pool_example
94+
Kind: pool
95+
entries:
96+
iron_sword_offer:
97+
goods: iron_sword
98+
weight: 10
99+
price: 99
100+
```
101+
75102
> 兼容说明:旧版 `shops/*.yml` 中直接内联 `goods.<id>` 的写法仍然可以读取,但新配置不建议继续这样写。
76103

77104
## 管理员维护流
@@ -89,6 +116,51 @@ name: '&f铁剑'
89116
- `/matrixshopadmin goods select <category> <product-id>`
90117
- `/matrixshopadmin goods edit <price|buy-max|currency|name|item|remove> ...`
91118

119+
当前还支持系统商店刷新管理命令:
120+
121+
- `/matrixshopadmin refresh list [category]`
122+
- `/matrixshopadmin refresh run <category> [icon]`
123+
124+
## 刷新区域
125+
126+
当前已经实现一套 SystemShop 刷新基础能力,刷新规则直接挂在 `icons.<char>.refresh` 下。
127+
128+
示例结构:
129+
130+
```yaml
131+
icons:
132+
'g':
133+
material: 'AIR'
134+
mode: 'goods'
135+
refresh:
136+
Enabled: true
137+
Cron: '0 0 6 * * ?'
138+
Timezone: 'Asia/Shanghai'
139+
Same-For-Players-In-Group: true
140+
groups:
141+
default:
142+
Enabled: true
143+
Random-Refresh: true
144+
Pick: 2
145+
Pool-Ref: 'weapon_refresh_pool_example'
146+
```
147+
148+
字段含义:
149+
150+
- `Same-For-Players-In-Group`
151+
- `true` 时,同组玩家共用一份刷新结果
152+
- `false` 时,同组玩家各自独立生成结果
153+
- `groups.<id>.Match-Script`
154+
- 使用 Kether 脚本匹配当前玩家是否命中该组
155+
- `groups.<id>.Pool-Ref`
156+
- 引用 `goods` 目录中的 `Kind: pool` 文件
157+
- `groups.<id>.goods`
158+
- 非随机模式下直接引用静态商品或商品组
159+
160+
默认资源里已经带了一个关闭状态的注释示例:
161+
162+
- `SystemShop/shops/weapon.yml`
163+
92164
## 菜单渲染规则
93165

94166
入口菜单通常会在 `layout` 里放一个 `mode: goods` 的图标槽位,例如:

0 commit comments

Comments
 (0)