hxp
2024-09-04 c7be7cd97a32658b8629f8c67fbd4973b642de46
ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossChampionship.py
@@ -29,6 +29,8 @@
import PlayerControl
import PyDataManager
import NetPackCommon
import GameXiangong
import GameWorship
import PyGameData
import ChConfig
import PlayerFB
@@ -61,6 +63,7 @@
value3:guessPlayerID     竞猜玩家ID
value4:tagPlayerID       目标玩家ID
value5:moneyTotal        投注总货币值
StrValue1:isClose        是否已结算
'''
Def_RecType_CrossChampionshipOfficial = ShareDefine.Def_UniversalGameRecType_CrossChampionshipOfficial
@@ -68,10 +71,11 @@
跨服排位争霸赛最终排名官职信息
ShareDefine.Def_UniversalGameRecType_CrossChampionshipOfficial
time:time                上一次辞退下级仙官时间
value1:zoneID官职ID      官职ID*10 + 分区ID
value1:官职ID            官职ID
value2:playerID          玩家ID,可能为0
value3:worshipValue      被膜拜次数*10 + 是否双倍
value4:rank              排名
value5:zoneID            分区ID
StrValue3:               [申请该官职玩家ID,...]
'''
@@ -79,7 +83,8 @@
'''
跨服排位争霸赛官职挑战信息
ShareDefine.Def_UniversalGameRecType_CrossChampionshipOffChallenge
value1:zoneID官职ID      官职ID*10 + 分区ID
value1:官职ID             官职ID
value2:zoneID            分区ID
StrValue3:               {挑战玩家信息key:value, ...}
'''
@@ -180,6 +185,7 @@
        self.tagPlayerID = 0 # 目标玩家ID
        self.moneyTotal = 0 # 投注总货币值
        self.guessRank = 0 # 竞猜名次,没有名次的竞猜默认0;1-代表第一名
        self.isClose = 0 # 是否已结算
        return
    
    def GetString(self):
@@ -361,12 +367,15 @@
        return
    
    def GetChampPKZoneIDList(self): return self._pkZoneInfo.keys()
    def GetChampPKZoneMgr(self, zoneID):
    def GetChampPKZoneMgr(self, zoneID, addNew=False):
        pkZoneMgr = None
        if zoneID in self._pkZoneInfo:
            pkZoneMgr = self._pkZoneInfo[zoneID]
        else:
        elif addNew:
            pkZoneMgr = ChampionshipPKZoneMgr(zoneID)
            self._pkZoneInfo[zoneID] = pkZoneMgr
        if not pkZoneMgr:
            GameWorld.ErrLog("找不到跨服排位赛分区管理! zoneID=%s" % zoneID)
        return pkZoneMgr
    
    def GetPlayerPKZoneID(self, playerID):
@@ -374,6 +383,8 @@
        # @return: 如果在排位中则返回所在排位分区,否则返回当前服务器所在跨服匹配PK分区
        for zoneID in self._pkZoneInfo.keys():
            pkZoneMgr = self.GetChampPKZoneMgr(zoneID)
            if not pkZoneMgr:
                continue
            if playerID in pkZoneMgr.GetBatPlayerIDList():
                return zoneID
        return GameWorld.GetGameWorld().GetDictByKey(ShareDefine.Def_Notify_WorldKey_CrossPKZoneID)
@@ -436,7 +447,7 @@
        groupMark = groupInfo / 100
        battleNum = groupInfo % 100
        
        pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID)
        pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID, True)
        
        if groupMark in groupMarkList and battleNum:
            battle = ChampionshipBattle()
@@ -471,8 +482,11 @@
        guessPlayerID = recData.GetValue3()
        tagPlayerID = recData.GetValue4()
        moneyTotal = recData.GetValue5()
        isClose = GameWorld.ToIntDef(recData.GetStrValue1(), 0)
        
        pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID)
        if not pkZoneMgr:
            continue
        playerGuessList = pkZoneMgr.GetPlayerGuessList(guessPlayerID, guessType)
        guessObj = ChampionshipGuess()
        guessObj.zoneID = zoneID
@@ -481,6 +495,7 @@
        guessObj.guessPlayerID = guessPlayerID
        guessObj.tagPlayerID = tagPlayerID
        guessObj.moneyTotal = moneyTotal
        guessObj.isClose = isClose
        playerGuessList.append(guessObj)
        
        if guessType not in pkZoneMgr.supportCountInfo:
