随机商店
随机商店是 AIOShop 的核心特性之一,可以创建定期刷新、商品随机变化的商店。
概念
| 概念 | 说明 |
|---|---|
| 商品池 | 所有可能出现的商品列表 |
| 稀有度 | 控制商品出现概率的权重系统 |
| 刷新周期 | 商品重新随机的时间间隔 |
| 刷新点数 | 玩家手动刷新商店消耗的资源 |
生成模式
BY_ITEM(按物品随机)
从商品池中随机选取指定数量的商品。
random-generation:
enabled: true
generation-mode: "BY_ITEM"
period: "PERSONAL_DAILY"
count: 8
allow-duplicates: false
BY_RARITY(按稀有度随机)
随机选择一个稀有度,展示该稀有度下的所有商品。
random-generation:
enabled: true
generation-mode: "BY_RARITY"
period: "PERSONAL_DAILY"
完整配置示例
display-name: "&d&l神秘商店"
description:
- "&7每日刷新的神秘商店"
- "&7商品随机出现"
gui-template: "random-shop"
random-generation:
enabled: true
generation-mode: "BY_ITEM"
period: "PERSONAL_DAILY"
count: 6
allow-duplicates: false
manual-refresh-enabled: true
items:
common_bread:
item-id: "bread"
rarity: "普通"
display-name: "&f面包"
buy-price:
amount: 5
currency: "VAULT"
buy-rewards:
self:
type: "ITEM"
item: "bread"
amount: 1
limit-type: "PERSONAL_DAILY"
limit-amount-range: "10-20"
enabled: true
rare_diamond:
item-id: "diamond"
rarity: "稀有"
display-name: "&b钻石"
buy-price:
amount: 500
currency: "VAULT"
buy-rewards:
self:
type: "ITEM"
item: "diamond"
amount: 1
limit-type: "PERSONAL_DAILY"
limit-amount: 3
enabled: true
legendary_nether_star:
item-id: "nether_star"
rarity: "传说"
display-name: "&e&l下界之星"
buy-price:
amount: 5000
currency: "VAULT"
buy-rewards:
self:
type: "ITEM"
item: "nether_star"
amount: 1
limit-type: "PERSONAL_DAILY"
limit-amount: 1
enabled: true
配置项说明
random-generation
| 字段 | 类型 | 说明 |
|---|---|---|
enabled | boolean | 是否启用随机生成 |
generation-mode | string | BY_ITEM 或 BY_RARITY |
period | string | 刷新周期 |
count | number | 生成商品数量(BY_ITEM 模式) |
allow-duplicates | boolean | 是否允许重复商品 |
manual-refresh-enabled | boolean | 是否允许手动刷新 |
刷新周期:
| 周期 | 说明 |
|---|---|
PERSONAL_DAILY | 每个玩家每日独立刷新 |
GLOBAL_DAILY | 全服每日统一刷新 |
商品稀有度
商品通过 rarity 字段引用 rarities.yml 中定义的稀有度:
rarity: "传说"
随机限购数量
使用 limit-amount-range 设置随机范围:
limit-amount-range: "5-10" # 每次刷新随机 5-10 个限购
稀有度配置
rarities.yml 定义稀有度和权重:
rarities:
普通:
chance: 0.5 # 50% 概率
稀有:
chance: 0.3 # 30% 概率
史诗:
chance: 0.15 # 15% 概率
传说:
chance: 0.05 # 5% 概率
权重越高,该稀有度/商品被选中的概率越大。
刷新点数
玩家可以使用刷新点数手动刷新商店商品。
管理命令
# 查询刷新点数
/shop refreshpoints <玩家> <商店ID>
# 设置刷新点数
/shop refreshpoints <玩家> <商店ID> <数量>
# 管理员强制刷新玩家商店
/shop refresh <玩家> <商店ID>
# 全服刷新某商店
/shop refreshshop <商店ID>
给予刷新点数
可通过命令奖励给予:
buy-rewards:
refresh_points:
type: "COMMAND"
commands:
- "shop refreshpoints {player} my-random-shop 5"