From 3fa43daecc099f2701baec224a791ca09766cdf4 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期四, 21 十一月 2019 14:58:00 +0800
Subject: [PATCH] 8341 【恺英】【后端】强化进化系统优化(强化支持消耗材料)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_EquipPlus.py |   40 ++++++++++++++++++++++++++++++++--------
 1 files changed, 32 insertions(+), 8 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_EquipPlus.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_EquipPlus.py
index 8be890e..6debfb6 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_EquipPlus.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_EquipPlus.py
@@ -89,7 +89,8 @@
     if not plusIpyData:
         return
     costSilver = plusIpyData.GetCostCount()
-    if not costSilver:
+    costItemInfo = plusIpyData.GetCostItemInfo()
+    if not costSilver and not costItemInfo:
         #GameWorld.DebugLog("已到强化最大等级! curPartPlusLV=%s" % curPartPlusLV, playerID)        
         return
     
@@ -104,16 +105,39 @@
                       % (curPartPlusLV, maxPlusLV, curEvolveLV), playerID)
         return
     
-    if not PlayerControl.PayMoney(curPlayer, IPY_GameWorld.TYPE_Price_Silver_Money, costSilver, isNotify=False):
+    if costSilver and not PlayerControl.HaveMoney(curPlayer, IPY_GameWorld.TYPE_Price_Silver_Money, costSilver):
+        GameWorld.DebugLog("铜钱不足,无法强化! costSilver=%s" % costSilver)
         return
     
-    totalExp = plusIpyData.GetTotalExp()
-    curExp = ChEquip.GetEquipPartProficiency(curPlayer, packType, index) + plusIpyData.GetAddExp()
+    costItemID, costItemCount = 0, 0
+    if costItemInfo:
+        costItemID, costItemCount = costItemInfo
+        itemPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem)
+        hasEnough, itemIndexList = ItemCommon.GetItem_FromPack_ByID(costItemID, itemPack, costItemCount)
+        if not hasEnough:
+            GameWorld.DebugLog("材料不足,无法强化! costItemID=%s, costItemCount=%s" % (costItemID, costItemCount))
+            return
+        
+    if costSilver:
+        PlayerControl.PayMoney(curPlayer, IPY_GameWorld.TYPE_Price_Silver_Money, costSilver, isNotify=False)
     
-    if curExp >= totalExp:
-        #升级
+    if costItemID:
+        ItemCommon.ReduceItem(curPlayer, itemPack, itemIndexList, costItemCount, True, ChConfig.ItemDel_EquipPlus)
+        
+    isLVUp = False
+    curExp = 0
+    addExp = plusIpyData.GetAddExp()
+    totalExp = plusIpyData.GetTotalExp()
+    if addExp and totalExp:
+        curExp = ChEquip.GetEquipPartProficiency(curPlayer, packType, index) + addExp
+        if curExp >= totalExp:
+            curExp = curExp - totalExp
+            isLVUp = True
+    else:
+        isLVUp = True
+        
+    if isLVUp:
         curPartPlusLV += 1
-        curExp = curExp - totalExp
         __EquipMayaPlusChange(curPlayer, packType, curEquip, index, curPartPlusLV)
         
     DataRecordPack.DR_UpStarLVSuccess(curPlayer, curExp, curPartPlusLV)
@@ -198,7 +222,7 @@
             return
         delItemDict[tuple(indexList)] = itemCnt
     for itemIndexList, delCnt in delItemDict.items():
-        ItemCommon.ReduceItem(curPlayer, itemPack, itemIndexList, delCnt, True, ChConfig.ItemDel_EquipPlusEvolve)
+        ItemCommon.ReduceItem(curPlayer, itemPack, itemIndexList, delCnt, True, ChConfig.ItemDel_EquipPlus)
         
     ChEquip.SetEquipPartPlusEvolveLV(curPlayer, packType, equipPackindex, nextEvolveLV)
     DoLogic_OnEquipPartStarLVChange(curPlayer, packType, ItemCommon.GetItemClassLV(curEquip))

--
Gitblit v1.8.0