From 1579f778ac32e4a62e830f52611715c5c7c5a307 Mon Sep 17 00:00:00 2001
From: xdh <xiefantasy@qq.com>
Date: 星期四, 04 七月 2019 11:48:21 +0800
Subject: [PATCH] 7803 【2.0.200】【后端】灵根升品显示特效

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/SkillShell.py     |    4 +
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ChEquip.py         |   55 ++++++++++++++++++++++++++-
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py        |   23 +++++++++++
 PySysDB/PySysDBPY.h                                                                         |    9 ++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py |   13 +++++-
 5 files changed, 98 insertions(+), 6 deletions(-)

diff --git a/PySysDB/PySysDBPY.h b/PySysDB/PySysDBPY.h
index bb72964..dd58c54 100644
--- a/PySysDB/PySysDBPY.h
+++ b/PySysDB/PySysDBPY.h
@@ -1893,4 +1893,13 @@
 	WORD		NeedLV;	//要求等级
 	DWORD		FightPower;	//推荐战力
 	BYTE		IsNotify;	//是否广播
+};
+
+//灵根特效表
+
+struct tagLingGenEffect
+{
+	DWORD		ID;	//唯一ID
+	DWORD		_PointID;	//灵根ID
+	BYTE		_QualityLV;	//品级
 };
\ No newline at end of file
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py
index 02b566d..33f12e5 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py
@@ -1466,6 +1466,12 @@
                         ("DWORD", "FightPower", 0),
                         ("BYTE", "IsNotify", 0),
                         ),
+
+                "LingGenEffect":(
+                        ("DWORD", "ID", 0),
+                        ("DWORD", "PointID", 1),
+                        ("BYTE", "QualityLV", 1),
+                        ),
                 }
 
 
@@ -4485,6 +4491,19 @@
     def GetNeedLV(self): return self.NeedLV # 要求等级
     def GetFightPower(self): return self.FightPower # 推荐战力
     def GetIsNotify(self): return self.IsNotify # 是否广播
+
+# 灵根特效表
+class IPY_LingGenEffect():
+    
+    def __init__(self):
+        self.ID = 0
+        self.PointID = 0
+        self.QualityLV = 0
+        return
+        
+    def GetID(self): return self.ID # 唯一ID
+    def GetPointID(self): return self.PointID # 灵根ID
+    def GetQualityLV(self): return self.QualityLV # 品级
 
 
 def Log(msg, playerID=0, par=0):
@@ -4804,6 +4823,8 @@
         self.ipySkillElementLen = len(self.ipySkillElementCache)
         self.ipySkyTowerCache = self.__LoadFileData("SkyTower", IPY_SkyTower)
         self.ipySkyTowerLen = len(self.ipySkyTowerCache)
+        self.ipyLingGenEffectCache = self.__LoadFileData("LingGenEffect", IPY_LingGenEffect)
+        self.ipyLingGenEffectLen = len(self.ipyLingGenEffectCache)
         Log("IPY_FuncConfig count=%s" % len(self.ipyFuncConfigDict))
         Log("IPY_DataMgr InitOK!")
         return
@@ -5264,6 +5285,8 @@
     def GetSkillElementByIndex(self, index): return self.ipySkillElementCache[index]
     def GetSkyTowerCount(self): return self.ipySkyTowerLen
     def GetSkyTowerByIndex(self, index): return self.ipySkyTowerCache[index]
+    def GetLingGenEffectCount(self): return self.ipyLingGenEffectLen
+    def GetLingGenEffectByIndex(self, index): return self.ipyLingGenEffectCache[index]
 
 IPYData = IPY_DataMgr()
 def IPY_Data(): return IPYData
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ChEquip.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ChEquip.py
index 94b076e..d8dd02f 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ChEquip.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Item/ChEquip.py
@@ -1189,7 +1189,7 @@
 #===============================================================================
 # #//03 2F 请求装备显隐#tagRequestEquipShowHide
 # //装备显示开关
-# int GetEquipShowSwitch(); 第几套*10+是否有套装
+# int GetEquipShowSwitch(); 灵根特效表key * 1000+第几套*10+是否有套装
 #===============================================================================
 ##请求装备显隐. (设置显示哪套装备外观)
 # @param index 玩家索引
