From 180eab3510f793ed008e9504976c3b3063f7ca6d Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 18 十一月 2025 18:21:52 +0800
Subject: [PATCH] 110 【主界面】仙树升级-服务端(免费减时修改为充能减时;特权支持充能额外上限;广告奖励支持领取充能奖励;)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerArena.py |  100 ++++++++++++++++++++++++++++++++------------------
 1 files changed, 64 insertions(+), 36 deletions(-)

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 5db30f2..76ecda7 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerArena.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerArena.py
@@ -22,11 +22,13 @@
 import PlayerControl
 import IpyGameDataPY
 import ChPyNetSendPack
+import PlayerGoldInvest
 import PlayerViewCache
 import NetPackCommon
 import PyGameData
 import GameWorld
 import ChConfig
+import ObjPool
 import random
 
 # 记录攻击类型
@@ -94,6 +96,7 @@
     else:
         return
     
+    billBoard.SortDelayDo()
     orderList = [int(orderStr) for orderStr in billboradAwardDict.keys()]
     orderList.sort()
     GameWorld.Log("    奖励名次列表: %s" % orderList)
@@ -165,6 +168,8 @@
     return
 
 def DoArenaOpen(curPlayer):
+    storeMax = IpyGameDataPY.GetFuncCfg("ArenaSet", 3)
+    PlayerControl.GiveMoney(curPlayer, ShareDefine.TYPE_Price_ArenaTicket, storeMax, "ArenaOpen")    
     __DoArenaSeasonReset(curPlayer)
     return
 
@@ -178,11 +183,11 @@
 
 def GetArenaTicketStoreMax(curPlayer):
     ## 获取挑战券存储上限
-    baseCnt = IpyGameDataPY.GetFuncCfg("ArenaSet", 3)
+    storeMax = IpyGameDataPY.GetFuncCfg("ArenaSet", 3)
     
     # 其他特权提升上限
+    storeMax += PlayerGoldInvest.GetArenaTicketMax(curPlayer)
     
-    storeMax = baseCnt
     return storeMax
 
 #// B2 09 演武场匹配玩家 #tagCSArenaMatch
@@ -251,6 +256,7 @@
     toOrder = playerOrder + fromLowerCnt * matchPerRank # 从低名次往高名次匹配
     GameWorld.DebugLog("    fromLowerCnt=%s,matchPerRank=%s,toOrder=%s" % (fromLowerCnt, matchPerRank, toOrder), playerID)
     matchOrderList = [] # 匹配到的名次
+    viewCacheDict = {}
     for _ in range(matchPlayerCnt):
         fromOrder = max(1, toOrder - matchPerRank)
         if toOrder <= fromOrder:
@@ -262,36 +268,26 @@
         if not orderList:
             break
         
-        if fromOrder == 1:
-            for order in orderList:
-                if order > maxOrder:
-                    continue
-                matchOrderList.append(order)
+        for order in orderList:
+            if order > maxOrder:
+                continue
+            billData = billBoard.At(order - 1)
+            tagID = billData.GetID()
+            viewCache = PlayerViewCache.FindBattleViewCache(tagID)
+            if not viewCache:
+                GameWorld.DebugLog("    无战斗缓存的玩家不匹配: tagID=%s,order=%s,fromOrder=%s,toOrder=%s" % (tagID, order, fromOrder, toOrder), playerID)
+                continue
+            matchOrderList.append(order)
+            viewCacheDict[tagID] = viewCache
+            
+            if fromOrder == 1:
                 if len(matchOrderList) >= matchPlayerCnt:
                     break
-        else:
-            order = orderList[0]
-            if order <= maxOrder:
-                matchOrderList.append(order)
-                
+            else:
+                break
+            
         GameWorld.DebugLog("    匹配玩家: fromOrder=%s,toOrder=%s,matchOrderList=%s" % (fromOrder, toOrder, matchOrderList), playerID)
         toOrder = fromOrder - 1
-        
-    # GM指定匹配测试
-    if gmMatchIDList != None and curPlayer.GetGMLevel():
-        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
-            GameWorld.DebugAnswer(curPlayer, "指定匹配ID(%s),order(%s)" % (gmMatchID, gmMatchOrder))
-            if gmMatchID not in matchOrderList:
-                matchOrderList.insert(0, gmMatchOrder)
-        matchOrderList = matchOrderList[:needMatchCount]
         
     matchOrderList.sort()
     matchIDList = [] # 最终匹配的玩家ID列表
