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/IpyGameDataPY.py                    |    3 +++
 PySysDB/PySysDBPY.h                                                                                     |    1 +
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_EquipPlus.py |   40 ++++++++++++++++++++++++++++++++--------
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py                         |    4 ++--
 4 files changed, 38 insertions(+), 10 deletions(-)

diff --git a/PySysDB/PySysDBPY.h b/PySysDB/PySysDBPY.h
index bc3db27..293b0a4 100644
--- a/PySysDB/PySysDBPY.h
+++ b/PySysDB/PySysDBPY.h
@@ -120,6 +120,7 @@
 	list		AttrType;	//属性类型
 	list		AttrValue;	//属性值
 	DWORD		CostCount;	//消耗铜钱
+	list		CostItemInfo;	//消耗物品材料及个数 [itemID, itemCount]
 	DWORD		AddExp;	//提升熟练度值
 	DWORD		TotalExp;	//升级所需熟练度总值
 };
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
index 52f70d0..04f263d 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -4931,7 +4931,7 @@
 ItemDel_CoatDecompose, # 时装分解
 ItemDel_EquipEvolve, # 装备进阶
 ItemDel_EquipStarUp, # 装备升星
-ItemDel_EquipPlusEvolve, # 装备强化进化
+ItemDel_EquipPlus, # 装备强化进化
 ItemDel_LingQiEquipBreak, # 灵器突破
 ItemDel_HorsePetAwake, # 骑宠觉醒 
 ) = range(2000, 2000 + 42)
@@ -4977,7 +4977,7 @@
                    ItemDel_CoatDecompose:"CoatDecompose",
                    ItemDel_EquipEvolve:"EquipEvolve",
                    ItemDel_EquipStarUp:"EquipStarUp",
-                   ItemDel_EquipPlusEvolve:"EquipPlusEvolve",
+                   ItemDel_EquipPlus:"EquipPlus",
                    ItemDel_LingQiEquipBreak:"LingQiEquipBreak",
                    ItemDel_HorsePetAwake:"HorsePetAwake",
                    }
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))
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py
index b3c32e8..562f2ec 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py
@@ -125,6 +125,7 @@
                         ("list", "AttrType", 0),
                         ("list", "AttrValue", 0),
                         ("DWORD", "CostCount", 0),
+                        ("list", "CostItemInfo", 0),
                         ("DWORD", "AddExp", 0),
                         ("DWORD", "TotalExp", 0),
                         ),
@@ -1736,6 +1737,7 @@
         self.AttrType = []
         self.AttrValue = []
         self.CostCount = 0
+        self.CostItemInfo = []
         self.AddExp = 0
         self.TotalExp = 0
         return
@@ -1745,6 +1747,7 @@
     def GetAttrType(self): return self.AttrType # 属性类型
     def GetAttrValue(self): return self.AttrValue # 属性值
     def GetCostCount(self): return self.CostCount # 消耗铜钱
+    def GetCostItemInfo(self): return self.CostItemInfo # 消耗物品材料及个数 [itemID, itemCount]
     def GetAddExp(self): return self.AddExp # 提升熟练度值
     def GetTotalExp(self): return self.TotalExp # 升级所需熟练度总值
 

--
Gitblit v1.8.0