@@ -493,9 +508,8 @@
    for index in xrange(officialRecDataList.Count()):
        recData = officialRecDataList.At(index)
        lastDismissJuniorTime = recData.GetTime()
        value1 = recData.GetValue1()
        officialID = value1 / 10
        zoneID = value1 % 10
        officialID = recData.GetValue1()
        zoneID = recData.GetValue5()
        playerID = recData.GetValue2()
        worshipValue = recData.GetValue3()
        worshipCount = worshipValue / 10
@@ -526,9 +540,8 @@
    GameWorld.Log("加载跨服排位官职挑战记录信息! %s" % challengeRecDataList.Count())
    for index in xrange(challengeRecDataList.Count()):
        recData = challengeRecDataList.At(index)
        value1 = recData.GetValue1()
        officialID = value1 / 10
        zoneID = value1 % 10
        officialID = recData.GetValue1()
        zoneID = recData.GetValue2()
        strValue3 = recData.GetStrValue3()
        if not strValue3:
            continue
@@ -547,7 +560,10 @@
    return
def OnServerClose():
    SaveChampionshipData()
    return
def SaveChampionshipData():
    if not GameWorld.IsCrossServer():
        return
    
@@ -560,7 +576,8 @@
    groupRecDataList = universalRecMgr.GetTypeList(Def_RecType_CrossChampionshipGroup)
    for zoneID in pkZoneIDList:
        pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID)
        if not pkZoneMgr:
            continue
        # 保存参赛玩家名单
        batPlayerIDList = pkZoneMgr.GetBatPlayerIDList()
        GameWorld.Log("    zoneID=%s,batPlayerIDCount=%s, %s" % (zoneID, len(batPlayerIDList), batPlayerIDList))
@@ -589,6 +606,8 @@
    guessRecDataList = universalRecMgr.GetTypeList(Def_RecType_CrossChampionshipGuess)
    for zoneID in pkZoneIDList:
        pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID)
        if not pkZoneMgr:
            continue
        for guessType, playerGuessDict in pkZoneMgr.guessInfo.items():
            for guessPlayerID, guessObjList in playerGuessDict.items():
                #GameWorld.Log("    zoneID=%s,guessType=%s,guessPlayerID=%s,guessCount=%s" % (zoneID, guessType, guessPlayerID, len(guessObjList)))
@@ -599,6 +618,7 @@
                    recData.SetValue3(guessPlayerID)
                    recData.SetValue4(guessObj.tagPlayerID)
                    recData.SetValue5(guessObj.moneyTotal)
                    recData.SetStrValue1("%s" % guessObj.isClose)
                    
    offZoneIDList = champMgr.GetChampOfficialZoneIDList()
    GameWorld.Log("保存跨服排位玩家官职信息! offZoneIDList=%s" % offZoneIDList)
@@ -613,22 +633,23 @@
            offObj = offZoneMgr.GetOfficialObj(officialID)
            if not offObj:
                continue
            value1 = offObj.officialID * 10 + zoneID
            recData = officialRecDataList.AddRec()
            recData.SetTime(offObj.lastDismissJuniorTime)
            recData.SetValue1(value1)
            recData.SetValue1(officialID)
            recData.SetValue2(offObj.playerID)
            recData.SetValue3(offObj.worshipCount * 10 + offObj.worshipDouble)
            recData.SetValue4(offObj.rank)
            recData.SetValue5(zoneID)
            strValue3 = "%s" % offObj.applyPlayerInfo.keys()
            strValue3 = strValue3.replace(" ", "")
            recData.SetStrValue3(strValue3)
            
            #GameWorld.Log("        zoneID=%s,officialID=%s,playerID=%s,rank=%s,challengeCount=%s"
            #              % (zoneID, officialID, offObj.playerID, offObj.rank, len(offObj.challengeList)))
            GameWorld.Log("        zoneID=%s,officialID=%s,playerID=%s,rank=%s,challengeCount=%s"
                          % (zoneID, officialID, offObj.playerID, offObj.rank, len(offObj.challengeList)))
            for challengeDict in offObj.challengeList:
                challRecData = challengeRecDataList.AddRec()
                challRecData.SetValue1(value1)
                challRecData.SetValue1(officialID)
                challRecData.SetValue2(zoneID)
                strValue3 = str(challengeDict)
                strValue3 = strValue3.replace(" ", "")
                challRecData.SetStrValue3(strValue3)
