From 297de92ab4234a2ec6c84a0b93861a41bc71d1b3 Mon Sep 17 00:00:00 2001
From: xdh <xiefantasy@qq.com>
Date: 星期一, 12 十一月 2018 17:07:58 +0800
Subject: [PATCH] 4631 【后端】【1.3.0】上古战场增加机器人投放、分线逻辑优化

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_EnterFB.py |   42 ++++++++++++++++++++++++++----------------
 1 files changed, 26 insertions(+), 16 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..8a9cca4 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
@@ -65,25 +65,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))
+            
             
 #===================================================================================================
 #    # 战盟家园
@@ -137,9 +149,7 @@
         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
         for index in range(gameWorldManager.GetGameWorldCount()):
             gameWorld = IPY_GameWorld.IPY_GameWorld(index)

--
Gitblit v1.8.0