Implement most jewels
This commit is contained in:
@@ -5,7 +5,6 @@ using Godot;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Zennysoft.Game.Abstractions;
|
||||
using Zennysoft.Game.Implementation;
|
||||
using Zennysoft.Ma.Adapter;
|
||||
|
||||
@@ -92,7 +91,9 @@ public partial class Inventory : Node, IInventory
|
||||
var consumables = listToSort.Where(x => x is ConsumableItem).OrderBy(x => x as ConsumableItem, new ConsumableComparer());
|
||||
var throwables = listToSort.Where(x => x is ThrowableItem).OrderBy(x => x as ThrowableItem, new ThrowableComparer());
|
||||
var effectItems = listToSort.Where(x => x is EffectItem).OrderBy(x => x as EffectItem, new EffectComparer());
|
||||
Items = [.. equippedItems, .. weapons, .. armor, .. accessories, .. ammo, .. consumables, .. throwables, .. effectItems];
|
||||
var jewelItems = listToSort.Where(x => x is Jewel).OrderBy(x => x as Jewel, new JewelComparer());
|
||||
var setItems = listToSort.Where(x => x is Plastique).OrderBy(x => x as Plastique, new SetItemComparer());
|
||||
Items = [.. equippedItems, .. weapons, .. armor, .. accessories, .. ammo, .. consumables, .. throwables, .. effectItems, .. jewelItems, .. setItems];
|
||||
|
||||
var stackableItems = Items.OfType<IStackable>();
|
||||
var itemsToStack = stackableItems.GroupBy(x => ((InventoryItem)x).ItemName).Where(x => x.Count() > 1);
|
||||
@@ -146,6 +147,22 @@ public partial class Inventory : Node, IInventory
|
||||
}
|
||||
}
|
||||
|
||||
public class JewelComparer : IComparer<Jewel>
|
||||
{
|
||||
public int Compare(Jewel x, Jewel y)
|
||||
{
|
||||
return x.ItemName.CompareTo(y.ItemName);
|
||||
}
|
||||
}
|
||||
|
||||
public class SetItemComparer : IComparer<Plastique>
|
||||
{
|
||||
public int Compare(Plastique x, Plastique y)
|
||||
{
|
||||
return x.ItemName.CompareTo(y.ItemName);
|
||||
}
|
||||
}
|
||||
|
||||
public class ConsumableComparer : IComparer<ConsumableItem>
|
||||
{
|
||||
public int Compare(ConsumableItem x, ConsumableItem y)
|
||||
|
||||
Reference in New Issue
Block a user