Looting fix

This commit is contained in:
dingo
2026-01-25 17:36:37 -05:00
parent 87f9f3cb21
commit 5f545bc8f7
2 changed files with 16 additions and 16 deletions
+2 -5
View File
@@ -1765,11 +1765,8 @@ public sealed partial class DungeonHandler : IClientMessageHandler
mob.DeathLoot = allItems; mob.DeathLoot = allItems;
mob.DeathLootGold = totalGold; mob.DeathLootGold = totalGold;
// If mob has no loot, mark it for corpse removal // Don't set LootEmptiedAtTick here - let the simulation do it when dungeon is cleared
if (!mob.HasDeathLoot && dungeon != null) // This way corpses stay during combat even if they have no loot
{
mob.LootEmptiedAtTick = dungeon.Simulation.CurrentTick;
}
_log.LogDebug("Mob {Mob} died with {Count} items and {Gold} gold loot", _log.LogDebug("Mob {Mob} died with {Count} items and {Gold} gold loot",
mob.Name, allItems.Count, totalGold); mob.Name, allItems.Count, totalGold);
+14 -11
View File
@@ -374,21 +374,24 @@ public partial class DungeonSimulation
UpdatePlayer(player); UpdatePlayer(player);
} }
// Handle corpse cleanup (remove corpses 10 seconds after loot is empty) // Handle corpse cleanup (remove corpses 30 seconds after loot is empty AND dungeon is cleared)
var corpsesToRemove = new List<int>(); var corpsesToRemove = new List<int>();
foreach (var mob in Mobs.Values.Where(m => !m.IsAlive)) if (Phase == DungeonPhase.Cleared)
{ {
// Check if loot just became empty foreach (var mob in Mobs.Values.Where(m => !m.IsAlive))
if (!mob.HasDeathLoot && !mob.LootEmptiedAtTick.HasValue)
{ {
mob.LootEmptiedAtTick = CurrentTick; // Check if loot just became empty
} if (!mob.HasDeathLoot && !mob.LootEmptiedAtTick.HasValue)
{
mob.LootEmptiedAtTick = CurrentTick;
}
// Remove corpse 10 seconds after loot emptied (10 ticks per second) // Remove corpse 30 seconds after loot emptied (10 ticks per second)
if (mob.LootEmptiedAtTick.HasValue && if (mob.LootEmptiedAtTick.HasValue &&
CurrentTick - mob.LootEmptiedAtTick.Value >= 10 * TicksPerSecond) CurrentTick - mob.LootEmptiedAtTick.Value >= 30 * TicksPerSecond)
{ {
corpsesToRemove.Add(mob.Id); corpsesToRemove.Add(mob.Id);
}
} }
} }