From c939b30761259159d62bdc92320375310b3bb010 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期一, 22 四月 2019 21:11:16 +0800
Subject: [PATCH] 6459 【后端】【2.0】缥缈仙域开发单(查询副本功能线路人数信息逻辑修改,支持查询妖王地图)

---
 ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossRealmMsg.py                                     |    3 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_FBLinePlayerCnt.py |   32 +++
 ServerPython/CoreServerGroup/GameServer/Script/PyGameData.py                                                       |    2 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py                                 |    1 
 ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFB.py                                                  |   40 ++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py                                 |  128 +++++----------
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py                             |   60 -------
 ServerPython/CoreServerGroup/GameServer/Script/ChConfig.py                                                         |    3 
 ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py                                                      |  128 +++++----------
 ServerPython/CoreServerGroup/GameServer/Script/Player/ChPlayer.py                                                  |   22 ++
 ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py                                                      |    1 
 ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py                                                  |   60 -------
 12 files changed, 180 insertions(+), 300 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ChConfig.py b/ServerPython/CoreServerGroup/GameServer/Script/ChConfig.py
index 90b5dac..407f81f 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ChConfig.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ChConfig.py
@@ -706,6 +706,9 @@
 #需要动态分配线路的跨服地图
 Def_CrossDynamicLineMap = [Def_FBMapID_CrossDemonKing, Def_FBMapID_CrossGrasslandLing, Def_FBMapID_CrossGrasslandXian]
 
