From b4d7b98ffa412398224044aa25b85f92118ede8e Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期四, 16 五月 2024 18:43:39 +0800
Subject: [PATCH] 10156 副本功能玩法关联回合战斗表现(竞技场挑战券优化)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ItemControler.py                             |    8 ++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/UseItem/Item_AddArenaBattleCount.py          |   34 ++++++-----
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py                                |   12 +--
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerArena.py                             |   50 +++++++++++-----
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCutTree.py                           |    5 +
 ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py                                                     |   12 +--
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_ArenaBattle.py |    4 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py                                       |    3 
 8 files changed, 76 insertions(+), 52 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
index 2d177a2..77943dc 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
@@ -18965,9 +18965,8 @@
                   ("SubCmd", c_ubyte),
                   ("IsReset", c_ubyte),    #是否是重置的
                   ("Score", c_int),    #当前积分
-                  ("BattleCountToday", c_ubyte),    #今日已挑战次数
                   ("MatchRefreshCount", c_ubyte),    #当前已刷新匹配列表次数,每次挑战后会重置
-                  ("ItemAddBattleCountToday", c_ubyte),    #今日已使用物品增加的挑战次数
+                  ("BattleCount", c_ubyte),    #当前可挑战次数
                   ]
 
     def __init__(self):
@@ -18986,9 +18985,8 @@
         self.SubCmd = 0xC3
         self.IsReset = 0
         self.Score = 0
-        self.BattleCountToday = 0
         self.MatchRefreshCount = 0
-        self.ItemAddBattleCountToday = 0
+        self.BattleCount = 0
         return
 
     def GetLength(self):
@@ -19003,18 +19001,16 @@
                                 SubCmd:%s,
                                 IsReset:%d,
                                 Score:%d,
-                                BattleCountToday:%d,
                                 MatchRefreshCount:%d,
-                                ItemAddBattleCountToday:%d
+                                BattleCount:%d
                                 '''\
                                 %(
                                 self.Cmd,
                                 self.SubCmd,
                                 self.IsReset,
                                 self.Score,
-                                self.BattleCountToday,
                                 self.MatchRefreshCount,
-                                self.ItemAddBattleCountToday
+                                self.BattleCount
                                 )
         return DumpString
 
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
index 23d19ad..ee097b5 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -4403,10 +4403,9 @@
 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" # 今日已使用物品增加次数
 Def_PDict_ArenaBattleTagID = "ArenaBattleTagID" # 当前对战的对手ID
+Def_PDict_ArenaBattleCount = "ArenaBattleCount" # 当前可用次数
 
 #功能系统特权
 Def_PDict_FuncSysPrivilegeActTime = "FuncSysPrivilegeActTime_%s" # 系统功能特权激活时间戳,参数(系统功能ID)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
index 2d177a2..77943dc 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
@@ -18965,9 +18965,8 @@
                   ("SubCmd", c_ubyte),
                   ("IsReset", c_ubyte),    #是否是重置的
                   ("Score", c_int),    #当前积分
-                  ("BattleCountToday", c_ubyte),    #今日已挑战次数
                   ("MatchRefreshCount", c_ubyte),    #当前已刷新匹配列表次数,每次挑战后会重置
-                  ("ItemAddBattleCountToday", c_ubyte),    #今日已使用物品增加的挑战次数
+                  ("BattleCount", c_ubyte),    #当前可挑战次数
                   ]
 
     def __init__(self):
@@ -18986,9 +18985,8 @@
         self.SubCmd = 0xC3
         self.IsReset = 0
         self.Score = 0
-        self.BattleCountToday = 0
         self.MatchRefreshCount = 0
-        self.ItemAddBattleCountToday = 0
+        self.BattleCount = 0
         return
 
     def GetLength(self):
@@ -19003,18 +19001,16 @@
                                 SubCmd:%s,
                                 IsReset:%d,
                                 Score:%d,
-                                BattleCountToday:%d,
                                 MatchRefreshCount:%d,
-                                ItemAddBattleCountToday:%d
+                                BattleCount:%d
                                 '''\
                                 %(
                                 self.Cmd,
                                 self.SubCmd,
                                 self.IsReset,
                                 self.Score,
-                                self.BattleCountToday,
                                 self.MatchRefreshCount,
-                                self.ItemAddBattleCountToday
+                                self.BattleCount
                                 )
         return DumpString
 
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_ArenaBattle.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_ArenaBattle.py
index 6ac443e..d2ba9dc 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_ArenaBattle.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_ArenaBattle.py
@@ -25,7 +25,7 @@
     ## 回合战斗请求 - 地图验证
     
     playerID = curPlayer.GetPlayerID()
