From da600c48b92c65ec78edea08544c6ca9a50b1143 Mon Sep 17 00:00:00 2001
From: xdh <xiefantasy@qq.com>
Date: 星期一, 29 四月 2019 16:20:58 +0800
Subject: [PATCH] 3450 【BUG】【2.0】莲台升星错误

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/RemoteQuery/GY_Query_CrossRealmReg.py |   91 +++++++++++++++++++++++++++++++++++++--------
 1 files changed, 75 insertions(+), 16 deletions(-)

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 b4d8357..1fabaab 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
@@ -16,9 +16,15 @@
 #-------------------------------------------------------------------------------
 
 import GameWorld
+import PlayerControl
 import CrossRealmPlayer
 import IPY_GameWorld
-import ChPlayer
+import ChPyNetSendPack
+import CrossPlayerData
+import NetPackCommon
+import ChConfig
+import FBCommon
+import FBLogic
 
 
 #------------------------------------------------------------------------------ 
@@ -43,30 +49,73 @@
 #  @remarks 函数详细说明.
 def DoResult(curPlayer, callFunName, funResult, tick):
     resultInfo = eval(funResult)
-    actionType = resultInfo[0]
-    mapPosInfo = resultInfo[1:]
-    if not curPlayer:
+    GameWorld.Log("GY_Query_CrossRealmReg DoResult %s" % funResult, curPlayer.GetPlayerID())
+    if not resultInfo:
         return
-    
-    playerID = curPlayer.GetPlayerID()
-    GameWorld.Log("GY_Query_CrossRealmReg DoResult %s" % funResult, playerID)
+    registerMap, mapID, dataMapID, copyMapID, posX, posY, lineID = resultInfo
+    RegisterEnterCrossServer(curPlayer, registerMap, mapID, dataMapID, copyMapID, posX, posY, lineID)
+    return
 
-    if GameWorld.IsMergeServer():
+def RegisterEnterCrossServer(curPlayer, registerMap, mapID=0, dataMapID=0, copyMapID=0, posX=0, posY=0, lineID=0):
+    '''
+    @param registerMap: 一般是dataMapID
+    '''
+    playerID = curPlayer.GetPlayerID()
+    if GameWorld.IsCrossServer():
         GameWorld.Log("    跨服服务器不允许上传报名数据!", playerID)
         return
     
-    if not mapPosInfo:
+    playerRegisterMap = curPlayer.NomalDictGetProperty(ChConfig.Def_PlayerKey_CrossRegisterMap)
+    if playerRegisterMap in ChConfig.RegisterEnter_CrossServerMapIDList:
+        GameWorld.ErrLog("跨服已经在上传数据,不重复提交!playerRegisterMap=%s,registerMap=%s" % (playerRegisterMap, registerMap), curPlayer.GetPlayerID())
         return
     
     #跨服前更新自己所属服务器组ID
-    ChPlayer.UpdatePlayerServerGroupID(curPlayer)
+    PlayerControl.UpdPlayerServerGroupID(curPlayer)
+    serverGroupID = PlayerControl.GetPlayerServerGroupID(curPlayer)
+    zoneIpyData = CrossRealmPlayer.GetCrossZoneIpyDataByServerGroupID(registerMap, serverGroupID)
+    if not zoneIpyData:
+        return
+    zoneID = zoneIpyData.GetZoneID()
     