@@ -1243,7 +1243,7 @@
     return
 
 def ChangeEquipfacadeByClassLV(curPlayer, classLV):
-    ##变更第X套装备外观
+    ##变更第X套装备外观 灵根特效表key * 1000+第几套*10+是否有套装
     oldEquipShowSwitch = curPlayer.GetEquipShowSwitch()
     realSuit=1
     equipPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptEquip)
@@ -1260,11 +1260,60 @@
         if not curEquip.GetSuiteID():
             realSuit = 0
             break
-    updEquipShowSwitch = classLV*10+realSuit
+    updEquipShowSwitch = oldEquipShowSwitch /1000*1000+ classLV*10+realSuit
     if oldEquipShowSwitch == updEquipShowSwitch:
         return
     curPlayer.SetEquipShowSwitch(updEquipShowSwitch)
     return True
+
+def ChangeEquipfacadeByLingGen(curPlayer):
+    ## 灵根品级变化影响角色外观显示 灵根特效表key * 1000+第几套*10+是否有套装
+    pointValueInfo = [[ShareDefine.Def_Effect_Metal,PlayerControl.GetMetalQualityLV(curPlayer)],
+                          [ShareDefine.Def_Effect_Wood,PlayerControl.GetWoodQualityLV(curPlayer)],
+                          [ShareDefine.Def_Effect_Water,PlayerControl.GetWaterQualityLV(curPlayer)],
+                          [ShareDefine.Def_Effect_Fire,PlayerControl.GetFireQualityLV(curPlayer)],
+                          [ShareDefine.Def_Effect_Earth,PlayerControl.GetEarthQualityLV(curPlayer)],
+                          ]
+    g_skillElementCntDict = {} #灵根对应使用专精技能数量
+    skillManager = curPlayer.GetSkillManager()
+    gameData = GameWorld.GetGameData()
+    for i in xrange(skillManager.GetSkillCount()):
+        curSkill = skillManager.GetSkillByIndex(i)
+        skillID = curSkill.GetSkillTypeID()
+        curSelectSkillID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SkillElementID % skillID)
+        if not curSelectSkillID:
+            continue
+        elementSkillData = gameData.GetSkillBySkillID(curSelectSkillID)
+        if not elementSkillData:
+            continue
+        skillElementType = SkillShell.GetSkillElementType(elementSkillData)
+        g_skillElementCntDict[skillElementType] = g_skillElementCntDict.get(skillElementType, 0) + 1
+    
+    showPointID, showQualityLV = 0, 0
+    for pointID, qualityLV in pointValueInfo:
+        if qualityLV > showQualityLV:
+            showQualityLV = qualityLV
+            showPointID = pointID
+        elif showQualityLV and qualityLV == showQualityLV:
+            #比谁的专精技能数量多
+            if g_skillElementCntDict.get(pointID, 0) > g_skillElementCntDict.get(showPointID, 0):
+                showQualityLV = qualityLV
+                showPointID = pointID
+    effectID = 0
+    if showPointID:
+        ipyData = IpyGameDataPY.GetIpyGameData('LingGenEffect', showPointID, showQualityLV)
+        if not ipyData:
+            return
+        effectID = ipyData.GetID()
+    oldEquipShowSwitch = curPlayer.GetEquipShowSwitch()
+    updEquipShowSwitch = oldEquipShowSwitch % 1000 + 1000 * effectID
+    GameWorld.DebugLog('灵根品级变化影响角色外观显示g_skillElementCntDict=%s,oldEquipShowSwitch=%s,updEquipShowSwitch=%s'%
+                       (g_skillElementCntDict, oldEquipShowSwitch, updEquipShowSwitch))
+    if oldEquipShowSwitch != updEquipShowSwitch:
+        curPlayer.SetEquipShowSwitch(updEquipShowSwitch)
+    return
+
+
 #获取当前是第几套装备外观
 def GetEquipFacadeClassLV(curPlayer):return curPlayer.GetEquipShowSwitch()/10
 
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py
index 045797c..ed46c5d 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py
@@ -4144,12 +4144,15 @@
                           ShareDefine.Def_Effect_Fire:[lambda curObj:GetFire(curObj), lambda curObj, value:SetFireQualityLV(curObj, value), lambda curObj:GetFireQualityLV(curObj)],
                           ShareDefine.Def_Effect_Earth:[lambda curObj:GetEarth(curObj), lambda curObj, value:SetEarthQualityLV(curObj, value), lambda curObj:GetEarthQualityLV(curObj)],
                           }
