Initial item filter / loot item processing done
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System.Windows.Media;
|
||||
using Filtration.ObjectModel.Enums;
|
||||
using Filtration.ObjectModel.Extensions;
|
||||
using Filtration.ObjectModel.LootExplosionStudio;
|
||||
|
||||
namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||
{
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Windows.Media;
|
||||
using Filtration.ObjectModel.Annotations;
|
||||
using Filtration.ObjectModel.LootExplosionStudio;
|
||||
|
||||
namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Windows.Media;
|
||||
using Filtration.ObjectModel.LootExplosionStudio;
|
||||
using Filtration.ObjectModel.ThemeEditor;
|
||||
|
||||
namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Windows.Media;
|
||||
using Filtration.ObjectModel.LootExplosionStudio;
|
||||
|
||||
namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Windows.Media;
|
||||
using Filtration.ObjectModel.LootExplosionStudio;
|
||||
|
||||
namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||
{
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using Filtration.ObjectModel.Enums;
|
||||
using Filtration.ObjectModel.Extensions;
|
||||
using Filtration.ObjectModel.LootExplosionStudio;
|
||||
|
||||
namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||
{
|
||||
@@ -47,5 +48,45 @@ namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||
OnPropertyChanged("FilterPredicate");
|
||||
OnPropertyChanged("SummaryText");
|
||||
}
|
||||
|
||||
|
||||
|
||||
public abstract int GetLootItemProperty(LootItem lootItem);
|
||||
|
||||
public virtual bool MatchesLootItem(LootItem lootItem)
|
||||
{
|
||||
var lootItemProperty = GetLootItemProperty(lootItem);
|
||||
var predicateOperand = FilterPredicate.PredicateOperand;
|
||||
|
||||
switch (FilterPredicate.PredicateOperator)
|
||||
{
|
||||
case FilterPredicateOperator.Equal:
|
||||
{
|
||||
return lootItemProperty == predicateOperand;
|
||||
}
|
||||
case FilterPredicateOperator.GreaterThan:
|
||||
{
|
||||
return lootItemProperty > predicateOperand;
|
||||
}
|
||||
case FilterPredicateOperator.GreaterThanOrEqual:
|
||||
{
|
||||
return lootItemProperty >= predicateOperand;
|
||||
}
|
||||
case FilterPredicateOperator.LessThan:
|
||||
{
|
||||
return lootItemProperty < predicateOperand;
|
||||
}
|
||||
case FilterPredicateOperator.LessThanOrEqual:
|
||||
{
|
||||
return lootItemProperty <= predicateOperand;
|
||||
}
|
||||
case FilterPredicateOperator.NotEqual:
|
||||
{
|
||||
return lootItemProperty != predicateOperand;
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Collections.Specialized;
|
||||
using System.Linq;
|
||||
using Filtration.ObjectModel.LootExplosionStudio;
|
||||
|
||||
namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||
{
|
||||
@@ -36,5 +37,12 @@ namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||
OnPropertyChanged("Items");
|
||||
OnPropertyChanged("SummaryText");
|
||||
}
|
||||
|
||||
public abstract string GetLootItemProperty(LootItem lootItem);
|
||||
|
||||
public virtual bool MatchesLootItem(LootItem lootItem)
|
||||
{
|
||||
return Items.Any(i => i == GetLootItemProperty(lootItem));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Linq;
|
||||
using System.Windows.Media;
|
||||
using Filtration.ObjectModel.BlockItemBaseTypes;
|
||||
using Filtration.ObjectModel.LootExplosionStudio;
|
||||
|
||||
namespace Filtration.ObjectModel.BlockItemTypes
|
||||
{
|
||||
@@ -56,5 +57,10 @@ namespace Filtration.ObjectModel.BlockItemTypes
|
||||
{
|
||||
get { return 11; }
|
||||
}
|
||||
|
||||
public override string GetLootItemProperty(LootItem lootItem)
|
||||
{
|
||||
return lootItem.BaseType;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Linq;
|
||||
using System.Windows.Media;
|
||||
using Filtration.ObjectModel.BlockItemBaseTypes;
|
||||
using Filtration.ObjectModel.LootExplosionStudio;
|
||||
|
||||
namespace Filtration.ObjectModel.BlockItemTypes
|
||||
{
|
||||
@@ -50,5 +51,10 @@ namespace Filtration.ObjectModel.BlockItemTypes
|
||||
{
|
||||
get { return 10; }
|
||||
}
|
||||
|
||||
public override string GetLootItemProperty(LootItem lootItem)
|
||||
{
|
||||
return lootItem.Class;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Windows.Media;
|
||||
using Filtration.ObjectModel.BlockItemBaseTypes;
|
||||
using Filtration.ObjectModel.Enums;
|
||||
using Filtration.ObjectModel.LootExplosionStudio;
|
||||
|
||||
namespace Filtration.ObjectModel.BlockItemTypes
|
||||
{
|
||||
@@ -68,5 +69,10 @@ namespace Filtration.ObjectModel.BlockItemTypes
|
||||
return 100;
|
||||
}
|
||||
}
|
||||
|
||||
public override int GetLootItemProperty(LootItem lootItem)
|
||||
{
|
||||
return lootItem.DropLevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Windows.Media;
|
||||
using Filtration.ObjectModel.BlockItemBaseTypes;
|
||||
using Filtration.ObjectModel.Enums;
|
||||
using Filtration.ObjectModel.LootExplosionStudio;
|
||||
|
||||
namespace Filtration.ObjectModel.BlockItemTypes
|
||||
{
|
||||
@@ -65,5 +66,10 @@ namespace Filtration.ObjectModel.BlockItemTypes
|
||||
return 6;
|
||||
}
|
||||
}
|
||||
|
||||
public override int GetLootItemProperty(LootItem lootItem)
|
||||
{
|
||||
return lootItem.Height;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Windows.Media;
|
||||
using Filtration.ObjectModel.BlockItemBaseTypes;
|
||||
using Filtration.ObjectModel.Enums;
|
||||
using Filtration.ObjectModel.LootExplosionStudio;
|
||||
|
||||
namespace Filtration.ObjectModel.BlockItemTypes
|
||||
{
|
||||
@@ -67,5 +68,10 @@ namespace Filtration.ObjectModel.BlockItemTypes
|
||||
return 100;
|
||||
}
|
||||
}
|
||||
|
||||
public override int GetLootItemProperty(LootItem lootItem)
|
||||
{
|
||||
return lootItem.ItemLevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using System.Windows.Media;
|
||||
using System.Linq;
|
||||
using System.Windows.Media;
|
||||
using Filtration.ObjectModel.BlockItemBaseTypes;
|
||||
using Filtration.ObjectModel.Enums;
|
||||
using Filtration.ObjectModel.LootExplosionStudio;
|
||||
|
||||
namespace Filtration.ObjectModel.BlockItemTypes
|
||||
{
|
||||
@@ -68,5 +70,10 @@ namespace Filtration.ObjectModel.BlockItemTypes
|
||||
return 6;
|
||||
}
|
||||
}
|
||||
|
||||
public override int GetLootItemProperty(LootItem lootItem)
|
||||
{
|
||||
return lootItem.SocketGroups.Where(c => c.Sockets.Count > 1).Sum(socketGroup => socketGroup.Sockets.Count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Windows.Media;
|
||||
using Filtration.ObjectModel.BlockItemBaseTypes;
|
||||
using Filtration.ObjectModel.Enums;
|
||||
using Filtration.ObjectModel.LootExplosionStudio;
|
||||
|
||||
namespace Filtration.ObjectModel.BlockItemTypes
|
||||
{
|
||||
@@ -68,5 +69,10 @@ namespace Filtration.ObjectModel.BlockItemTypes
|
||||
return 20;
|
||||
}
|
||||
}
|
||||
|
||||
public override int GetLootItemProperty(LootItem lootItem)
|
||||
{
|
||||
return lootItem.Quality;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using Filtration.ObjectModel.BlockItemBaseTypes;
|
||||
using Filtration.ObjectModel.Enums;
|
||||
using Filtration.ObjectModel.Extensions;
|
||||
using Filtration.ObjectModel.LootExplosionStudio;
|
||||
|
||||
namespace Filtration.ObjectModel.BlockItemTypes
|
||||
{
|
||||
@@ -85,5 +86,10 @@ namespace Filtration.ObjectModel.BlockItemTypes
|
||||
return (int)ItemRarity.Unique;
|
||||
}
|
||||
}
|
||||
|
||||
public override int GetLootItemProperty(LootItem lootItem)
|
||||
{
|
||||
return (int)lootItem.Rarity;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
using System.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Media;
|
||||
using Filtration.ObjectModel.BlockItemBaseTypes;
|
||||
using Filtration.ObjectModel.Enums;
|
||||
using Filtration.ObjectModel.LootExplosionStudio;
|
||||
|
||||
namespace Filtration.ObjectModel.BlockItemTypes
|
||||
{
|
||||
@@ -47,5 +51,68 @@ namespace Filtration.ObjectModel.BlockItemTypes
|
||||
{
|
||||
get { return 9; }
|
||||
}
|
||||
|
||||
public override string GetLootItemProperty(LootItem lootItem)
|
||||
{
|
||||
return lootItem.SocketGroups.ToString();
|
||||
}
|
||||
|
||||
public override bool MatchesLootItem(LootItem lootItem)
|
||||
{
|
||||
foreach (var socketGroupString in Items)
|
||||
{
|
||||
var socketColorList = SocketGroupStringToSocketColors(socketGroupString);
|
||||
if (
|
||||
lootItem.SocketGroups.Any(
|
||||
g =>
|
||||
g.Sockets.Count(s => s == SocketColor.Red) >=
|
||||
socketColorList.Count(l => l == SocketColor.Red) &&
|
||||
g.Sockets.Count(s => s == SocketColor.Green) >=
|
||||
socketColorList.Count(l => l == SocketColor.Green) &&
|
||||
g.Sockets.Count(s => s == SocketColor.Blue) >=
|
||||
socketColorList.Count(l => l == SocketColor.Blue) &&
|
||||
g.Sockets.Count(s => s == SocketColor.White) >=
|
||||
socketColorList.Count(l => l == SocketColor.White)))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private List<SocketColor> SocketGroupStringToSocketColors(string socketGroupString)
|
||||
{
|
||||
var socketColorList = new List<SocketColor>();
|
||||
|
||||
foreach (var c in socketGroupString.ToCharArray())
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
case 'R':
|
||||
{
|
||||
socketColorList.Add(SocketColor.Red);
|
||||
break;
|
||||
}
|
||||
case 'G':
|
||||
{
|
||||
socketColorList.Add(SocketColor.Green);
|
||||
break;
|
||||
}
|
||||
case 'B':
|
||||
{
|
||||
socketColorList.Add(SocketColor.Blue);
|
||||
break;
|
||||
}
|
||||
case 'W':
|
||||
{
|
||||
socketColorList.Add(SocketColor.White);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return socketColorList;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using System.Windows.Media;
|
||||
using System.Linq;
|
||||
using System.Windows.Media;
|
||||
using Filtration.ObjectModel.BlockItemBaseTypes;
|
||||
using Filtration.ObjectModel.Enums;
|
||||
using Filtration.ObjectModel.LootExplosionStudio;
|
||||
|
||||
namespace Filtration.ObjectModel.BlockItemTypes
|
||||
{
|
||||
@@ -68,5 +70,10 @@ namespace Filtration.ObjectModel.BlockItemTypes
|
||||
return 6;
|
||||
}
|
||||
}
|
||||
|
||||
public override int GetLootItemProperty(LootItem lootItem)
|
||||
{
|
||||
return lootItem.SocketGroups.Sum(c => c.Sockets.Count());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Windows.Media;
|
||||
using Filtration.ObjectModel.BlockItemBaseTypes;
|
||||
using Filtration.ObjectModel.Enums;
|
||||
using Filtration.ObjectModel.LootExplosionStudio;
|
||||
|
||||
namespace Filtration.ObjectModel.BlockItemTypes
|
||||
{
|
||||
@@ -68,5 +69,10 @@ namespace Filtration.ObjectModel.BlockItemTypes
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
public override int GetLootItemProperty(LootItem lootItem)
|
||||
{
|
||||
return lootItem.Width;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="BlockItemBaseTypes\ActionBlockItem.cs" />
|
||||
<Compile Include="BlockItemBaseTypes\BlockItembase.cs" />
|
||||
<Compile Include="BlockItemBaseTypes\BlockItemBase.cs" />
|
||||
<Compile Include="BlockItemBaseTypes\ColorBlockItem.cs" />
|
||||
<Compile Include="BlockItemBaseTypes\DualIntegerBlockItem.cs" />
|
||||
<Compile Include="BlockItemBaseTypes\IntegerBlockItem.cs" />
|
||||
@@ -77,6 +77,10 @@
|
||||
<Compile Include="ItemFilterBlockGroup.cs" />
|
||||
<Compile Include="ItemFilterScript.cs" />
|
||||
<Compile Include="ItemFilterSection.cs" />
|
||||
<Compile Include="LootExplosionStudio\DefaultLootItemAppearanceConstants.cs" />
|
||||
<Compile Include="LootExplosionStudio\LootItem.cs" />
|
||||
<Compile Include="LootExplosionStudio\LootItemCollection.cs" />
|
||||
<Compile Include="LootExplosionStudio\SocketGroup.cs" />
|
||||
<Compile Include="NumericFilterPredicate.cs" />
|
||||
<Compile Include="Properties\Annotations.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace Filtration.ObjectModel.LootExplosionStudio
|
||||
{
|
||||
public static class DefaultLootItemAppearanceConstants
|
||||
{
|
||||
public readonly static Color NormalTextColor = new Color { A = 255, R = 200, G = 200, B = 200 };
|
||||
public readonly static Color MagicTextColor = new Color { A = 255, R = 136, G = 136, B = 255 };
|
||||
public readonly static Color RareTextColor = new Color { A = 255, R = 255, G = 255, B = 119 };
|
||||
public readonly static Color UniqueTextColor = new Color { A = 255, R = 175, G = 96, B = 37 };
|
||||
public readonly static Color QuestItemTextColor = new Color { A = 255, R = 74, G = 230, B = 58 };
|
||||
public static readonly Color BackgroundColor = new Color {A = 255, R = 0, G = 0, B = 0};
|
||||
public static readonly Color BorderColor = new Color { A = 255, R = 0, G = 0, B = 0 };
|
||||
public static readonly int FontSize = 35;
|
||||
}
|
||||
}
|
||||
25
Filtration.ObjectModel/LootExplosionStudio/LootItem.cs
Normal file
25
Filtration.ObjectModel/LootExplosionStudio/LootItem.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Media;
|
||||
using Filtration.ObjectModel.Enums;
|
||||
|
||||
namespace Filtration.ObjectModel.LootExplosionStudio
|
||||
{
|
||||
public class LootItem
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public int ItemLevel { get; set; }
|
||||
public int DropLevel { get; set; }
|
||||
public int Quality { get; set; }
|
||||
public ItemRarity Rarity { get; set; }
|
||||
public string Class { get; set; }
|
||||
public string BaseType { get; set; }
|
||||
public List<SocketGroup> SocketGroups { get; set; }
|
||||
public int Width { get; set; }
|
||||
public int Height { get; set; }
|
||||
|
||||
public Color TextColor { get; set; }
|
||||
public Color BackgroundColor { get; set; }
|
||||
public Color BorderColor { get; set; }
|
||||
public int FontSize { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace Filtration.ObjectModel.LootExplosionStudio
|
||||
{
|
||||
public class LootItemCollection : Collection<LootItem>
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
10
Filtration.ObjectModel/LootExplosionStudio/SocketGroup.cs
Normal file
10
Filtration.ObjectModel/LootExplosionStudio/SocketGroup.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using System.Collections.Generic;
|
||||
using Filtration.ObjectModel.Enums;
|
||||
|
||||
namespace Filtration.ObjectModel.LootExplosionStudio
|
||||
{
|
||||
public class SocketGroup
|
||||
{
|
||||
public List<SocketColor> Sockets { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user