From 3f8e22d3a4cd8b09306807b15caa999ad6a37be7 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期一, 03 十二月 2018 16:56:03 +0800
Subject: [PATCH] 2551 【BUG】【1.3】助战登记,登记次数问题

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/GameWorldProcess.py |   73 ++++++++++++++++++++++++++++--------
 1 files changed, 57 insertions(+), 16 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/GameWorldProcess.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/GameWorldProcess.py
index e31eba8..6c1429b 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/GameWorldProcess.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/GameWorldProcess.py
@@ -39,6 +39,7 @@
 import GameWorld
 import ChConfig
 import PlayerControl
+import FamilyRobBoss
 import EventShell
 import FBLogic
 import FBCommon
@@ -101,6 +102,17 @@
     if fbType == 0:
         return
     
+    if fbType == IPY_GameWorld.fbtSingle:
+        ownerID = gameFBMgr.GetGameFBDictByKey(ChConfig.Def_FB_SingleFBPlayerID)
+        if ownerID in PyGameData.g_fbHelpBattlePlayerDict:
+            PyGameData.g_fbHelpBattlePlayerDict.pop(ownerID)
+            GameWorld.DebugLog("清除单人副本镜像助战信息: ownerID=%s" % ownerID)
+    elif fbType == IPY_GameWorld.fbtTeam:
+        teamID = gameWorld.GetPropertyID()
+        if teamID in PyGameData.g_teamFBMemRelationDict:
+            PyGameData.g_teamFBMemRelationDict.pop(teamID)
+            GameWorld.DebugLog("清除组队副本队员关系信息: teamID=%s" % teamID)
+            
     #副本关闭时统一清怪
     FBCommon.ClearFBNPC()
     
@@ -307,19 +319,39 @@
         return
     
     #特殊副本,不执行这个逻辑
-    if not GameWorld.GetMap().GetAutoSize():
+    if not IsNoPlayerNeedCloseFB():
         return
     
     gameFB = GameWorld.GetGameFB()
-    logOffTick = gameFB.GetPlayerLogoffTick()
+    fbIndex = gameWorld.GetCurGameWorldIndex()
+    if fbIndex in PyGameData.g_lastExitFBType:
+        '''老模式根据 GetPlayerLogoffTick()、GetIsSafeClose()判断的话在某些情况下会有隐藏bug
+                            因为当副本中玩家同时退出时可能出现  GameWorld.GetMapCopyPlayerManager().GetPlayerCount() != 1 的情况
+                            所以老逻辑存在副本无法关闭的bug,这里只使用新模式,老模式暂不做修改,仅做兼容后备处理
+        '''
+        exitFBType, exitTick = PyGameData.g_lastExitFBType[fbIndex]
+        if exitFBType == 1:
+            passTick = tick - exitTick
+            if passTick < ChConfig.Def_EmptyFBKeepTime:
+                #GameWorld.DebugLog("最后一个玩家离线退出的,副本保护中!tick=%s,exitTick=%s,passTick=%s" 
+                #                   % (tick, exitTick, passTick), fbIndex)
+                return
+            #GameWorld.DebugLog("最后一个玩家离线退出的,副本保护超时,关闭副本!tick=%s,exitTick=%s,passTick=%s" 
+            #                   % (tick, exitTick, passTick), fbIndex)
+        #else:
+        #    GameWorld.DebugLog("最后一个玩家主动退出的,直接关闭副本!", fbIndex)
+        PyGameData.g_lastExitFBType.pop(fbIndex)
+        #GameWorld.DebugLog("PyGameData.g_lastExitFBType=%s" % PyGameData.g_lastExitFBType, fbIndex)
+    else:
+        logOffTick = gameFB.GetPlayerLogoffTick()
 
-    if logOffTick == 0:
-        return
-
-    if (not gameFB.GetIsSafeClose()) and tick - logOffTick < ChConfig.Def_EmptyFBKeepTime:
-        #GameWorld.Log(str(tick - logOffTick))
-        #不是安全断线的情况下, 返回
-        return
+        if logOffTick == 0:
+            return
+    
+        if (not gameFB.GetIsSafeClose()) and tick - logOffTick < ChConfig.Def_EmptyFBKeepTime:
+            #GameWorld.Log(str(tick - logOffTick))
+            #不是安全断线的情况下, 返回
+            return
 
     #输出调试信息
     GameWorld.Log('__ProcessClose! LineID = %s, openState = %s, isSafeClose = %s'%(
@@ -402,9 +434,13 @@
             return IPY_GameWorld.cmePlayerFull
 
     #检查副本状态是否可以登录
-    if not FBCommon.CheckFBStateCanEnter(askStruct):
+    checkRet = FBCommon.CheckFBStateCanEnter(askStruct)
+    if type(checkRet) not in [tuple, list]:
+        checkRet = (checkRet, "FB_andyshao_861048")
+    canEnter, notifyMark = checkRet
+    if not canEnter:
         #副本关闭中, 请稍后
-        return IPY_GameWorld.cmeCustom, 'FB_andyshao_861048'
+        return IPY_GameWorld.cmeCustom, notifyMark
     
     changeMapAskResult = FBLogic.OnChangeMapAsk(askStruct, tick)
 
@@ -452,11 +488,11 @@
     
     __ProcessOpen(gameWorld, tick)
     
-    __ProcessTimeKickPlayer(gameWorld, tick)
+    __ProcessTimeKickPlayer(gameWorld, tick) # 处理副本生存周期强关副本
     
-    __ProcessFBDelayKickPlayer(gameWorld, tick)
+    __ProcessFBDelayKickPlayer(gameWorld, tick) # 关闭副本延迟踢出玩家
     
-    __ProcessClose(gameWorld, tick)
+    __ProcessClose(gameWorld, tick) # 自伸缩副本关闭逻辑
     
     __ProcessMapServerAcPlayer(tick)
     
@@ -477,6 +513,9 @@
     __RefreshOnFiveMinute(tick)
     #定时检测关闭超时文件
     EventReport.OnTimeCloseScribeTxt()
+    
+    #仙盟归属boss定时处理
+    FamilyRobBoss.OnFamilyOwnerBossProcess(tick)
     return
 
 ## 通知RouteServer 消息
@@ -564,8 +603,7 @@
     if gameMap.GetMapFBType() == 0:
         return
     
-    if gameMap.GetAutoSize() == 0:
-        #只处理自动是否的地图
+    if not IsNoPlayerNeedCloseFB():
         return
     
     playerManager = gameWorld.GetMapCopyPlayerManager()
@@ -574,6 +612,9 @@
         __CloseFB(GameWorld.GetGameWorld(), GameWorld.GetGameWorld().GetTick())    
 
 
+def IsNoPlayerNeedCloseFB():
+    ## 副本中无玩家是否需要自动关闭的副本
+    return GameWorld.GetMap().GetAutoSize() and GameWorld.GetMap().GetMapID() not in ChConfig.Def_NoPlayerNotCloseAutoSizeMap
 
 #//08 06 根据国家统计的玩家数目#tagMPlayerCountByCountry
 #tagMPlayerCountByCountry       *   GettagMPlayerCountByCountry();

--
Gitblit v1.8.0