From 445e6bdb5719d07c7196afe09b5e610e1839e062 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 21 十月 2025 10:44:32 +0800
Subject: [PATCH] 129 【战斗】战斗系统-服务端(优化B4 10 回合制战斗 #tagCMTurnFight请求战斗时FuncLineID逻辑)
---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChNetSendPack.py | 337 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 334 insertions(+), 3 deletions(-)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChNetSendPack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChNetSendPack.py
index 2752f9e..4a062ca 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChNetSendPack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChNetSendPack.py
@@ -110,6 +110,7 @@
("ObjID", c_int),
("AttackType", c_ubyte), #爆击, miss
("HurtHP", c_int),
+ ("HurtHPEx", c_int),
("CurHP", c_int),
("CurHPEx", c_int),
]
@@ -128,6 +129,7 @@
self.ObjID = 0
self.AttackType = 0
self.HurtHP = 0
+ self.HurtHPEx = 0
self.CurHP = 0
self.CurHPEx = 0
return
@@ -144,6 +146,7 @@
ObjID:%d,
AttackType:%d,
HurtHP:%d,
+ HurtHPEx:%d,
CurHP:%d,
CurHPEx:%d
'''\
@@ -152,6 +155,7 @@
self.ObjID,
self.AttackType,
self.HurtHP,
+ self.HurtHPEx,
self.CurHP,
self.CurHPEx
)
@@ -845,8 +849,9 @@
("SubCmd", c_ubyte),
("ObjID", c_int),
("ObjType", c_ubyte),
- ("RefreshType", c_ubyte),
+ ("RefreshType", c_ushort),
("Value", c_int),
+ ("ValueEx", c_int),
]
def __init__(self):
@@ -867,6 +872,7 @@
self.ObjType = 0
self.RefreshType = 0
self.Value = 0
+ self.ValueEx = 0
return
def GetLength(self):
@@ -882,7 +888,8 @@
ObjID:%d,
ObjType:%d,
RefreshType:%d,
- Value:%d
+ Value:%d,
+ ValueEx:%d
'''\
%(
self.Cmd,
@@ -890,7 +897,8 @@
self.ObjID,
self.ObjType,
self.RefreshType,
- self.Value
+ self.Value,
+ self.ValueEx
)
return DumpString
@@ -1105,3 +1113,326 @@
m_NAtagNPCDie=tagNPCDie()
ChNetPackDict[eval("0x%02x%02x"%(m_NAtagNPCDie.Cmd,m_NAtagNPCDie.SubCmd))] = m_NAtagNPCDie
+
+#04 06 NPC出现#tagNPCAppear
+
+class tagNPCAppear(Structure):
+ _pack_ = 1
+ _fields_ = [
+ ("Cmd", c_ubyte),
+ ("SubCmd", c_ubyte),
+ ("ObjID", c_int),
+ ("NPCID", c_int),
+ ("NPCHP", c_int),
+ ("NPCHPEx", c_int), #扩展超过20E血量
+ ("MaxHP", c_int), #成长型NPC需要通知
+ ("MaxHPEx", c_int), #超过20E血量
+ ("CurLV", c_ushort), #成长型NPC
+ ("PosX", c_ushort),
+ ("PosY", c_ushort),
+ ("Speed", c_ushort),
+ ]
+
+ def __init__(self):
+ self.Clear()
+ self.Cmd = 0x04
+ self.SubCmd = 0x06
+ 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 = 0x04
+ self.SubCmd = 0x06
+ self.ObjID = 0
+ self.NPCID = 0
+ self.NPCHP = 0
+ self.NPCHPEx = 0
+ self.MaxHP = 0
+ self.MaxHPEx = 0
+ self.CurLV = 0
+ self.PosX = 0
+ self.PosY = 0
+ self.Speed = 0
+ return
+
+ def GetLength(self):
+ return sizeof(tagNPCAppear)
+
+ def GetBuffer(self):
+ return string_at(addressof(self), self.GetLength())
+
+ def OutputString(self):
+ DumpString = '''//04 06 NPC出现//tagNPCAppear:
+ Cmd:%s,
+ SubCmd:%s,
+ ObjID:%d,
+ NPCID:%d,
+ NPCHP:%d,
+ NPCHPEx:%d,
+ MaxHP:%d,
+ MaxHPEx:%d,
+ CurLV:%d,
+ PosX:%d,
+ PosY:%d,
+ Speed:%d
+ '''\
+ %(
+ self.Cmd,
+ self.SubCmd,
+ self.ObjID,
+ self.NPCID,
+ self.NPCHP,
+ self.NPCHPEx,
+ self.MaxHP,
+ self.MaxHPEx,
+ self.CurLV,
+ self.PosX,
+ self.PosY,
+ self.Speed
+ )
+ return DumpString
+
+
+m_NAtagNPCAppear=tagNPCAppear()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagNPCAppear.Cmd,m_NAtagNPCAppear.SubCmd))] = m_NAtagNPCAppear
+
+#04 07 NPC消失#tagNPCDisappear
+
+class tagNPCDisappear(Structure):
+ Head = tagHead()
+ Count = 0 #(WORD Count)
+ NPCID = list() #(vector<DWORD> NPCID)//size = Count
+ data = None
+
+ def __init__(self):
+ self.Clear()
+ self.Head.Cmd = 0x04
+ self.Head.SubCmd = 0x07
+ return
+
+ def ReadData(self, _lpData, _pos=0, _Len=0):
+ self.Clear()
+ _pos = self.Head.ReadData(_lpData, _pos)
+ self.Count,_pos = CommFunc.ReadWORD(_lpData, _pos)
+ for i in range(self.Count):
+ value,_pos=CommFunc.ReadDWORD(_lpData,_pos)
+ self.NPCID.append(value)
+ return _pos
+
+ def Clear(self):
+ self.Head = tagHead()
+ self.Head.Clear()
+ self.Head.Cmd = 0x04
+ self.Head.SubCmd = 0x07
+ self.Count = 0
+ self.NPCID = list()
+ return
+
+ def GetLength(self):
+ length = 0
+ length += self.Head.GetLength()
+ length += 2
+ length += 4 * self.Count
+
+ return length
+
+ def GetBuffer(self):
+ data = ''
+ data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
+ data = CommFunc.WriteWORD(data, self.Count)
+ for i in range(self.Count):
+ data = CommFunc.WriteDWORD(data, self.NPCID[i])
+ return data
+
+ def OutputString(self):
+ DumpString = '''
+ Head:%s,
+ Count:%d,
+ NPCID:%s
+ '''\
+ %(
+ self.Head.OutputString(),
+ self.Count,
+ "..."
+ )
+ return DumpString
+
+
+m_NAtagNPCDisappear=tagNPCDisappear()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagNPCDisappear.Head.Cmd,m_NAtagNPCDisappear.Head.SubCmd))] = m_NAtagNPCDisappear
+
+#04 23 对象状态刷新通知(只显示)#tagObjPropertyRefreshView
+
+class tagObjPropertyRefreshView(Structure):
+ _pack_ = 1
+ _fields_ = [
+ ("Cmd", c_ubyte),
+ ("SubCmd", c_ubyte),
+ ("ObjID", c_int), #对象ID
+ ("ObjType", c_ubyte), #对象类型
+ ("SkillID", c_int), #技能ID
+ ("DiffValue", c_int), #值
+ ("DiffValueEx", c_int), #超亿值
+ ("AttackType", c_ubyte), #攻击类型
+ ("SrcObjID", c_int), #飘血来源
+ ("SrcObjType", c_ubyte),
+ ("HP", c_int), #剩余血量
+ ("HPEx", c_int), #剩余血量 亿
+ ]
+
+ def __init__(self):
+ self.Clear()
+ self.Cmd = 0x04
+ self.SubCmd = 0x23
+ 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 = 0x04
+ self.SubCmd = 0x23
+ self.ObjID = 0
+ self.ObjType = 0
+ self.SkillID = 0
+ self.DiffValue = 0
+ self.DiffValueEx = 0
+ self.AttackType = 0
+ self.SrcObjID = 0
+ self.SrcObjType = 0
+ self.HP = 0
+ self.HPEx = 0
+ return
+
+ def GetLength(self):
+ return sizeof(tagObjPropertyRefreshView)
+
+ def GetBuffer(self):
+ return string_at(addressof(self), self.GetLength())
+
+ def OutputString(self):
+ DumpString = '''//04 23 对象状态刷新通知(只显示)//tagObjPropertyRefreshView:
+ Cmd:%s,
+ SubCmd:%s,
+ ObjID:%d,
+ ObjType:%d,
+ SkillID:%d,
+ DiffValue:%d,
+ DiffValueEx:%d,
+ AttackType:%d,
+ SrcObjID:%d,
+ SrcObjType:%d,
+ HP:%d,
+ HPEx:%d
+ '''\
+ %(
+ self.Cmd,
+ self.SubCmd,
+ self.ObjID,
+ self.ObjType,
+ self.SkillID,
+ self.DiffValue,
+ self.DiffValueEx,
+ self.AttackType,
+ self.SrcObjID,
+ self.SrcObjType,
+ self.HP,
+ self.HPEx
+ )
+ return DumpString
+
+
+m_NAtagObjPropertyRefreshView=tagObjPropertyRefreshView()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagObjPropertyRefreshView.Cmd,m_NAtagObjPropertyRefreshView.SubCmd))] = m_NAtagObjPropertyRefreshView
+
+#06 02 普通攻击#tagObjBaseAttack
+
+class tagObjBaseAttack(Structure):
+ _pack_ = 1
+ _fields_ = [
+ ("Cmd", c_ubyte),
+ ("SubCmd", c_ubyte),
+ ("AttackerID", c_int),
+ ("AttackerObjType", c_ubyte),
+ ("BattleType", c_ubyte), #攻击类型 物理/魔法
+ ("ObjID", c_int), #对象ID
+ ("ObjType", c_ubyte), #对象类型
+ ("AttackType", c_ubyte), #普攻, 闪躲, 致命 类型
+ ("Value", c_int),
+ ("ValueEx", c_int),
+ ("RemainHP", c_int), #对方剩余的血
+ ("RemainHPEx", c_int), #对方剩余的血, 超亿支持
+ ]
+
+ def __init__(self):
+ self.Clear()
+ self.Cmd = 0x06
+ self.SubCmd = 0x02
+ 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 = 0x06
+ self.SubCmd = 0x02
+ self.AttackerID = 0
+ self.AttackerObjType = 0
+ self.BattleType = 0
+ self.ObjID = 0
+ self.ObjType = 0
+ self.AttackType = 0
+ self.Value = 0
+ self.ValueEx = 0
+ self.RemainHP = 0
+ self.RemainHPEx = 0
+ return
+
+ def GetLength(self):
+ return sizeof(tagObjBaseAttack)
+
+ def GetBuffer(self):
+ return string_at(addressof(self), self.GetLength())
+
+ def OutputString(self):
+ DumpString = '''//06 02 普通攻击//tagObjBaseAttack:
+ Cmd:%s,
+ SubCmd:%s,
+ AttackerID:%d,
+ AttackerObjType:%d,
+ BattleType:%d,
+ ObjID:%d,
+ ObjType:%d,
+ AttackType:%d,
+ Value:%d,
+ ValueEx:%d,
+ RemainHP:%d,
+ RemainHPEx:%d
+ '''\
+ %(
+ self.Cmd,
+ self.SubCmd,
+ self.AttackerID,
+ self.AttackerObjType,
+ self.BattleType,
+ self.ObjID,
+ self.ObjType,
+ self.AttackType,
+ self.Value,
+ self.ValueEx,
+ self.RemainHP,
+ self.RemainHPEx
+ )
+ return DumpString
+
+
+m_NAtagObjBaseAttack=tagObjBaseAttack()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagObjBaseAttack.Cmd,m_NAtagObjBaseAttack.SubCmd))] = m_NAtagObjBaseAttack
\ No newline at end of file
--
Gitblit v1.8.0