From 88650853f1898815f4612280dd2ffc85af9ddd80 Mon Sep 17 00:00:00 2001
From: xdh <xiefantasy@qq.com>
Date: 星期四, 25 四月 2019 16:57:33 +0800
Subject: [PATCH] 6607 【2.0】【后端】技能升级功能改版

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerAttrFruit.py           |   23 +
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/SkillShell.py                 |  162 +++++++++++++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py                      |   52 +++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py                  |  108 ++++++++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py                    |   20 ++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py                  |    5 
 PySysDB/PySysDBPY.h                                                                                     |    8 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyGameData.py                       |    3 
 ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py                                           |   52 +++++
 ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py                                       |  108 ++++++++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/UseItem/Item_ResetAttrPoint.py |    4 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py                         |    2 
 12 files changed, 534 insertions(+), 13 deletions(-)

diff --git a/PySysDB/PySysDBPY.h b/PySysDB/PySysDBPY.h
index 45204f8..b4a6982 100644
--- a/PySysDB/PySysDBPY.h
+++ b/PySysDB/PySysDBPY.h
@@ -1884,4 +1884,12 @@
 	WORD		_MoneyCnt;	//仙玉数量
 	DWORD		BuffID;	//BuffID
 	WORD		BuffCD;	//间隔时间s
+};
+
+//技能升级表
+
+struct tagSkillElement
+{
+	DWORD		_ElementSkillID;	//专精技能ID
+	DWORD		MainSkillID;	//主技能ID
 };
\ No newline at end of file
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py
index e8f8f90..1d77aca 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py
@@ -10992,6 +10992,58 @@
 
 
 #------------------------------------------------------
+# A5 16 选择技能五行专精 #tagCMSelectSkillElement
+
+class  tagCMSelectSkillElement(Structure):
+    _pack_ = 1
+    _fields_ = [
+                  ("Cmd", c_ubyte),
+                  ("SubCmd", c_ubyte),
+                  ("SkillTypeID", c_int),    # 专精技能ID
+                  ]
+
+    def __init__(self):
+        self.Clear()
+        self.Cmd = 0xA5
+        self.SubCmd = 0x16
+        return
+
+    def ReadData(self, stringData, _pos=0, _len=0):
+        self.Clear()
+        memmove(addressof(self), stringData[_pos:], self.GetLength())
+        return _pos + self.GetLength()
+
+    def Clear(self):
+        self.Cmd = 0xA5
+        self.SubCmd = 0x16
+        self.SkillTypeID = 0
+        return
+
+    def GetLength(self):
+        return sizeof(tagCMSelectSkillElement)
+
+    def GetBuffer(self):
+        return string_at(addressof(self), self.GetLength())
+
+    def OutputString(self):
+        DumpString = '''// A5 16 选择技能五行专精 //tagCMSelectSkillElement:
+                                Cmd:%s,
+                                SubCmd:%s,
+                                SkillTypeID:%d
+                                '''\
+                                %(
+                                self.Cmd,
+                                self.SubCmd,
+                                self.SkillTypeID
+                                )
+        return DumpString
+
+
+m_NAtagCMSelectSkillElement=tagCMSelectSkillElement()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMSelectSkillElement.Cmd,m_NAtagCMSelectSkillElement.SubCmd))] = m_NAtagCMSelectSkillElement
+
+
+#------------------------------------------------------
 # A5 17 绑玉转盘开始 #tagCMStartBindJadeWheel
 
 class  tagCMStartBindJadeWheel(Structure):
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
index 74be579..af4daca 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
@@ -16772,6 +16772,114 @@
 
 
 #------------------------------------------------------
