From f8e30b43a4228e1231debfd6f2758218a2675654 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期一, 16 九月 2019 18:44:30 +0800
Subject: [PATCH] 8260 【主干】【400】跨服匹配优化

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_EnterFB.py |   34 +++++++++++++++++++++++++++-------
 1 files changed, 27 insertions(+), 7 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 6876be5..b59703e 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
@@ -30,6 +30,8 @@
 import GameWorld
 import FBCommon
 import ChConfig
+import IpyGameDataPY
+import random
 #---------------------------------------------------------------------
 #全局变量
 #---------------------------------------------------------------------
@@ -69,8 +71,11 @@
         maxPlayerCount = FBLogic.GetFBLineMaxPlayerCount(tagMapID, tagMapLineID)
         
         GameWorld.Log("    DoLogic()  tagMapID=%s,tagMapLineID=%s,maxPlayerCount=%s" % (tagMapID, tagMapLineID,maxPlayerCount))
+        if not maxPlayerCount:
+            pass
         firstEmptyGameWorld = None
-        sameLineGameWorldList = []
+        sameLineGameWorldList = [] #人数未满的线路列表
+        fullLineGameWorldList = [] #人数已满的线路列表
         for index in xrange(gameWorldManager.GetGameWorldCount()):
             gameWorld = IPY_GameWorld.IPY_GameWorld(index)
             playerManager = gameWorld.GetMapCopyPlayerManagerByFbIndex(index)
@@ -82,14 +87,29 @@
                 firstEmptyGameWorld = gameWorld
             # 如果不是同一线路属性的,则跳过
             # 如果当前人数超过额定人数,则跳过
-            if propertyID == tagMapPropertyID and curPlayerCnt < maxPlayerCount:
-                sameLineGameWorldList.append([gameWorld, curPlayerCnt])
+            if propertyID == tagMapPropertyID:
+                if curPlayerCnt < maxPlayerCount:
+                    sameLineGameWorldList.append([gameWorld, curPlayerCnt])
+                else:
+                    fullLineGameWorldList.append([gameWorld, curPlayerCnt])
         findGameWorld = None
         if sameLineGameWorldList:
-            sameLineGameWorldList.sort(key=lambda asd:asd[1])
-            findGameWorld = sameLineGameWorldList[0][0]
+            #若是进入过副本则随机一个,否则选人数最少的一个
+            enterCnt = packCMDList[2]
+            if enterCnt:
+                #GameWorld.DebugLog('DoLogic() sameLineGameWorldList=%s'%len(sameLineGameWorldList))
+                findGameWorld = random.choice(sameLineGameWorldList)[0]
+            else:
+                sameLineGameWorldList.sort(key=lambda asd:asd[1])
+                findGameWorld = sameLineGameWorldList[0][0]
+                
         elif firstEmptyGameWorld:
             findGameWorld = firstEmptyGameWorld
+        elif fullLineGameWorldList:
+            #线路都满人了则取个人数相对较少的
+            fullLineGameWorldList.sort(key=lambda asd:asd[1])
+            findGameWorld = fullLineGameWorldList[0][0]
+            
         if findGameWorld:
             if findGameWorld.GetPropertyID() == 0:
                 findGameWorld.SetFBFirstOpen(1) # 开启副本
@@ -166,13 +186,13 @@
             # 如果不是同一线路属性的,则跳过
             if propertyID == tagMapPropertyID:
                 if tagMapID == ChConfig.Def_FBMapID_SealDemon:
-                    if GameLogic_SealDemon.GetBossRemainHPPer(tagMapLineID, tick) < 15:
+                    if GameLogic_SealDemon.GetBossRemainHPPer(index, tagMapLineID, tick) < 15:
                         findGameWord = None
                         findPlayerManager = None
                         notifyMark = "DemonJar_Text4"
                         break
                 elif tagMapID == ChConfig.Def_FBMapID_ZhuXianBoss:
-                    if GameLogic_ZhuXianBoss.GetBossRemainHPPer(tagMapLineID, tick) < 15:
+                    if GameLogic_ZhuXianBoss.GetBossRemainHPPer(index, tagMapLineID, tick) < IpyGameDataPY.GetFuncCfg('ZhuXianBossCntCfg', 4):
                         findGameWord = None
                         findPlayerManager = None
                         notifyMark = "DemonJar_Text4"

--
Gitblit v1.8.0