11---
22title : SystemShop
3- description : SystemShop 的默认配置、分类文件和商品字段解释 。
3+ description : SystemShop 的默认配置、goods 目录、分类引用和管理员维护方式 。
44---
55
66# SystemShop
@@ -10,6 +10,7 @@ description: SystemShop 的默认配置、分类文件和商品字段解释。
1010## 默认文件
1111
1212- ` SystemShop/settings.yml `
13+ - ` SystemShop/goods/*.yml `
1314- ` SystemShop/shops/weapon.yml `
1415- ` SystemShop/shops/food.yml `
1516- ` SystemShop/shops/material.yml `
@@ -121,7 +122,7 @@ icons:
121122
122123# # `SystemShop/shops/weapon.yml`
123124
124- 这是最关键的商品分类配置文件。`food.yml` 和 `material.yml` 的结构与它一致。
125+ 分类文件负责页面布局、模板和商品引用。推荐写法如下:
125126
126127` ` ` yaml
127128id: weapon
@@ -165,47 +166,15 @@ template:
165166 - ''
166167 - '&e左键进入购买确认'
167168
169+ Currency:
170+ Key: vault
171+
168172goods:
169- wooden_sword:
170- material: 'WOOD_SWORD'
171- amount: 1
172- price: 25
173- buy-max: 16
174- name: '&f木剑'
175- lore:
176- - '&7入门级近战武器'
177- iron_sword:
178- material: 'IRON_SWORD'
179- amount: 1
180- price: 120
181- buy-max: 16
182- name: '&f铁剑'
183- lore:
184- - '&7稳定的主力武器'
185- diamond_sword:
186- material: 'DIAMOND_SWORD'
187- amount: 1
188- price: 420
189- buy-max: 8
190- name: '&b钻石剑'
191- lore:
192- - '&7高品质近战武器'
193- bow:
194- material: 'BOW'
195- amount: 1
196- price: 180
197- buy-max: 8
198- name: '&6弓'
199- lore:
200- - '&7远程作战基础装备'
201- arrow_bundle:
202- material: 'ARROW'
203- amount: 16
204- price: 32
205- buy-max: 64
206- name: '&f箭矢 x16'
207- lore:
208- - '&7远程消耗品补给'
173+ - wooden_sword
174+ - iron_sword
175+ - diamond_sword
176+ - bow
177+ - arrow_bundle
209178` ` `
210179
211180# ## 顶层字段解释
@@ -217,20 +186,40 @@ goods:
217186| `layout` | `g` 是动态商品槽位,`I` 是说明,`R` 是返回。 |
218187| `icons` | 静态图标定义。 |
219188| `template` | 所有动态商品统一使用的名称和 Lore 模板。 |
220- | `goods` | 静态商品列表。 |
189+ | `Currency.Key` | 当前分类的默认货币 key。 |
190+ | `goods` | 当前分类引用的商品 id 列表。 |
191+
192+ # # `SystemShop/goods/diamond_sword.yml`
193+
194+ 商品文件负责真正的商品定义:
221195
222- # ## `goods.*` 字段解释
196+ ` ` ` yaml
197+ id: diamond_sword
198+ material: 'DIAMOND_SWORD'
199+ amount: 1
200+ price: 420
201+ buy-max: 8
202+ name: '&b钻石剑'
203+ lore:
204+ - '&7高品质近战武器'
205+ ` ` `
206+
207+ # ## 商品字段解释
223208
224209| 字段 | 说明 |
225210| --- | --- |
211+ | `id` | 商品 id,通常与文件名一致。 |
226212| `material` | 商品材质。 |
213+ | `item` | 更高保真的物品定义,可覆盖基础材质展示。 |
227214| `amount` | 每次购买给多少个。 |
228215| `price` | 单次交易价格。 |
229216| `buy-max` | 单次购买的最大数量或上限展示值。 |
230217| `name` | 商品显示名。 |
231218| `lore` | 商品说明。 |
232219| `currency` | 商品级货币 key。可选;只有你想覆盖默认货币时才需要写。 |
233220
221+ > 兼容说明:旧版 `SystemShop/shops/*.yml` 中直接内联 `goods.<id>` 的写法仍然可读取,但新配置应优先拆到 `SystemShop/goods/*.yml`。
222+
234223# # 当前货币优先级
235224
236225` SystemShop` 当前采用:
@@ -240,10 +229,31 @@ goods:
2402293. `SystemShop/settings.yml` 里的 `Currency.Key`
2412304. 默认回退 `vault`
242231
232+ # # 管理员商品维护
233+
234+ 当前后台命令流已经拆成两步:
235+
236+ 1. 保存商品定义到 `goods` 仓库
237+ 2. 把已保存商品挂到某个系统商店分类
238+
239+ 命令如下:
240+
241+ - ` /matrixshopadmin goods ui [page]`
242+ - ` /matrixshopadmin goods save <price> [buy-max] [product-id]`
243+ - ` /matrixshopadmin goods add <category> <product-id>`
244+ - ` /matrixshopadmin goods select <category> <product-id>`
245+ - ` /matrixshopadmin goods edit <price|buy-max|currency|name|item|remove> ...`
246+
247+ 其中:
248+
249+ - ` goods save` 只写 `SystemShop/goods/*.yml`
250+ - ` goods add` 只负责把商品 id 引用进分类文件的 `goods:`
251+ - ` goods edit remove` 只会把商品从当前分类下架,不会删除 `goods` 仓库里的文件
252+
243253# # 你应该怎么改
244254
245255- 想新增一个分类:复制一份 `shops/weapon.yml`,改文件名,再把 `ui/shop.yml` 的按钮指过去。
246- - 想新增一个商品:直接在 ` goods:` 下加一项 。
256+ - 想新增一个商品:新建 `SystemShop/ goods/<product-id>.yml`,然后把 id 加到对应分类的 `goods :` 列表里 。
247257- 想改默认打开的分类:改顶层 `config.yml` 的 `system-shop.default-category`。
248258
249259# # 相关文件
@@ -252,4 +262,4 @@ goods:
252262- ` SystemShop/shops/material.yml`
253263- ` SystemShop/ui/confirm.yml`
254264
255- 通常先改 `shops/*.yml`,只有在你想重做分类入口和确认流程时,才需要再动 `ui/*.yml`。
265+ 通常先改 `goods/*.yml` 和 ` shops/*.yml`,只有在你想重做分类入口和确认流程时,才需要再动 `ui/*.yml`。
0 commit comments