@@ -705,6 +726,8 @@
    champMgr = GetChampionshipMgr()
    for zoneID in champMgr.GetChampPKZoneIDList():
        pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID)
        if not pkZoneMgr:
            continue
        if playerID in pkZoneMgr.GetBatPlayerIDList():
            # 是参赛玩家
            return True
@@ -738,11 +761,22 @@
        
    return
def DoChampionshipOpen(curPlayer):
    NotifyPlayerChampionshipInfo(curPlayer, GameWorld.GetGameWorld().GetTick())
    return
def OnPlayerLogin(curPlayer, tick):
    
    if GameWorld.IsCrossServer():
        return
    
    if not PlayerControl.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_Championship):
        return
    NotifyPlayerChampionshipInfo(curPlayer, tick)
    return
def NotifyPlayerChampionshipInfo(curPlayer, tick):
    playerID = curPlayer.GetPlayerID()
    champMgr = GetChampionshipMgr()
    pkZoneIDList = champMgr.GetChampPKZoneIDList()
@@ -754,6 +788,8 @@
    if pkZoneIDList:
        playerZoneID = champMgr.GetPlayerPKZoneID(playerID)
        pkZoneMgr = champMgr.GetChampPKZoneMgr(playerZoneID)
        if not pkZoneMgr:
            return
        if playerID not in pkZoneMgr.syncGuessPlayerIDInfo:
            sendMsg = {"zoneID":playerZoneID, "playerID":playerID, "exDataType":"ChampionshipGuessQuery"}
            CrossRealmMsg.SendMsgToCrossServer(ShareDefine.ClientServerMsg_ChampionshipGuess, sendMsg)
@@ -763,11 +799,60 @@
            
    return
def OnMinuteProcess():
def ChampionshipErrorDo():
    ## 状态异常后处理
    stateError = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_CrossChampionshipStateError)
    if not stateError:
        return "state is not error."
    if PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_CrossChampionshipErrorDo):
        return "already done."
    champMgr = GetChampionshipMgr()
    # 返还未结算的竞猜消耗
    moneyType, _ = IpyGameDataPY.GetFuncEvalCfg("CrossChamGuess", 1)
    moneyItemID = ChConfig.MoneyItemIDDict.get(moneyType)
    for zoneID in champMgr.GetChampPKZoneIDList():
        pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID)
        if not pkZoneMgr:
            continue
        backGuessTypeList = []
        playerGuessMoneyInfo = {}
        for guessType, playerGuessDict in pkZoneMgr.guessInfo.items():
            for guessPlayerID, guessObjList in playerGuessDict.items():
                for guessObj in guessObjList:
                    if guessObj.isClose:
                        # 已经结算的不处理
                        continue
                    guessObj.isClose = 1
                    if guessType not in backGuessTypeList:
                        backGuessTypeList.append(guessType)
                    playerGuessMoneyInfo[guessPlayerID] = playerGuessMoneyInfo.get(guessPlayerID, 0) + guessObj.moneyTotal
        GameWorld.Log("竞猜需要返还玩家信息: moneyItemID=%s,zoneID=%s,backGuessTypeList=%s, %s" % (moneyItemID, zoneID, backGuessTypeList, playerGuessMoneyInfo))
        if not moneyItemID or not playerGuessMoneyInfo:
            continue
        for guessPlayerID, totalMoney in playerGuessMoneyInfo.items():
            paramList = []
            addItemList = [[moneyItemID, totalMoney, 0]]
            PlayerCompensation.SendMailByKey("CrossChampionshipGuessBack", [guessPlayerID], addItemList, paramList, crossMail=True)
    PlayerDBGSEvent.SetDBGSTrig_ByKey(PlayerDBGSEvent.Def_CrossChampionshipErrorDo, 1)
    return "OK"
def OnMinuteProcess(curMinute):
    if not GameWorld.IsCrossServer():
        return
    
    Dispose_CrossChampionshipState()
    # 每半小时存档一次
    if curMinute % 30 == 0:
        SaveChampionshipData()
    return
