From b08ce201940a5a40d0ea7f5d8f794e9c591e9a40 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期一, 02 三月 2026 11:56:05 +0800
Subject: [PATCH] 121 【武将】武将系统-服务端(寻宝增加最小次数才能产出配置、增加非永久卡保底产出配置;)
---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerTreasure.py | 49 +++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 43 insertions(+), 6 deletions(-)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerTreasure.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerTreasure.py
index 81e52da..c530ab9 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerTreasure.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerTreasure.py
@@ -130,7 +130,13 @@
gridNumMaxLimitInfo = setIpyData.GetGridNumMaxLimitInfo()
for gridNumStr in gridNumMaxLimitInfo.keys():
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TreasureGridCnt % (treasureType, int(gridNumStr)), 0)
-
+
+ houseList = IpyGameDataPY.GetIpyGameDataList("TreasureHouse", treasureType)
+ if houseList:
+ for hourseIpyData in houseList:
+ for gridNum in hourseIpyData.GetAtLeastCntLimitInfo().items():
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TreasureAtleastCnt % (treasureType, gridNum), 0)
+
Sync_TreasureInfo(curPlayer, treasureTypeList)
return
@@ -379,7 +385,17 @@
return
setLuckyGridNum = setIpyData.GetLuckyGridNum() # 标的格子
- luckyItemRateInfo = ipyData.GetLuckyItemRateInfo()
+ atLeastCntLimitInfo = ipyData.GetAtLeastCntLimitInfo() # 至少需要幸运产出概率饼图 {"幸运值":[[概率, 格子编号], ...], ...}
+ atLeastCntLimitDict = {}
+ for gridNum, needAtLeastCnt in atLeastCntLimitInfo.items():
+ curAtLeastCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TreasureAtleastCnt % (treasureType, gridNum))
+ atLeastCntLimitDict[gridNum] = [curAtLeastCnt, needAtLeastCnt]
+ GameWorld.DebugLog("atLeastCntLimitDict=%s" % (atLeastCntLimitDict), playerID)
+ luckyItemRateInfo = ipyData.GetLuckyItemRateInfo() # 幸运产出概率饼图 {"幸运值":[[概率, 格子编号], ...], ...}
+ if treasureType in TreasureType_HeroCallList:
+ if not PlayerGoldInvest.GetInvestState(curPlayer, ChConfig.InvestType_Life):
+ luckyItemRateInfo = ipyData.GetLuckyItemRateInfoEx()
+ GameWorld.DebugLog("终身卡未开通,武将招募使用内置保底", playerID)
luckyItemRateDict = {int(k):v for k, v in luckyItemRateInfo.items()}
luckyValueList = sorted(luckyItemRateDict.keys())
luckyGridNumList = [] # 幸运格子编号列表
@@ -388,10 +404,7 @@
maxLuck = max(luckyValueList) if luckyValueList else 0 # 满幸运值
updLuck = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TreasureLuck % (treasureType)) # 当前幸运值
GameWorld.DebugLog("updLuck=%s,maxLuck=%s,setLuckyGridNum=%s,luckyItemRateDict=%s" % (updLuck, maxLuck, setLuckyGridNum, luckyItemRateDict), playerID)
- if treasureType in TreasureType_HeroCallList and not PlayerGoldInvest.GetInvestState(curPlayer, ChConfig.InvestType_Life):
- addLuck = 0
- GameWorld.DebugLog("终身卡未开通,武将招募不增加幸运", playerID)
-
+
curTreasureCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TreasureCount % (treasureType)) # 当前已寻宝次数
updTreasureCount = curTreasureCount
@@ -529,18 +542,30 @@
curRateList = GetRemoveLimitGridRateList(ensureRateList, gridNumCountInfo, gridNumMaxLimitInfo)
GameWorld.DebugLog(" 【满%s次数必出饼图】: %s" % (ensureCount, curRateList), playerID)
+ isNormalRate = False
doCount = 0
while doCount <= 50: # 限制最大次数
doCount += 1
if doCount > 1 or not curRateList: # 重新随机的默认使用常规饼图
curRateList = commItemRateList
GameWorld.DebugLog(" 使用常规饼图=%s" % curRateList, playerID)
+ isNormalRate = True
gridNum = GameWorld.GetResultByRandomList(curRateList)
if gridNum in luckyGridNumList and gridNum in getGridResult:
GameWorld.DebugLog(" 幸运物品已经出过,不再重复产出重新随机! gridNum=%s in %s" % (gridNum, getGridResult), playerID)
continue
+ # 常规概率的额外逻辑
+ if isNormalRate:
+ # 验证至少所需次数限制
+ if gridNum in atLeastCntLimitDict:
+ curAtLeastCnt, needAtLeastCnt = atLeastCntLimitDict[gridNum]
+ if curAtLeastCnt < needAtLeastCnt:
+ GameWorld.DebugLog(" 该格子未达到最小寻宝次数不产出! gridNum=%s,curAtLeastCnt=%s < %s"
+ % (gridNum, curAtLeastCnt, needAtLeastCnt), playerID)
+ continue
+
# 心愿库物品,检查心愿预产出
gridNumStr = str(gridNum)
wishLibID = 0
@@ -575,6 +600,16 @@
if gridNum in gridNumCountInfo:
gridNumCountInfo[gridNum] = gridNumCountInfo[gridNum] + 1
GameWorld.DebugLog(" 【更新产出次数】: gridNum=%s, %s" % (gridNum, gridNumCountInfo), playerID)
+
+ for gNum, atLeastInfo in atLeastCntLimitDict.items():
+ curAtLeastCnt, needAtLeastCnt = atLeastInfo
+ if gNum == gridNum:
+ curAtLeastCnt = 0
+ else:
+ curAtLeastCnt += 1
+ atLeastCntLimitDict[gNum] = [curAtLeastCnt, needAtLeastCnt]
+ GameWorld.DebugLog(" 更新最少所需次数进度: gridNum=%s,%s/%s" % (gNum, curAtLeastCnt, needAtLeastCnt), playerID)
+
break
GameWorld.DebugLog("寻宝格子结果: getGridResult=%s" % getGridResult, playerID)
@@ -682,6 +717,8 @@
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TreasureCount % (treasureType), updTreasureCount)
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TreasureCountTodayGold % (treasureType), updTreasureCountTodayGold)
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TreasureLuck % (treasureType), updLuck)
+ for gridNum, atLeastInfo in atLeastCntLimitDict.items():
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TreasureAtleastCnt % (treasureType, gridNum), atLeastInfo[0])
for gridNum, updCount in gridNumCountInfo.items():
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TreasureGridCnt % (treasureType, gridNum), updCount)
if curIndexCount <= maxIndexCount:
--
Gitblit v1.8.0