| | |
| | | billboardData.PKScore = pkPlayer.pkScore
|
| | | billboardData.DanLV = pkPlayer.danLV
|
| | | billboardData.Time = billboardTime
|
| | | GameWorld.Log(" 更新PK积分排行榜: playerID=%s,pkScore=%s,order=%s" % (playerID, billboardData.PKScore, order), playerID)
|
| | | GameWorld.DebugLog(" 更新PK积分排行榜: playerID=%s,pkScore=%s,order=%s" % (playerID, billboardData.PKScore, order), playerID)
|
| | |
|
| | | # 战斗结算更新榜单先不排序,只设置需要排序
|
| | | if isUpd:
|
| | |
| | | def CrossServerMsg_PKSyncBillboard(syncInfo):
|
| | | ## 收到跨服服务器同步的排行榜信息
|
| | | zoneID, seasonID, syncBillboardList, exData, isFinalBillboardData = syncInfo
|
| | | GameWorld.Log("收到跨服服务器同步的排行榜信息: zoneID=%s,seasonID=%s,billboardDataCount=%s,exData=%s,isFinalBillboardData=%s" |
| | | % (zoneID, seasonID, len(syncBillboardList), exData, isFinalBillboardData))
|
| | | GameWorld.DebugLog("收到跨服服务器同步的排行榜信息: zoneID=%s,seasonID=%s,billboardDataCount=%s,exData=%s,isFinalBillboardData=%s" |
| | | % (zoneID, seasonID, len(syncBillboardList), exData, isFinalBillboardData))
|
| | |
|
| | | crossPKBillboardMgr = PyDataManager.GetCrossPKBillboardManager()
|
| | | billboardList, orderDict = crossPKBillboardMgr.UpdClientServerPKBillboard(zoneID, seasonID, syncBillboardList, isFinalBillboardData)
|
| | |
| | | CrossRealmMsg.SendMsgToCrossServer(ShareDefine.ClientServerMsg_PKCancel, dataMsg)
|
| | | PlayerControl.SetVsRoomId(curPlayer, 0)
|
| | | SetIsCrossPKMatching(curPlayer, 0)
|
| | | GameWorld.Log("发送取消跨服PK匹配到跨服服务器:dataMsg=%s" % str(dataMsg), curPlayer.GetPlayerID())
|
| | | GameWorld.DebugLog("发送取消跨服PK匹配到跨服服务器:dataMsg=%s" % str(dataMsg), curPlayer.GetPlayerID())
|
| | | return
|
| | |
|
| | | def ClientServerMsg_PKMatch(serverGroupID, playerInfoDict, tick):
|
| | |
| | | zoneMatchPlayerList.append(playerID)
|
| | | PyGameData.g_crossPKZoneMatchPlayerDict[pkZoneID] = zoneMatchPlayerList
|
| | |
|
| | | GameWorld.Log("玩家加入匹配: 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,len(zoneMatchPlayerList)=%s" |
| | | % (seasonID, pkZoneID, serverGroupID, accID, playerID, pkScore, fightPower, cWinCount, len(zoneMatchPlayerList)))
|
| | |
|
| | | CrossRealmMsg.SendMsgToClientServer(ShareDefine.CrossServerMsg_PKMatchReqRet, [playerID, 1], [serverGroupID])
|
| | | return
|
| | |
| | | GameWorld.Log("跨服对战房间已经开启了线路,或者双方数据都已传输完毕,不可再取消匹配!vsRoomID=%s" % vsRoomID)
|
| | | return
|
| | |
|
| | | GameWorld.Log("玩家取消匹配: reason=%s,accID=%s,playerID=%s,vsRoomID=%s" % (reason, accID, playerID, vsRoomID))
|
| | | GameWorld.DebugLog("玩家取消匹配: reason=%s,accID=%s,playerID=%s,vsRoomID=%s" % (reason, accID, playerID, vsRoomID))
|
| | |
|
| | | pkZoneID = 0
|
| | | if playerID in PyGameData.g_crossPKPlayerDict:
|
| | | pkPlayer = PyGameData.g_crossPKPlayerDict.pop(playerID)
|
| | | pkZoneID = pkPlayer.pkZoneID
|
| | | GameWorld.Log(" 移除PK玩家: pkZoneID=%s,accID=%s,playerID=%s" % (pkZoneID, accID, playerID))
|
| | | GameWorld.DebugLog(" 移除PK玩家: pkZoneID=%s,accID=%s,playerID=%s" % (pkZoneID, accID, playerID))
|
| | |
|
| | | zoneMatchPlayerList = PyGameData.g_crossPKZoneMatchPlayerDict.get(pkZoneID, [])
|
| | | if playerID in zoneMatchPlayerList:
|
| | | zoneMatchPlayerList.remove(playerID)
|
| | | GameWorld.Log(" 从匹配队列中删除,匹配队列剩余人数=%s" % (len(zoneMatchPlayerList)))
|
| | | GameWorld.DebugLog(" 从匹配队列中删除,匹配队列剩余人数=%s" % (len(zoneMatchPlayerList)))
|
| | |
|
| | | #取消所有存在该玩家的房间,子服不一定知道玩家当前最新所属房间ID, 故只能通过遍历删除已经为玩家创建的房间
|
| | | for roomID, pkRoom in PyGameData.g_crossPKRoomDict.items():
|
| | |
| | |
|
| | | for roomPlayerID in pkRoom.roomPlayerIDList:
|
| | | if roomPlayerID == playerID:
|
| | | GameWorld.Log(" 自己不处理: roomID=%s,playerID=%s" % (roomID, playerID))
|
| | | GameWorld.DebugLog(" 自己不处理: roomID=%s,playerID=%s" % (roomID, playerID))
|
| | | continue
|
| | |
|
| | | zoneMatchPlayerList = PyGameData.g_crossPKZoneMatchPlayerDict.get(pkZoneID, [])
|
| | | zoneMatchPlayerList.append(roomPlayerID)
|
| | | PyGameData.g_crossPKZoneMatchPlayerDict[pkZoneID] = zoneMatchPlayerList
|
| | | GameWorld.Log(" 将之前匹配的对手重新加入匹配队列: roomID=%s,roomPlayerID=%s,当前匹配人数=%s" |
| | | % (roomID, roomPlayerID, len(zoneMatchPlayerList)))
|
| | | GameWorld.DebugLog(" 将之前匹配的对手重新加入匹配队列: roomID=%s,roomPlayerID=%s,当前匹配人数=%s" |
| | | % (roomID, roomPlayerID, len(zoneMatchPlayerList)))
|
| | |
|
| | | PyGameData.g_crossPKRoomDict.pop(roomID)
|
| | | GameWorld.Log(" 移除房间: popRoomID=%s" % (roomID))
|
| | | GameWorld.DebugLog(" 移除房间: popRoomID=%s" % (roomID))
|
| | |
|
| | | # 记录流向
|
| | | dataDict = {"cancelPlayerID":playerID}
|
| | |
| | | if playerID not in vsRoom.readyPlayerIDList:
|
| | | vsRoom.readyPlayerIDList.append(playerID)
|
| | |
|
| | | GameWorld.Log("玩家跨服PK准备完毕: accID=%s,playerID=%s,vsRoomID=%s" % (accID, playerID, vsRoomID))
|
| | | GameWorld.DebugLog("玩家跨服PK准备完毕: accID=%s,playerID=%s,vsRoomID=%s" % (accID, playerID, vsRoomID))
|
| | | return
|
| | |
|
| | | def __ReadyOKRoomPlayerProcess(tick):
|
| | |
| | | continue
|
| | | vsRoom.roomState = ShareDefine.Def_VsRoom_State_PrepareFight
|
| | | vsRoom.readyTick = tick
|
| | | GameWorld.Log(" 准备好的房间: pkZoneID=%s,roomID=%s,mapID=%s,readyMemberDict=%s" % (pkZoneID, roomID, vsRoom.mapID, str(readyMemberDict)))
|
| | | GameWorld.DebugLog(" 准备好的房间: pkZoneID=%s,roomID=%s,mapID=%s,readyMemberDict=%s" % (pkZoneID, roomID, vsRoom.mapID, str(readyMemberDict)))
|
| | |
|
| | | sendReadyOKRoomList.append([roomID, readyMemberDict])
|
| | | serverGroupIDList += roomGroupIDList
|
| | |
|
| | | # 将已准备好的房间广播到子服
|
| | | if sendReadyOKRoomList:
|
| | | GameWorld.Log(" 已准备好的对战房间数: %s" % len(sendReadyOKRoomList))
|
| | | GameWorld.DebugLog(" 已准备好的对战房间数: %s" % len(sendReadyOKRoomList))
|
| | | CrossRealmMsg.SendMsgToClientServer(ShareDefine.CrossServerMsg_PKReadyOKRoomList, sendReadyOKRoomList, serverGroupIDList)
|
| | |
|
| | | return
|
| | |
| | | #GameWorld.Log("匹配PK人数不足,不处理!pkZoneID=%s, 总人数:%s" % (pkZoneID, matchPlayerCount))
|
| | | continue
|
| | |
|
| | | GameWorld.Log("★★★★★★★★★★开始跨服PK匹配(pkZoneID=%s, 总人数:%s)★★★★★★★★★★" % (pkZoneID, matchPlayerCount))
|
| | | GameWorld.DebugLog("★★★★★★★★★★开始跨服PK匹配(pkZoneID=%s, 总人数:%s)★★★★★★★★★★" % (pkZoneID, matchPlayerCount))
|
| | |
|
| | | matchPlayerList = []
|
| | | for matchPlayerID in matchPlayerIDList:
|
| | |
| | | # 给成功匹配的玩家非配对战房间
|
| | | matchPlayerVSList = matchPlayerVSList[:maxGroupCnt]
|
| | | __DoSetVSRoom(pkZoneID, matchPlayerVSList, tick)
|
| | | GameWorld.Log("==========匹配结束(总匹配队伍:%s)==========" % len(matchPlayerVSList))
|
| | | #GameWorld.Log("crossPlayerIDList=%s" % PyGameData.g_crossPKPlayerDict.keys())
|
| | | #GameWorld.Log("matchPlayerIDList=%s" % PyGameData.g_crossPKZoneMatchPlayerDict[pkZoneID])
|
| | | GameWorld.DebugLog("==========匹配结束(总匹配队伍:%s)==========" % len(matchPlayerVSList))
|
| | | #GameWorld.DebugLog("crossPlayerIDList=%s" % PyGameData.g_crossPKPlayerDict.keys())
|
| | | #GameWorld.DebugLog("matchPlayerIDList=%s" % PyGameData.g_crossPKZoneMatchPlayerDict[pkZoneID])
|
| | | return
|
| | |
|
| | |
|
| | |
| | | '''匹配超时玩家
|
| | | 匹配中的玩家按积分排序,最后一个默认匹配上一个,第一个默认匹配下一个,其他匹配前后积分差绝对值较小的一个
|
| | | '''
|
| | | GameWorld.Log(" ==优先匹配超时等待玩家==最大等待时间:%s, tick=%s" % (outTimeTick, tick))
|
| | | GameWorld.Log(" scoreSortListLen=%s" % len(scoreSortList))
|
| | | GameWorld.DebugLog(" ==优先匹配超时等待玩家==最大等待时间:%s, tick=%s" % (outTimeTick, tick))
|
| | | GameWorld.DebugLog(" scoreSortListLen=%s" % len(scoreSortList))
|
| | | for i, matchPlayer in enumerate(matchTickSortList):
|
| | | # 只有一个玩家
|
| | | if len(scoreSortList) <= 1:
|
| | | #GameWorld.Log(" 当前玩家数%s<=1,不再匹配!" % len(scoreSortList))
|
| | | #GameWorld.DebugLog(" 当前玩家数%s<=1,不再匹配!" % len(scoreSortList))
|
| | | break
|
| | |
|
| | | if tick - matchPlayer.matchTick < outTimeTick:
|
| | | #GameWorld.Log(" i=%s,玩家未超时,不再匹配!" % (i))
|
| | | #GameWorld.DebugLog(" i=%s,玩家未超时,不再匹配!" % (i))
|
| | | break
|
| | |
|
| | | GameWorld.Log(" i=%s,超时玩家, %s-%s=%s >= outTimeTick(%s)" |
| | | % (i, tick, matchPlayer.matchTick, tick - matchPlayer.matchTick, outTimeTick))
|
| | | GameWorld.DebugLog(" i=%s,超时玩家, %s-%s=%s >= outTimeTick(%s)" |
| | | % (i, tick, matchPlayer.matchTick, tick - matchPlayer.matchTick, outTimeTick))
|
| | | # 已经被匹配走了
|
| | | if matchPlayer not in scoreSortList:
|
| | | GameWorld.Log(" 已经被匹配走了!")
|
| | | GameWorld.DebugLog(" 已经被匹配走了!")
|
| | | continue
|
| | |
|
| | | outTimeIndex = scoreSortList.index(matchPlayer)
|
| | | # 最后一个默认匹配上一个
|
| | | if outTimeIndex == len(scoreSortList) - 1:
|
| | | vsIndex = outTimeIndex - 1
|
| | | GameWorld.Log(" 超时玩家积分排序索引%s,最后一个,默认匹配上一个索引%s!" % (outTimeIndex, vsIndex))
|
| | | GameWorld.DebugLog(" 超时玩家积分排序索引%s,最后一个,默认匹配上一个索引%s!" % (outTimeIndex, vsIndex))
|
| | | # 第一个默认匹配下一个
|
| | | elif outTimeIndex == 0:
|
| | | vsIndex = outTimeIndex + 1
|
| | | GameWorld.Log(" 超时玩家积分排序索引%s,第一个,默认匹配下一个索引%s!" % (outTimeIndex, vsIndex))
|
| | | GameWorld.DebugLog(" 超时玩家积分排序索引%s,第一个,默认匹配下一个索引%s!" % (outTimeIndex, vsIndex))
|
| | | # 其他情况匹配积分较近的一个
|
| | | else:
|
| | | preIndex = outTimeIndex - 1
|
| | |
| | | preDiff = abs(prePlayer.pkScore - matchPlayer.pkScore)
|
| | | nextDiff = abs(matchPlayer.pkScore - nextPlayer.pkScore)
|
| | | vsIndex = preIndex if preDiff <= nextDiff else nextIndex
|
| | | GameWorld.Log(" 超时玩家积分排序索引-积分(%s-%s),上一个(%s-%s),下一个(%s-%s),preDiff=%s,nextDiff=%s,vsIndex=%s" |
| | | % (outTimeIndex, matchPlayer.pkScore, preIndex, prePlayer.pkScore,
|
| | | nextIndex, nextPlayer.pkScore, preDiff, nextDiff, vsIndex))
|
| | | GameWorld.DebugLog(" 超时玩家积分排序索引-积分(%s-%s),上一个(%s-%s),下一个(%s-%s),preDiff=%s,nextDiff=%s,vsIndex=%s" |
| | | % (outTimeIndex, matchPlayer.pkScore, preIndex, prePlayer.pkScore, |
| | | nextIndex, nextPlayer.pkScore, preDiff, nextDiff, vsIndex))
|
| | |
|
| | | if outTimeIndex > vsIndex:
|
| | | scoreSortList.pop(outTimeIndex)
|
| | |
| | | ''' 匹配积分分段玩家
|
| | | 匹配中的玩家按段位积分归组,归组后,随机段位顺序,每个段位组中的玩家随机两两PK
|
| | | '''
|
| | | GameWorld.Log(" ==匹配积分分段玩家== maxGroupCnt=%s,scoreSortListLen=%s" % (maxGroupCnt, len(scoreSortList)))
|
| | | GameWorld.DebugLog(" ==匹配积分分段玩家== maxGroupCnt=%s,scoreSortListLen=%s" % (maxGroupCnt, len(scoreSortList)))
|
| | | danPlayerListDict = {} # 按积分分段列表分散玩家
|
| | | for matchPlayer in scoreSortList:
|
| | | danLV = matchPlayer.danLV
|
| | |
| | | danList = danPlayerListDict.keys()
|
| | | random.shuffle(danList) # 打乱段位顺序
|
| | |
|
| | | GameWorld.Log(" 积分分段个数: %s, %s" % (len(danList), danList))
|
| | | GameWorld.DebugLog(" 积分分段个数: %s, %s" % (len(danList), danList))
|
| | |
|
| | | # 优先匹配相同段位
|
| | | doCount = 0
|
| | |
| | | doCount += 1
|
| | | isMatchOK = False
|
| | | # # 日志输出分组明细
|
| | | # GameWorld.Log(" -------------")
|
| | | # GameWorld.DebugLog(" -------------")
|
| | | # for danLV in danList:
|
| | | # strList = []
|
| | | # for player in danPlayerListDict[danLV]:
|
| | | # strList.append((player.playerID, player.pkScore, player.fightPower))
|
| | | # GameWorld.Log(" 积分段组, danLV=%s, %s" % (danLV, str(strList)))
|
| | | # GameWorld.DebugLog(" 积分段组, danLV=%s, %s" % (danLV, str(strList)))
|
| | | # # -------------------------------
|
| | |
|
| | | for danLV in danList:
|
| | | danPlayerList = danPlayerListDict[danLV]
|
| | | danPlayerCount = len(danPlayerList)
|
| | | if danPlayerCount < 2:
|
| | | #GameWorld.Log(" 段位人数少于2个,不处理!doCount=%s,danLV=%s" % (doCount, danLV))
|
| | | #GameWorld.DebugLog(" 段位人数少于2个,不处理!doCount=%s,danLV=%s" % (doCount, danLV))
|
| | | continue
|
| | |
|
| | | vsIndexList = random.sample(xrange(danPlayerCount), 2) # 随机取两个索引对战
|
| | |
| | |
|
| | | matchPlayerVSList.append([aPlayer, bPlayer])
|
| | | isMatchOK = True
|
| | | GameWorld.Log(" 成功匹配相同段位玩家: aPlayerID=%s,aDanLV=%s VS bPlayerID=%s,bDanLV=%s" % (aPlayer.playerID, aPlayer.danLV, bPlayer.playerID, bPlayer.danLV))
|
| | | GameWorld.DebugLog(" 成功匹配相同段位玩家: aPlayerID=%s,aDanLV=%s VS bPlayerID=%s,bDanLV=%s" % (aPlayer.playerID, aPlayer.danLV, bPlayer.playerID, bPlayer.danLV))
|
| | |
|
| | | if len(matchPlayerVSList) >= maxGroupCnt:
|
| | | GameWorld.Log(" 已经达到最大匹配数! 已匹配对战数=%s, 不再匹配!doCount=%s" % (len(matchPlayerVSList), doCount))
|
| | | GameWorld.DebugLog(" 已经达到最大匹配数! 已匹配对战数=%s, 不再匹配!doCount=%s" % (len(matchPlayerVSList), doCount))
|
| | | break
|
| | |
|
| | | if not isMatchOK:
|
| | | GameWorld.Log(" 已经没有满足匹配条件的玩家! 不再匹配!doCount=%s" % (doCount))
|
| | | GameWorld.DebugLog(" 已经没有满足匹配条件的玩家! 不再匹配!doCount=%s" % (doCount))
|
| | | break
|
| | |
|
| | | # 不足再匹配范围段位
|
| | |
| | | doCount += 1
|
| | | isMatchOK = False
|
| | | # # 日志输出分组明细
|
| | | # GameWorld.Log(" -------------")
|
| | | # GameWorld.DebugLog(" -------------")
|
| | | # for danLV in danList:
|
| | | # strList = []
|
| | | # for player in danPlayerListDict[danLV]:
|
| | | # strList.append((player.playerID, player.pkScore, player.fightPower))
|
| | | # GameWorld.Log(" 积分段组, danLV=%s, %s" % (danLV, str(strList)))
|
| | | # GameWorld.DebugLog(" 积分段组, danLV=%s, %s" % (danLV, str(strList)))
|
| | | # # -------------------------------
|
| | |
|
| | | for danLV in danList:
|
| | |
| | | danMatchPlayerList += danPlayerListDict[matchDanLV]
|
| | |
|
| | | #matchPlayerIDList = [matchPlayer.playerID for matchPlayer in danMatchPlayerList]
|
| | | #GameWorld.Log("danLV=%s,danMatchRange=%s,matchPlayerIDList=%s" % (danLV, danMatchRange, matchPlayerIDList))
|
| | | #GameWorld.DebugLog("danLV=%s,danMatchRange=%s,matchPlayerIDList=%s" % (danLV, danMatchRange, matchPlayerIDList))
|
| | | matchPlayerCount = len(danMatchPlayerList)
|
| | | if matchPlayerCount < 2:
|
| | | #GameWorld.Log(" 段位范围人数少于2个,不处理!doCount=%s,danLV=%s,danMatchRange=%s" % (doCount, danLV, danMatchRange))
|
| | | #GameWorld.DebugLog(" 段位范围人数少于2个,不处理!doCount=%s,danLV=%s,danMatchRange=%s" % (doCount, danLV, danMatchRange))
|
| | | continue
|
| | |
|
| | | vsIndexList = random.sample(xrange(matchPlayerCount), 2) # 随机取两个索引对战
|
| | |
| | |
|
| | | matchPlayerVSList.append([aPlayer, bPlayer])
|
| | | isMatchOK = True
|
| | | GameWorld.Log(" 成功匹配范围段位玩家: aPlayerID=%s,aDanLV=%s VS bPlayerID=%s,bDanLV=%s | danLV=%s,danMatchRange=%s" |
| | | % (aPlayer.playerID, aPlayer.danLV, bPlayer.playerID, bPlayer.danLV, danLV, danMatchRange))
|
| | | GameWorld.DebugLog(" 成功匹配范围段位玩家: aPlayerID=%s,aDanLV=%s VS bPlayerID=%s,bDanLV=%s | danLV=%s,danMatchRange=%s" |
| | | % (aPlayer.playerID, aPlayer.danLV, bPlayer.playerID, bPlayer.danLV, danLV, danMatchRange))
|
| | |
|
| | | if len(matchPlayerVSList) >= maxGroupCnt:
|
| | | GameWorld.Log(" 已经达到最大匹配数! 已匹配对战数=%s, 不再匹配!doCount=%s" % (len(matchPlayerVSList), doCount))
|
| | | GameWorld.DebugLog(" 已经达到最大匹配数! 已匹配对战数=%s, 不再匹配!doCount=%s" % (len(matchPlayerVSList), doCount))
|
| | | break
|
| | |
|
| | | if not isMatchOK:
|
| | | GameWorld.Log(" 已经没有满足匹配条件的玩家! 不再匹配! doCount=%s" % (doCount))
|
| | | GameWorld.DebugLog(" 已经没有满足匹配条件的玩家! 不再匹配! doCount=%s" % (doCount))
|
| | | break
|
| | |
|
| | | return
|
| | |
| | | zoneMatchPlayerList = PyGameData.g_crossPKZoneMatchPlayerDict.get(pkZoneID, [])
|
| | |
|
| | | mapIDList = IpyGameDataPY.GetFuncCfg("CrossRealmPKMatch", 4)
|
| | | GameWorld.Log("===给配对的玩家开房间(pkZoneID=%s,配对数:%s)===" % (pkZoneID, len(matchPlayerVSList)))
|
| | | GameWorld.DebugLog("===给配对的玩家开房间(pkZoneID=%s,配对数:%s)===" % (pkZoneID, len(matchPlayerVSList)))
|
| | | for aPlayer, bPlayer in matchPlayerVSList:
|
| | |
|
| | | if not aPlayer or not bPlayer:
|
| | |
| | | PyGameData.g_crossPKRoomDict[roomID] = newRoom
|
| | |
|
| | | aServerGroupID, bServerGroupID = aPlayer.serverGroupID, bPlayer.serverGroupID
|
| | | GameWorld.Log(" 开房:pkZoneID=%s,mapID=%s,roomID=%s,aPlayerID=%s,bPlayerID=%s" % (pkZoneID, mapID, roomID, aPlayerID, bPlayerID))
|
| | | GameWorld.DebugLog(" 开房:pkZoneID=%s,mapID=%s,roomID=%s,aPlayerID=%s,bPlayerID=%s" % (pkZoneID, mapID, roomID, aPlayerID, bPlayerID))
|
| | | vsRoomDict[roomID] = [mapID, [[aServerGroupID, aPlayerID], [bServerGroupID, bPlayerID]]]
|
| | |
|
| | | # 记录流向
|
| | |
| | | def MapServer_CrossPKOver(infoList, tick):
|
| | | ## 收到MapServer副本跨服PK结果同步
|
| | |
|
| | | GameWorld.Log("收到MapServer_跨服PK战斗结果: %s" % str(infoList))
|
| | | GameWorld.DebugLog("收到MapServer_跨服PK战斗结果: %s" % str(infoList))
|
| | |
|
| | | roomID, winnerID, loserID, roundWinnerIDList, overType = infoList
|
| | |
|
| | |
| | | winnerDanLV, loserDanLV = winner.danLV, loser.danLV
|
| | | winnerDayScore, loserDayScore = max(0, winnerScore - winner.ondayScore), max(0, loserScore - loser.ondayScore) # 今日已获得积分,正积分
|
| | |
|
| | | GameWorld.Log("winnerDayScore=%s,winnerScore=%s,winnerDanLV=%s,cWinCount=%s" % (winnerDayScore, winnerScore, winnerDanLV, cWinCount))
|
| | | GameWorld.Log("loserDayScore=%s,loserScore=%s,loserDanLV=%s" % (loserDayScore, loserScore, loserDanLV))
|
| | | GameWorld.DebugLog("winnerDayScore=%s,winnerScore=%s,winnerDanLV=%s,cWinCount=%s" % (winnerDayScore, winnerScore, winnerDanLV, cWinCount))
|
| | | GameWorld.DebugLog("loserDayScore=%s,loserScore=%s,loserDanLV=%s" % (loserDayScore, loserScore, loserDanLV))
|
| | |
|
| | | winIpyData = IpyGameDataPY.GetIpyGameData("CrossRealmPKDan", winnerDanLV)
|
| | | loseIpyData = IpyGameDataPY.GetIpyGameData("CrossRealmPKDan", loserDanLV)
|
| | |
| | | if loseIpyData and loseIpyData.GetLVUpScore() and loser.pkScore >= loseIpyData.GetLVUpScore():
|
| | | loser.danLV += 1
|
| | |
|
| | | GameWorld.Log("wBaseScore=%s,wExScore=%s,winnerAddScore=%s,updScore=%s,updDanLV=%s,updCWinCount=%s" % (wBaseScore, wExScore, winnerAddScore, winner.pkScore, winner.danLV, winner.cWinCount))
|
| | | GameWorld.Log("lBaseScore=%s,lExScore=%s,loserAddScore=%s,updScore=%s,updDanLV=%s,updCWinCount=%s" % (lBaseScore, lExScore, loserAddScore, loser.pkScore, loser.danLV, loser.cWinCount))
|
| | | GameWorld.DebugLog("wBaseScore=%s,wExScore=%s,winnerAddScore=%s,updScore=%s,updDanLV=%s,updCWinCount=%s" % (wBaseScore, wExScore, winnerAddScore, winner.pkScore, winner.danLV, winner.cWinCount))
|
| | | GameWorld.DebugLog("lBaseScore=%s,lExScore=%s,loserAddScore=%s,updScore=%s,updDanLV=%s,updCWinCount=%s" % (lBaseScore, lExScore, loserAddScore, loser.pkScore, loser.danLV, loser.cWinCount))
|
| | |
|
| | | # 更新排行榜
|
| | | UpdateCrossPKBillboard(zoneID, seasonID, winner, loser)
|
| | |
| | | overPack.TagNameLen = len(overPack.TagName)
|
| | | NetPackCommon.SendFakePack(player, overPack)
|
| | |
|
| | | GameWorld.Log("同步玩家PK结果: serverGroupID=%s,roomID=%s,addScore=%s,pkScore=%s,danLV=%s,cWinCount=%s,tagPlayerID=%s" |
| | | % (serverGroupID, roomID, addScore, pkScore, danLV, cWinCount, tagPlayerID), playerID)
|
| | | GameWorld.DebugLog("同步玩家PK结果: serverGroupID=%s,roomID=%s,addScore=%s,pkScore=%s,danLV=%s,cWinCount=%s,tagPlayerID=%s" |
| | | % (serverGroupID, roomID, addScore, pkScore, danLV, cWinCount, tagPlayerID), playerID)
|
| | |
|
| | | serverGroupIDList = [winner.serverGroupID, loser.serverGroupID]
|
| | | GameWorld.Log("同步子服战斗结果: seasonID=%s,timeStr=%s,roomID=%s,overType=%s,winnerID=%s,roundWinnerIDList=%s" |
| | | % (seasonID, timeStr, roomID, overType, winnerID, roundWinnerIDList))
|
| | | 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)
|
| | |
|
| | |
| | | curServerGroupID = GameWorld.GetServerGroupID()
|
| | | actionType = ShareDefine.Def_CrossAction_PK
|
| | | mapPosList = IpyGameDataPY.GetFuncEvalCfg("CrossRealmPKMatch", 5)
|
| | | GameWorld.Log("=== 收到PK匹配结果处理 === curServerGroupID=%s" % curServerGroupID)
|
| | | GameWorld.DebugLog("=== 收到PK匹配结果处理 === curServerGroupID=%s" % curServerGroupID)
|
| | | if not mapPosList:
|
| | | GameWorld.ErrLog("没有配置对战地图进入坐标!")
|
| | | return
|
| | |
|
| | | for roomID, roomInfo in vsRoomDict.items():
|
| | | mapID, playerList = roomInfo
|
| | | GameWorld.Log(" roomID=%s,playerList=%s" % (roomID, playerList))
|
| | | GameWorld.DebugLog(" roomID=%s,playerList=%s" % (roomID, playerList))
|
| | | for i, playerInfo in enumerate(playerList):
|
| | | serverGroupID, playerID = playerInfo
|
| | | if serverGroupID != curServerGroupID:
|
| | |
| | | ## 子服接收玩家已准备好的PK房间信息, 此房间里的玩家可传送进入跨服
|
| | |
|
| | | curServerGroupID = GameWorld.GetServerGroupID()
|
| | | GameWorld.Log("===收到跨服服务器通知已准备好的对战PK房间信息处理=== curServerGroupID=%s" % curServerGroupID)
|
| | | GameWorld.DebugLog("===收到跨服服务器通知已准备好的对战PK房间信息处理=== curServerGroupID=%s" % curServerGroupID)
|
| | | # serverGroupID, playerName, playerJob
|
| | |
|
| | | if not CrossRealmPlayer.IsCrossServerOpen():
|
| | |
| | | matchOKPack.MatchPlayer = [matchPlayer]
|
| | | matchOKPack.MatchPlayerCount = len(matchOKPack.MatchPlayer)
|
| | | NetPackCommon.SendFakePack(player, matchOKPack)
|
| | | GameWorld.Log(" 通知玩家进入跨服PK对战房间! roomID=%s,playerID=%s,matchPlayerID=%s" % (roomID, playerID, matchPlayer.PlayerID))
|
| | | GameWorld.DebugLog(" 通知玩家进入跨服PK对战房间! roomID=%s,playerID=%s,matchPlayerID=%s" % (roomID, playerID, matchPlayer.PlayerID))
|
| | |
|
| | | return
|
| | |
|
| | |
| | | ## 子服接收已超时的PK房间信息, 此房间里的玩家重置跨服状态
|
| | |
|
| | | curServerGroupID = GameWorld.GetServerGroupID()
|
| | | GameWorld.Log("===收到跨服服务器通知已超时的对战PK房间信息处理=== curServerGroupID=%s" % curServerGroupID)
|
| | | GameWorld.DebugLog("===收到跨服服务器通知已超时的对战PK房间信息处理=== curServerGroupID=%s" % curServerGroupID)
|
| | |
|
| | | for roomID, roomPlayerInfo in timeoutRoomDict.items():
|
| | | if not roomPlayerInfo:
|
| | |
| | | ## 子服接收跨服PK结果信息
|
| | |
|
| | | curServerGroupID = GameWorld.GetServerGroupID()
|
| | | GameWorld.Log("===收到跨服服务器同步的跨服PK结果=== curServerGroupID=%s" % curServerGroupID)
|
| | | GameWorld.DebugLog("===收到跨服服务器同步的跨服PK结果=== curServerGroupID=%s" % curServerGroupID)
|
| | |
|
| | | for playerID, overInfo in playerOverDict.items():
|
| | | roomID, zoneID, seasonID, timeStr, overType, winnerID, roundWinnerIDList, \
|
| | |
| | | sendMapOverInfo = [roomID, zoneID, seasonID, timeStr, overType, winnerID, roundWinnerIDList, pkScore, danLV, cWinCount, addScore, tagPlayerID, tagPlayerName, notifyState]
|
| | | player = GameWorld.GetPlayerManager().FindPlayerByID(playerID)
|
| | | if not player or PlayerControl.GetIsTJG(player):
|
| | | GameWorld.Log(" 玩家不在线 或脱机中,先缓存,玩家上线后再同步,playerID=%s" % (playerID))
|
| | | GameWorld.DebugLog(" 玩家不在线 或脱机中,先缓存,玩家上线后再同步,playerID=%s" % (playerID))
|
| | | overInfoData = PyGameDataStruct.tagDBCrossPKUnNotifyOverInfo()
|
| | | overInfoData.clear()
|
| | | overInfoData.ZoneID = zoneID
|
| | |
| | | PlayerControl.SetVsRoomId(player, 0)
|
| | | sysMsg = str(sendMapOverInfo)
|
| | | player.MapServer_QueryPlayerResult(0, 0, "CrossPKOverInfo", sysMsg, len(sysMsg))
|
| | | GameWorld.Log("通知地图跨服PK结算: roomID=%s,zoneID=%s,seasonID=%s,timeStr=%s,overType=%s,winnerID=%s,roundWinnerIDList=%s, pkScore=%s,danLV=%s,cWinCount=%s,addScore=%s,tagPlayerID=%s,notifyState=%s,mapID=%s" |
| | | % (roomID, zoneID, seasonID, timeStr, overType, winnerID, roundWinnerIDList, pkScore, danLV, cWinCount, addScore, tagPlayerID, notifyState, player.GetMapID()), playerID)
|
| | | GameWorld.DebugLog("通知地图跨服PK结算: roomID=%s,zoneID=%s,seasonID=%s,timeStr=%s,overType=%s,winnerID=%s,roundWinnerIDList=%s, pkScore=%s,danLV=%s,cWinCount=%s,addScore=%s,tagPlayerID=%s,notifyState=%s,mapID=%s" |
| | | % (roomID, zoneID, seasonID, timeStr, overType, winnerID, roundWinnerIDList, pkScore, danLV, cWinCount, addScore, tagPlayerID, notifyState, player.GetMapID()), playerID)
|
| | | return
|
| | |
|
| | | def __OnLoginNotifyPKOverInfo(curPlayer):
|
| | |
| | | sendMapOverInfo = [roomID, zoneID, seasonID, timeStr, overType, winnerID, roundWinnerIDList, pkScore, danLV, cWinCount, addScore, tagPlayerID, tagPlayerName, notifyState]
|
| | | sysMsg = str(sendMapOverInfo)
|
| | | curPlayer.MapServer_QueryPlayerResult(0, 0, "CrossPKOverInfo", sysMsg, len(sysMsg))
|
| | | GameWorld.Log("玩家上线通知地图未结算的跨服PK结算: roomID=%s,zoneID=%s,seasonID=%s,timeStr=%s,overType=%s,winnerID=%s,roundWinnerIDList=%s, pkScore=%s,danLV=%s,cWinCount=%s,addScore=%s,tagPlayerID=%s,notifyState=%s,mapID=%s" |
| | | % (roomID, zoneID, seasonID, timeStr, overType, winnerID, roundWinnerIDList, pkScore, danLV, cWinCount, addScore, tagPlayerID, notifyState, curPlayer.GetMapID()), playerID)
|
| | | GameWorld.DebugLog("玩家上线通知地图未结算的跨服PK结算: roomID=%s,zoneID=%s,seasonID=%s,timeStr=%s,overType=%s,winnerID=%s,roundWinnerIDList=%s, pkScore=%s,danLV=%s,cWinCount=%s,addScore=%s,tagPlayerID=%s,notifyState=%s,mapID=%s" |
| | | % (roomID, zoneID, seasonID, timeStr, overType, winnerID, roundWinnerIDList, pkScore, danLV, cWinCount, addScore, tagPlayerID, notifyState, curPlayer.GetMapID()), playerID)
|
| | | return
|
| | |
|
| | | def DR_CrossReamlPK(eventName, dataDict={}):
|