diff --git a/Game/Dungeon/DungeonHandler.cs b/Game/Dungeon/DungeonHandler.cs index 92a2061..7d553cc 100644 --- a/Game/Dungeon/DungeonHandler.cs +++ b/Game/Dungeon/DungeonHandler.cs @@ -3908,12 +3908,26 @@ public sealed partial class DungeonHandler : IClientMessageHandler { // Track disconnection in Redis _ = TrackPlayerDisconnectedAsync(session); - + if (session.CurrentDungeonId.HasValue) { - _ = RemoveFromDungeonAsync(session, false, CancellationToken.None); + // Delay removal from dungeon by 25 seconds to allow for reconnection + // and to prevent abuse (disconnecting to avoid combat) + _ = Task.Run(async () => + { + await Task.Delay(TimeSpan.FromSeconds(25)); + await RemoveFromDungeonAsync(session, false, CancellationToken.None); + _log.LogInformation("Player {CharacterName} removed from dungeon after 25s disconnect timeout", + session.Character?.Name ?? "Unknown"); + }); + + _log.LogInformation("Dungeon session for {CharacterName} will be removed in 25s after disconnect", + session.Character?.Name ?? "Unknown"); + } + else + { + _log.LogInformation("Dungeon session cleaned up for connection {Id}", connectionId); } - _log.LogInformation("Dungeon session cleaned up for connection {Id}", connectionId); } } ///