-    if not PlayerArena.CheckArenaBattleCount(curPlayer):
+    if not PlayerArena.GetArenaBattleCount(curPlayer):
         GameWorld.DebugLog("竞技场已经没有对战次数!", playerID)
         return
     
@@ -50,7 +50,7 @@
         return
     tagPlayerID = valueList[0]
         
-    if not PlayerArena.CheckArenaBattleCount(curPlayer):
+    if not PlayerArena.GetArenaBattleCount(curPlayer):
         return
     
     playerLV = curPlayer.GetLV()
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ItemControler.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ItemControler.py
index 83accd6..58bc0eb 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ItemControler.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ItemControler.py
@@ -36,6 +36,7 @@
 import IpyGameDataPY
 import DataRecordPack
 import PlayerGubao
+import PlayerArena
 import EventShell
 import PlayerTask
 import PlayerVip
@@ -1152,6 +1153,13 @@
                 tagItem.Clear()
                 return True
             
+        #增加竞技场次数
+        if itemEff.GetEffectID() == ChConfig.Def_Effect_AddArenaBattleCount:
+            PlayerArena.AddArenaBattleCount(curPlayer, itemEff.GetEffectValue(0))
+            #GameWorld.DebugLog("增加竞技场次数物品默认使用!")
+            tagItem.Clear()
+            return True
+            
         if itemID in ChConfig.Def_TransformItemIDList or tagItem.GetType() == ChConfig.Def_ItemType_AutoUseMoney:
             # 直接转化为对应货币的物品仅在放入背包时直接转化,否则还是以真实物品的形式存在,但堆叠上限需要做特殊处理
             if packIndex == IPY_GameWorld.rptItem:
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/UseItem/Item_AddArenaBattleCount.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/UseItem/Item_AddArenaBattleCount.py
index cfe6ed8..d04e5d8 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/UseItem/Item_AddArenaBattleCount.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/UseItem/Item_AddArenaBattleCount.py
@@ -30,18 +30,22 @@
 # @return 是否使用物品成功
 # @remarks 使用物品,触发物品附加效果
 def BatchUseItem(curPlayer, curRoleItem, tick, useCnt, exData):
-    useItemEff = curRoleItem.GetEffectByIndex(0)
-    addCnt = useItemEff.GetEffectValue(0) * useCnt
-    if addCnt <= 0:
-        return
-    
-    updItemAddCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ArenaItemAddCount) + addCnt
-    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ArenaItemAddCount, updItemAddCount)
-    PlayerArena.Sync_ArenaInfo(curPlayer)
-    
-    #扣除物品
-    ItemCommon.DelItem(curPlayer, curRoleItem, useCnt)
-    
-    # 竞技场挑战次数增加<color=#109d06FF>%s0</color>次
-    PlayerControl.NotifyCode(curPlayer, "ArenaBattleCountAdd", [addCnt])
-    return True
+    #改为自动使用
+    return
+    #===============================================================================================
+    # useItemEff = curRoleItem.GetEffectByIndex(0)
+    # addCnt = useItemEff.GetEffectValue(0) * useCnt
+    # if addCnt <= 0:
+    #    return
+    # 
+    # updItemAddCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ArenaItemAddCount) + addCnt
+    # PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ArenaItemAddCount, updItemAddCount)
+    # PlayerArena.Sync_ArenaInfo(curPlayer)
+    # 
+    # #扣除物品
+    # ItemCommon.DelItem(curPlayer, curRoleItem, useCnt)
+    # 
+    # # 竞技场挑战次数增加<color=#109d06FF>%s0</color>次
+    # PlayerControl.NotifyCode(curPlayer, "ArenaBattleCountAdd", [addCnt])
+    # return True
+    #===============================================================================================
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 4eb6e4d..26b6e0e 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerArena.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerArena.py
@@ -53,8 +53,6 @@
     if not GameFuncComm.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_Arena):
         return
     
-    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ArenaItemAddCount, 0)
-    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ArenaBattleCountDay, 0)
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ArenaMatchRefreshCount, 0)
     Sync_ArenaInfo(curPlayer)
     
