Merge branch 'develop'

This commit is contained in:
Ben Wallis 2019-04-10 17:39:33 +01:00
commit 992c6f510a
21 changed files with 1336 additions and 32 deletions

View File

@ -0,0 +1,23 @@
using System.Windows.Media;
using Filtration.ObjectModel.BlockItemBaseTypes;
using Filtration.ObjectModel.Enums;
namespace Filtration.ObjectModel.BlockItemTypes
{
public sealed class AnyEnchantmentBlockItem : BooleanBlockItem
{
public AnyEnchantmentBlockItem()
{
}
public AnyEnchantmentBlockItem(bool booleanValue) : base(booleanValue)
{
}
public override string PrefixText => "AnyEnchantment";
public override string DisplayHeading => "Any Enchantment";
public override Color SummaryBackgroundColor => Colors.YellowGreen;
public override Color SummaryTextColor => Colors.Black;
public override BlockItemOrdering SortOrder => BlockItemOrdering.AnyEnchantment;
}
}

View File

@ -0,0 +1,23 @@
using System.Windows.Media;
using Filtration.ObjectModel.BlockItemBaseTypes;
using Filtration.ObjectModel.Enums;
namespace Filtration.ObjectModel.BlockItemTypes
{
public sealed class FracturedItemBlockItem : BooleanBlockItem
{
public FracturedItemBlockItem()
{
}
public FracturedItemBlockItem(bool booleanValue) : base(booleanValue)
{
}
public override string PrefixText => "FracturedItem";
public override string DisplayHeading => "Fractured Item";
public override Color SummaryBackgroundColor => Colors.Salmon;
public override Color SummaryTextColor => Colors.Black;
public override BlockItemOrdering SortOrder => BlockItemOrdering.FracturedItem;
}
}

View 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 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;
}
}

View File

@ -0,0 +1,23 @@
using System.Windows.Media;
using Filtration.ObjectModel.BlockItemBaseTypes;
using Filtration.ObjectModel.Enums;
namespace Filtration.ObjectModel.BlockItemTypes
{
public sealed class SynthesisedItemBlockItem : BooleanBlockItem
{
public SynthesisedItemBlockItem()
{
}
public SynthesisedItemBlockItem(bool booleanValue) : base(booleanValue)
{
}
public override string PrefixText => "SynthesisedItem";
public override string DisplayHeading => "Synthesised Item";
public override Color SummaryBackgroundColor => Colors.Salmon;
public override Color SummaryTextColor => Colors.Black;
public override BlockItemOrdering SortOrder => BlockItemOrdering.SynthesisedItem;
}
}

View File

@ -12,6 +12,9 @@ namespace Filtration.ObjectModel.Enums
Corrupted,
ElderItem,
ShaperItem,
SynthesisedItem,
FracturedItem,
AnyEnchantment,
MapTier,
ShapedMap,
ElderMap,
@ -27,6 +30,7 @@ namespace Filtration.ObjectModel.Enums
BaseType,
Prophecy,
HasExplicitMod,
HasEnchantment,
SetTextColor,
SetBackgroundColor,
SetBorderColor,

View File

@ -81,8 +81,11 @@
<Compile Include="BlockItemBaseTypes\IntegerBlockItem.cs" />
<Compile Include="BlockItemBaseTypes\NumericFilterPredicateBlockItem.cs" />
<Compile Include="BlockItemBaseTypes\StringListBlockItem.cs" />
<Compile Include="BlockItemTypes\AnyEnchantmentBlockItem.cs" />
<Compile Include="BlockItemTypes\BackgroundColorBlockItem.cs" />
<Compile Include="BlockItemTypes\BaseTypeBlockItem.cs" />
<Compile Include="BlockItemTypes\FracturedItemBlockItem.cs" />
<Compile Include="BlockItemTypes\HasEnchantmentBlockItem.cs" />
<Compile Include="BlockItemTypes\MapTierBlockItem.cs" />
<Compile Include="BlockItemTypes\PlayEffectBlockItem.cs" />
<Compile Include="BlockItemTypes\BorderColorBlockItem.cs" />
@ -95,6 +98,7 @@
<Compile Include="BlockItemTypes\MapIconBlockItem.cs" />
<Compile Include="BlockItemTypes\ProphecyBlockItem.cs" />
<Compile Include="BlockItemTypes\ShapedMapBlockItem.cs" />
<Compile Include="BlockItemTypes\SynthesisedItemBlockItem.cs" />
<Compile Include="BlockItemTypes\ShaperItemBlockItem.cs" />
<Compile Include="BlockItemTypes\ElderItemBlockItem.cs" />
<Compile Include="BlockItemTypes\CorruptedBlockItem.cs" />

