From d37ff1be4e18dee345942f1cac676c616636cb61 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期四, 18 一月 2024 15:57:41 +0800
Subject: [PATCH] 10019 【砍树】回合战斗(每次攻击触发精怪技能支持)

---
 ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py |  264 +++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 245 insertions(+), 19 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
index 604bd86..c634db5 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
@@ -47494,25 +47494,22 @@
 
 
 #------------------------------------------------------
-# B4 20 回合制战斗状态 #tagMCTurnFightState
+# B4 21 回合战斗对象开始行动 #tagMCTurnFightObjAction
 
-class  tagMCTurnFightState(Structure):
+class  tagMCTurnFightObjAction(Structure):
     _pack_ = 1
     _fields_ = [
                   ("Cmd", c_ubyte),
                   ("SubCmd", c_ubyte),
-                  ("MapID", c_int),    # 自定义地图ID,可用于绑定战斗场景功能(如野外关卡,爬塔功能,竞技场等)
-                  ("FuncLineID", c_ushort),    
-                  ("PlayerID", c_int),    # 对应玩家ID,可为0,某些功能可能有用,如竞技场
-                  ("State", c_ubyte),    # 0-开始;1-战斗中;2-胜利;3-失败;4-结束
                   ("TurnNum", c_ubyte),    # 当前轮次
-                  ("TurnMax", c_ubyte),    # 最大轮次
+                  ("ObjID", c_int),    
+                  ("ObjType", c_ubyte),    
                   ]
 
     def __init__(self):
         self.Clear()
         self.Cmd = 0xB4
-        self.SubCmd = 0x20
+        self.SubCmd = 0x21
         return
 
     def ReadData(self, stringData, _pos=0, _len=0):
@@ -47522,47 +47519,276 @@
 
     def Clear(self):
         self.Cmd = 0xB4
