From 55c0dde92cc8e292f9385ee313b515649c6162b4 Mon Sep 17 00:00:00 2001
From: xdh <xiefantasy@qq.com>
Date: 星期六, 16 二月 2019 11:49:12 +0800
Subject: [PATCH] 6236 【后端】【1.6】合服重新同步下诛仙排行榜

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_EnterFB.py |   84 ++++++++++++++++++++++++++++--------------
 1 files changed, 56 insertions(+), 28 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_EnterFB.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_EnterFB.py
index 4eaa6fd..ef7d527 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_EnterFB.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_EnterFB.py
@@ -24,6 +24,7 @@
 #导入
 import FBLogic
 import GameLogic_SealDemon
+import GameLogic_ZhuXianBoss
 import IPY_GameWorld
 import PlayerControl
 import GameWorld
@@ -57,7 +58,7 @@
     tagMapID = packCMDList[0]  # 目标地图id
     tagMapLineID = packCMDList[1]  # 目标地图线路属性,从0开始
     resultLineID = -1  # 结果lineID
-    
+    notifyMark = 'GeRen_chenxin_500807' #不能进的提示
     if tagMapID in ChConfig.Def_MapID_LineIDToPropertyID:        
         GameWorld.Log("    DoLogic() tagMapID in ChConfig.Def_MapID_LineIDToPropertyID")
         tagMapPropertyID = tagMapLineID + 1 # 因为PropertyID默认是0,所以使用时从1开始
@@ -65,25 +66,37 @@
         resultLineID = -1  # 结果lineID
         
         gameWorldManager = GameWorld.GetGameWorld()
-        maxPlayerCount = FBLogic.GetFBLineMaxPlayerCount(tagMapID)
+        maxPlayerCount = FBLogic.GetFBLineMaxPlayerCount(tagMapID, tagMapLineID)
         
-        GameWorld.Log("    DoLogic()  tagMapID=%s,maxPlayerCount=%s" % (tagMapID, maxPlayerCount))
-        for index in range(gameWorldManager.GetGameWorldCount()):
+        GameWorld.Log("    DoLogic()  tagMapID=%s,tagMapLineID=%s,maxPlayerCount=%s" % (tagMapID, tagMapLineID,maxPlayerCount))
+        firstEmptyGameWorld = None
+        sameLineGameWorldList = []
+        for index in xrange(gameWorldManager.GetGameWorldCount()):
             gameWorld = IPY_GameWorld.IPY_GameWorld(index)
             playerManager = gameWorld.GetMapCopyPlayerManagerByFbIndex(index)
             propertyID = gameWorld.GetPropertyID()
-            GameWorld.Log("    DoLogic()  check gameworld index=%s,propertyID=%s,playerCount=%s" \
-                          % (index, propertyID, playerManager.GetPlayerCount()))
+            curPlayerCnt = playerManager.GetPlayerCount()
+#            GameWorld.Log("    DoLogic()  check gameworld index=%s,propertyID=%s,playerCount=%s" \
+#                          % (index, propertyID, curPlayerCnt))
+            if propertyID == 0 and not firstEmptyGameWorld:
+                firstEmptyGameWorld = gameWorld
             # 如果不是同一线路属性的,则跳过
             # 如果当前人数超过额定人数,则跳过
-            if propertyID == 0 or (propertyID == tagMapPropertyID \
-                                   and playerManager.GetPlayerCount() < maxPlayerCount):
-                gameWorld.SetPropertyID(tagMapPropertyID)
-                if propertyID == 0:
-                    gameWorld.SetFBFirstOpen(1) # 开启副本
-                resultLineID = gameWorld.GetLineID()
-                GameWorld.Log("    DoLogic()  check ok!resultLineID=%s" % (resultLineID))
-                break
+            if propertyID == tagMapPropertyID and curPlayerCnt < maxPlayerCount:
+                sameLineGameWorldList.append([gameWorld, curPlayerCnt])
+        findGameWorld = None
+        if sameLineGameWorldList:
+            sameLineGameWorldList.sort(key=lambda asd:asd[1])
+            findGameWorld = sameLineGameWorldList[0][0]
+        elif firstEmptyGameWorld:
+            findGameWorld = firstEmptyGameWorld
+        if findGameWorld:
+            if findGameWorld.GetPropertyID() == 0:
+                findGameWorld.SetFBFirstOpen(1) # 开启副本
+            findGameWorld.SetPropertyID(tagMapPropertyID)
+            resultLineID = findGameWorld.GetLineID()
+            GameWorld.Log("    DoLogic()  check ok!resultLineID=%s" % (resultLineID))
+            
             
 #===================================================================================================
 #    # 战盟家园
