From a37eb96d6acab1cee41fbaba5010285099ee0ae7 Mon Sep 17 00:00:00 2001
From: xdh <xiefantasy@qq.com>
Date: 星期二, 02 七月 2019 16:52:23 +0800
Subject: [PATCH] 7724 【后端】【主干】分解获得仙丹材料的体验优化

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerRune.py |   79 +++++++++++++++++++++++----------------
 1 files changed, 47 insertions(+), 32 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerRune.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerRune.py
index c6acf5e..ce3dc08 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerRune.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerRune.py
@@ -28,6 +28,9 @@
 import PlayerSuccess
 import PlayerMagicWeapon
 import IPY_GameWorld
+import OpenServerCampaign
+import DataRecordPack
+import PlayerWeekParty
 
 g_runeLVExpDict = {}
 
@@ -96,6 +99,9 @@
         qualityPerDict = IpyGameDataPY.GetFuncEvalCfg(keyStr, 2, {})
         if itemColor in qualityPerDict:
             value *= float(qualityPerDict[itemColor])
+        extraValueDict = IpyGameDataPY.GetFuncEvalCfg(keyStr, 4, {})
+        value += extraValueDict.get(itemColor, 0)
+        
         if isSpecial:
             specialPer = IpyGameDataPY.GetFuncCfg(keyStr, 3)
             if specialPer:
@@ -164,18 +170,10 @@
 
 ## 获取符印是否已解锁
 def GetIsOpenByRuneID(curPlayer, itemid):
-    itemData = GameWorld.GetGameData().GetItemByTypeID(itemid)
-    if not itemData:
-        return
-    curPassLV = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_TrialTower_PassLV)
-    curEff = itemData.GetEffectByIndex(0)
-    curRuneType = curEff.GetEffectID()
-    floorCnt = IpyGameDataPY.GetFuncCfg('TowerRuneType', 2)
-    towerRuneTypeDict = IpyGameDataPY.GetFuncEvalCfg('TowerRuneType')
-    for floor, typeList in towerRuneTypeDict.items():
-        if curRuneType in typeList:
-            floorkey = (int(floor) - 1)*100+ floorCnt if int(floor) > 1 else 0
-            return curPassLV >= floorkey
+    ipyData = GetRuneIpyData(itemid)
+    if ipyData:
+        curPassLV = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_TrialTower_PassLV)
+        return curPassLV >= ipyData.GetTowerID()
     # 没配置限制层数解锁的默认解锁
     return True
 
@@ -211,7 +209,9 @@
         if not srcIpyData:
             GameWorld.DebugLog("该符印没有配置属性! 无法镶嵌! itemID=%s" % srcRuneItemID, curPlayer.GetPlayerID())
             return True
-        srcRuneAttrType = srcIpyData.GetAttrType()
+        srcRuneAttrTypeList = srcIpyData.GetAttrType()
+        srcRuneAttrTypeCntDict = {attrType:1 for attrType in srcRuneAttrTypeList}
+        maxSameAttrRuneCnt = IpyGameDataPY.GetFuncCfg('RuneUnlock', 5)
         # 判断是否已有镶嵌该属性类型
         doubleCnt = 0 #双属性符印个数
         for RuneNum in xrange(1, maxRuneHole + 1):
@@ -225,13 +225,19 @@
             if not ipyData:
                 continue
             attrTypeList = ipyData.GetAttrType()
-            if srcRuneAttrType == attrTypeList:
-                GameWorld.DebugLog("已有镶嵌该属性类型! 无法镶嵌! RuneHoleNum=%s,srcRuneAttrType=%s" % (RuneNum, srcRuneAttrType), curPlayer.GetPlayerID())
-                return True
+            for attrType in attrTypeList:
+                if attrType in srcRuneAttrTypeCntDict:
+                    srcRuneAttrTypeCntDict[attrType] += 1
+                    if srcRuneAttrTypeCntDict[attrType] > maxSameAttrRuneCnt:
+                        GameWorld.DebugLog(
+                            "该属性类型已镶嵌数量超过%s! 无法镶嵌! ,attrType=%s" % (maxSameAttrRuneCnt, attrType),
+                            curPlayer.GetPlayerID())
+                        return
+
             if len(attrTypeList) > 1:
                 doubleCnt +=1
         
