From df1375798cf673f2a88c813d944cd6346c6e7be3 Mon Sep 17 00:00:00 2001 From: hch <305670599@qq.com> Date: 星期四, 15 五月 2025 19:48:24 +0800 Subject: [PATCH] 0312 新架构一个地图就是一个服务器,增加DB管理;初版遗漏了更新旧的pymongo代码后续补充 --- ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NetPackCommon.py | 34 ++++++++++++++++++++-------------- 1 files changed, 20 insertions(+), 14 deletions(-) diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NetPackCommon.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NetPackCommon.py index 2213f4d..a51cfd4 100644 --- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NetPackCommon.py +++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NetPackCommon.py @@ -30,6 +30,7 @@ import ChPyNetSendPack import traceback import ChGameToMapPyPack +from PyMongoDB.DBCommon import CommonDefine #------------------------------------------------------------------------------- #---全局变量--- @@ -288,21 +289,26 @@ ##发送Map到GameServer的沟通包 # def SendPyPackToGameServer(sendPack): - if hasattr(sendPack, 'PlayerID'): - if sendPack.PlayerID >= 100000000: - return - routeIndex = GameWorld.GetGameWorld().GetLineNO() - #这里必须用GetRealMapID,GetMapID 实际取到的是DataMapID,在有分线的地图会问题 - mapID = GameWorld.GetGameWorld().GetRealMapID() - #先写入当前地图标识,方便GameServer回包时可以正确通知到对应地图 - data = '' - data = CommFunc.WriteBYTE(data, routeIndex) #1 - data = CommFunc.WriteDWORD(data, mapID) #4 - data = CommFunc.WriteString(data, sendPack.GetLength(), sendPack.GetBuffer()) + # if hasattr(sendPack, 'PlayerID'): + # if sendPack.PlayerID >= 100000000: + # return + # routeIndex = GameWorld.GetGameWorld().GetLineNO() + # #这里必须用GetRealMapID,GetMapID 实际取到的是DataMapID,在有分线的地图会问题 + # mapID = GameWorld.GetGameWorld().GetRealMapID() + # #先写入当前地图标识,方便GameServer回包时可以正确通知到对应地图 + # data = '' + # data = CommFunc.WriteBYTE(data, routeIndex) #1 + # data = CommFunc.WriteDWORD(data, mapID) #4 + # data = CommFunc.WriteString(data, sendPack.GetLength(), sendPack.GetBuffer()) - dataLen = 1 + 4 + sendPack.GetLength() + # dataLen = 1 + 4 + sendPack.GetLength() - GameWorld.GetGameWorld().SendGameServerGeneralPack(dataLen, data) + # GameWorld.GetGameWorld().SendGameServerGeneralPack(dataLen, data) + return - +##向地图(c++)发送数据 +# 结构体要求第一个类型为枚举 TDataServerToBalanceServer,不需要封包头,用类型做判断 +def SendPyPackToMapServerSelf(data, datalen): + GameWorld.GetGameWorld().SendPyPackToMapServerSelf(datalen, data) + return -- Gitblit v1.8.0