@@ -132,15 +145,14 @@
 #            GameWorld.DebugLog("    创建新战盟家园: tagFamilyID=%s,tagFamilyHomeLV=%s,resultLineID=%s" 
 #                               % (tagFamilyID, tagFamilyHomeLV, resultLineID))
 #===================================================================================================
-    elif tagMapID == ChConfig.Def_FBMapID_SealDemon:
+    elif tagMapID in [ChConfig.Def_FBMapID_SealDemon, ChConfig.Def_FBMapID_ZhuXianBoss]:
         tagMapPropertyID = tagMapLineID + 1 # 因为PropertyID默认是0,所以使用时从1开始
         resultLineID = -1  # 结果lineID
         
         gameWorldManager = GameWorld.GetGameWorld()
-        maxPlayerCount = FBLogic.GetFBLineMaxPlayerCount(tagMapID)
-        
-        GameWorld.Log("    DoLogic()  tagMapID=%s,maxPlayerCount=%s" % (tagMapID, maxPlayerCount))
+        GameWorld.Log("    DoLogic()  tagMapID=%s,tagMapLineID=%s" % (tagMapID, tagMapLineID))
         findGameWord = None
+        findPlayerManager = None
         for index in range(gameWorldManager.GetGameWorldCount()):
             gameWorld = IPY_GameWorld.IPY_GameWorld(index)
             playerManager = gameWorld.GetMapCopyPlayerManagerByFbIndex(index)
@@ -153,13 +165,32 @@
 #                          % (index, propertyID, playerManager.GetPlayerCount()))
             # 如果不是同一线路属性的,则跳过
             if propertyID == tagMapPropertyID:
-                if GameLogic_SealDemon.GetBossRemainHPPer(tagMapLineID, tick) < 15:
-                    findGameWord = None
-                    break
+                if tagMapID == ChConfig.Def_FBMapID_SealDemon:
+                    if GameLogic_SealDemon.GetBossRemainHPPer(tagMapLineID, tick) < 15:
+                        findGameWord = None
+                        findPlayerManager = None
+                        notifyMark = "DemonJar_Text4"
+                        break
+                elif tagMapID == ChConfig.Def_FBMapID_ZhuXianBoss:
+                    if GameLogic_ZhuXianBoss.GetBossRemainHPPer(tagMapLineID, tick) < 15:
+                        findGameWord = None
+                        findPlayerManager = None
+                        notifyMark = "DemonJar_Text4"
+                        break
+                    
                 findGameWord = gameWorld
+                findPlayerManager = playerManager
                 break
             if not findGameWord and propertyID == 0:
                 findGameWord = gameWorld
+                findPlayerManager = playerManager
+        
+        if findPlayerManager and tagMapID == ChConfig.Def_FBMapID_ZhuXianBoss:
+            if packCMDList[3] !=-1 and not GameLogic_ZhuXianBoss.GetHasSameFamilyMerber(packCMDList[3], findPlayerManager):
+                notifyMark = "TryEnterJadeDynastyBossError_6"
+                findGameWord = None
+                GameWorld.DebugLog("    归属次数为0且没有同盟玩家在副本里!")
+                
         if findGameWord:
             if findGameWord.GetPropertyID() == 0:
                 findGameWord.SetFBFirstOpen(1) # 开启副本
@@ -170,7 +201,7 @@
         #resultLineID = tagMapLineID
         resultLineID = 0
         
-    return ['%s' % packCMDList, '%d' % resultLineID]
+    return ['%s' % packCMDList, '%d' % resultLineID, notifyMark]
 #---------------------------------------------------------------------
 
 
@@ -186,22 +217,19 @@
     
     #还原格式 '[]' -> []
     funResult = eval(funResult)
-    if not funResult or len(funResult) < 2:
+    if not funResult or len(funResult) < 3:
         GameWorld.Log("GY_Query_EnterFB DoResult() return []")
         return
     
     tagMapInfo = eval(funResult[0])
     backFBID = int(funResult[1]) # 返回的切图线路id(0~N)
-    
+    notifyMark = funResult[2]
     mapID = tagMapInfo[0] # 请求的切图id
     funcLineID = tagMapInfo[1]   # 请求的场次线路id(0~6)
     GameWorld.Log("GY_Query_EnterFB DoResult() mapID=%s,funcLineID=%s,backFBID=%s" % (mapID, funcLineID, backFBID), curPlayer.GetPlayerID())
     
     if backFBID == -1: # 未找到可进入的分线,则返回,提示人数已满
-        if mapID == ChConfig.Def_FBMapID_SealDemon:
-            PlayerControl.NotifyCode(curPlayer, "DemonJar_Text4")
-        else:
-            PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_500807")
+        PlayerControl.NotifyCode(curPlayer, notifyMark)
         return
     
     if curPlayer.GetMapID() == mapID:

--
Gitblit v1.8.0