From a49287c1591671d95952114f04db742c1507de13 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 20 八月 2024 15:01:53 +0800
Subject: [PATCH] 10223 10238 10241 【越南】【砍树】【主干】【港台】仙匣秘境、骑宠养成、古宝养成增加可配置是否关联跨服活动;

---
 ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossBillboard.py |   75 ++++++++++++++++++++++++++++++-------
 1 files changed, 61 insertions(+), 14 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossBillboard.py b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossBillboard.py
index 81b335e..ccb8aa3 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossBillboard.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossBillboard.py
@@ -122,10 +122,10 @@
     def GetGroupValue2(self): return self.__groupValue2
     
     def ClearData(self):
-        GameWorld.Log("CrossBillboard ClearData billboardType=%s,groupValue1=%s,groupValue2=%s" 
-                      % (self.__billboardType, self.__groupValue1, self.__groupValue2))
+        GameWorld.Log("CrossBillboard ClearData billboardType=%s,groupValue1=%s,groupValue2=%s,dataCount=%s" 
+                      % (self.__billboardType, self.__groupValue1, self.__groupValue2, len(self.__billboardList)))
         if GameWorld.IsCrossServer():
-            self.SaveDRData()
+            self.SaveDRData("Clear")
         self.__billboardList = [] # [tagDBCrossBillboard, ...] 
         self.__idOrderDict = {} # {id:名次, ...}
         
@@ -169,16 +169,25 @@
         order = idOrderDict[findID]
         return order - 1
     
-    def SaveDRData(self):
+    def SaveDRData(self, eventName="", addDataDict={}):
         ## 记录流向数据
-        eventTypeName = "CrossBillboard_%s" % (self.__billboardType)
-        drDict = {"BillboardType":self.__billboardType, "GroupValue1":self.__groupValue1, "GroupValue2":self.__groupValue2, 
-                  "DataCount":len(self.__billboardList)}
-        DataRecordPack.SendEventPack(eventTypeName, drDict)
-        for billboardData in self.__billboardList:
-            dataDict = {"BillboardType":billboardData.BillboardType, "GroupValue1":billboardData.GroupValue1, 
-                        "GroupValue2":billboardData.GroupValue2, "Type2":billboardData.Type2,
-                        "ID":billboardData.ID, "ID2":billboardData.ID2,
+        
+        dataCount = len(self.__billboardList)
+        if not dataCount:
+            return
+        
+        serverTime = GameWorld.GetServerTime()
+        timeStr = "%02d%02d%02d%s" % (serverTime.hour, serverTime.minute, serverTime.second, str(serverTime.microsecond)[:3])
+        eventTypeStr = "Billboard_%s_%s_%s_%s_%s" % (self.__billboardType, self.__groupValue1, self.__groupValue2, eventName, timeStr)
+        
+        dataDict = {"BillboardType":self.__billboardType, "DataCount":dataCount, "addDataDict":addDataDict,
+                    "GroupValue1":self.__groupValue1, "GroupValue2":self.__groupValue2}
+        DataRecordPack.SendEventPack(eventTypeStr, dataDict)
+        
+        for index, billboardData in enumerate(self.__billboardList):
+            rank = index + 1
+            dataDict = {"Type2":billboardData.Type2, "Rank":rank,
+                        "ID":billboardData.ID, "ID2":billboardData.ID2,  
                         "Name1":billboardData.Name1, "Name2":billboardData.Name2,
                         "Value1":billboardData.Value1, "Value2":billboardData.Value2,
                         "Value3":billboardData.Value3, "Value4":billboardData.Value4,
@@ -186,7 +195,7 @@
                         "Value7":billboardData.Value7, "Value8":billboardData.Value8,
                         "CmpValue":billboardData.CmpValue, "CmpValue2":billboardData.CmpValue2, 
                         "CmpValue3":billboardData.CmpValue3, "UserData":billboardData.UserData}
-            DataRecordPack.SendEventPack(eventTypeName, dataDict)
+            DataRecordPack.SendEventPack(eventTypeStr, dataDict)
         return
     
     def GetBillboardDataList(self): return self.__billboardList
@@ -273,10 +282,12 @@
 def CopyBillboardOnDay():
     billboardMgr = PyDataManager.GetCrossBillboardManager()
     for billboardType in ShareDefine.CrossBillboardTypeList:
+        if billboardType in [ShareDefine.Def_CBT_BossTrialSubmitBak, ShareDefine.Def_CBT_BossTrialSubmitFamilyBak]:
+            continue
         groupList = billboardMgr.GetBillboardGroupList(billboardType)
         for billboardType, groupValue1, groupValue2 in groupList:
             billboardObj = billboardMgr.GetCrossBillboard(billboardType, groupValue1, groupValue2)
-            billboardObj.SaveDRData()
+            billboardObj.SaveDRData("OnDay")
     return
 
 def CopyBillboard(fromBillboardType, toBillboardType):
@@ -318,6 +329,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

--
Gitblit v1.8.0