From 93a031366b3d30fd19c36afad29e8e9e260b65eb Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期一, 23 五月 2022 17:00:28 +0800
Subject: [PATCH] 9415 【BT】【后端】古神战场(修复分流到非32060地图时准备时间进场无法在地图中间坐标范围bug;增加跨服分流地图请求、进入、退出流向)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBLogic.py                    |   28 +++++++++++++-
 ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFB.py                                                |   27 ++++++++-----
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_CrossRealmReg.py |    4 +
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/GameWorldProcess.py           |    5 +-
 ServerPython/CoreServerGroup/GameServer/Script/Player/CrossRealmPlayer.py                                        |    2 +
 5 files changed, 50 insertions(+), 16 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/Player/CrossRealmPlayer.py b/ServerPython/CoreServerGroup/GameServer/Script/Player/CrossRealmPlayer.py
index e3c3ef0..d25d85e 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/Player/CrossRealmPlayer.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/Player/CrossRealmPlayer.py
@@ -196,6 +196,8 @@
 
 def SendCrossRealmReg(curPlayer, registerMap, mapID=0, dataMapID=0, copyMapID=0, posX=0, posY=0, lineID=0):
     # 发送跨服账号注册上传数据
+    # @param mapID: 真实场景地图ID
+    # @param dataMapID: 真实场景地图ID对应场景数据地图ID
     
     # 设置上传数据的活动类型
     curPlayer.SetDict(ChConfig.Def_PlayerKey_CrossRegisterMap, registerMap)
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFB.py b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFB.py
index 927e896..7f38e29 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFB.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerFB.py
@@ -33,6 +33,7 @@
 import IPY_PlayerDefine
 import CrossBattlefield
 import CrossRealmPlayer
+import DataRecordPack
 import CrossRealmMsg
 import ShareDefine
 import CrossBoss
@@ -261,21 +262,25 @@
     if openState == IPY_PlayerDefine.fbosOpen:
         funcLineID = tagCopyMapObj.funcLineID
         playerIDList = [playerID]
-        retInfo = [playerIDList, mapID, realMapID, copyMapID, funcLineID]
+        # 分流地图的地图数据ID直接使用场景ID,因为分流地图实际上是两张不同的地图,所以直接使用场景ID,不然会导致上传跨服玩家数据时坐标为0
+        retInfo = [playerIDList, mapID, realMapID, realMapID, copyMapID, funcLineID]
         CrossRealmMsg.SendMsgToClientServer(ShareDefine.CrossServerMsg_EnterFBRet, retInfo, [serverGroupID])
         
+    dataDict = {}
+    dataDict.update(msgData)
+    dataDict.update({"mapID":mapID, "realMapID":realMapID, "copyMapID":copyMapID, "realFuncLineID":funcLineID, "openState":openState})
+    DataRecordPack.SendEventPack("CrossFBRequest", dataDict)
     return tagCopyMapObj
 
 def CrossServerMsg_EnterFBRet(msgData, tick):
     ## 收到跨服服务器动态分配的跨服副本进入信息
-    
-    playerIDList, dataMapID, mapID, copyMapID, funcLineID = msgData
+    playerIDList, dataMapID, mapID, realMapID, copyMapID, funcLineID = msgData
     
     for playerID in playerIDList:
         curPlayer = GameWorld.GetPlayerManager().FindPlayerByID(playerID)
         if not curPlayer:
             continue
-        CrossRealmPlayer.SendCrossRealmReg(curPlayer, dataMapID, mapID, dataMapID, copyMapID, lineID=funcLineID)
+        CrossRealmPlayer.SendCrossRealmReg(curPlayer, dataMapID, realMapID, mapID, copyMapID, lineID=funcLineID)
         
     return
 
@@ -501,7 +506,7 @@
     return 0
 
 def OnCrossDynamicLineStateChange(msgList):
-    realMapID, copyMapID, state = msgList[:3]
+    mapID, realMapID, copyMapID, state = msgList[:4]
     
     if state == IPY_PlayerDefine.fbosWaitForClose:
         funcLineDataCache = msgList[3]
@@ -509,11 +514,11 @@
     elif state == IPY_PlayerDefine.fbosClosed:
         OnCrossDynamicLineClose(realMapID, copyMapID)
     elif state == IPY_PlayerDefine.fbosOpen:
