From 1ea23ac831a440e8eb302b199ab1abdadfec184c Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期四, 11 四月 2024 16:30:49 +0800
Subject: [PATCH] 10019 【砍树】回合战斗(增加buff被动效果ID 4543、4544、4545、4546;) 1. 增加buff被动效果ID4543: 被暴击附加额外伤害百分比; 2. 增加buff被动效果ID4544: 触发时减少buff层数; 3. 增加buff被动效果ID4545: 灵宠技能释放成功触发技能; 4. 增加buff被动效果ID4546: 灵宠释放技能后触发删除本buff; 5. 技能被动效果ID 5000,支持每X回合配置; 6. buff替换方式增加方式3 - 只取最高,相同或低级的则不处理,减少长时buff无用的重复添加逻辑;

---
 ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossBillboard.py |   64 ++++++++++++++++++++++++++++++--
 1 files changed, 60 insertions(+), 4 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossBillboard.py b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossBillboard.py
index 9eb6861..56014c3 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossBillboard.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossBillboard.py
@@ -61,6 +61,13 @@
             self.__billboardDict[key] = billboardObj
         return billboardObj
     
+    def RemoveBillboard(self, billboardType):
+        ## 移除某个类型的榜单所有数据
+        for key in self.__billboardDict.keys():
+            if key[0] == billboardType:
+                self.__billboardDict.pop(key)
+        return
+    
     # 保存数据 存数据库和realtimebackup
     def GetSaveData(self):
         savaData = ""
@@ -118,6 +125,8 @@
     def ClearData(self):
         GameWorld.Log("CrossBillboard ClearData billboardType=%s,groupValue1=%s,groupValue2=%s" 
                       % (self.__billboardType, self.__groupValue1, self.__groupValue2))
+        if GameWorld.IsCrossServer():
+            self.SaveDRData()
         self.__billboardList = [] # [tagDBCrossBillboard, ...] 
         self.__idOrderDict = {} # {id:名次, ...}
         
@@ -240,6 +249,46 @@
             
         return
 
+def CopyBillboardOnDay():
+    billboardMgr = PyDataManager.GetCrossBillboardManager()
+    for billboardType in ShareDefine.CrossBillboardTypeList:
+        groupList = billboardMgr.GetBillboardGroupList(billboardType)
+        for billboardType, groupValue1, groupValue2 in groupList:
+            billboardObj = billboardMgr.GetCrossBillboard(billboardType, groupValue1, groupValue2)
+            billboardObj.SaveDRData()
+    return
+
+def CopyBillboard(fromBillboardType, toBillboardType):
+    ## 将某个类型的榜单完全拷贝到其他榜单 - 一般用于备份、转移数据
+    
+    billboardMgr = PyDataManager.GetCrossBillboardManager()
+    billboardMgr.RemoveBillboard(toBillboardType) # 默认清空目标榜单
+    
+    groupList = billboardMgr.GetBillboardGroupList(fromBillboardType)
+    for billboardType, groupValue1, groupValue2 in groupList:
+        frbillboardObj = billboardMgr.GetCrossBillboard(billboardType, groupValue1, groupValue2)
+        toBillboardObj = billboardMgr.GetCrossBillboard(toBillboardType, groupValue1, groupValue2)
+        GameWorld.Log("CopyCrossBillboard: billboardType=%s,toBillboardType=%s,groupValue1=%s,groupValue2=%s" 
+                      % (billboardType, 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.CmpValue = frbillboardData.CmpValue
+            tobillboardData.CmpValue2 = frbillboardData.CmpValue2
+            tobillboardData.CmpValue3 = frbillboardData.CmpValue3
+            toBillboardObj.AddBillboardData(tobillboardData)
+            
+    return
+
 #// C0 04 查看跨服排行榜 #tagCGViewCrossBillboard
 #
 #struct    tagCGViewCrossBillboard
@@ -282,10 +331,14 @@
     SyncCrossBillboardToClientServer(billboardType, groupValue1, groupValue2, [serverGroupID], queryData)
     return
 
-def SyncCrossBillboardToClientServer(billboardType, groupValue1, groupValue2, serverGroupIDList=[], queryData={}):
+def SyncCrossBillboardToClientServer(billboardType, groupValue1, groupValue2, serverGroupIDList=None, queryData=None):
     ## 同步跨服榜单到子服
     if not GameWorld.IsCrossServer():
         return
+    if serverGroupIDList == None:
+        serverGroupIDList = []
+    if queryData == None:
+        queryData = {}
     billboardMgr = PyDataManager.GetCrossBillboardManager()
     billboardObj = billboardMgr.GetCrossBillboard(billboardType, groupValue1, groupValue2)
     crossServerDataVer = billboardObj.GetCrossServerDataVer()
@@ -455,7 +508,7 @@
     return
 
 def UpdCrossBillboard(billboardType, groupValue1, dataID, name1, name2, type2, value1, value2, cmpValue,
-                      cmpValue2=0, cmpValue3=0, groupValue2=0, id2=0, autoSort=True):
+                      cmpValue2=0, cmpValue3=0, groupValue2=0, id2=0, autoSort=True, noSortAndSync=False):
     ''' 更新跨服排行榜
     @param billboardType: 排行榜索引类型,同个榜单类型可以有多个分组榜单数据,独立排序
     @param groupValue1: 榜单分组1
@@ -471,6 +524,7 @@
     @param groupValue1: 榜单分组2
     @param id2: 扩展数据ID2
     @param autoSort: 是否排序,默认True
+    @param noSortAndSync: 不排序及同步子服,默认False; 一般用于批量更新数据时设置为True,减少排序及同步频率,但是一定要在设置完数据或最后一条数据后手动调用一次排序SortData
     @return: 是否上榜更新榜单
     '''
     if not GameWorld.IsCrossServer():
@@ -514,8 +568,8 @@
     billboardData.BillboardType = billboardType
     billboardData.ID = dataID
     billboardData.ID2 = id2
-    billboardData.Name1 = name1
-    billboardData.Name2 = name2
+    billboardData.Name1 = "" if len(name1) > 33 else name1
+    billboardData.Name2 = "" if len(name2) > 33 else name2
     billboardData.Type2 = type2
     billboardData.Value1 = value1
     billboardData.Value2 = value2
@@ -527,6 +581,8 @@
                        % (billboardType, groupValue1, groupValue2, dataID, isNewData, cmpValueChange,
                           type2, value1, value2, cmpValue, cmpValue2, cmpValue3), dataID)
     
+    if noSortAndSync:
+        return True
     if autoSort and cmpValueChange:
         billboardObj.SortData()
     else:

--
Gitblit v1.8.0