From b0e150a77873e570c2ca672daba998c35f7a3dfa Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 15 十一月 2022 19:16:07 +0800
Subject: [PATCH] 9748 【BT7】跨服BOSS定时活动(增加常规跨服分区ID通知C010)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py |   52 +++++++++++++++++
 ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py                      |   52 +++++++++++++++++
 ServerPython/CoreServerGroup/GameServer/Script/Player/CrossRealmPlayer.py              |   23 +++++++
 3 files changed, 125 insertions(+), 2 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
index 34f3883..f7d12aa 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
@@ -15200,6 +15200,58 @@
 
 
 #------------------------------------------------------
+# C0 10 跨服所属分区信息 #tagGCCrossZoneInfo
+
+class  tagGCCrossZoneInfo(Structure):
+    _pack_ = 1
+    _fields_ = [
+                  ("Cmd", c_ubyte),
+                  ("SubCmd", c_ubyte),
+                  ("CommZoneID", c_ubyte),    # 所属常规分区ID
+                  ]
+
+    def __init__(self):
+        self.Clear()
+        self.Cmd = 0xC0
+        self.SubCmd = 0x10
+        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 = 0xC0
+        self.SubCmd = 0x10
+        self.CommZoneID = 0
+        return
+
+    def GetLength(self):
+        return sizeof(tagGCCrossZoneInfo)
+
+    def GetBuffer(self):
+        return string_at(addressof(self), self.GetLength())
+
+    def OutputString(self):
+        DumpString = '''// C0 10 跨服所属分区信息 //tagGCCrossZoneInfo:
+                                Cmd:%s,
+                                SubCmd:%s,
+                                CommZoneID:%d
+                                '''\
+                                %(
+                                self.Cmd,
+                                self.SubCmd,
+                                self.CommZoneID
+                                )
+        return DumpString
+
+
+m_NAtagGCCrossZoneInfo=tagGCCrossZoneInfo()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagGCCrossZoneInfo.Cmd,m_NAtagGCCrossZoneInfo.SubCmd))] = m_NAtagGCCrossZoneInfo
+
+
+#------------------------------------------------------
 # C0 14 幸运云购开奖记录 #tagGCLuckyCloudBuyLotteryRecInfo
 
 class  tagGCLuckyCloudBuyLotteryRec(Structure):
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/Player/CrossRealmPlayer.py b/ServerPython/CoreServerGroup/GameServer/Script/Player/CrossRealmPlayer.py
index a4815ec..a59b095 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/Player/CrossRealmPlayer.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/Player/CrossRealmPlayer.py
@@ -92,6 +92,21 @@
         ipyDataList = IpyGameDataPY.GetIpyGameDataByCondition(zoneTypeName, {"CrossZoneName":crossZoneName}, True)
     return ipyDataList
 
+def GetServerCommCrossZoneID(serverGroupID):
+    ## 获取跨服常规分区
+    zoneTypeName = "CrossZoneComm"
+    crossZoneName = GameWorld.GetCrossZoneName()
+    ipyDataList = IpyGameDataPY.GetIpyGameDataByCondition(zoneTypeName, {"CrossZoneName":crossZoneName}, True)
+    if not ipyDataList:
+        return 0
+    for ipyData in ipyDataList:
+        serverGroupIDList = ipyData.GetServerGroupIDList()
+        for serverGroupIDInfo in serverGroupIDList:
+            if (isinstance(serverGroupIDInfo, tuple) and serverGroupIDInfo[0] <= serverGroupID <= serverGroupIDInfo[1]) \
+                or (isinstance(serverGroupIDInfo, int) and serverGroupIDInfo == serverGroupID):
+                return ipyData.GetZoneID()
+    return 0
+
 def GetServerCrossZoneMapIpyData(zoneID, mapID):
     ## 获取本服对应跨服玩法分区地图信息 - 仅适用于固定地图及虚拟分线的跨服玩法
     if mapID not in ChConfig.Def_CrossZoneMapTableName:
@@ -434,6 +449,7 @@
     if not IsCrossServerOpen():
         return
     
+    Sync_CrossZoneInfo(curPlayer)
     LoginDoUnNotifyCrossMsg(curPlayer)
     return
     
@@ -467,5 +483,8 @@
         curPlayer.MapServer_QueryPlayerResult(0, 0, callName, msgInfo, len(msgInfo))
     return
 
-
-    
\ No newline at end of file
+def Sync_CrossZoneInfo(curPlayer):
+    clientPack = ChPyNetSendPack.tagGCCrossZoneInfo()
+    clientPack.CommZoneID = GetServerCommCrossZoneID(GameWorld.GetServerGroupID())
+    NetPackCommon.SendFakePack(curPlayer, clientPack)
+    return
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
index 34f3883..f7d12aa 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
@@ -15200,6 +15200,58 @@
 
 
 #------------------------------------------------------
+# C0 10 跨服所属分区信息 #tagGCCrossZoneInfo
+
+class  tagGCCrossZoneInfo(Structure):
+    _pack_ = 1
+    _fields_ = [
+                  ("Cmd", c_ubyte),
+                  ("SubCmd", c_ubyte),
+                  ("CommZoneID", c_ubyte),    # 所属常规分区ID
+                  ]
+
+    def __init__(self):
+        self.Clear()
+        self.Cmd = 0xC0
+        self.SubCmd = 0x10
+        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 = 0xC0
+        self.SubCmd = 0x10
+        self.CommZoneID = 0
+        return
+
+    def GetLength(self):
+        return sizeof(tagGCCrossZoneInfo)
+
+    def GetBuffer(self):
+        return string_at(addressof(self), self.GetLength())
+
+    def OutputString(self):
+        DumpString = '''// C0 10 跨服所属分区信息 //tagGCCrossZoneInfo:
+                                Cmd:%s,
+                                SubCmd:%s,
+                                CommZoneID:%d
+                                '''\
+                                %(
+                                self.Cmd,
+                                self.SubCmd,
+                                self.CommZoneID
+                                )
+        return DumpString
+
+
+m_NAtagGCCrossZoneInfo=tagGCCrossZoneInfo()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagGCCrossZoneInfo.Cmd,m_NAtagGCCrossZoneInfo.SubCmd))] = m_NAtagGCCrossZoneInfo
+
+
+#------------------------------------------------------
 # C0 14 幸运云购开奖记录 #tagGCLuckyCloudBuyLotteryRecInfo
 
 class  tagGCLuckyCloudBuyLotteryRec(Structure):

--
Gitblit v1.8.0