View File

@ -279,7 +279,7 @@ namespace Filtration.ObjectModel
get
{
var borderColorBlockItem = BlockItems.OfType<BorderColorBlockItem>().FirstOrDefault();
return borderColorBlockItem?.Color ?? new Color { A = 240, R = 0, G = 0, B = 0 };
return borderColorBlockItem?.Color ?? new Color { A = 0, R = 255, G = 255, B = 255 };
}
}

View File

@ -322,7 +322,13 @@ namespace Filtration.Parser.Tests.Services
Environment.NewLine +
"Show" + Environment.NewLine +
" ItemLevel > 20" + Environment.NewLine +
" SetTextColor 255 255 0";
" SetTextColor 255 255 0" + Environment.NewLine +
Environment.NewLine +
"#Show $Recipes->Glassblower->15% %D1" + Environment.NewLine +
"# SetTextColor 255 255 0" + Environment.NewLine +
Environment.NewLine +
"#Hide simple text without any special character" + Environment.NewLine +
"# SetTextColor 255 255 0";
var blockTranslator = new ItemFilterBlockTranslator(Mock.Of<IBlockGroupHierarchyBuilder>());
@ -332,15 +338,21 @@ namespace Filtration.Parser.Tests.Services
var result = translator.TranslateStringToItemFilterScript(testInputScript);
// Assert
Assert.AreEqual(3, result.ItemFilterBlocks.Count);
Assert.AreEqual(5, result.ItemFilterBlocks.Count);
var firstBlock = result.ItemFilterBlocks.OfType<ItemFilterBlock>().First();
var secondBlock = result.ItemFilterBlocks.OfType<ItemFilterBlock>().Skip(1).First();
var thirdBlock = result.ItemFilterBlocks.OfType<ItemFilterBlock>().Skip(2).First();
var fourthBlock = result.ItemFilterBlocks.OfType<ItemFilterBlock>().Skip(3).First();
var fifthBlock = result.ItemFilterBlocks.OfType<ItemFilterBlock>().Skip(4).First();
Assert.AreEqual(3, firstBlock.BlockItems.Count);
Assert.AreEqual(5, secondBlock.BlockItems.Count);
Assert.AreEqual(3, thirdBlock.BlockItems.Count);
Assert.AreEqual(2, fourthBlock.BlockItems.Count);
Assert.AreEqual(2, fifthBlock.BlockItems.Count);
Assert.AreEqual(false, fourthBlock.Enabled);
Assert.AreEqual(false, fifthBlock.Enabled);
}
[Test]

View File

