From ac0cdeb67cbd2829aeea991a89ec4442bba3f865 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期四, 09 五月 2019 20:25:43 +0800
Subject: [PATCH] 6711 【后端】【2.0】洗练从0级开始洗练 6717【后端】【2.0】洗练数值非0 6628【2.0】【后端】查看玩家装备和查看玩家战力功能

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_EquipWash.py |   33 ++++++++++++++++++++++++++++-----
 1 files changed, 28 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 cdb674a..9201b05 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
@@ -36,9 +36,9 @@
 Def_EquipWashMaxAttrCount = 3 # 装备洗练最大洗练属性条数
 g_allIndexList = [] #可洗炼的部位缓存
 
-def OnEquipWashLogin(curPlayer):
-    Sycn_EquipWashInfo(curPlayer, isLogin=True)
-    return
+#def OnEquipWashLogin(curPlayer):
+#    Sycn_EquipWashInfo(curPlayer, isLogin=True)
+#    return
 
 def GetEquipWashMaxLV(curPlayer, equipPackindex, equipPlace):
     # @return: 0-未开放; >=1-该装备位最大可洗练等级
@@ -178,6 +178,14 @@
                 return
         GameWorld.DebugLog("随机范围属性%s, washValue=%s, %s~%s" % (attrNum, washValue, randValueMin, randValueMax))
         randValue = random.randint(randValueMin, randValueMax)
+        for _ in xrange(50):
+            if randValue != 0:
+                break
+            randValue = random.randint(randValueMin, randValueMax)
+            #GameWorld.DebugLog("随机值0,重新随机!")
+        if randValue == 0:
+            randValue = 1
+            #GameWorld.DebugLog("随机值还是0,强制设置为1!")
         randAttrDict[attrNum] = randValue
         if randValue <= 0:
             negativeValueCnt += 1
@@ -359,13 +367,28 @@
         if tempValue < getattr(washData, "GetAttrMax%s" % attrNum)():
             return
     washLV += 1
-    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_EquipWashLV % (equipPackindex), washLV)
-    GameWorld.DebugLog("装备洗练等级升级: equipPackindex=%s,washLV=%s" % (equipPackindex, washLV), curPlayer.GetPlayerID())
+    SetEquipWashLV(curPlayer, equipPackindex, washLV)
     
     # 洗练广播
     PlayerControl.WorldNotify(0, "WashCongratulation", [curPlayer.GetPlayerName(), curPlayer.GetPlayerID(), classLV, equipPlace, washLV])
     return True
 
+def SetEquipWashLV(curPlayer, index, setWashLV):
+    befWashLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipWashLV % index)
+    if befWashLV == setWashLV:
+        return
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_EquipWashLV % (index), setWashLV)
+    
+    # 同步更新洗练总等级
+    befTotalWashLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TotalEquipWashLV)
+    updTotalWashLV = max(0, befTotalWashLV + setWashLV - befWashLV)
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TotalEquipWashLV, updTotalWashLV)
+    GameWorld.DebugLog("设置洗练等级: index=%s,befWashLV=%s,setWashLV=%s,befTotalWashLV=%s,updTotalWashLV=%s" 
+                       % (index, befWashLV, setWashLV, befTotalWashLV, updTotalWashLV))
+    return
+
+## 全身洗练总等级
+def GetTotalEquipWashLV(curPlayer): return curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TotalEquipWashLV)
 
 def Sycn_EquipWashInfo(curPlayer, equipPackindex=-1, isLogin=False):
     hasValue = False

--
Gitblit v1.8.0