def __GetChampionshipStartDate():
@@ -985,6 +1070,7 @@
    PlayerDBGSEvent.SetDBGSTrig_ByKey(PlayerDBGSEvent.Def_CrossChampionshipID, crossChampionshipID)
    PlayerDBGSEvent.SetDBGSTrig_ByKey(PlayerDBGSEvent.Def_CrossChampionshipState, updState)
    PlayerDBGSEvent.SetDBGSTrig_ByKey(PlayerDBGSEvent.Def_CrossChampionshipStateError, 0)
    PlayerDBGSEvent.SetDBGSTrig_ByKey(PlayerDBGSEvent.Def_CrossChampionshipErrorDo, 0)
    
    champMgr = GetChampionshipMgr()
    champMgr.ClearPKZone() # 仅清理PK分区信息,仙官信息不变
@@ -998,7 +1084,7 @@
            if not billboardList:
                # 没有玩家上榜的不处理
                continue
            pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID)
            pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID, True)
            battlePlayerList = billboardList[:Def_CrossChampionshipPlayerMax]
            for num, billboardData in enumerate(battlePlayerList, 1):
                playerID = billboardData.PlayerID
@@ -1034,6 +1120,8 @@
    champMgr = GetChampionshipMgr()
    for zoneID in champMgr.GetChampPKZoneIDList():
        pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID)
        if not pkZoneMgr:
            continue
        # 首轮取所有参赛玩家
        if preGroupMark == 0:
            batPlayerIDList = pkZoneMgr.GetBatPlayerIDList()
@@ -1134,7 +1222,8 @@
    champMgr = GetChampionshipMgr()
    for zoneID in champMgr.GetChampPKZoneIDList():
        pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID)
        if not pkZoneMgr:
            continue
        winPlayerIDList, losePlayerIDList = [], [] # 胜者组、败者组
        battleNumList = pkZoneMgr.battleInfo.get(preGroupMark, {}).keys()
        battleNumList.sort() # 对战编号按之前的分组顺序排序,确保分组顺序一致
@@ -1221,7 +1310,8 @@
    champMgr = GetChampionshipMgr()
    for zoneID in champMgr.GetChampPKZoneIDList():
        pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID)
        if not pkZoneMgr:
            continue
        battleNumList = pkZoneMgr.battleInfo.get(preGroupMark, {}).keys()
        battleNumList.sort() # 对战编号按之前的分组顺序排序,确保分组顺序一致
        for battleNum in battleNumList:
@@ -1251,6 +1341,7 @@
            for guessObj in guessList:
                if guessObj.guessType != guessType or guessObj.guessPlayerID != guessPlayerID:
                    continue
                guessObj.isClose = 1
                tagPlayerID = guessObj.tagPlayerID
                moneyTotal = guessObj.moneyTotal
                if not tagPlayerID or tagPlayerID not in top8PlayerIDList:
@@ -1273,19 +1364,23 @@
    if state not in ShareDefine.CrossChampionshipEnterStateInfo:
        return
    groupMark = ShareDefine.CrossChampionshipEnterStateInfo[state]
    mapIndex = 0
    mapIDList = IpyGameDataPY.GetFuncEvalCfg("CrossChamFB", 3)
    GameWorld.Log("跨服排位争霸赛开启进场副本: groupMark=%s,mapIDList=%s" % (groupMark, mapIDList))
    champMgr = GetChampionshipMgr()
    pkZoneIDList = champMgr.GetChampPKZoneIDList()
    for index, zoneID in enumerate(pkZoneIDList):
        if index >= len(mapIDList):
            GameWorld.ErrLog("该跨服排位争霸赛分区没有分配对战地图! zoneID=%s,index=%s" % (zoneID, index), zoneID)
            continue
        mapID = mapIDList[index]
    for zoneID in pkZoneIDList:
        pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID)
        if not pkZoneMgr:
            continue
        if groupMark not in pkZoneMgr.battleInfo:
            GameWorld.Log("该跨服排位争霸赛分区没有对战组! zoneID=%s,groupMark=%s" % (zoneID, groupMark), zoneID)
            continue
        if mapIndex >= len(mapIDList):
            GameWorld.ErrLog("该跨服排位争霸赛分区没有分配对战地图! zoneID=%s,mapIndex=%s" % (zoneID, mapIndex), zoneID)
            continue
        mapID = mapIDList[mapIndex]
        mapIndex += 1
        copyMapID = 0
        copyPropertyList = []
        battleDict = pkZoneMgr.battleInfo[groupMark]