+#需要统计副本功能线路ID人数的跨服地图
+Def_NeedCountFBFuncLinePlayerCrossMap = [Def_FBMapID_CrossDemonKing]
+
 #同系职业枚举
 JOB_TYPY_COUNT = 5
 (
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py
index faa9c62..d77fb5f 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py
@@ -104,60 +104,74 @@
 # A0 04 查询副本功能线路人数 #tagCGGetFBLinePlayerCnt
 
 class  tagCGGetFBLinePlayerCnt(Structure):
-    _pack_ = 1
-    _fields_ = [
-                  ("Cmd", c_ubyte),
-                  ("SubCmd", c_ubyte),
-                  ("MapID", c_int),    
-                  ("FBLineID", c_ubyte),    
-                  ("IsAllLine", c_ubyte),    
-                  ]
+    Head = tagHead()
+    MapID = 0    #(DWORD MapID)
+    LineCount = 0    #(BYTE LineCount)
+    LineIDList = list()    #(vector<BYTE> LineIDList)//个数为0时代表查全部
+    data = None
 
     def __init__(self):
         self.Clear()
-        self.Cmd = 0xA0
-        self.SubCmd = 0x04
+        self.Head.Cmd = 0xA0
+        self.Head.SubCmd = 0x04
         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.LineCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
+        for i in range(self.LineCount):
+            value,_pos=CommFunc.ReadBYTE(_lpData,_pos)
+            self.LineIDList.append(value)
+        return _pos
 
     def Clear(self):
-        self.Cmd = 0xA0
-        self.SubCmd = 0x04
+        self.Head = tagHead()
+        self.Head.Clear()
+        self.Head.Cmd = 0xA0
+        self.Head.SubCmd = 0x04
         self.MapID = 0
-        self.FBLineID = 0
-        self.IsAllLine = 0
+        self.LineCount = 0
+        self.LineIDList = list()
         return
 
     def GetLength(self):
-        return sizeof(tagCGGetFBLinePlayerCnt)
+        length = 0
+        length += self.Head.GetLength()
+        length += 4
+        length += 1
+        length += 1 * self.LineCount
+
+        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.WriteBYTE(data, self.LineCount)
+        for i in range(self.LineCount):
+            data = CommFunc.WriteBYTE(data, self.LineIDList[i])
+        return data
 
     def OutputString(self):
-        DumpString = '''// A0 04 查询副本功能线路人数 //tagCGGetFBLinePlayerCnt:
-                                Cmd:%s,
-                                SubCmd:%s,
+        DumpString = '''
+                                Head:%s,
                                 MapID:%d,
-                                FBLineID:%d,
-                                IsAllLine:%d
+                                LineCount:%d,
+                                LineIDList:%s
                                 '''\
                                 %(
-                                self.Cmd,
-                                self.SubCmd,
+                                self.Head.OutputString(),
                                 self.MapID,
-                                self.FBLineID,
-                                self.IsAllLine
+                                self.LineCount,
+                                "..."
                                 )
         return DumpString
 
 
 m_NAtagCGGetFBLinePlayerCnt=tagCGGetFBLinePlayerCnt()
-ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCGGetFBLinePlayerCnt.Cmd,m_NAtagCGGetFBLinePlayerCnt.SubCmd))] = m_NAtagCGGetFBLinePlayerCnt
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCGGetFBLinePlayerCnt.Head.Cmd,m_NAtagCGGetFBLinePlayerCnt.Head.SubCmd))] = m_NAtagCGGetFBLinePlayerCnt
 
 
 #------------------------------------------------------
@@ -1346,62 +1360,6 @@
 
 m_NAtagCGQueryCompensation=tagCGQueryCompensation()
 ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCGQueryCompensation.Cmd,m_NAtagCGQueryCompensation.SubCmd))] = m_NAtagCGQueryCompensation
-
-
-#------------------------------------------------------
-# A9 05 查询副本功能线路当前玩家数 #tagCGQueryFBFuncLinePlayerCount
-
-class  tagCGQueryFBFuncLinePlayerCount(Structure):
-    _pack_ = 1
-    _fields_ = [
-                  ("Cmd", c_ubyte),
-                  ("SubCmd", c_ubyte),
-                  ("MapID", c_int),    
-                  ("FuncLineID", c_ubyte),    
-                  ]
-
-    def __init__(self):
-        self.Clear()
-        self.Cmd = 0xA9
-        self.SubCmd = 0x05
-        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 = 0xA9
-        self.SubCmd = 0x05
-        self.MapID = 0
-        self.FuncLineID = 0
-        return
-
-    def GetLength(self):
-        return sizeof(tagCGQueryFBFuncLinePlayerCount)
-
-    def GetBuffer(self):
-        return string_at(addressof(self), self.GetLength())
-
-    def OutputString(self):
-        DumpString = '''// A9 05 查询副本功能线路当前玩家数 //tagCGQueryFBFuncLinePlayerCount:
-                                Cmd:%s,
-                                SubCmd:%s,
-                                MapID:%d,
-                                FuncLineID:%d
-                                '''\
-                                %(
-                                self.Cmd,
-                                self.SubCmd,
-                                self.MapID,
-                                self.FuncLineID
-                                )
-        return DumpString
-
-
-m_NAtagCGQueryFBFuncLinePlayerCount=tagCGQueryFBFuncLinePlayerCount()
-ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCGQueryFBFuncLinePlayerCount.Cmd,m_NAtagCGQueryFBFuncLinePlayerCount.SubCmd))] = m_NAtagCGQueryFBFuncLinePlayerCount
 
 
 #------------------------------------------------------
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
index 6075342..74be579 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
@@ -2889,66 +2889,6 @@
 
 
 #------------------------------------------------------
-# A9 05 副本功能线路当前玩家数 #tagGCFBFuncLinePlayerCountInfo
-
-class  tagGCFBFuncLinePlayerCountInfo(Structure):
-    _pack_ = 1
-    _fields_ = [
-                  ("Cmd", c_ubyte),
-                  ("SubCmd", c_ubyte),
-                  ("MapID", c_int),    
-                  ("FuncLineID", c_ubyte),    
-                  ("PlayerCount", c_ubyte),    
-                  ]
-
-    def __init__(self):
-        self.Clear()
-        self.Cmd = 0xA9
-        self.SubCmd = 0x05
-        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 = 0xA9
-        self.SubCmd = 0x05
-        self.MapID = 0
-        self.FuncLineID = 0
-        self.PlayerCount = 0
-        return
-
-    def GetLength(self):
-        return sizeof(tagGCFBFuncLinePlayerCountInfo)
-
-    def GetBuffer(self):
-        return string_at(addressof(self), self.GetLength())
-
-    def OutputString(self):
-        DumpString = '''// A9 05 副本功能线路当前玩家数 //tagGCFBFuncLinePlayerCountInfo:
-                                Cmd:%s,
-                                SubCmd:%s,
-                                MapID:%d,
-                                FuncLineID:%d,
-                                PlayerCount:%d
-                                '''\
-                                %(
-                                self.Cmd,
-                                self.SubCmd,
-                                self.MapID,
-                                self.FuncLineID,
-                                self.PlayerCount
-                                )
-        return DumpString
-
-
-m_NAtagGCFBFuncLinePlayerCountInfo=tagGCFBFuncLinePlayerCountInfo()
-ChNetPackDict[eval("0x%02x%02x"%(m_NAtagGCFBFuncLinePlayerCountInfo.Cmd,m_NAtagGCFBFuncLinePlayerCountInfo.SubCmd))] = m_NAtagGCFBFuncLinePlayerCountInfo
-
-
-#------------------------------------------------------
 # A9 A9 通知好友互赠精力信息 #tagGCFriendSendEnergyInfo
 
 class  tagGCFriendSendEnergyInfo(Structure):
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossRealmMsg.py b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossRealmMsg.py
index 941b762..c6afb53 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossRealmMsg.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossRealmMsg.py
@@ -274,6 +274,9 @@
         elif msgType == ShareDefine.CrossServerMsg_SendMail:
             PlayerCompensation.CrossServerMsg_SendMail(msgData)
             
+        elif msgType == ShareDefine.CrossServerMsg_FBPlayerCount:
+            PlayerFB.CrossServerMsg_FBPlayerCount(msgData)
+            
         # 需要发送到地图服务器处理的
         elif msgType in [ShareDefine.CrossServerMsg_RebornRet, ShareDefine.CrossServerMsg_CollectNPCOK, ShareDefine.CrossServerMsg_FBEnd,
                          ShareDefine.CrossServerMsg_NPCAttackCount]:
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/Player/ChPlayer.py b/ServerPython/CoreServerGroup/GameServer/Script/Player/ChPlayer.py
index 6390293..abd0868 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/Player/ChPlayer.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/Player/ChPlayer.py
@@ -873,17 +873,29 @@
 #{
 #    tagHead        Head;
 #    DWORD        MapID;
-#    BYTE        FBLineID;
-#    BYTE        IsAllLine;
+#    BYTE        LineCount;
+#    BYTE        LineIDList[LineCount];    //个数为0时代表查全部
 #};
 def ClinetQueryFBLinePlayerCnt(index, clientData, tick):
     curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
     queryMapID = clientData.MapID
-    fbLineID = clientData.FBLineID
-    isAllLine = clientData.IsAllLine
+    queryFBLineIDList = clientData.LineIDList
     playerManager = GameWorld.GetPlayerManager()
     
-    sendCMD = str([queryMapID, fbLineID, isAllLine])
+    if queryMapID in ChConfig.Def_CrossMapIDList:
+        fbLinePlayerInfoDict = PyGameData.g_crossFBFuncLinePlayerCountInfo.get(queryMapID, {})
+        if not queryFBLineIDList:
+            resultInfo = [queryMapID, fbLinePlayerInfoDict]
+        else:
+            defaultInfo = [0] # 与本服结构相同,默认0人
+            queryFBLineInfo = {}
+            for lineID in queryFBLineIDList:
+                queryFBLineInfo[lineID] = fbLinePlayerInfoDict.get(lineID, defaultInfo)
+            resultInfo = [queryMapID, queryFBLineInfo]
+        QueryFBLinePlayerCntResult(curPlayer, resultInfo)
+        return
+    
+    sendCMD = str([queryMapID, queryFBLineIDList])
     playerManager.MapServer_QueryPlayer(curPlayer.GetPlayerID(), 0, 0, queryMapID,
                 'FBLinePlayerCnt', sendCMD, len(sendCMD), curPlayer.GetRouteServerIndex())
     return
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFB.py b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFB.py
index 286a645..f3e6c51 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFB.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFB.py
@@ -33,6 +33,8 @@
 import IPY_PlayerDefine
 import CrossRealmPlayer
 import CrossRealmMsg
+import ChPyNetSendPack
+import NetPackCommon
 import ShareDefine
 import CrossBoss
 
@@ -348,10 +350,16 @@
                 break
     
     key = (mapID, copyMapID)
-    PyGameData.g_crossDynamicLineCopyMapInfo.pop(key, {})
+    copyMapObj = PyGameData.g_crossDynamicLineCopyMapInfo.pop(key, {})
     
     #GameWorld.DebugLog("    PyGameData.g_crossDynamicLineInfo=%s" % PyGameData.g_crossDynamicLineInfo)
     #GameWorld.DebugLog("    PyGameData.g_crossDynamicLineCopyMapInfo=%s" % PyGameData.g_crossDynamicLineCopyMapInfo)
+    
+    playerCount = 0
+    zoneID = copyMapObj.zoneID
+    funcLineID = copyMapObj.funcLineID
+    playerCountInfo = [playerCount]
+    SyncClientServerCrossFBFuncLinePlayerCount(zoneID, mapID, funcLineID, playerCountInfo)
     return
 
 def OnCrossDynamicMapReset(msgList):
@@ -393,6 +401,26 @@
     #                   % (curPlayer.GetMapID(), mapID, copyMapID, serverGroupID), playerID)
     #GameWorld.DebugLog("    副本中的玩家ID: %s" % copyMapObj.fbPlayerDict)
     #GameWorld.DebugLog("    等待中的玩家ID: %s" % copyMapObj.waitPlayerDict)
+    
+    playerCount = len(copyMapObj.fbPlayerDict) # 等待进入的暂时不算
+    zoneID = copyMapObj.zoneID
+    funcLineID = copyMapObj.funcLineID
+    playerCountInfo = [playerCount]
+    SyncClientServerCrossFBFuncLinePlayerCount(zoneID, mapID, funcLineID, playerCountInfo)
+    return
+
+def SyncClientServerCrossFBFuncLinePlayerCount(zoneID, mapID, funcLineID, playerCountInfo):
+    ## 同步子服跨服副本功能线路人数
+    ## 注意: 此人数不是一个精确人数值,只是一个大概人数值,不用很精确,暂时只玩家进入时同步人数信息,玩家退出暂不处理 
+    mapID = GetRecordMapID(mapID)
+    if mapID not in ChConfig.Def_NeedCountFBFuncLinePlayerCrossMap:
+        return
+    zoneIpyData = CrossRealmPlayer.GetCrossZoneIpyDataByZoneID(mapID, zoneID)
+    if not zoneIpyData:
+        return
+    serverGroupIDList = zoneIpyData.GetServerGroupIDList()
+    playerCountInfo = [mapID, funcLineID, playerCountInfo]
+    CrossRealmMsg.SendMsgToClientServer(ShareDefine.CrossServerMsg_FBPlayerCount, playerCountInfo, serverGroupIDList)
     return
 
 def OnPlayerDisconnectCrossServer(curPlayer):
@@ -414,6 +442,16 @@
     #GameWorld.DebugLog("    等待中的玩家ID: %s" % copyMapObj.waitPlayerDict)
     return
 
+def CrossServerMsg_FBPlayerCount(msgData):
+    ## 收到跨服服务器同步的副本功能线路人数信息
+    
+    mapID, funcLineID, playerCountInfo = msgData
+    if mapID not in PyGameData.g_crossFBFuncLinePlayerCountInfo:
+        PyGameData.g_crossFBFuncLinePlayerCountInfo[mapID] = {}
+    fbLinePlayerInfoDict = PyGameData.g_crossFBFuncLinePlayerCountInfo[mapID]
+    fbLinePlayerInfoDict[funcLineID] = playerCountInfo
+    return
+
 ##--------------------------------------------------------------------------------------------------
 
 ## 请求进入副本分线
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/PyGameData.py b/ServerPython/CoreServerGroup/GameServer/Script/PyGameData.py
index 7b93dff..a4b0db1 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/PyGameData.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/PyGameData.py
@@ -104,3 +104,5 @@
 g_crossDynamicLineInfo = {} # 跨服动态线路信息 {dataMapID:{(zoneID, funcLineID):[CrossFuncLineInfo, CrossFuncLineInfo, ...], ...}, ...}
 g_crossDynamicLineCopyMapInfo = {} # 跨服动态线路虚拟线路信息 {(mapID, copyMapID):CrossCopyMapInfo, ...}
 
+g_crossFBFuncLinePlayerCountInfo = {} # 跨服副本功能线路人数信息,本服缓存 {mapID:{funcLineID:[playerCount], ...}, ...}
+
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py b/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py
index 321083b..752f8ea 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py
@@ -1217,6 +1217,7 @@
 CrossServerMsg_FBEnd = "FBEnd"                          # 完成跨服副本
 CrossServerMsg_NPCAttackCount = "NPCAttackCount"        # 攻击NPC次数记录
 CrossServerMsg_SendMail = "SendMail"                    # 发送邮件
+CrossServerMsg_FBPlayerCount = "FBPlayerCount"          # 副本功能线路人数同步
 
 # 子服发送跨服信息定义
 ClientServerMsg_ServerInitOK = "ServerInitOK"           # 子服启动成功
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py
index faa9c62..d77fb5f 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py
@@ -104,60 +104,74 @@
 # A0 04 查询副本功能线路人数 #tagCGGetFBLinePlayerCnt
 
 class  tagCGGetFBLinePlayerCnt(Structure):
-    _pack_ = 1
-    _fields_ = [
-                  ("Cmd", c_ubyte),
-                  ("SubCmd", c_ubyte),
-                  ("MapID", c_int),    
-                  ("FBLineID", c_ubyte),    
-                  ("IsAllLine", c_ubyte),    
-                  ]
+    Head = tagHead()
+    MapID = 0    #(DWORD MapID)
+    LineCount = 0    #(BYTE LineCount)
+    LineIDList = list()    #(vector<BYTE> LineIDList)//个数为0时代表查全部
+    data = None
 
     def __init__(self):
         self.Clear()
-        self.Cmd = 0xA0
-        self.SubCmd = 0x04
+        self.Head.Cmd = 0xA0
+        self.Head.SubCmd = 0x04
         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.LineCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
+        for i in range(self.LineCount):
+            value,_pos=CommFunc.ReadBYTE(_lpData,_pos)
+            self.LineIDList.append(value)
+        return _pos
 
     def Clear(self):
-        self.Cmd = 0xA0
-        self.SubCmd = 0x04
+        self.Head = tagHead()
+        self.Head.Clear()
+        self.Head.Cmd = 0xA0
+        self.Head.SubCmd = 0x04
         self.MapID = 0
-        self.FBLineID = 0
-        self.IsAllLine = 0
+        self.LineCount = 0
+        self.LineIDList = list()
         return
 
     def GetLength(self):
-        return sizeof(tagCGGetFBLinePlayerCnt)
+        length = 0
+        length += self.Head.GetLength()
+        length += 4
+        length += 1
+        length += 1 * self.LineCount
+
+        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.WriteBYTE(data, self.LineCount)
+        for i in range(self.LineCount):
+            data = CommFunc.WriteBYTE(data, self.LineIDList[i])
+        return data
 
     def OutputString(self):
-        DumpString = '''// A0 04 查询副本功能线路人数 //tagCGGetFBLinePlayerCnt:
-                                Cmd:%s,
-                                SubCmd:%s,
+        DumpString = '''
+                                Head:%s,
                                 MapID:%d,
-                                FBLineID:%d,
-                                IsAllLine:%d
+                                LineCount:%d,
+                                LineIDList:%s
                                 '''\
                                 %(
-                                self.Cmd,
-                                self.SubCmd,
+                                self.Head.OutputString(),
                                 self.MapID,
-                                self.FBLineID,
-                                self.IsAllLine
+                                self.LineCount,
+                                "..."
                                 )
         return DumpString
 
 
 m_NAtagCGGetFBLinePlayerCnt=tagCGGetFBLinePlayerCnt()
-ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCGGetFBLinePlayerCnt.Cmd,m_NAtagCGGetFBLinePlayerCnt.SubCmd))] = m_NAtagCGGetFBLinePlayerCnt
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCGGetFBLinePlayerCnt.Head.Cmd,m_NAtagCGGetFBLinePlayerCnt.Head.SubCmd))] = m_NAtagCGGetFBLinePlayerCnt
 
 
 #------------------------------------------------------
