From 885772e34137afba56a4ca8583b62a6f20c2c137 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期六, 11 五月 2019 20:06:21 +0800
Subject: [PATCH] 860312 防范时间掉血 人数为0问题

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/GameWorldProcess.py |   76 +++++++++++++++++++++++++++++++++++---
 1 files changed, 70 insertions(+), 6 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 e3ddad5..747aea3 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/GameWorldProcess.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/GameWorldProcess.py
@@ -39,9 +39,12 @@
 import GameWorld
 import ChConfig
 import PlayerControl
+import FamilyRobBoss
+import NPCCustomRefresh
 import EventShell
 import FBLogic
 import FBCommon
+import ShareDefine
 import EventReport
 import ItemCommon
 import PyGameData
@@ -73,6 +76,8 @@
     
     #调用副本开启触发器
     FBLogic.OnOpenFB(tick)
+    
+    GameServer_DynamicLineMapStateChange(gameWorld, IPY_GameWorld.fbosOpen)
     return
 
 ## 副本关闭
@@ -91,8 +96,10 @@
     gameFBMgr = gameWorld.GetGameFB() 
     gameFBMgr.SetPlayerLogoffTick(0)
     gameFBMgr.SetIsSafeClose(0)
-
-    GameWorld.Log("FB Close! lineID = %s, openState = %s"%(gameWorld.GetLineID(), gameWorld.GetOpenState()))
+    
+    lineID = gameWorld.GetLineID()
+    copyMapID = gameWorld.GetCopyMapID()
+    GameWorld.Log("FB Close! lineID = %s, openState = %s"%(lineID, gameWorld.GetOpenState()))
     
     gameWorld.SetOpenState(IPY_GameWorld.fbosClosed)
     gameMap = gameWorld.GetMap()
@@ -101,9 +108,23 @@
     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()
     
+    if lineID in PyGameData.g_fbRobotJobDict:
+        PyGameData.g_fbRobotJobDict.pop(lineID)
+        
     mapID = FBCommon.GetRecordMapID(gameMap.GetMapID())
     #清理物品
     unPickItemDict = {}
@@ -134,9 +155,15 @@
         
     #发送未拾取的物品给玩家
     if mapID in ChConfig.Def_SendUnPickItemMailMapIDList and unPickItemDict:
+        isCrossServer = GameWorld.IsCrossServer()
+        playerServerGroupIDDict = PyGameData.g_crossPlayerServerGroupIDInfo.get(copyMapID, {})
         for ownerID, mailItemList in unPickItemDict.items():
             GameWorld.Log("发送未拾取的物品给玩家: %s" % mailItemList, ownerID)
-            PlayerControl.SendMailByKey("ItemNoPickUp", [ownerID], mailItemList, [gameWorld.GetMapID()])
+            if isCrossServer:
+                serverGroupID = playerServerGroupIDDict.get(ownerID, 0)
+                PlayerControl.SendCrossMail(serverGroupID, "ItemNoPickUp", [ownerID], mailItemList, [gameWorld.GetMapID()])
+            else:
+                PlayerControl.SendMailByKey("ItemNoPickUp", [ownerID], mailItemList, [gameWorld.GetMapID()])
         
     playerManager = gameWorld.GetMapCopyPlayerManager()
     
@@ -150,6 +177,26 @@
     #根据是否收缩型FB处理
     FreeOrClearFBByAutoSize(gameWorld)
     
+    GameServer_DynamicLineMapStateChange(gameWorld, IPY_GameWorld.fbosClosed)
+        
+    gameWorld.SetPropertyID(0)
+    PyGameData.g_crossPlayerServerGroupIDInfo.pop(copyMapID, None)
+    return
+
+def GameServer_DynamicLineMapStateChange(gameWorld, state):
+    if gameWorld.GetMapID() not in ChConfig.Def_CrossDynamicLineMap:
+        return
+    
+    realMapID, copyMapID = gameWorld.GetRealMapID(), gameWorld.GetCopyMapID()
+    if state == IPY_GameWorld.fbosWaitForClose:
+        crossFuncLineDataCache = FBLogic.OnGetCrossFuncLineDataCache()
+        msgInfo = [realMapID, copyMapID, state, crossFuncLineDataCache]
+    else:
+        msgInfo = [realMapID, copyMapID, state]
+        
+    msgInfo = str(msgInfo)
+    GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, "DynamicLineMapStateChange", msgInfo, len(msgInfo))
+    GameWorld.Log("DynamicLineMapStateChange realMapID=%s, copyMapID=%s, PropertyID=%s, state=%s" % (realMapID, copyMapID, gameWorld.GetPropertyID(), state))
     return
 
 ##根据表中的收缩类型释放或者清空副本状态
@@ -231,6 +278,7 @@
     
     ##踢人
     __KickAllPlayerAndCloseFB(gameWorld, tick)
+    GameServer_DynamicLineMapStateChange(gameWorld, IPY_GameWorld.fbosClosed)
     return
 
 ## 副本踢出玩家逻辑
@@ -307,7 +355,7 @@
         return
     
     #特殊副本,不执行这个逻辑
-    if not GameWorld.GetMap().GetAutoSize():
+    if not IsNoPlayerNeedCloseFB():
         return
     
     gameFB = GameWorld.GetGameFB()
@@ -501,6 +549,12 @@
     __RefreshOnFiveMinute(tick)
     #定时检测关闭超时文件
     EventReport.OnTimeCloseScribeTxt()
+    
+    #仙盟归属boss定时处理
+    FamilyRobBoss.OnFamilyOwnerBossProcess(tick)
+    
+    #地图自定义随机刷怪
+    NPCCustomRefresh.ProcessMapRandomRefreshNPC(gameWorld, tick)
     return
 
 ## 通知RouteServer 消息
@@ -565,6 +619,11 @@
     if GameWorld.GetMap().GetMapFBType() == IPY_GameWorld.fbtNull:
         msgInfo = str([gameWorld.GetMapID(), gameWorld.GetLineID(), gameWorld.GetRealMapID(), gameWorld.GetCopyMapID()])
         GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, "CommMapServerInitOK", msgInfo, len(msgInfo))
+        
+    if gameWorld.GetMapID() in ChConfig.Def_CrossDynamicLineMap and gameWorld.GetCopyMapID() == gameWorld.GetGameWorldCount() - 1:
+        msgInfo = str([gameWorld.GetRealMapID(), gameWorld.GetGameWorldCount()])
+        GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, "DynamicLineMapInitOK", msgInfo, len(msgInfo))
+        
     return
 
 
@@ -574,6 +633,9 @@
 #  @remarks 函数详细说明.
 def CloseFB(tick):
     GameWorld.GetGameWorld().SetCloseFBTick(tick)
+    
+    gameWorld = GameWorld.GetGameWorld()
+    GameServer_DynamicLineMapStateChange(gameWorld, IPY_GameWorld.fbosWaitForClose)
     return
 
 ## 玩家离开地图时,尝试关闭副本
@@ -588,8 +650,7 @@
     if gameMap.GetMapFBType() == 0:
         return
     
-    if gameMap.GetAutoSize() == 0:
-        #只处理自动是否的地图
+    if not IsNoPlayerNeedCloseFB():
         return
     
     playerManager = gameWorld.GetMapCopyPlayerManager()
@@ -598,6 +659,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