@ -184,6 +184,21 @@ namespace Filtration.Parser.Services
AddBooleanItemToBlockItems<ShaperItemBlockItem>(block, trimmedLine);
break;
}
case "SynthesisedItem":
{
AddBooleanItemToBlockItems<SynthesisedItemBlockItem>(block, trimmedLine);
break;
}
case "FracturedItem":
{
AddBooleanItemToBlockItems<FracturedItemBlockItem>(block, trimmedLine);
break;
}
case "AnyEnchantment":
{
AddBooleanItemToBlockItems<AnyEnchantmentBlockItem>(block, trimmedLine);
break;
}
case "ShapedMap":
{
AddBooleanItemToBlockItems<ShapedMapBlockItem>(block, trimmedLine);
@ -317,6 +332,11 @@ namespace Filtration.Parser.Services
AddStringListItemToBlockItems<HasExplicitModBlockItem>(block, trimmedLine);
break;
}
case "HasEnchantment":
{
AddStringListItemToBlockItems<HasEnchantmentBlockItem>(block, trimmedLine);
break;
}
case "ElderMap":
{
AddBooleanItemToBlockItems<ElderMapBlockItem>(block, trimmedLine);

View File

@ -61,8 +61,7 @@ namespace Filtration.Parser.Services
lines[i] = lines[i].Trim();
if(!lines[i].StartsWith("#"))
{
string curLine = Regex.Replace(lines[i], @"\s+", "");
if ((curLine.StartsWith("Show") || curLine.StartsWith("Hide")) && (curLine.Length == 4 || curLine[4] == '#')) // found
if ((lines[i].StartsWith("Show") || lines[i].StartsWith("Hide")) && (lines[i].Length == 4 || lines[i][4] == ' ')) // found
{
inBlock[i] = true;
break;
@ -98,8 +97,8 @@ namespace Filtration.Parser.Services
{
if (!inDisabledBlock && lines[i].StartsWith("#"))
{
string curLine = Regex.Replace(lines[i].Substring(1), @"\s+", "");
if ((curLine.StartsWith("Show") || curLine.StartsWith("Hide")) && (curLine.Length == 4 || curLine[4] == '#') && !inBlock[i])
string curLine = lines[i].Substring(1).Trim();
if ((curLine.StartsWith("Show") || curLine.StartsWith("Hide")) && (curLine.Length == 4 || curLine[4] == ' ') && !inBlock[i])
{
inDisabledBlock = true;
lines[i] = lines[i].Substring(1).TrimStart(' ');

View File

@ -463,6 +463,7 @@
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="Resources\Enchantments.txt" />
<Resource Include="Resources\Icons\no_sound_dds_light.png" />
<Resource Include="Resources\Icons\no_sound_dds.png" />
<Resource Include="Resources\Icons\speaker_icon.png" />

View File

@ -8,26 +8,13 @@
<authors>Ben Wallis</authors>
<description>A Path of Exile loot filter script editor</description>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<copyright>Copyright 2018</copyright>
<releaseNotes>* Added support for new Prophecies block item type
* Added Betrayal League Item Base Types and Item Classes to static data
* All open filter scripts are now remembered on exit and reopened when the application is started rather than just the last opened one (#95)
* Filter sections are once again now expanded by default when scripts are opened, unless the new "Auto-expand all sections when opening scripts" setting is disabled
* A new Clear Styles button has been added which removes all styles from the selected block (#96)
* New buttons for adding/removing DisableDropSound from selected blocks have been added (#110)
* Added a new indicator for blocks with a DisableDropSound block present (#113)
* The Enable/Disable Block toggle button is now visible on both the Regular Block Items and Appearance Block Items views
* When there are too many block items to fit horizontally in a block a horizontal scrollbar will now appear
* Fixed an issue with MinimapIcon block items causing an "Unused Theme Components" message box to erroneously be shown when saving (#116)
* Fixed the Advanced tab in the Color Picker in the Theme Editor not being clickable (#115)
* Fixed the previously incorrect handling of DisableDropSound as a true/false value when in fact it is enabled/disabled purely by its presence or lack thereof in a block (#111)
* Fixed the application freezing for a long period of time when Ctrl+A (Select All) is performed
* Fixed the Switch to Appearance/Regular Block Items text overlapping block items
* Fixed theme saving (blank theme files were being saved) (#83)
* Fixed checkboxes in Block Group Browser (#97)
* Fixed the Select Path of Exile data directory dialog appearing after every upgrade (#94)
* Fixed an issue where custom sounds were only populated from the default Path of Exile data directory rather than the configured directory
* Clean installs no longer prompt to select the Path of Exile data directory if the default directory exists</releaseNotes>
<copyright>Copyright 2019</copyright>
<releaseNotes>* Added support for AnyEnchantment block item type
* Added support for HasEnchantment block item type
* Added support for FracturedItem block item type
* Added support for SynthesisedItem block item type
* Fixed parsing of disabled Show/Hide blocks with extra information following the Show/Hide keyword (#133)
* Fixed copy/pasted block styles not affecting the preview (#126) </releaseNotes>
<dependencies />
</metadata>
<files>

View File

@ -10,8 +10,8 @@ using System.Runtime.CompilerServices;
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.1.0")]
[assembly: AssemblyInformationalVersion("1.1.0")]
[assembly: AssemblyVersion("1.2.0")]
[assembly: AssemblyInformationalVersion("1.2.0")]
[assembly: InternalsVisibleTo("Filtration.Tests")]
[assembly: InternalsVisibleTo("Filtration.ItemFilterPreview.Tests")]

View File

@ -388,7 +388,18 @@ namespace Filtration.Properties {
return ResourceManager.GetString("Prophecies", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Enchantment Decree of Force.
/// </summary>
internal static string Enchantments
{
get
{
return ResourceManager.GetString("Enchantments", resourceCulture);
}
}
/// <summary>
/// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream.
/// </summary>

View File

@ -214,4 +214,7 @@
<data name="Prophecies" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Prophecies.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data>
<data name="Enchantments" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Enchantments.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data>
</root>

File diff suppressed because it is too large Load Diff

View File

@ -22,6 +22,7 @@ Alira's Amulet
Alleyways Map
Allflame
Alloyed Spiked Shield
Alone in the Darkness
Alteration Shard
Amber Amulet
Ambush Boots
@ -76,6 +77,7 @@ Armageddon Brand
Arming Axe
Armourer's Scrap
Armoury Map
Arrogance of the Vaal
Arsenal Map
Ashen Wood Map
Ashscale Talisman
@ -96,6 +98,7 @@ Avian Twins Talisman
Awl
Baleful Gem
Ball Lightning
Bane
Bane of the Loyal
Barbed Club
Barbute Helmet
@ -172,6 +175,7 @@ Bone Offering
Bone Spirit Shield
Bonechill Support
Bonespire Talisman
Boon of Justice
Boon of the First Ones
Boot Blade
Boot Knife
@ -389,6 +393,7 @@ Dagger Axe
Damage on Full Life Support
Dark Forest Map
Dark Pact
Dark Temptation
Darkwood Sceptre
Deadhand Talisman
Deadly Ailments Support
@ -450,6 +455,7 @@ Diamond Ring
Dig Map
Discharge
Discipline
Divine Ire
Divine Life Flask
Divine Mana Flask
Divine Orb
@ -510,6 +516,7 @@ Enchanted Fossil
Encrusted Fossil
Endurance Charge on Melee Stun Support
Enduring Cry
Energy Leech Support
Enfeeble
Engineer's Orb
Engineer's Shard
@ -820,7 +827,9 @@ Infernal Axe
Infernal Blow
Infernal Sword
Infested Valley Map
Infused Channelling Support
Innervate Support
Intensify Support
Invasion Leaguestone
Inya's Key
Iron Circlet
@ -949,6 +958,7 @@ Majestic Plate
Malachai's Entrails
Malachai's Heart
Malachai's Lungs
Malevolence
Malformation Map
Maligaro's Map
Maligaro's Spike
@ -1009,6 +1019,7 @@ Molten Shell
Molten Strike
Monkey Paw Talisman
Monkey Twins Talisman
Monochrome
Moon Orb
Moon Staff
Moon Temple Map
@ -1183,6 +1194,7 @@ Prophet Crown
Prosperity
Puncture
Punishment
Purifying Flame
Purity of Elements
Purity of Fire
Purity of Ice
@ -1295,6 +1307,7 @@ Saint's Hauberk
Saintly Chainmail
Sallet
Sambar Sceptre
Sambodhi's Vow
Samite Gloves
Samite Helmet
Samite Slippers
@ -1357,6 +1370,7 @@ Serpentscale Gauntlets
Serrated Arrow Quiver
Serrated Foil
Serrated Fossil
Seven Years Bad Luck
Shabby Jerkin
Shackled Boots
Shadow Axe
@ -1457,6 +1471,7 @@ Soldier Helmet
Soldier's Brigandine
Sorcerer Boots
Sorcerer Gloves
Soulrend
Sovereign Spiked Shield
Spark
Sparkling Claw
@ -1628,6 +1643,7 @@ The Garish Power
The Gemcutter
The Gentleman
The Gladiator
The Golden Era
The Hale Heart
The Harvester
The Hermit
@ -1642,19 +1658,24 @@ The Inventor
The Iron Bard
The Jester
The Jeweller's Boon
The Journey
The King's Blade
The King's Heart
The Landing
The Last One Standing
The Lich
The Life Thief
The Lion
The Lord in Black
The Lord of Celebration
The Lover
The Lunaris Priestess
The Mad King
The Master
The Master Artisan
The Mayor
The Mercenary
The Messenger
The Metalsmith's Gift
The Nurse
The Oath
@ -1684,6 +1705,7 @@ The Samurai's Eye
The Scarred Meadow
The Scavenger
The Scholar
The Seeker
The Sephirot
The Shaper's Key
The Shaper's Realm
@ -1800,6 +1822,7 @@ Underground River Map
Underground Sea Map
Undying Flesh Talisman
Unearth
Unleash Support
Unset Ring
Unshaping Orb
Ursine Pelt
@ -1924,6 +1947,7 @@ Warlord's Mark
Waste Pool Map
Wasteland Map
Waterways Map
Wave of Conviction
Waxed Garb
Wealth and Power
Weeping Essence
@ -1978,4 +2002,5 @@ Yriel's Key
Zealot Boots
Zealot Gloves
Zealot Helmet
Zealotry
Zodiac Leather

View File

@ -12,6 +12,7 @@ namespace Filtration.Services
IEnumerable<string> ItemClasses { get; }
IEnumerable<string> ItemMods { get; }
IEnumerable<string> Prophecies { get; }
IEnumerable<string> Enchantments { get; }
}
internal class StaticDataService : IStaticDataService
@ -29,12 +30,15 @@ namespace Filtration.Services
public IEnumerable<string> Prophecies { get; private set; }
public IEnumerable<string> Enchantments { get; private set; }
private void PopulateStaticData()
{
ItemBaseTypes = new LineReader(() => new StringReader(Resources.ItemBaseTypes)).ToList();
ItemClasses = new LineReader(() => new StringReader(Resources.ItemClasses)).ToList();
ItemMods = new LineReader(() => new StringReader(Resources.ItemMods)).ToList();
Prophecies = new LineReader(() => new StringReader(Resources.Prophecies)).ToList();
Enchantments = new LineReader(() => new StringReader(Resources.Enchantments)).ToList();
}
}
}

View File

@ -87,6 +87,11 @@
<userControls:EditableListBoxControl Margin="5,5,5,5" ItemsSource="{Binding Items}" AutoCompleteItemsSource="{Binding ElementName=TopLevelGrid, Path=DataContext.AutocompleteItemMods}" />
</DataTemplate>
<!-- Enchantments Template -->
<DataTemplate DataType="{x:Type blockItemTypes:HasEnchantmentBlockItem}">
<userControls:EditableListBoxControl Margin="5,5,5,5" ItemsSource="{Binding Items}" AutoCompleteItemsSource="{Binding ElementName=TopLevelGrid, Path=DataContext.AutocompleteEnchantments}" />
</DataTemplate>
<!-- Socket Groups Template -->
<DataTemplate DataType="{x:Type blockItemTypes:SocketGroupBlockItem}">
<userControls:EditableListBoxControl Margin="5,5,5,5" ItemsSource="{Binding Items}" />

View File

@ -131,12 +131,16 @@ namespace Filtration.ViewModels.DesignTime
typeof (CorruptedBlockItem),
typeof (ElderItemBlockItem),
typeof (ShaperItemBlockItem),
typeof (SynthesisedItemBlockItem),
typeof (FracturedItemBlockItem),
typeof (AnyEnchantmentBlockItem),
typeof (MapTierBlockItem),
typeof (ShapedMapBlockItem),
typeof (ElderMapBlockItem),
typeof (GemLevelBlockItem),
typeof (StackSizeBlockItem),
typeof (HasExplicitModBlockItem)
typeof (HasExplicitModBlockItem),
typeof (HasEnchantmentBlockItem)
};
public List<Type> AudioVisualBlockItemTypesAvailable { get; }
public Color DisplayTextColor => Colors.Red;

View File

@ -208,6 +208,8 @@ namespace Filtration.ViewModels
public IEnumerable<string> AutocompleteItemMods => _staticDataService.ItemMods;
public IEnumerable<string> AutocompleteEnchantments => _staticDataService.Enchantments;
public List<Type> BlockItemTypesAvailable => new List<Type>
{
typeof (ItemLevelBlockItem),
@ -226,12 +228,16 @@ namespace Filtration.ViewModels
typeof (CorruptedBlockItem),
typeof (ElderItemBlockItem),
typeof (ShaperItemBlockItem),
typeof (SynthesisedItemBlockItem),
typeof (FracturedItemBlockItem),
typeof (AnyEnchantmentBlockItem),
typeof (MapTierBlockItem),
typeof (ShapedMapBlockItem),
typeof (ElderMapBlockItem),
typeof (GemLevelBlockItem),
typeof (StackSizeBlockItem),
typeof (HasExplicitModBlockItem)
typeof (HasExplicitModBlockItem),
typeof (HasEnchantmentBlockItem)
};
public List<Type> AudioVisualBlockItemTypesAvailable => new List<Type>
@ -351,6 +357,10 @@ namespace Filtration.ViewModels
private void OnPasteBlockStyleCommand()
{
_parentScriptViewModel.PasteBlockStyle(this);
foreach (var blockItem in Block.BlockItems.OfType<IAudioVisualBlockItem>())
{
blockItem.PropertyChanged += OnBlockItemChanged;
}
}
private void OnAddBlockCommand()