feat : 보스맵 종료후 -> 로비 맵 이동 처리
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user