From 2f939ff52bb563ea39b3c011819e9c41b56c334b Mon Sep 17 00:00:00 2001 From: HibiKier <45528451+HibiKier@users.noreply.github.com> Date: Mon, 6 Jan 2025 21:23:15 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20=E4=BF=AE=E5=A4=8D=E5=95=86?= =?UTF-8?q?=E5=93=81=E5=9B=BE=E6=A0=87=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98?= =?UTF-8?q?=EF=BC=8C=E7=A7=BB=E9=99=A4=E6=B5=8B=E8=AF=95=E9=81=93=E5=85=B7?= =?UTF-8?q?=20(#1817)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Flern --- zhenxun/builtin_plugins/shop/__init__.py | 2 +- .../builtin_plugins/shop/goods_register.py | 144 +----------------- zhenxun/builtin_plugins/shop/html_image.py | 9 +- 3 files changed, 16 insertions(+), 139 deletions(-) diff --git a/zhenxun/builtin_plugins/shop/__init__.py b/zhenxun/builtin_plugins/shop/__init__.py index 4b9cb36a..59f494bb 100644 --- a/zhenxun/builtin_plugins/shop/__init__.py +++ b/zhenxun/builtin_plugins/shop/__init__.py @@ -25,7 +25,6 @@ from zhenxun.utils.message import MessageUtils from zhenxun.utils.platform import PlatformUtils from ._data_source import ShopManage, gold_rank -from .goods_register import * # noqa: F403 __plugin_meta__ = PluginMetadata( name="商店", @@ -57,6 +56,7 @@ __plugin_meta__ = PluginMetadata( ).dict(), ) +from .goods_register import * # noqa: F403 _matcher = on_alconna( Alconna( diff --git a/zhenxun/builtin_plugins/shop/goods_register.py b/zhenxun/builtin_plugins/shop/goods_register.py index 1f1eab68..4658ddf6 100644 --- a/zhenxun/builtin_plugins/shop/goods_register.py +++ b/zhenxun/builtin_plugins/shop/goods_register.py @@ -19,143 +19,15 @@ async def _(user_id: str): @shop_register( - name="测试道具A1", + name="神秘药水2", price=999999, des="鬼知道会有什么效果,要不试试?", - partition="TEST", - icon="mysterious_potion.png", + partition="小秘密", ) async def _(user_id: str): - pass - - -@shop_register( - name="测试道具A2", - price=999999, - des="鬼知道会有什么效果,要不试试?", - partition="TEST", - icon="mysterious_potion.png", -) -async def _(user_id: str): - pass - - -@shop_register( - name="测试道具A3", - price=999999, - des="鬼知道会有什么效果,要不试试?", - partition="TEST", - icon="mysterious_potion.png", -) -async def _(user_id: str): - pass - - -@shop_register( - name="测试道具A4", - price=999999, - des="鬼知道会有什么效果,要不试试?", - partition="TEST", - icon="mysterious_potion.png", -) -async def _(user_id: str): - pass - - -@shop_register( - name="测试道具A5", - price=999999, - des="鬼知道会有什么效果,要不试试?", - partition="TEST", - icon="mysterious_potion.png", -) -async def _(user_id: str): - pass - - -@shop_register( - name="测试道具A6", - price=999999, - des="鬼知道会有什么效果,要不试试?", - partition="TEST", - icon="mysterious_potion.png", -) -async def _(user_id: str): - pass - - -@shop_register( - name="测试道具A7", - price=999999, - des="鬼知道会有什么效果,要不试试?", - partition="TEST", - icon="mysterious_potion.png", -) -async def _(user_id: str): - pass - - -@shop_register( - name="测试道具A8", - price=999999, - des="鬼知道会有什么效果,要不试试?", - partition="TEST", - icon="mysterious_potion.png", -) -async def _(user_id: str): - pass - - -@shop_register( - name="测试道具A9", - price=999999, - des="鬼知道会有什么效果,要不试试?", - partition="TEST", - icon="mysterious_potion.png", -) -async def _(user_id: str): - pass - - -@shop_register( - name="测试道具A10", - price=999999, - des="鬼知道会有什么效果,要不试试?", - partition="TEST", - icon="mysterious_potion.png", -) -async def _(user_id: str): - pass - - -@shop_register( - name="测试道具A11", - price=999999, - des="鬼知道会有什么效果,要不试试?", - partition="TEST", - icon="mysterious_potion.png", -) -async def _(user_id: str): - pass - - -@shop_register( - name="测试道具A12", - price=999999, - des="鬼知道会有什么效果,要不试试?", - partition="TEST", - icon="mysterious_potion.png", -) -async def _(user_id: str): - pass - - -@shop_register( - name="测试道具A13", - price=999999, - des="鬼知道会有什么效果,要不试试?", - partition="TEST", - icon="mysterious_potion.png", -) -async def _(user_id: str): - pass + await UserConsole.add_gold( + user_id, + 1000000, + "shop", + ) + return "使用道具神秘药水成功!你滴金币+1000000!" diff --git a/zhenxun/builtin_plugins/shop/html_image.py b/zhenxun/builtin_plugins/shop/html_image.py index 49f3f046..8042c6c3 100644 --- a/zhenxun/builtin_plugins/shop/html_image.py +++ b/zhenxun/builtin_plugins/shop/html_image.py @@ -31,14 +31,19 @@ async def html_image() -> bytes: goods[1].partition = "默认分区" if goods[1].partition not in partition_dict: partition_dict[goods[1].partition] = [] + icon = None + if goods[1].icon: + icon = ( + "data:image/png;base64," + + BuildImage.open(ICON_PATH / goods[1].icon).pic2bs4()[9:] + ) partition_dict[goods[1].partition].append( { "id": goods[0], "price": goods[1].goods_price, "daily_limit": goods[1].daily_limit or "∞", "name": goods[1].goods_name, - "icon": "data:image/png;base64," - + BuildImage.open(ICON_PATH / goods[1].icon).pic2bs4()[9:], + "icon": icon, "description": goods[1].goods_description, } )