From 06000a31bd6d8f35635aa93f883e37c3af69d23a Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期五, 01 七月 2022 14:55:26 +0800
Subject: [PATCH] 1111 【主干】【bt7】【yn_1.0.1】【yn_ver1】 切图封包A126 A127通知dataMapID

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py            |   27 +++++++++++++++++++++++++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyGameData.py           |    2 ++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py |    4 ++--
 3 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py
index e9c753f..e40aa0a 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py
@@ -908,6 +908,33 @@
 def GetMap():
     return __GameWorld.GetMap()
 
+def GetMapDataMapID(mapID):
+    ## 用于获取非本地图的dataMapID,仅针对 ZoneServerGroup\map1_8G\MapServer\MapServerData\Map\MapID.txt
+    mapIDTxtInfo = GetMapIDTxtInfo()
+    if mapID not in mapIDTxtInfo:
+        return mapID
+    mapInfo = mapIDTxtInfo[mapID]
+    dataMapID = mapInfo.get("DataMapID", mapID)
+    return dataMapID
+
+def GetMapIDTxtInfo():
+    if PyGameData.g_mapIDTxtInfo:
+        return PyGameData.g_mapIDTxtInfo
+    PyGameData.g_mapIDTxtInfo = {}
+    rootPath = ChConfig.GetServerRootPath()
+    mapIDTxt = rootPath + "\\ZoneServerGroup\\map1_8G\\MapServer\\MapServerData\\Map\\MapID.txt"
+    f = open(mapIDTxt)
+    for line in f.readlines():
+        lineList = line.split('\t')
+        if not lineList or len(lineList) < 9:
+            continue
+        tMapID = int(lineList[1])
+        dDataMapID = int(lineList[3])
+        PyGameData.g_mapIDTxtInfo[tMapID] = {"DataMapID":dDataMapID}
+    Log("Load %s" % mapIDTxt)
+    Log("g_mapIDTxtInfo=%s" % PyGameData.g_mapIDTxtInfo)
+    return PyGameData.g_mapIDTxtInfo
+
 #---------------------------------------------------------------------
 ##获取Mail实例
 # @param 无
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 2da4e6c..ee57059 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py
@@ -2218,7 +2218,7 @@
     curPlayer.SetVisible(False)
     sendPack = ChPyNetSendPack.tagMCPrepareChangeMap()
     sendPack.Clear()
-    sendPack.MapID = sceneMapID
+    sendPack.MapID = GameWorld.GetMapDataMapID(sceneMapID)
     sendPack.FuncLineID = funcLineID
     
     NetPackCommon.SendFakePack(curPlayer, sendPack)
@@ -2229,7 +2229,7 @@
 def NotifyStartChangeMap(curPlayer):
     sendPack = ChPyNetSendPack.tagMCStartChangeMap()
     sendPack.Clear()
-    sendPack.MapID = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ChangeMapID)
+    sendPack.MapID = GameWorld.GetMapDataMapID(curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ChangeMapID))
     sendPack.FuncLineID = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_ReqFBFuncLine)
     NetPackCommon.SendFakePack(curPlayer, sendPack)
     
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyGameData.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyGameData.py
index f4963bc..b883fa3 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyGameData.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyGameData.py
@@ -14,6 +14,8 @@
 #-------------------------------------------------------------------------------
 #"""Version = 2017-09-05 21:30"""
 #-------------------------------------------------------------------------------
+g_mapIDTxtInfo = {} # MapID.txt 加载的信息
+
 g_commMapLinePlayerCountDict = {} # 常规地图分线人数 {mapID:{lineID:人数, ...}}
 g_needRefreshMapServerState = True # 常规地图分线人数是否有变更需要通知
 g_mapLastProcess_Minute = -1 # 地图上次处理的分钟

--
Gitblit v1.8.0