From a5704bbcc5d2b17998615e9af7f497498a79f90f Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 25 六月 2024 16:15:46 +0800
Subject: [PATCH] 10185 【越南】【港台】【主干】BOSS凭证修改(排行榜优化;跨服榜查看改为直接查跨服数据,支持分页查询;跨服凭证个人榜单最大调整为1000条,其他100;)
---
ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerBillboard.py | 15 +-
ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_QueryBillboardCross.py | 24 +++-
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py | 6 +
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py | 16 ++
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py | 21 ++++
ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossBillboard.py | 137 ++++++++++++++++++---------
ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py | 16 ++
ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py | 6 +
ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py | 21 ++++
9 files changed, 201 insertions(+), 61 deletions(-)
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py
index 5e54f8c..129baed 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py
@@ -4613,6 +4613,9 @@
("Type", c_ubyte), #榜单类型
("GroupValue1", c_ubyte), # 分组值1
("GroupValue2", c_ubyte), # 分组值2,与分组值1组合归为同组榜单数据
+ ("StartIndex", c_int), #查看的起始名次索引, 默认0
+ ("WatchCnt", c_ubyte), #查看条数,默认20,最大不超过100
+ ("IsWatchSelf", c_ubyte), #是否查看自己名次前后,默认10条数据
]
def __init__(self):
@@ -4632,6 +4635,9 @@
self.Type = 0
self.GroupValue1 = 0
self.GroupValue2 = 0
+ self.StartIndex = 0
+ self.WatchCnt = 0
+ self.IsWatchSelf = 0
return
def GetLength(self):
@@ -4646,14 +4652,20 @@
SubCmd:%s,
Type:%d,
GroupValue1:%d,
- GroupValue2:%d
+ GroupValue2:%d,
+ StartIndex:%d,
+ WatchCnt:%d,
+ IsWatchSelf:%d
'''\
%(
self.Cmd,
self.SubCmd,
self.Type,
self.GroupValue1,
- self.GroupValue2
+ self.GroupValue2,
+ self.StartIndex,
+ self.WatchCnt,
+ self.IsWatchSelf
)
return DumpString
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
index 9872833..21dc35d 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
@@ -14841,7 +14841,9 @@
# C0 07 跨服排行榜信息 #tagGCCrossBillboardInfo
class tagGCCrossBillboardData(Structure):
+ OrderIndex = 0 #(WORD OrderIndex)//名次索引,0代表第一名
ID = 0 #(DWORD ID)
+ ID2 = 0 #(DWORD ID2)
Name1 = "" #(char Name1[33])//名字1,用来显示排序对象名字
Name2 = "" #(char Name2[33])//名字2
Type2 = 0 #(BYTE Type2)//附加类型,用来表示排序对象的类型,比如,玩家所属职业门派,宠物类型等
@@ -14866,7 +14868,9 @@
def ReadData(self, _lpData, _pos=0, _Len=0):
self.Clear()
+ self.OrderIndex,_pos = CommFunc.ReadWORD(_lpData, _pos)
self.ID,_pos = CommFunc.ReadDWORD(_lpData, _pos)
+ self.ID2,_pos = CommFunc.ReadDWORD(_lpData, _pos)
self.Name1,_pos = CommFunc.ReadString(_lpData, _pos,33)
self.Name2,_pos = CommFunc.ReadString(_lpData, _pos,33)
self.Type2,_pos = CommFunc.ReadBYTE(_lpData, _pos)
@@ -14886,7 +14890,9 @@
return _pos
def Clear(self):
+ self.OrderIndex = 0
self.ID = 0
+ self.ID2 = 0
self.Name1 = ""
self.Name2 = ""
self.Type2 = 0
@@ -14907,6 +14913,8 @@
def GetLength(self):
length = 0
+ length += 2
+ length += 4
length += 4
length += 33
length += 33
@@ -14929,7 +14937,9 @@
def GetBuffer(self):
data = ''
+ data = CommFunc.WriteWORD(data, self.OrderIndex)
data = CommFunc.WriteDWORD(data, self.ID)
+ data = CommFunc.WriteDWORD(data, self.ID2)
data = CommFunc.WriteString(data, 33, self.Name1)
data = CommFunc.WriteString(data, 33, self.Name2)
data = CommFunc.WriteBYTE(data, self.Type2)
@@ -14950,7 +14960,9 @@
def OutputString(self):
DumpString = '''
+ OrderIndex:%d,
ID:%d,
+ ID2:%d,
Name1:%s,
Name2:%s,
Type2:%d,
@@ -14969,7 +14981,9 @@
UserData:%s
'''\
%(
+ self.OrderIndex,
self.ID,
+ self.ID2,
self.Name1,
self.Name2,
self.Type2,
@@ -14995,6 +15009,7 @@
Type = 0 #(BYTE Type)//榜单类型
GroupValue1 = 0 #(BYTE GroupValue1)// 分组值1
GroupValue2 = 0 #(BYTE GroupValue2)// 分组值2,与分组值1组合归为同组榜单数据
+ IsWatchSelf = 0 #(BYTE IsWatchSelf)
BillboardCount = 0 #(BYTE BillboardCount)
CrossBillboardDataList = list() #(vector<tagGCCrossBillboardData> CrossBillboardDataList)
data = None
@@ -15011,6 +15026,7 @@
self.Type,_pos = CommFunc.ReadBYTE(_lpData, _pos)
self.GroupValue1,_pos = CommFunc.ReadBYTE(_lpData, _pos)
self.GroupValue2,_pos = CommFunc.ReadBYTE(_lpData, _pos)
+ self.IsWatchSelf,_pos = CommFunc.ReadBYTE(_lpData, _pos)
self.BillboardCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
for i in range(self.BillboardCount):
temCrossBillboardDataList = tagGCCrossBillboardData()
@@ -15026,6 +15042,7 @@
self.Type = 0
self.GroupValue1 = 0
self.GroupValue2 = 0
+ self.IsWatchSelf = 0
self.BillboardCount = 0
self.CrossBillboardDataList = list()
return
@@ -15033,6 +15050,7 @@
def GetLength(self):
length = 0
length += self.Head.GetLength()
+ length += 1
length += 1
length += 1
length += 1
@@ -15048,6 +15066,7 @@
data = CommFunc.WriteBYTE(data, self.Type)
data = CommFunc.WriteBYTE(data, self.GroupValue1)
data = CommFunc.WriteBYTE(data, self.GroupValue2)
+ data = CommFunc.WriteBYTE(data, self.IsWatchSelf)
data = CommFunc.WriteBYTE(data, self.BillboardCount)
for i in range(self.BillboardCount):
data = CommFunc.WriteString(data, self.CrossBillboardDataList[i].GetLength(), self.CrossBillboardDataList[i].GetBuffer())
@@ -15059,6 +15078,7 @@
Type:%d,
GroupValue1:%d,
GroupValue2:%d,
+ IsWatchSelf:%d,
BillboardCount:%d,
CrossBillboardDataList:%s
'''\
@@ -15067,6 +15087,7 @@
self.Type,
self.GroupValue1,
self.GroupValue2,
+ self.IsWatchSelf,
self.BillboardCount,
"..."
)
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_QueryBillboardCross.py b/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_QueryBillboardCross.py
index 89a9e26..0fcb5b0 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_QueryBillboardCross.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_QueryBillboardCross.py
@@ -45,21 +45,35 @@
groupValue1 = GameWorld.ToIntDef(gmCmdDict.get('groupValue1', ''), None)
groupValue2 = GameWorld.ToIntDef(gmCmdDict.get('groupValue2', ''), None)
+ queryCount = GameWorld.ToIntDef(gmCmdDict.get('queryCount', ''), 10)
+ startRank = GameWorld.ToIntDef(gmCmdDict.get('startRank', ''), 1)
+ startRank = max(1, startRank)
billboardMgr = PyDataManager.GetCrossBillboardManager()
groupList = billboardMgr.GetBillboardGroupList(billboardType)
-
- backMsg = {"billboardType":billboardType, "groupList":groupList}
+ dataTotalDict = {}
+ for bType, gValue1, gValue2 in groupList:
+ billboardObj = billboardMgr.GetCrossBillboard(bType, gValue1, gValue2)
+ dataTotalDict["%s-%s-%s" % (bType, gValue1, gValue2)] = billboardObj.GetCount()
+
+ backMsg = {"billboardType":billboardType, "groupList":groupList, "dataTotalDict":dataTotalDict,
+ "groupValue1":groupValue1, "groupValue2":groupValue2, "queryCount":queryCount, "startRank":startRank}
if groupValue1 != None and groupValue2 != None:
billboardObj = billboardMgr.GetCrossBillboard(billboardType, groupValue1, groupValue2)
-
+ dataTotal = billboardObj.GetCount()
+ fromIndex = startRank - 1
+ toIndex = fromIndex + queryCount
billboardInfo = []
- for i in xrange(billboardObj.GetCount()):
+ for i in xrange(startRank - 1, toIndex):
+ if i >= dataTotal:
+ break
billboardData = billboardObj.At(i)
if not billboardData:
continue
+ rank = i + 1
billboardDict = {
+ "Rank":rank,
"ID":billboardData.ID,
"ID2":billboardData.ID2,
"Name1":billboardData.Name1,
@@ -89,7 +103,7 @@
billboardInfo.append(billboardDict)
- backMsg.update({"billboardInfo":billboardInfo, "groupValue1":groupValue1, "groupValue2":groupValue2})
+ backMsg.update({"billboardInfo":billboardInfo, "groupValue1":groupValue1, "groupValue2":groupValue2, "dataTotal":dataTotal})
#执行成功
GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_Success, backMsg)
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossBillboard.py b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossBillboard.py
index aee6b1f..42fd0af 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossBillboard.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossBillboard.py
@@ -28,8 +28,6 @@
import operator
import time
-Def_CrossBillboard_MaxDataCount = 200 # 跨服榜单数据最大条数暂固定最大为100条,如有需要调整需针对实际情况进行评估(如数据同步、同步封包等)
-
class CrossBillboardManager(object):
## 跨服排行榜管理,注意该类只处理数据逻辑,功能相关逻辑不要写在该类,不然重读脚本不会生效
@@ -112,6 +110,7 @@
self.__billboardType = billboardType
self.__groupValue1 = groupValue1
self.__groupValue2 = groupValue2
+ self.__maxCount = ShareDefine.CrossBillboard_MaxDataCount.get(billboardType, 100)
self.__crossServerDataVer = 0 # 主服榜单数据版本
self.__clientServerDataVer = 0 # 子服榜单数据版本
self.__billboardList = [] # [tagDBCrossBillboard, ...]
@@ -159,6 +158,17 @@
order = idOrderDict[findID]
return self.__billboardList[order - 1]
+ def IndexOfByID(self, findID):
+ ''' 根据ID查询所在榜单索引
+ @param findID: 查找的ID
+ @return: -1 or >=0
+ '''
+ idOrderDict = self.GetIDOrderDict()
+ if findID not in idOrderDict:
+ return -1
+ order = idOrderDict[findID]
+ return order - 1
+
def SaveDRData(self):
## 记录流向数据
eventTypeName = "CrossBillboard_%s" % (self.__billboardType)
@@ -189,10 +199,10 @@
return self.__idOrderDict
def GetCount(self): return len(self.__billboardList)
- def GetMaxCount(self): return Def_CrossBillboard_MaxDataCount
+ def GetMaxCount(self): return self.__maxCount
def At(self, i): return self.__billboardList[i]
- def IsFull(self): return len(self.__billboardList) >= Def_CrossBillboard_MaxDataCount
+ def IsFull(self): return len(self.__billboardList) >= self.__maxCount
def UpdCrossServerDataVer(self, version=None):
## 更新跨服榜单数据版本号,用于跨服主服、子服验证数据版本,同步榜单数据用
@@ -201,7 +211,7 @@
if version == None:
version = int(time.time())
self.__crossServerDataVer = version
- SyncCrossBillboardToClientServer(self.__billboardType, self.__groupValue1, self.__groupValue2)
+ #SyncCrossBillboardToClientServer(self.__billboardType, self.__groupValue1, self.__groupValue2)
return
def GetCrossServerDataVer(self): return self.__crossServerDataVer
@@ -316,6 +326,9 @@
# BYTE Type; //榜单类型
# BYTE GroupValue1; // 分组值1
# BYTE GroupValue2; // 分组值2,与分组值1组合归为同组榜单数据
+# DWORD StartIndex; //查看的起始名次索引, 默认0
+# BYTE WatchCnt; //查看条数,默认20,最大不超过100
+# BYTE IsWatchSelf; //是否查看自己名次前后,默认10条数据
#};
def OnViewCrossBillboard(index, clientData, tick):
curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
@@ -323,21 +336,20 @@
return
playerID = curPlayer.GetPlayerID()
billboardType, groupValue1, groupValue2 = clientData.Type, clientData.GroupValue1, clientData.GroupValue2
+ startIndex = clientData.StartIndex
+ watchCnt = clientData.WatchCnt
+ isWatchSelf = clientData.IsWatchSelf
if billboardType not in ShareDefine.CrossBillboardTypeList:
return
- billboardMgr = PyDataManager.GetCrossBillboardManager()
- billboardObj = billboardMgr.GetCrossBillboard(billboardType, groupValue1, groupValue2)
+ # 支持分页查询,改为直接查跨服服务器
GameWorld.DebugLog("玩家请求查看跨服排行榜: billboardType=%s,groupValue1=%s,groupValue2=%s" % (billboardType, groupValue1, groupValue2))
- if not billboardObj.CheckClientServerDataVer():
- SyncCrossBillboardToPlayer(curPlayer, billboardType, groupValue1, groupValue2, billboardObj.GetBillboardDataList())
- return
# 请求查询跨服服务器
dataMsg = {"BillboardType":billboardType, "GroupValue1":groupValue1, "GroupValue2":groupValue2,
- "QueryData":{"EventName":"View", "PlayerID":playerID}}
+ "QueryData":{"EventName":"View", "PlayerID":playerID, "StartIndex":startIndex, "WatchCnt":watchCnt, "IsWatchSelf":isWatchSelf}}
CrossRealmMsg.SendMsgToCrossServer(ShareDefine.ClientServerMsg_QueryBillboard, dataMsg)
return
@@ -366,9 +378,39 @@
# 有查询数据时才同步榜单数据列表,否则只同步数据版本号
if queryData:
+ playerID = queryData.get("PlayerID", 0)
+ startIndex = queryData.get("StartIndex", 0)
+ watchCnt = queryData.get("WatchCnt", 0)
+ isWatchSelf = queryData.get("IsWatchSelf", 0)
+
+ count = billboardObj.GetCount()
+ endIndex = 0
+ # 查看自己前后名次
+ if isWatchSelf:
+ playerIndex = billboardObj.IndexOfByID(playerID)
+ if playerIndex != -1:
+ # 前5后4,首尾补足10条记录
+ endIndex = min(playerIndex + 5, count)
+ startIndex = max(0, endIndex - 10)
+ endIndex = min(endIndex + (10 - (endIndex - startIndex)), count)
+ else:
+ startIndex = 0
+
+ # 指定索引分页查看
+ else:
+ startIndex = max(startIndex, 0)
+ startIndex = min(startIndex, count)
+ watchCnt = 20 if not watchCnt else min(watchCnt, 100) # 默认20,最多100
+ endIndex = min(startIndex + watchCnt, count)
+
syncBillboardList = []
- billboardList = billboardObj.GetBillboardDataList()
- for billboardData in billboardList:
+ for index in xrange(startIndex, endIndex):
+
+ if startIndex < 0 or index >= count:
+ break
+
+ billboardData = billboardObj.At(index)
+
ID = billboardData.ID
ID2 = billboardData.ID2
Name1 = billboardData.Name1
@@ -386,7 +428,7 @@
CmpValue = billboardData.CmpValue
CmpValue2 = billboardData.CmpValue2
CmpValue3 = billboardData.CmpValue3
- syncBillboardList.append([ID, ID2, Name1, Name2, Type2, Value1, Value2, CmpValue, CmpValue2, CmpValue3, Value3, Value4, Value5, Value6, Value7, Value8, UserData])
+ syncBillboardList.append([index, ID, ID2, Name1, Name2, Type2, Value1, Value2, CmpValue, CmpValue2, CmpValue3, Value3, Value4, Value5, Value6, Value7, Value8, UserData])
msgData["BillboardDataList"] = syncBillboardList
CrossRealmMsg.SendMsgToClientServer(ShareDefine.CrossServerMsg_SyncBillboard, msgData, serverGroupIDList)
@@ -402,16 +444,16 @@
GameWorld.DebugLog("收到跨服服务器同步的排行榜信息: billboardType=%s,groupValue1=%s,groupValue2=%s,crossServerDataVer=%s"
% (billboardType, groupValue1, groupValue2, crossServerDataVer))
- billboardMgr = PyDataManager.GetCrossBillboardManager()
- billboardObj = billboardMgr.GetCrossBillboard(billboardType, groupValue1, groupValue2)
- billboardObj.UpdClientServerBillboard(crossServerDataVer, syncBillboardList)
+ #billboardMgr = PyDataManager.GetCrossBillboardManager()
+ #billboardObj = billboardMgr.GetCrossBillboard(billboardType, groupValue1, groupValue2)
+ #billboardObj.UpdClientServerBillboard(crossServerDataVer, syncBillboardList)
queryData = msgData.get("QueryData")
if not queryData:
return
eventName = queryData.get("EventName")
- eventData = queryData.get("EventData")
+ #eventData = queryData.get("EventData")
queryPlayerID = queryData.get("PlayerID", 0)
if not eventName or not queryPlayerID:
return
@@ -421,40 +463,45 @@
return
if eventName == "View":
- SyncCrossBillboardToPlayer(queryPlayer, billboardType, groupValue1, groupValue2, billboardObj.GetBillboardDataList())
- else:
- idOrderDict = billboardObj.GetIDOrderDict()
- order = idOrderDict.get(queryPlayerID, 0)
- sysMsg = str([billboardType, groupValue1, groupValue2, eventName, eventData, order])
- queryPlayer.MapServer_QueryPlayerResult(0, 0, "CrossBillboardOrder", sysMsg, len(sysMsg))
+ isWatchSelf = queryData.get("IsWatchSelf", 0)
+ SyncCrossBillboardToPlayer(queryPlayer, billboardType, groupValue1, groupValue2, syncBillboardList, isWatchSelf)
+ #else:
+ # idOrderDict = billboardObj.GetIDOrderDict()
+ # order = idOrderDict.get(queryPlayerID, 0)
+ # sysMsg = str([billboardType, groupValue1, groupValue2, eventName, eventData, order])
+ # queryPlayer.MapServer_QueryPlayerResult(0, 0, "CrossBillboardOrder", sysMsg, len(sysMsg))
return
-def SyncCrossBillboardToPlayer(curPlayer, billboardType, groupValue1, groupValue2, billboardList):
+def SyncCrossBillboardToPlayer(curPlayer, billboardType, groupValue1, groupValue2, billboardList, isWatchSelf):
## 同步给玩家跨服榜单
billboardInfo = ChPyNetSendPack.tagGCCrossBillboardInfo()
billboardInfo.Type = billboardType
billboardInfo.GroupValue1 = groupValue1
billboardInfo.GroupValue2 = groupValue2
+ billboardInfo.IsWatchSelf = isWatchSelf
billboardInfo.CrossBillboardDataList = []
- for billboardData in billboardList:
+ for dataInfo in billboardList:
+ index, ID, ID2, Name1, Name2, Type2, Value1, Value2, CmpValue, CmpValue2, CmpValue3, Value3, Value4, Value5, Value6, Value7, Value8, UserData = dataInfo
billboardInfoData = ChPyNetSendPack.tagGCCrossBillboardData()
- billboardInfoData.ID = billboardData.ID
- billboardInfoData.Name1 = billboardData.Name1
- billboardInfoData.Name2 = billboardData.Name2
- billboardInfoData.Type2 = billboardData.Type2
- billboardInfoData.Value1 = billboardData.Value1
- billboardInfoData.Value2 = billboardData.Value2
- billboardInfoData.Value3 = billboardData.Value3
- billboardInfoData.Value4 = billboardData.Value4
- billboardInfoData.Value5 = billboardData.Value5
- billboardInfoData.Value6 = billboardData.Value6
- billboardInfoData.Value7 = billboardData.Value7
- billboardInfoData.Value8 = billboardData.Value8
- billboardInfoData.CmpValue = billboardData.CmpValue
- billboardInfoData.CmpValue2 = billboardData.CmpValue2
- billboardInfoData.CmpValue3 = billboardData.CmpValue3
- billboardInfoData.UserData = billboardData.UserData
+ billboardInfoData.OrderIndex = index
+ billboardInfoData.ID = ID
+ billboardInfoData.ID2 = ID2
+ billboardInfoData.Name1 = Name1
+ billboardInfoData.Name2 = Name2
+ billboardInfoData.Type2 = Type2
+ billboardInfoData.Value1 = Value1
+ billboardInfoData.Value2 = Value2
+ billboardInfoData.Value3 = Value3
+ billboardInfoData.Value4 = Value4
+ billboardInfoData.Value5 = Value5
+ billboardInfoData.Value6 = Value6
+ billboardInfoData.Value7 = Value7
+ billboardInfoData.Value8 = Value8
+ billboardInfoData.CmpValue = CmpValue
+ billboardInfoData.CmpValue2 = CmpValue2
+ billboardInfoData.CmpValue3 = CmpValue3
+ billboardInfoData.UserData = UserData
billboardInfoData.DataLen = len(billboardInfoData.UserData)
billboardInfo.CrossBillboardDataList.append(billboardInfoData)
billboardInfo.BillboardCount = len(billboardInfo.CrossBillboardDataList)
@@ -507,8 +554,8 @@
and (not cmpValue3 or cmpValue3 == billboardData.CmpValue3) \
and value1 == billboardData.Value1 and value2 == billboardData.Value2 \
and value3 == billboardData.Value3 and value4 == billboardData.Value4 \
- and value5 == billboardData.Value1 and value6 == billboardData.Value6 \
- and value7 == billboardData.Value1 and value8 == billboardData.Value8 \
+ and value5 == billboardData.Value5 and value6 == billboardData.Value6 \
+ and value7 == billboardData.Value7 and value8 == billboardData.Value8 \
and name1 == billboardData.Name1 and name2 == billboardData.Name2 \
and type2 == billboardData.Type2 and id2 == billboardData.ID2 and userData == billboardData.UserData:
GameWorld.DebugLog(" 榜单值相同,不同步跨服服务器! ")
@@ -625,7 +672,7 @@
if not billboardObj.AddBillboardData(billboardData):
return
- cmpValueChange = isNewData or billboardData.CmpValue != cmpValue or billboardData.CmpValue2 != cmpValue2 or billboardData.CmpValue3 != cmpValue3
+ cmpValueChange = isNewData or billboardData.CmpValue != cmpValue or billboardData.CmpValue2 != cmpValue2 or (cmpValue3 and billboardData.CmpValue3 != cmpValue3)
# 没设置值默认为时间time,先上榜的排前面
if cmpValue3 == 0:
# 时间权值仅在比较值变更的情况下才更新, 防止其他附属值更新时导致比较值相同的玩家名次间会变动的问题
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerBillboard.py b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerBillboard.py
index ea99991..2c80efa 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerBillboard.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerBillboard.py
@@ -669,14 +669,15 @@
return False
isNewData = playerBillBoardData.GetID2() == 0 # 是否是新增的数据
- cmpValueChange = False
- if isNewData or playerBillBoardData.GetCmpValue() != cmpValue or playerBillBoardData.GetCmpValue2() != cmpValue2 \
- or playerBillBoardData.GetCmpValue3() != cmpValue3:
- cmpValueChange = True
- if cmpValue3 == 0:
+ cmpValueChange = isNewData or playerBillBoardData.GetCmpValue() != cmpValue or playerBillBoardData.GetCmpValue2() != cmpValue2 \
+ or (cmpValue3 and playerBillBoardData.GetCmpValue3() != cmpValue3)
+ if cmpValue3 == 0:
+ if cmpValueChange:
# 时间权值仅在比较值变更的情况下才更新, 防止其他附属值更新时导致比较值相同的玩家名次间会变动的问题
calcTime = GameWorld.ChangeTimeStrToNum("2080-01-01 00:00:00")
cmpValue3 = max(0, calcTime - int(time.time())) # 比较值3如果没指定值则默认存当前更新的time
+ else:
+ cmpValue3 = playerBillBoardData.GetCmpValue3()
#设置排行榜数据
playerBillBoardData.SetType(billboardIndex)
@@ -703,8 +704,8 @@
if cmpValue3 > 0:
playerBillBoardData.SetCmpValue3(cmpValue3)
- GameWorld.DebugLog("更新排行榜值 index=%s,type2=%s,value1=%s,value2=%s,cmpValue=%s,cmpValue2==%s,cmpValue3==%s,isNewData=%s,%s"
- % (billboardIndex, type2, value1, value2, cmpValue, cmpValue2, cmpValue3, isNewData, kwargs), curPlayerID)
+ GameWorld.DebugLog("更新排行榜值 index=%s,type2=%s,value1=%s,value2=%s,cmpValue=%s,cmpValue2==%s,cmpValue3==%s,isNewData=%s,cmpValueChange=%s,%s"
+ % (billboardIndex, type2, value1, value2, cmpValue, cmpValue2, cmpValue3, isNewData, cmpValueChange, kwargs), curPlayerID)
if not cmpValueChange:
return True
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py b/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py
index 484d29c..2feeb94 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py
@@ -848,6 +848,12 @@
Def_CBT_BossTrialSubmitFamilyBak, # boss凭证 - 仙盟榜 上一期 161
) = range(150, 161 + 1)
+# 跨服榜单最大数据名次,没有设置的默认100
+CrossBillboard_MaxDataCount = {
+ Def_CBT_BossTrialSubmit:1000,
+ Def_CBT_BossTrialSubmitBak:1000,
+ }
+
#职业对应战力排行榜类型
JobFightPowerBillboardDict = {
PlayerJob_Warrior:Def_BT_FightPower_Warrior,
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py
index 5e54f8c..129baed 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py
@@ -4613,6 +4613,9 @@
("Type", c_ubyte), #榜单类型
("GroupValue1", c_ubyte), # 分组值1
("GroupValue2", c_ubyte), # 分组值2,与分组值1组合归为同组榜单数据
+ ("StartIndex", c_int), #查看的起始名次索引, 默认0
+ ("WatchCnt", c_ubyte), #查看条数,默认20,最大不超过100
+ ("IsWatchSelf", c_ubyte), #是否查看自己名次前后,默认10条数据
]
def __init__(self):
@@ -4632,6 +4635,9 @@
self.Type = 0
self.GroupValue1 = 0
self.GroupValue2 = 0
+ self.StartIndex = 0
+ self.WatchCnt = 0
+ self.IsWatchSelf = 0
return
def GetLength(self):
@@ -4646,14 +4652,20 @@
SubCmd:%s,
Type:%d,
GroupValue1:%d,
- GroupValue2:%d
+ GroupValue2:%d,
+ StartIndex:%d,
+ WatchCnt:%d,
+ IsWatchSelf:%d
'''\
%(
self.Cmd,
self.SubCmd,
self.Type,
self.GroupValue1,
- self.GroupValue2
+ self.GroupValue2,
+ self.StartIndex,
+ self.WatchCnt,
+ self.IsWatchSelf
)
return DumpString
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
index 9872833..21dc35d 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
@@ -14841,7 +14841,9 @@
# C0 07 跨服排行榜信息 #tagGCCrossBillboardInfo
class tagGCCrossBillboardData(Structure):
+ OrderIndex = 0 #(WORD OrderIndex)//名次索引,0代表第一名
ID = 0 #(DWORD ID)
+ ID2 = 0 #(DWORD ID2)
Name1 = "" #(char Name1[33])//名字1,用来显示排序对象名字
Name2 = "" #(char Name2[33])//名字2
Type2 = 0 #(BYTE Type2)//附加类型,用来表示排序对象的类型,比如,玩家所属职业门派,宠物类型等
@@ -14866,7 +14868,9 @@
def ReadData(self, _lpData, _pos=0, _Len=0):
self.Clear()
+ self.OrderIndex,_pos = CommFunc.ReadWORD(_lpData, _pos)
self.ID,_pos = CommFunc.ReadDWORD(_lpData, _pos)
+ self.ID2,_pos = CommFunc.ReadDWORD(_lpData, _pos)
self.Name1,_pos = CommFunc.ReadString(_lpData, _pos,33)
self.Name2,_pos = CommFunc.ReadString(_lpData, _pos,33)
self.Type2,_pos = CommFunc.ReadBYTE(_lpData, _pos)
@@ -14886,7 +14890,9 @@
return _pos
def Clear(self):
+ self.OrderIndex = 0
self.ID = 0
+ self.ID2 = 0
self.Name1 = ""
self.Name2 = ""
self.Type2 = 0
@@ -14907,6 +14913,8 @@
def GetLength(self):
length = 0
+ length += 2
+ length += 4
length += 4
length += 33
length += 33
@@ -14929,7 +14937,9 @@
def GetBuffer(self):
data = ''
+ data = CommFunc.WriteWORD(data, self.OrderIndex)
data = CommFunc.WriteDWORD(data, self.ID)
+ data = CommFunc.WriteDWORD(data, self.ID2)
data = CommFunc.WriteString(data, 33, self.Name1)
data = CommFunc.WriteString(data, 33, self.Name2)
data = CommFunc.WriteBYTE(data, self.Type2)
@@ -14950,7 +14960,9 @@
def OutputString(self):
DumpString = '''
+ OrderIndex:%d,
ID:%d,
+ ID2:%d,
Name1:%s,
Name2:%s,
Type2:%d,
@@ -14969,7 +14981,9 @@
UserData:%s
'''\
%(
+ self.OrderIndex,
self.ID,
+ self.ID2,
self.Name1,
self.Name2,
self.Type2,
@@ -14995,6 +15009,7 @@
Type = 0 #(BYTE Type)//榜单类型
GroupValue1 = 0 #(BYTE GroupValue1)// 分组值1
GroupValue2 = 0 #(BYTE GroupValue2)// 分组值2,与分组值1组合归为同组榜单数据
+ IsWatchSelf = 0 #(BYTE IsWatchSelf)
BillboardCount = 0 #(BYTE BillboardCount)
CrossBillboardDataList = list() #(vector<tagGCCrossBillboardData> CrossBillboardDataList)
data = None
@@ -15011,6 +15026,7 @@
self.Type,_pos = CommFunc.ReadBYTE(_lpData, _pos)
self.GroupValue1,_pos = CommFunc.ReadBYTE(_lpData, _pos)
self.GroupValue2,_pos = CommFunc.ReadBYTE(_lpData, _pos)
+ self.IsWatchSelf,_pos = CommFunc.ReadBYTE(_lpData, _pos)
self.BillboardCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
for i in range(self.BillboardCount):
temCrossBillboardDataList = tagGCCrossBillboardData()
@@ -15026,6 +15042,7 @@
self.Type = 0
self.GroupValue1 = 0
self.GroupValue2 = 0
+ self.IsWatchSelf = 0
self.BillboardCount = 0
self.CrossBillboardDataList = list()
return
@@ -15033,6 +15050,7 @@
def GetLength(self):
length = 0
length += self.Head.GetLength()
+ length += 1
length += 1
length += 1
length += 1
@@ -15048,6 +15066,7 @@
data = CommFunc.WriteBYTE(data, self.Type)
data = CommFunc.WriteBYTE(data, self.GroupValue1)
data = CommFunc.WriteBYTE(data, self.GroupValue2)
+ data = CommFunc.WriteBYTE(data, self.IsWatchSelf)
data = CommFunc.WriteBYTE(data, self.BillboardCount)
for i in range(self.BillboardCount):
data = CommFunc.WriteString(data, self.CrossBillboardDataList[i].GetLength(), self.CrossBillboardDataList[i].GetBuffer())
@@ -15059,6 +15078,7 @@
Type:%d,
GroupValue1:%d,
GroupValue2:%d,
+ IsWatchSelf:%d,
BillboardCount:%d,
CrossBillboardDataList:%s
'''\
@@ -15067,6 +15087,7 @@
self.Type,
self.GroupValue1,
self.GroupValue2,
+ self.IsWatchSelf,
self.BillboardCount,
"..."
)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
index 484d29c..2feeb94 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
@@ -848,6 +848,12 @@
Def_CBT_BossTrialSubmitFamilyBak, # boss凭证 - 仙盟榜 上一期 161
) = range(150, 161 + 1)
+# 跨服榜单最大数据名次,没有设置的默认100
+CrossBillboard_MaxDataCount = {
+ Def_CBT_BossTrialSubmit:1000,
+ Def_CBT_BossTrialSubmitBak:1000,
+ }
+
#职业对应战力排行榜类型
JobFightPowerBillboardDict = {
PlayerJob_Warrior:Def_BT_FightPower_Warrior,
--
Gitblit v1.8.0