@@ -1301,7 +1396,7 @@
            
            # 添加开启分线数据
            realMapID = mapID
            copyMapObj = PlayerFB.CrossCopyMapInfo(zoneID, 0)
            copyMapObj = PlayerFB.CrossCopyMapInfo(zoneID, ChConfig.Def_FBMapID_CrossChampionship, 0)
            copyMapObj.realMapID = realMapID
            copyMapObj.copyMapID = copyMapID
            key = (realMapID, copyMapID)
@@ -1339,7 +1434,7 @@
    CrossRealmMsg.SendMsgToClientServer(ShareDefine.CrossServerMsg_ChampionshipState, dataMsg, serverGroupIDList)
    return
def Send_CrossServerMsg_ChampionshipPlayer(syncPlayerIDList=None, serverGroupID=0, isSync=False):
def Send_CrossServerMsg_ChampionshipPlayer(syncPlayerIDList=None, serverGroupID=0, isSync=False, clearPlayer=False):
    # 通知参赛玩家
    
    zoneBatPlayerInfo = {}
@@ -1347,6 +1442,8 @@
    for zoneID in champMgr.GetChampPKZoneIDList():
        batPlayerList = []
        pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID)
        if not pkZoneMgr:
            continue
        playerIDList = pkZoneMgr.GetBatPlayerIDList() if syncPlayerIDList == None else syncPlayerIDList
        for playerID in playerIDList:
            batPlayer = pkZoneMgr.GetBatPlayer(playerID)
@@ -1355,7 +1452,7 @@
            batPlayerList.append(batPlayer.GetString())
        zoneBatPlayerInfo[zoneID] = batPlayerList
        
    dataMsg = {"isSync":isSync, "zoneBatPlayerInfo":zoneBatPlayerInfo}
    dataMsg = {"isSync":isSync, "zoneBatPlayerInfo":zoneBatPlayerInfo, "clearPlayer":clearPlayer}
    serverGroupIDList = [serverGroupID] if serverGroupID else []
    CrossRealmMsg.SendMsgToClientServer(ShareDefine.CrossServerMsg_ChampionshipPlayer, dataMsg, serverGroupIDList)
    return
@@ -1370,6 +1467,8 @@
        champMgr = GetChampionshipMgr()
        for zoneID in champMgr.GetChampPKZoneIDList():
            pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID)
            if not pkZoneMgr:
                continue
            for gMark in syncGroupMarkList:
                battleDict = pkZoneMgr.battleInfo.get(gMark, {})
                if not battleDict:
@@ -1394,12 +1493,13 @@
            guessList.append(guessObj.GetString())
        else:
            pkZoneMgr = champMgr.GetChampPKZoneMgr(syncZoneID)
            for playerGuessDict in pkZoneMgr.guessInfo.values():
                if playerID not in playerGuessDict:
                    continue
                playerGuessList = playerGuessDict[playerID]
                for guess in playerGuessList:
                    guessList.append(guess.GetString())
            if pkZoneMgr:
                for playerGuessDict in pkZoneMgr.guessInfo.values():
                    if playerID not in playerGuessDict:
                        continue
                    playerGuessList = playerGuessDict[playerID]
                    for guess in playerGuessList:
                        guessList.append(guess.GetString())
                    
    dataMsg = {"exData":exData if exData else {}, "guessList":guessList}
    if syncPub:
@@ -1407,6 +1507,8 @@
        syncZoneIDList = [syncZoneID] if syncZoneID else champMgr.GetChampPKZoneIDList()
        for zoneID in syncZoneIDList:
            pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID)
            if not pkZoneMgr:
                continue
            zoneSupportCountInfo[zoneID] = pkZoneMgr.supportCountInfo
        dataMsg["pubInfo"] = {"zoneSupportCountInfo":zoneSupportCountInfo}
        
@@ -1445,14 +1547,16 @@
    ## 收到跨服服务器同步的信息  - 参赛玩家信息
    
    isSync = msgData["isSync"]
    clearPlayer = msgData["clearPlayer"]
    zoneBatPlayerInfo = msgData["zoneBatPlayerInfo"]
    
    champMgr = GetChampionshipMgr()
    for zoneID, batPlayerList in zoneBatPlayerInfo.items():
        pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID)
        pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID, True)
        
        if not batPlayerList:
            pkZoneMgr.playerDict = {}
            if clearPlayer:
                pkZoneMgr.playerDict = {}
        else:
            for attrDict in batPlayerList:
                zoneID = attrDict["zoneID"]
