From f194ca807c0ef437b866e74db7cd4dcb02e531c3 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期四, 14 二月 2019 17:54:57 +0800
Subject: [PATCH] 6211 【后端】【1.6】合服任务单(运营活动支持合服定制)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_EquipWash.py |   38 +++++++++++++++++++++++++++++++++-----
 1 files changed, 33 insertions(+), 5 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_EquipWash.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_EquipWash.py
index 23f9e03..a08f4aa 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_EquipWash.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_EquipWash.py
@@ -22,6 +22,8 @@
 import PlayerControl
 import PlayerSuccess
 import IPY_GameWorld
+import DataRecordPack
+import PlayerActLogin
 import ShareDefine
 import ItemCommon
 import ChConfig
@@ -40,7 +42,10 @@
 
 def GetEquipWashMaxLV(curPlayer, equipPlace):
     # @return: 0-未开放; >=1-该装备位最大可洗练等级
-    maxLVDict = IpyGameDataPY.GetFuncEvalCfg("EquipWashMaxLV", 1)
+    washType = GetEquipWashType(equipPlace)
+    if not washType:
+        return 0
+    maxLVDict = IpyGameDataPY.GetFuncEvalCfg("EquipWashGroup%s" % washType, 2)
     if not maxLVDict:
         return 0
     equipPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptEquip)
@@ -154,8 +159,8 @@
                            % (costItemID, costItemCount, bindCnt, unBindCnt), playerID)
         return
     
-    goldWashCostList = washData.GetGoldWashCostList()
-    if not goldWashCostList or len(goldWashCostList) != Def_EquipWashMaxAttrCount:
+    goldWashCostItemCountList = washData.GetGoldWashCostList() # 洗练必增条数消耗必增道具个数
+    if not goldWashCostItemCountList or len(goldWashCostItemCountList) != Def_EquipWashMaxAttrCount:
         return
     
     randAttrDict = {} # 随机变更值字典 {属性编号:随机值, ...}
@@ -190,7 +195,22 @@
         fixMaxValueDict[attrNum] = randValueMax
         
     checkUseGoldCnt = len(useGoldAttrNumList)
-    needGold = 0 if checkUseGoldCnt <= 0 else goldWashCostList[checkUseGoldCnt - 1]
+    needGold = 0
+    needMustID = IpyGameDataPY.GetFuncCfg("EquipWashMustID", 1)
+    needMustIDCount = 0 if checkUseGoldCnt <= 0 else goldWashCostItemCountList[checkUseGoldCnt - 1]
+    delMustIDCount = needMustIDCount
+    mustItemIndexList, mustBindCnt, mustUnBindCnt = [], 0, 0
+    if needMustIDCount:
+        mustItemIndexList, mustBindCnt, mustUnBindCnt = ItemCommon.GetPackItemBindStateIndexInfo(curPlayer, needMustID, needMustIDCount)
+        mustItemLackCount = max(0, needMustIDCount - (mustBindCnt + mustUnBindCnt))
+        if mustItemLackCount > 0:
+            needGold = ItemCommon.GetAutoBuyItemNeedGold({needMustID:mustItemLackCount})
+            if needGold <= 0:
+                GameWorld.ErrLog("自动购买必增道具所需仙玉异常!needMustID=%s,mustItemLackCount=%s,needGold=%s" 
+                                 % (needMustID, mustItemLackCount, needGold), playerID)
+                return
+            delMustIDCount = needMustIDCount - mustItemLackCount
+            
     if needGold and not PlayerControl.HaveMoney(curPlayer, IPY_GameWorld.TYPE_Price_Gold_Money, needGold):
         GameWorld.DebugLog("仙玉不足,无法洗练!checkUseGoldCnt=%s,needGold=%s" % (checkUseGoldCnt, needGold), playerID)
         return
@@ -204,6 +224,9 @@
         
     # 扣除消耗
     ItemCommon.DelCostItemByBind(curPlayer, costItemIndexList, bindCnt, unBindCnt, costItemCount, "EquipWash")
+    if delMustIDCount:
+        ItemCommon.DelCostItemByBind(curPlayer, mustItemIndexList, mustBindCnt, mustUnBindCnt, delMustIDCount, "EquipWash")
+        
     if needGold:
         infoDict = {"EquipPlace":equipPlace, "WashType":washType, "WashLV":washLV, "CheckUseGoldCnt":checkUseGoldCnt}
         PlayerControl.PayMoney(curPlayer, IPY_GameWorld.TYPE_Price_Gold_Money, needGold, ChConfig.Def_Cost_EquipWash, infoDict)
@@ -253,6 +276,8 @@
         if attrNum in useGoldAttrNumList:
             isRefreshAttr = True
             PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_EquipWashValue % (equipPlace, attrNum), tempValue)
+            dataDict = {'equipPlace':equipPlace,'attrNum':attrNum,'oldValue':washValue,'newValue':tempValue}
+            DataRecordPack.Cache_FightPowerChangeInfo(curPlayer, ChConfig.PowerDownType_EquipWash, dataDict)
             GameWorld.DebugLog("    勾选洗练,直接更新数值: %s" % tempValue, playerID)
         else:
             PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_EquipWashValueTemp % (equipPlace, attrNum), tempValue)
@@ -265,7 +290,7 @@
     
     if isRefreshAttr:
         RefreshEquipWashAttr(curPlayer)
-        
+    PlayerActLogin.AddLoginAwardActionCnt(curPlayer, ChConfig.Def_LoginAct_EquipWash, 1)
     return
 
 
@@ -318,7 +343,10 @@
         
         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_EquipWashValueTemp % (equipPlace, attrNum), 0)
         if isSave == 1:
+            oldValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipWashValue % (equipPlace, attrNum))
             PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_EquipWashValue % (equipPlace, attrNum), tempValue)
+            dataDict = {'equipPlace':equipPlace,'attrNum':attrNum,'oldValue':oldValue,'newValue':tempValue}
+            DataRecordPack.Cache_FightPowerChangeInfo(curPlayer, ChConfig.PowerDownType_EquipWash, dataDict)
             GameWorld.DebugLog("保存洗练数据: equipPlace=%s,attrNum=%s,tempValue=%s" % (equipPlace, attrNum, tempValue), playerID)
             
     if isSave == 1:

--
Gitblit v1.8.0