+# A3 09 技能五行专精信息 #tagMCSkillElementInfo
+
+class  tagMCSkillElementData(Structure):
+    _pack_ = 1
+    _fields_ = [
+                  ("MainSkillID", c_int),    # 主技能ID
+                  ("ElementSkillID", c_int),    # 专精技能ID
+                  ]
+
+    def __init__(self):
+        self.Clear()
+        return
+
+    def ReadData(self, stringData, _pos=0, _len=0):
+        self.Clear()
+        memmove(addressof(self), stringData[_pos:], self.GetLength())
+        return _pos + self.GetLength()
+
+    def Clear(self):
+        self.MainSkillID = 0
+        self.ElementSkillID = 0
+        return
+
+    def GetLength(self):
+        return sizeof(tagMCSkillElementData)
+
+    def GetBuffer(self):
+        return string_at(addressof(self), self.GetLength())
+
+    def OutputString(self):
+        DumpString = '''// A3 09 技能五行专精信息 //tagMCSkillElementInfo:
+                                MainSkillID:%d,
+                                ElementSkillID:%d
+                                '''\
+                                %(
+                                self.MainSkillID,
+                                self.ElementSkillID
+                                )
+        return DumpString
+
+
+class  tagMCSkillElementInfo(Structure):
+    Head = tagHead()
+    Cnt = 0    #(BYTE Cnt)// 数量
+    InfoList = list()    #(vector<tagMCSkillElementData> InfoList)
+    data = None
+
+    def __init__(self):
+        self.Clear()
+        self.Head.Cmd = 0xA3
+        self.Head.SubCmd = 0x09
+        return
+
+    def ReadData(self, _lpData, _pos=0, _Len=0):
+        self.Clear()
+        _pos = self.Head.ReadData(_lpData, _pos)
+        self.Cnt,_pos = CommFunc.ReadBYTE(_lpData, _pos)
+        for i in range(self.Cnt):
+            temInfoList = tagMCSkillElementData()
+            _pos = temInfoList.ReadData(_lpData, _pos)
+            self.InfoList.append(temInfoList)
+        return _pos
+
+    def Clear(self):
+        self.Head = tagHead()
+        self.Head.Clear()
+        self.Head.Cmd = 0xA3
+        self.Head.SubCmd = 0x09
+        self.Cnt = 0
+        self.InfoList = list()
+        return
+
+    def GetLength(self):
+        length = 0
+        length += self.Head.GetLength()
+        length += 1
+        for i in range(self.Cnt):
+            length += self.InfoList[i].GetLength()
+
+        return length
+
+    def GetBuffer(self):
+        data = ''
+        data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
+        data = CommFunc.WriteBYTE(data, self.Cnt)
+        for i in range(self.Cnt):
+            data = CommFunc.WriteString(data, self.InfoList[i].GetLength(), self.InfoList[i].GetBuffer())
+        return data
+
+    def OutputString(self):
+        DumpString = '''
+                                Head:%s,
+                                Cnt:%d,
+                                InfoList:%s
+                                '''\
+                                %(
+                                self.Head.OutputString(),
+                                self.Cnt,
+                                "..."
+                                )
+        return DumpString
+
+
+m_NAtagMCSkillElementInfo=tagMCSkillElementInfo()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCSkillElementInfo.Head.Cmd,m_NAtagMCSkillElementInfo.Head.SubCmd))] = m_NAtagMCSkillElementInfo
+
+
+#------------------------------------------------------
 # A3 BC 通知装备位孔位宝石ID #tagMCStoneInfo
 
 class  tagMCStoneMsg(Structure):
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
index 811c79f..e4b1bb9 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -3891,6 +3891,8 @@
 Def_PDict_FairyDomainVisitCnt = "FairyDomainVisitCnt" #寻访总次数
 Def_PDict_FairyAdventuresData = "FairyAdventuresData_%s" #奇遇数值 唯一ID*100+档位 参数事件ID
 Def_PDict_FairyDomainEventAppearCnt = "FDEventAppearCnt%s" #事件出现次数 参数事件ID  AAABBB BBB:小时段出现次数 AAA:今日出现次数
+
+Def_PDict_SkillElementID = "SkillElementID%s" #主技能选择的专精技能 参数主技能ID
 #-------------------------------------------------------------------------------
 #可以从07 41封包购买的背包类型,和对应字典{背包类型:[字典key, 默认格子数]}
 
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py
index e8f8f90..1d77aca 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py
@@ -10992,6 +10992,58 @@
 
 
 #------------------------------------------------------
