d
This commit is contained in:
parent
d074c75b6c
commit
719a1b8d34
@ -22,7 +22,7 @@
|
||||
| 收获 | 收获成熟作物 | |
|
||||
| 铲除 | 铲除荒废作物 | |
|
||||
| 我的作物 | | |
|
||||
| 出售作物 [作物名称] [数量] | 从仓库里向系统售卖作物 | 数量不填默认全部 |
|
||||
| 出售作物 [作物名称] [数量] | 从仓库里向系统售卖作物 | 作物不填默认清空仓库 数量不填默认全部 |
|
||||
| @美波理 偷菜 | 偷别人的菜 | 每人每天只能偷5次 |
|
||||
| 购买农场币 | 将真寻金币兑换成农场币 | 兑换比例默认为1:2 手续费默认20% |
|
||||
|
||||
|
||||
@ -634,7 +634,10 @@ class CSqlManager:
|
||||
|
||||
if plant in plantsDict:
|
||||
plantsDict[plant] += num
|
||||
if plantsDict[plant] <= 0:
|
||||
del plantsDict[plant]
|
||||
else:
|
||||
if num > 0:
|
||||
plantsDict[plant] = num
|
||||
|
||||
updatedPlants = ','.join([f"{name}|{count}" for name, count in plantsDict.items()])
|
||||
|
||||
@ -679,7 +679,7 @@ class CFarmManager:
|
||||
logger.info(f"{level[0]}")
|
||||
|
||||
if level[0] < levelFileter:
|
||||
return f"当前用户等级不足,升级所需等级为{levelFileter}"
|
||||
return f"当前用户等级{level[0]},升级所需等级为{levelFileter}"
|
||||
|
||||
if userInfo['point'] < point:
|
||||
return f"当前用户农场币不足,升级所需农场币为{point}"
|
||||
|
||||
15
farm/shop.py
15
farm/shop.py
@ -1,5 +1,6 @@
|
||||
import math
|
||||
|
||||
from Python311.Lib._pytest.mark.structures import istestfunc
|
||||
from zhenxun.services.log import logger
|
||||
from zhenxun.utils._build_image import BuildImage
|
||||
from zhenxun.utils.image_utils import ImageTemplate
|
||||
@ -139,6 +140,10 @@ class CShopManager:
|
||||
totalSold = 0
|
||||
remainingItems = []
|
||||
|
||||
isAll = False
|
||||
if num == -1:
|
||||
isAll = True
|
||||
|
||||
items = plant.split(',')
|
||||
if len(name) <= 0:
|
||||
#出售全部
|
||||
@ -160,20 +165,26 @@ class CShopManager:
|
||||
try:
|
||||
count = int(countStr)
|
||||
if plantName == name:
|
||||
|
||||
if isAll:
|
||||
sellAmount = count
|
||||
else:
|
||||
sellAmount = min(num, count)
|
||||
|
||||
totalSold += sellAmount
|
||||
remaining = count - sellAmount
|
||||
|
||||
if remaining > 0:
|
||||
remainingItems.append(f"{plantName}|{remaining}")
|
||||
|
||||
if isAll == False:
|
||||
num -= sellAmount
|
||||
if num == 0:
|
||||
|
||||
break
|
||||
except (ValueError, TypeError):
|
||||
continue
|
||||
|
||||
if num > 0:
|
||||
if num > 0 and isAll == False:
|
||||
return f"出售作物{name}出错:数量不足"
|
||||
|
||||
#计算收益
|
||||
|
||||
Loading…
Reference in New Issue
Block a user