@@ -1346,62 +1360,6 @@
 
 m_NAtagCGQueryCompensation=tagCGQueryCompensation()
 ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCGQueryCompensation.Cmd,m_NAtagCGQueryCompensation.SubCmd))] = m_NAtagCGQueryCompensation
-
-
-#------------------------------------------------------
-# A9 05 查询副本功能线路当前玩家数 #tagCGQueryFBFuncLinePlayerCount
-
-class  tagCGQueryFBFuncLinePlayerCount(Structure):
-    _pack_ = 1
-    _fields_ = [
-                  ("Cmd", c_ubyte),
-                  ("SubCmd", c_ubyte),
-                  ("MapID", c_int),    
-                  ("FuncLineID", c_ubyte),    
-                  ]
-
-    def __init__(self):
-        self.Clear()
-        self.Cmd = 0xA9
-        self.SubCmd = 0x05
-        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 = 0xA9
-        self.SubCmd = 0x05
-        self.MapID = 0
-        self.FuncLineID = 0
-        return
-
-    def GetLength(self):
-        return sizeof(tagCGQueryFBFuncLinePlayerCount)
-
-    def GetBuffer(self):
-        return string_at(addressof(self), self.GetLength())
-
-    def OutputString(self):
-        DumpString = '''// A9 05 查询副本功能线路当前玩家数 //tagCGQueryFBFuncLinePlayerCount:
-                                Cmd:%s,
-                                SubCmd:%s,
-                                MapID:%d,
-                                FuncLineID:%d
-                                '''\
-                                %(
-                                self.Cmd,
-                                self.SubCmd,
-                                self.MapID,
-                                self.FuncLineID
-                                )
-        return DumpString
-
-
-m_NAtagCGQueryFBFuncLinePlayerCount=tagCGQueryFBFuncLinePlayerCount()
-ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCGQueryFBFuncLinePlayerCount.Cmd,m_NAtagCGQueryFBFuncLinePlayerCount.SubCmd))] = m_NAtagCGQueryFBFuncLinePlayerCount
 
 
 #------------------------------------------------------
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
index 6075342..74be579 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
@@ -2889,66 +2889,6 @@
 
 
 #------------------------------------------------------
