From 7401f56246945b00aa91d12ba03ec3865c4c2b25 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期三, 03 九月 2025 16:58:58 +0800
Subject: [PATCH] 121 【武将】武将系统-服务端(天赋洗炼改为仅使用洗炼ID,锁定天赋增加消耗洗炼道具个数;)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerHero.py |   32 +++++++++++++-------------------
 1 files changed, 13 insertions(+), 19 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 134fed7..6c361d2 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerHero.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerHero.py
@@ -825,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:

--
Gitblit v1.8.0