-        if len(srcRuneAttrType) > 1 and doubleCnt >= __GetCanInlayDoubleAttrRuneCnt(curPlayer):
+        if len(srcRuneAttrTypeList) > 1 and doubleCnt >= __GetCanInlayDoubleAttrRuneCnt(curPlayer):
             GameWorld.DebugLog("当前可镶嵌双属性符印个数已达上限%s! 无法镶嵌! itemID=%s" % (doubleCnt, srcRuneItemID), curPlayer.GetPlayerID())
             return True
         
@@ -254,11 +260,12 @@
         if emptyIndex == -1:
             GameWorld.DebugLog("符印背包已满,无法摘下! ", curPlayer.GetPlayerID())
             return True
-        
+        desRuneData = 0
         # 摘下设置孔数据为0
         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_Rune_Data % srcRuneNum, 0)
         ItemControler.SetVPackItemKeyData(curPlayer, ShareDefine.rptRune, emptyIndex, srcRuneData)
-    
+    dataDict = {'desBackPack':desBackPack, 'srcRuneData':srcRuneData, 'desRuneData':desRuneData}
+    DataRecordPack.Cache_FightPowerChangeInfo(curPlayer, ChConfig.PowerDownType_Rune, dataDict)
     RefreshRuneAttr(curPlayer)
     PlayerControl.PlayerControl(curPlayer).RefreshPlayerAttrState()
     Sync_RuneInfo(curPlayer)
@@ -304,6 +311,7 @@
     RuneItemID = ItemControler.GetRuneItemID(RuneData)
     RuneItemPlusLV = ItemControler.GetRuneItemPlusLV(RuneData)
     RuneIsLock = ItemControler.GetRuneItemIsLock(RuneData)
+    RuneSource = ItemControler.GetRuneItemSource(RuneData)
     itemData = GameWorld.GetGameData().GetItemByTypeID(RuneItemID)
     if not itemData:
         return
@@ -321,7 +329,7 @@
         return
 
     
-    updRuneData = ItemControler.GetRuneItemKeyData(RuneItemID, RuneItemPlusLV + 1, RuneIsLock)
+    updRuneData = ItemControler.GetRuneItemKeyData(RuneItemID, RuneItemPlusLV + 1, RuneIsLock, RuneSource)
     if not PlayerControl.PayMoney(curPlayer, ShareDefine.TYPE_Price_Rune, plusCost):
         curRuneMoney = PlayerControl.GetMoney(curPlayer, ShareDefine.TYPE_Price_Rune)
         GameWorld.DebugLog("符印精华点不足,无法升级!placeType=%s,placeIndex=%s,itemID=%s,plusLV=%s,plusCost=%s,curRuneMoney=%s" 
@@ -364,7 +372,10 @@
         runeItemPlusLV = ItemControler.GetRuneItemPlusLV(runeData) + 1 #客户端1开始
         totalLV += runeItemPlusLV
         PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_InlayRune, 1, [itemColor])
+        PlayerWeekParty.AddWeekPartyActionCnt(curPlayer, ChConfig.Def_WPAct_Rune, itemColor, False)
     PlayerSuccess.UptateSuccessProgress(curPlayer, ShareDefine.SuccType_RuneLvUp, totalLV)
+    # 开服活动数据
+    #OpenServerCampaign.UpdOpenServerCampaignRecordData(curPlayer, ShareDefine.Def_Campaign_Type_RuneLV, totalLV)
     return
 
 #// A5 66 符印分解 #tagCMRuneDecompose
@@ -389,8 +400,7 @@
     totalMJ = 0
     packIndex = ShareDefine.rptRune
     placeList = xrange(ItemCommon.GetVPackCnt(packIndex)) if (isAll or clientData.QualityCnt > 0) else clientData.PlaceIndexList
