From 65f05c143e3d8221200ef65eb84c850c8c183191 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期三, 11 八月 2021 21:07:29 +0800
Subject: [PATCH] 8585 【BT3】【主干】竞技场(匹配优化前X后X开出配置;增加概率匹配机器人)

---
 ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldArena.py                   |   24 +++++++----
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/QuestRunner.py |   26 +++++++++++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventShell.py           |   10 +++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerArena.py         |   12 +++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/Arena.py          |    1 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py                   |    1 
 6 files changed, 64 insertions(+), 10 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldArena.py b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldArena.py
index 9a35b2a..a8b5747 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldArena.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldArena.py
@@ -568,13 +568,13 @@
         playerOrder = maxOrder + 1
         
     GameWorld.DebugLog("    maxOrder=%s,playerOrder=%s" % (maxOrder, playerOrder), playerID)
-    
+    highRandOrder, lowRandOrder = IpyGameDataPY.GetFuncEvalCfg("ArenaMatch", 5) # 前X名匹配比自己高名次时直接随机
     matchOrderList = [] # 匹配到的名次
     # 非第一名的匹配比自身名次高的
     if playerOrder > 1 and higherOrderPerList:
         higherOrderCount = playerOrder - 1 # 比玩家高的名次的个数
         # 小于10个的直接纯随机
-        if 0 < higherOrderCount < 10:
+        if 0 < higherOrderCount < highRandOrder:
             randOrderList = range(1, playerOrder)
             random.shuffle(randOrderList)
             matchOrderList.extend(randOrderList[:len(higherOrderPerList)])
@@ -582,7 +582,7 @@
                                % (higherOrderCount, randOrderList, matchOrderList), playerID)
             
         # 按比例划分
-        elif higherOrderCount >= 10:
+        elif higherOrderCount >= highRandOrder:
             randMaxOrder = playerOrder - 1
             for per in higherOrderPerList:
                 per = min(per, 100) # 最多到100
@@ -605,7 +605,7 @@
     if 1 <= playerOrder < maxOrder and lowerOrderPerList:
         lowerOrderCount = maxOrder - playerOrder # 比玩家低的名次的个数
         # 小于10个的直接纯随机
-        if 0 < lowerOrderCount < 10:
+        if 0 < lowerOrderCount < lowRandOrder:
             randOrderList = range(playerOrder + 1, maxOrder + 1)
             random.shuffle(randOrderList)
             matchOrderList.extend(randOrderList[:len(lowerOrderPerList)])
@@ -613,7 +613,7 @@
                                % (lowerOrderCount, randOrderList, matchOrderList), playerID)
             
         # 按比例划分
-        elif lowerOrderCount >= 10:
+        elif lowerOrderCount >= lowRandOrder:
             randMinOrder = playerOrder + 1
             for per in lowerOrderPerList:
                 per = min(per, 100) # 最多到100
@@ -657,24 +657,30 @@
             if gmMatchOrder in matchOrderList:
                 continue
             gmMatchOrderList.append(gmMatchOrder)
-            GameWorld.DebugAnswer(curPlayer, "指定匹配ID(%s),order(%s)" % (gmMatchID, gmMatchOrder))
+            GameWorld.DebugAnswer(curPlayer, "指定匹配ID(%s),order(%s)" % (gmMatchID, gmMatchOrder), playerID)
             
         GameWorld.DebugLog("matchOrderList=%s,needMatchCount=%s" % (str(matchOrderList), needMatchCount))
         if matchOrderList:
             matchOrderList = matchOrderList[:needMatchCount - len(gmMatchOrderList)]
         matchOrderList += gmMatchOrderList
         matchOrderList.sort()
+            
+    matchRobotRate = IpyGameDataPY.GetFuncCfg("ArenaMatch", 4) # 每次可直接匹配一个机器人概率
+    if matchRobotRate and matchOrderList and len(matchOrderList) >= needMatchCount and GameWorld.CanHappen(matchRobotRate, 100):
+        popOrder = matchOrderList.pop(-1) # 去掉最后一个
+        GameWorld.DebugLog("    概率匹配到一个机器人,去掉最后一个! matchRobotRate=%s,popOrder=%s" % (matchRobotRate, popOrder), playerID)
+        
     GameWorld.DebugLog("    最终匹配到的名次列表: matchOrderList=%s" % matchOrderList, playerID)
     
     # 随机机器人备用信息
-    openJobList = IpyGameDataPY.GetFuncEvalCfg("OpenJob", 1)
+    openJobList = IpyGameDataPY.GetFuncEvalCfg("OpenJob", 1)    
     
-    randRobotLVPerRange = IpyGameDataPY.GetFuncEvalCfg("ArenaMatch", 3)
+    randRobotLVScorePerInfo = IpyGameDataPY.GetFuncEvalCfg("ArenaMatch", 3)
+    randRobotLVPerRange, randRobotScorePerRange = randRobotLVScorePerInfo
     minLV, maxLV = IpyGameDataPY.GetFuncEvalCfg("ArenaRobot", 2) # 机器人最小、最大等级
     randMinLV = min(minLV, int(playerLV * randRobotLVPerRange[0] / 100.0))
     randMaxLV = min(maxLV, int(playerLV * randRobotLVPerRange[1] / 100.0))
     
