mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2026-10-10 06:10:01 +08:00
✨ 新增全新商店界面 (#1816)
* 🎉 新增商店模板及样式配置 * 🎨 移除webui注释 * 🎨 新增神秘药水道具及商店样式调整 * 🎨 添加商店样式底部边距调整 --------- Co-authored-by: Flern <cb56ec362bbbfb5272eb941281299d8d-qq_connect@git.osc>
This commit is contained in:
@@ -17,6 +17,7 @@ class Goods(BaseModel):
|
||||
daily_limit: int
|
||||
icon: str | None = None
|
||||
is_passive: bool
|
||||
partition: str | None
|
||||
func: Callable
|
||||
kwargs: dict[str, str] = {}
|
||||
send_success_msg: bool
|
||||
@@ -73,6 +74,7 @@ class ShopRegister(dict):
|
||||
load_status: tuple[bool, ...],
|
||||
daily_limit: tuple[int, ...],
|
||||
is_passive: tuple[bool, ...],
|
||||
partition: tuple[str, ...],
|
||||
icon: tuple[str, ...],
|
||||
send_success_msg: tuple[bool, ...],
|
||||
max_num_limit: tuple[int, ...],
|
||||
@@ -89,6 +91,7 @@ class ShopRegister(dict):
|
||||
load_status: 是否加载
|
||||
daily_limit: 每日限购
|
||||
is_passive: 是否被动道具
|
||||
partition: 分区名称
|
||||
icon: 图标
|
||||
send_success_msg: 成功时发送消息
|
||||
max_num_limit: 单次最大使用次数
|
||||
@@ -97,7 +100,7 @@ class ShopRegister(dict):
|
||||
def add_register_item(func: Callable):
|
||||
if name in self._data.keys():
|
||||
raise ValueError("该商品已注册,请替换其他名称!")
|
||||
for n, p, d, dd, lmt, s, dl, pa, i, ssm, mnl in zip(
|
||||
for n, p, d, dd, lmt, s, dl, pa, par, i, ssm, mnl in zip(
|
||||
name,
|
||||
price,
|
||||
des,
|
||||
@@ -106,6 +109,7 @@ class ShopRegister(dict):
|
||||
load_status,
|
||||
daily_limit,
|
||||
is_passive,
|
||||
partition,
|
||||
icon,
|
||||
send_success_msg,
|
||||
max_num_limit,
|
||||
@@ -124,6 +128,7 @@ class ShopRegister(dict):
|
||||
limit_time=lmt,
|
||||
daily_limit=dl,
|
||||
is_passive=pa,
|
||||
partition=par,
|
||||
func=func,
|
||||
send_success_msg=ssm,
|
||||
max_num_limit=mnl,
|
||||
@@ -135,6 +140,7 @@ class ShopRegister(dict):
|
||||
goods.daily_limit = dl
|
||||
goods.icon = i
|
||||
goods.is_passive = pa
|
||||
goods.partition = par
|
||||
goods.func = func
|
||||
goods.kwargs = _temp_kwargs
|
||||
goods.send_success_msg = ssm
|
||||
@@ -162,6 +168,7 @@ class ShopRegister(dict):
|
||||
goods.limit_time,
|
||||
goods.daily_limit,
|
||||
goods.is_passive,
|
||||
goods.partition,
|
||||
goods.icon,
|
||||
)
|
||||
if uuid:
|
||||
@@ -186,6 +193,7 @@ class ShopRegister(dict):
|
||||
load_status: bool | tuple[bool, ...] = True,
|
||||
daily_limit: int | tuple[int, ...] = 0,
|
||||
is_passive: bool | tuple[bool, ...] = False,
|
||||
partition: str | tuple[str, ...] | None = None,
|
||||
icon: str | tuple[str, ...] = "",
|
||||
send_success_msg: bool | tuple[bool, ...] = True,
|
||||
max_num_limit: int | tuple[int, ...] = 1,
|
||||
@@ -202,11 +210,11 @@ class ShopRegister(dict):
|
||||
load_status: 是否加载
|
||||
daily_limit: 每日限购
|
||||
is_passive: 是否被动道具
|
||||
partition: 分区名称
|
||||
icon: 图标
|
||||
send_success_msg: 成功时发送消息
|
||||
max_num_limit: 单次最大使用次数
|
||||
"""
|
||||
_tuple_list = []
|
||||
_current_len = -1
|
||||
for x in [name, price, des, discount, limit_time, load_status]:
|
||||
if isinstance(x, tuple):
|
||||
@@ -226,6 +234,7 @@ class ShopRegister(dict):
|
||||
_load_status = self.__get(load_status, _current_len)
|
||||
_daily_limit = self.__get(daily_limit, _current_len)
|
||||
_is_passive = self.__get(is_passive, _current_len)
|
||||
_partition = self.__get(partition, _current_len)
|
||||
_icon = self.__get(icon, _current_len)
|
||||
_send_success_msg = self.__get(send_success_msg, _current_len)
|
||||
_max_num_limit = self.__get(max_num_limit, _current_len)
|
||||
@@ -238,6 +247,7 @@ class ShopRegister(dict):
|
||||
_load_status,
|
||||
_daily_limit,
|
||||
_is_passive,
|
||||
_partition,
|
||||
_icon,
|
||||
_send_success_msg,
|
||||
_max_num_limit,
|
||||
|
||||
Reference in New Issue
Block a user