From fe9b738b1cb89e3b4d320924fceef70a8e1f6fac Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期四, 04 三月 2021 14:24:50 +0800
Subject: [PATCH] 8650 【主干】【BT2】活动规则优化(多活动支持的改为单表模式,增加活动分组编号字段区分不同的活动编号;常规活动改为不受合服影响,合服活动独立出来;累计充值活动、集字活动适配为新模式 master冲突补同步);

---
 ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossRealmPK.py |   47 ++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 42 insertions(+), 5 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossRealmPK.py b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossRealmPK.py
index aa6a7b2..5351038 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossRealmPK.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossRealmPK.py
@@ -200,7 +200,7 @@
                 cnt += 1
                 savaData += billboardData.getBuffer()
                 
-        GameWorld.Log("SaveCrossPKBillboard cnt :%s" % cnt)
+        GameWorld.Log("SaveCrossPKBillboard cnt :%s len=%s" % (cnt, len(savaData)))
         return CommFunc.WriteDWORD(cntData, cnt) + savaData
     
     # 从数据库载入数据
@@ -968,6 +968,35 @@
         
     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):
     ## 取消匹配
     
@@ -1180,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))
         
@@ -1211,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
 
 
@@ -1701,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
     
@@ -1874,6 +1910,7 @@
         SetIsCrossPKMatching(curPlayer, 1)
         startMatchPack.IsRobot = 0
     elif result == 2:
+        SetIsCrossPKMatching(curPlayer, 0)
         startMatchPack.IsRobot = 1
         
     NetPackCommon.SendFakePack(curPlayer, startMatchPack)    
@@ -2029,7 +2066,7 @@
             cnt += 1
             savaData += overInfoData.getBuffer()
                 
-        GameWorld.Log("SaveDBCrossPKUnNotifyOverInfo cnt :%s" % cnt)
+        GameWorld.Log("SaveDBCrossPKUnNotifyOverInfo cnt :%s len=%s" % (cnt, len(savaData)))
         return CommFunc.WriteDWORD(cntData, cnt) + savaData
     
     # 从数据库载入数据

--
Gitblit v1.8.0