-# A9 05 副本功能线路当前玩家数 #tagGCFBFuncLinePlayerCountInfo
-
-class  tagGCFBFuncLinePlayerCountInfo(Structure):
-    _pack_ = 1
-    _fields_ = [
-                  ("Cmd", c_ubyte),
-                  ("SubCmd", c_ubyte),
-                  ("MapID", c_int),    
-                  ("FuncLineID", c_ubyte),    
-                  ("PlayerCount", c_ubyte),    
-                  ]
-
-    def __init__(self):
-        self.Clear()
-        self.Cmd = 0xA9
-        self.SubCmd = 0x05
-        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 = 0xA9
-        self.SubCmd = 0x05
-        self.MapID = 0
-        self.FuncLineID = 0
-        self.PlayerCount = 0
-        return
-
-    def GetLength(self):
-        return sizeof(tagGCFBFuncLinePlayerCountInfo)
-
-    def GetBuffer(self):
-        return string_at(addressof(self), self.GetLength())
-
-    def OutputString(self):
-        DumpString = '''// A9 05 副本功能线路当前玩家数 //tagGCFBFuncLinePlayerCountInfo:
-                                Cmd:%s,
-                                SubCmd:%s,
-                                MapID:%d,
-                                FuncLineID:%d,
-                                PlayerCount:%d
-                                '''\
-                                %(
-                                self.Cmd,
-                                self.SubCmd,
-                                self.MapID,
-                                self.FuncLineID,
-                                self.PlayerCount
-                                )
-        return DumpString
-
-
-m_NAtagGCFBFuncLinePlayerCountInfo=tagGCFBFuncLinePlayerCountInfo()
-ChNetPackDict[eval("0x%02x%02x"%(m_NAtagGCFBFuncLinePlayerCountInfo.Cmd,m_NAtagGCFBFuncLinePlayerCountInfo.SubCmd))] = m_NAtagGCFBFuncLinePlayerCountInfo
-
-
-#------------------------------------------------------
 # A9 A9 通知好友互赠精力信息 #tagGCFriendSendEnergyInfo
 
 class  tagGCFriendSendEnergyInfo(Structure):
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_FBLinePlayerCnt.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_FBLinePlayerCnt.py
index 1e0cda1..bc9e4e7 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_FBLinePlayerCnt.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_FBLinePlayerCnt.py
@@ -43,13 +43,13 @@
     GameWorld.DebugLog("GY_Query_FBLinePlayerCnt DoLogic() query_Type=%s,query_ID=%s,packCMDList=%s,tick=%s" % \
                   (query_Type, query_ID, packCMDList, tick))
     
