From 93050d52767b12951e24f827ace71d44865d31d9 Mon Sep 17 00:00:00 2001 From: sven-n Date: Tue, 21 Jul 2026 08:00:55 +0200 Subject: [PATCH] Merge pull request #835 from nolt/fix-item-row-leak Delete item rows when items leave the game (cherry picked from commit c5eb47f03e726fc300fae352487622b79337911d) --- src/GameLogic/PlayerActions/Items/ItemStackAction.cs | 2 ++ src/GameLogic/PlayerActions/Items/SellItemToNpcAction.cs | 1 + 2 files changed, 3 insertions(+) diff --git a/src/GameLogic/PlayerActions/Items/ItemStackAction.cs b/src/GameLogic/PlayerActions/Items/ItemStackAction.cs index e9c5fa6..413b934 100644 --- a/src/GameLogic/PlayerActions/Items/ItemStackAction.cs +++ b/src/GameLogic/PlayerActions/Items/ItemStackAction.cs @@ -52,6 +52,7 @@ public class ItemStackAction foreach (var jewel in jewels) { await player.Inventory.RemoveItemAsync(jewel).ConfigureAwait(false); + await player.PersistenceContext.DeleteAsync(jewel).ConfigureAwait(false); await player.InvokeViewPlugInAsync(p => p.RemoveItemAsync(jewel.ItemSlot)).ConfigureAwait(false); } @@ -118,6 +119,7 @@ public class ItemStackAction } await player.Inventory.RemoveItemAsync(stacked).ConfigureAwait(false); + await player.PersistenceContext.DeleteAsync(stacked).ConfigureAwait(false); await player.InvokeViewPlugInAsync(p => p.RemoveItemAsync(slot)).ConfigureAwait(false); foreach (var freeSlot in freeSlots) { diff --git a/src/GameLogic/PlayerActions/Items/SellItemToNpcAction.cs b/src/GameLogic/PlayerActions/Items/SellItemToNpcAction.cs index 6a835b2..f80c358 100644 --- a/src/GameLogic/PlayerActions/Items/SellItemToNpcAction.cs +++ b/src/GameLogic/PlayerActions/Items/SellItemToNpcAction.cs @@ -63,6 +63,7 @@ public class SellItemToNpcAction { player.Logger.LogDebug("Sold Item {0} for price: {1}", item, sellingPrice); await player.Inventory!.RemoveItemAsync(item).ConfigureAwait(false); + await player.PersistenceContext.DeleteAsync(item).ConfigureAwait(false); await player.InvokeViewPlugInAsync(p => p.ItemSoldToNpcAsync(true)).ConfigureAwait(false); player.GameContext.PlugInManager.GetPlugInPoint()?.ItemSold(player, item, player.OpenedNpc!);