-        self.SubCmd = 0x20
+        self.SubCmd = 0x21
+        self.TurnNum = 0
+        self.ObjID = 0
+        self.ObjType = 0
+        return
+
+    def GetLength(self):
+        return sizeof(tagMCTurnFightObjAction)
+
+    def GetBuffer(self):
+        return string_at(addressof(self), self.GetLength())
+
+    def OutputString(self):
+        DumpString = '''// B4 21 回合战斗对象开始行动 //tagMCTurnFightObjAction:
+                                Cmd:%s,
+                                SubCmd:%s,
+                                TurnNum:%d,
+                                ObjID:%d,
+                                ObjType:%d
+                                '''\
+                                %(
+                                self.Cmd,
+                                self.SubCmd,
+                                self.TurnNum,
+                                self.ObjID,
+                                self.ObjType
+                                )
+        return DumpString
+
+
+m_NAtagMCTurnFightObjAction=tagMCTurnFightObjAction()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCTurnFightObjAction.Cmd,m_NAtagMCTurnFightObjAction.SubCmd))] = m_NAtagMCTurnFightObjAction
+
+
+#------------------------------------------------------
+# B4 22 回合战斗角色死亡 #tagMCTurnFightObjDead
+
+class  tagMCTurnFightObjDead(Structure):
+    _pack_ = 1
+    _fields_ = [
+                  ("Cmd", c_ubyte),
+                  ("SubCmd", c_ubyte),
+                  ("ObjID", c_int),    
+                  ("ObjType", c_ubyte),    
+                  ]
+
+    def __init__(self):
+        self.Clear()
+        self.Cmd = 0xB4
+        self.SubCmd = 0x22
+        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 = 0xB4
+        self.SubCmd = 0x22
+        self.ObjID = 0
+        self.ObjType = 0
+        return
+
+    def GetLength(self):
+        return sizeof(tagMCTurnFightObjDead)
+
+    def GetBuffer(self):
+        return string_at(addressof(self), self.GetLength())
+
+    def OutputString(self):
+        DumpString = '''// B4 22 回合战斗角色死亡 //tagMCTurnFightObjDead:
+                                Cmd:%s,
+                                SubCmd:%s,
+                                ObjID:%d,
+                                ObjType:%d
+                                '''\
+                                %(
+                                self.Cmd,
+                                self.SubCmd,
+                                self.ObjID,
+                                self.ObjType
+                                )
+        return DumpString
+
+
+m_NAtagMCTurnFightObjDead=tagMCTurnFightObjDead()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCTurnFightObjDead.Cmd,m_NAtagMCTurnFightObjDead.SubCmd))] = m_NAtagMCTurnFightObjDead
+
+
+#------------------------------------------------------
+# B4 23 回合战斗角色复活 #tagMCTurnFightObjReborn
+
+class  tagMCTurnFightObjReborn(Structure):
+    _pack_ = 1
+    _fields_ = [
+                  ("Cmd", c_ubyte),
+                  ("SubCmd", c_ubyte),
+                  ("ObjID", c_int),    
+                  ("ObjType", c_ubyte),    
+                  ("HP", c_int),    # 复活后血量,求余亿部分
+                  ("HPEx", c_int),    # 复活后血量,整除亿部分
+                  ("RebornType", c_ubyte),    # 复活方式:1-灵宠技能复活;2-待扩展
+                  ("RebornValue1", c_int),    # 复活方式对应值1,由复活方式决定其值意义
+                  ("RebornValue2", c_int),    # 复活方式对应值2
+                  ]
+
+    def __init__(self):
+        self.Clear()
+        self.Cmd = 0xB4
+        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 = 0xB4
+        self.SubCmd = 0x23
+        self.ObjID = 0
+        self.ObjType = 0
+        self.HP = 0
+        self.HPEx = 0
+        self.RebornType = 0
+        self.RebornValue1 = 0
+        self.RebornValue2 = 0
+        return
+
+    def GetLength(self):
+        return sizeof(tagMCTurnFightObjReborn)
+
+    def GetBuffer(self):
+        return string_at(addressof(self), self.GetLength())
+
+    def OutputString(self):
+        DumpString = '''// B4 23 回合战斗角色复活 //tagMCTurnFightObjReborn:
+                                Cmd:%s,
+                                SubCmd:%s,
+                                ObjID:%d,
+                                ObjType:%d,
+                                HP:%d,
+                                HPEx:%d,
+                                RebornType:%d,
+                                RebornValue1:%d,
+                                RebornValue2:%d
+                                '''\
+                                %(
+                                self.Cmd,
+                                self.SubCmd,
+                                self.ObjID,
+                                self.ObjType,
+                                self.HP,
+                                self.HPEx,
+                                self.RebornType,
+                                self.RebornValue1,
+                                self.RebornValue2
+                                )
+        return DumpString
+
+
+m_NAtagMCTurnFightObjReborn=tagMCTurnFightObjReborn()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCTurnFightObjReborn.Cmd,m_NAtagMCTurnFightObjReborn.SubCmd))] = m_NAtagMCTurnFightObjReborn
+
+
+#------------------------------------------------------
+# B4 20 回合制战斗状态 #tagMCTurnFightState
+
+class  tagMCTurnFightState(Structure):
+    Head = tagHead()
+    MapID = 0    #(DWORD MapID)// 自定义地图ID,可用于绑定战斗场景功能(如野外关卡,爬塔功能,竞技场等)
+    FuncLineID = 0    #(WORD FuncLineID)
+    PlayerID = 0    #(DWORD PlayerID)// 对应玩家ID,可为0,某些功能可能有用,如竞技场
+    State = 0    #(BYTE State)// 0-起始状态标记;1-准备完毕;2-战斗中;3-战斗结束;4-结算奖励;5-结束状态标记
+    TurnNum = 0    #(BYTE TurnNum)// 当前轮次
+    TurnMax = 0    #(BYTE TurnMax)// 最大轮次
+    Len = 0    #(WORD Len)
+    Msg = ""    #(String Msg)//size = Len
+    data = None
+
+    def __init__(self):
+        self.Clear()
+        self.Head.Cmd = 0xB4
+        self.Head.SubCmd = 0x20
+        return
+
+    def ReadData(self, _lpData, _pos=0, _Len=0):
+        self.Clear()
+        _pos = self.Head.ReadData(_lpData, _pos)
+        self.MapID,_pos = CommFunc.ReadDWORD(_lpData, _pos)
+        self.FuncLineID,_pos = CommFunc.ReadWORD(_lpData, _pos)
+        self.PlayerID,_pos = CommFunc.ReadDWORD(_lpData, _pos)
+        self.State,_pos = CommFunc.ReadBYTE(_lpData, _pos)
+        self.TurnNum,_pos = CommFunc.ReadBYTE(_lpData, _pos)
+        self.TurnMax,_pos = CommFunc.ReadBYTE(_lpData, _pos)
+        self.Len,_pos = CommFunc.ReadWORD(_lpData, _pos)
+        self.Msg,_pos = CommFunc.ReadString(_lpData, _pos,self.Len)
+        return _pos
+
+    def Clear(self):
+        self.Head = tagHead()
+        self.Head.Clear()
+        self.Head.Cmd = 0xB4
+        self.Head.SubCmd = 0x20
         self.MapID = 0
         self.FuncLineID = 0
         self.PlayerID = 0
         self.State = 0
         self.TurnNum = 0
         self.TurnMax = 0
