From babddd65bd1fa02b4e4ba7ca399e05fe476abcef Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 25 六月 2024 16:15:52 +0800
Subject: [PATCH] 10185 【越南】【港台】【主干】BOSS凭证修改(优化凭证榜单奖励结算;优化榜单备份;)

---
 ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerActBossTrial.py      |  188 +++++++++++++++++++------------------
 ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_QueryBillboard.py |   19 ++-
 ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossBillboard.py  |   40 +++++++
 3 files changed, 147 insertions(+), 100 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_QueryBillboard.py b/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_QueryBillboard.py
index 6c24b99..8c6485e 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_QueryBillboard.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_QueryBillboard.py
@@ -38,7 +38,9 @@
     if billType != None:
         billBoardType = billType
     
-    topNum = GameWorld.ToIntDef(gmCmdDict.get('topNum', ''), 10)
+    queryCount = GameWorld.ToIntDef(gmCmdDict.get('queryCount', ''), 10)
+    startRank = GameWorld.ToIntDef(gmCmdDict.get('startRank', ''), 1)
+    startRank = max(1, startRank)
     
     if billBoardType == None:
         GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_TypeNumErr)
@@ -52,19 +54,22 @@
     if not billBoard:
         GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_TypeNumErr)
         return False
-
-    billBoardInfo = []
     
-    for index in range(0, billBoard.GetCount()):
-        
-        if index >= topNum:
+    dataTotal = billBoard.GetCount()
+    fromIndex = startRank - 1
+    toIndex = fromIndex + queryCount
+    billBoardInfo = []
+    for index in xrange(fromIndex, toIndex):
+        if index >= dataTotal:
             break
         
         billBoardData = billBoard.At(index)
         if not billBoardData:
             continue
         
+        rank = index + 1
         billBoardDict = {
+                        "Rank":rank,
                         "ID":billBoardData.GetID(),
                         "ID2":billBoardData.GetID2(),
                         "Name1":billBoardData.GetName1(),
@@ -91,7 +96,7 @@
         GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_MaxLimit)   
         return
     
-    backMsg = {"BillBoardType":billBoardType, "BillBoardInfo":billBoardInfo}
+    backMsg = {"BillBoardType":billBoardType, "BillBoardInfo":billBoardInfo, "dataTotal":dataTotal}
     #执行成功
     GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_Success, backMsg)        
     return
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossBillboard.py b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossBillboard.py
index 81b335e..4e12dba 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossBillboard.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossBillboard.py
@@ -175,10 +175,10 @@
         drDict = {"BillboardType":self.__billboardType, "GroupValue1":self.__groupValue1, "GroupValue2":self.__groupValue2, 
                   "DataCount":len(self.__billboardList)}
         DataRecordPack.SendEventPack(eventTypeName, drDict)
