From dcc91df4e4090f84da0bf7027de4550a0315c184 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 21 十二月 2021 16:52:28 +0800
Subject: [PATCH] 1111 【后端】修复组队报错;修复购买副本次数报错;

---
 ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFB.py |   32 +++++++++++++++++++++++++-------
 1 files changed, 25 insertions(+), 7 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFB.py b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFB.py
index f3e6c51..a8d5e9e 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFB.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFB.py
@@ -33,12 +33,9 @@
 import IPY_PlayerDefine
 import CrossRealmPlayer
 import CrossRealmMsg
-import ChPyNetSendPack
-import NetPackCommon
 import ShareDefine
 import CrossBoss
 
-import random
 #---------------------------------------------------------------------
 
 ## 跨服地图动态分配的功能线路,如果有人数上限的,则同分区同地图玩法的可能同时存在多个相同功能线路的数据
@@ -64,6 +61,7 @@
         self.openState = IPY_PlayerDefine.fbosClosed
         self.fbPlayerDict = {} # 副本中的玩家信息 {playerID:serverGroupID, ...}
         self.waitPlayerDict = {} # 等待进入的玩家信息 {playerID:[serverGroupID, tick], ...}
+        self.offlinePlayerDict = {} # 掉线的玩家信息,非主动退出的 {playerID:serverGroupID, ...}
         return
     
     def OnRequestEnterCrossCopyMap(self, playerID, serverGroupID, tick, copyMapPlayerMax):
@@ -350,8 +348,9 @@
                 break
     
     key = (mapID, copyMapID)
-    copyMapObj = PyGameData.g_crossDynamicLineCopyMapInfo.pop(key, {})
-    
+    copyMapObj = PyGameData.g_crossDynamicLineCopyMapInfo.pop(key, None)
+    if not copyMapObj:
+        return
     #GameWorld.DebugLog("    PyGameData.g_crossDynamicLineInfo=%s" % PyGameData.g_crossDynamicLineInfo)
     #GameWorld.DebugLog("    PyGameData.g_crossDynamicLineCopyMapInfo=%s" % PyGameData.g_crossDynamicLineCopyMapInfo)
     
@@ -360,6 +359,11 @@
     funcLineID = copyMapObj.funcLineID
     playerCountInfo = [playerCount]
     SyncClientServerCrossFBFuncLinePlayerCount(zoneID, mapID, funcLineID, playerCountInfo)
+    
+    #如果虚拟分线关闭时,有掉线的玩家,则通知子服重置这些玩家的跨服状态
+    for playerID, serverGroupID in copyMapObj.offlinePlayerDict.items():
+        CrossRealmMsg.SendMsgToClientServer(ShareDefine.CrossServerMsg_ExitCrossServer, playerID, [serverGroupID])
+        
     return
 
 def OnCrossDynamicMapReset(msgList):
@@ -395,12 +399,14 @@
     playerID = curPlayer.GetPlayerID()
     serverGroupID = PlayerControl.GetPlayerServerGroupID(curPlayer)
     copyMapObj.waitPlayerDict.pop(playerID, None)
+    copyMapObj.offlinePlayerDict.pop(playerID, None)
     copyMapObj.fbPlayerDict[playerID] = serverGroupID
     
     #GameWorld.DebugLog("玩家登录动态分配的跨服地图: GetMapID=%s,GetRealMapID=%s,GetFBID()=%s,serverGroupID=%s" 
     #                   % (curPlayer.GetMapID(), mapID, copyMapID, serverGroupID), playerID)
     #GameWorld.DebugLog("    副本中的玩家ID: %s" % copyMapObj.fbPlayerDict)
     #GameWorld.DebugLog("    等待中的玩家ID: %s" % copyMapObj.waitPlayerDict)
+    #GameWorld.DebugLog("    离线中的玩家ID: %s" % copyMapObj.offlinePlayerDict)
     
     playerCount = len(copyMapObj.fbPlayerDict) # 等待进入的暂时不算
     zoneID = copyMapObj.zoneID
@@ -436,10 +442,16 @@
     copyMapObj.waitPlayerDict.pop(playerID, None)
     copyMapObj.fbPlayerDict.pop(playerID, None)
     
-    #GameWorld.DebugLog("玩家退出动态分配的跨服地图: GetMapID=%s,GetRealMapID=%s,GetFBID()=%s" 
-    #                   % (curPlayer.GetMapID(), mapID, copyMapID), playerID)
+    crossMapID = PlayerControl.GetCrossMapID(curPlayer)
+    # 不是主动退出的
+    if crossMapID:
+        copyMapObj.offlinePlayerDict[playerID] = PlayerControl.GetPlayerServerGroupID(curPlayer)
+    
+    #GameWorld.DebugLog("玩家退出动态分配的跨服地图: GetMapID=%s,GetRealMapID=%s,GetFBID()=%s,crossMapID=%s" 
+    #                   % (curPlayer.GetMapID(), mapID, copyMapID, crossMapID), playerID)
     #GameWorld.DebugLog("    副本中的玩家ID: %s" % copyMapObj.fbPlayerDict)
     #GameWorld.DebugLog("    等待中的玩家ID: %s" % copyMapObj.waitPlayerDict)
+    #GameWorld.DebugLog("    离线中的玩家ID: %s" % copyMapObj.offlinePlayerDict)
     return
 
 def CrossServerMsg_FBPlayerCount(msgData):
@@ -485,6 +497,12 @@
     
     # 组队副本, 有队伍的情况才验证其他队员可否进入,否则代表单人进入
     if gameMap.GetMapFBType() == ChConfig.fbtTeam:
+        if tagMapID == ChConfig.Def_FBMapID_Love:
+            onlyDoubleTeam = IpyGameDataPY.GetFuncCfg("LoveFB", 1)
+            if onlyDoubleTeam:
+                if PlayerTeam.CheckTeamOnLineCount(curPlayer.GetTeam(), includeTJG=False) != 2:
+                    PlayerControl.NotifyCode(curPlayer, "OnlyTwoMemTeamCanEnter", [tagMapID])
+                    return
         PlayerTeam.OnEnterFBTeamAsk(curPlayer, PlayerTeam.TeamFBAskType_Enter, tagMapID, tagLineID, tick)
         return
     

--
Gitblit v1.8.0