| | |
| | | # BYTE GroupValue2; // 分组值2,与分组值1组合归为同组榜单数据
|
| | | # DWORD StartIndex; //查看的起始名次索引, 默认0
|
| | | # BYTE WatchCnt; //查看条数,默认20,最大不超过100
|
| | | # BYTE IsWatchSelf; //是否查看自己名次前后,默认10条数据
|
| | | # DWORD WatchID; //查看指定ID名次前后,如玩家ID、家族ID等
|
| | | #};
|
| | | def OnViewCrossBillboard(index, clientData, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | |
| | | billboardType, groupValue1, groupValue2 = clientData.Type, clientData.GroupValue1, clientData.GroupValue2
|
| | | startIndex = clientData.StartIndex
|
| | | watchCnt = clientData.WatchCnt
|
| | | isWatchSelf = clientData.IsWatchSelf
|
| | | watchID = clientData.WatchID
|
| | |
|
| | | if billboardType not in ShareDefine.CrossBillboardTypeList:
|
| | | return
|
| | |
| | |
|
| | | # 请求查询跨服服务器
|
| | | dataMsg = {"BillboardType":billboardType, "GroupValue1":groupValue1, "GroupValue2":groupValue2,
|
| | | "QueryData":{"EventName":"View", "PlayerID":playerID, "StartIndex":startIndex, "WatchCnt":watchCnt, "IsWatchSelf":isWatchSelf}}
|
| | | "QueryData":{"EventName":"View", "PlayerID":playerID, "StartIndex":startIndex, "WatchCnt":watchCnt, "WatchID":watchID}}
|
| | | CrossRealmMsg.SendMsgToCrossServer(ShareDefine.ClientServerMsg_QueryBillboard, dataMsg)
|
| | | return
|
| | |
|
| | |
| | |
|
| | | # 有查询数据时才同步榜单数据列表,否则只同步数据版本号
|
| | | if queryData:
|
| | | playerID = queryData.get("PlayerID", 0)
|
| | | #playerID = queryData.get("PlayerID", 0)
|
| | | startIndex = queryData.get("StartIndex", 0)
|
| | | watchCnt = queryData.get("WatchCnt", 0)
|
| | | isWatchSelf = queryData.get("IsWatchSelf", 0)
|
| | | watchID = queryData.get("WatchID", 0)
|
| | |
|
| | | count = billboardObj.GetCount()
|
| | | endIndex = 0
|
| | | # 查看自己前后名次
|
| | | if isWatchSelf:
|
| | | playerIndex = billboardObj.IndexOfByID(playerID)
|
| | | if watchID:
|
| | | playerIndex = billboardObj.IndexOfByID(watchID)
|
| | | if playerIndex != -1:
|
| | | # 前5后4,首尾补足10条记录
|
| | | endIndex = min(playerIndex + 5, count)
|
| | |
| | | return
|
| | |
|
| | | if eventName == "View":
|
| | | isWatchSelf = queryData.get("IsWatchSelf", 0)
|
| | | SyncCrossBillboardToPlayer(queryPlayer, billboardType, groupValue1, groupValue2, syncBillboardList, isWatchSelf)
|
| | | watchID = queryData.get("WatchID", 0)
|
| | | SyncCrossBillboardToPlayer(queryPlayer, billboardType, groupValue1, groupValue2, syncBillboardList, watchID)
|
| | | #else:
|
| | | # idOrderDict = billboardObj.GetIDOrderDict()
|
| | | # order = idOrderDict.get(queryPlayerID, 0)
|
| | |
| | |
|
| | | return
|
| | |
|
| | | def SyncCrossBillboardToPlayer(curPlayer, billboardType, groupValue1, groupValue2, billboardList, isWatchSelf):
|
| | | def SyncCrossBillboardToPlayer(curPlayer, billboardType, groupValue1, groupValue2, billboardList, watchID):
|
| | | ## 同步给玩家跨服榜单
|
| | | billboardInfo = ChPyNetSendPack.tagGCCrossBillboardInfo()
|
| | | billboardInfo.Type = billboardType
|
| | | billboardInfo.GroupValue1 = groupValue1
|
| | | billboardInfo.GroupValue2 = groupValue2
|
| | | billboardInfo.IsWatchSelf = isWatchSelf
|
| | | billboardInfo.WatchID = watchID
|
| | | billboardInfo.CrossBillboardDataList = []
|
| | | for dataInfo in billboardList:
|
| | | index, ID, ID2, Name1, Name2, Type2, Value1, Value2, CmpValue, CmpValue2, CmpValue3, Value3, Value4, Value5, Value6, Value7, Value8, UserData = dataInfo
|