+        hasChange_Qualitylv = False #灵根品级是否有变更
         lingGenQualityAttrList = [{} for _ in range(4)]
         for pointAttrID, pointFuncInfo in pointValueInfo.items():
             pointValue = pointFuncInfo[0](curPlayer)
             befPQLV = pointFuncInfo[2](curPlayer)
             pointFuncInfo[1](curPlayer, 0)
             if not pointValue:
+                if 0 != befPQLV:
+                    hasChange_Qualitylv = True
                 continue
             ipyData = IpyGameDataPY.GetIpyGameData("RolePoint", pointAttrID)
             if not ipyData:
@@ -4173,6 +4176,8 @@
                 else:
                     break
             pointFuncInfo[1](curPlayer, curPQLV)
+            if curPQLV != befPQLV:
+                hasChange_Qualitylv = True
             if not curPQLV:
                 continue
             pqAttrInfoDict = ipyData.GetPointQualityAttrDict().get(str(curPlayer.GetJob()), {})
@@ -4189,7 +4194,7 @@
         curPlayer.SetDict(ChConfig.Def_PlayerKey_MFPEx % ShareDefine.Def_MFPType_Role, pointFightPowerEx) 
         SetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_RoleBase, allAttrList)
         SetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_LingGenQuailty, lingGenQualityAttrList)
-        return
+        return hasChange_Qualitylv
     
     #---------------------------------------------------------------------
     def NotifyAllState(self, playerStateDict):
@@ -4452,7 +4457,7 @@
             CalcNoLineEffect.ChangePlayerAttrInNoLineEffectList(curPlayer, baseAttrNolineDict)
             
         # 功能有加基础属性值,这里再重新刷新一下基础属性, 基础属性会影响战斗属性, 每次都刷新角色基础属性
-        self.CalcRoleBaseAttr(curPlayer)
+        hasChange_Qualitylv = self.CalcRoleBaseAttr(curPlayer)
         roleBaseAttrInfo, roleInsidePerAttrDict = GetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_RoleBase)
         lingGenQualityAttrList, lingGenQualityInsidePerAttrDict = GetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_LingGenQuailty)
         funcAttrInfoList[ChConfig.Def_CalcAttrFunc_RoleBase] = roleBaseAttrInfo
@@ -4629,6 +4634,10 @@
                 if beforePointList[i] != afterPointList[i]:
                     diffPointAttrList.append(attrID)
             SkillShell.RefreshElementSkillByAttr(curPlayer, diffPointAttrList)
+        if hasChange_Qualitylv:
+            #灵根品级变化处理
+            ChEquip.ChangeEquipfacadeByLingGen(curPlayer)
+            
         # 更新开服活动灵根数据
         OpenServerCampaign.UpdOpenServerCampaignLingGenData(curPlayer)
         
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 7db2e30..972f097 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/SkillShell.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/SkillShell.py
@@ -41,7 +41,7 @@
 import GameMap
 import collections
 import PassiveBuffEffMng
-import EffGetSet
+import ChEquip
 import SkillShell
 import FBCommon
 import IpyGameDataPY
@@ -2134,6 +2134,7 @@
             return
         
         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_SkillElementID % mainSkillID, selectSkillID)
+        ChEquip.ChangeEquipfacadeByLingGen(curPlayer)
         if curElementSkillID and curElementSkillID != selectSkillID:
             #原技能删除
             skillManager.DeleteSkillBySkillTypeID(curElementSkillID)
@@ -2192,6 +2193,7 @@
             ipyData = IpyGameDataPY.GetIpyGameData('SkillElement', skillTypeID)
             mainSkillID = ipyData.GetMainSkillID()
             PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_SkillElementID % mainSkillID, 0)
+            ChEquip.ChangeEquipfacadeByLingGen(curPlayer)
             isNotify = True
     else:
         for _ in xrange(updSkillLV-curSkillLV):

--
Gitblit v1.8.0