diff --git a/Game/Dungeon/DungeonHandler.cs b/Game/Dungeon/DungeonHandler.cs
index d7a004a..f14c141 100644
--- a/Game/Dungeon/DungeonHandler.cs
+++ b/Game/Dungeon/DungeonHandler.cs
@@ -367,6 +367,17 @@ public sealed partial class DungeonHandler : IClientMessageHandler
case DungeonOpCodes.LOOT_CHEST_CLOSE:
await HandleLootChestClose(connection, session, payload, ct);
break;
+
+ // Mob loot operations
+ case DungeonOpCodes.MOB_LOOT_REQUEST:
+ await HandleMobLootRequest(connection, session, payload, ct);
+ break;
+ case DungeonOpCodes.MOB_LOOT_TAKE_ITEM:
+ await HandleMobLootTakeItem(connection, session, payload, ct);
+ break;
+ case DungeonOpCodes.MOB_LOOT_TAKE_ALL:
+ await HandleMobLootTakeAll(connection, session, payload, ct);
+ break;
// Dungeon browser
case DungeonOpCodes.DUNGEON_LIST_REQUEST:
@@ -1665,7 +1676,7 @@ public sealed partial class DungeonHandler : IClientMessageHandler
}
///
- /// Process loot when a mob dies - includes normal loot roll plus any carried player loot
+ /// Process loot when a mob dies - stores loot on mob body for player interaction
///
private async Task ProcessMobDeathLootAsync(DungeonInstance dungeon, DeathEvent death)
{
@@ -1675,13 +1686,6 @@ public sealed partial class DungeonHandler : IClientMessageHandler
if (!dungeon.Simulation.Mobs.TryGetValue(death.EntityId, out var mob))
return;
- // Find the player who killed it
- var killerSession = _playerSessions.Values
- .FirstOrDefault(s => s.CharacterId == (ulong)death.KillerId);
-
- if (killerSession == null)
- return;
-
// Generate loot from the mob's loot tables
var loot = _lootService.GenerateMobLoot(
mob.DefinitionId,
@@ -1689,7 +1693,7 @@ public sealed partial class DungeonHandler : IClientMessageHandler
1.0f
);
- // Collect all items to give (normal loot + carried player loot)
+ // Collect all items (normal loot + carried player loot)
var allItems = new List(loot);
long totalGold = 0;
@@ -1728,28 +1732,12 @@ public sealed partial class DungeonHandler : IClientMessageHandler
mob.CarriedPlayerLoot.Clear();
}
- if (allItems.Count == 0 && totalGold == 0)
- return;
+ // Store loot on the mob body for players to loot manually
+ mob.DeathLoot = allItems;
+ mob.DeathLootGold = totalGold;
- // Try to add loot to player's inventory, get overflow
- var (addedItems, overflowItems, overflowGold) = await AddLootToInventoryWithOverflowAsync(
- killerSession, allItems, totalGold);
-
- // Send loot popup for items that were added directly
- if (addedItems.Count > 0)
- {
- await SendLootPopupAsync(killerSession, addedItems);
- }
-
- // If there's overflow, spawn a personal loot chest
- if (overflowItems.Count > 0 || overflowGold > 0)
- {
- await SpawnLootChestAsync(dungeon, killerSession, overflowItems, overflowGold,
- mob.X, mob.Y, null, mob.DefinitionId);
- }
-
- _log.LogDebug("Player {Player} received {Count} items and {Gold} gold from {Mob}",
- killerSession.Character.Name, addedItems.Count, totalGold - overflowGold, mob.Name);
+ _log.LogDebug("Mob {Mob} died with {Count} items and {Gold} gold loot",
+ mob.Name, allItems.Count, totalGold);
}
catch (Exception ex)
{
@@ -3632,7 +3620,7 @@ public sealed partial class DungeonHandler : IClientMessageHandler
isInCombat = p.IsInCombat
}),
- mobs = sim.Mobs.Values.Where(m => m.IsAlive).Select(m => new
+ mobs = sim.Mobs.Values.Select(m => new
{
id = m.Id,
name = m.Name,
@@ -3642,7 +3630,7 @@ public sealed partial class DungeonHandler : IClientMessageHandler
health = m.Health,
maxHealth = m.MaxHealth,
state = m.State.ToString().ToLower(),
- spriteConfig = string.IsNullOrEmpty(m.SpriteConfigJson) ? null :
+ spriteConfig = string.IsNullOrEmpty(m.SpriteConfigJson) ? null :
System.Text.Json.JsonSerializer.Deserialize