-        for billboardData in self.__billboardList:
+        for index, billboardData in enumerate(self.__billboardList):
             dataDict = {"BillboardType":billboardData.BillboardType, "GroupValue1":billboardData.GroupValue1, 
                         "GroupValue2":billboardData.GroupValue2, "Type2":billboardData.Type2,
-                        "ID":billboardData.ID, "ID2":billboardData.ID2,
+                        "ID":billboardData.ID, "ID2":billboardData.ID2, "Place":index,  
                         "Name1":billboardData.Name1, "Name2":billboardData.Name2,
                         "Value1":billboardData.Value1, "Value2":billboardData.Value2,
                         "Value3":billboardData.Value3, "Value4":billboardData.Value4,
@@ -318,6 +318,42 @@
             
     return
 
+def CopyBillboardEx(fromBillboardType, toBillboardType, groupValue1, groupValue2=0):
+    ## 将某个类型的榜单完全拷贝到其他榜单 - 一般用于备份、转移数据
+    
+    billboardMgr = PyDataManager.GetCrossBillboardManager()
+    frbillboardObj = billboardMgr.GetCrossBillboard(fromBillboardType, groupValue1, groupValue2)
+    toBillboardObj = billboardMgr.GetCrossBillboard(toBillboardType, groupValue1, groupValue2)
+    toBillboardObj.ClearData()
+    GameWorld.Log("CopyBillboardEx: fromBillboardType=%s,toBillboardType=%s,groupValue1=%s,groupValue2=%s" 
+                  % (fromBillboardType, toBillboardType, groupValue1, groupValue2))
+    for frbillboardData in frbillboardObj.GetBillboardDataList():
+        tobillboardData = PyGameDataStruct.tagDBCrossBillboard()
+        tobillboardData.GroupValue1 = groupValue1
+        tobillboardData.GroupValue2 = groupValue2
+        tobillboardData.BillboardType = toBillboardType
+        tobillboardData.ID = frbillboardData.ID
+        tobillboardData.ID2 = frbillboardData.ID2
+        tobillboardData.Name1 = frbillboardData.Name1
+        tobillboardData.Name2 = frbillboardData.Name2
+        tobillboardData.Type2 = frbillboardData.Type2
+        tobillboardData.Value1 = frbillboardData.Value1
+        tobillboardData.Value2 = frbillboardData.Value2
+        tobillboardData.Value3 = frbillboardData.Value3
+        tobillboardData.Value4 = frbillboardData.Value4
+        tobillboardData.Value5 = frbillboardData.Value5
+        tobillboardData.Value6 = frbillboardData.Value6
+        tobillboardData.Value7 = frbillboardData.Value7
+        tobillboardData.Value8 = frbillboardData.Value8
+        tobillboardData.UserData = frbillboardData.UserData
+        tobillboardData.DataLen = len(tobillboardData.UserData)
+        tobillboardData.CmpValue = frbillboardData.CmpValue
+        tobillboardData.CmpValue2 = frbillboardData.CmpValue2
+        tobillboardData.CmpValue3 = frbillboardData.CmpValue3
+        toBillboardObj.AddBillboardData(tobillboardData)
+        
+    return
+
 #// C0 04 查看跨服排行榜 #tagCGViewCrossBillboard
 #
 #struct    tagCGViewCrossBillboard
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerActBossTrial.py b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerActBossTrial.py
index f19b272..6b9f197 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerActBossTrial.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerActBossTrial.py
@@ -50,10 +50,19 @@
     if not cfgID:
         return
     BillboardType = ShareDefine.Def_BT_BossTrialSubmit
-    billBoard = GameWorld.GetBillboard().FindBillboard(BillboardType)
+    templateID = GameWorld.GetTemplateID(ipyData, cfgID, dayIndex)
+    __OnEndAward_Personal(templateID, BillboardType)
+    
+    DataRecordPack.DR_BillboardData(BillboardType, "BossTrial", {"actNum":actNum, "cfgID":cfgID, "dayIndex":dayIndex, "templateID":templateID})
+    PlayerBillboard.CopyBillboard(ShareDefine.Def_BT_BossTrialSubmitBak, BillboardType)
+    PlayerBillboard.ClearBillboardByIndex(BillboardType)
+    GameWorld.Log("=================================================================================")
+    return
+
+def __OnEndAward_Personal(templateID, billboardType):
+    billBoard = GameWorld.GetBillboard().FindBillboard(billboardType)
     if not billBoard:
         return
-    templateID = GameWorld.GetTemplateID(ipyData, cfgID, dayIndex)
     if not templateID:
         GameWorld.Log("本次活动没有个人榜奖励!")
         return
@@ -87,10 +96,6 @@
         
         PlayerCompensation.SendMailByKey("BossTrialMail10", [playerID], awardItemList, [rank])
         
-    DataRecordPack.DR_BillboardData(BillboardType, "BossTrial", {"actNum":actNum, "cfgID":cfgID, "dayIndex":dayIndex, "templateID":templateID})
-    PlayerBillboard.CopyBillboard(ShareDefine.Def_BT_BossTrialSubmitBak, BillboardType)
-    PlayerBillboard.ClearBillboardByIndex(BillboardType)
-    GameWorld.Log("=================================================================================")
     return
 
 def OnGiveFamilyOrderAwawrd(actNum, ipyData, dayIndex):
@@ -100,11 +105,19 @@
     if not cfgID:
         return
     BillboardType = ShareDefine.Def_BT_BossTrialSubmitFamily
-    billBoard = GameWorld.GetBillboard().FindBillboard(BillboardType)
+    templateID = GameWorld.GetTemplateIDByList(ipyData.GetFamilyTemplateIDList(), dayIndex)
+    __OnEndAward_Family(templateID, BillboardType)
+    
+    DataRecordPack.DR_BillboardData(BillboardType, "BossTrial", {"actNum":actNum, "cfgID":cfgID, "dayIndex":dayIndex, "templateID":templateID})
+    PlayerBillboard.CopyBillboard(ShareDefine.Def_BT_BossTrialSubmitFamilyBak, BillboardType)
+    PlayerBillboard.ClearBillboardByIndex(BillboardType)
+    GameWorld.Log("=================================================================================")
+    return
+
+def __OnEndAward_Family(templateID, billboardType):
+    billBoard = GameWorld.GetBillboard().FindBillboard(billboardType)
     if not billBoard:
         return
-    templateIDList = ipyData.GetFamilyTemplateIDList()
-    templateID = GameWorld.GetTemplateIDByList(templateIDList, dayIndex)
     if not templateID:
         GameWorld.Log("本次活动没有仙盟榜奖励!")
         return
@@ -140,6 +153,7 @@
         
         familyActionData = GetFamilyBossTrialSubmitActionData(familyID, False)
         if not familyActionData:
+            GameWorld.ErrLog("该仙盟没有提交凭证ActionData! familyID=%s" % familyID)
             continue
         awardState = GetFamilyAwardState(familyActionData)
         awardIndex = 0 # 本服奖励状态索引
@@ -170,10 +184,6 @@
         GameWorld.Log("发放boss历练活动仙盟榜单奖励本服: familyID=%s,名次=%s,总提交个数=%s,updAwardState=%s,awardMemIDList=%s,memSubCountDict=%s" 
                       % (familyID, familyRank, cmpValue, updAwardState, awardMemIDList, memSubCountDict))
         
-    DataRecordPack.DR_BillboardData(BillboardType, "BossTrial", {"actNum":actNum, "cfgID":cfgID, "dayIndex":dayIndex, "templateID":templateID})
-    PlayerBillboard.CopyBillboard(ShareDefine.Def_BT_BossTrialSubmitFamilyBak, BillboardType)
-    PlayerBillboard.ClearBillboardByIndex(BillboardType)
-    GameWorld.Log("=================================================================================")
     return
 
 def MapServer_BossTrial(curPlayer, msgList):
@@ -322,6 +332,7 @@
         
         familyActionData = GetFamilyBossTrialSubmitActionData(familyID, False)
         if not familyActionData:
+            GameWorld.ErrLog("该仙盟没有提交凭证ActionData! familyID=%s" % familyID)
             continue
         awardState = GetFamilyAwardState(familyActionData)
         awardIndex = 1 #跨服奖励状态索引
@@ -408,11 +419,8 @@
         PersonalTemplateID = ipyData.GetPersonalTemplateID()
         FamilyTemplateID = ipyData.GetFamilyTemplateID()
         
-        if PersonalTemplateID:
-            __GiveCrossOrderAwardPersonal(cfgID, zoneID, PersonalTemplateID)
-            
-        if FamilyTemplateID:
-            __GiveCrossOrderAwardFamily(cfgID, zoneID, FamilyTemplateID)
+        __GiveCrossOrderAwardPersonal(cfgID, zoneID, PersonalTemplateID, ShareDefine.Def_CBT_BossTrialSubmit)
+        __GiveCrossOrderAwardFamily(cfgID, zoneID, FamilyTemplateID, ShareDefine.Def_CBT_BossTrialSubmitFamily)
             
     # 如果有新活动,处理新活动
     if not state:
@@ -429,110 +437,108 @@
         
     return
     
-def __GiveCrossOrderAwardPersonal(cfgID, zoneID, templateID):
+def __GiveCrossOrderAwardPersonal(cfgID, zoneID, templateID, billboardType):
     
     groupValue1 = zoneID
-    billboardType = ShareDefine.Def_CBT_BossTrialSubmit
+    #billboardType = ShareDefine.Def_CBT_BossTrialSubmit #榜单类型改为参数传入,异常情况下可特殊处理用备份榜单发奖励
     billboardMgr = PyDataManager.GetCrossBillboardManager()
     billboardObj = billboardMgr.GetCrossBillboard(billboardType, groupValue1)
     billboardDataCount = billboardObj.GetCount()
     if not billboardDataCount:
-        GameWorld.Log("跨服Boss凭证个人排行数据为空! billboardType=%s,cfgID=%s,zoneID=%s,templateID=%s" % (billboardType, cfgID, zoneID, templateID))
+        GameWorld.Log("跨服Boss凭证个人排行数据为空! billboardType=%s,zoneID=%s,cfgID=%s,templateID=%s" % (billboardType, zoneID, cfgID, templateID))
         return
     
     # 结算时排序并保存榜单数据流向
     billboardObj.SortData()
     
-    GameWorld.Log("结算跨服Boss凭证个人排行奖励: billboardType=%s,cfgID=%s,zoneID=%s,templateID=%s,billboardDataCount=%s" 
-                  % (billboardType, cfgID, zoneID, templateID, billboardDataCount))
+    GameWorld.Log("结算跨服Boss凭证个人排行奖励: billboardType=%s,zoneID=%s,cfgID=%s,templateID=%s,billboardDataCount=%s" 
+                  % (billboardType, zoneID, cfgID, templateID, billboardDataCount))
     
     orderIpyDataList = IpyGameDataPY.GetIpyGameDataList("ActBossTrialTemplate", templateID)
-    if not orderIpyDataList:
-        return
-    
-    rankPre = 0
-    billboardIndex = 0
-    for ipyData in orderIpyDataList:
-        rank = ipyData.GetRank()
-        awardItemList = ipyData.GetAwardItemList()
-        orderCountTotal = rank - rankPre # 奖励名次数量
-        rankPre = rank
-        orderCount = 0
-        
-        for index in xrange(billboardIndex, billboardDataCount):
-            if orderCount >= orderCountTotal:
-                break
+    if orderIpyDataList:
+        rankPre = 0
+        billboardIndex = 0
+        for ipyData in orderIpyDataList:
+            rank = ipyData.GetRank()
+            awardItemList = ipyData.GetAwardItemList()
+            orderCountTotal = rank - rankPre # 奖励名次数量
+            rankPre = rank
+            orderCount = 0
             
-            billboardData = billboardObj.At(index)
-            playerID = billboardData.ID
-            name2 = billboardData.Name2
-            cmpValue = billboardData.CmpValue
-            
-            playerRank = index + 1
-            GameWorld.Log("    发放boss历练个人榜单奖励: rank=%s,playerID=%s,cmpValue=%s,awardItemList=%s, %s" 
-                          % (rank, playerID, cmpValue, awardItemList, name2))
-            PlayerCompensation.SendMailByKey("BossTrialCrossPlayer", [playerID], awardItemList, [playerRank], crossMail=True)
-            
-            orderCount += 1
-            billboardIndex += 1
-            
+            for index in xrange(billboardIndex, billboardDataCount):
+                if orderCount >= orderCountTotal:
+                    break
+                
+                billboardData = billboardObj.At(index)
+                playerID = billboardData.ID
+                name2 = billboardData.Name2
+                cmpValue = billboardData.CmpValue
+                
+                playerRank = index + 1
+                GameWorld.Log("    发放boss历练个人榜单奖励: rank=%s,playerID=%s,cmpValue=%s,awardItemList=%s, %s" 
+                              % (rank, playerID, cmpValue, awardItemList, name2))
+                PlayerCompensation.SendMailByKey("BossTrialCrossPlayer", [playerID], awardItemList, [playerRank], crossMail=True)
+                
+                orderCount += 1
+                billboardIndex += 1
+                
     # 结算完备份、清除榜单数据
-    CrossBillboard.CopyBillboard(billboardType, ShareDefine.Def_CBT_BossTrialSubmitBak)
-    billboardObj.ClearData()
+    if billboardType == ShareDefine.Def_CBT_BossTrialSubmit:
+        CrossBillboard.CopyBillboardEx(billboardType, ShareDefine.Def_CBT_BossTrialSubmitBak, groupValue1)
+        billboardObj.ClearData()
     return
 
-def __GiveCrossOrderAwardFamily(cfgID, zoneID, templateID):
+def __GiveCrossOrderAwardFamily(cfgID, zoneID, templateID, billboardType):
     
     groupValue1 = zoneID
-    billboardType = ShareDefine.Def_CBT_BossTrialSubmitFamily
+    #billboardType = ShareDefine.Def_CBT_BossTrialSubmitFamily
     billboardMgr = PyDataManager.GetCrossBillboardManager()
     billboardObj = billboardMgr.GetCrossBillboard(billboardType, groupValue1)
     billboardDataCount = billboardObj.GetCount()
     if not billboardDataCount:
-        GameWorld.Log("跨服Boss凭证仙盟排行数据为空! billboardType=%s,cfgID=%s,zoneID=%s,templateID=%s" % (billboardType, cfgID, zoneID, templateID))
+        GameWorld.Log("跨服Boss凭证仙盟排行数据为空! billboardType=%s,zoneID=%s,cfgID=%s,templateID=%s" % (billboardType, zoneID, cfgID, templateID))
         return
     
     # 结算时排序并保存榜单数据流向
     billboardObj.SortData()
     
-    GameWorld.Log("结算跨服Boss凭证仙盟排行奖励: billboardType=%s,cfgID=%s,zoneID=%s,templateID=%s,billboardDataCount=%s" 
-                  % (billboardType, cfgID, zoneID, templateID, billboardDataCount))
+    GameWorld.Log("结算跨服Boss凭证仙盟排行奖励: billboardType=%s,zoneID=%s,cfgID=%s,templateID=%s,billboardDataCount=%s" 
+                  % (billboardType, zoneID, cfgID, templateID, billboardDataCount))
     
     orderIpyDataList = IpyGameDataPY.GetIpyGameDataList("ActBossTrialTemplate", templateID)
-    if not orderIpyDataList:
-        return
-    
-    awardFamilyList = []
-    rankPre = 0
-    billboardIndex = 0
-    for ipyData in orderIpyDataList:
-        rank = ipyData.GetRank()
-        leaderAwardItemList = ipyData.GetAwardItemList()
-        memAwardItemList = ipyData.GetMemAwardItemList()
-        orderCountTotal = rank - rankPre # 奖励名次数量
-        rankPre = rank
-        orderCount = 0
+    if orderIpyDataList:
+        awardFamilyList = []
+        rankPre = 0
+        billboardIndex = 0
+        for ipyData in orderIpyDataList:
+            rank = ipyData.GetRank()
+            leaderAwardItemList = ipyData.GetAwardItemList()
+            memAwardItemList = ipyData.GetMemAwardItemList()
+            orderCountTotal = rank - rankPre # 奖励名次数量
+            rankPre = rank
+            orderCount = 0
+            
+            for index in xrange(billboardIndex, billboardDataCount):
+                if orderCount >= orderCountTotal:
+                    break
+                
+                billboardData = billboardObj.At(index)
+                familyID = billboardData.ID
+                familySubmitTotal = billboardData.CmpValue
+                
+                familyRank = index + 1
+                GameWorld.Log("    familyID=%s,名次=%s,总提交个数=%s" % (familyID, familyRank, familySubmitTotal))
+                awardFamilyList.append([familyID, familyRank, familySubmitTotal, leaderAwardItemList, memAwardItemList])
+                orderCount += 1
+                billboardIndex += 1
+                
+        # 广播子服发放奖励
+        sendMsg = {"cfgID":cfgID, "zoneID":zoneID, "templateID":templateID, "awardFamilyList":awardFamilyList}
+        CrossRealmMsg.SendMsgToClientServer(ShareDefine.CrossServerMsg_CrossBossTrialFamilyAward, sendMsg)
         
-        for index in xrange(billboardIndex, billboardDataCount):
-            if orderCount >= orderCountTotal:
-                break
-            
-            billboardData = billboardObj.At(index)
-            familyID = billboardData.ID
-            familySubmitTotal = billboardData.CmpValue
-            
-            familyRank = index + 1
-            GameWorld.Log("    familyID=%s,名次=%s,总提交个数=%s" % (familyID, familyRank, familySubmitTotal))
-            awardFamilyList.append([familyID, familyRank, familySubmitTotal, leaderAwardItemList, memAwardItemList])
-            orderCount += 1
-            billboardIndex += 1
-            
-    # 广播子服发放奖励
-    sendMsg = {"cfgID":cfgID, "zoneID":zoneID, "templateID":templateID, "awardFamilyList":awardFamilyList}
-    CrossRealmMsg.SendMsgToClientServer(ShareDefine.CrossServerMsg_CrossBossTrialFamilyAward, sendMsg)
-    
     # 结算完备份、清除榜单数据
-    CrossBillboard.CopyBillboard(billboardType, ShareDefine.Def_CBT_BossTrialSubmitFamilyBak)
-    billboardObj.ClearData()
+    if billboardType == ShareDefine.Def_CBT_BossTrialSubmitFamily:
+        CrossBillboard.CopyBillboardEx(billboardType, ShareDefine.Def_CBT_BossTrialSubmitFamilyBak, groupValue1)
+        billboardObj.ClearData()
     return
 

--
Gitblit v1.8.0