From c3935a93e6be5457f7d1e90bbe91845abf3943f4 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期五, 05 九月 2025 17:37:18 +0800
Subject: [PATCH] 129 【战斗】战斗系统-服务端(去除0407通知;修复5011触发被动报错;)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerHero.py |   43 +++++++++++++++++++++----------------------
 1 files changed, 21 insertions(+), 22 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerHero.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerHero.py
index 19998a5..6c361d2 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerHero.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerHero.py
@@ -554,11 +554,16 @@
     if not heroIpyData:
         return
     quality = heroIpyData.GetQuality()
+    heroLV = heroItem.GetUserAttr(ShareDefine.Def_IudetHeroLV)
     breakLV = heroItem.GetUserAttr(ShareDefine.Def_IudetHeroBreakLV)
-    GameWorld.DebugLog("请求武将突破: itemIndex=%s,heroID=%s,quality=%s,breakLV=%s" 
-                       % (itemIndex, heroID, quality, breakLV), playerID)
+    GameWorld.DebugLog("请求武将突破: itemIndex=%s,heroID=%s,quality=%s,heroLV=%s,breakLV=%s" 
+                       % (itemIndex, heroID, quality, heroLV, breakLV), playerID)
     ipyData = IpyGameDataPY.GetIpyGameData("HeroQualityBreak", quality, breakLV)
     if not ipyData:
+        return
+    LVMax = ipyData.GetLVMax()
+    if heroLV < LVMax:
+        GameWorld.DebugLog("未满级,无法突破: heroLV=%s < %s" % (heroLV, LVMax), playerID)
         return
     nextBreakLV = breakLV + 1
     if not IpyGameDataPY.GetIpyGameData("HeroQualityBreak", quality, nextBreakLV):
@@ -820,33 +825,27 @@
         GameWorld.ErrLog("武将洗炼结果未处理,无法洗炼! washIDCnt=%s" % washIDCnt)
         return
     
-    washCostItemInfo = IpyGameDataPY.GetFuncEvalCfg("HeroWash", 1)
-    lockCostItemInfo = IpyGameDataPY.GetFuncEvalCfg("HeroWash", 2)
-    if not washCostItemInfo or not lockCostItemInfo:
+    washItemID = IpyGameDataPY.GetFuncCfg("HeroWash", 1)
+    lockCostItemList = IpyGameDataPY.GetFuncEvalCfg("HeroWash", 2)
+    if not lockCostItemList:
         return
-    washItemID, washCostItemCount = washCostItemInfo
-    lockItemID, lockCostItemCount = lockCostItemInfo
-    
+    singleItem = heroItem.GetItem()
+    idCount = singleItem.GetUserAttrCount(ShareDefine.Def_IudetHeroTalentID)
+    for lockIndex in lockTalentIndexs[::-1]:
+        if lockIndex >= idCount:
+            lockTalentIndexs.remove(lockIndex)
+            GameWorld.DebugLog("去除不存在的锁定索引: lockIndex=%s" % lockIndex)
+            
+    lockCnt = len(lockTalentIndexs)
+    washCostItemCount = lockCostItemList[lockCnt] if len(lockCostItemList) > lockCnt else lockCostItemList[-1]
+    GameWorld.DebugLog("washItemID=%s,washCostItemCount=%s,lockTalentIndexs=%s" % (washItemID, washCostItemCount, lockTalentIndexs))
     itemPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem)
     hasEnough, washItemIndexList = ItemCommon.GetItem_FromPack_ByID(washItemID, itemPack, washCostItemCount)
     if not hasEnough:
         GameWorld.DebugLog("洗炼材料不足,武将无法洗炼! washItemID=%s,washCostItemCount=%s" % (washItemID, washCostItemCount))
         return
-    lockItemIndexList = []
-    lockCostItemCountTotal = 0
-    if lockTalentIndexs:
-        lockCostItemCountTotal = len(lockTalentIndexs) * lockCostItemCount
-        hasEnough, lockItemIndexList = ItemCommon.GetItem_FromPack_ByID(lockItemID, itemPack, lockCostItemCountTotal)
-        if not hasEnough:
-            GameWorld.DebugLog("锁定材料不足,武将无法洗炼! lockItemID=%s,lockCostItemCount=%s,lockCostItemCountTotal=%s" 
-                               % (lockItemID, lockCostItemCount, lockCostItemCountTotal))
-            return
-    
     ItemCommon.ReduceItem(curPlayer, itemPack, washItemIndexList, washCostItemCount, True, "HeroTalentWash")
-    ItemCommon.ReduceItem(curPlayer, itemPack, lockItemIndexList, lockCostItemCountTotal, True, "HeroTalentWash")
     
-    singleItem = heroItem.GetItem()
-    idCount = singleItem.GetUserAttrCount(ShareDefine.Def_IudetHeroTalentID)
     washIDList = []
     for index in range(idCount):
         if index in lockTalentIndexs:
@@ -1208,7 +1207,7 @@
 #struct    tagCSHeroDismiss
 #{
 #    tagHead         Head;
-#    BYTE        Count;
+#    WORD        Count;
 #    WORD        ItemIndexList[Count];    // 武将物品所在武将背包位置索引列表
 #};
 def OnHeroDismiss(index, clientData, tick):

--
Gitblit v1.8.0