From d57475ffe460133d146d377e66ed19ccb77b11a7 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期一, 20 十月 2025 17:22:00 +0800
Subject: [PATCH] 121 【武将】武将系统-服务端(寻宝支持定制第x次x抽必出)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py         |    4 +++-
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerTreasure.py |   30 ++++++++++++++++++++++++++++--
 PySysDB/PySysDBPY.h                                                                          |    1 +
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py              |    1 +
 4 files changed, 33 insertions(+), 3 deletions(-)

diff --git a/PySysDB/PySysDBPY.h b/PySysDB/PySysDBPY.h
index 672e3f8..0f31164 100644
--- a/PySysDB/PySysDBPY.h
+++ b/PySysDB/PySysDBPY.h
@@ -1800,6 +1800,7 @@
 	list		GridItemRateList1;	//常规产出格子编号饼图 [[概率, 格子编号], ...]
 	list		GridItemRateList2;	//每满x次保底产出格子编号饼图 [[概率, 格子编号], ...]
 	dict		GridItemRateList3;	//第x次必出产出格子编号饼图 {次数:[[概率, 格子编号], ...], ...}
+	list		GridItemRateList4;	//第x次x抽必出
 	dict		LuckyItemRateInfo;	//幸运产出概率饼图 {"幸运值":[[概率, 格子编号], ...], ...}
 };
 
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
index 4c93c4b..4af6b30 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -3330,6 +3330,7 @@
 
 Def_PDict_TreasureFreeCount = "TreasureFreeCount_%s"  # 寻宝今日已使用免费次数, 参数(寻宝类型)
 Def_PDict_TreasureCount = "TreasureCount_%s"  # 寻宝次数, 参数(寻宝类型)
+Def_PDict_TreasureCountEx = "TreasureCountEx_%s"  # 第x次x抽必出,按第x次单抽、10连抽记录, 参数(寻宝类型)
 Def_PDict_TreasureCountToday = "TreasureCountToday_%s"  # 今日寻宝次数, 参数(寻宝类型)
 Def_PDict_TreasureLuck = "TreasureLuck_%s"  # 寻宝当前幸运值, 参数(寻宝类型)
 Def_PDict_TreasureCntAward = "TreasureCntAward_%s"  # 累计寻宝次数对应物品奖励领奖状态, 参数(寻宝类型)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py
index 9fe2fa6..b7f7580 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py
@@ -1458,6 +1458,7 @@
                         ("list", "GridItemRateList1", 0),
                         ("list", "GridItemRateList2", 0),
                         ("dict", "GridItemRateList3", 0),
+                        ("list", "GridItemRateList4", 0),
                         ("dict", "LuckyItemRateInfo", 0),
                         ),
 
@@ -4528,7 +4529,8 @@
     def GetGridItemRateList1(self): return self.attrTuple[6] # 常规产出格子编号饼图 [[概率, 格子编号], ...] list
     def GetGridItemRateList2(self): return self.attrTuple[7] # 每满x次保底产出格子编号饼图 [[概率, 格子编号], ...] list
     def GetGridItemRateList3(self): return self.attrTuple[8] # 第x次必出产出格子编号饼图 {次数:[[概率, 格子编号], ...], ...} dict
-    def GetLuckyItemRateInfo(self): return self.attrTuple[9] # 幸运产出概率饼图 {"幸运值":[[概率, 格子编号], ...], ...} dict
+    def GetGridItemRateList4(self): return self.attrTuple[9] # 第x次x抽必出 list
+    def GetLuckyItemRateInfo(self): return self.attrTuple[10] # 幸运产出概率饼图 {"幸运值":[[概率, 格子编号], ...], ...} dict
 
 # 寻宝物品库
 class IPY_TreasureItemLib():
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 1fca1bb..cebd907 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerTreasure.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerTreasure.py
@@ -78,6 +78,7 @@
             ItemControler.RecycleItem(curPlayer, costItemID, recycleItemMail)
         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TreasureFreeCount % (treasureType), 0)
         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TreasureCount % (treasureType), 0)
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TreasureCountEx % (treasureType), 0)
         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TreasureCountToday % (treasureType), 0)
         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TreasureLuck % (treasureType), 0)
         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TreasureCntAward % (treasureType), 0)
@@ -240,6 +241,20 @@
         gridNumCountInfo[int(gridNumStr)] = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TreasureGridCnt % (treasureType, gridNumStr))
     GameWorld.DebugLog("gridNumMaxLimitInfo=%s,gridNumCountInfo=%s" % (gridNumMaxLimitInfo, gridNumCountInfo), playerID)
     
