From e45410c415266e12c20439fd2c32429a8c8b7e5d Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期四, 23 八月 2018 15:56:47 +0800
Subject: [PATCH] Fix: 修复CTG命令无法充值指定金额的bug;

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerDogz.py |   65 +++++++++++++++++++++++---------
 1 files changed, 46 insertions(+), 19 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerDogz.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerDogz.py
index 8e6639b..3f9c581 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerDogz.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerDogz.py
@@ -328,24 +328,26 @@
                            % (equipIndex, curEquip.GetItemTypeID()), playerID)
         return
     
+    equipColor = curEquip.GetItemColor()
+    colorPlusMaxLVDict = IpyGameDataPY.GetFuncEvalCfg("DogzAssist", 4) # {颜色:等级上限, ...}
+    if equipColor not in colorPlusMaxLVDict:
+        return
+    maxPlusLV = colorPlusMaxLVDict[equipColor]
+    
     equipPlace = curEquip.GetEquipPlace()
     curPlusLV = curEquip.GetUserAttrByIndex(ShareDefine.Def_IudetDogzEquipPlus, 0)
     curPlusExpTotal = curEquip.GetUserAttrByIndex(ShareDefine.Def_IudetDogzEquipPlus, 1)
+    if curPlusLV >= maxPlusLV:
+        GameWorld.Log("神兽装备已满级, 无法强化!equipColor=%s,curPlusLV=%s,maxPlusLV=%s" % (equipColor, curPlusLV, maxPlusLV), playerID)
+        return
     
     ipyData = IpyGameDataPY.GetIpyGameData("DogzEquipPlus", equipPlace, curPlusLV)
     if not ipyData:
         return
-    curLVUPTotalExp = ipyData.GetPlusLVUPTotalExp()
-    if not curLVUPTotalExp:
+    lvUPTotalExp = ipyData.GetPlusLVUPTotalExp()
+    if not lvUPTotalExp:
         GameWorld.Log("神兽装备升级所需总经验为0, 无法强化!equipPlace=%s,curPlusLV=%s" % (equipPlace, curPlusLV), playerID)
         return
-    
-    nextLVIpyData = None
-    if curPlusExpTotal >= curLVUPTotalExp:
-        nextLVIpyData = IpyGameDataPY.GetIpyGameDataNotLog("DogzEquipPlus", equipPlace, curPlusLV + 1)
-        if not nextLVIpyData:
-            GameWorld.Log("神兽装备已满级, 无法强化!equipPlace=%s,curPlusLV=%s" % (equipPlace, curPlusLV), playerID)
-            return
         
     costGoldTotal = 0
     addExpTotal = 0
@@ -400,16 +402,19 @@
         ItemCommon.DelItem(curPlayer, delItem, curItem.GetCount(), False, ChConfig.ItemDel_DogzEquipPlus, infoDict)
         
     updPlusLV = curPlusLV
-    if updPlusExpTotal >= curLVUPTotalExp:
-        doCount = 0
-        while nextLVIpyData and updPlusExpTotal >= nextLVIpyData.GetPlusLVUPTotalExp() and doCount < 100:
-            doCount += 1
-            nextLV = updPlusLV + 1
-            nextLVIpyData = IpyGameDataPY.GetIpyGameDataNotLog("DogzEquipPlus", equipPlace, nextLV)
-            if not nextLVIpyData:
-                break
-            updPlusLV = nextLV
-            
+    doCount, maxDoCount = 0, maxPlusLV * 2
+    while updPlusExpTotal >= lvUPTotalExp and updPlusLV < maxPlusLV and doCount < maxDoCount:
+        doCount += 1
+        nextLV = updPlusLV + 1
+        nextLVIpyData = IpyGameDataPY.GetIpyGameDataNotLog("DogzEquipPlus", equipPlace, nextLV)
+        if not nextLVIpyData:
+            GameWorld.DebugLog("    没有下一级数据,不能升级!nextLV=%s" % (nextLV), playerID)
+            break
+        updPlusLV = nextLV
+        lvUPTotalExp = nextLVIpyData.GetPlusLVUPTotalExp()
+        GameWorld.DebugLog("    升级: equipPlace=%s,maxPlusLV=%s,updPlusLV=%s,updPlusExpTotal=%s,lvUPTotalExp=%s" 
+                           % (equipPlace, maxPlusLV, updPlusLV, updPlusExpTotal, lvUPTotalExp), playerID)
+        
     isRefreshAtrr = False
     # 未强化过
     if not curPlusExpTotal:
@@ -430,6 +435,28 @@
         
     return
 
+def GetDogzEquipPlusLVExpInfo(equipColor, equipPlace, totalExp):
+    ## 获取当前神兽装备最高强化等级的强化熟练度
+    retLV, retExp = 0, 0
+    colorPlusMaxLVDict = IpyGameDataPY.GetFuncEvalCfg("DogzAssist", 4) # {颜色:等级上限, ...}
+    if equipColor not in colorPlusMaxLVDict:
+        return retLV, retExp
+    maxPlusLV = colorPlusMaxLVDict[equipColor]
+    for lv in xrange(maxPlusLV + 1):
+        ipyData = IpyGameDataPY.GetIpyGameDataNotLog("DogzEquipPlus", equipPlace, lv)
+        if lv and not ipyData:
+            break
+        
+        lvUPTotalExp = ipyData.GetPlusLVUPTotalExp()
+        if not lvUPTotalExp:
+            break
+        
+        if totalExp < lvUPTotalExp:
+            return lv, totalExp
+        retLV, retExp = lv, lvUPTotalExp
+        
+    return retLV, retExp
+
 def RefreshDogzAttr(curPlayer):
     ## 刷新神兽属性
     

--
Gitblit v1.8.0