From af5522def1cb54b7754696424edd3d392dea8105 Mon Sep 17 00:00:00 2001 From: hxp <ale99527@vip.qq.com> Date: 星期三, 28 八月 2024 17:41:02 +0800 Subject: [PATCH] 10256 【越南】【砍树】排行榜名次加入积分限制 1. 跨服榜增加延迟排序,每分钟对变更数据且不实时排序的榜单进行排序,或玩家查询时触发排序; 2. 骑宠跨服榜改为仅更新数据,不实时排序; 3. 骑宠养成增加各排名上榜积分限制;增加名次达标积分额外奖励;去除跨服榜单上榜限制配置,统一取榜单模版中最后一条限制作为保底限制; --- ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossBillboard.py | 39 ++++++++++++++++++++++++++++++++++++++- 1 files changed, 38 insertions(+), 1 deletions(-) diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossBillboard.py b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossBillboard.py index ccb8aa3..2f8cfed 100644 --- a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossBillboard.py +++ b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossBillboard.py @@ -115,6 +115,7 @@ self.__clientServerDataVer = 0 # 子服榜单数据版本 self.__billboardList = [] # [tagDBCrossBillboard, ...] self.__idOrderDict = {} # {id:名次, ...} + self.__sortDelay = False # 是否需要延迟排序 return def GetBillboardType(self): return self.__billboardType @@ -133,9 +134,27 @@ return def SortData(self): + GameWorld.DebugLog("跨服榜单排序: billboardType=%s,groupValue1=%s,groupValue2=%s,dataCount=%s" + % (self.__billboardType, self.__groupValue1, self.__groupValue2, len(self.__billboardList))) self.__billboardList.sort(key=operator.attrgetter("CmpValue", "CmpValue2", "CmpValue3"), reverse=True) self.__idOrderDict = {} # 排序后重置,下次查询时更新并缓存 + self.__sortDelay = False self.UpdCrossServerDataVer() + return + + def SetDelaySort(self): + ## 设置延迟排序 + GameWorld.DebugLog("跨服榜单设置延迟排序: billboardType=%s,groupValue1=%s,groupValue2=%s,dataCount=%s" + % (self.__billboardType, self.__groupValue1, self.__groupValue2, len(self.__billboardList))) + self.__sortDelay = True + self.UpdCrossServerDataVer() + return + + def DoDelaySort(self): + ## 延迟排序 + if not self.__sortDelay: + return + self.SortData() return def AddBillboardData(self, billboardData): @@ -172,6 +191,7 @@ def SaveDRData(self, eventName="", addDataDict={}): ## 记录流向数据 + self.DoDelaySort() dataCount = len(self.__billboardList) if not dataCount: return @@ -288,6 +308,15 @@ for billboardType, groupValue1, groupValue2 in groupList: billboardObj = billboardMgr.GetCrossBillboard(billboardType, groupValue1, groupValue2) billboardObj.SaveDRData("OnDay") + return + +def OnMinuteProcess(): + 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.DoDelaySort() return def CopyBillboard(fromBillboardType, toBillboardType): @@ -419,6 +448,7 @@ queryData = {} billboardMgr = PyDataManager.GetCrossBillboardManager() billboardObj = billboardMgr.GetCrossBillboard(billboardType, groupValue1, groupValue2) + billboardObj.DoDelaySort() crossServerDataVer = billboardObj.GetCrossServerDataVer() msgData = {"BillboardType":billboardType, "GroupValue1":groupValue1, "GroupValue2":groupValue2, "QueryData":queryData, "CrossServerDataVer":crossServerDataVer} @@ -757,8 +787,15 @@ type2, value1, value2, cmpValue, cmpValue2, cmpValue3, kwargs), dataID) if noSortAndSync: return True - if autoSort and cmpValueChange: + + # 新数据可能导致榜单ID增减,强制排序一次 + if isNewData: billboardObj.SortData() + elif cmpValueChange: + if autoSort: + billboardObj.SortData() + else: + billboardObj.SetDelaySort() else: billboardObj.UpdCrossServerDataVer() return True -- Gitblit v1.8.0