mirror of
https://github.com/Shu-Ying/main_plugin_farm.git
synced 2026-10-31 06:49:59 +08:00
🎨 添加收获次数判断作物升星,一二三四五星作物写入库中
This commit is contained in:
@@ -384,7 +384,7 @@ class CUserSoilDB(CSqlManager):
|
||||
if soilInfo and soilInfo.get("plantName"):
|
||||
return False
|
||||
|
||||
# 获取植物配置
|
||||
# 获取植物配置""" """
|
||||
plantCfg = await g_pDBService.plant.getPlantByName(plantName)
|
||||
if not plantCfg:
|
||||
logger.error(f"未知植物: {plantName}")
|
||||
@@ -404,6 +404,20 @@ class CUserSoilDB(CSqlManager):
|
||||
async with cls._transaction():
|
||||
prev = soilInfo or {}
|
||||
await cls._deleteUserSoil(uid, soilIndex)
|
||||
# 根据此植物收获次数对其星级进行升级
|
||||
if g_pDBService.plant.existsPlant("一星" + plantName):
|
||||
harvestCounts = (
|
||||
await g_pDBService.userPlantCount.getUserPlantCountByPlantName(
|
||||
uid, plantName
|
||||
)
|
||||
)
|
||||
if harvestCounts >= 350:
|
||||
plantName = "一星" + plantName
|
||||
if harvestCounts >= 700:
|
||||
plantName = "二星" + plantName
|
||||
if harvestCounts >= 1200:
|
||||
plantName = "三星" + plantName
|
||||
|
||||
await cls._insertUserSoil(
|
||||
{
|
||||
"uid": uid,
|
||||
|
||||
Reference in New Issue
Block a user