限购系统
灵活的购买和出售限制机制
限购类型概览
AIOShop 提供 8 种限购类型,由 作用域 和 周期 组合而成:
| 限购类型 | 作用域 | 周期 | 重置时间 |
|---|---|---|---|
PERSONAL_DAILY | 个人 | 每日 | 每天 00:00 |
PERSONAL_WEEKLY | 个人 | 每周 | 每周一 00:00 |
PERSONAL_MONTHLY | 个人 | 每月 | 每月 1 日 00:00 |
PERSONAL_TOTAL | 个人 | 永久 | 永不重置 |
GLOBAL_DAILY | 全服 | 每日 | 每天 00:00 |
GLOBAL_WEEKLY | 全服 | 每周 | 每周一 00:00 |
GLOBAL_MONTHLY | 全服 | 每月 | 每月 1 日 00:00 |
GLOBAL_TOTAL | 全服 | 永久 | 永不重置 |
NONE | - | - | 无限制 |
购买限购配置
固定限购数量
items:
limited_item:
item-id: "golden_apple"
display-name: "&6金苹果"
buy-price:
amount: 100.0
currency: "VAULT"
buy-rewards:
self:
type: "ITEM"
item: "golden_apple"
amount: 1
# 个人每日限购 5 个
limit-type: "PERSONAL_DAILY"
limit-amount: 5
enabled: true
随机限购数量
适用于随机商店,每次刷新时随机生成限购数量:
items:
random_limit_item:
item-id: "diamond"
display-name: "&b钻石"
buy-price:
amount: 200.0
currency: "VAULT"
buy-rewards:
self:
type: "ITEM"
item: "diamond"
amount: 1
limit-type: "PERSONAL_DAILY"
# 限购数量在 3-8 之间随机
limit-amount-range: "3-8"
enabled: true
出售限购配置
除了购买限购,还可以配置出售限购:
items:
sell_limited_item:
item-id: "coal"
display-name: "&8煤炭"
# 不可购买
buy-price: null
sell-item-matcher:
material: "coal"
sell-rewards:
main:
type: "CURRENCY"
amount: 2.0
currencyType: "VAULT"
# 全服每日限制回收 200 个
sell-limit-type: "GLOBAL_DAILY"
sell-limit-amount: 200
enabled: true
限购类型详解
个人限购 (PERSONAL_*)
每个玩家独立计算购买数量,互不影响。
- PERSONAL_DAILY:玩家每天可购买 X 个,每天 00:00 重置
- PERSONAL_WEEKLY:玩家每周可购买 X 个,每周一 00:00 重置
- PERSONAL_MONTHLY:玩家每月可购买 X 个,每月 1 日 00:00 重置
- PERSONAL_TOTAL:玩家终身只能购买 X 个,永不重置
全服限购 (GLOBAL_*)
所有玩家共享同一购买额度,先到先得。
- GLOBAL_DAILY:全服每天共 X 个,每天 00:00 重置
- GLOBAL_WEEKLY:全服每周共 X 个,每周一 00:00 重置
- GLOBAL_MONTHLY:全服每月共 X 个,每月 1 日 00:00 重置
- GLOBAL_TOTAL:全服共 X 个,售完即止,永不补货
使用场景示例
VIP 礼包(个人每月限购)
vip_pack:
item-id: "chest"
display-name: "&d&lVIP月度礼包"
buy-price:
amount: 0.0
currency: "VAULT"
buy-rewards:
pack:
type: "ITEM"
item: "diamond"
amount: 64
limit-type: "PERSONAL_MONTHLY"
limit-amount: 1
enabled: true
限量稀有物品(全服永久限购)
rare_beacon:
item-id: "beacon"
display-name: "&e&l限量信标"
description:
- "&7全服限量 10 个"
- "&7售完即止!"
buy-price:
amount: 10000.0
currency: "VAULT"
buy-rewards:
self:
type: "ITEM"
item: "beacon"
amount: 1
limit-type: "GLOBAL_TOTAL"
limit-amount: 10
enabled: true
回收站(全服每日出售限制)
recycle_iron:
item-id: "iron_ingot"
display-name: "&7铁锭回收"
description:
- "&7每日全服限收 1000 个"
buy-price: null
sell-item-matcher:
material: "iron_ingot"
sell-rewards:
main:
type: "CURRENCY"
amount: 5.0
currencyType: "VAULT"
sell-limit-type: "GLOBAL_DAILY"
sell-limit-amount: 1000
enabled: true
GUI 显示
限购信息会在商品 lore 中显示,具体格式由 GUI 模板中的 formats.limit 配置决定。
常见显示格式:
剩余购买次数: 3/5今日限购: 已购买 2/5全服剩余: 8/10