@@ -122,18 +120,41 @@
         GameWorld.DebugLog("竞技场赛季重置! preSeasonscore=%s,setScore=%s" % (preSeasonscore, setScore))
         
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ArenaScore, setScore)
-    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ArenaItemAddCount, 0)
-    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ArenaBattleCountDay, 0)
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ArenaMatchRefreshCount, 0)
     Sync_ArenaInfo(curPlayer, True)
     return
 
-def CheckArenaBattleCount(curPlayer):
-    ## 验证是否还有对战次数
-    todayBattleCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ArenaBattleCountDay)
-    itemAddCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ArenaItemAddCount)
-    dayFreeCount = IpyGameDataPY.GetFuncCfg("ArenaSet", 3)
-    return todayBattleCount < (dayFreeCount + itemAddCount)
+def AddArenaBattleCount(curPlayer, addCount):
+    updCount = min(ChConfig.Def_UpperLimit_DWord, curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ArenaBattleCount) + addCount)
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ArenaBattleCount, updCount)
+    Sync_ArenaInfo(curPlayer)
+    return
+
+def GetArenaBattleCount(curPlayer):
+    ## 获取当前可对战次数
+    return curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ArenaBattleCount)
+
+def GetArenaBattleCountMax(curPlayer):
+    ## 最大可累计挑战次数
+    initMax = IpyGameDataPY.GetFuncCfg("ArenaSet", 3) # 初始最大次数
+    
+    # 其他功能增加上限...
+    
+    maxCount = initMax
+    return maxCount
+
+def CheckCanGiveBattleCountItem(curPlayer, itemID):
+    ## 可否给加挑战次数道具
+    itemData = GameWorld.GetGameData().GetItemByTypeID(itemID)
+    if not itemData:
+        return False
+    itemEff = itemData.GetEffectByIndex(0)
+    if itemEff.GetEffectID() != ChConfig.Def_Effect_AddArenaBattleCount:
+        GameWorld.DebugLog("非挑战券可给! itemID=%s" % itemID)
+        return True
+    canGive = GetArenaBattleCount(curPlayer) < GetArenaBattleCountMax(curPlayer)
+    GameWorld.DebugLog("可否给挑战券: canGive=%s" % canGive)
+    return canGive
 
 #// B2 09 竞技场匹配玩家 #tagCMArenaMatch
 #
@@ -282,10 +303,10 @@
     updOrder = retDict["updOrder"]
     
     # 扣次数
-    todayBattleCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ArenaBattleCountDay) + 1
-    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ArenaBattleCountDay, todayBattleCount)
+    battleCount = max(0, curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ArenaBattleCount) - 1)
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ArenaBattleCount, battleCount)
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ArenaMatchRefreshCount, 0)
-        
+    
     # 更新积分
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ArenaScore, updScore)
     highestScore = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ArenaHighestScore)
@@ -362,9 +383,8 @@
     clientPack = ChPyNetSendPack.tagMCArenaPlayerInfo()
     clientPack.IsReset = 1 if isReset else 0
     clientPack.Score = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ArenaScore)
-    clientPack.BattleCountToday = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ArenaBattleCountDay)
     clientPack.MatchRefreshCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ArenaMatchRefreshCount)
-    clientPack.ItemAddBattleCountToday = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ArenaItemAddCount)
+    clientPack.BattleCount = min(255, curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ArenaBattleCount))
     NetPackCommon.SendFakePack(curPlayer, clientPack)
     return
 
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCutTree.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCutTree.py
index 117b8ac..fec007f 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCutTree.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCutTree.py
@@ -26,6 +26,7 @@
 import PlayerControl
 import IPY_GameWorld
 import ItemControler
+import PlayerArena
 import PlayerTask
 import NPCCommon
 import ChConfig
@@ -144,9 +145,9 @@
         giveEquipIDList.append(equipItemID)
         
         exItem = GameWorld.GetResultByRandomList(exAwardItemRateList)
-        if exItem:
+        if exItem and PlayerArena.CheckCanGiveBattleCountItem(curPlayer, exItem[0]):
             giveItemListEx.append([exItem[0], exItem[1], 0])
-                    
+            
     if not giveEquipIDList:
         return
     giveEquipCount = len(giveEquipIDList)

--
Gitblit v1.8.0