From 5fbb5f807ca75fa69fba14ad2563892f08b4588d Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 10 二月 2026 18:28:22 +0800
Subject: [PATCH] 66 【公会】基础主体-服务端(修复改名没有同步更新名字映射关系bug;)
---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFamily.py | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 52 insertions(+), 5 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 924a4e1..6439486 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
@@ -295,6 +297,7 @@
if not member:
return
member.RefreshMemberByID(playerID)
+ Broadcast_FamilyInfo(familyID, changeMemIDList=[playerID], excludeIDList=[playerID]) # 成员信息变更
return
def FamilyPyPackForwarding(curPlayer, clientData, tick, funcName, needResult=False, reqCD=0.5, reqDataEx=None):
@@ -1593,13 +1596,19 @@
if CheckFamilyNameExists(crossPlayer, newName, fromServerID):
return
+ zoneMgr = familyMgr.GetZoneFamilyMgrByFamilyID(familyID)
+ if not zoneMgr:
+ return
+
+ if not zoneMgr.FamilyRemainName(family, newName):
+ return
+
+ if cdHours:
+ SetRenameTime(family, curTime)
+
moneyType, moneyValue = IpyGameDataPY.GetFuncEvalCfg("FamilyRename", 1)
if moneyType and moneyValue:
CrossPlayer.CostPlayerResources(crossPlayer, "FamilyRename", costMoneyDict={moneyType:moneyValue})
-
- family.SetName(newName)
- if cdHours:
- SetRenameTime(family, curTime)
crossPlayerMgr = CrossPlayer.GetCrossPlayerMgr()
for index in xrange(family.GetCount()):
@@ -2022,7 +2031,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"]
@@ -2042,6 +2051,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