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 | 29 ++++++++++++++++++++++++-----
1 files changed, 24 insertions(+), 5 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 81478ab..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
@@ -31,6 +31,7 @@
import FBCommon
import ChConfig
import IpyGameDataPY
+import random
#---------------------------------------------------------------------
#全局变量
#---------------------------------------------------------------------
@@ -70,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)
@@ -83,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) # 开启副本
--
Gitblit v1.8.0