+# A5 16 选择技能五行专精 #tagCMSelectSkillElement
+
+class  tagCMSelectSkillElement(Structure):
+    _pack_ = 1
+    _fields_ = [
+                  ("Cmd", c_ubyte),
+                  ("SubCmd", c_ubyte),
+                  ("SkillTypeID", c_int),    # 专精技能ID
+                  ]
+
+    def __init__(self):
+        self.Clear()
+        self.Cmd = 0xA5
+        self.SubCmd = 0x16
+        return
+
+    def ReadData(self, stringData, _pos=0, _len=0):
+        self.Clear()
+        memmove(addressof(self), stringData[_pos:], self.GetLength())
+        return _pos + self.GetLength()
+
+    def Clear(self):
+        self.Cmd = 0xA5
+        self.SubCmd = 0x16
+        self.SkillTypeID = 0
+        return
+
+    def GetLength(self):
+        return sizeof(tagCMSelectSkillElement)
+
+    def GetBuffer(self):
+        return string_at(addressof(self), self.GetLength())
+
+    def OutputString(self):
+        DumpString = '''// A5 16 选择技能五行专精 //tagCMSelectSkillElement:
+                                Cmd:%s,
+                                SubCmd:%s,
+                                SkillTypeID:%d
+                                '''\
+                                %(
+                                self.Cmd,
+                                self.SubCmd,
+                                self.SkillTypeID
+                                )
+        return DumpString
+
+
+m_NAtagCMSelectSkillElement=tagCMSelectSkillElement()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMSelectSkillElement.Cmd,m_NAtagCMSelectSkillElement.SubCmd))] = m_NAtagCMSelectSkillElement
+
+
+#------------------------------------------------------
 # A5 17 绑玉转盘开始 #tagCMStartBindJadeWheel
 
 class  tagCMStartBindJadeWheel(Structure):
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
index 74be579..af4daca 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
@@ -16772,6 +16772,114 @@
 
 
 #------------------------------------------------------
