40 lines
1.4 KiB
C#
40 lines
1.4 KiB
C#
|
using System.Linq;
|
|||
|
using System.Windows.Media;
|
|||
|
using Filtration.ObjectModel.BlockItemBaseTypes;
|
|||
|
using Filtration.ObjectModel.Enums;
|
|||
|
|
|||
|
namespace Filtration.ObjectModel.BlockItemTypes
|
|||
|
{
|
|||
|
public class HasEnchantmentBlockItem : StringListBlockItem
|
|||
|
{
|
|||
|
public override string PrefixText => "HasEnchantment";
|
|||
|
public override int MaximumAllowed => 1;
|
|||
|
public override string DisplayHeading => "Has Enchantment";
|
|||
|
|
|||
|
public override string SummaryText
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
if (Items.Count > 0 && Items.Count < 4)
|
|||
|
{
|
|||
|
return "Enchantments: " +
|
|||
|
Items.Aggregate(string.Empty, (current, i) => current + i + ", ").TrimEnd(' ').TrimEnd(',');
|
|||
|
}
|
|||
|
if (Items.Count >= 4)
|
|||
|
{
|
|||
|
var remaining = Items.Count - 3;
|
|||
|
return "Enchantments: " + Items.Take(3)
|
|||
|
.Aggregate(string.Empty, (current, i) => current + i + ", ")
|
|||
|
.TrimEnd(' ')
|
|||
|
.TrimEnd(',') + " (+" + remaining + " more)";
|
|||
|
}
|
|||
|
return "Enchantments: (none)";
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public override Color SummaryBackgroundColor => Colors.PaleGreen;
|
|||
|
public override Color SummaryTextColor => Colors.Black;
|
|||
|
public override BlockItemOrdering SortOrder => BlockItemOrdering.HasEnchantment;
|
|||
|
}
|
|||
|
}
|