-        OnCrossDynamicLineOpen(realMapID, copyMapID)
+        OnCrossDynamicLineOpen(mapID, realMapID, copyMapID)
         
     return
 
-def OnCrossDynamicLineOpen(realMapID, copyMapID):
+def OnCrossDynamicLineOpen(mapID, realMapID, copyMapID):
     ## 动态分配线路的地图虚拟线路启动成功
     
     key = (realMapID, copyMapID)
@@ -532,11 +537,11 @@
         playerIDList = serverPlayerIDListDict[serverGroupID]
         playerIDList.append(playerID)
         
-    mapID = GetRecordMapID(realMapID)
-    GameWorld.Log("动态分配虚拟线路启动成功,通知子服等待玩家可进入: mapID=%s,realMapID=%s,copyMapID=%s,serverPlayerIDListDict=%s" 
-                  % (mapID, realMapID, copyMapID, serverPlayerIDListDict))
+    recordMapID = GetRecordMapID(realMapID)
+    GameWorld.Log("动态分配虚拟线路启动成功,通知子服等待玩家可进入: recordMapID=%s,mapID=%s,realMapID=%s,copyMapID=%s,serverPlayerIDListDict=%s" 
+                  % (recordMapID, mapID, realMapID, copyMapID, serverPlayerIDListDict))
     for serverGroupID, playerIDList in serverPlayerIDListDict.items():
-        retInfo = [playerIDList, mapID, realMapID, copyMapID, funcLineID]
+        retInfo = [playerIDList, recordMapID, mapID, realMapID, copyMapID, funcLineID]
         CrossRealmMsg.SendMsgToClientServer(ShareDefine.CrossServerMsg_EnterFBRet, retInfo, [serverGroupID])
         
     #GameWorld.DebugLog("    PyGameData.g_crossDynamicLineInfo=%s" % PyGameData.g_crossDynamicLineInfo)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBLogic.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBLogic.py
index 6951c7d..c4dcefd 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBLogic.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBLogic.py
@@ -19,6 +19,7 @@
 import PlayerControl
 import GameWorldProcess
 import CrossRealmPlayer
+import DataRecordPack
 import PlayerSuccess
 import ReadChConfig
 import PlayerAssist
@@ -508,6 +509,10 @@
     if GameWorld.IsCrossServer():
         mapID = GameWorld.GetMap().GetMapID()
         mapID = FBCommon.GetRecordMapID(mapID)
+        gameWorld = GameWorld.GetGameWorld()
+        copyMapID = gameWorld.GetCopyMapID()
+        dataDict = {"PlayerID":curPlayer.GetPlayerID(), "PlayerName":curPlayer.GetPlayerName(), "AccID":curPlayer.GetAccID(), 
+                    "recordMapID":mapID, "mapID":GameWorld.GetMap().GetMapID(), "realMapID":gameWorld.GetRealMapID(), "copyMapID":copyMapID}
         if mapID in ChConfig.Def_CrossDynamicLineMap:
             fbZoneID = FBCommon.GetCrossDynamicLineMapZoneID()
             fbFuncLineID = FBCommon.GetCrossDynamicLineMapFuncLineID()
@@ -517,16 +522,18 @@
                 GameWorld.ErrLog("DoEnterFB 玩家与当前副本线路所属分区或功能分线不同,踢出玩家!fbZoneID=%s,playerZoneID=%s,fbFuncLineID=%s,playerFuncLineID=%s" 
                                  % (fbZoneID, playerZoneID, fbFuncLineID, playerFuncLineID), curPlayerID)
                 CrossRealmPlayer.PlayerExitCrossServer(curPlayer)
+                dataDict.update({"Error":"zoneLineIDError"})
+                DataRecordPack.SendEventPack("CrossFBEnter", dataDict, curPlayer)
                 return
             GameWorld.Log("玩家进入跨服副本动态分配的线路: fbZoneID=%s,playerZoneID=%s,fbFuncLineID=%s,playerFuncLineID=%s" 
                           % (fbZoneID, playerZoneID, fbFuncLineID, playerFuncLineID), curPlayerID)
+            dataDict.update({"fbZoneID":fbZoneID, "fbFuncLineID":fbFuncLineID, "playerZoneID":playerZoneID, "playerFuncLineID":playerFuncLineID})
             