@@ -1478,7 +1582,7 @@
        groupMark = attrDict["groupMark"]
        battleNum = attrDict["battleNum"]
        
        pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID)
        pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID, True)
        battle = pkZoneMgr.GetBattle(groupMark, battleNum)
        if not battle:
            battle = ChampionshipBattle()
@@ -1533,7 +1637,7 @@
            # 非本服玩家
            continue
        
        pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID)
        pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID, True)
        
        guessObj = None
        playerGuessList = pkZoneMgr.GetPlayerGuessList(guessPlayerID, guessType)
@@ -1551,7 +1655,7 @@
    if pubInfo != None:
        zoneSupportCountInfo = pubInfo["zoneSupportCountInfo"]
        for zoneID, supportCountInfo in zoneSupportCountInfo.items():
            pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID)
            pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID, True)
            pkZoneMgr.supportCountInfo = supportCountInfo
            pubZoneIDList.append(zoneID)
            
@@ -1563,7 +1667,7 @@
            # 非本服玩家
            return
        zoneID = exData.get("zoneID", 0)
        pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID)
        pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID, True)
        pkZoneMgr.syncGuessPlayerIDInfo[playerID] = tick
        curPlayer = GameWorld.GetPlayerManager().FindPlayerByID(playerID)
        if curPlayer == None:
@@ -1615,6 +1719,8 @@
    champMgr = GetChampionshipMgr()
    for zoneID in champMgr.GetChampPKZoneIDList():
        pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID)
        if not pkZoneMgr:
            continue
        if groupMark not in pkZoneMgr.battleInfo:
            continue
        battleDict = pkZoneMgr.battleInfo[groupMark]
@@ -1689,6 +1795,8 @@
    
    champMgr = GetChampionshipMgr()
    pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID)
    if not pkZoneMgr:
        return
    battleObj = pkZoneMgr.GetBattle(groupMark, battleNum)
    if not battleObj:
        return
@@ -1840,13 +1948,21 @@
    champMgr = GetChampionshipMgr()
    champMgr.ClearOfficialZone() # 最终结算重置仙官信息,替换最新仙官
    
    # 膜拜重置
    worshipType = ShareDefine.Def_WorshipType_CrossChampionship
    GameWorship.DelWorshipPlayer(worshipType)
    pkZoneIDList = champMgr.GetChampPKZoneIDList()
    GameWorld.Log("pkZoneIDList=%s" % pkZoneIDList)
    
    worshipList = []
    syncNewXiangongDict = {}
    for zoneID in pkZoneIDList:
        GameWorld.Log("=== 结算排位分区: zoneID=%s ===" % zoneID, zoneID)
        finalPlayerIDList = []
        pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID)
        if not pkZoneMgr:
            continue
        battleNumList = pkZoneMgr.battleInfo.get(finalGroupMark, {}).keys()
        for battleNum in battleNumList:
            batObj = pkZoneMgr.GetBattle(finalGroupMark, battleNum)
@@ -1872,8 +1988,9 @@
            rankIpyData = IpyGameDataPY.GetIpyGameData("ChampionshipRank", rank)
            officialID = rankIpyData.GetMainOfficialID() if rankIpyData else 0
            rankAwardItemList = rankIpyData.GetRankAwardItemList() if rankIpyData else []
            GameWorld.Log("    最终排名: zoneID=%s,rank=%s,playerID=%s,officialID=%s,rankAwardItemList=%s,accID=%s,fightPower=%s"
                          % (zoneID, rank, playerID, officialID, rankAwardItemList, accID, fightPower), zoneID)
            xiangongID = rankIpyData.GetXiangongID() if rankIpyData else 0
            GameWorld.Log("    最终排名: zoneID=%s,rank=%s,playerID=%s,officialID=%s,xiangongID=%s,rankAwardItemList=%s,accID=%s,fightPower=%s"
                          % (zoneID, rank, playerID, officialID, xiangongID, rankAwardItemList, accID, fightPower), zoneID)
            
            if officialID:
                offObj = ChampionshipOfficial()