+    treasureCountEx = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TreasureCountEx % (treasureType)) # 当前第x次单抽、x抽
+    curIndexCount, maxIndexCount = 0, 0
+    beSureCountByIndexDict = {}
+    beSureCountByIndexList = ipyData.GetGridItemRateList4() # 第x次x抽必出,最多支持定制到9次
+    if beSureCountByIndexList and treasureIndex < len(beSureCountByIndexList):
+        beSureCountByIndexDict = beSureCountByIndexList[treasureIndex]
+        maxIndexCount = min(9, max(beSureCountByIndexDict))
+        curIndexCount = GameWorld.GetDataByDigitPlace(treasureCountEx, treasureIndex) + 1
+    rateByIndexCount = 0 # 第x次x抽必出可产出个数
+    rateByIndexCountList = []
+    if curIndexCount <= maxIndexCount and curIndexCount in beSureCountByIndexDict:
+        rateByIndexCountList = [[10000, beSureCountByIndexDict[curIndexCount]]]
+        rateByIndexCount = 1 # 可扩展支持产出多个,暂定单次抽奖仅定制产出1个
+        
     # 单抽产出优先级: 幸运物品 > 必出 > 保底 > 普通
     # 连抽没有优先级限制,只要满足条件即可产出
     getGridResult = []
@@ -275,6 +290,13 @@
         if not curRateList and ensureCount and updTreasureCount % ensureCount == 0 and ensureRateList:
             curRateList = GetRemoveLimitGridRateList(ensureRateList, gridNumCountInfo, gridNumMaxLimitInfo)
             GameWorld.DebugLog("    【满%s次数必出饼图】: %s" % (ensureCount, curRateList), playerID)
+            
+        # 第x次x抽必出,优先级较低
+        if not curRateList and rateByIndexCountList and rateByIndexCount > 0:
+            rateByIndexCount -= 1
+            curRateList = rateByIndexCountList
+            GameWorld.DebugLog("    【第x次x抽必出】: treasureIndex=%s,curIndexCount=%s,rateByIndexCount=%s,%s" 
+                               % (treasureIndex, curIndexCount, rateByIndexCount, rateByIndexCountList), playerID)
             
         doCount = 0
         while doCount <= 50: # 限制最大次数
@@ -388,6 +410,10 @@
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TreasureLuck % (treasureType), updLuck)
     for gridNum, updCount in gridNumCountInfo.items():
         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TreasureGridCnt % (treasureType, gridNum), updCount)
+    if curIndexCount <= maxIndexCount:
+        treasureCountEx = GameWorld.ChangeDataByDigitPlace(treasureCountEx, treasureIndex, curIndexCount)
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TreasureCountEx % (treasureType), treasureCountEx)
+        GameWorld.DebugLog("更新第x次x抽次数: treasureIndex=%s,curIndexCount=%s,maxIndexCount=%s,treasureCountEx=%s" % (treasureIndex, curIndexCount, maxIndexCount, treasureCountEx))
         
     addScoreType = setIpyData.GetAwardMoneyType() # 额外奖励货币类型
     addScore = setIpyData.GetAwardMoneyValue() # 单次奖励货币数
@@ -436,8 +462,8 @@
     if mailItemList:
         PlayerControl.SendMailByKey("HappyXBUnEnough", [playerID], mailItemList)
         
-    GameWorld.DebugLog("寻宝成功: treasureType=%s,updTreasureCount=%s(%s),updLuck=%s,addScoreType=%s,addScore=%s,gridNumCountInfo=%s" 
-                       % (treasureType, updTreasureCount, updTreasureCountToday, updLuck, addScoreType, addScore, gridNumCountInfo), playerID)
+    GameWorld.DebugLog("寻宝成功: treasureType=%s,updTreasureCount=%s(%s),updLuck=%s,addScoreType=%s,addScore=%s,gridNumCountInfo=%s,treasureCountEx=%s" 
+                       % (treasureType, updTreasureCount, updTreasureCountToday, updLuck, addScoreType, addScore, gridNumCountInfo, treasureCountEx), playerID)
     GameWorld.DebugLog("    treasureResult=%s" % (treasureResult), playerID)
     GameWorld.DebugLog("    mailItemList=%s" % (mailItemList), playerID)
     

--
Gitblit v1.8.0