-        gameWorld = GameWorld.GetGameWorld()
-        copyMapID = gameWorld.GetCopyMapID()
         if copyMapID not in PyGameData.g_crossPlayerServerGroupIDInfo:
             PyGameData.g_crossPlayerServerGroupIDInfo[copyMapID] = {}
         playerServerGroupIDDict = PyGameData.g_crossPlayerServerGroupIDInfo[copyMapID]
         playerServerGroupIDDict[curPlayerID] = PlayerControl.GetPlayerServerGroupID(curPlayer)
+        DataRecordPack.SendEventPack("CrossFBEnter", dataDict, curPlayer)
         
     # 自伸缩副本根据玩家进入开启,主动调用一次,避免间隔调用时机未触发导致逻辑错乱
     GameWorldProcess.EnterOpenFB(tick)
@@ -742,6 +749,23 @@
 #  @return None
 #  @remarks 函数详细说明.
 def DoExitFBLogic(curPlayer, tick):
+    if GameWorld.IsCrossServer():
+        mapID = GameWorld.GetMap().GetMapID()
+        mapID = FBCommon.GetRecordMapID(mapID)
+        gameWorld = GameWorld.GetGameWorld()
+        copyMapID = gameWorld.GetCopyMapID()
+        dataDict = {"PlayerID":curPlayer.GetPlayerID(), "PlayerName":curPlayer.GetPlayerName(), "AccID":curPlayer.GetAccID(), 
+                    "recordMapID":mapID, "mapID":GameWorld.GetMap().GetMapID(), "realMapID":gameWorld.GetRealMapID(), "copyMapID":copyMapID}
+        if mapID in ChConfig.Def_CrossDynamicLineMap:
+            fbZoneID = FBCommon.GetCrossDynamicLineMapZoneID()
+            fbFuncLineID = FBCommon.GetCrossDynamicLineMapFuncLineID()
+            playerZoneID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_ReqCrossFBZoneID)
+            playerFuncLineID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_ReqCrossFBFuncLine)
+            dataDict.update({"fbZoneID":fbZoneID, "fbFuncLineID":fbFuncLineID, "playerZoneID":playerZoneID, "playerFuncLineID":playerFuncLineID})
+        if curPlayer.GetFaction():
+            dataDict["Faction"] = curPlayer.GetFaction()
+        DataRecordPack.SendEventPack("CrossFBExit", dataDict, curPlayer)
+        
     do_FBLogic_ID = __GetFBLogic_MapID(GameWorld.GetMap().GetMapID())
     
     callFunc = GameWorld.GetExecFunc(FBProcess, "GameLogic_%s.%s" % (do_FBLogic_ID, "DoExitFB"))
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/GameWorldProcess.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/GameWorldProcess.py
index 2fa2745..697edb8 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/GameWorldProcess.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/GameWorldProcess.py
@@ -188,12 +188,13 @@
     if mapID not in ChConfig.Def_CrossDynamicLineMap:
         return
     
+    mapID = gameWorld.GetMapID()
     realMapID, copyMapID = gameWorld.GetRealMapID(), gameWorld.GetCopyMapID()
     if state == IPY_GameWorld.fbosWaitForClose:
         crossFuncLineDataCache = FBLogic.OnGetCrossFuncLineDataCache()
-        msgInfo = [realMapID, copyMapID, state, crossFuncLineDataCache]
+        msgInfo = [mapID, realMapID, copyMapID, state, crossFuncLineDataCache]
     else:
-        msgInfo = [realMapID, copyMapID, state]
+        msgInfo = [mapID, realMapID, copyMapID, state]
         
     msgInfo = str(msgInfo)
     GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(0, 0, 0, "DynamicLineMapStateChange", msgInfo, len(msgInfo))
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_CrossRealmReg.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_CrossRealmReg.py
index 33ac77f..a3e467d 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_CrossRealmReg.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_CrossRealmReg.py
@@ -58,7 +58,9 @@
 
 def RegisterEnterCrossServer(curPlayer, registerMap, mapID=0, dataMapID=0, copyMapID=0, posX=0, posY=0, lineID=0):
     '''
-    @param registerMap: 一般是dataMapID
+    @param registerMap: 一般是功能地图ID dataMapID
+    @param mapID: 真实场景地图ID
+    @param dataMapID: 真实场景地图ID对应场景数据地图ID
     '''
     playerID = curPlayer.GetPlayerID()
     if GameWorld.IsCrossServer():

--
Gitblit v1.8.0