From fd11ce1c13096dce046ed4f740290eaea2749591 Mon Sep 17 00:00:00 2001
From: xdh <xiefantasy@qq.com>
Date: 星期三, 08 五月 2019 13:51:13 +0800
Subject: [PATCH] 6681 【2.0】【后端】五行专精激活方式变更
---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/SkillShell.py | 132 +++++++++++++++++---------
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py | 80 ++++++++++++++-
ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py | 80 ++++++++++++++-
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py | 2
4 files changed, 233 insertions(+), 61 deletions(-)
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
index ef4b9e7..ce0d1ce 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
@@ -16782,11 +16782,11 @@
#------------------------------------------------------
# A3 09 技能五行专精信息 #tagMCSkillElementInfo
-class tagMCSkillElementData(Structure):
+class tagMCSkillElementActiveData(Structure):
_pack_ = 1
_fields_ = [
- ("MainSkillID", c_int), # 主技能ID
- ("ElementSkillID", c_int), # 专精技能ID
+ ("SkillID", c_int), # 技能ID
+ ("ActiveLV", c_ubyte), # 激活等级
]
def __init__(self):
@@ -16799,24 +16799,88 @@
return _pos + self.GetLength()
def Clear(self):
- self.MainSkillID = 0
- self.ElementSkillID = 0
+ self.SkillID = 0
+ self.ActiveLV = 0
return
def GetLength(self):
- return sizeof(tagMCSkillElementData)
+ return sizeof(tagMCSkillElementActiveData)
def GetBuffer(self):
return string_at(addressof(self), self.GetLength())
def OutputString(self):
DumpString = '''// A3 09 技能五行专精信息 //tagMCSkillElementInfo:
+ SkillID:%d,
+ ActiveLV:%d
+ '''\
+ %(
+ self.SkillID,
+ self.ActiveLV
+ )
+ return DumpString
+
+
+class tagMCSkillElementData(Structure):
+ MainSkillID = 0 #(DWORD MainSkillID)// 主技能ID
+ ElementSkillID = 0 #(DWORD ElementSkillID)// 选择的专精技能ID
+ SkillCnt = 0 #(BYTE SkillCnt)// 数量
+ ActiveSkill = list() #(vector<tagMCSkillElementActiveData> ActiveSkill)// 激活的技能ID
+ data = None
+
+ def __init__(self):
+ self.Clear()
+ return
+
+ def ReadData(self, _lpData, _pos=0, _Len=0):
+ self.Clear()
+ self.MainSkillID,_pos = CommFunc.ReadDWORD(_lpData, _pos)
+ self.ElementSkillID,_pos = CommFunc.ReadDWORD(_lpData, _pos)
+ self.SkillCnt,_pos = CommFunc.ReadBYTE(_lpData, _pos)
+ for i in range(self.SkillCnt):
+ temActiveSkill = tagMCSkillElementActiveData()
+ _pos = temActiveSkill.ReadData(_lpData, _pos)
+ self.ActiveSkill.append(temActiveSkill)
+ return _pos
+
+ def Clear(self):
+ self.MainSkillID = 0
+ self.ElementSkillID = 0
+ self.SkillCnt = 0
+ self.ActiveSkill = list()
+ return
+
+ def GetLength(self):
+ length = 0
+ length += 4
+ length += 4
+ length += 1
+ for i in range(self.SkillCnt):
+ length += self.ActiveSkill[i].GetLength()
+
+ return length
+
+ def GetBuffer(self):
+ data = ''
+ data = CommFunc.WriteDWORD(data, self.MainSkillID)
+ data = CommFunc.WriteDWORD(data, self.ElementSkillID)
+ data = CommFunc.WriteBYTE(data, self.SkillCnt)
+ for i in range(self.SkillCnt):
+ data = CommFunc.WriteString(data, self.ActiveSkill[i].GetLength(), self.ActiveSkill[i].GetBuffer())
+ return data
+
+ def OutputString(self):
+ DumpString = '''
MainSkillID:%d,
- ElementSkillID:%d
+ ElementSkillID:%d,
+ SkillCnt:%d,
+ ActiveSkill:%s
'''\
%(
self.MainSkillID,
- self.ElementSkillID
+ self.ElementSkillID,
+ self.SkillCnt,
+ "..."
)
return DumpString
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
index 1c26dfb..4409a43 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -3921,7 +3921,9 @@
Def_PDict_FairyAdventuresData = "FairyAdventuresData_%s" #奇遇数值 唯一ID*100+档位 参数事件ID
Def_PDict_FairyDomainEventAppearCnt = "FDEventAppearCnt%s" #事件出现次数 参数事件ID AAABBB BBB:小时段出现次数 AAA:今日出现次数
+#五行专精
Def_PDict_SkillElementID = "SkillElementID%s" #主技能选择的专精技能 参数主技能ID
+Def_PDict_SkillElementLV = "SkillElementLV%s" #专精技能技能等级 参数技能ID
#-------------------------------------------------------------------------------
#可以从07 41封包购买的背包类型,和对应字典{背包类型:[字典key, 默认格子数]}
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
index ef4b9e7..ce0d1ce 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
@@ -16782,11 +16782,11 @@
#------------------------------------------------------
# A3 09 技能五行专精信息 #tagMCSkillElementInfo
-class tagMCSkillElementData(Structure):
+class tagMCSkillElementActiveData(Structure):
_pack_ = 1
_fields_ = [
- ("MainSkillID", c_int), # 主技能ID
- ("ElementSkillID", c_int), # 专精技能ID
+ ("SkillID", c_int), # 技能ID
+ ("ActiveLV", c_ubyte), # 激活等级
]
def __init__(self):
@@ -16799,24 +16799,88 @@
return _pos + self.GetLength()
def Clear(self):
- self.MainSkillID = 0
- self.ElementSkillID = 0
+ self.SkillID = 0
+ self.ActiveLV = 0
return
def GetLength(self):
- return sizeof(tagMCSkillElementData)
+ return sizeof(tagMCSkillElementActiveData)
def GetBuffer(self):
return string_at(addressof(self), self.GetLength())
def OutputString(self):
DumpString = '''// A3 09 技能五行专精信息 //tagMCSkillElementInfo:
+ SkillID:%d,
+ ActiveLV:%d
+ '''\
+ %(
+ self.SkillID,
+ self.ActiveLV
+ )
+ return DumpString
+
+
+class tagMCSkillElementData(Structure):
+ MainSkillID = 0 #(DWORD MainSkillID)// 主技能ID
+ ElementSkillID = 0 #(DWORD ElementSkillID)// 选择的专精技能ID
+ SkillCnt = 0 #(BYTE SkillCnt)// 数量
+ ActiveSkill = list() #(vector<tagMCSkillElementActiveData> ActiveSkill)// 激活的技能ID
+ data = None
+
+ def __init__(self):
+ self.Clear()
+ return
+
+ def ReadData(self, _lpData, _pos=0, _Len=0):
+ self.Clear()
+ self.MainSkillID,_pos = CommFunc.ReadDWORD(_lpData, _pos)
+ self.ElementSkillID,_pos = CommFunc.ReadDWORD(_lpData, _pos)
+ self.SkillCnt,_pos = CommFunc.ReadBYTE(_lpData, _pos)
+ for i in range(self.SkillCnt):
+ temActiveSkill = tagMCSkillElementActiveData()
+ _pos = temActiveSkill.ReadData(_lpData, _pos)
+ self.ActiveSkill.append(temActiveSkill)
+ return _pos
+
+ def Clear(self):
+ self.MainSkillID = 0
+ self.ElementSkillID = 0
+ self.SkillCnt = 0
+ self.ActiveSkill = list()
+ return
+
+ def GetLength(self):
+ length = 0
+ length += 4
+ length += 4
+ length += 1
+ for i in range(self.SkillCnt):
+ length += self.ActiveSkill[i].GetLength()
+
+ return length
+
+ def GetBuffer(self):
+ data = ''
+ data = CommFunc.WriteDWORD(data, self.MainSkillID)
+ data = CommFunc.WriteDWORD(data, self.ElementSkillID)
+ data = CommFunc.WriteBYTE(data, self.SkillCnt)
+ for i in range(self.SkillCnt):
+ data = CommFunc.WriteString(data, self.ActiveSkill[i].GetLength(), self.ActiveSkill[i].GetBuffer())
+ return data
+
+ def OutputString(self):
+ DumpString = '''
MainSkillID:%d,
- ElementSkillID:%d
+ ElementSkillID:%d,
+ SkillCnt:%d,
+ ActiveSkill:%s
'''\
%(
self.MainSkillID,
- self.ElementSkillID
+ self.ElementSkillID,
+ self.SkillCnt,
+ "..."
)
return DumpString
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 ffb92a0..2d2ee46 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/SkillShell.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/SkillShell.py
@@ -2013,6 +2013,14 @@
return False
#玩家属性点要求
+ if not CheckLearnSkillNeedAttr(curPlayer, curSkill):
+ return False
+
+ return True
+
+def CheckLearnSkillNeedAttr(curPlayer, curSkill):
+ #玩家属性点要求
+ curSkillTypeID = curSkill.GetSkillTypeID()
stateSkillLV = curSkill.GetStateSkillLV() #需要基础属性ID*100000+需要属性点
needBaseAttrID, needBaseAttrValue = GetSkillUpNeedAttr(stateSkillLV)
if needBaseAttrID and needBaseAttrValue:
@@ -2024,14 +2032,14 @@
ShareDefine.Def_Effect_Earth:PlayerControl.GetEarth(curPlayer),
}
if needBaseAttrID not in baseAttrDict:
- GameWorld.ErrLog(' 天赋技能升级属性点条件配置错误,curSkillTypeID=%s,needBaseAttrID=%s'%(curSkillTypeID, needBaseAttrID))
+ GameWorld.ErrLog(' 技能升级属性点条件配置错误,curSkillTypeID=%s,needBaseAttrID=%s'%(curSkillTypeID, needBaseAttrID))
return False
curBaseAttrValue = baseAttrDict.get(needBaseAttrID, 0)
if curBaseAttrValue < needBaseAttrValue:
- GameWorld.DebugLog('升级技能%s需要属性点 %s达到%s, 当前点数=%s!'%(curSkillTypeID, needBaseAttrID, needBaseAttrValue, curBaseAttrValue))
+ #GameWorld.DebugLog('升级技能%s需要属性点 %s达到%s, 当前点数=%s!'%(curSkillTypeID, needBaseAttrID, needBaseAttrValue, curBaseAttrValue))
return False
-
return True
+
## 获取技能升级属性需求 rutrun attrID, attrvalue
def GetSkillUpNeedAttr(stateSkillLV):return stateSkillLV /100000, stateSkillLV%100000
@@ -2052,30 +2060,50 @@
if curPlayer.GetLV() < ipyData.GetNeedLV():
GameWorld.DebugLog('选择技能五行专精等级不足!')
return
-
- 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)
- if curElementSkillID:
- #原技能删除
- skillManager.DeleteSkillBySkillTypeID(curElementSkillID)
- else:
- EventShell.EventRespons_ElementSkill(curPlayer)
- #更新新技能
- RefreshElementSkill(curPlayer, selectSkillID)
- # 重刷被动技能
- PassiveBuffEffMng.GetPassiveEffManager().RegistPassiveEff(curPlayer)
- # 重刷技能战力
- PlayerControl.PlayerControl(curPlayer).RefreshPlayerAttrState()
+ curElementSkillID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SkillElementID % mainSkillID)
+ activeSkillLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SkillElementLV % selectSkillID)
+ #先判断是否可升级
+ updSelectSkillLV = activeSkillLV
+ nextSkill = GameWorld.GetGameData().FindSkillByType(selectSkillID, activeSkillLV + 1)
+ if nextSkill:
+ if CheckLearnSkillNeedAttr(curPlayer, nextSkill):
+ updSelectSkillLV = activeSkillLV + 1
+ isChangeSkill = False #是否变更生效的技能
+ if updSelectSkillLV != activeSkillLV:
+ #可升级则激活升一级
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_SkillElementLV % selectSkillID, updSelectSkillLV)
+ if curElementSkillID == selectSkillID:
+ #正在使用的专精技能,则立即生效
+ isChangeSkill = True
+ elif selectSkillID != curElementSkillID:
+ isChangeSkill = True
+
+ if isChangeSkill:
+ #更换专精
+ if not RefreshElementSkill(curPlayer, selectSkillID):
+ GameWorld.DebugLog('更换专精 不成功 selectSkillID=%s'%selectSkillID)
+ return
+
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_SkillElementID % mainSkillID, selectSkillID)
+ if curElementSkillID:
+ if curElementSkillID != selectSkillID:
+ #原技能删除
+ skillManager.DeleteSkillBySkillTypeID(curElementSkillID)
+ else:
+ EventShell.EventRespons_ElementSkill(curPlayer)
- NotifyElementSkillInfo(curPlayer, mainSkillID)
+ # 重刷被动技能
+ PassiveBuffEffMng.GetPassiveEffManager().RegistPassiveEff(curPlayer)
+ # 重刷技能战力
+ PlayerControl.PlayerControl(curPlayer).RefreshPlayerAttrState()
+
+ NotifyElementSkillInfo(curPlayer, mainSkillID, selectSkillID if updSelectSkillLV != activeSkillLV else 0)
return
def RefreshElementSkill(curPlayer, skillTypeID):
@@ -2090,7 +2118,7 @@
ShareDefine.Def_Effect_Fire:PlayerControl.GetFire(curPlayer),
ShareDefine.Def_Effect_Earth:PlayerControl.GetEarth(curPlayer),
}
-
+ activeSkillLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SkillElementLV % skillTypeID)
limitInfoList = PyGameData.g_elemntSkillDict[skillTypeID]
maxSkillLV = len(limitInfoList)
updSkillLV = 0
@@ -2100,16 +2128,23 @@
if curAttrValue >= needAttrValue:
updSkillLV = maxSkillLV - i
break
+ if activeSkillLV > updSkillLV:
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_SkillElementLV % skillTypeID, updSkillLV)
+ updSkillLV = min(updSkillLV, activeSkillLV) #不可超过激活的等级
skillManager = curPlayer.GetSkillManager()
curSkill = skillManager.FindSkillBySkillTypeID(skillTypeID)
curSkillLV = curSkill.GetSkillLV() if curSkill else 0
-
+ #GameWorld.DebugLog('更新专精技能生效的等级 skillTypeID=%s,curSkillLV=%s,activeSkillLV=%s,updSkillLV=%s'%(skillTypeID, curSkillLV, activeSkillLV, updSkillLV))
if updSkillLV == curSkillLV:
return
elif updSkillLV < curSkillLV:
skillManager.DeleteSkillBySkillTypeID(skillTypeID)
for _ in xrange(updSkillLV):
skillManager.LVUpSkillBySkillTypeID(skillTypeID)
+ if updSkillLV == 0:#重置为未选状态
+ ipyData = IpyGameDataPY.GetIpyGameData('SkillElement', skillTypeID)
+ mainSkillID = ipyData.GetMainSkillID()
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_SkillElementID % mainSkillID, 0)
else:
for _ in xrange(updSkillLV-curSkillLV):
skillManager.LVUpSkillBySkillTypeID(skillTypeID)
@@ -2124,19 +2159,18 @@
for i in xrange(skillManager.GetSkillCount()):
hasSkill = skillManager.GetSkillByIndex(i)
hasSkillID = hasSkill.GetSkillTypeID()
- ipyData = IpyGameDataPY.GetIpyGameDataByCondition('SkillElement', {'MainSkillID':hasSkillID}, False, False)
- if not ipyData:
+ ipyDataList = IpyGameDataPY.GetIpyGameDataByCondition('SkillElement', {'MainSkillID':hasSkillID}, True, False)
+ if not ipyDataList:
continue
- curElementSkillID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SkillElementID % hasSkillID)
- if not curElementSkillID:
- continue
- if curElementSkillID not in PyGameData.g_elemntSkillDict:
- continue
- attrID = GetSkillUpNeedAttr(PyGameData.g_elemntSkillDict[curElementSkillID][0])[0]
- if attrID not in attrIDList:
- continue
- needRefreshSkillIDList.append(curElementSkillID)
-
+ for ipyData in ipyDataList:
+ curElementSkillID = ipyData.GetElementSkillID()
+ if curElementSkillID not in PyGameData.g_elemntSkillDict:
+ continue
+ attrID = GetSkillUpNeedAttr(PyGameData.g_elemntSkillDict[curElementSkillID][0])[0]
+ if attrID not in attrIDList:
+ continue
+ needRefreshSkillIDList.append(curElementSkillID)
+ #GameWorld.DebugLog('属性点变更 刷新专精attrIDList=%s,needRefreshSkillIDList=%s'%(attrIDList,needRefreshSkillIDList))
isRefresh = False
for skillID in needRefreshSkillIDList:
if RefreshElementSkill(curPlayer, skillID):
@@ -2146,6 +2180,7 @@
PassiveBuffEffMng.GetPassiveEffManager().RegistPassiveEff(curPlayer)
# 重刷技能战力
PlayerControl.PlayerControl(curPlayer).RefreshPlayerAttrState()
+ NotifyElementSkillInfo(curPlayer)
return
def GetElementSkillCnt(curPlayer):
@@ -2184,30 +2219,37 @@
PyGameData.g_elemntSkillDict[elementSkillID].append(curSkill.GetStateSkillLV())
return
-def NotifyElementSkillInfo(curPlayer, mainSkillID=0):
+def NotifyElementSkillInfo(curPlayer, mainSkillID=0, changeSkillID=0):
##通知五行专精信息
if not mainSkillID:
- syncMainSkillList = []
+ syncMainSkillDict = {}
skillManager = curPlayer.GetSkillManager()
for i in xrange(skillManager.GetSkillCount()):
hasSkill = skillManager.GetSkillByIndex(i)
hasSkillID = hasSkill.GetSkillTypeID()
- ipyData = IpyGameDataPY.GetIpyGameDataByCondition('SkillElement', {'MainSkillID':hasSkillID}, False, False)
- if not ipyData:
+ ipyDataList = IpyGameDataPY.GetIpyGameDataByCondition('SkillElement', {'MainSkillID':hasSkillID}, True, False)
+ if not ipyDataList:
continue
- syncMainSkillList.append(hasSkillID)
-
+ syncMainSkillDict[hasSkillID] = []
+ for ipyData in ipyDataList:
+ syncMainSkillDict[hasSkillID].append(ipyData.GetElementSkillID())
+
else:
- syncMainSkillList = [mainSkillID]
+ syncMainSkillDict = {mainSkillID:[changeSkillID]} if changeSkillID else {mainSkillID:[]}
sendPack = ChPyNetSendPack.tagMCSkillElementInfo()
sendPack.InfoList = []
- for mSkillID in syncMainSkillList:
+ for mSkillID, elementList in syncMainSkillDict.items():
curElementSkillID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SkillElementID % mSkillID)
- if not curElementSkillID:
- continue
elementData = ChPyNetSendPack.tagMCSkillElementData()
elementData.MainSkillID = mSkillID
elementData.ElementSkillID = curElementSkillID
+ elementData.ActiveSkill = []
+ for elementSkillID in elementList:
+ activeData = ChPyNetSendPack.tagMCSkillElementActiveData()
+ activeData.SkillID = elementSkillID
+ activeData.ActiveLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SkillElementLV % elementSkillID)
+ elementData.ActiveSkill.append(activeData)
+ elementData.SkillCnt = len(elementData.ActiveSkill)
sendPack.InfoList.append(elementData)
sendPack.Cnt = len(sendPack.InfoList)
NetPackCommon.SendFakePack(curPlayer, sendPack)
--
Gitblit v1.8.0