From 9d5ec7599f3abe0cebb76ce1df3c3b8c4e0aa51e Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 10 二月 2026 11:40:15 +0800
Subject: [PATCH] 66 【公会】基础主体-服务端(跨服聊天;)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFamily.py |   42 +++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 41 insertions(+), 1 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFamily.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFamily.py
index de7090b..9e5032a 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFamily.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFamily.py
@@ -165,6 +165,8 @@
     PlayerLoginRefreshFamily(crossPlayer) # 必须先刷新
     Sync_RequestAddFamilyInfo(crossPlayer, False)
     PlayerTalk.NotifyTalkCache(crossPlayer, [IPY_GameWorld.tcFamily]) # 公会聊天缓存
+    if GameWorld.IsCrossServer():
+        PlayerTalk.NotifyTalkCache(crossPlayer, [IPY_GameWorld.tcCountry]) # 跨服公会聊天缓存
     PlayerFamilyTaofa.OnCrossPlayerLogin(crossPlayer)
     return
 
@@ -2023,7 +2025,7 @@
 def OnFamilyTalk(curPlayer, familyID, talkPack, tick):
     clientData, tick = None, 0
     reqDataEx = {"talkBuffer":talkPack.GetBuffer()}
-    FamilyPyPackForwarding(curPlayer, clientData, tick, "__OnFamilyTalk", reqCD=0, reqDataEx=reqDataEx)
+    FamilyPyPackForwarding(curPlayer, clientData, tick, "__OnFamilyTalk", reqDataEx=reqDataEx)
     return
 def __OnFamilyTalk(crossPlayer, clientData, tick, fromServerID=0, reqDataEx=None):
     talkBuffer = reqDataEx["talkBuffer"]
@@ -2043,6 +2045,44 @@
     PlayerTalk.DoTalkCache(channelType, playerID, content, bubbleBox, familyID)
     return
 
+def OnCrossFamilyTalk(curPlayer, talkPack, tick):
+    ## 跨服公会聊天,与跨服公会互通范围一致
+    crossServerID = DBDataMgr.GetFamilyMgr().GetCurCrossServerID()
+    if crossServerID <= 0:
+        GameWorld.DebugLog("本服公会未互通,不允许跨服聊天")
+        return
+    clientData, tick = None, 0
+    reqDataEx = {"talkBuffer":talkPack.GetBuffer()}
+    FamilyPyPackForwarding(curPlayer, clientData, tick, "__OnCrossTalk", reqDataEx=reqDataEx)
+    return
+def __OnCrossTalk(crossPlayer, clientData, tick, fromServerID=0, reqDataEx=None):
+    talkBuffer = reqDataEx["talkBuffer"]
+    playerID = crossPlayer.GetPlayerID()
+    
+    if not talkBuffer:
+        return
+    
+    familyMgr = DBDataMgr.GetFamilyMgr()
+    zoneID = familyMgr.GetZoneIDInThisServer(fromServerID)
+    if zoneID < 0:
+        GameWorld.ErrLog("找不到服务器ID在跨服中的公会分区! fromServerID=%s" % fromServerID)
+        return
+    zoneMgr = familyMgr.GetZoneFamilyMgr(zoneID)
+    serverIDList = zoneMgr.GetZoneServerIDList()
+    if not serverIDList:
+        return
+    
+    clientPack = ChPyNetSendPack.tagMCTalk()
+    clientPack.ReadData(talkBuffer)
+    CrossPlayer.SendFackPackToServerList(clientPack, serverIDList)
+    
+    # 聊天缓存
+    channelType = clientPack.ChannelType
+    content = clientPack.Content
+    bubbleBox = clientPack.BubbleBox
+    PlayerTalk.DoTalkCache(channelType, playerID, content, bubbleBox)
+    return
+
 ## -------------------------------------- 游戏服本服处理 --------------------------------------------
 '''
 为方便本服、跨服互通公会逻辑统一,公会相关数据处理统一使用 CrossPlayer,视为以前的GameServer处理,这样本服跨服的公会管理通用

--
Gitblit v1.8.0