Skip to content

Commit 362d9e8

Browse files
committed
Refine economy docs examples
1 parent 5be1056 commit 362d9e8

1 file changed

Lines changed: 62 additions & 0 deletions

File tree

docs/matrixshop/economy.mdx

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ custom_points:
5858
- "tell:&c货币不足,需要 &e{need} &c,当前为 &e{balance}"
5959
```
6060
61+
说明:
62+
63+
- `vault` 是当前未定义时的默认回退货币
64+
- `playerpoints` 适合整数型点券
65+
- `custom_points` 只是示例 key,可以改成你自己的命名
66+
6167
## 货币定义字段
6268

6369
| 字段 | 说明 |
@@ -76,6 +82,22 @@ custom_points:
7682
- 自定义占位符货币主要依赖 `Actions.Take / Give / Deny`
7783
- 如果没有定义动作,就只能用于读取余额,不能安全完成结算
7884

85+
## 默认回退规则
86+
87+
如果业务模块在以下三个层级都没有定义货币 key:
88+
89+
1. 商品级
90+
2. 商店级
91+
3. 模块级
92+
93+
那么最终会自动回退到:
94+
95+
```yml
96+
vault
97+
```
98+
99+
也就是说,不配置时默认使用 `vault`。
100+
79101
## 配置优先级
80102

81103
当前版本的货币 key 解析优先级是:
@@ -128,6 +150,46 @@ Currency:
128150
Key: vault
129151
```
130152

153+
### 一个完整示例
154+
155+
假设你想让:
156+
157+
- `SystemShop` 默认使用金币
158+
- `Auction/default.yml` 使用点券
159+
- `SystemShop/shops/weapon.yml` 下某把武器单独使用点券
160+
161+
可以这样写:
162+
163+
```yml
164+
# SystemShop/settings.yml
165+
Currency:
166+
Key: vault
167+
```
168+
169+
```yml
170+
# SystemShop/shops/weapon.yml
171+
Currency:
172+
Key: vault
173+
174+
goods:
175+
diamond_sword:
176+
material: 'DIAMOND_SWORD'
177+
price: 420
178+
currency: playerpoints
179+
```
180+
181+
```yml
182+
# Auction/shops/default.yml
183+
Currency:
184+
Key: playerpoints
185+
```
186+
187+
最终效果:
188+
189+
- 大多数系统商店商品使用 `vault`
190+
- `diamond_sword` 使用 `playerpoints`
191+
- `Auction/default.yml` 下的拍卖使用 `playerpoints`
192+
131193
## 各模块当前支持方式
132194

133195
| 模块 | 支持方式 |

0 commit comments

Comments
 (0)