From 78a2ce57d2d546ebade26a801b33c5cb0d8a408c Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期一, 21 十月 2019 14:09:33 +0800
Subject: [PATCH] 8309 【恺英】邮件神装物品传奇属性异常
---
ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossRealmPK.py | 72 ++++++++++++++++++++++++++++++++----
1 files changed, 64 insertions(+), 8 deletions(-)
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossRealmPK.py b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossRealmPK.py
index 2afb3cb..57fd24b 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossRealmPK.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossRealmPK.py
@@ -58,6 +58,7 @@
self.serverGroupID = 0 # 所属服务器ID,一个服务器ID由多个服组成
self.pkZoneID = 0 # 所属赛区ID,一个赛区由多个服务器ID组成
self.seasonID = 0 # 赛季ID
+ self.notifyMatchRobotTick = 0 # 通知匹配到机器人的tick
return
def GetDRInfo(self):
@@ -926,15 +927,18 @@
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, 2], [serverGroupID])
+ #这里优化下暂通知开始匹配,实际匹配到机器人做延迟通知
+ CrossRealmMsg.SendMsgToClientServer(ShareDefine.CrossServerMsg_PKMatchReqRet, [playerID, 1], [serverGroupID])
return
PyGameData.g_crossPKPlayerDict[playerID] = pkPlayer
@@ -943,10 +947,54 @@
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):
@@ -1149,6 +1197,8 @@
return
GameWorld.GetGameWorld().SetDict(processTickKey, tick)
+ # 延迟通知匹配到机器人的
+ __DelayNotifyMatchRobot(tick)
# 处理超时的房间
__DoCheckRoomTimeout(tick)
# 通知已准备好的房间玩家可进入跨服
@@ -1159,10 +1209,13 @@
# 每个赛区单独匹配
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))
@@ -1190,6 +1243,8 @@
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
@@ -1680,6 +1735,8 @@
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
@@ -1706,8 +1763,7 @@
overType = 0
roundWinnerIDList = []
notifyState = False
- if winner:
- winnerID = winner.playerID
+ winnerID = winner.playerID if winner else 0
tagPlayerID = 0
tagPlayerName = ""
--
Gitblit v1.8.0