Fix items not removed from stores

This commit is contained in:
Bluzume 2021-11-07 05:53:05 -05:00
parent d32ce1c73f
commit f3e80cad74

View file

@ -7954,12 +7954,26 @@ namespace HISP.Server
foreach (GameClient connectedClient in GameClient.ConnectedClients)
{
if (connectedClient.LoggedIn)
{
if (connectedClient.LoggedinUser.Inventory.HasItemId(id))
{
InventoryItem invItm = connectedClient.LoggedinUser.Inventory.GetItemByItemId(id);
foreach (ItemInstance itm in invItm.ItemInstances.ToArray())
connectedClient.LoggedinUser.Inventory.Remove(itm);
}
}
}
// Remove from shops
foreach(Shop shop in Shop.ShopList)
{
if (shop.Inventory.HasItemId(id))
{
InventoryItem invItm = shop.Inventory.GetItemByItemId(id);
foreach (ItemInstance itm in invItm.ItemInstances.ToArray())
shop.Inventory.Remove(itm);
}
}
DroppedItems.DeleteAllItemsWithId(id); // Delete all dropped items
Database.DeleteAllItemsFromUsers(id); // Delete from offline players