@@ -1884,10 +2001,21 @@
                
                offZoneMgr.officialInfo[officialID] = offObj
                
                worshipValue = rank
                if GameWorship.GetWorshipIpyData(worshipType, worshipValue):
                    worshipData = GameWorship.AddWorshipPlayer(playerID, worshipType, worshipValue, zoneID=zoneID, isNotify=False)
                    worshipList.append(worshipData)
            # 名次奖励
            paramList = [rank]
            PlayerCompensation.SendMailByKey("CrossChampionshipPKRank", [playerID], rankAwardItemList, paramList, crossMail=True)
            
            if xiangongID:
                crossZoneName = GameWorld.GetCrossZoneName()
                zoneIpyData = IpyGameDataPY.GetIpyGameData("CrossZonePK", crossZoneName, zoneID)
                serverIDRangeList = zoneIpyData.GetServerGroupIDList() if zoneIpyData else []
                GameXiangong.AddXiangongPlayer(xiangongID, playerID, serverIDRangeList, rank, syncNewXiangongDict)
        # 处理4强竞猜发奖励
        guessType = 4
        moneyType = ShareDefine.TYPE_Price_GongdePoint
@@ -1901,6 +2029,7 @@
            for guessObj in guessList:
                if guessObj.guessType != guessType or guessObj.guessPlayerID != guessPlayerID:
                    continue
                guessObj.isClose = 1
                tagPlayerID = guessObj.tagPlayerID
                guessRank = guessObj.guessRank
                moneyTotal = guessObj.moneyTotal
@@ -1925,6 +2054,10 @@
    
    serverGroupIDList = [] # 全服统一逻辑
    PlayerControl.WorldNotifyCross(serverGroupIDList, 0, "ChampionshipOver")
    # 通知新添加的膜拜
    GameWorship.SyncAddCrossWorship(worshipList)
    GameXiangong.SendNewXiangongPlayerToClientServer(syncNewXiangongDict)
    GameWorld.Log("===================================================================")
    return
@@ -1933,6 +2066,8 @@
    
    champMgr = GetChampionshipMgr()
    pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID)
    if not pkZoneMgr:
        return {}
    
    # 决赛
    finalGroupMark = 2
@@ -2168,6 +2303,8 @@
    
    champMgr = GetChampionshipMgr()
    pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID)
    if not pkZoneMgr:
        return
    tagBatPlayer = pkZoneMgr.GetBatPlayer(tagPlayerID)
    if not tagBatPlayer:
        GameWorld.ErrLog("该分区不存在该参赛玩家,无法排位竞猜! zoneID=%s,tagPlayerID=%s" % (zoneID, tagPlayerID), playerID)
@@ -2278,7 +2415,21 @@
    playerID = msgData["playerID"]
    mainOfficialID = msgData["mainOfficialID"]
    officialID = msgData["officialID"]
    cancel = msgData["cancel"]
    PropData = msgData["PropData"]
    if cancel:
        champMgr = GetChampionshipMgr()
        offZoneMgr = champMgr.GetChampOfficialZoneMgr(zoneID)
        officialObj = offZoneMgr.GetOfficialObj(officialID)
        if not officialObj:
            return
        if playerID not in officialObj.applyPlayerInfo:
            GameWorld.ErrLog("不在仙官申请列表里! zoneID=%s,mainOfficialID=%s,officialID=%s" % (zoneID, mainOfficialID, officialID), playerID)
            return
        officialObj.applyPlayerInfo.pop(playerID, None)
        Send_CrossServerMsg_ChampionshipOfficial(zoneID, [officialID])
        return
    
    mainIpyData = IpyGameDataPY.GetIpyGameData("ChampionshipOfficial", mainOfficialID)
    if not mainIpyData:
@@ -2518,6 +2669,7 @@
        GameWorld.Log("挑战目标仙官玩家ID结果! zoneID=%s,mainOfficialID=%s,officialID=%s,fightPower=%s,tagFightPower=%s,tagPlayerID=%s,Ret=%s" 
                      % (zoneID, mainOfficialID, officialID, fightPower, tagFightPower, tagPlayerID, Ret), playerID)
        
    syncOfficialIDList = [officialID]
    playerName = PropData.get("Name", str(playerID))
    # 暂时只记录挑战胜利的
    if Ret == 1:
