Redesign and reimplement inventory menu
Add jewels but no implementation yet (needed redesign of inventory menu to function correctly)
This commit is contained in:
@@ -6,6 +6,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Zennysoft.Game.Abstractions;
|
||||
using Zennysoft.Game.Implementation;
|
||||
using Zennysoft.Ma.Adapter;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
@@ -96,9 +97,10 @@ public partial class Inventory : Node, IInventory
|
||||
foreach (var itemStack in itemsToStack)
|
||||
{
|
||||
var firstItem = itemStack.First();
|
||||
firstItem.SetCount(itemStack.Count());
|
||||
firstItem.SetCount(itemStack.Sum(x => x.Count.Value));
|
||||
var itemsToRemove = itemStack.Except([firstItem]).Cast<InventoryItem>();
|
||||
Items = [.. Items.Except(itemsToRemove)];
|
||||
foreach (var item in itemsToRemove)
|
||||
Remove(item);
|
||||
}
|
||||
|
||||
return !Items.SequenceEqual(initialList);
|
||||
|
||||
Reference in New Issue
Block a user