+# A3 09 技能五行专精信息 #tagMCSkillElementInfo
+
+class  tagMCSkillElementData(Structure):
+    _pack_ = 1
+    _fields_ = [
+                  ("MainSkillID", c_int),    # 主技能ID
+                  ("ElementSkillID", c_int),    # 专精技能ID
+                  ]
+
+    def __init__(self):
+        self.Clear()
+        return
+
+    def ReadData(self, stringData, _pos=0, _len=0):
+        self.Clear()
+        memmove(addressof(self), stringData[_pos:], self.GetLength())
+        return _pos + self.GetLength()
+
+    def Clear(self):
+        self.MainSkillID = 0
+        self.ElementSkillID = 0
+        return
+
+    def GetLength(self):
+        return sizeof(tagMCSkillElementData)
+
+    def GetBuffer(self):
+        return string_at(addressof(self), self.GetLength())
+
+    def OutputString(self):
+        DumpString = '''// A3 09 技能五行专精信息 //tagMCSkillElementInfo:
+                                MainSkillID:%d,
+                                ElementSkillID:%d
+                                '''\
+                                %(
+                                self.MainSkillID,
+                                self.ElementSkillID
+                                )
+        return DumpString
+
+
+class  tagMCSkillElementInfo(Structure):
+    Head = tagHead()
+    Cnt = 0    #(BYTE Cnt)// 数量
+    InfoList = list()    #(vector<tagMCSkillElementData> InfoList)
+    data = None
+
+    def __init__(self):
+        self.Clear()
+        self.Head.Cmd = 0xA3
+        self.Head.SubCmd = 0x09
+        return
+
+    def ReadData(self, _lpData, _pos=0, _Len=0):
+        self.Clear()
+        _pos = self.Head.ReadData(_lpData, _pos)
+        self.Cnt,_pos = CommFunc.ReadBYTE(_lpData, _pos)
+        for i in range(self.Cnt):
+            temInfoList = tagMCSkillElementData()
+            _pos = temInfoList.ReadData(_lpData, _pos)
+            self.InfoList.append(temInfoList)
+        return _pos
+
+    def Clear(self):
+        self.Head = tagHead()
+        self.Head.Clear()
+        self.Head.Cmd = 0xA3
+        self.Head.SubCmd = 0x09
+        self.Cnt = 0
+        self.InfoList = list()
+        return
+
+    def GetLength(self):
+        length = 0
+        length += self.Head.GetLength()
+        length += 1
+        for i in range(self.Cnt):
+            length += self.InfoList[i].GetLength()
+
+        return length
+
+    def GetBuffer(self):
+        data = ''
+        data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
+        data = CommFunc.WriteBYTE(data, self.Cnt)
+        for i in range(self.Cnt):
+            data = CommFunc.WriteString(data, self.InfoList[i].GetLength(), self.InfoList[i].GetBuffer())
+        return data
+
+    def OutputString(self):
+        DumpString = '''
+                                Head:%s,
+                                Cnt:%d,
+                                InfoList:%s
+                                '''\
+                                %(
+                                self.Head.OutputString(),
+                                self.Cnt,
+                                "..."
+                                )
+        return DumpString
+
+
+m_NAtagMCSkillElementInfo=tagMCSkillElementInfo()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCSkillElementInfo.Head.Cmd,m_NAtagMCSkillElementInfo.Head.SubCmd))] = m_NAtagMCSkillElementInfo
+
+
+#------------------------------------------------------
 # A3 BC 通知装备位孔位宝石ID #tagMCStoneInfo
 
 class  tagMCStoneMsg(Structure):
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py
index 24c3df0..0c31f0b 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py
@@ -1455,6 +1455,11 @@
                         ("DWORD", "BuffID", 0),
                         ("WORD", "BuffCD", 0),
                         ),
+
+                "SkillElement":(
+                        ("DWORD", "ElementSkillID", 1),
+                        ("DWORD", "MainSkillID", 0),
+                        ),
                 }
 
 
@@ -4453,6 +4458,17 @@
     def GetMoneyCnt(self): return self.MoneyCnt # 仙玉数量
     def GetBuffID(self): return self.BuffID # BuffID
     def GetBuffCD(self): return self.BuffCD # 间隔时间s
+
+# 技能升级表
+class IPY_SkillElement():
+    
+    def __init__(self):
+        self.ElementSkillID = 0
+        self.MainSkillID = 0
+        return
+        
+    def GetElementSkillID(self): return self.ElementSkillID # 专精技能ID
+    def GetMainSkillID(self): return self.MainSkillID # 主技能ID
 
 
 def Log(msg, playerID=0, par=0):
@@ -4774,6 +4790,8 @@
         self.ipyFairyDomainAppointLen = len(self.ipyFairyDomainAppointCache)
         self.ipyFBBuyBuffCache = self.__LoadFileData("FBBuyBuff", IPY_FBBuyBuff)
         self.ipyFBBuyBuffLen = len(self.ipyFBBuyBuffCache)
+        self.ipySkillElementCache = self.__LoadFileData("SkillElement", IPY_SkillElement)
+        self.ipySkillElementLen = len(self.ipySkillElementCache)
         Log("IPY_FuncConfig count=%s" % len(self.ipyFuncConfigDict))
         Log("IPY_DataMgr InitOK!")
         return
@@ -5236,6 +5254,8 @@
     def GetFairyDomainAppointByIndex(self, index): return self.ipyFairyDomainAppointCache[index]
     def GetFBBuyBuffCount(self): return self.ipyFBBuyBuffLen
     def GetFBBuyBuffByIndex(self, index): return self.ipyFBBuyBuffCache[index]
