From 9ec66731c8a551035958aebe1fa974a140b99cf1 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期三, 02 七月 2025 17:34:10 +0800
Subject: [PATCH] 129 【战斗】战斗系统-服务端(初版战斗,支持基础的三维属性战斗,支持简单的普攻技能、怒气技能、回血技能;主线章节关卡过关支持;阵容保存支持多阵容;)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py |  164 +++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 142 insertions(+), 22 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py
index 324f86d..4983cd7 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py
@@ -19056,9 +19056,9 @@
 
 
 #------------------------------------------------------
-# B4 12 战斗阵型保存 #tagCSHeroBattlePosSave
+# B4 12 战斗阵容保存 #tagCSHeroLineupSave
 
-class  tagCSHeroBattlePos(Structure):
+class  tagCSHeroLineupPos(Structure):
     _pack_ = 1
     _fields_ = [
                   ("ItemIndex", c_ushort),    #武将物品所在武将背包位置索引
@@ -19080,13 +19080,13 @@
         return
 
     def GetLength(self):
-        return sizeof(tagCSHeroBattlePos)
+        return sizeof(tagCSHeroLineupPos)
 
     def GetBuffer(self):
         return string_at(addressof(self), self.GetLength())
 
     def OutputString(self):
-        DumpString = '''// B4 12 战斗阵型保存 //tagCSHeroBattlePosSave:
+        DumpString = '''// B4 12 战斗阵容保存 //tagCSHeroLineupSave:
                                 ItemIndex:%d,
                                 PosNum:%d
                                 '''\
@@ -19097,11 +19097,12 @@
         return DumpString
 
 
-class  tagCSHeroBattlePosSave(Structure):
+class  tagCSHeroLineupSave(Structure):
     Head = tagHead()
-    FuncType = 0    #(BYTE FuncType)//布阵功能类型:0-默认主阵型;其他待扩展,如某个活动的防守阵型
+    LineupID = 0    #(BYTE LineupID)//阵容ID:1-主阵容;其他待扩展,如某个防守阵容
+    ShapeType = 0    #(BYTE ShapeType)//本阵容阵型,0为默认阵型,可扩展不同的阵型
     PosCnt = 0    #(BYTE PosCnt)
-    HeroPosList = list()    #(vector<tagCSHeroBattlePos> HeroPosList)// 保存的阵型,只要发送最终的阵型武将位置即可
+    HeroPosList = list()    #(vector<tagCSHeroLineupPos> HeroPosList)// 保存的阵容,只发送最终的阵容武将位置即可
     data = None
 
     def __init__(self):
@@ -19113,10 +19114,11 @@
     def ReadData(self, _lpData, _pos=0, _Len=0):
         self.Clear()
         _pos = self.Head.ReadData(_lpData, _pos)
-        self.FuncType,_pos = CommFunc.ReadBYTE(_lpData, _pos)
+        self.LineupID,_pos = CommFunc.ReadBYTE(_lpData, _pos)
+        self.ShapeType,_pos = CommFunc.ReadBYTE(_lpData, _pos)
         self.PosCnt,_pos = CommFunc.ReadBYTE(_lpData, _pos)
         for i in range(self.PosCnt):
-            temHeroPosList = tagCSHeroBattlePos()
+            temHeroPosList = tagCSHeroLineupPos()
             _pos = temHeroPosList.ReadData(_lpData, _pos)
             self.HeroPosList.append(temHeroPosList)
         return _pos
@@ -19126,7 +19128,8 @@
         self.Head.Clear()
         self.Head.Cmd = 0xB4
         self.Head.SubCmd = 0x12
-        self.FuncType = 0
+        self.LineupID = 0
+        self.ShapeType = 0
         self.PosCnt = 0
         self.HeroPosList = list()
         return
@@ -19134,6 +19137,7 @@
     def GetLength(self):
         length = 0
         length += self.Head.GetLength()
+        length += 1
         length += 1
         length += 1
         for i in range(self.PosCnt):
@@ -19144,7 +19148,8 @@
     def GetBuffer(self):
         data = ''
         data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
-        data = CommFunc.WriteBYTE(data, self.FuncType)
+        data = CommFunc.WriteBYTE(data, self.LineupID)
+        data = CommFunc.WriteBYTE(data, self.ShapeType)
         data = CommFunc.WriteBYTE(data, self.PosCnt)
         for i in range(self.PosCnt):
             data = CommFunc.WriteString(data, self.HeroPosList[i].GetLength(), self.HeroPosList[i].GetBuffer())
@@ -19153,21 +19158,79 @@
     def OutputString(self):
         DumpString = '''
                                 Head:%s,
-                                FuncType:%d,
+                                LineupID:%d,
+                                ShapeType:%d,
                                 PosCnt:%d,
                                 HeroPosList:%s
                                 '''\
                                 %(
                                 self.Head.OutputString(),
-                                self.FuncType,
+                                self.LineupID,
+                                self.ShapeType,
                                 self.PosCnt,
                                 "..."
                                 )
         return DumpString
 
 
-m_NAtagCSHeroBattlePosSave=tagCSHeroBattlePosSave()
-ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCSHeroBattlePosSave.Head.Cmd,m_NAtagCSHeroBattlePosSave.Head.SubCmd))] = m_NAtagCSHeroBattlePosSave
+m_NAtagCSHeroLineupSave=tagCSHeroLineupSave()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCSHeroLineupSave.Head.Cmd,m_NAtagCSHeroLineupSave.Head.SubCmd))] = m_NAtagCSHeroLineupSave
+
+
+#------------------------------------------------------
+# B4 13 主线战斗请求 #tagCSMainFightReq
+
+class  tagCSMainFightReq(Structure):
+    _pack_ = 1
+    _fields_ = [
+                  ("Cmd", c_ubyte),
+                  ("SubCmd", c_ubyte),
+                  ("ReqType", c_ubyte),    # 0-停止战斗回城;1-设置消耗倍值;2-挑战小怪;3-挑战boss;4-下一段战报;5-下一队;
+                  ("ReqValue", c_int),    # 请求值,ReqType为1时发送消耗倍值
+                  ]
+
+    def __init__(self):
+        self.Clear()
+        self.Cmd = 0xB4
+        self.SubCmd = 0x13
+        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 = 0x13
+        self.ReqType = 0
+        self.ReqValue = 0
+        return
+
+    def GetLength(self):
+        return sizeof(tagCSMainFightReq)
+
+    def GetBuffer(self):
+        return string_at(addressof(self), self.GetLength())
+
+    def OutputString(self):
+        DumpString = '''// B4 13 主线战斗请求 //tagCSMainFightReq:
+                                Cmd:%s,
+                                SubCmd:%s,
+                                ReqType:%d,
+                                ReqValue:%d
+                                '''\
+                                %(
+                                self.Cmd,
+                                self.SubCmd,
+                                self.ReqType,
+                                self.ReqValue
+                                )
+        return DumpString
+
+
+m_NAtagCSMainFightReq=tagCSMainFightReq()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCSMainFightReq.Cmd,m_NAtagCSMainFightReq.SubCmd))] = m_NAtagCSMainFightReq
 
 
 #------------------------------------------------------
@@ -20267,10 +20330,10 @@
 
 class  tagCMTurnFight(Structure):
     Head = tagHead()
-    MapID = 0    #(DWORD MapID)// 自定义地图ID,可用于绑定战斗场景功能(如野外关卡,爬塔功能,竞技场等)
-    FuncLineID = 0    #(WORD FuncLineID)
-    TagType = 0    #(BYTE TagType)// 战斗目标类型,0-NPC,1-玩家,2-队伍
-    TagID = 0    #(DWORD TagID)// 战斗目标类型对应的ID
+    MapID = 0    #(DWORD MapID)// 自定义地图ID,可用于绑定战斗地图场景功能(如主线关卡、主线boss、爬塔、竞技场等)
+    FuncLineID = 0    #(DWORD FuncLineID)// MapID对应的扩展值,如具体某个关卡等
+    TagType = 0    #(BYTE TagType)// 目标类型,0-NPC阵容,1-玩家
+    TagID = 0    #(DWORD TagID)// 目标类型对应的ID,如阵容ID或玩家ID
     ValueCount = 0    #(BYTE ValueCount)
     ValueList = list()    #(vector<DWORD> ValueList)// 附加值列表,可选,具体含义由MapID决定
     data = None
@@ -20285,7 +20348,7 @@
         self.Clear()
         _pos = self.Head.ReadData(_lpData, _pos)
         self.MapID,_pos = CommFunc.ReadDWORD(_lpData, _pos)
-        self.FuncLineID,_pos = CommFunc.ReadWORD(_lpData, _pos)
+        self.FuncLineID,_pos = CommFunc.ReadDWORD(_lpData, _pos)
         self.TagType,_pos = CommFunc.ReadBYTE(_lpData, _pos)
         self.TagID,_pos = CommFunc.ReadDWORD(_lpData, _pos)
         self.ValueCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
@@ -20311,7 +20374,7 @@
         length = 0
         length += self.Head.GetLength()
         length += 4
-        length += 2
+        length += 4
         length += 1
         length += 4
         length += 1
@@ -20323,7 +20386,7 @@
         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.FuncLineID)
         data = CommFunc.WriteBYTE(data, self.TagType)
         data = CommFunc.WriteDWORD(data, self.TagID)
         data = CommFunc.WriteBYTE(data, self.ValueCount)
@@ -20358,6 +20421,63 @@
 
 
 #------------------------------------------------------
+# B4 14 查看战报 #tagCSTurnFightReportView
+
+class  tagCSTurnFightReportView(Structure):
+    Head = tagHead()
+    GUID = ""    #(char GUID[40])//战报guid
+    data = None
+
+    def __init__(self):
+        self.Clear()
+        self.Head.Cmd = 0xB4
+        self.Head.SubCmd = 0x14
+        return
+
+    def ReadData(self, _lpData, _pos=0, _Len=0):
+        self.Clear()
+        _pos = self.Head.ReadData(_lpData, _pos)
+        self.GUID,_pos = CommFunc.ReadString(_lpData, _pos,40)
+        return _pos
+
+    def Clear(self):
+        self.Head = tagHead()
+        self.Head.Clear()
+        self.Head.Cmd = 0xB4
+        self.Head.SubCmd = 0x14
+        self.GUID = ""
+        return
+
+    def GetLength(self):
+        length = 0
+        length += self.Head.GetLength()
+        length += 40
+
+        return length
+
+    def GetBuffer(self):
+        data = ''
+        data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
+        data = CommFunc.WriteString(data, 40, self.GUID)
+        return data
+
+    def OutputString(self):
+        DumpString = '''
+                                Head:%s,
+                                GUID:%s
+                                '''\
+                                %(
+                                self.Head.OutputString(),
+                                self.GUID
+                                )
+        return DumpString
+
+
+m_NAtagCSTurnFightReportView=tagCSTurnFightReportView()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCSTurnFightReportView.Head.Cmd,m_NAtagCSTurnFightReportView.Head.SubCmd))] = m_NAtagCSTurnFightReportView
+
+
+#------------------------------------------------------
 # B5 18 拍卖行修改关注物品 #tagCGAttentionAuctionItemChange
 
 class  tagCGAttentionAuctionItemChange(Structure):

--
Gitblit v1.8.0