From d10f56cbd683c075ad792da0c09373904b2e75f2 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期五, 02 十一月 2018 16:51:13 +0800
Subject: [PATCH] 4549 【后端】【1.2.0】中立地图(包括异兽之地)增加退出按钮

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py      |    2 +-
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py |   51 +++++++++++++++++++++++++++++++++++++++++++++------
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py             |    4 ++++
 3 files changed, 50 insertions(+), 7 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
index c47d988..b13a052 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -3267,6 +3267,10 @@
 LittleHelperSetNumCount = 20 # 小助手设置编号个数
 LittleHelperValueCount = 6 # 小助手设置值个数
 Def_Player_Dict_LittleHelperValue = "LittleHelperValue%s_%s" # 小助手设置值存储, 参数(设置编号, value编号)
+Def_Player_Dict_FromMapID = 'FromMapID'    # 最后一次离开的非中立常规地图,地图ID
+Def_Player_Dict_FromPosX = 'FromPosX'    # 最后一次离开的非中立常规地图,坐标X
+Def_Player_Dict_FromPosY = 'FromPosY'    # 最后一次离开的非中立常规地图,坐标X
+Def_Player_Dict_FromLineID = 'FromLineID'    # 最后一次离开的非中立常规地图,线路ID
 
 
 Def_Player_Dict_FamilyTechLV = "FamilyTechLV_%s"    #家族科技等级, 参数(科技ID)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
index 9184107..1fc2d40 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
@@ -3566,7 +3566,7 @@
 #@return 返回值无意义
 #@remarks 客户端封包响应 //03 10 退出副本#tagCExitFB
 def __Func_ExitFB(curPlayer, tick):
-    if GameWorld.GetMap().GetMapFBType() == IPY_GameWorld.fbtNull:
+    if GameWorld.GetMap().GetMapFBType() == IPY_GameWorld.fbtNull and curPlayer.GetMapID() not in IpyGameDataPY.GetFuncEvalCfg("MapLine", 4):
         return
     
     GameWorld.Log('玩家 = %s , 主动离开副本' % (curPlayer.GetName()) , curPlayer.GetID())
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py
index 19f2d94..68efc7e 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py
@@ -1453,6 +1453,24 @@
 #        summonIndex += 1
         
     
+    # 更新最后一次离开的非中立常规地图, 从中立地图退出时需要回到该地方,必须在 DoResetWorldPosAndClear 之前更新
+    if GameWorld.GetMap().GetMapFBType() == IPY_GameWorld.fbtNull and curPlayer.GetMapID() not in IpyGameDataPY.GetFuncEvalCfg("MapLine", 4):
+        mapID = curPlayer.GetMapID()
+        posX = curPlayer.GetPosX()
+        posY = curPlayer.GetPosY()
+        lineID = curPlayer.GetClientLineID()
+        NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FromMapID, mapID)
+        NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FromPosX, posX)
+        NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FromPosY, posY)
+        NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FromLineID, lineID)
+        GameWorld.DebugLog("最后一次离开的非中立常规地图更新!mapID=%s,lineID=%s,Pos(%s,%s)" % (mapID, lineID, posX, posY))
+    else:
+        mapID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FromMapID)
+        posX = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FromPosX)
+        posY = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FromPosY)
+        lineID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FromLineID)
+        GameWorld.DebugLog("最后一次离开的非中立常规地图不变!mapID=%s,lineID=%s,Pos(%s,%s)" % (mapID, lineID, posX, posY))
+        
     #2. 调用切换地图接口
     curPlayer.DoResetWorldPosAndClear()
     
@@ -1479,12 +1497,33 @@
         #RouteServer未初始化不允许切换地图, 缓存处理
         GameServerRefresh.Set_PlayerRouteServerInitOK_OnLeaveFB(curPlayer, 1)
         return
-    
+
+    #中立地图回到上一次非中立常规地图    
+    if curPlayer.GetMapID() in IpyGameDataPY.GetFuncEvalCfg("MapLine", 4):
+        mapID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FromMapID)
+        posX = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FromPosX)
+        posY = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FromPosY)
+        lineID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FromLineID)
+        # 老号支持,本来就在中立地图的,返回新手村
+        if not mapID:
+            # {职业:[dataMapID,posX,posY], ...}
+            createRoleMapDict = IpyGameDataPY.GetFuncEvalCfg("CreateRoleMap", 1, {})
+            if not createRoleMapDict:
+                return
+            job = curPlayer.GetJob()
+            lineID = 0
+            if job in createRoleMapDict:
+                mapID, posX, posY = createRoleMapDict[job]
+            else:
+                mapInfoList = createRoleMapDict.values()
+                mapID, posX, posY = mapInfoList[0]
     #离开副本
-    mapID = curPlayer.GetFromMapID()
-    posX = curPlayer.GetFromPosX()
-    posY = curPlayer.GetFromPosY()
-    
+    else:
+        mapID = curPlayer.GetFromMapID()
+        posX = curPlayer.GetFromPosX()
+        posY = curPlayer.GetFromPosY()
+        lineID = curPlayer.GetFromLineID()
+        
     if mapID == curPlayer.GetMapID():
         # 如果在同一张地图, 取DB重生点, 普通地图下线重上时FromMapID会被设置为本地图
         gameMap = GameWorld.GetMap()
@@ -1507,7 +1546,7 @@
     #    ChangePlayerAction(curPlayer, IPY_GameWorld.paNull)
     #===============================================================================================
     
-    PlayerResetWorldPosFB(curPlayer, mapID, posX, posY, False, curPlayer.GetFromLineID())
+    PlayerResetWorldPosFB(curPlayer, mapID, posX, posY, False, lineID)
     
     #在空闲或者移动状态下,才能锁死玩家
     if curPlayer.GetPlayerAction() in [IPY_GameWorld.paNull] or curPlayer.IsMoving():

--
Gitblit v1.8.0