🚑 修复了用户不能正常偷菜、收菜的问题
This commit is contained in:
parent
43b2184597
commit
16c801bcb6
@ -295,7 +295,7 @@ async def _(session: Uninfo, target: Match[At]):
|
||||
point = await g_pSqlManager.getUserPointByUid(tar.target)
|
||||
|
||||
if point < 0:
|
||||
await MessageUtils.build_message("尚未开通农场,快at我发送 开通农场 开通吧").send()
|
||||
await MessageUtils.build_message("目标尚未开通农场,快at我发送 开通农场 开通吧").send()
|
||||
return None
|
||||
|
||||
result = await g_pFarmManager.stealing(uid, tar.target)
|
||||
|
||||
18
farm/farm.py
18
farm/farm.py
@ -301,7 +301,7 @@ class CFarmManager:
|
||||
|
||||
plant = {}
|
||||
|
||||
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
|
||||
@ -312,8 +312,13 @@ class CFarmManager:
|
||||
experience = 0
|
||||
|
||||
for (soil_name, (status, info)) in zip(soilNames, soilStatuses):
|
||||
if not status:
|
||||
if len(info) <= 0:
|
||||
continue
|
||||
|
||||
soilInfo = info.split(',')
|
||||
if soilInfo[3] == 4:
|
||||
continue
|
||||
|
||||
plantId = soilInfo[0]
|
||||
plantInfo = g_pJsonManager.m_pPlant['plant'][plantId] # type: ignore
|
||||
|
||||
@ -495,7 +500,7 @@ class CFarmManager:
|
||||
plant = {}
|
||||
|
||||
#根据解锁土地,获取每块土地状态信息
|
||||
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(target, name)
|
||||
for name in soilNames
|
||||
@ -508,7 +513,9 @@ class CFarmManager:
|
||||
for (soilName, (status, info)) in zip(soilNames, soilStatuses):
|
||||
isStealing = False
|
||||
|
||||
if not info:
|
||||
if len(info) < 0:
|
||||
continue
|
||||
|
||||
soilInfo = info.split(',')
|
||||
if soilInfo[3] == 4:
|
||||
continue
|
||||
@ -545,8 +552,7 @@ class CFarmManager:
|
||||
plant[plantId] = plant.get(plantId, 0) + randomNumber
|
||||
harvestRecords.append(f"成功偷到作物:{plantId},数量为:{randomNumber}")
|
||||
|
||||
newElement = f"|{uid}-{randomNumber}"
|
||||
stealingStatus.append(newElement)
|
||||
stealingStatus.append(f"|{uid}-{randomNumber}")
|
||||
|
||||
#如果将作物偷完,就直接更新状态 并记录用户偷取过
|
||||
if plantInfo['harvest'] - randomNumber + stealingNumber == 0:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user