> For the complete documentation index, see [llms.txt](https://spintowin.superiormc.cn/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://spintowin.superiormc.cn/jian-ti-zhong-wen-2/zhuan-pan-ui/ui-pei-zhi/jia-ge-pei-zhi.md).

# 💰价格配置

在 UI 的 `prices` 中配置抽奖消耗。价格 ID 从 `1` 开始连续递增。无需消耗时，可以配置[免费价格](#免费)。

## 物品价格

使用[物品格式](https://ultimateshop.superiormc.cn/base/item-format)指定消耗的原版物品、已保存物品或第三方插件物品。

```yaml
    1:
      material: APPLE
      name: 'Magic Apple'
      custom-model-data: 5
      apply: [1,2]
      amount: 10
      placeholder: 'Magic Apple x10'
```

## 自定义物品匹配：需要 MythicChanger

在价格中设置 `match-item`，指定可用于支付的物品规则，详见[自定义物品匹配](https://spintowin.superiormc.cn/jian-ti-zhong-wen-2/gong-neng/custom-item-match-method.md)。

```yaml
    1:
      match-item:
        items:
          - 'ender_pearl'
        has-name: true
      apply: [1,2]
      amount: 10
      placeholder: 'Any named Ender Peral x10'
```

此例允许使用符合规则的已命名末影珍珠，不要求它与一个固定物品完全一致。

## 第三方经济

* `economy-plugin`：经济插件名称；可用插件见[兼容性](https://spintowin.superiormc.cn/jian-ti-zhong-wen-2/ji-ben-xin-xi/compatibility.md)。
* `economy-type`：多货币插件的货币 ID。使用 CoinsEngine 等插件时，需要填写正确的货币名。

```yaml
  1:
    economy-plugin: Vault
    # 如果使用 CoinsEngine，则填写：
    # economy-plugin: CoinsEngine
    # economy-type: Coin
    # 多货币插件需要指定 economy-type。
    # 此例消耗 5 个货币单位。
    amount: 5
    placeholder: '$5'
    apply: [1,2,3]
```

## 原版经验与等级

`economy-type` 支持 `exp` 和 `levels`，分别表示经验点数与经验等级。

```yaml
  1:
    economy-type: levels
    # 此例按抽奖次数消耗不同经验等级。
    placeholders:
      3: '10 Levels'
      4: '20 Levels'
    cost: [10,20]
    apply: [3,4]
```

此例在第 3、4 次抽奖分别消耗 10、20 级经验。

## 自定义价格

* `match-placeholder`：要检查的 PlaceholderAPI 变量或表达式。
* `amount`：变量值需要达到的最低值。
* `take-actions`：实际支付时执行的动作，使用[动作格式](https://spintowin.superiormc.cn/jian-ti-zhong-wen-2/ji-ben-xin-xi/format.md)。

```yaml
    1:
      match-placeholder: '%player_health%'
      placeholder: 'Health x1'
      apply: [1,2]
      amount: 10
      take-actions:
        1:
          type: message
          message: 'I steal your one health!'
```

该示例检查生命值并执行消息动作；如需实际扣除生命值或其他数值，需要配置能够完成扣除的动作。

## 免费

使用 `free: true`。如果希望从第一次起始终免费，可以配置：

```yaml
prices:
  1:
    free: true
    amount: 0
    start-apply: 1
    placeholder: '免费'
```

## 通用选项

* `amount`：消耗物品数量或经济数值，默认 `1`。
* `placeholder`：在抽奖按钮 `%price%` 中显示的价格文本。不设置时使用语言文件提供的默认格式。
* `placeholders`：为不同抽奖次数设置不同文本，键为抽奖次数。

```yaml
placeholders:
  1: 'Stone x2'
  2: 'Stone x5'
```

* `start-apply`：从指定抽奖次数开始持续应用此价格，包含指定次数本身。此选项配合 `amount` 使用，不支持通过 `cost` 配置逐次价格。
* `apply`：适用的抽奖次数列表，例如 `[1,2,3]` 表示第 1、2、3 次。不设置时默认使用当前价格的 ID。
* `cost`：与 `apply` 逐项对应的消耗列表，例如 `apply: [1,2,3]` 配合 `cost: [10,20,30]`。不设置时使用 `amount`。
* `conditions`：使用此价格前必须满足的条件。

## 价格条件

可以按抽奖次数分别配置：

```yaml
conditions:
  1:
    1:
      type: permission
      permission: 'group.default'
  2:
    1:
      type: world
      world: 'world'
    2:
      type: permission
      permission: 'group.default'
```

也可以设置始终需要满足的条件，不区分抽奖次数：

```yaml
conditions:
  1:
    type: permission
    permission: 'hi.hi'
```

每个条件节点使用[条件格式](https://spintowin.superiormc.cn/jian-ti-zhong-wen-2/ji-ben-xin-xi/format.md)。旧中文文档中用字符串列表表示条件的方式不适用于此结构。

## apply 与 start-apply 对应的次数

`reserve: false` 时，当前待执行的抽奖次数为：

```
1 + max(展示槽位数量, 初始奖励数量) - 剩余可抽奖励数量
```

例如初始有 20 个奖励、14 个槽位，第一次为第 1 次，已领取 3 个后，下一次为第 4 次。隐藏奖励仍计入剩余可抽奖池。

`reserve: true` 时，使用玩家已记录的该 UI 使用次数加 1。当前抽奖流程在启用 `config.yml` 的 `check-permission-limit` 时更新使用次数；未启用且没有已有记录时，会继续按第 1 次选择价格。

开启 `reserve` 后奖励不会因领取而从奖池移除，玩家可以重复抽取。详见[奖励轮转与抽奖动画](https://spintowin.superiormc.cn/jian-ti-zhong-wen-2/zhuan-pan-ui/ui-pei-zhi/jiang-li-lun-zhuan.md)。