-    mapID, dataMapID, copyMapID, posX, posY = mapPosInfo
+    if not mapID:
+        zoneIpyData = CrossRealmPlayer.GetServerCrossZoneMapIpyData(zoneID, registerMap)
+        if not zoneIpyData:
+            GameWorld.ErrLog("找不到该服务器对应跨服分区: registerMap=%s" % (registerMap))
+            return
+        mapID, dataMapID, copyMapID, posX, posY = zoneIpyData.GetMapID(), zoneIpyData.GetDataMapID(), zoneIpyData.GetCopyMapID(), zoneIpyData.GetPosX(), zoneIpyData.GetPosY()
+    
+    if not posX or not posY:
+        fbLineIpyData = FBCommon.GetFBLineIpyData(mapID, lineID)
+        if fbLineIpyData:
+            tick = GameWorld.GetGameWorld().GetTick()
+            ipyEnterPosInfo = FBCommon.GetFBLineEnterPosInfo(mapID, lineID, fbLineIpyData)
+            retPos = FBLogic.OnGetFBEnterPos(curPlayer, mapID, lineID, ipyEnterPosInfo, tick)
+            if not retPos:
+                GameWorld.ErrLog("未找到进入副本坐标!mapID=%s,lineID=%s" % (mapID, lineID))
+                return
+            posX, posY = retPos
+            
+    if not mapID or not posX or not posY:
+        return
+    
+    if not FBLogic.OnRegEnterCrossFB(curPlayer, mapID, lineID):
+        GameWorld.ErrLog("OnRegEnterCrossFB 进入跨服副本注册失败,进入条件不足!无法注册! mapID=%s,lineID=%s" % (mapID, lineID), playerID)
+        return
+    
+    if registerMap in ChConfig.RegisterEnter_CrossServerMapIDList:
+        prepareEnterCrossServer = ChPyNetSendPack.tagMCPrepareEnterCrossServer()
+        prepareEnterCrossServer.DataMapID = registerMap
+        NetPackCommon.SendFakePack(curPlayer, prepareEnterCrossServer)
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PlayerKey_CrossRegisterMap, registerMap)
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_ReqCrossFBFuncLine, lineID)
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_ReqCrossFBZoneID, zoneID)
+    CrossPlayerData.OnPlayerCrossReg(curPlayer)
     #curPlayer.SendMergeRegisterPlayer(mapID, dataMapID, copyMapID, posX, posY)
     curPlayer.SendMergeRegisterPlayerAfterChange(CrossRealmPlayer.GetCrossPlayerName(curPlayer), mapID, dataMapID, copyMapID, posX, posY)
-    GameWorld.Log("    发送跨服玩家数据注册: actionType=%s,mapID=%s,dataMapID=%s,copyMapID=%s,posX=%s,posY=%s,GetVsRoomId=%s" 
-                  % (actionType, mapID, dataMapID, copyMapID, posX, posY, curPlayer.GetVsRoomId()), playerID)
-    return
+    GameWorld.Log("    发送跨服玩家数据注册: registerMap=%s,lineID=%s,zoneID=%s,mapID=%s,dataMapID=%s,copyMapID=%s,posX=%s,posY=%s,GetVsRoomId=%s" 
+                  % (registerMap, lineID, zoneID, mapID, dataMapID, copyMapID, posX, posY, curPlayer.GetVsRoomId()), playerID)
+    return True
 
 ## 跨服赛报名结果(上传数据)
 #  @param index 玩家索引
@@ -75,19 +124,29 @@
 def GameServer_MergeRegisterResult(index, tick):
     registerResult = IPY_GameWorld.IPY_GMMergeRegisterPlayerResult()
     curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
+    registerMap = curPlayer.NomalDictGetProperty(ChConfig.Def_PlayerKey_CrossRegisterMap)
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PlayerKey_CrossRegisterMap, 0)
+    curPlayer.SetDict(ChConfig.Def_PlayerKey_RequestEnterCrossServerTick, 0)
     playerID = curPlayer.GetPlayerID()
     result = registerResult.GetResult()
+    GameWorld.Log("GameServer_MergeRegisterResult registerMap=%s,result=%s" % (registerMap, result), playerID)
     if not result:
         errorMsg = registerResult.GetErrorMsg()
         GameWorld.Log("CrossRealmReg result Error:%s" % errorMsg, playerID)
+        NetPackCommon.SendFakePack(curPlayer, ChPyNetSendPack.tagMCEnterCrossServerError())
+        return
+    
+    if registerMap in ChConfig.RegisterEnter_CrossServerMapIDList:
+        CrossRealmPlayer.DoEnterCrossRealm(curPlayer)
+        PlayerControl.SetCrossMapID(curPlayer, registerMap)
+        NetPackCommon.SendFakePack(curPlayer, ChPyNetSendPack.tagMCStartEnterCrossServer())
         return
     
     #newAccount = registerResult.GetAccount()
     #newName = registerResult.GetPwd()
     
-    msgList = str([]) 
+    msgList = str([registerMap]) 
     GameWorld.GetPlayerManager().GameServer_QueryPlayerResult(curPlayer.GetID(), 0, 0, "CrossRealmReg", msgList, len(msgList))    
-    GameWorld.Log("GameServer_MergeRegisterResult msgList=%s" % msgList, playerID)
     return
     
     

--
Gitblit v1.8.0