+        self.Len = 0
+        self.Msg = ""
         return
 
     def GetLength(self):
-        return sizeof(tagMCTurnFightState)
+        length = 0
+        length += self.Head.GetLength()
+        length += 4
+        length += 2
+        length += 4
+        length += 1
+        length += 1
+        length += 1
+        length += 2
+        length += len(self.Msg)
+
+        return length
 
     def GetBuffer(self):
-        return string_at(addressof(self), self.GetLength())
+        data = ''
+        data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
+        data = CommFunc.WriteDWORD(data, self.MapID)
+        data = CommFunc.WriteWORD(data, self.FuncLineID)
+        data = CommFunc.WriteDWORD(data, self.PlayerID)
+        data = CommFunc.WriteBYTE(data, self.State)
+        data = CommFunc.WriteBYTE(data, self.TurnNum)
+        data = CommFunc.WriteBYTE(data, self.TurnMax)
+        data = CommFunc.WriteWORD(data, self.Len)
+        data = CommFunc.WriteString(data, self.Len, self.Msg)
+        return data
 
     def OutputString(self):
-        DumpString = '''// B4 20 回合制战斗状态 //tagMCTurnFightState:
-                                Cmd:%s,
-                                SubCmd:%s,
+        DumpString = '''
+                                Head:%s,
                                 MapID:%d,
                                 FuncLineID:%d,
                                 PlayerID:%d,
                                 State:%d,
                                 TurnNum:%d,
-                                TurnMax:%d
+                                TurnMax:%d,
+                                Len:%d,
+                                Msg:%s
                                 '''\
                                 %(
-                                self.Cmd,
-                                self.SubCmd,
+                                self.Head.OutputString(),
                                 self.MapID,
                                 self.FuncLineID,
                                 self.PlayerID,
                                 self.State,
                                 self.TurnNum,
-                                self.TurnMax
+                                self.TurnMax,
+                                self.Len,
+                                self.Msg
                                 )
         return DumpString
 
 
 m_NAtagMCTurnFightState=tagMCTurnFightState()
-ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCTurnFightState.Cmd,m_NAtagMCTurnFightState.SubCmd))] = m_NAtagMCTurnFightState
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCTurnFightState.Head.Cmd,m_NAtagMCTurnFightState.Head.SubCmd))] = m_NAtagMCTurnFightState
 
 
 #------------------------------------------------------

--
Gitblit v1.8.0