From b7bb8308d9b16d2802ccc3c259c871c2b6e58002 Mon Sep 17 00:00:00 2001 From: hxp <ale99527@vip.qq.com> Date: 星期二, 15 十一月 2022 19:16:05 +0800 Subject: [PATCH] 9748 【BT7】跨服BOSS定时活动(跨服妖魔boss;增加跨服日常活动时间控制;Boss刷新增加支持关联跨服日常活动;优化跨服boss复活剩余时间计算使用跨服时间;) --- ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossBillboard.py | 43 ++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 42 insertions(+), 1 deletions(-) diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossBillboard.py b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossBillboard.py index 711cc8a..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 = "" @@ -249,6 +256,37 @@ 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 @@ -470,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 @@ -486,6 +524,7 @@ @param groupValue1: 榜单分组2 @param id2: 扩展数据ID2 @param autoSort: 是否排序,默认True + @param noSortAndSync: 不排序及同步子服,默认False; 一般用于批量更新数据时设置为True,减少排序及同步频率,但是一定要在设置完数据或最后一条数据后手动调用一次排序SortData @return: 是否上榜更新榜单 ''' if not GameWorld.IsCrossServer(): @@ -542,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