From 6fcf3513ccde191e067c8dfd8279cccedf95eb77 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期五, 17 五月 2019 19:22:25 +0800
Subject: [PATCH] 6603 【后端】【2.0】增加新版的sp和被动技能 - 新版

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/Operate_EquipStone.py |   53 +++++++++++++++++++++++++++++++----------------------
 1 files changed, 31 insertions(+), 22 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 521fbce..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
@@ -30,14 +30,15 @@
 import PlayerSuccess
 import PlayerWeekParty
 import ShareDefine
+import EventShell
 #import EquipZhuXian
 
 g_stoneCanPlaceList = [] #可镶嵌的位置
 
-def OnLogin(curPlayer):
-    ###登录发包同步客户端宝石信息
-    Sycn_StoneHoleInfo(curPlayer)
-    return
+#def OnLogin(curPlayer):
+#    ###登录发包同步客户端宝石信息
+#    Sycn_StoneHoleInfo(curPlayer)
+#    return
 
 def GetAllStoneEquipIndexList():
     ###得到所有可镶嵌宝石装备位列表
@@ -95,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):
@@ -191,6 +214,8 @@
     Sycn_StoneHoleInfo(curPlayer, [equipPackIndex])
     #成就
     DoStoneSuccess(curPlayer)
+    
+    EventShell.EventRespons_InlayStone(curPlayer)
     return
 
 def DoStoneSuccess(curPlayer):
@@ -284,23 +309,7 @@
 
 def GetTotalStoneLV(curPlayer):
     ##宝石总等级
-    totalStoneLV = 0
-    holeIndexList = GetAllEquipPlaceHoleIndex()
-    gameData = GameWorld.GetGameData()
-    playerEquip = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptEquip)
-    for equipIndex in xrange(playerEquip.GetCount()):
-        if equipIndex not in ShareDefine.RoleEquipType :
-            continue
-        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