From a9415978e2c4b94debfb59787771e1434a1adf19 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期三, 10 四月 2024 13:58:44 +0800
Subject: [PATCH] 10130 【后端】福地争夺资源功能(增加摇人功能)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py |   78 ++++++++++++++++++++++++++------------
 1 files changed, 53 insertions(+), 25 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py
index 52f7c44..c8826b9 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py
@@ -20891,60 +20891,88 @@
 # B4 10 回合制战斗 #tagCMTurnFight
 
 class  tagCMTurnFight(Structure):
-    _pack_ = 1
-    _fields_ = [
-                  ("Cmd", c_ubyte),
-                  ("SubCmd", c_ubyte),
-                  ("MapID", c_int),    # 自定义地图ID,可用于绑定战斗场景功能(如野外关卡,爬塔功能,竞技场等)
-                  ("FuncLineID", c_ushort),    
-                  ("PlayerID", c_int),    # 对应玩家ID,可为0,某些功能可能有用,如竞技场
-                  ]
+    Head = tagHead()
+    MapID = 0    #(DWORD MapID)// 自定义地图ID,可用于绑定战斗场景功能(如野外关卡,爬塔功能,竞技场等)
+    FuncLineID = 0    #(WORD FuncLineID)
+    PlayerID = 0    #(DWORD PlayerID)// 战斗目标玩家ID,可为0,某些功能可能有用,如竞技场
+    ValueCount = 0    #(BYTE ValueCount)
+    ValueList = list()    #(vector<DWORD> ValueList)// 附加值列表,可选,具体含义由MapID决定
+    data = None
 
     def __init__(self):
         self.Clear()
-        self.Cmd = 0xB4
-        self.SubCmd = 0x10
+        self.Head.Cmd = 0xB4
+        self.Head.SubCmd = 0x10
         return
 
-    def ReadData(self, stringData, _pos=0, _len=0):
+    def ReadData(self, _lpData, _pos=0, _Len=0):
         self.Clear()
-        memmove(addressof(self), stringData[_pos:], self.GetLength())
-        return _pos + self.GetLength()
+        _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.ValueCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
+        for i in range(self.ValueCount):
+            value,_pos=CommFunc.ReadDWORD(_lpData,_pos)
+            self.ValueList.append(value)
+        return _pos
 
     def Clear(self):
-        self.Cmd = 0xB4
-        self.SubCmd = 0x10
+        self.Head = tagHead()
+        self.Head.Clear()
+        self.Head.Cmd = 0xB4
+        self.Head.SubCmd = 0x10
         self.MapID = 0
         self.FuncLineID = 0
         self.PlayerID = 0
+        self.ValueCount = 0
+        self.ValueList = list()
         return
 
     def GetLength(self):
-        return sizeof(tagCMTurnFight)
+        length = 0
+        length += self.Head.GetLength()
+        length += 4
+        length += 2
+        length += 4
+        length += 1
+        length += 4 * self.ValueCount
+
+        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.ValueCount)
+        for i in range(self.ValueCount):
+            data = CommFunc.WriteDWORD(data, self.ValueList[i])
+        return data
 
     def OutputString(self):
-        DumpString = '''// B4 10 回合制战斗 //tagCMTurnFight:
-                                Cmd:%s,
-                                SubCmd:%s,
+        DumpString = '''
+                                Head:%s,
                                 MapID:%d,
                                 FuncLineID:%d,
-                                PlayerID:%d
+                                PlayerID:%d,
+                                ValueCount:%d,
+                                ValueList:%s
                                 '''\
                                 %(
-                                self.Cmd,
-                                self.SubCmd,
+                                self.Head.OutputString(),
                                 self.MapID,
                                 self.FuncLineID,
-                                self.PlayerID
+                                self.PlayerID,
+                                self.ValueCount,
+                                "..."
                                 )
         return DumpString
 
 
 m_NAtagCMTurnFight=tagCMTurnFight()
-ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMTurnFight.Cmd,m_NAtagCMTurnFight.SubCmd))] = m_NAtagCMTurnFight
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMTurnFight.Head.Cmd,m_NAtagCMTurnFight.Head.SubCmd))] = m_NAtagCMTurnFight
 
 
 #------------------------------------------------------

--
Gitblit v1.8.0