-    wmpIpyData = PlayerMagicWeapon.GetMagicWeaponPrivilege(curPlayer, ChConfig.MWPrivilege_RuneDecompose)
-    addPer = int(wmpIpyData.GetEffectValue()) if wmpIpyData else 0
+    addPer = 0
     for place in placeList:
         RuneData = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_VPackItem % (packIndex, place))
         if not RuneData:
@@ -422,7 +432,7 @@
                     decompose += decompose * addPer / ShareDefine.Def_MaxRateValue
                     
             ipyData = IpyGameDataPY.GetIpyGameDataNotLog('RuneCompound', RuneItemID)
-            if ipyData and ItemControler.GetRuneItemSource(RuneData) in [0,2]:
+            if ipyData and ItemControler.GetRuneItemSource(RuneData) in [ChConfig.Rune_Source_Unkown,ChConfig.Item_Source_Compound]:
                 totalMJ += ipyData.GetNeedMJ()
             
 
@@ -524,19 +534,19 @@
         GameWorld.DebugLog('    符印合成 材料不对 tagItemID=%s, materialsIDList=%s, needItemIDList=%s'%(tagItemID,materialsIDList,needItemIDList))
         return
     
-    needMJ = ipyData.GetNeedMJ()
-    infoDict = {"TagItemID":tagItemID}
-    if not PlayerControl.PayMoney(curPlayer, ShareDefine.TYPE_Price_Ysog, needMJ, ChConfig.Def_Cost_ItemProduce, infoDict):
-        return
-    
     if 0 not in packList:
         #如果没有背包的材料要判断格子数
         emptySpace = ItemCommon.GetItemPackSpace(curPlayer, ShareDefine.rptRune, 1)
         if emptySpace < 1:
+            PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_676165", [ShareDefine.rptRune])
             GameWorld.DebugLog('    符印合成 背包格子数量不足1个')
             return 
-    
-    
+        
+    needMJ = ipyData.GetNeedMJ()
+    infoDict = {"TagItemID":tagItemID}
+    if not PlayerControl.PayMoney(curPlayer, ShareDefine.TYPE_Price_Ysog, needMJ, ChConfig.Def_Cost_ItemProduce, infoDict):
+        return
+     
     totalPoint = 0
     for itemID in materialsIDList:
         decompose = 0
@@ -560,7 +570,11 @@
         ItemCommon.DelVPackItem(curPlayer, ShareDefine.rptRune, indexList1, ChConfig.ItemDel_Rune)
     if indexList2:
         for index in indexList2:
+            srcRuneData = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_Rune_Data % index, 0)
             PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_Rune_Data % index, 0)
+            dataDict = {'doType':'RuneCompound', 'srcRuneData':srcRuneData, 'desRuneData':0}
+            DataRecordPack.Cache_FightPowerChangeInfo(curPlayer, ChConfig.PowerDownType_Rune, dataDict)
+            
         Sync_RuneInfo(curPlayer)
         RefreshRuneAttr(curPlayer)
         PlayerControl.PlayerControl(curPlayer).RefreshPlayerAttrState()
@@ -568,9 +582,10 @@
     #给新物品
     curItem = ItemControler.GetOutPutItemObj(tagItemID)
     curItem.SetUserAttr(ShareDefine.Def_IudetRuneLV, tagItemLV)
-    curItem.SetUserAttr(ShareDefine.Def_IudetRuneSource, 2)
+    curItem.SetUserAttr(ShareDefine.Def_IudetRuneSource, ChConfig.Item_Source_Compound)
     PlayerItemControler = ItemControler.PlayerItemControler(curPlayer)
-    PlayerItemControler.PutInItem(ShareDefine.rptRune, curItem, event=[ChConfig.ItemGive_RuneCompound, False, {}])
+    PlayerItemControler.PutInItem(ShareDefine.rptRune, curItem, event=[ChConfig.ItemGive_RuneCompound, False, {'indexList1':indexList1,'indexList2':indexList2}])
+    curPlayer.Sync_MakeItemAnswer(ShareDefine.Def_mitRuneCompound, 1)
     return
 
 

--
Gitblit v1.8.0