+    def GetSkillElementCount(self): return self.ipySkillElementLen
+    def GetSkillElementByIndex(self, index): return self.ipySkillElementCache[index]
 
 IPYData = IPY_DataMgr()
 def IPY_Data(): return IPYData
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/UseItem/Item_ResetAttrPoint.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/UseItem/Item_ResetAttrPoint.py
index baf0bc9..a43f922 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/UseItem/Item_ResetAttrPoint.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/UseItem/Item_ResetAttrPoint.py
@@ -20,6 +20,7 @@
 import IpyGameDataPY
 import ItemCommon
 import ChConfig
+import SkillShell
 
 ##批量使用物品
 # @param curPlayer: 玩家实例
@@ -84,6 +85,9 @@
     #刷新人物所有状态
     playerControl = PlayerControl.PlayerControl(curPlayer)
     playerControl.RefreshPlayerAttrState()
+    
+    #更新技能专精
+    SkillShell.RefreshElementSkillByAttr(curPlayer, resetIDList)
     return True
 
 ## 逻辑实现 //返回值为是否使用成功(外层通知特效)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
index e6e1ff4..138d117 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
@@ -116,6 +116,7 @@
 import PlayerCoat
 import PlayerQuDaoDoubleBill
 import PlayerFB
+import SkillShell
 
 import datetime
 import time
@@ -769,6 +770,8 @@
     #缥缈仙域
     PlayerFairyDomain.OnLogin(curPlayer)
     PlayerFB.OnLogin(curPlayer)
+    #技能专精信息
+    SkillShell.NotifyElementSkillInfo(curPlayer)
     
     curPlayer.SetState(0)   # 脱机挂恢复为正常上线
     curPlayer.SetFacePic(0) # 通知数据库是否保存还是下线,做一次恢复,1为保存 0为正常下线
@@ -1770,6 +1773,8 @@
     NotifyPlayerBasePoint(curPlayer, pointAttrIDList)
     playerControl = PlayerControl.PlayerControl(curPlayer)
     playerControl.RefreshPlayerAttrState()
+    #更新技能专精
+    SkillShell.RefreshElementSkillByAttr(curPlayer, pointAttrIDList)
     return
 
 def NotifyPlayerBasePoint(curPlayer, syncAttrIDList=[]):
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerAttrFruit.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerAttrFruit.py
index 5f9e96a..c70482f 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerAttrFruit.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerAttrFruit.py
@@ -39,6 +39,7 @@
 import PlayerPet
 import PlayerRefineStove
 import PlayerSuccess