-    if not packCMDList or len(packCMDList) < 3:
+    if not packCMDList or len(packCMDList) < 2:
         GameWorld.DebugLog("    DoLogic() return []")
         return []
     
-    tagMapID = packCMDList[0]  # 目标地图id
-    tagFBLineID = packCMDList[1]  # 线路id
-    isAllLine = packCMDList[2]  # 查询的NPCID列表
+    tagMapID, queryFBLineIDList = packCMDList
+    tagFBLineID = 0 if not queryFBLineIDList else queryFBLineIDList[0]  # 线路id
+    isAllLine = not queryFBLineIDList  # 查询的NPCID列表
     gameWorldManager = GameWorld.GetGameWorld()
     fbLinePlayerCntDict = {}
     if tagMapID == ChConfig.Def_FBMapID_SealDemon:
@@ -63,6 +63,22 @@
                 continue
             playerCnt = playerManager.GetPlayerCount()
             fbLinePlayerCntDict[fblineID] = [playerCnt]
+            if not isAllLine:
+                break
+            
+    elif tagMapID == ChConfig.Def_FBMapID_DemonKing:
+        for index in xrange(gameWorldManager.GetGameWorldCount()):
+            gameWorld = IPY_GameWorld.IPY_GameWorld(index)
+            playerManager = gameWorld.GetMapCopyPlayerManagerByFbIndex(index)
+            fblineID = gameWorld.GetPropertyID() - 1
+            if fblineID < 0:
+                continue
+            if queryFBLineIDList and fblineID not in queryFBLineIDList:
+                continue
+            playerCnt = playerManager.GetPlayerCount()
+            fbLinePlayerCntDict[fblineID] = [playerCnt]
+            if len(queryFBLineIDList) == len(fbLinePlayerCntDict):
+                break
             
     elif tagMapID == ChConfig.Def_FBMapID_ZhuXianBoss:
         for index in xrange(gameWorldManager.GetGameWorldCount()):
