From d2bd99f40539e4eb6dc19ce7cc52e3aea56abb4c Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期四, 22 十一月 2018 15:06:04 +0800
Subject: [PATCH] 4911 【后端】【1.3】神兵功能相关修改——解封、仙玉自动锤炼
---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/PyNetPack.ini | 5
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py | 8 +
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py | 52 ++++++++++
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerGodWeapon.py | 105 ++++++++++++++------
ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py | 52 ++++++++++
ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py | 8 +
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py | 5 +
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py | 6
8 files changed, 203 insertions(+), 38 deletions(-)
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py
index a462748..09463a3 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py
@@ -8901,6 +8901,58 @@
#------------------------------------------------------
+# A5 56 神兵激活 #tagCMGodWeaponActivate
+
+class tagCMGodWeaponActivate(Structure):
+ _pack_ = 1
+ _fields_ = [
+ ("Cmd", c_ubyte),
+ ("SubCmd", c_ubyte),
+ ("WeaponType", c_int), # 神兵类型
+ ]
+
+ def __init__(self):
+ self.Clear()
+ self.Cmd = 0xA5
+ self.SubCmd = 0x56
+ 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 = 0x56
+ self.WeaponType = 0
+ return
+
+ def GetLength(self):
+ return sizeof(tagCMGodWeaponActivate)
+
+ def GetBuffer(self):
+ return string_at(addressof(self), self.GetLength())
+
+ def OutputString(self):
+ DumpString = '''// A5 56 神兵激活 //tagCMGodWeaponActivate:
+ Cmd:%s,
+ SubCmd:%s,
+ WeaponType:%d
+ '''\
+ %(
+ self.Cmd,
+ self.SubCmd,
+ self.WeaponType
+ )
+ return DumpString
+
+
+m_NAtagCMGodWeaponActivate=tagCMGodWeaponActivate()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMGodWeaponActivate.Cmd,m_NAtagCMGodWeaponActivate.SubCmd))] = m_NAtagCMGodWeaponActivate
+
+
+#------------------------------------------------------
# A5 55 神兵升级 #tagCMGodWeaponPlus
class tagCMGodWeaponPlus(Structure):
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py b/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py
index b1c8544..85d0940 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py
@@ -774,10 +774,14 @@
CDBPlayerRefresh_TreasureScore, # 寻宝积分
CDBPlayerRefresh_Danjing, # 丹精
CDBPlayerRefresh_NPCHurtAddPer, # 对怪物伤害加成
-CDBPlayerRefresh_FinalHurtPer, # 最终输出伤害百分比
+CDBPlayerRefresh_FinalHurtPer, # 最终输出伤害百分比
CDBPlayerRefresh_TalentPoint, # 天赋点数 190
CDBPlayerRefresh_DayFBHelpPoint, # 今日副本助战点数 191
-) = range(146, 192)
+CDBPlayerRefresh_GodWeaponLV_1, # 神兵等级 - 类型1 192
+CDBPlayerRefresh_GodWeaponLV_2, # 神兵等级 - 类型2 193
+CDBPlayerRefresh_GodWeaponLV_3, # 神兵等级 - 类型3 194
+CDBPlayerRefresh_GodWeaponLV_4, # 神兵等级 - 类型4 195
+) = range(146, 196)
TYPE_Price_Gold_Paper_Money = 5 # 金钱类型,(先用礼券,再用金子)
TYPE_Price_Family_Contribution = 6 # 战盟贡献度(活跃度转换得来)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/PyNetPack.ini b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/PyNetPack.ini
index f05f5d8..a164022 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/PyNetPack.ini
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/PyNetPack.ini
@@ -890,12 +890,15 @@
Writer = ljd
Releaser = ljd
RegType = 0
-RegisterPackCount = 1
+RegisterPackCount = 2
PacketCMD_1=0xA5
PacketSubCMD_1=0x55
PacketCallFunc_1=OnPlusGodWeapon
+PacketCMD_2=0xA5
+PacketSubCMD_2=0x56
+PacketCallFunc_2=OnGodWeaponActivate
;聊天
[PlayerTalk]
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
index c1710c2..5d2c27b 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -4524,9 +4524,10 @@
Def_Cost_DogzEquipPlus, # 神兽装备强化
Def_Cost_RuneHole, # 符印孔解锁
Def_Cost_AlchemyPray, # 丹药祈福
-Def_Cost_ResetGreatMasterSkill, # 重置天赋技能
+Def_Cost_ResetGreatMasterSkill, # 重置天赋技能 35
Def_Cost_BindJadeWheel, # 绑玉转盘
Def_Cost_WishingWell, # 许愿池刷新
+Def_Cost_GodWeapon, # 神兵
#-----------以下为暂时没用的,先不删除,如有新增消费点则放在这些之前------------
Def_Cost_RefreshArrestTask, # 刷新悬赏任务
Def_Cost_OffLineExp, # 兑换离线经验
@@ -4547,7 +4548,7 @@
Def_Cost_Trade, # 交易
Def_Cost_Rename, # 改名
Def_Cost_SkillLvUp, # 技能升级
-) = range(2000, 2000 + 57)
+) = range(2000, 2000 + 58)
Def_Cost_Reason_SonKey = "reason_name_son" # 消费点原因子类说明key
@@ -4632,6 +4633,7 @@
Def_Cost_AlchemyPray:"AlchemyPray",
Def_Cost_BindJadeWheel:"BindJadeWheel",
Def_Cost_WishingWell:"WishingWell",
+Def_Cost_GodWeapon:"GodWeapon",
}
## -----------------------------------------------------
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py
index a462748..09463a3 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py
@@ -8901,6 +8901,58 @@
#------------------------------------------------------
+# A5 56 神兵激活 #tagCMGodWeaponActivate
+
+class tagCMGodWeaponActivate(Structure):
+ _pack_ = 1
+ _fields_ = [
+ ("Cmd", c_ubyte),
+ ("SubCmd", c_ubyte),
+ ("WeaponType", c_int), # 神兵类型
+ ]
+
+ def __init__(self):
+ self.Clear()
+ self.Cmd = 0xA5
+ self.SubCmd = 0x56
+ 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 = 0x56
+ self.WeaponType = 0
+ return
+
+ def GetLength(self):
+ return sizeof(tagCMGodWeaponActivate)
+
+ def GetBuffer(self):
+ return string_at(addressof(self), self.GetLength())
+
+ def OutputString(self):
+ DumpString = '''// A5 56 神兵激活 //tagCMGodWeaponActivate:
+ Cmd:%s,
+ SubCmd:%s,
+ WeaponType:%d
+ '''\
+ %(
+ self.Cmd,
+ self.SubCmd,
+ self.WeaponType
+ )
+ return DumpString
+
+
+m_NAtagCMGodWeaponActivate=tagCMGodWeaponActivate()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMGodWeaponActivate.Cmd,m_NAtagCMGodWeaponActivate.SubCmd))] = m_NAtagCMGodWeaponActivate
+
+
+#------------------------------------------------------
# A5 55 神兵升级 #tagCMGodWeaponPlus
class tagCMGodWeaponPlus(Structure):
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 68bacc8..ef41edc 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py
@@ -5631,6 +5631,9 @@
# SetExAttr1 ~ SetExAttr14(DWORD uiExAttr10, bool bNotifyAll = false, bool bNotifyGameServer = false)
# @param bNotifyAll: 是否广播所周围玩家,默认false,只会发给自己
# @param bNotifyGameServer: 是否同步GameServer,默认false
+# SetExAttr15 ~ SetExAttr20(DWORD uiExAttr15)
+# 15~20扩展属性同步封包:0309 选角登录简短信息、0434 周围玩家出现、0102 登录地图玩家信息;
+# 同步前端及GameServer需要自己写通知,设置函数自身不带通知参数
#
# 发送0418包
# SendPropertyRefresh(int inputType, int inputValue, bool boardCast, bool includeSelf = true)
@@ -5639,6 +5642,8 @@
# 通知GsmeServer;
# SendGameServerRefreshState(int inputType, int inputValue)
+# SetExAttr15 ~ 18 对应神兵类型等级,场景特效用
+
# 禁言 通知gameServer
def SetGMForbidenTalk(curPlayer, value):
curPlayer.SetGMForbidenTalk(value)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerGodWeapon.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerGodWeapon.py
index 57f43a4..4d95da1 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerGodWeapon.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerGodWeapon.py
@@ -46,15 +46,39 @@
if not GameFuncComm.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_GodWeapon):
return
Sync_GodWeaponLVInfo(curPlayer)
+
+ #老号相关神兵场景特效等级同步支持
+ if curPlayer.GetExAttr15() == 0:
+ ipyDataMgr = IpyGameDataPY.IPY_Data()
+ maxType = ipyDataMgr.GetGodWeaponByIndex(ipyDataMgr.GetGodWeaponCount()-1).GetType()
+ for setWeaponType in xrange(1, maxType + 1):
+ setLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GodWeaponLV % setWeaponType)
+ if not setLV:
+ continue
+ SetGodWeaponLV(curPlayer, setWeaponType, setLV)
+ GameWorld.Log("老号设置神兵场景等级: setWeaponType=%s,setLV=%s" % (setWeaponType, setLV), curPlayer.GetPlayerID())
return
+def SetGodWeaponLV(curPlayer, weaponType, lv):
+ ## 设置神兵等级,同步设置场景神兵等级
+ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GodWeaponLV % weaponType, lv)
+ sceneEffectsDict = {1:[lambda curObj, value:curObj.SetExAttr15(value), ShareDefine.CDBPlayerRefresh_GodWeaponLV_1],
+ 2:[lambda curObj, value:curObj.SetExAttr16(value), ShareDefine.CDBPlayerRefresh_GodWeaponLV_2],
+ 3:[lambda curObj, value:curObj.SetExAttr17(value), ShareDefine.CDBPlayerRefresh_GodWeaponLV_3],
+ 4:[lambda curObj, value:curObj.SetExAttr18(value), ShareDefine.CDBPlayerRefresh_GodWeaponLV_4],
+ }
+ if weaponType in sceneEffectsDict:
+ setFunc, notifyType = sceneEffectsDict[weaponType]
+ setFunc(curPlayer, lv)
+ curPlayer.SendPropertyRefresh(notifyType, lv, False)
+ return
## 神器开启
# @return: 是否激活成功
def DoGodWeaponOpen(curPlayer):
# 默认激活1级的类型
for i in IpyGameDataPY.GetFuncEvalCfg('GodWeaponActive'):
- PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GodWeaponLV % i, 1)
+ SetGodWeaponLV(curPlayer, i, 1)
PlayerSuccess.UptateSuccessProgress(curPlayer, ShareDefine.SuccType_GodWeapon, 1, [i])
Sync_GodWeaponLVInfo(curPlayer)
return True
@@ -98,6 +122,39 @@
return
#---------------------------------------------------------------------------------------------------
+#// A5 56 神兵激活 #tagCMGodWeaponActivate
+#
+#struct tagCMGodWeaponActivate
+#{
+# tagHead Head;
+# DWORD WeaponType; // 神兵类型
+#};
+def OnGodWeaponActivate(index, clientData, tick):
+ curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
+ weaponType = clientData.WeaponType
+
+ if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GodWeaponLV % weaponType):
+ GameWorld.DebugLog("已经解锁的神兵!weaponType=%s" % weaponType)
+ return
+
+ godWeaponUnlockDict = IpyGameDataPY.GetFuncEvalCfg("GodWeaponActive", 2, {})
+ if str(weaponType) not in godWeaponUnlockDict:
+ GameWorld.DebugLog("该神兵不能解锁!weaponType=%s" % weaponType)
+ return
+ conditionList = godWeaponUnlockDict[str(weaponType)]
+
+ for needType, needLV in conditionList:
+ needTypeLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GodWeaponLV % needType)
+ if needTypeLV < needLV:
+ GameWorld.DebugLog("所需前置神兵等级不足,无法解锁!weaponType=%s,needType=%s,needLV=%s > needTypeLV(%s)"
+ % (weaponType, needType, needLV, needTypeLV))
+ return
+
+ SetGodWeaponLV(curPlayer, weaponType, 1)
+ GameWorld.DebugLog("解锁神兵: weaponType=%s" % weaponType)
+ Sync_GodWeaponLVInfo(curPlayer, weaponType)
+ return
+
#===============================================================================
#// A5 55 神兵升级 #tagCMGodWeaponPlus
#
@@ -149,11 +206,12 @@
if not effect:
GameWorld.DebugLog('###神兵假包,物品ID=%s没有经验值'%useItemID)
return
- addExp = effect.GetEffectValue(0)
- if not addExp:
+ itemExp = effect.GetEffectValue(0)
+ if not itemExp:
GameWorld.DebugLog('###神兵假包,物品ID=%s没有经验值'%useItemID)
return
+ goldExpTotal = 0
costItemIndexList, bindCnt, unBindCnt = ItemCommon.GetPackItemBindStateIndexInfo(curPlayer, useItemID, useItemCount)
lackCount = max(0, useItemCount - (bindCnt + unBindCnt))
if lackCount > 0:
@@ -161,13 +219,19 @@
GameWorld.DebugLog("神兵升级消耗不足!useItemID=%s,useItemCount=%s,bindCnt=%s,unBindCnt=%s,lackCount=%s"
% (useItemID, useItemCount, bindCnt, unBindCnt, lackCount))
return
- lackCost = ItemCommon.GetAutoBuyItemNeedGold({useItemID:lackCount})
+ godMagicExpDict = IpyGameDataPY.GetFuncEvalCfg("GodMagicExp", 1, {})
+ if str(weaponType) not in godMagicExpDict:
+ return
+ costGold, goldExp = godMagicExpDict[str(weaponType)]
+ lackCost = costGold * lackCount
+ goldExpTotal = goldExp * lackCount
+ #lackCost = ItemCommon.GetAutoBuyItemNeedGold({useItemID:lackCount})
if lackCost <= 0:
return
- infoDict = {ChConfig.Def_Cost_Reason_SonKey:useItemID}
+ infoDict = {ChConfig.Def_Cost_Reason_SonKey:useItemID, "lackCount":lackCount}
if not PlayerControl.PayMoney(curPlayer, IPY_GameWorld.TYPE_Price_Gold_Money, lackCost,
- ChConfig.Def_Cost_BuyStoreItem, infoDict, lackCount):
+ ChConfig.Def_Cost_GodWeapon, infoDict, lackCount):
return
delUseItemCount = useItemCount - lackCount
@@ -175,11 +239,11 @@
if delUseItemCount:
ItemCommon.DelCostItemByBind(curPlayer, costItemIndexList, bindCnt, unBindCnt, delUseItemCount, ChConfig.ItemDel_GodWeapon)
- addTotalExp = addExp * useItemCount
+ addTotalExp = itemExp * delUseItemCount + goldExpTotal
befExp = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GodWeaponExp % weaponType)
curExp = befExp + addTotalExp
- GameWorld.DebugLog("执行神兵升级: weaponType=%s,beforeAttrLV=%s,befExp=%s,addTotalExp=%s(%s*%s),curExp=%s"
- % (weaponType, beforeAttrLV, befExp, addTotalExp, addExp, useItemCount, curExp))
+ GameWorld.DebugLog("执行神兵升级: weaponType=%s,beforeAttrLV=%s,befExp=%s,addTotalExp=%s(%s*%s+%s),curExp=%s"
+ % (weaponType, beforeAttrLV, befExp, addTotalExp, itemExp, delUseItemCount, goldExpTotal, curExp))
isLVUP = False
@@ -204,10 +268,9 @@
#满级
break
- PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GodWeaponLV % weaponType, attrLV)
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GodWeaponExp % weaponType, curExp)
-
if isLVUP:
+ SetGodWeaponLV(curPlayer, weaponType, attrLV)
GameWorld.DebugLog("神兵升级结果: attrLV=%s,curExp=%s" % (attrLV, curExp))
RefreshGodWeaponAttr(curPlayer)
#x神器达到X级成就
@@ -223,26 +286,6 @@
for notifyLV in notifyDict[weaponType]:
if beforeAttrLV < notifyLV and attrLV >= notifyLV:
PlayerControl.WorldNotify(0, 'GodWeaponLv', [curPlayer.GetName(), weaponType, notifyLV])
-
- #升级判断是否可解锁其他神兵
- godWeaponUnlockDict = IpyGameDataPY.GetFuncEvalCfg("GodWeaponActive", 2, {})
- for unlockGodWeaponType, unlockConditionList in godWeaponUnlockDict.items():
- unlockGodWeaponType = int(unlockGodWeaponType)
- if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GodWeaponLV % unlockGodWeaponType):
- GameWorld.DebugLog("已经解锁的神兵不需要再判断!unlockGodWeaponType=%s" % unlockGodWeaponType)
- continue
- isUnlock = True
- for needType, needLV in unlockConditionList:
- needTypeLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GodWeaponLV % needType)
- if needTypeLV < needLV:
- isUnlock = False
- GameWorld.DebugLog("所需前置神兵等级不足,无法解锁!unlockGodWeaponType=%s,needType=%s,needLV=%s > needTypeLV(%s)"
- % (unlockGodWeaponType, needType, needLV, needTypeLV))
- break
- if isUnlock:
- PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GodWeaponLV % unlockGodWeaponType, 1)
- GameWorld.DebugLog("解锁神兵: unlockGodWeaponType=%s" % unlockGodWeaponType)
- Sync_GodWeaponLVInfo(curPlayer, unlockGodWeaponType)
Sync_GodWeaponLVInfo(curPlayer, weaponType)
#任务
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
index b1c8544..85d0940 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
@@ -774,10 +774,14 @@
CDBPlayerRefresh_TreasureScore, # 寻宝积分
CDBPlayerRefresh_Danjing, # 丹精
CDBPlayerRefresh_NPCHurtAddPer, # 对怪物伤害加成
-CDBPlayerRefresh_FinalHurtPer, # 最终输出伤害百分比
+CDBPlayerRefresh_FinalHurtPer, # 最终输出伤害百分比
CDBPlayerRefresh_TalentPoint, # 天赋点数 190
CDBPlayerRefresh_DayFBHelpPoint, # 今日副本助战点数 191
-) = range(146, 192)
+CDBPlayerRefresh_GodWeaponLV_1, # 神兵等级 - 类型1 192
+CDBPlayerRefresh_GodWeaponLV_2, # 神兵等级 - 类型2 193
+CDBPlayerRefresh_GodWeaponLV_3, # 神兵等级 - 类型3 194
+CDBPlayerRefresh_GodWeaponLV_4, # 神兵等级 - 类型4 195
+) = range(146, 196)
TYPE_Price_Gold_Paper_Money = 5 # 金钱类型,(先用礼券,再用金子)
TYPE_Price_Family_Contribution = 6 # 战盟贡献度(活跃度转换得来)
--
Gitblit v1.8.0