+import SkillShell
 
 (
 Def_LimitType_Cnt, # 按个数限制
@@ -195,11 +196,19 @@
     Sync_AttrFruitEatCnt(curPlayer, [itemID])
     
     # 增加属性
-    __AddFruitAttr(curPlayer, itemID, funcIndex, addValue)
+    attrIDList = __AddFruitAttr(curPlayer, itemID, funcIndex, addValue)
     
     # 刷新属性
     __RefreshAttr(curPlayer, funcIndex)
-    
+
+    # 若是加灵根属性则更新技能专精
+    pointAttrIDList = []
+    for attrID in attrIDList:
+        if attrID in [ShareDefine.Def_Effect_Metal, ShareDefine.Def_Effect_Wood, ShareDefine.Def_Effect_Water, 
+                      ShareDefine.Def_Effect_Fire, ShareDefine.Def_Effect_Earth]:
+            pointAttrIDList.append(attrID)
+    if pointAttrIDList:
+        SkillShell.RefreshElementSkillByAttr(curPlayer, pointAttrIDList)
     return True, hasUseCnt
 
 ## 玩家使用属性果实
@@ -289,11 +298,11 @@
 def __AddFruitAttr(curPlayer, fruitItemID, funcIndex, addValue):
     
     if addValue < 1:
-        return
+        return []
     
     itemData = GameWorld.GetGameData().GetItemByTypeID(fruitItemID)
     if not itemData:
-        return
+        return []
     
     
     limitType = Def_LimitType_Cnt #默认按个数
@@ -306,14 +315,14 @@
     fightPowerEx = fightPowerEx + addFightPowerEx * addValue
     curPlayer.SetDict(fightPowerExfigKey, fightPowerEx)
     GameWorld.DebugLog("    Add funcIndex=%s,addFightPowerEx=%s,addValue=%s,fightPowerEx=%s" % (funcIndex, addFightPowerEx, addValue, fightPowerEx))
-    
+    attrIDList = []
     for i in range(itemData.GetEffectCount()):
         curEffect = itemData.GetEffectByIndex(i)
         effectID = curEffect.GetEffectID()
         
         if not effectID or effectID not in ChConfig.ItemEffect_AttrDict:
             continue
-                    
+        attrIDList.append(effectID)
         attrKey = ChConfig.Def_PlayerKey_FruitAttr % (funcIndex, effectID)
         curValue = curPlayer.GetDictByKey(attrKey)
         effValueA = curEffect.GetEffectValue(0)
@@ -326,7 +335,7 @@
         curPlayer.SetDict(attrKey, updValue)
         GameWorld.DebugLog("    Add funcIndex=%s,effID=%s,curValue=%s,effA=%s,effB=%s,count=%s,updV=%s" 
                            % (funcIndex, effectID, curValue, effValueA, effValueB, addValue, updValue))
-    return
+    return attrIDList
 
 ## 加载果实增加的属性缓存,一般是登录或切地图后
 # @param curPlayer
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyGameData.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyGameData.py
index 9aa10d5..18ebf1b 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyGameData.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyGameData.py
@@ -105,4 +105,5 @@
 g_crossFuncLineDataCache = {} # 动态分配的跨服虚拟分线数据缓存 {(mapID, copyMapID):funcLineDataCache, ...}
 g_crossPlayerServerGroupIDInfo = {} #跨服玩家服务器组ID缓存,副本线路关闭时才释放,所以支持离线跨服玩家 {copyMapID:{playerID:serverGroupID, ...}, ...}
 g_fbBuyBuffTimeDict = {} # 副本购买buff时间缓存{playerID:{moneyCnt:time}}
-g_fairyDomainLimit = [] #全服已限制的缥缈仙域事件
\ No newline at end of file
+g_fairyDomainLimit = [] #全服已限制的缥缈仙域事件
+g_elemntSkillDict = {} #{skillID:[attrID*10000+needValue,..]}
\ No newline at end of file
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/SkillShell.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/SkillShell.py
index 890dc9a..3511579 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/SkillShell.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/SkillShell.py
@@ -41,9 +41,11 @@
 import GameMap
 import collections
 import PassiveBuffEffMng
+import EffGetSet
 import SkillShell
 import FBCommon
 import IpyGameDataPY
+import PyGameData
 #import EquipZhuXian
 #---------------------------------------------------------------------
 GameWorld.ImportAll("Script\\Skill\\" , "GameSkills")
@@ -2018,11 +2020,11 @@
     needBaseAttrID, needBaseAttrValue = stateSkillLV /10000, stateSkillLV%10000
     if needBaseAttrID and needBaseAttrValue:
         baseAttrDict = {
-                            ShareDefine.Def_Effect_Metal:PlayerControl.GetMetal(),
-                            ShareDefine.Def_Effect_Wood:PlayerControl.GetWood(),
-                            ShareDefine.Def_Effect_Water:PlayerControl.GetWater(),
-                            ShareDefine.Def_Effect_Fire:PlayerControl.GetFire(),
-                            ShareDefine.Def_Effect_Earth:PlayerControl.GetEarth(),
+                            ShareDefine.Def_Effect_Metal:PlayerControl.GetMetal(curPlayer),
+                            ShareDefine.Def_Effect_Wood:PlayerControl.GetWood(curPlayer),
+                            ShareDefine.Def_Effect_Water:PlayerControl.GetWater(curPlayer),
+                            ShareDefine.Def_Effect_Fire:PlayerControl.GetFire(curPlayer),
+                            ShareDefine.Def_Effect_Earth:PlayerControl.GetEarth(curPlayer),
                          }
         if needBaseAttrID not in baseAttrDict:
             GameWorld.ErrLog('    天赋技能升级属性点条件配置错误,curSkillTypeID=%s,needBaseAttrID=%s'%(curSkillTypeID, needBaseAttrID))
@@ -2034,6 +2036,156 @@
     
     return True
 
+#// A5 16 选择技能五行专精 #tagCMSelectSkillElement
+#
+#struct    tagCMSelectSkillElement
+#{
+#    tagHead        Head;
+#    DWORD    SkillTypeID;    // 专精技能ID
+#};
+def OnSelectSkillElement(index, clientData, tick):
+    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
+    selectSkillID = clientData.SkillTypeID
+    ipyData = IpyGameDataPY.GetIpyGameData('SkillElement', selectSkillID)
+    if not ipyData:
+        return
+    mainSkillID = ipyData.GetMainSkillID()
+    
+    curElementSkillID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SkillElementID % mainSkillID)
+    if selectSkillID == curElementSkillID:
+        GameWorld.DebugLog('已经是该专精技能!')
+        return
+    skillManager = curPlayer.GetSkillManager()
+    mainSkill = skillManager.FindSkillBySkillTypeID(mainSkillID)
+    if not mainSkill:
+        GameWorld.DebugLog('主技能未学习,无法选专精mainSkillID=%s'%mainSkillID)
+        return
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_SkillElementID % mainSkillID, selectSkillID)
+    #原技能删除
+    skillManager.DeleteSkillBySkillTypeID(curElementSkillID)
+    #更新新技能
+    RefreshElementSkill(curPlayer, selectSkillID)
+    # 重刷被动技能
+    PassiveBuffEffMng.GetPassiveEffManager().RegistPassiveEff(curPlayer)    
+    # 重刷技能战力
+    PlayerControl.PlayerControl(curPlayer).RefreshAllSkill()
+    
+    NotifyElementSkillInfo(curPlayer, mainSkillID)
+    return
+
+def RefreshElementSkill(curPlayer, skillTypeID):
+    ##更新专精技能生效的等级
+    __InitElementSkillInfo()
+    if skillTypeID not in PyGameData.g_elemntSkillDict:
+        return
+    baseAttrDict = {
+                            ShareDefine.Def_Effect_Metal:PlayerControl.GetMetal(curPlayer),
+                            ShareDefine.Def_Effect_Wood:PlayerControl.GetWood(curPlayer),
+                            ShareDefine.Def_Effect_Water:PlayerControl.GetWater(curPlayer),
+                            ShareDefine.Def_Effect_Fire:PlayerControl.GetFire(curPlayer),
+                            ShareDefine.Def_Effect_Earth:PlayerControl.GetEarth(curPlayer),
+                         }
+    
+    limitInfoList = PyGameData.g_elemntSkillDict[skillTypeID]
+    maxSkillLV = len(limitInfoList)
+    updSkillLV = 0
+    for i, limitInfo in enumerate(limitInfoList):
+        needAttrID, needAttrValue = limitInfo /10000, limitInfo%10000
+        curAttrValue = baseAttrDict.get(needAttrID, 0)
+        if curAttrValue >= needAttrValue:
+            updSkillLV = maxSkillLV - i
+            break
+    skillManager = curPlayer.GetSkillManager()
+    curSkill = skillManager.FindSkillBySkillTypeID(skillTypeID)
+    curSkillLV = curSkill.GetSkillLV() if curSkill else 0
+        
+    if updSkillLV == curSkillLV:
+        return
+    elif updSkillLV < curSkillLV:
+        skillManager.DeleteSkillBySkillTypeID(skillTypeID)
+        for _ in xrange(updSkillLV):
+            skillManager.LVUpSkillBySkillTypeID(skillTypeID)
+    else:
+        for _ in xrange(updSkillLV-curSkillLV):
+            skillManager.LVUpSkillBySkillTypeID(skillTypeID)
+    return True
+
+def RefreshElementSkillByAttr(curPlayer, attrIDList):
+    #加点、丹药、境界、洗点 会影响灵根点
+    __InitElementSkillInfo()
+    isRefresh = False
+    skillManager = curPlayer.GetSkillManager()
+    for i in xrange(skillManager.GetSkillCount()):
+        hasSkill = skillManager.GetSkillByIndex(i)
+        hasSkillID = hasSkill.GetSkillID()
+        ipyData = IpyGameDataPY.GetIpyGameDataByCondition('SkillElement', {'MainSkillID':hasSkillID}, False, False)
+        if not ipyData:
+            continue
+        curElementSkillID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SkillElementID % hasSkillID)
+        if not curElementSkillID:
+            continue
+        if curElementSkillID not in PyGameData.g_elemntSkillDict:
+            continue
+        if PyGameData.g_elemntSkillDict[curElementSkillID][0] /10000 not in attrIDList:
+            continue
+        if RefreshElementSkill(curPlayer, curElementSkillID):
+            isRefresh = True
+    if isRefresh:
+        # 重刷被动技能
+        PassiveBuffEffMng.GetPassiveEffManager().RegistPassiveEff(curPlayer)    
+        # 重刷技能战力
+        PlayerControl.PlayerControl(curPlayer).RefreshAllSkill()
+    return
+
+def __InitElementSkillInfo():
+    #缓存技能专精信息{skillID:[attrID*10000+needValue,..]}
+    if not PyGameData.g_elemntSkillDict:
+        ipyMgr = IpyGameDataPY.IPY_Data()
+        for i in xrange(ipyMgr.GetSkillElementCount()):
+            ipyData = ipyMgr.GetSkillElementByIndex(i)
+            elementSkillID = ipyData.GetElementSkillID()
+            skill = GameWorld.GetGameData().FindSkillByType(elementSkillID, 1)
+            if not skill:
+                continue
+            skillMaxLV = skill.GetSkillMaxLV() # 最高技能等级
+            for skillLV in xrange(skillMaxLV, 0, -1):
+                curSkill = GameWorld.GetGameData().FindSkillByType(elementSkillID, skillLV)
+                if not curSkill:
+                    continue
+                if elementSkillID not in PyGameData.g_elemntSkillDict:
+                    PyGameData.g_elemntSkillDict[elementSkillID] = []
+                PyGameData.g_elemntSkillDict[elementSkillID].append(curSkill.GetStateSkillLV())
+    return
+
+def NotifyElementSkillInfo(curPlayer, mainSkillID=0):
+    ##通知五行专精信息
+    if not mainSkillID:
+        syncMainSkillList = []
+        skillManager = curPlayer.GetSkillManager()
+        for i in xrange(skillManager.GetSkillCount()):
+            hasSkill = skillManager.GetSkillByIndex(i)
+            hasSkillID = hasSkill.GetSkillID()
+            ipyData = IpyGameDataPY.GetIpyGameDataByCondition('SkillElement', {'MainSkillID':hasSkillID}, False, False)
+            if not ipyData:
+                continue
+            syncMainSkillList.append(hasSkillID)
+            
+    else:
+        syncMainSkillList = [mainSkillID]
+    sendPack = ChPyNetSendPack.tagMCSkillElementInfo()
+    sendPack.InfoList = []
+    for mSkillID in syncMainSkillList:
+        curElementSkillID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SkillElementID % mSkillID)
+        if not curElementSkillID:
+            continue
+        elementData = ChPyNetSendPack.tagMCSkillElementData()
+        elementData.MainSkillID = mSkillID
+        elementData.ElementSkillID = curElementSkillID
+        sendPack.InfoList.append(elementData)
+    sendPack.Cnt = len(sendPack.InfoList)
+    NetPackCommon.SendFakePack(curPlayer, sendPack)
+    return
+    
 #---------------------------------------------------------------------
 ##当前buff是否能够触发BuffProcess_%d 的脚本
 # @param curObj 对象

--
Gitblit v1.8.0