From 71ae4bc172ca3c70e3a6ba2e09ff8bf4f2b57872 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期五, 09 七月 2021 18:20:04 +0800
Subject: [PATCH] 8585 【主干】【BT2】【BT3】【后端】竞技场(Arena命令支持指定匹配玩家ID)

---
 ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldArena.py               |   25 +++++++++++-
 ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerBillboard.py                      |    4 +-
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerBillboard.py |    8 ++--
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerArena.py     |    9 ++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/Arena.py      |   15 ++++++-
 5 files changed, 50 insertions(+), 11 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldArena.py b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldArena.py
index 7be1215..9a35b2a 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldArena.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldArena.py
@@ -526,7 +526,7 @@
     
     # 匹配刷新
     if cmd == "MatchRefresh":
-        __DoArenaMatchRefresh(curPlayer, cmdDict["isRefresh"], cmdDict["playerLV"], cmdDict["playerScore"])
+        __DoArenaMatchRefresh(curPlayer, cmdDict["isRefresh"], cmdDict["playerLV"], cmdDict["playerScore"], cmdDict.get("gmMatchIDList"))
         
     # 对战结算
     elif cmd == "BattleResult":
@@ -534,7 +534,7 @@
         
     return msgList + [retDict]
 
-def __DoArenaMatchRefresh(curPlayer, isRefresh, playerLV, playerScore):
+def __DoArenaMatchRefresh(curPlayer, isRefresh, playerLV, playerScore, gmMatchIDList=None):
     ## 玩家刷新匹配对手
     
     playerID = curPlayer.GetPlayerID()
@@ -643,6 +643,27 @@
                                        % (higherLackCount, randOrderMin, randOrderMax, randOrder, matchOrderList), playerID)
                     
     matchOrderList.sort()
+    # GM指定匹配测试
+    if gmMatchIDList != None and curPlayer.GetGMLevel():
+        gmMatchOrderList = []
+        for gmMatchID in gmMatchIDList:
+            if gmMatchID == playerID:
+                GameWorld.DebugAnswer(curPlayer, "目标ID不能是自己!无法匹配!%s" % gmMatchID)
+                continue
+            gmMatchOrder = billBoard.IndexOfByID(gmMatchID) + 1
+            if gmMatchOrder <= 0:
+                GameWorld.DebugAnswer(curPlayer, "目标ID不在榜单上!无法匹配!%s" % gmMatchID)
+                continue
+            if gmMatchOrder in matchOrderList:
+                continue
+            gmMatchOrderList.append(gmMatchOrder)
+            GameWorld.DebugAnswer(curPlayer, "指定匹配ID(%s),order(%s)" % (gmMatchID, gmMatchOrder))
+            
+        GameWorld.DebugLog("matchOrderList=%s,needMatchCount=%s" % (str(matchOrderList), needMatchCount))
+        if matchOrderList:
+            matchOrderList = matchOrderList[:needMatchCount - len(gmMatchOrderList)]
+        matchOrderList += gmMatchOrderList
+        matchOrderList.sort()
     GameWorld.DebugLog("    最终匹配到的名次列表: matchOrderList=%s" % matchOrderList, playerID)
     
     # 随机机器人备用信息
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerBillboard.py b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerBillboard.py
index 29bc77e..586d56e 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerBillboard.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerBillboard.py
@@ -444,7 +444,7 @@
 def MapServer_UpdateBillboard(billInfoDict, tick):
     '''地图更新排行榜, 通用
     {"Type":bType, "Type2":bType2, "ID":bID, "ID2":bID2, "Name1":bName, "Name2":bName2, "ExInfo":exInfo,
-    "Value1":value1, "Value2":value2, "CmpValue":cmpValue, "CmpValue2":cmpValue2, "CmpValue3":cmpValue3}
+    "Value1":value1, "Value2":value2, "CmpValue":cmpValue, "CmpValue2":cmpValue2, "CmpValue3":cmpValue3, "autoSort":autoSort}
     '''
     
     bType = billInfoDict["Type"]
@@ -477,7 +477,7 @@
     
     gameWorld = GameWorld.GetGameWorld()
     lastSortTick = gameWorld.GetDictByKey(Def_Key_BillboardSortTick % bType)
-    autoSort = (tick - lastSortTick) >= 60000 # 1分钟强制排序一次
+    autoSort = (tick - lastSortTick) >= 60000 or billInfoDict.get("autoSort") == True # 1分钟强制排序一次
     if autoSort:
         gameWorld.SetDict(Def_Key_BillboardSortTick % bType, tick)
     #GameWorld.DebugLog("更新排行榜:bType=%s,autoSort=%s,tick=%s,lastSortTick=%s,d=%s" % (bType, autoSort, tick, lastSortTick, tick - lastSortTick))
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/Arena.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/Arena.py
index ed4202e..4926e9c 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/Arena.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/Arena.py
@@ -32,7 +32,8 @@
     
     if not msgList:
         GameWorld.DebugAnswer(curPlayer, "重置玩家竞技场: Arena 0")
