From ad9d17a43b170d55888150142485325bfdbbf693 Mon Sep 17 00:00:00 2001 From: dingo Date: Wed, 21 Jan 2026 08:42:45 -0500 Subject: [PATCH] Fix disconnect --- Game/Dungeon/DungeonHandler.cs | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) 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); } } ///