|  |  |  | 
|---|
|  |  |  | self.serverGroupID = 0 # 所属服务器ID,一个服务器ID由多个服组成 | 
|---|
|  |  |  | self.pkZoneID = 0 # 所属赛区ID,一个赛区由多个服务器ID组成 | 
|---|
|  |  |  | self.seasonID = 0 # 赛季ID | 
|---|
|  |  |  | self.notifyMatchRobotTick = 0 # 通知匹配到机器人的tick | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def GetDRInfo(self): | 
|---|
|  |  |  | 
|---|
|  |  |  | return | 
|---|
|  |  |  | maxCount = min(2000, maxCount) | 
|---|
|  |  |  | upBillboardList = [] | 
|---|
|  |  |  | if winner.danLV >= danLVLimit: | 
|---|
|  |  |  | upBillboardList.append(winner) | 
|---|
|  |  |  | else: | 
|---|
|  |  |  | GameWorld.DebugLog("    段位不足,无法上榜! winnerDanLV=%s < danLVLimit=%s" % (winner.danLV, danLVLimit), winner.playerID) | 
|---|
|  |  |  | if loser.danLV >= danLVLimit: | 
|---|
|  |  |  | upBillboardList.append(loser) | 
|---|
|  |  |  | else: | 
|---|
|  |  |  | GameWorld.DebugLog("    段位不足,无法上榜! loserDanLV=%s < danLVLimit=%s" % (loser.danLV, danLVLimit), loser.playerID) | 
|---|
|  |  |  | if winner: | 
|---|
|  |  |  | if winner.danLV >= danLVLimit: | 
|---|
|  |  |  | upBillboardList.append(winner) | 
|---|
|  |  |  | else: | 
|---|
|  |  |  | GameWorld.DebugLog("    段位不足,无法上榜! winnerDanLV=%s < danLVLimit=%s" % (winner.danLV, danLVLimit), winner.playerID) | 
|---|
|  |  |  | if loser: | 
|---|
|  |  |  | if loser.danLV >= danLVLimit: | 
|---|
|  |  |  | upBillboardList.append(loser) | 
|---|
|  |  |  | else: | 
|---|
|  |  |  | GameWorld.DebugLog("    段位不足,无法上榜! loserDanLV=%s < danLVLimit=%s" % (loser.danLV, danLVLimit), loser.playerID) | 
|---|
|  |  |  | if not upBillboardList: | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | if not preState and isOpen: | 
|---|
|  |  |  | PyGameData.g_crossPKPlayerDict = {} | 
|---|
|  |  |  | PyGameData.g_crossPKZoneMatchPlayerDict = {} | 
|---|
|  |  |  | PyGameData.g_crossPKZoneMatchRobotPlayerDict = {} | 
|---|
|  |  |  | PyGameData.g_crossPKRoomDict = {} | 
|---|
|  |  |  | GameWorld.Log("跨服PK匹配状态开启,重置相关匹配数据!") | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | pkScore = playerInfoDict["pkScore"] # 当前积分 | 
|---|
|  |  |  | danLV = playerInfoDict["danLV"] # 当前段位 | 
|---|
|  |  |  | cWinCount = playerInfoDict["cWinCount"] # 连胜次数 | 
|---|
|  |  |  | cLoseCount = playerInfoDict["cLoseCount"] # 连败次数 | 
|---|
|  |  |  | ondayScore = playerInfoDict["ondayScore"] # 过天时的积分 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if playerID in PyGameData.g_crossPKZoneMatchRobotPlayerDict: | 
|---|
|  |  |  | GameWorld.Log("玩家已匹配机器人,无法重复发起匹配! playerID=%s,accID=%s" % (playerID, accID)) | 
|---|
|  |  |  | CrossRealmMsg.SendMsgToClientServer(ShareDefine.CrossServerMsg_PKMatchReqRet, [playerID, 2], [serverGroupID]) | 
|---|
|  |  |  | return | 
|---|
|  |  |  | zoneMatchPlayerList = PyGameData.g_crossPKZoneMatchPlayerDict.get(pkZoneID, []) | 
|---|
|  |  |  | if playerID in zoneMatchPlayerList: | 
|---|
|  |  |  | GameWorld.Log("玩家正在匹配中,无法重复发起匹配!playerID=%s,accID=%s" % (playerID, accID)) | 
|---|
|  |  |  | GameWorld.Log("玩家正在匹配中,无法重复发起匹配! playerID=%s,accID=%s" % (playerID, accID)) | 
|---|
|  |  |  | CrossRealmMsg.SendMsgToClientServer(ShareDefine.CrossServerMsg_PKMatchReqRet, [playerID, 1], [serverGroupID]) | 
|---|
|  |  |  | return | 
|---|
|  |  |  | if playerID in PyGameData.g_crossPKPlayerDict: | 
|---|
|  |  |  | GameWorld.Log("玩家正在战斗中,无法重复发起匹配!playerID=%s,accID=%s" % (playerID, accID)) | 
|---|
|  |  |  | GameWorld.Log("玩家正在战斗中,无法重复发起匹配! playerID=%s,accID=%s" % (playerID, accID)) | 
|---|
|  |  |  | CrossRealmMsg.SendMsgToClientServer(ShareDefine.CrossServerMsg_PKMatchReqRet, [playerID, -2], [serverGroupID]) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | pkPlayer.serverGroupID = serverGroupID | 
|---|
|  |  |  | pkPlayer.pkZoneID = pkZoneID | 
|---|
|  |  |  | pkPlayer.seasonID = seasonID | 
|---|
|  |  |  |  | 
|---|
|  |  |  | # 判断是否匹配机器人 | 
|---|
|  |  |  | matchRobotRate = 0 | 
|---|
|  |  |  | danIpyData = IpyGameDataPY.GetIpyGameData("CrossRealmPKDan", danLV) | 
|---|
|  |  |  | if danIpyData: | 
|---|
|  |  |  | matchRobotRate = danIpyData.GetMatchRobotRate() + danIpyData.GetMatchRobotRateEx() * cLoseCount | 
|---|
|  |  |  | if matchRobotRate and GameWorld.CanHappen(matchRobotRate, 100): | 
|---|
|  |  |  | pkPlayer.notifyMatchRobotTick = tick + random.randint(3, 5) * 1000 | 
|---|
|  |  |  | PyGameData.g_crossPKZoneMatchRobotPlayerDict[playerID] = pkPlayer | 
|---|
|  |  |  | GameWorld.DebugLog("玩家加入匹配: seasonID=%s,pkZoneID=%s,serverGroupID=%s,accID=%s,playerID=%s,pkScore=%s,fightPower=%s,cWinCount=%s" | 
|---|
|  |  |  | % (seasonID, pkZoneID, serverGroupID, accID, playerID, pkScore, fightPower, cWinCount)) | 
|---|
|  |  |  | GameWorld.DebugLog("    本次匹配到机器人: danLV=%s,cLoseCount=%s,概率=%s" % (danLV, cLoseCount, matchRobotRate), playerID) | 
|---|
|  |  |  | #这里优化下暂通知开始匹配,实际匹配到机器人做延迟通知 | 
|---|
|  |  |  | CrossRealmMsg.SendMsgToClientServer(ShareDefine.CrossServerMsg_PKMatchReqRet, [playerID, 1], [serverGroupID]) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | PyGameData.g_crossPKPlayerDict[playerID] = pkPlayer | 
|---|
|  |  |  |  | 
|---|
|  |  |  | # 加入赛区匹配列表 | 
|---|
|  |  |  | zoneMatchPlayerList.append(playerID) | 
|---|
|  |  |  | PyGameData.g_crossPKZoneMatchPlayerDict[pkZoneID] = zoneMatchPlayerList | 
|---|
|  |  |  |  | 
|---|
|  |  |  | GameWorld.DebugLog("玩家加入匹配: seasonID=%s,pkZoneID=%s,serverGroupID=%s,accID=%s,playerID=%s,pkScore=%s,fightPower=%s,cWinCount=%s,len(zoneMatchPlayerList)=%s" | 
|---|
|  |  |  | % (seasonID, pkZoneID, serverGroupID, accID, playerID, pkScore, fightPower, cWinCount, len(zoneMatchPlayerList))) | 
|---|
|  |  |  | GameWorld.DebugLog("玩家加入匹配: seasonID=%s,pkZoneID=%s,serverGroupID=%s,accID=%s,playerID=%s,pkScore=%s,fightPower=%s,cWinCount=%s,cLoseCount=%s,概率=%s,len(zoneMatchPlayerList)=%s" | 
|---|
|  |  |  | % (seasonID, pkZoneID, serverGroupID, accID, playerID, pkScore, fightPower, cWinCount, cLoseCount, matchRobotRate, len(zoneMatchPlayerList))) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | CrossRealmMsg.SendMsgToClientServer(ShareDefine.CrossServerMsg_PKMatchReqRet, [playerID, 1], [serverGroupID]) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def __DelayNotifyMatchRobot(tick): | 
|---|
|  |  |  | ## 做体验,延迟通知匹配到机器人 | 
|---|
|  |  |  | for playerID, pkPlayer in PyGameData.g_crossPKZoneMatchRobotPlayerDict.items(): | 
|---|
|  |  |  | if pkPlayer.notifyMatchRobotTick == -1: | 
|---|
|  |  |  | #GameWorld.DebugLog("已通知过玩家匹配到机器人", playerID) | 
|---|
|  |  |  | continue | 
|---|
|  |  |  | if tick < pkPlayer.notifyMatchRobotTick: | 
|---|
|  |  |  | continue | 
|---|
|  |  |  | pkPlayer.notifyMatchRobotTick = -1 | 
|---|
|  |  |  | serverGroupID = pkPlayer.serverGroupID | 
|---|
|  |  |  | GameWorld.DebugLog("延迟通知玩家匹配到机器人: serverGroupID=%s" % (serverGroupID), playerID) | 
|---|
|  |  |  | CrossRealmMsg.SendMsgToClientServer(ShareDefine.CrossServerMsg_PKMatchReqRet, [playerID, 2], [serverGroupID]) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def __DoTimeOutPlayerMatchRobot(matchTickSortList, matchPlayerIDList, tick): | 
|---|
|  |  |  | ## 超时很久很久的玩家系统匹配机器人 | 
|---|
|  |  |  | if not matchPlayerIDList: | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | matchRobotTimeoutInfo = IpyGameDataPY.GetFuncEvalCfg("CrossRealmPKRobot", 1) | 
|---|
|  |  |  | if len(matchRobotTimeoutInfo) != 2: | 
|---|
|  |  |  | return | 
|---|
|  |  |  | matchRobotTick = random.randint(matchRobotTimeoutInfo[0], matchRobotTimeoutInfo[1]) * 1000 # 超时匹配机器人时间tick | 
|---|
|  |  |  |  | 
|---|
|  |  |  | for i, matchPlayer in enumerate(matchTickSortList): | 
|---|
|  |  |  |  | 
|---|
|  |  |  | playerID = matchPlayer.playerID | 
|---|
|  |  |  | if playerID not in matchPlayerIDList: | 
|---|
|  |  |  | continue | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if tick - matchPlayer.matchTick < matchRobotTick: | 
|---|
|  |  |  | #GameWorld.DebugLog("    i=%s,玩家未满足超时匹配机器人时间条件!" % (i)) | 
|---|
|  |  |  | break | 
|---|
|  |  |  |  | 
|---|
|  |  |  | matchPlayerIDList.remove(playerID) # 这个列表为分区对应匹配中的玩家列表 PyGameData.g_crossPKZoneMatchPlayerDict[pkZoneID] | 
|---|
|  |  |  |  | 
|---|
|  |  |  | PyGameData.g_crossPKZoneMatchRobotPlayerDict[playerID] = matchPlayer | 
|---|
|  |  |  | matchPlayer.notifyMatchRobotTick = -1 | 
|---|
|  |  |  | serverGroupID = matchPlayer.serverGroupID | 
|---|
|  |  |  | GameWorld.DebugLog("直接通知超时玩家匹配到机器人: serverGroupID=%s" % (serverGroupID), playerID) | 
|---|
|  |  |  | CrossRealmMsg.SendMsgToClientServer(ShareDefine.CrossServerMsg_PKMatchReqRet, [playerID, 2], [serverGroupID]) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def ClientServerMsg_PKCancel(playerInfoDict, tick): | 
|---|
|  |  |  | 
|---|
|  |  |  | return | 
|---|
|  |  |  | GameWorld.GetGameWorld().SetDict(processTickKey, tick) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | # 延迟通知匹配到机器人的 | 
|---|
|  |  |  | __DelayNotifyMatchRobot(tick) | 
|---|
|  |  |  | # 处理超时的房间 | 
|---|
|  |  |  | __DoCheckRoomTimeout(tick) | 
|---|
|  |  |  | # 通知已准备好的房间玩家可进入跨服 | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | # 每个赛区单独匹配 | 
|---|
|  |  |  | for pkZoneID, matchPlayerIDList in PyGameData.g_crossPKZoneMatchPlayerDict.items(): | 
|---|
|  |  |  | matchPlayerCount = len(matchPlayerIDList) | 
|---|
|  |  |  | if matchPlayerCount < 2: | 
|---|
|  |  |  | #GameWorld.Log("匹配PK人数不足,不处理!pkZoneID=%s, 总人数:%s" % (pkZoneID, matchPlayerCount)) | 
|---|
|  |  |  | if not matchPlayerIDList: | 
|---|
|  |  |  | #GameWorld.Log("没有玩家匹配PK,不处理!pkZoneID=%s" % (pkZoneID)) | 
|---|
|  |  |  | continue | 
|---|
|  |  |  | matchPlayerCount = len(matchPlayerIDList) | 
|---|
|  |  |  | #        if matchPlayerCount < 2: | 
|---|
|  |  |  | #            #GameWorld.Log("匹配PK人数不足,不处理!pkZoneID=%s, 总人数:%s" % (pkZoneID, matchPlayerCount)) | 
|---|
|  |  |  | #            continue | 
|---|
|  |  |  |  | 
|---|
|  |  |  | GameWorld.DebugLog("★★★★★★★★★★开始跨服PK匹配(pkZoneID=%s, 总人数:%s)★★★★★★★★★★" % (pkZoneID, matchPlayerCount)) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | GameWorld.DebugLog("==========匹配结束(总匹配队伍:%s)==========" % len(matchPlayerVSList)) | 
|---|
|  |  |  | #GameWorld.DebugLog("crossPlayerIDList=%s" % PyGameData.g_crossPKPlayerDict.keys()) | 
|---|
|  |  |  | #GameWorld.DebugLog("matchPlayerIDList=%s" % PyGameData.g_crossPKZoneMatchPlayerDict[pkZoneID]) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | __DoTimeOutPlayerMatchRobot(matchTickSortList, matchPlayerIDList, tick) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | DR_CrossReamlPK("PKOverRoom", dataDict) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def UpdatePKPlayerScore(roomID, pkPlayer, isWin): | 
|---|
|  |  |  | ## 更新PK玩家积分 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | playerID = pkPlayer.playerID | 
|---|
|  |  |  | cWinCount = pkPlayer.cWinCount | 
|---|
|  |  |  | pkScore = pkPlayer.pkScore | 
|---|
|  |  |  | danLV = pkPlayer.danLV | 
|---|
|  |  |  | dayScore = max(0, pkScore - pkPlayer.ondayScore)# 今日已获得积分,正积分 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | GameWorld.DebugLog("roomID=%s,playerID=%s,isWin=%s,dayScore=%s,pkScore=%s,danLV=%s,cWinCount=%s" | 
|---|
|  |  |  | % (roomID, playerID, isWin, dayScore, pkScore, danLV, cWinCount)) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | pkDanIpyData = IpyGameDataPY.GetIpyGameData("CrossRealmPKDan", danLV) | 
|---|
|  |  |  | if not pkDanIpyData: | 
|---|
|  |  |  | GameWorld.ErrLog("跨服PK房间段位数据异常! roomID=%s,playerID=%s,danLV=%s" % (roomID, playerID, danLV)) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | baseScoreList = IpyGameDataPY.GetFuncEvalCfg("CrossRealmPKScore", 2) # 胜负保底分 | 
|---|
|  |  |  | wBaseScore = baseScoreList[0] if len(baseScoreList) > 0 else 0 | 
|---|
|  |  |  | lBaseScore = baseScoreList[1] if len(baseScoreList) > 1 else 0 | 
|---|
|  |  |  | wExScore = eval(IpyGameDataPY.GetFuncCompileCfg("CrossRealmPKScore", 3)) # 胜方附加分 | 
|---|
|  |  |  | lExScore = 0 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if isWin: | 
|---|
|  |  |  | addScore = wBaseScore + wExScore | 
|---|
|  |  |  | pkPlayer.cWinCount += 1 | 
|---|
|  |  |  | else: | 
|---|
|  |  |  | addScore = lBaseScore + lExScore | 
|---|
|  |  |  | pkPlayer.cWinCount = 0 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | dayMaxScore = IpyGameDataPY.GetFuncCfg("CrossRealmPKScore", 1) # 每日获得积分上限,0为不限制 | 
|---|
|  |  |  | if dayMaxScore and addScore: | 
|---|
|  |  |  | addScore = min(dayMaxScore - dayScore, addScore) | 
|---|
|  |  |  | pkPlayer.pkScore += addScore | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if pkDanIpyData and pkDanIpyData.GetLVUpScore() and pkPlayer.pkScore >= pkDanIpyData.GetLVUpScore(): | 
|---|
|  |  |  | pkPlayer.danLV += 1 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return addScore | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def ClientServerMsg_PKRobotOver(serverGroupID, playerInfoDict, tick): | 
|---|
|  |  |  | ## 收到子服同步的PK机器人结算 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if not GameWorld.IsCrossServer(): | 
|---|
|  |  |  | GameWorld.ErrLog("非跨服服务器不处理跨服PK匹配请求!") | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | playerID = playerInfoDict["playerID"] # 角色ID | 
|---|
|  |  |  | isWinner = playerInfoDict["isWinner"] # 是否获胜 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if playerID not in PyGameData.g_crossPKZoneMatchRobotPlayerDict: | 
|---|
|  |  |  | GameWorld.DebugLog("玩家没有匹配到机器人,无法结算PK机器人奖励!", playerID) | 
|---|
|  |  |  | return | 
|---|
|  |  |  | pkPlayer = PyGameData.g_crossPKZoneMatchRobotPlayerDict.pop(playerID) | 
|---|
|  |  |  | if playerID in PyGameData.g_crossPKPlayerDict: | 
|---|
|  |  |  | PyGameData.g_crossPKPlayerDict.pop(playerID) | 
|---|
|  |  |  | zoneID = pkPlayer.pkZoneID | 
|---|
|  |  |  | seasonID = pkPlayer.seasonID | 
|---|
|  |  |  |  | 
|---|
|  |  |  | GameWorld.Log("机器人跨服PK结算: isWinner=%s,zoneID=%s,seasonID=%s,pkScore=%s,danLV=%s,cWinCount=%s" | 
|---|
|  |  |  | % (isWinner, zoneID, seasonID, pkPlayer.pkScore, pkPlayer.danLV, pkPlayer.cWinCount), playerID) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | roomID = 0 | 
|---|
|  |  |  | addScore = UpdatePKPlayerScore(roomID, pkPlayer, isWinner) | 
|---|
|  |  |  | pkScore = pkPlayer.pkScore | 
|---|
|  |  |  | danLV = pkPlayer.danLV | 
|---|
|  |  |  | cWinCount = pkPlayer.cWinCount | 
|---|
|  |  |  |  | 
|---|
|  |  |  | GameWorld.Log("    更新: addScore=%s,pkScore=%s,danLV=%s,cWinCount=%s" % (addScore,pkScore, danLV, cWinCount), playerID) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if isWinner: | 
|---|
|  |  |  | winner, loser = pkPlayer, None | 
|---|
|  |  |  | else: | 
|---|
|  |  |  | winner, loser = None, pkPlayer | 
|---|
|  |  |  |  | 
|---|
|  |  |  | # 更新排行榜 | 
|---|
|  |  |  | UpdateCrossPKBillboard(zoneID, seasonID, winner, loser) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | # PK机器人默认结果数据 | 
|---|
|  |  |  | overType = 0 | 
|---|
|  |  |  | roundWinnerIDList = [] | 
|---|
|  |  |  | notifyState = False | 
|---|
|  |  |  | winnerID = winner.playerID if winner else 0 | 
|---|
|  |  |  | tagPlayerID = 0 | 
|---|
|  |  |  | tagPlayerName = "" | 
|---|
|  |  |  |  | 
|---|
|  |  |  | timeStr = GameWorld.GetCurrentDataTimeStr() | 
|---|
|  |  |  | playerOverDict = {} | 
|---|
|  |  |  | playerOverDict[playerID] = [roomID, zoneID, seasonID, timeStr, overType, winnerID, roundWinnerIDList] \ | 
|---|
|  |  |  | + [serverGroupID, pkScore, danLV, cWinCount, addScore, tagPlayerID, tagPlayerName, notifyState] | 
|---|
|  |  |  |  | 
|---|
|  |  |  | serverGroupIDList = [pkPlayer.serverGroupID] | 
|---|
|  |  |  | GameWorld.DebugLog("同步子服战斗结果: seasonID=%s,timeStr=%s,roomID=%s,overType=%s,winnerID=%s,roundWinnerIDList=%s" | 
|---|
|  |  |  | % (seasonID, timeStr, roomID, overType, winnerID, roundWinnerIDList)) | 
|---|
|  |  |  | # 同步子服 | 
|---|
|  |  |  | CrossRealmMsg.SendMsgToClientServer(ShareDefine.CrossServerMsg_PKOverInfo, playerOverDict, serverGroupIDList) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | # 记录流向 | 
|---|
|  |  |  | dataDict = {"zoneID":zoneID, "seasonID":seasonID, "pkPlayer":pkPlayer.GetDRInfo()} | 
|---|
|  |  |  | DR_CrossReamlPK("PKOverRobot", dataDict) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ##================================== 以下是子服逻辑 ========================================== | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def OnGameServerInitOK(): | 
|---|
|  |  |  | 
|---|
|  |  |  | if not curPlayer: | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if not result: | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if result == -2: | 
|---|
|  |  |  | PlayerControl.NotifyCode(curPlayer, "CrossMatching17") | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | startMatchPack = ChPyNetSendPack.tagGCCrossRealmPKStartMatch() | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if result == 1: | 
|---|
|  |  |  | SetIsCrossPKMatching(curPlayer, 1) | 
|---|
|  |  |  | NetPackCommon.SendFakePack(curPlayer, ChPyNetSendPack.tagGCCrossRealmPKStartMatch()) | 
|---|
|  |  |  | startMatchPack.IsRobot = 0 | 
|---|
|  |  |  | elif result == 2: | 
|---|
|  |  |  | startMatchPack.IsRobot = 1 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | NetPackCommon.SendFakePack(curPlayer, startMatchPack) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ## 跨服匹配状态 | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | sendMapOverInfo = [roomID, zoneID, seasonID, timeStr, overType, winnerID, roundWinnerIDList, pkScore, danLV, cWinCount, addScore, tagPlayerID, tagPlayerName, notifyState] | 
|---|
|  |  |  | player = GameWorld.GetPlayerManager().FindPlayerByID(playerID) | 
|---|
|  |  |  | if not player: | 
|---|
|  |  |  | CrossRealmPlayer.DoOfflinePlayerExitCrossServer(playerID) | 
|---|
|  |  |  | if not player or PlayerControl.GetIsTJG(player): | 
|---|
|  |  |  | GameWorld.DebugLog("    玩家不在线 或脱机中,先缓存,玩家上线后再同步,playerID=%s" % (playerID)) | 
|---|
|  |  |  | overInfoData = PyGameDataStruct.tagDBCrossPKUnNotifyOverInfo() | 
|---|