-        GameWorld.DebugAnswer(curPlayer, "设置玩家积分: Arena 积分")
+        GameWorld.DebugAnswer(curPlayer, "设置玩家榜积分: Arena 积分")
+        GameWorld.DebugAnswer(curPlayer, "直接匹配到目标: Arena 1 对手ID 对手ID ...")
         GameWorld.DebugAnswer(curPlayer, "重置赛季直接用 test_OnWeek (需开服7天后)")
         return
     
@@ -47,7 +48,7 @@
         GameWorld.DebugAnswer(curPlayer, "重置成功!")
         return
     
-    else:
+    elif len(msgList) == 1 and value1 > 0:
         GameWorld.DebugAnswer(curPlayer, "设置竞技场积分: %s" % value1)
         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ArenaScore, value1)
         PlayerArena.Sync_ArenaInfo(curPlayer)
@@ -58,6 +59,14 @@
         cmpValue3 = 0
         value1 = curPlayer.GetOfficialRank()
         value2 = curPlayer.GetLV()
-        PlayerBillboard.UpdatePlayerBillboard(curPlayer, ShareDefine.Def_BT_Arena, cmpValue, cmpValue2, cmpValue3, value1, value2)
+        PlayerBillboard.UpdatePlayerBillboard(curPlayer, ShareDefine.Def_BT_Arena, cmpValue, cmpValue2, cmpValue3, value1, value2, autoSort=True)
+        
+    elif len(msgList) >= 2 and value1 == 1:
+        gmMatchIDList = msgList[1:]
+        PlayerArena.GMArenaMatch(curPlayer, gmMatchIDList)
+        
+    else:
+        pass
+    
     return
 
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerArena.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerArena.py
index d13cf07..5d3ce1f 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerArena.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerArena.py
@@ -160,6 +160,15 @@
     GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(curPlayer.GetID(), 0, 0, "Arena", msgInfo, len(msgInfo))
     return
 
+def GMArenaMatch(curPlayer, gmMatchIDList):
+    playerID = curPlayer.GetPlayerID()
+    playerLV = curPlayer.GetLV()
+    playerScore = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ArenaScore)
+    msgInfo = str(["MatchRefresh", {"isRefresh":1, "playerLV":playerLV, "playerScore":playerScore, "gmMatchIDList":gmMatchIDList}])
+    GameWorld.DebugLog("竞技场发送GameServer匹配: %s" % msgInfo, playerID)
+    GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(curPlayer.GetID(), 0, 0, "Arena", msgInfo, len(msgInfo))
+    return
+
 #// B2 10 竞技场挑战玩家 #tagCMArenaBattle
 #
 #struct    tagCMArenaBattle
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerBillboard.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerBillboard.py
index 7e513f0..1c8a3c6 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerBillboard.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerBillboard.py
@@ -65,7 +65,7 @@
     
     return True
 
-def UpdatePlayerBillboard(curPlayer, bType, cmpValue, cmpValue2=0, cmpValue3=0, value1=0, value2=0, exInfo=[]):
+def UpdatePlayerBillboard(curPlayer, bType, cmpValue, cmpValue2=0, cmpValue3=0, value1=0, value2=0, exInfo=[], autoSort=False):
     ## 更新玩家排行榜
     
     #if not cmpValue and not cmpValue2 and not cmpValue3:
@@ -81,12 +81,12 @@
     if bType in ShareDefine.BTValue1_OfficialRankList:
         value1 = curPlayer.GetOfficialRank()
     GameServer_UpdateBillboard(bType, playerJob, playerID, playerName, playerOpInfo,
-                               value1, value2, cmpValue, cmpValue2, cmpValue3, 0, exInfo)
+                               value1, value2, cmpValue, cmpValue2, cmpValue3, 0, exInfo, autoSort)
     return
 
-def GameServer_UpdateBillboard(bType, bType2, bID, bName, bName2, value1, value2, cmpValue, cmpValue2=0, cmpValue3=0, bID2=0, exInfo=[]):
+def GameServer_UpdateBillboard(bType, bType2, bID, bName, bName2, value1, value2, cmpValue, cmpValue2=0, cmpValue3=0, bID2=0, exInfo=[], autoSort=False):
     sendMsg = "%s" % ({"Type":bType, "Type2":bType2, "ID":bID, "ID2":bID2, "Name1":bName, "Name2":bName2, "ExInfo":exInfo,
-                       "Value1":value1, "Value2":value2, "CmpValue":cmpValue, "CmpValue2":cmpValue2, "CmpValue3":cmpValue3}) 
+                       "Value1":value1, "Value2":value2, "CmpValue":cmpValue, "CmpValue2":cmpValue2, "CmpValue3":cmpValue3, "autoSort":autoSort}) 
     GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, "UpdateBillboard", sendMsg, len(sendMsg))
     GameWorld.DebugLog("同步GameServer排行榜:bType=%s,cmpValue=%s, %s" % (bType, cmpValue, sendMsg), bID)
     return

--
Gitblit v1.8.0