ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossBillboard.py
@@ -175,10 +175,10 @@
        drDict = {"BillboardType":self.__billboardType, "GroupValue1":self.__groupValue1, "GroupValue2":self.__groupValue2, 
                  "DataCount":len(self.__billboardList)}
        DataRecordPack.SendEventPack(eventTypeName, drDict)
        for billboardData in self.__billboardList:
        for index, billboardData in enumerate(self.__billboardList):
            dataDict = {"BillboardType":billboardData.BillboardType, "GroupValue1":billboardData.GroupValue1, 
                        "GroupValue2":billboardData.GroupValue2, "Type2":billboardData.Type2,
                        "ID":billboardData.ID, "ID2":billboardData.ID2,
                        "ID":billboardData.ID, "ID2":billboardData.ID2, "Place":index,
                        "Name1":billboardData.Name1, "Name2":billboardData.Name2,
                        "Value1":billboardData.Value1, "Value2":billboardData.Value2,
                        "Value3":billboardData.Value3, "Value4":billboardData.Value4,
@@ -318,6 +318,42 @@
            
    return
def CopyBillboardEx(fromBillboardType, toBillboardType, groupValue1, groupValue2=0):
    ## 将某个类型的榜单完全拷贝到其他榜单 - 一般用于备份、转移数据
    billboardMgr = PyDataManager.GetCrossBillboardManager()
    frbillboardObj = billboardMgr.GetCrossBillboard(fromBillboardType, groupValue1, groupValue2)
    toBillboardObj = billboardMgr.GetCrossBillboard(toBillboardType, groupValue1, groupValue2)
    toBillboardObj.ClearData()
    GameWorld.Log("CopyBillboardEx: fromBillboardType=%s,toBillboardType=%s,groupValue1=%s,groupValue2=%s"
                  % (fromBillboardType, 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.Value3 = frbillboardData.Value3
        tobillboardData.Value4 = frbillboardData.Value4
        tobillboardData.Value5 = frbillboardData.Value5
        tobillboardData.Value6 = frbillboardData.Value6
        tobillboardData.Value7 = frbillboardData.Value7
        tobillboardData.Value8 = frbillboardData.Value8
        tobillboardData.UserData = frbillboardData.UserData
        tobillboardData.DataLen = len(tobillboardData.UserData)
        tobillboardData.CmpValue = frbillboardData.CmpValue
        tobillboardData.CmpValue2 = frbillboardData.CmpValue2
        tobillboardData.CmpValue3 = frbillboardData.CmpValue3
        toBillboardObj.AddBillboardData(tobillboardData)
    return
#// C0 04 查看跨服排行榜 #tagCGViewCrossBillboard
#
#struct    tagCGViewCrossBillboard
@@ -328,7 +364,7 @@
#    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)
@@ -338,7 +374,7 @@
    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
@@ -349,7 +385,7 @@
    
    # 请求查询跨服服务器
    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
@@ -378,16 +414,16 @@
    
    # 有查询数据时才同步榜单数据列表,否则只同步数据版本号
    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)
@@ -463,8 +499,8 @@
        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)
@@ -473,13 +509,13 @@
        
    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