From dc726cc331d46a3d684ec75b03176288257fafa3 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期一, 12 八月 2024 14:18:07 +0800
Subject: [PATCH] 10245 【越南】【砍树】【主干】【港台】古宝升星修改(支持额外扣除品质碎片数量)

---
 ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py |   95 +++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 79 insertions(+), 16 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py
index 331497e..b28d832 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py
@@ -19471,18 +19471,15 @@
 #------------------------------------------------------
 # B2 17 古宝升星 #tagCMGubaoStarUp
 
-class  tagCMGubaoStarUp(Structure):
+class  tagCMGubaoPieceUse(Structure):
     _pack_ = 1
     _fields_ = [
-                  ("Cmd", c_ubyte),
-                  ("SubCmd", c_ubyte),
-                  ("GubaoID", c_ushort),    
+                  ("GubaoID", c_ushort),    # 通用碎片古宝ID
+                  ("PieceCount", c_ushort),    # 使用碎片个数
                   ]
 
     def __init__(self):
         self.Clear()
-        self.Cmd = 0xB2
-        self.SubCmd = 0x17
         return
 
     def ReadData(self, stringData, _pos=0, _len=0):
@@ -19491,33 +19488,99 @@
         return _pos + self.GetLength()
 
     def Clear(self):
-        self.Cmd = 0xB2
-        self.SubCmd = 0x17
         self.GubaoID = 0
+        self.PieceCount = 0
         return
 
     def GetLength(self):
-        return sizeof(tagCMGubaoStarUp)
+        return sizeof(tagCMGubaoPieceUse)
 
     def GetBuffer(self):
         return string_at(addressof(self), self.GetLength())
 
     def OutputString(self):
         DumpString = '''// B2 17 古宝升星 //tagCMGubaoStarUp:
-                                Cmd:%s,
-                                SubCmd:%s,
-                                GubaoID:%d
+                                GubaoID:%d,
+                                PieceCount:%d
                                 '''\
                                 %(
-                                self.Cmd,
-                                self.SubCmd,
-                                self.GubaoID
+                                self.GubaoID,
+                                self.PieceCount
+                                )
+        return DumpString
+
+
+class  tagCMGubaoStarUp(Structure):
+    Head = tagHead()
+    GubaoID = 0    #(WORD GubaoID)
+    PieceSelectCount = 0    #(BYTE PieceSelectCount)
+    CommPieceUseList = list()    #(vector<tagCMGubaoPieceUse> CommPieceUseList)// 通用古宝碎片使用列表
+    data = None
+
+    def __init__(self):
+        self.Clear()
+        self.Head.Cmd = 0xB2
+        self.Head.SubCmd = 0x17
+        return
+
+    def ReadData(self, _lpData, _pos=0, _Len=0):
+        self.Clear()
+        _pos = self.Head.ReadData(_lpData, _pos)
+        self.GubaoID,_pos = CommFunc.ReadWORD(_lpData, _pos)
+        self.PieceSelectCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
+        for i in range(self.PieceSelectCount):
+            temCommPieceUseList = tagCMGubaoPieceUse()
+            _pos = temCommPieceUseList.ReadData(_lpData, _pos)
+            self.CommPieceUseList.append(temCommPieceUseList)
+        return _pos
+
+    def Clear(self):
+        self.Head = tagHead()
+        self.Head.Clear()
+        self.Head.Cmd = 0xB2
+        self.Head.SubCmd = 0x17
+        self.GubaoID = 0
+        self.PieceSelectCount = 0
+        self.CommPieceUseList = list()
+        return
+
+    def GetLength(self):
+        length = 0
+        length += self.Head.GetLength()
+        length += 2
+        length += 1
+        for i in range(self.PieceSelectCount):
+            length += self.CommPieceUseList[i].GetLength()
+
+        return length
+
+    def GetBuffer(self):
+        data = ''
+        data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
+        data = CommFunc.WriteWORD(data, self.GubaoID)
+        data = CommFunc.WriteBYTE(data, self.PieceSelectCount)
+        for i in range(self.PieceSelectCount):
+            data = CommFunc.WriteString(data, self.CommPieceUseList[i].GetLength(), self.CommPieceUseList[i].GetBuffer())
+        return data
+
+    def OutputString(self):
+        DumpString = '''
+                                Head:%s,
+                                GubaoID:%d,
+                                PieceSelectCount:%d,
+                                CommPieceUseList:%s
+                                '''\
+                                %(
+                                self.Head.OutputString(),
+                                self.GubaoID,
+                                self.PieceSelectCount,
+                                "..."
                                 )
         return DumpString
 
 
 m_NAtagCMGubaoStarUp=tagCMGubaoStarUp()
-ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMGubaoStarUp.Cmd,m_NAtagCMGubaoStarUp.SubCmd))] = m_NAtagCMGubaoStarUp
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMGubaoStarUp.Head.Cmd,m_NAtagCMGubaoStarUp.Head.SubCmd))] = m_NAtagCMGubaoStarUp
 
 
 #------------------------------------------------------

--
Gitblit v1.8.0