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_EquipStone.py |   48 ++++++++++++++++++++++++++++--------------------
 1 files changed, 28 insertions(+), 20 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_EquipStone.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_EquipStone.py
index 8717ca8..e34e150 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_EquipStone.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_EquipStone.py
@@ -35,10 +35,10 @@
 
 g_stoneCanPlaceList = [] #可镶嵌的位置
 
-def OnLogin(curPlayer):
-    ###登录发包同步客户端宝石信息
-    Sycn_StoneHoleInfo(curPlayer)
-    return
+#def OnLogin(curPlayer):
+#    ###登录发包同步客户端宝石信息
+#    Sycn_StoneHoleInfo(curPlayer)
+#    return
 
 def GetAllStoneEquipIndexList():
     ###得到所有可镶嵌宝石装备位列表
@@ -96,9 +96,31 @@
 
 def SetEquipIndexStoneIDAndIsBand(curPlayer, equipIndex, holeIndex, changeStoneID, isBind):
     ### 保存装备位孔位宝石ID和绑定信息
+    befStoneID, befIsBind = GetEquipIndexStoneIDAndIsBand(curPlayer, equipIndex, holeIndex)
+    if befStoneID == changeStoneID and befIsBind == isBind:
+        return
+    
     isBind = 0 #现绑定无用,默认存0
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_EquipPartStoneID % (equipIndex, holeIndex),
-                                       changeStoneID * ChConfig.Def_Stone_SaveStoneInfoXNumber + isBind) 
+                                       changeStoneID * ChConfig.Def_Stone_SaveStoneInfoXNumber + isBind)
+    
+    # 同步更新宝石总等级
+    gameData = GameWorld.GetGameData()
+    befStoneLV = 0
+    if befStoneID:
+        befGem = gameData.GetItemByTypeID(befStoneID)
+        befStoneLV = 0 if not befGem else befGem.GetEffectByIndex(0).GetEffectValue(1)
+        
+    aftStoneLV = 0
+    if changeStoneID:
+        aftGem = gameData.GetItemByTypeID(changeStoneID)
+        aftStoneLV = 0 if not aftGem else aftGem.GetEffectByIndex(0).GetEffectValue(1)
+        
+    befTotalStoneLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TotalStoneLV)
+    updTotalStoneLV = max(0, befTotalStoneLV + aftStoneLV - befStoneLV)
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TotalStoneLV, updTotalStoneLV)
+    GameWorld.DebugLog("设置宝石等级: equipIndex=%s,holeIndex=%s,befStoneLV=%s,aftStoneLV=%s,befTotalStoneLV=%s,updTotalStoneLV=%s" 
+                       % (equipIndex, holeIndex, befStoneLV, aftStoneLV, befTotalStoneLV, updTotalStoneLV))
     return
 
 def GetPackTypeByEquipPlace(equipPlace):
@@ -287,21 +309,7 @@
 
 def GetTotalStoneLV(curPlayer):
     ##宝石总等级
-    totalStoneLV = 0
-    equipIndexList = GetAllStoneEquipIndexList()
-    holeIndexList = GetAllEquipPlaceHoleIndex()
-    gameData = GameWorld.GetGameData()
-    for equipIndex in equipIndexList:
-        for holeIndex in holeIndexList:
-            curGemID = GetEquipIndexStoneIDAndIsBand(curPlayer, equipIndex, holeIndex)[0]
-            if curGemID == 0:
-                continue
-            curGem = gameData.GetItemByTypeID(curGemID)
-            if not curGem:
-                continue
-            gemLV = curGem.GetEffectByIndex(0).GetEffectValue(1)
-            totalStoneLV += gemLV
-    return totalStoneLV
+    return curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TotalStoneLV)
 
 #// A3 06 宝石升级 #tagCMEquipStoneUpgrade
 #struct    tagCMEquipStoneUpgrade

--
Gitblit v1.8.0