From be15b990ac94f5c24dfc8077e5dc62ce79236c43 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期六, 22 十二月 2018 18:09:05 +0800
Subject: [PATCH] 5424 【后端】【1.4】跨服竞技场开发(修复无法收到匹配请求bug,修改发送子服信息模式)

---
 ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py |  195 +++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 188 insertions(+), 7 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
index b6309d3..3d2aed2 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
@@ -8047,6 +8047,176 @@
 
 
 #------------------------------------------------------
+# C0 05 跨服PK赛季排行榜 #tagGCCrossRealmPKBillboardInfo
+
+class  tagGCCrossRealmPKBillboardData(Structure):
+    PlayerID = 0    #(DWORD PlayerID)
+    NameLen = 0    #(BYTE NameLen)
+    PlayerName = ""    #(String PlayerName)
+    Job = 0    #(BYTE Job)
+    FightPower = 0    #(DWORD FightPower)
+    RealmLV = 0    #(WORD RealmLV)
+    PKScore = 0    #(DWORD PKScore)
+    DanLV = 0    #(BYTE DanLV)
+    data = None
+
+    def __init__(self):
+        self.Clear()
+        return
+
+    def ReadData(self, _lpData, _pos=0, _Len=0):
+        self.Clear()
+        self.PlayerID,_pos = CommFunc.ReadDWORD(_lpData, _pos)
+        self.NameLen,_pos = CommFunc.ReadBYTE(_lpData, _pos)
+        self.PlayerName,_pos = CommFunc.ReadString(_lpData, _pos,self.NameLen)
+        self.Job,_pos = CommFunc.ReadBYTE(_lpData, _pos)
+        self.FightPower,_pos = CommFunc.ReadDWORD(_lpData, _pos)
+        self.RealmLV,_pos = CommFunc.ReadWORD(_lpData, _pos)
+        self.PKScore,_pos = CommFunc.ReadDWORD(_lpData, _pos)
+        self.DanLV,_pos = CommFunc.ReadBYTE(_lpData, _pos)
+        return _pos
+
+    def Clear(self):
+        self.PlayerID = 0
+        self.NameLen = 0
+        self.PlayerName = ""
+        self.Job = 0
+        self.FightPower = 0
+        self.RealmLV = 0
+        self.PKScore = 0
+        self.DanLV = 0
+        return
+
+    def GetLength(self):
+        length = 0
+        length += 4
+        length += 1
+        length += len(self.PlayerName)
+        length += 1
+        length += 4
+        length += 2
+        length += 4
+        length += 1
+
+        return length
+
+    def GetBuffer(self):
+        data = ''
+        data = CommFunc.WriteDWORD(data, self.PlayerID)
+        data = CommFunc.WriteBYTE(data, self.NameLen)
+        data = CommFunc.WriteString(data, self.NameLen, self.PlayerName)
+        data = CommFunc.WriteBYTE(data, self.Job)
+        data = CommFunc.WriteDWORD(data, self.FightPower)
+        data = CommFunc.WriteWORD(data, self.RealmLV)
+        data = CommFunc.WriteDWORD(data, self.PKScore)
+        data = CommFunc.WriteBYTE(data, self.DanLV)
+        return data
+
+    def OutputString(self):
+        DumpString = '''
+                                PlayerID:%d,
+                                NameLen:%d,
+                                PlayerName:%s,
+                                Job:%d,
+                                FightPower:%d,
+                                RealmLV:%d,
+                                PKScore:%d,
+                                DanLV:%d
+                                '''\
+                                %(
+                                self.PlayerID,
+                                self.NameLen,
+                                self.PlayerName,
+                                self.Job,
+                                self.FightPower,
+                                self.RealmLV,
+                                self.PKScore,
+                                self.DanLV
+                                )
+        return DumpString
+
+
+class  tagGCCrossRealmPKBillboardInfo(Structure):
+    Head = tagHead()
+    ZoneID = 0    #(BYTE ZoneID)// 赛区ID    
+    SeasonID = 0    #(BYTE SeasonID)// 赛季ID    
+    Count = 0    #(WORD Count)
+    PKBillboardList = list()    #(vector<tagGCCrossRealmPKBillboardData> PKBillboardList)
+    data = None
+
+    def __init__(self):
+        self.Clear()
+        self.Head.Cmd = 0xC0
+        self.Head.SubCmd = 0x05
+        return
+
+    def ReadData(self, _lpData, _pos=0, _Len=0):
+        self.Clear()
+        _pos = self.Head.ReadData(_lpData, _pos)
+        self.ZoneID,_pos = CommFunc.ReadBYTE(_lpData, _pos)
+        self.SeasonID,_pos = CommFunc.ReadBYTE(_lpData, _pos)
+        self.Count,_pos = CommFunc.ReadWORD(_lpData, _pos)
+        for i in range(self.Count):
+            temPKBillboardList = tagGCCrossRealmPKBillboardData()
+            _pos = temPKBillboardList.ReadData(_lpData, _pos)
+            self.PKBillboardList.append(temPKBillboardList)
+        return _pos
+
+    def Clear(self):
+        self.Head = tagHead()
+        self.Head.Clear()
+        self.Head.Cmd = 0xC0
+        self.Head.SubCmd = 0x05
+        self.ZoneID = 0
+        self.SeasonID = 0
+        self.Count = 0
+        self.PKBillboardList = list()
+        return
+
+    def GetLength(self):
+        length = 0
+        length += self.Head.GetLength()
+        length += 1
+        length += 1
+        length += 2
+        for i in range(self.Count):
+            length += self.PKBillboardList[i].GetLength()
+
+        return length
+
+    def GetBuffer(self):
+        data = ''
+        data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
+        data = CommFunc.WriteBYTE(data, self.ZoneID)
+        data = CommFunc.WriteBYTE(data, self.SeasonID)
+        data = CommFunc.WriteWORD(data, self.Count)
+        for i in range(self.Count):
+            data = CommFunc.WriteString(data, self.PKBillboardList[i].GetLength(), self.PKBillboardList[i].GetBuffer())
+        return data
+
+    def OutputString(self):
+        DumpString = '''
+                                Head:%s,
+                                ZoneID:%d,
+                                SeasonID:%d,
+                                Count:%d,
+                                PKBillboardList:%s
+                                '''\
+                                %(
+                                self.Head.OutputString(),
+                                self.ZoneID,
+                                self.SeasonID,
+                                self.Count,
+                                "..."
+                                )
+        return DumpString
+
+
+m_NAtagGCCrossRealmPKBillboardInfo=tagGCCrossRealmPKBillboardInfo()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagGCCrossRealmPKBillboardInfo.Head.Cmd,m_NAtagGCCrossRealmPKBillboardInfo.Head.SubCmd))] = m_NAtagGCCrossRealmPKBillboardInfo
+
+
+#------------------------------------------------------
 # C0 01 跨服PK匹配成功 #tagGCCrossRealmPKMatchOK
 
 class  tagGCCrossRealmPKMatchPlayer(Structure):
