Dungeon Fixes
This commit is contained in:
@@ -53,6 +53,32 @@ public partial class DungeonHandler
|
||||
|
||||
return _dungeons.TryRemove(dungeonId, out _);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Force archive a dungeon (admin action). Fails if players are inside.
|
||||
/// </summary>
|
||||
public async Task<(bool ok, string? error)> ForceArchiveDungeonAsync(Guid dungeonId, CancellationToken ct = default)
|
||||
{
|
||||
if (!_dungeons.TryGetValue(dungeonId, out var dungeon))
|
||||
return (false, "Dungeon not found.");
|
||||
|
||||
if (dungeon.Simulation.Players.Count > 0)
|
||||
return (false, "Dungeon has active players.");
|
||||
|
||||
if (dungeon.IsPersisted)
|
||||
return (false, "Dungeon already archived.");
|
||||
|
||||
if (dungeon.BossKilled)
|
||||
return (false, "Boss was killed; dungeon is marked for cleanup, not archive.");
|
||||
|
||||
await PersistDungeonAsync(dungeon, ct);
|
||||
|
||||
if (!dungeon.IsPersisted)
|
||||
return (false, "Failed to archive dungeon. Check server logs for details.");
|
||||
|
||||
_dungeons.TryRemove(dungeonId, out _);
|
||||
return (true, null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get summary statistics for admin dashboard
|
||||
|
||||
Reference in New Issue
Block a user