ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossChampionship.py
@@ -29,6 +29,7 @@
import PlayerControl
import PyDataManager
import NetPackCommon
import GameWorship
import PyGameData
import ChConfig
import PlayerFB
@@ -69,10 +70,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,...]
'''
@@ -80,7 +82,8 @@
'''
跨服排位争霸赛官职挑战信息
ShareDefine.Def_UniversalGameRecType_CrossChampionshipOffChallenge
value1:zoneID官职ID      官职ID*10 + 分区ID
value1:官职ID             官职ID
value2:zoneID            分区ID
StrValue3:               {挑战玩家信息key:value, ...}
'''
@@ -504,9 +507,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
@@ -537,9 +539,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
@@ -631,22 +632,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)
@@ -758,11 +760,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()
@@ -1382,7 +1395,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)
@@ -1934,9 +1947,14 @@
    champMgr = GetChampionshipMgr()
    champMgr.ClearOfficialZone() # 最终结算重置仙官信息,替换最新仙官
    
    # 膜拜重置
    worshipType = ShareDefine.Def_WorshipType_CrossChampionship
    GameWorship.DelWorshipPlayer(worshipType)
    pkZoneIDList = champMgr.GetChampPKZoneIDList()
    GameWorld.Log("pkZoneIDList=%s" % pkZoneIDList)
    
    worshipList = []
    for zoneID in pkZoneIDList:
        GameWorld.Log("=== 结算排位分区: zoneID=%s ===" % zoneID, zoneID)
        finalPlayerIDList = []
@@ -1980,6 +1998,11 @@
                
                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)
@@ -2022,6 +2045,9 @@
    
    serverGroupIDList = [] # 全服统一逻辑
    PlayerControl.WorldNotifyCross(serverGroupIDList, 0, "ChampionshipOver")
    # 通知新添加的膜拜
    GameWorship.SyncAddCrossWorship(worshipList)
    GameWorld.Log("===================================================================")
    return
@@ -2379,7 +2405,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:
@@ -2619,6 +2659,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:
@@ -2637,13 +2678,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
@@ -2839,11 +2889,13 @@
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)
@@ -2918,6 +2970,8 @@
            playerZoneID = champMgr.GetPlayerPKZoneID(curPlayer.GetPlayerID())
            if playerZoneID != zoneID:
                continue
            if not PlayerControl.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_Championship):
                continue
            NetPackCommon.SendFakePack(curPlayer, clientPack)
            
    return
@@ -2930,6 +2984,8 @@
    champMgr = GetChampionshipMgr()
    playerZoneID = champMgr.GetPlayerPKZoneID(playerID)
    if not playerZoneID:
        return
    if not PlayerControl.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_Championship):
        return
    
    pkZoneMgr = champMgr.GetChampPKZoneMgr(playerZoneID)
@@ -2976,6 +3032,8 @@
        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:
@@ -3019,6 +3077,8 @@
            playerZoneID = champMgr.GetPlayerPKZoneID(curPlayer.GetPlayerID())
            if playerZoneID != zoneID:
                continue
            if not PlayerControl.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_Championship):
                continue
            NetPackCommon.SendFakePack(curPlayer, clientPack)
    return
@@ -3030,6 +3090,8 @@
    if curPlayer:
        playerZoneID = champMgr.GetPlayerOfficialZoneID(curPlayer.GetPlayerID())
        if playerZoneID != zoneID:
            return
        if not PlayerControl.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_Championship):
            return
        
    clientPack = ChPyNetSendPack.tagGCChampionshipOfficialInfo()
@@ -3090,6 +3152,8 @@
            playerZoneID = champMgr.GetPlayerOfficialZoneID(curPlayer.GetPlayerID())
            if playerZoneID != zoneID:
                continue
            if not PlayerControl.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_Championship):
                continue
            NetPackCommon.SendFakePack(curPlayer, clientPack)
            
    return