From 9a155fa0565ec6a5cb57b396ef4586163b69391f Mon Sep 17 00:00:00 2001 From: qornwh1 Date: Tue, 17 Mar 2026 14:28:39 +0900 Subject: [PATCH] =?UTF-8?q?feat=20:=20=EB=B3=B4=EC=8A=A4=EB=A7=B5=20?= =?UTF-8?q?=EC=A2=85=EB=A3=8C=ED=9B=84=20->=20=EB=A1=9C=EB=B9=84=20?= =?UTF-8?q?=EB=A7=B5=20=EC=9D=B4=EB=8F=99=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MMOTestServer/MMOserver/Game/GameServer.cs | 28 ++++++++++++++++------ 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/MMOTestServer/MMOserver/Game/GameServer.cs b/MMOTestServer/MMOserver/Game/GameServer.cs index 0c8dfed..46ab278 100644 --- a/MMOTestServer/MMOserver/Game/GameServer.cs +++ b/MMOTestServer/MMOserver/Game/GameServer.cs @@ -964,10 +964,24 @@ public class GameServer : ServerBase } int oldMapId = player.CurrentMapId; + int newMapId = packet.MapId; - if (!channel.ChangeMap(hashKey, player, packet.MapId)) + // 일단 보스맵에서 로비로 원복할떄 캐싱해둔 걸로 교체 + if (newMapId == -1) { - Log.Warning("[GameServer] CHANGE_MAP 유효하지 않은 맵 HashKey={Key} MapId={MapId}", hashKey, packet.MapId); + if (player.PreviousMapId > 0) + { + // 레이드 맵 사용 종료 처리 + channel.RemoveInstanceMap(oldMapId); + + newMapId = player.PreviousMapId; + player.PreviousMapId = 0; + } + } + + if (!channel.ChangeMap(hashKey, player, newMapId)) + { + Log.Warning("[GameServer] CHANGE_MAP 유효하지 않은 맵 HashKey={Key} MapId={MapId}", hashKey, newMapId); return; } @@ -978,12 +992,12 @@ public class GameServer : ServerBase BroadcastToMap(channelId, oldMapId, PacketSerializer.Serialize((ushort)PacketCode.CHANGE_MAP, exitNotify)); // 새 맵 유저들에게 입장 알림 (본인 제외) - ChangeMapPacket enterNotify = new() { MapId = packet.MapId, IsAdd = true, Player = playerInfo }; - BroadcastToMap(channelId, packet.MapId, PacketSerializer.Serialize((ushort)PacketCode.CHANGE_MAP, enterNotify), peer); + ChangeMapPacket enterNotify = new() { MapId = newMapId, IsAdd = true, Player = playerInfo }; + BroadcastToMap(channelId, newMapId, PacketSerializer.Serialize((ushort)PacketCode.CHANGE_MAP, enterNotify), peer); // 본인에게 새 맵 플레이어 목록 전달 - ChangeMapPacket response = new() { MapId = packet.MapId }; - AMap? newMap = channel.GetMap(packet.MapId); + ChangeMapPacket response = new() { MapId = newMapId }; + AMap? newMap = channel.GetMap(newMapId); if (newMap != null) { foreach ((int uid, Player p) in newMap.GetUsers()) @@ -998,7 +1012,7 @@ public class GameServer : ServerBase } SendTo(peer, PacketSerializer.Serialize((ushort)PacketCode.CHANGE_MAP, response)); - Log.Debug("[GameServer] CHANGE_MAP HashKey={Key} OldMap={OldMapId} NewMap={MapId}", hashKey, oldMapId, packet.MapId); + Log.Debug("[GameServer] CHANGE_MAP HashKey={Key} OldMap={OldMapId} NewMap={MapId}", hashKey, oldMapId, newMapId); } private void OnPartyChangeMap(NetPeer peer, int hashKey, byte[] payload)