Add initial support for the Prophecy block item.
This commit is contained in:
parent
b5a424f9e9
commit
66e9aeec11
39
Filtration.ObjectModel/BlockItemTypes/ProphecyBlockItem.cs
Normal file
39
Filtration.ObjectModel/BlockItemTypes/ProphecyBlockItem.cs
Normal file
@ -0,0 +1,39 @@
|
||||
using System.Linq;
|
||||
using System.Windows.Media;
|
||||
using Filtration.ObjectModel.BlockItemBaseTypes;
|
||||
using Filtration.ObjectModel.Enums;
|
||||
|
||||
namespace Filtration.ObjectModel.BlockItemTypes
|
||||
{
|
||||
public class ProphecyBlockItem : StringListBlockItem
|
||||
{
|
||||
public override string PrefixText => "Prophecy";
|
||||
public override int MaximumAllowed => 1;
|
||||
public override string DisplayHeading => "Prophecy";
|
||||
|
||||
public override string SummaryText
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Items.Count > 0 && Items.Count < 4)
|
||||
{
|
||||
return "Prophecies: " +
|
||||
Items.Aggregate(string.Empty, (current, i) => current + i + ", ").TrimEnd(' ').TrimEnd(',');
|
||||
}
|
||||
if (Items.Count >= 4)
|
||||
{
|
||||
var remaining = Items.Count - 3;
|
||||
return "Prophecies: " + Items.Take(3)
|
||||
.Aggregate(string.Empty, (current, i) => current + i + ", ")
|
||||
.TrimEnd(' ')
|
||||
.TrimEnd(',') + " (+" + remaining + " more)";
|
||||
}
|
||||
return "Prophecies: (none)";
|
||||
}
|
||||
}
|
||||
|
||||
public override Color SummaryBackgroundColor => Colors.DarkMagenta;
|
||||
public override Color SummaryTextColor => Colors.White;
|
||||
public override BlockItemOrdering SortOrder => BlockItemOrdering.Prophecy;
|
||||
}
|
||||
}
|
@ -25,6 +25,7 @@ namespace Filtration.ObjectModel.Enums
|
||||
Rarity,
|
||||
Class,
|
||||
BaseType,
|
||||
Prophecy,
|
||||
HasExplicitMod,
|
||||
SetTextColor,
|
||||
SetBackgroundColor,
|
||||
|
@ -8,6 +8,7 @@
|
||||
Rarity,
|
||||
Class,
|
||||
BaseType,
|
||||
Prophecy,
|
||||
Sockets,
|
||||
LinkedSockets,
|
||||
SocketGroup,
|
||||
|
@ -92,6 +92,7 @@
|
||||
<Compile Include="BlockItemTypes\GemLevelBlockItem.cs" />
|
||||
<Compile Include="BlockItemTypes\HasExplicitModBlockItem.cs" />
|
||||
<Compile Include="BlockItemTypes\MapIconBlockItem.cs" />
|
||||
<Compile Include="BlockItemTypes\ProphecyBlockItem.cs" />
|
||||
<Compile Include="BlockItemTypes\ShapedMapBlockItem.cs" />
|
||||
<Compile Include="BlockItemTypes\ShaperItemBlockItem.cs" />
|
||||
<Compile Include="BlockItemTypes\ElderItemBlockItem.cs" />
|
||||
|
@ -567,6 +567,25 @@ namespace Filtration.Parser.Tests.Services
|
||||
Assert.Contains("Test BaseType 2", blockItem.Items);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TranslateStringToItemFilterBlock_Prophecy_ReturnsCorrectObject()
|
||||
{
|
||||
// Arrange
|
||||
var inputString = "Show" + Environment.NewLine +
|
||||
@" Prophecy ""Test Prophecy 1"" ""TestOneWordProphecyInQuotes"" TestOneWordProphecyNotInQuotes ""Test Prophecy 2""";
|
||||
|
||||
// Act
|
||||
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(1, result.BlockItems.Count(b => b is ProphecyBlockItem));
|
||||
var blockItem = result.BlockItems.OfType<ProphecyBlockItem>().First();
|
||||
Assert.Contains("Test Prophecy 1", blockItem.Items);
|
||||
Assert.Contains("TestOneWordProphecyInQuotes", blockItem.Items);
|
||||
Assert.Contains("TestOneWordProphecyNotInQuotes", blockItem.Items);
|
||||
Assert.Contains("Test Prophecy 2", blockItem.Items);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TranslateStringToItemFilterBlock_HasExplicitMod_ReturnsCorrectObject()
|
||||
{
|
||||
@ -934,6 +953,7 @@ namespace Filtration.Parser.Tests.Services
|
||||
" ElderMap False" + Environment.NewLine +
|
||||
@" Class ""My Item Class"" AnotherClass ""AndAnotherClass""" + Environment.NewLine +
|
||||
@" BaseType MyBaseType ""Another BaseType""" + Environment.NewLine +
|
||||
@" Prophecy MyProphecy ""Another Prophecy""" + Environment.NewLine +
|
||||
@" HasExplicitMod MyMod ""Another Mod""" + Environment.NewLine +
|
||||
" JunkLine Let's ignore this one!" + Environment.NewLine +
|
||||
" #Quality Commented out quality line" + Environment.NewLine +
|
||||
@ -1008,6 +1028,11 @@ namespace Filtration.Parser.Tests.Services
|
||||
Assert.Contains("MyBaseType", baseTypeblockItem.Items);
|
||||
Assert.Contains("Another BaseType", baseTypeblockItem.Items);
|
||||
|
||||
var prophecyblockItem = result.BlockItems.OfType<ProphecyBlockItem>().First();
|
||||
Assert.AreEqual(2, prophecyblockItem.Items.Count);
|
||||
Assert.Contains("MyProphecy", prophecyblockItem.Items);
|
||||
Assert.Contains("Another Prophecy", prophecyblockItem.Items);
|
||||
|
||||
var hasExplicitModBlockItem = result.BlockItems.OfType<HasExplicitModBlockItem>().First();
|
||||
Assert.AreEqual(2, hasExplicitModBlockItem.Items.Count);
|
||||
Assert.Contains("MyMod", hasExplicitModBlockItem.Items);
|
||||
@ -1707,6 +1732,26 @@ namespace Filtration.Parser.Tests.Services
|
||||
Assert.AreEqual(expectedResult, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TranslateItemFilterBlockToString_Prophecies_ReturnsCorrectString()
|
||||
{
|
||||
// Arrange
|
||||
var expectedResult = "Show" + Environment.NewLine +
|
||||
" Prophecy \"Test Prophecy\" \"Another Prophecy\" \"Yet Another Prophecy\"";
|
||||
|
||||
var prophecyBlockItem = new ProphecyBlockItem();
|
||||
prophecyBlockItem.Items.Add("Test Prophecy");
|
||||
prophecyBlockItem.Items.Add("Another Prophecy");
|
||||
prophecyBlockItem.Items.Add("Yet Another Prophecy");
|
||||
_testUtility.TestBlock.BlockItems.Add(prophecyBlockItem);
|
||||
|
||||
// Act
|
||||
var result = _testUtility.Translator.TranslateItemFilterBlockToString(_testUtility.TestBlock);
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(expectedResult, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TranslateItemFilterBlockToString_HasExplicitMod_ReturnsCorrectString()
|
||||
{
|
||||
@ -2013,6 +2058,7 @@ namespace Filtration.Parser.Tests.Services
|
||||
" Rarity = Unique" + Environment.NewLine +
|
||||
" Class \"Body Armour\" \"Gloves\" \"Belt\" \"Two Hand Axes\"" + Environment.NewLine +
|
||||
" BaseType \"Greater Life Flask\" \"Simple Robe\" \"Full Wyrmscale\"" + Environment.NewLine +
|
||||
" Prophecy \"The Cursed Choir\" \"A Valuable Combination\" \"The Beautiful Guide\"" + Environment.NewLine +
|
||||
" HasExplicitMod \"Guatelitzi's\" \"of Tacati\" \"Tyrannical\"" + Environment.NewLine +
|
||||
" SetTextColor 255 89 0 56" + Environment.NewLine +
|
||||
" SetBackgroundColor 0 0 0" + Environment.NewLine +
|
||||
@ -2046,6 +2092,11 @@ namespace Filtration.Parser.Tests.Services
|
||||
baseTypeItemblockItem.Items.Add("Simple Robe");
|
||||
baseTypeItemblockItem.Items.Add("Full Wyrmscale");
|
||||
_testUtility.TestBlock.BlockItems.Add(baseTypeItemblockItem);
|
||||
var prophecyItemblockItem = new ProphecyBlockItem();
|
||||
prophecyItemblockItem.Items.Add("The Cursed Choir");
|
||||
prophecyItemblockItem.Items.Add("A Valuable Combination");
|
||||
prophecyItemblockItem.Items.Add("The Beautiful Guide");
|
||||
_testUtility.TestBlock.BlockItems.Add(prophecyItemblockItem);
|
||||
var hasExplicitModBlockItem = new HasExplicitModBlockItem();
|
||||
hasExplicitModBlockItem.Items.Add("Guatelitzi's");
|
||||
hasExplicitModBlockItem.Items.Add("of Tacati");
|
||||
|
@ -159,6 +159,11 @@ namespace Filtration.Parser.Services
|
||||
AddStringListItemToBlockItems<BaseTypeBlockItem>(block, trimmedLine);
|
||||
break;
|
||||
}
|
||||
case "Prophecy":
|
||||
{
|
||||
AddStringListItemToBlockItems<ProphecyBlockItem>(block, trimmedLine);
|
||||
break;
|
||||
}
|
||||
case "Corrupted":
|
||||
{
|
||||
AddBooleanItemToBlockItems<CorruptedBlockItem>(block, trimmedLine);
|
||||
|
@ -76,6 +76,11 @@
|
||||
<userControls:EditableListBoxControl Margin="5,5,5,5" ItemsSource="{Binding Items}" AutoCompleteItemsSource="{Binding ElementName=TopLevelGrid, Path=DataContext.AutoCompleteItemBaseTypes}" />
|
||||
</DataTemplate>
|
||||
|
||||
<!-- Prophecy Template -->
|
||||
<DataTemplate DataType="{x:Type blockItemTypes:ProphecyBlockItem}">
|
||||
<userControls:EditableListBoxControl Margin="5,5,5,5" ItemsSource="{Binding Items}" AutoCompleteItemsSource="{Binding ElementName=TopLevelGrid, Path=DataContext.AutoCompleteProphecies}" />
|
||||
</DataTemplate>
|
||||
|
||||
<!-- Explicit Mods Template -->
|
||||
<DataTemplate DataType="{x:Type blockItemTypes:HasExplicitModBlockItem}">
|
||||
<userControls:EditableListBoxControl Margin="5,5,5,5" ItemsSource="{Binding Items}" AutoCompleteItemsSource="{Binding ElementName=TopLevelGrid, Path=DataContext.AutocompleteItemMods}" />
|
||||
|
@ -111,6 +111,7 @@ namespace Filtration.ViewModels.DesignTime
|
||||
public bool DisplaySettingsPopupOpen { get; set; }
|
||||
public IEnumerable<string> AutoCompleteItemClasses { get; }
|
||||
public IEnumerable<string> AutoCompleteItemBaseTypes { get; }
|
||||
public IEnumerable<string> AutoCompleteProphecies { get; }
|
||||
public IEnumerable<string> AutocompleteItemMods { get; }
|
||||
public List<Type> BlockItemTypesAvailable => new List<Type>
|
||||
{
|
||||
@ -125,6 +126,7 @@ namespace Filtration.ViewModels.DesignTime
|
||||
typeof (SocketGroupBlockItem),
|
||||
typeof (ClassBlockItem),
|
||||
typeof (BaseTypeBlockItem),
|
||||
typeof (ProphecyBlockItem),
|
||||
typeof (IdentifiedBlockItem),
|
||||
typeof (CorruptedBlockItem),
|
||||
typeof (ElderItemBlockItem),
|
||||
|
@ -50,6 +50,7 @@ namespace Filtration.ViewModels
|
||||
bool DisplaySettingsPopupOpen { get; set; }
|
||||
IEnumerable<string> AutoCompleteItemClasses { get; }
|
||||
IEnumerable<string> AutoCompleteItemBaseTypes { get; }
|
||||
IEnumerable<string> AutoCompleteProphecies { get; }
|
||||
IEnumerable<string> AutocompleteItemMods { get; }
|
||||
List<Type> BlockItemTypesAvailable { get; }
|
||||
List<Type> AudioVisualBlockItemTypesAvailable { get; }
|
||||
@ -203,6 +204,8 @@ namespace Filtration.ViewModels
|
||||
|
||||
public IEnumerable<string> AutoCompleteItemBaseTypes => _staticDataService.ItemBaseTypes;
|
||||
|
||||
public IEnumerable<string> AutoCompleteProphecies => new List<string>();
|
||||
|
||||
public IEnumerable<string> AutocompleteItemMods => _staticDataService.ItemMods;
|
||||
|
||||
public List<Type> BlockItemTypesAvailable => new List<Type>
|
||||
@ -218,6 +221,7 @@ namespace Filtration.ViewModels
|
||||
typeof (SocketGroupBlockItem),
|
||||
typeof (ClassBlockItem),
|
||||
typeof (BaseTypeBlockItem),
|
||||
typeof (ProphecyBlockItem),
|
||||
typeof (IdentifiedBlockItem),
|
||||
typeof (CorruptedBlockItem),
|
||||
typeof (ElderItemBlockItem),
|
||||
|
Loading…
x
Reference in New Issue
Block a user