@@ -299,10 +295,34 @@
         if matchOrder > maxOrder or matchOrder <= 0:
             break
         billData = billBoard.At(matchOrder - 1)
-        matchIDList.append(billData.GetID())
+        tagID = billData.GetID()
+        matchIDList.append(tagID)
+    GameWorld.DebugLog("    匹配榜单结果: matchIDList=%s,matchOrderList=%s" % (matchIDList, matchOrderList), playerID)
+    
+    # GM指定匹配测试
+    if gmMatchIDList != None and curPlayer.GetGMLevel():
+        for gmMatchID in gmMatchIDList:
+            if gmMatchID == playerID:
+                GameWorld.DebugAnswer(curPlayer, "不能匹配自己!%s" % gmMatchID)
+                continue
+            
+            if gmMatchID in matchIDList:
+                continue
+            
+            viewCache = PlayerViewCache.FindBattleViewCache(gmMatchID)
+            if not viewCache:
+                GameWorld.DebugAnswer(curPlayer, "没有战斗缓存目标不匹配!%s" % gmMatchID)
+                continue
+            
+            GameWorld.DebugAnswer(curPlayer, "指定匹配ID(%s)" % (gmMatchID))
+            matchIDList.append(gmMatchID)
+            viewCacheDict[gmMatchID] = viewCache
+            
+        matchOrderList = matchOrderList[:needMatchCount]
+        GameWorld.DebugLog("    指定匹配结果: matchIDList=%s" % (matchIDList), playerID)
         
     needRobotCnt = needMatchCount - len(matchIDList)
-    GameWorld.DebugLog("    匹配榜单结果: matchIDList=%s,matchOrderList=%s,needRobotCnt=%s" % (matchIDList, matchOrderList, needRobotCnt), playerID)
+    GameWorld.DebugLog("    还需机器人数=%s" % (needRobotCnt), playerID)
     ipyDataMgr = IpyGameDataPY.IPY_Data()
     robotMax = ipyDataMgr.GetRobotCount()
     doCnt = 100
@@ -317,24 +337,32 @@
     GameWorld.DebugLog("    最终匹配结果: matchIDList=%s" % matchIDList, playerID)
     
     PyGameData.g_arenaPlayerMatchDict[playerID] = matchIDList
-    __SyncMatchList(curPlayer, matchIDList)
+    __SyncMatchList(curPlayer, matchIDList, viewCacheDict)
     return
 
-def __SyncMatchList(curPlayer, matchIDList):
+def __SyncMatchList(curPlayer, matchIDList, viewCacheDict={}):
     ## 同步匹配列表
-    clientPack = ChPyNetSendPack.tagSCArenaMatchList()
+    objPool = ObjPool.GetPoolMgr()
+    clientPack = objPool.acquire(ChPyNetSendPack.tagSCArenaMatchList)
     clientPack.MatchList = []
     for matchID in matchIDList:
-        viewCache = PlayerViewCache.FindViewCache(matchID)
-        matchInfo = ChPyNetSendPack.tagSCArenaMatchInfo()
+        if matchID in viewCacheDict:
+            viewCache = viewCacheDict[matchID]
+        else:
+            viewCache = PlayerViewCache.FindBattleViewCache(matchID)
+        if not viewCache:
+            continue
+        matchInfo = objPool.acquire(ChPyNetSendPack.tagSCArenaMatchInfo)
         matchInfo.PlayerID = matchID
         if viewCache:
             matchInfo.PlayerName = viewCache.GetPlayerName()
             matchInfo.RealmLV = viewCache.GetRealmLV()
+            matchInfo.LV = viewCache.GetLV()
             matchInfo.Face = viewCache.GetFace()
             matchInfo.FacePic = viewCache.GetFacePic()
             matchInfo.FightPower = viewCache.GetFightPower()
             matchInfo.FightPowerEx = viewCache.GetFightPowerEx()
+            matchInfo.TitleID = viewCache.GetTitleID()
         else:
             matchInfo.PlayerName = "p%s" % matchID
         clientPack.MatchList.append(matchInfo)
@@ -343,7 +371,7 @@
     return
 
 def Sync_ArenaInfo(curPlayer):
-    clientPack = ChPyNetSendPack.tagSCArenaPlayerInfo()
+    clientPack = ObjPool.GetPoolMgr().acquire(ChPyNetSendPack.tagSCArenaPlayerInfo)
     clientPack.Score = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ArenaScore)
     NetPackCommon.SendFakePack(curPlayer, clientPack)
     return

--
Gitblit v1.8.0