@@ -76,6 +92,8 @@
             playerCnt = playerManager.GetPlayerCount()
             ownerName = GameLogic_ZhuXianBoss.GetFirstOwnerName(fblineID)
             fbLinePlayerCntDict[fblineID] = [playerCnt, ownerName]
+            if not isAllLine:
+                break
             
     elif tagMapID == ChConfig.Def_FBMapID_HorsePetBoss:
         for index in xrange(gameWorldManager.GetGameWorldCount()):
@@ -89,6 +107,9 @@
             playerCnt = playerManager.GetPlayerCount()
             hpPer = GameLogic_HorsePetBoss.GetBossRemainHPPer(fblineID, tick)
             fbLinePlayerCntDict[fblineID] = [playerCnt, str(hpPer)]
+            if not isAllLine:
+                break
+            
     elif tagMapID == ChConfig.Def_FBMapID_AllFamilyBoss:
         for index in xrange(gameWorldManager.GetGameWorldCount()):
             gameWorld = IPY_GameWorld.IPY_GameWorld(index)
@@ -101,6 +122,9 @@
             playerCnt = playerManager.GetPlayerCount()
             hpPer = GameLogic_AllFamilyBoss.GetBossRemainHPPer(tick)
             fbLinePlayerCntDict[fblineID] = [playerCnt, str(hpPer)]
+            if not isAllLine:
+                break
+            
     else:
         return
     return [tagMapID, fbLinePlayerCntDict]
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
index 321083b..752f8ea 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
@@ -1217,6 +1217,7 @@
 CrossServerMsg_FBEnd = "FBEnd"                          # 完成跨服副本
 CrossServerMsg_NPCAttackCount = "NPCAttackCount"        # 攻击NPC次数记录
 CrossServerMsg_SendMail = "SendMail"                    # 发送邮件
+CrossServerMsg_FBPlayerCount = "FBPlayerCount"          # 副本功能线路人数同步
 
 # 子服发送跨服信息定义
 ClientServerMsg_ServerInitOK = "ServerInitOK"           # 子服启动成功

--
Gitblit v1.8.0