From 09b51bf548ca182946661708d79ff976c12b85b3 Mon Sep 17 00:00:00 2001 From: Art_Sakura <1754798088@qq.com> Date: Sat, 22 Mar 2025 21:23:20 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20=E4=BF=AE=E5=A4=8D=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E6=AD=A3=E5=B8=B8=E9=93=B2=E9=99=A4=E6=9E=AF=E8=90=8E?= =?UTF-8?q?=E4=BD=9C=E7=89=A9=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- __init__.py | 3 +++ command.py | 7 +++++++ farm/farm.py | 16 ++++++++++++---- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/__init__.py b/__init__.py index 9ff19c7..297a380 100644 --- a/__init__.py +++ b/__init__.py @@ -51,6 +51,9 @@ async def start(): # 初始化读取Json await g_pJsonManager.init() + # await g_pFarmManager.reclamation("1754798088") + # await g_pSqlManager.initUserInfoByUid("1754798088", "Art_Sakura", 0, 100) + # 析构函数 @driver.on_shutdown async def shutdown(): diff --git a/command.py b/command.py index 344a4a4..dfbff5c 100644 --- a/command.py +++ b/command.py @@ -247,6 +247,13 @@ async def _(session: Uninfo): # result = await g_pFarmManager.getUserPlantByUid(uid) # await MessageUtils.build_message(result).send(reply_to=True) +# diuse_farm.set_path_arg("reclamation", "") + + +# @diuse_farm.got("test") +# async def _(session: Uninfo, flag: str = ArgStr("flag")): +# await MessageUtils.build_message("测试一下").send(reply_to=True) + diuse_farm.shortcut( "出售作物(?P.*?)", diff --git a/farm/farm.py b/farm/farm.py index 7999bf0..f48250f 100644 --- a/farm/farm.py +++ b/farm/farm.py @@ -371,7 +371,7 @@ class CFarmManager: soilUnlock = await g_pSqlManager.getUserSoilByUid(uid) - soilNames = [f"soil{i}" for i in range(soilUnlock)] + soilNames = [f"soil{i + 1}" for i in range(soilUnlock)] soilStatuses = await asyncio.gather(*[ g_pSqlManager.getUserSoilStatusBySoilID(uid, name) for name in soilNames @@ -583,10 +583,18 @@ class CFarmManager: # userInfo = await g_pSqlManager.getUserInfoByUid(uid) # level = await g_pSqlManager.getUserLevelByUid(uid) - # rec = g_pJsonManager["reclamation"] # type: ignore + # rec = g_pJsonManager.m_pLevel["reclamation"] # type: ignore - # if not rec[f"{userInfo["soil"] + 1}"] == None + # try: + # rec = rec[f"{userInfo['soil'] + 1}"] - # return "" + # #TODO 缺少判断需要的Item + # if level >= rec['level'] and userInfo['point'] >= rec['point']: + + + # except Exception as e: + # return "获取升级土地条件失败!" + + # return "开垦土地失败,未知错误" g_pFarmManager = CFarmManager()