@@ -8127,7 +8297,8 @@
     RoomID = 0    #(WORD RoomID)// 房间ID
     NameLen = 0    #(BYTE NameLen)
     PlayerName = ""    #(String PlayerName)// 跨服名字
-    MatchPlayer=tagGCCrossRealmPKMatchPlayer()    #(tagGCCrossRealmPKMatchPlayer MatchPlayer)// 匹配到的玩家
+    MatchPlayerCount = 0    #(BYTE MatchPlayerCount)
+    MatchPlayer = list()    #(vector<tagGCCrossRealmPKMatchPlayer> MatchPlayer)// 匹配到的玩家
     data = None
 
     def __init__(self):
@@ -8142,7 +8313,11 @@
         self.RoomID,_pos = CommFunc.ReadWORD(_lpData, _pos)
         self.NameLen,_pos = CommFunc.ReadBYTE(_lpData, _pos)
         self.PlayerName,_pos = CommFunc.ReadString(_lpData, _pos,self.NameLen)
-        _pos = self.MatchPlayer.ReadData(_lpData,_pos)
+        self.MatchPlayerCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
+        for i in range(self.MatchPlayerCount):
+            temMatchPlayer = tagGCCrossRealmPKMatchPlayer()
+            _pos = temMatchPlayer.ReadData(_lpData, _pos)
+            self.MatchPlayer.append(temMatchPlayer)
         return _pos
 
     def Clear(self):
@@ -8153,8 +8328,8 @@
         self.RoomID = 0
         self.NameLen = 0
         self.PlayerName = ""
-        self.MatchPlayer=tagGCCrossRealmPKMatchPlayer()
-        self.MatchPlayer.Clear()
+        self.MatchPlayerCount = 0
+        self.MatchPlayer = list()
         return
 
     def GetLength(self):
@@ -8163,7 +8338,9 @@
         length += 2
         length += 1
         length += len(self.PlayerName)
-        length += self.MatchPlayer.GetLength()
+        length += 1
+        for i in range(self.MatchPlayerCount):
+            length += self.MatchPlayer[i].GetLength()
 
         return length
 
@@ -8173,7 +8350,9 @@
         data = CommFunc.WriteWORD(data, self.RoomID)
         data = CommFunc.WriteBYTE(data, self.NameLen)
         data = CommFunc.WriteString(data, self.NameLen, self.PlayerName)
-        data = CommFunc.WriteString(data,self.MatchPlayer.GetLength(),self.MatchPlayer.GetBuffer())
+        data = CommFunc.WriteBYTE(data, self.MatchPlayerCount)
+        for i in range(self.MatchPlayerCount):
+            data = CommFunc.WriteString(data, self.MatchPlayer[i].GetLength(), self.MatchPlayer[i].GetBuffer())
         return data
 
     def OutputString(self):
@@ -8182,6 +8361,7 @@
                                 RoomID:%d,
                                 NameLen:%d,
                                 PlayerName:%s,
+                                MatchPlayerCount:%d,
                                 MatchPlayer:%s
                                 '''\
                                 %(
@@ -8189,7 +8369,8 @@
                                 self.RoomID,
                                 self.NameLen,
                                 self.PlayerName,
-                                self.MatchPlayer.OutputString()
+                                self.MatchPlayerCount,
+                                "..."
                                 )
         return DumpString
 

--
Gitblit v1.8.0