-    randRobotScorePerRange = IpyGameDataPY.GetFuncEvalCfg("ArenaMatch", 4)
     randMinScore = int(playerScore * randRobotScorePerRange[0] / 100.0)
     randMaxScore = int(playerScore * randRobotScorePerRange[1] / 100.0)
     
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
index 230ada4..4f3307b 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -4152,6 +4152,7 @@
 #竞技场
 Def_PDict_ArenaOSSeasonState = "ArenaOSSeasonState" # 开服前定制X天赛季状态  0-未比赛过,1-进行中,>1结算时的开服天
 Def_PDict_ArenaScore = "ArenaScore" # 当前积分
+Def_PDict_ArenaHighestScore = "ArenaHighestScore" # 历史最高积分
 Def_PDict_ArenaBattleCountDay = "ArenaBattleCountDay" # 今日已战斗次数
 Def_PDict_ArenaMatchRefreshCount = "ArenaMatchRefreshCount" # 匹配刷新列表次数
 Def_PDict_ArenaItemAddCount = "ArenaItemAddCount" # 今日已使用物品增加次数
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventShell.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventShell.py
index dc14f0b..2441d62 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventShell.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventShell.py
@@ -2018,6 +2018,16 @@
     RunQuestEvent(curPlayer, "activityplace", event, Def_RunQuestType_RunAll if runall else Def_RunQuestType_Normal)
     return
 
+def EventRespons_ArenaBattleOver(curPlayer):
+    # 挑战竞技场 - 结算才算
+    RunQuestEvent(curPlayer, "arenabattleover", "arenabattleover", Def_RunQuestType_Normal)
+    return
+
+def EventRespons_ArenaHighestScore(curPlayer):
+    # 刷新竞技场历史最高分
+    RunQuestEvent(curPlayer, "arenahighestscore", "arenahighestscore", Def_RunQuestType_Normal)
+    return
+
 #---------------------------------------------------------------------
 
 #================================================================================
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/QuestRunner.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/QuestRunner.py
index 3a911a5..09ceb73 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/QuestRunner.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/QuestRunner.py
@@ -7361,6 +7361,32 @@
     weapontype = GameWorld.ToIntDef(curActionNode.GetAttribute("weapontype"), 0)
     return curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GodWeaponLV % weapontype) >= lv
 
+##竞技场历史最高分是否达到x分
+# @param None
+# @return None <Checkarenahighestscore  score="验证是否达到x分"/>
+def ConditionType_Checkarenahighestscore(curPlayer, curMission, curActionNode):
+    score = GameWorld.ToIntDef(curActionNode.GetAttribute("score"), 0)
+    highestScore = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ArenaHighestScore)
+    return highestScore >= score
+
+##设置竞技场历史最高分进度
+# @param None
+# @return None <Setarenahighestscore key="当前历史最高分存储任务key" id="可选任务ID" />
+def DoType_Setarenahighestscore(curPlayer, curMission, curActionNode):
+    missionID = curMission.GetMissionID()
+
+    highestScore = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ArenaHighestScore)
+    key = curActionNode.GetAttribute("key") # 显示进度用
+    questID = GameWorld.ToIntDef(curActionNode.GetAttribute("id"), 0)
+    if questID != 0:
+        curMission = curPlayer.FindMission(questID)
+    missionScore = curMission.GetProperty(key)
+    if missionScore < highestScore:
+        curMission.SetProperty(key, highestScore)
+        GameWorld.DebugLog("更新竞技场任务历史最高分: missionID=%s,questID=%s,missionScore=%s to %s" % (missionID, questID, missionScore, highestScore))
+        
+    return
+
 ##设置今日活跃度
 # @param curPlayer 玩家实例
 # @param curMission 任务实例
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 4926e9c..08134ed 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
@@ -44,6 +44,7 @@
     value1 = msgList[0]
     if value1 <= 0:
         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ArenaOSSeasonState, 0)
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ArenaHighestScore, 0)
         PlayerArena.__DoArenaSeasonReset(curPlayer)
         GameWorld.DebugAnswer(curPlayer, "重置成功!")
         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 6dff9b9..c79ec5d 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerArena.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerArena.py
@@ -26,6 +26,7 @@
 import FBCommon
 import IPY_GameWorld
 import ItemControler
+import EventShell
 
 def DoArenaOpen(curPlayer):
     ## 竞技场功能开启
@@ -279,7 +280,12 @@
         
     # 更新积分
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ArenaScore, updScore)
-    
+    highestScore = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ArenaHighestScore)
+    if updScore > highestScore:
+        highestScore = updScore
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ArenaHighestScore, highestScore)
+        GameWorld.DebugLog("    更新竞技场历史最高分! %s" % highestScore)
+        
     # 胜利给额外奖励
     itemList = retDict.get("awardItemList", [])
     ItemControler.GivePlayerItemOrMail(curPlayer, itemList)
@@ -288,6 +294,10 @@
     overDict = {FBCommon.Over_itemInfo:jsonItemList, "addScore":addScore, "updScore":updScore, "curOrder":curOrder, "updOrder":updOrder}
     FBCommon.NotifyFBOver(curPlayer, ChConfig.Def_FBMapID_ArenaBattle, 0, isWin, overDict)
     Sync_ArenaInfo(curPlayer)
+    
+    # 触发任务
+    EventShell.EventRespons_ArenaBattleOver(curPlayer)
+    EventShell.EventRespons_ArenaHighestScore(curPlayer)
     return
 
 def __DoUpdateArenaScore(curPlayer, cmdDict={}):

--
Gitblit v1.8.0