@@ -2536,13 +2688,22 @@
        officialObj.ResetPlayer()
        officialObj.playerID = playerID
        
        # 移除该玩家的其他仙官申请
        for offID in offZoneMgr.officialInfo.keys():
            offObj = offZoneMgr.GetOfficialObj(offID)
            if not offObj:
                continue
            if playerID in offObj.applyPlayerInfo:
                offObj.applyPlayerInfo.pop(playerID)
                syncOfficialIDList.append(offID)
        # 邮件通知对方,官职被挑战了
        if offPlayerID:
            PlayerCompensation.SendMailByKey("CrossChampionshipOfficialBeChallenge", [offPlayerID], [], [playerName, officialID], crossMail=True)
            
    exData = {"exDataType":"OfficialChallenge", "playerID":playerID, "tagPlayerName":officialObj.playerName,
              "mainOfficialID":mainOfficialID, "officialID":officialID, "Ret":Ret}
    Send_CrossServerMsg_ChampionshipOfficial(zoneID, [officialID], exData=exData)
    Send_CrossServerMsg_ChampionshipOfficial(zoneID, syncOfficialIDList, exData=exData)
    return
#// C0 23 跨服排位仙官挑战记录查询 #tagCGChampionshipOfficialChallengeQuery
@@ -2738,14 +2899,19 @@
def Sync_ChampionshipPKZoneGroupInfo(zoneID, groupMarkDict=None, curPlayer=None):
    ## 同步排位分区分组信息
    # @param groupMarkDict: {groupMark:[battleNum, ...], ...}
    champMgr = GetChampionshipMgr()
    if curPlayer:
        playerZoneID = champMgr.GetPlayerPKZoneID(curPlayer.GetPlayerID())
        if playerZoneID != zoneID:
            return
        if not PlayerControl.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_Championship):
            return
        
    pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID)
    if not pkZoneMgr:
        return
    if groupMarkDict == None:
        groupMarkDict = {}
        for groupMark, groupDict in pkZoneMgr.battleInfo.items():
@@ -2814,6 +2980,8 @@
            playerZoneID = champMgr.GetPlayerPKZoneID(curPlayer.GetPlayerID())
            if playerZoneID != zoneID:
                continue
            if not PlayerControl.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_Championship):
                continue
            NetPackCommon.SendFakePack(curPlayer, clientPack)
            
    return
@@ -2827,8 +2995,12 @@
    playerZoneID = champMgr.GetPlayerPKZoneID(playerID)
    if not playerZoneID:
        return
    if not PlayerControl.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_Championship):
        return
    
    pkZoneMgr = champMgr.GetChampPKZoneMgr(playerZoneID)
    if not pkZoneMgr:
        return
    
    clientPack = ChPyNetSendPack.tagGCChampionshipGuessPriInfo()
    clientPack.ZoneID = playerZoneID
@@ -2870,8 +3042,12 @@
        playerZoneID = champMgr.GetPlayerPKZoneID(curPlayer.GetPlayerID())
        if playerZoneID != zoneID:
            return
        if not PlayerControl.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_Championship):
            return
        
    pkZoneMgr = champMgr.GetChampPKZoneMgr(zoneID)
    if not pkZoneMgr:
        return
    
    # 公共竞猜信息
    clientPack = ChPyNetSendPack.tagGCChampionshipGuessPubInfo()
@@ -2911,6 +3087,8 @@
            playerZoneID = champMgr.GetPlayerPKZoneID(curPlayer.GetPlayerID())
            if playerZoneID != zoneID:
                continue
            if not PlayerControl.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_Championship):
                continue
            NetPackCommon.SendFakePack(curPlayer, clientPack)
    return
@@ -2922,6 +3100,8 @@
    if curPlayer:
        playerZoneID = champMgr.GetPlayerOfficialZoneID(curPlayer.GetPlayerID())
        if playerZoneID != zoneID:
            return
        if not PlayerControl.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_Championship):
            return
        
    clientPack = ChPyNetSendPack.tagGCChampionshipOfficialInfo()
@@ -2982,6 +3162,8 @@
            playerZoneID = champMgr.GetPlayerOfficialZoneID(curPlayer.GetPlayerID())
            if playerZoneID != zoneID:
                continue
            if not PlayerControl.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_Championship):
                continue
            NetPackCommon.SendFakePack(curPlayer, clientPack)
            
    return