Refactored parsing services into separate project

This commit is contained in:
Ben Wallis
2016-01-31 11:56:55 +00:00
parent 86dc03f4ff
commit 8bfbe7cc66
36 changed files with 842 additions and 147 deletions

View File

@@ -68,9 +68,6 @@
<Compile Include="Services\TestItemFilterPersistenceService.cs" />
<Compile Include="Services\TestStaticDataService.cs" />
<Compile Include="Services\TestUpdateService.cs" />
<Compile Include="Translators\TestBlockGroupHierarchyBuilder.cs" />
<Compile Include="Translators\TestItemFilterBlockTranslator.cs" />
<Compile Include="Translators\TestItemFilterScriptTranslator.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
@@ -78,6 +75,8 @@
</ItemGroup>
<ItemGroup>
<Folder Include="Models\" />
<Folder Include="Resources\" />
<Folder Include="Translators\" />
<Folder Include="ViewModels\" />
</ItemGroup>
<ItemGroup>
@@ -93,6 +92,10 @@
<Project>{4aac3beb-1dc1-483e-9d11-0e9334e80227}</Project>
<Name>Filtration.ObjectModel</Name>
</ProjectReference>
<ProjectReference Include="..\Filtration.Parser.Interface\Filtration.Parser.Interface.csproj">
<Project>{46383F20-02DF-48B4-B092-9088FA4ACD5A}</Project>
<Name>Filtration.Parser.Interface</Name>
</ProjectReference>
<ProjectReference Include="..\Filtration\Filtration.csproj">
<Project>{55e0a34c-e039-43d7-a024-a4045401cdda}</Project>
<Name>Filtration</Name>
@@ -104,12 +107,6 @@
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="Resources\ThioleItemFilter.txt" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\testscript.txt" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

View File

@@ -59,62 +59,5 @@ namespace Filtration.Tests.Properties {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to # Item Filter Script created by Filtration v0.1 - www.github.com/XVar/filtration
///# Begin Script Description
///# This is a test script
///#
///# End Script Description
///
///# First test condition booyah
///Show
/// ItemLevel = 32
/// DropLevel &gt;= 85
/// Quality &gt;= 15
/// Sockets &lt; 4
/// LinkedSockets &gt;= 3
/// SetFontSize 12
///
///# Section: Gud stuff u shud pick up m9
///
///# Second test condition
///Show
/// ItemLevel &gt; 50
/// Quality &gt;= 15
/// Rarity &gt; Magic
/// Class &quot;Test Class 1&quot; &quot;Test Class 2&quot; &quot;Test Class [rest of string was truncated]&quot;;.
/// </summary>
internal static string testscript {
get {
return ResourceManager.GetString("testscript", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to ###BETA VERSION 1.0.0.1-8
///#Please test and let me know via pm on reddit /u/brute_force or @Thiole in game if i am online
///
///#------------------------------------------------------------------
///#Fishing Rods First OFC
///Show
/// Class Fishing Rods
/// SetTextColor 0 0 0
/// SetBorderColor 0 0 0
/// SetBackgroundColor 255 255 255
///
///Show
/// Class &quot;Quest Items&quot;
///
///#####Shows better currency differently from lower currency for efficiency
///##### skill gems
///Show
/// Class &quot;Active Skill Gems&quot; &quot;Support Skil [rest of string was truncated]&quot;;.
/// </summary>
internal static string ThioleItemFilter {
get {
return ResourceManager.GetString("ThioleItemFilter", resourceCulture);
}
}
}
}

View File

@@ -118,10 +118,5 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="testscript" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\testscript.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data>
<data name="ThioleItemFilter" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ThioleItemFilter.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data>
</root>

View File

@@ -1,914 +0,0 @@
###BETA VERSION 1.0.0.1-8
#Please test and let me know via pm on reddit /u/brute_force or @Thiole in game if i am online
#------------------------------------------------------------------
#Fishing Rods First OFC
Show
Class Fishing Rods
SetTextColor 0 0 0
SetBorderColor 0 0 0
SetBackgroundColor 255 255 255
Show
Class "Quest Items"
#####Shows better currency differently from lower currency for efficiency
##### skill gems
Show
Class "Active Skill Gems" "Support Skill Gems"
Quality >= 1
SetFontSize 28
SetTextColor 0 200 200
SetBorderColor 0 200 200
Show
Class "Active Skill Gems" "Support Skill Gems"
SetFontSize 30
SetTextColor 0 200 200
# Section: Chance bases
Show
BaseType "Lapis Amulet" "Amber Amulet"
SetFontSize 25
SetBorderColor 255 0 255
Show
SocketGroup RGB BGR
SetFontSize 30
SetBorderColor 0 255 0
#Chance Bases
Show
BaseType "Prophecy Wand" "Leather Belt" "Occultist's Vestment" "Agate Amulet" "Gavel"
SetFontSize 30
Rarity Normal
SetBorderColor 255 0 255
################currency highlighting
Show
BaseType "Mirror of Kalandra" "Exalted Orb" "Divine Orb" "Orb of Regret" "Eternal Orb" "Regal Orb"
SetTextColor 200 200 130
SetBorderColor 200 200 130
SetBackgroundColor 0 0 0
SetFontSize 32
Show
BaseType "Gemcutter's Prism" "Chaos Orb" "Orb of Fusing" "Orb of Alchemy"
SetBorderColor 200 200 130
SetTextColor 200 200 130
SetFontSize 30
Show
BaseType "Chromatic Orb"
SetBorderColor 0 255 0
SetTextColor 200 200 130
Show
BaseType "Cartographer's Chisel"
SetBorderColor 0 0 255
SetTextColor 200 200 130
Show
Class Currency
SetTextColor 200 200 130
SetFontSize 30
SetBackgroundColor 0 0 0
#############################
#unique Weapon slot start
#staves / wands
Show
BaseType "Judgement Staff" "Long Staff" "Vile Staff" "Imperial Staff" "Prophecy Wand" "Spiraled Wand"
Rarity Unique
SetTextColor 175 100 40
SetBorderColor 175 100 40
SetBackgroundColor 0 0 0
Show
Class "Staves"
Rarity Unique
DropLevel = 48
SetTextColor 175 100 40
SetBorderColor 175 100 40
SetBackgroundColor 0 0 0
#Claws / Daggers
Show
BaseType "Slaughter Knife" "Imperial Skean" "Thresher Claw"
Rarity Unique
SetTextColor 175 100 40
SetBorderColor 175 100 40
SetBackgroundColor 0 0 0
#Maces / Sceptres / Mauls / Axes
Show
BaseType "Void Sceptre" "Siege Axe" "Gavel"
Rarity Unique
SetTextColor 175 100 40
SetBorderColor 175 100 40
SetBackgroundColor 0 0 0
#Swords
#Bows
Show
BaseType "Spine Bow" "Imperial Bow"
Rarity Unique
SetTextColor 175 100 40
SetBorderColor 175 100 40
SetBackgroundColor 0 0 0
#Body Armor
Show
BaseType "Simple Robe" "Full Wyrmscale" "Varnished Coat" "Occultist's Vestment" "Glorious Plate" "Sacrificial Garb"
Rarity Unique
SetTextColor 175 100 40
SetBorderColor 175 100 40
SetBackgroundColor 0 0 0
#boots
Show
BaseType "Conjurer Boots"
Rarity Unique
SetTextColor 175 100 40
SetBorderColor 175 100 40
SetBackgroundColor 0 0 0
#gloves
Show
BaseType "Vaal Gauntlets" "Strapped Mitts" "Conjurer Gloves" "Deerskin Gloves" "Murder Mitts"
Rarity Unique
SetTextColor 175 100 40
SetBorderColor 175 100 40
SetBackgroundColor 0 0 0
#helm
Show
BaseType "Sinner Tricorne" "Ursine Pelt" "Ezomyte Burgonet" "Great Crown"
Rarity Unique
SetTextColor 175 100 40
SetBorderColor 175 100 40
SetBackgroundColor 0 0 0
#######shields
Show
BaseType "Champion Kite Shield" "Archon Kite Shield" "Titanium Spirit Shield" "Mosaic Kite Shield" "Branded Kite Shield"
Rarity Unique
SetTextColor 175 100 40
SetBorderColor 175 100 40
SetBackgroundColor 0 0 0
#######Amulet / Ring/ Belt
Show
BaseType "Amber Amulet" "Onyx Amulet" "Agate Amulet" "Chain Belt"
Rarity Unique
SetTextColor 175 100 40
SetBorderColor 175 100 40
SetBackgroundColor 0 0 0
Show
BaseType "Gold Ring" "Sapphire Ring" "Prismatic Ring" "Amethyst Ring" "Paua Ring"
Rarity Unique
SetTextColor 175 100 40
SetBorderColor 175 100 40
SetBackgroundColor 0 0 0
#Utility
Show
Class Jewel "Utility Flask"
Rarity Unique
SetTextColor 175 100 40
SetBorderColor 175 100 40
SetBackgroundColor 0 0 0
Show
Class Jewel
SetBorderColor 255 0 255
################### LEVEL BASED UNIQUE HIGHLIGHTING #############################
Show
BaseType "Steelscale Gauntlets" "Prophet Crown" "Leather Cap" "Pine Buckler"
Rarity Unique
ItemLevel < 70
SetTextColor 175 100 40
SetBorderColor 0 0 0
SetBackgroundColor 175 100 40
####
Show
Rarity Unique
SetFontSize 30
SetTextColor 175 100 40
SetBackgroundColor 0 0 0
###########RARES#####
#Global Rules
Show
Class Amulets Rings Belt
Rarity Rare
SetFontSize 30
SetTextColor 255 255 0
SetBorderColor 255 255 0
SetBackgroundColor 0 60 0 200
Show
BaseType "Sai" "Moon Staff" "Maraketh Bow" "Tiger Hook" "Morning Star" "Tornado Wand" "Prophecy Wand" "Imbued Wand" "Infernal Sword" "Void Axe" "Jewelled Foil" "Harpy Rapier" "Judgement Staff" "Void Sceptre" "Midnight Blade" "Eternal Sword" "Harbinger Bow" "Imperial Claw" "Ambusher" "Platinum Kris" "Terror Claw" "Imperial Skean" "Demon Dagger" "Infernal Axe"
Rarity Rare
SetFontSize 30
SetTextColor 255 255 0
SetBorderColor 255 255 0
SetBackgroundColor 0 0 0
##Level Scaling Rules
##low 60 bases###############################
Show
BaseType "Terror Maul" "Vaal Rapier" "Imperial Staff" "Carnal Sceptre" "Imperial Bow" "Vaal Claw" "Thicket Bow" "Vaal Hatchet" "Royal Axe" "Nightmare Mace" "Vaal Blade" "Vaal Sceptre"
Rarity Rare
ItemLevel <= 70
SetFontSize 30
SetTextColor 255 255 0
SetBorderColor 255 255 0
SetBackgroundColor 0 0 0
Show
BaseType "Terror Maul" "Vaal Rapier" "Imperial Staff" "Carnal Sceptre" "Imperial Bow" "Vaal Claw" "Thicket Bow" "Vaal Hatchet" "Royal Axe" "Nightmare Mace" "Vaal Blade" "Vaal Sceptre"
Rarity Rare
ItemLevel <= 75
SetFontSize 30
SetTextColor 255 255 0
SetBorderColor 255 255 0
SetBackgroundColor 0 100 0 200
#####
Show
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
Rarity Rare
ItemLevel <= 75
DropLevel >= 67
SetFontSize 30
SetTextColor 255 255 0
SetBorderColor 255 255 0
SetBackgroundColor 0 100 0 200
Show
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
Rarity Rare
DropLevel >= 68
SetFontSize 30
SetTextColor 255 255 0
SetBorderColor 255 255 0
SetBackgroundColor 0 0 0
#######65-68 bases
Show
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
Rarity Rare
ItemLevel <= 73
DropLevel > 65
SetFontSize 30
SetTextColor 255 255 0
SetBorderColor 255 255 0
SetBackgroundColor 0 100 0 200
Show
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
Rarity Rare
DropLevel > 65
SetFontSize 30
SetTextColor 255 255 0
SetBorderColor 255 255 0
SetBackgroundColor 0 0 0
########## 60-65 bases
Show
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
Rarity Rare
ItemLevel <= 68
DropLevel > 60
SetFontSize 30
SetTextColor 255 255 0
SetBorderColor 255 255 0
SetBackgroundColor 0 100 0 200
Show
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
Rarity Rare
ItemLevel <= 73
DropLevel > 60
SetFontSize 30
SetTextColor 255 255 0
SetBorderColor 255 255 0
SetBackgroundColor 0 0 0
##### 55-60 bases
Show
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
Rarity Rare
ItemLevel <= 64
DropLevel > 55
SetFontSize 30
SetTextColor 255 255 0
SetBorderColor 255 255 0
SetBackgroundColor 0 100 0 200
Show
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
Rarity Rare
ItemLevel <= 70
DropLevel > 55
SetFontSize 30
SetTextColor 255 255 0
SetBorderColor 255 255 0
SetBackgroundColor 0 0 0
## 50-55 bases
Show
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
Rarity Rare
ItemLevel <= 58
DropLevel > 50
SetFontSize 30
SetTextColor 255 255 0
SetBorderColor 255 255 0
SetBackgroundColor 0 100 0 200
Show
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
Rarity Rare
ItemLevel <= 65
DropLevel > 50
SetFontSize 30
SetTextColor 255 255 0
SetBorderColor 255 255 0
SetBackgroundColor 0 0 0
#####46-50 bases
Show
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
Rarity Rare
ItemLevel <= 54
DropLevel > 46
SetFontSize 30
SetTextColor 255 255 0
SetBorderColor 255 255 0
SetBackgroundColor 0 100 0 200
Show
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
Rarity Rare
ItemLevel <= 60
DropLevel > 46
SetFontSize 30
SetTextColor 255 255 0
SetBorderColor 255 255 0
SetBackgroundColor 0 0 0
####42 - 48 bases
Show
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
Rarity Rare
ItemLevel <= 48
DropLevel > 42
SetFontSize 30
SetTextColor 255 255 0
SetBorderColor 255 255 0
SetBackgroundColor 0 100 0 200
Show
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
Rarity Rare
ItemLevel <= 51
DropLevel > 42
SetFontSize 30
SetTextColor 255 255 0
SetBorderColor 255 255 0
SetBackgroundColor 0 0 0
###38-42
Show
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
Rarity Rare
ItemLevel <= 42
DropLevel > 38
SetFontSize 30
SetTextColor 255 255 0
SetBorderColor 255 255 0
SetBackgroundColor 0 100 0 200
Show
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
Rarity Rare
ItemLevel <= 48
DropLevel > 38
SetFontSize 30
SetTextColor 255 255 0
SetBorderColor 255 255 0
SetBackgroundColor 0 0 0
####33-38
Show
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
Rarity Rare
ItemLevel <= 39
DropLevel > 33
SetFontSize 30
SetTextColor 255 255 0
SetBorderColor 255 255 0
SetBackgroundColor 0 100 0 200
Show
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
Rarity Rare
ItemLevel <= 42
DropLevel > 33
SetFontSize 30
SetTextColor 255 255 0
SetBorderColor 255 255 0
SetBackgroundColor 0 0 0
#### 27 - 32
Show
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
Rarity Rare
ItemLevel <= 32
DropLevel > 27
SetFontSize 30
SetTextColor 255 255 0
SetBorderColor 255 255 0
SetBackgroundColor 0 100 0 200
Show
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
Rarity Rare
ItemLevel <= 38
DropLevel > 27
SetFontSize 30
SetTextColor 255 255 0
SetBorderColor 255 255 0
SetBackgroundColor 0 0 0
##### 22- 27
Show
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
Rarity Rare
ItemLevel <= 27
DropLevel > 22
SetFontSize 30
SetTextColor 255 255 0
SetBorderColor 255 255 0
SetBackgroundColor 0 100 0 200
Show
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
Rarity Rare
ItemLevel <= 31
DropLevel > 22
SetFontSize 30
SetTextColor 255 255 0
SetBorderColor 255 255 0
SetBackgroundColor 0 0 0
########18-22
Show
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
Rarity Rare
ItemLevel <= 22
DropLevel > 18
SetFontSize 30
SetTextColor 255 255 0
SetBorderColor 255 255 0
SetBackgroundColor 0 100 0 200
Show
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
Rarity Rare
ItemLevel <= 27
DropLevel > 18
SetFontSize 30
SetTextColor 255 255 0
SetBorderColor 255 255 0
SetBackgroundColor 0 0 0
##12-18
Show
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
Rarity Rare
ItemLevel <= 18
DropLevel > 12
SetFontSize 30
SetTextColor 255 255 0
SetBorderColor 255 255 0
SetBackgroundColor 0 100 0 200
Show
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
Rarity Rare
ItemLevel <= 24
DropLevel > 12
SetFontSize 30
SetTextColor 255 255 0
SetBorderColor 255 255 0
SetBackgroundColor 0 0 0
###### 8-12
Show
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
Rarity Rare
ItemLevel <= 12
DropLevel > 8
SetFontSize 30
SetTextColor 255 255 0
SetBorderColor 255 255 0
SetBackgroundColor 0 100 0 200
Show
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
Rarity Rare
ItemLevel <= 16
DropLevel > 8
SetFontSize 30
SetTextColor 255 255 0
SetBorderColor 255 255 0
SetBackgroundColor 0 0 0
#####1-8
Show
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
Rarity Rare
ItemLevel <= 8
DropLevel >= 0
SetFontSize 30
SetTextColor 255 255 0
SetBorderColor 255 255 0
SetBackgroundColor 0 100 0 200
Show
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
Rarity Rare
ItemLevel <= 12
DropLevel >= 0
SetFontSize 30
SetTextColor 255 255 0
SetBorderColor 255 255 0
SetBackgroundColor 0 0 0
###Rare highlighting
Show
Rarity Rare
SetFontSize 27
SetTextColor 255 255 0 170
SetBorderColor 255 255 0
SetBackgroundColor 100 40 40 200
#### Flask Highlighting
Show
Class Flask
Quality > 13
SetFontSize 25
SetBorderColor 255 255 255
Show
Class Flask
Quality > 5
SetFontSize 25
Show
Class "Utility Flask"
SetFontSize 30
###### RGB Highlighting
Show
SocketGroup RGB BGR
SetFontSize 30
SetTextColor 0 255 0
SetBorderColor 0 255 0
########Chisel Recipe Highlighting
Show
BaseType "Gavel" "Rock Breaker" "Stone Hammer"
Rarity Normal
SetFontSize 25
SetBorderColor 0 0 255
Show
BaseType "Gavel" "Rock Breaker" "Stone Hammer"
Rarity Magic
Quality > 15
SetFontSize 25
SetBorderColor 0 0 255
####### 6S/5L
Show
LinkedSockets >= 5
SetBorderColor 255 0 0
SetFontSize 30
Show
Sockets 6
SetBorderColor 255 0 0
SetFontSize 30
Show
LinkedSockets >= 3
ItemLevel < 20
########################### Normal Show Rules
Show
BaseType "Sai" "Moon Staff" "Maraketh Bow" "Tiger Hook" "Morning Star" "Tornado Wand" "Prophecy Wand" "Imbued Wand" "Infernal Sword" "Void Axe" "Jewelled Foil" "Harpy Rapier" "Judgement Staff" "Void Sceptre" "Midnight Blade" "Eternal Sword" "Harbinger Bow" "Imperial Claw" "Ambusher" "Platinum Kris" "Terror Claw" "Imperial Skean" "Demon Dagger" "Infernal Axe"
SetFontSize 30
### Show these whites up to 70
Show
BaseType "Terror Maul" "Vaal Rapier" "Imperial Staff" "Carnal Sceptre" "Imperial Bow" "Vaal Claw" "Thicket Bow" "Vaal Hatchet" "Royal Axe" "Nightmare Mace" "Vaal Blade" "Vaal Sceptre"
Rarity Normal
SetFontSize 30
ItemLevel <= 70
###### T1 Bases up to forever
Show
Class "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
DropLevel >= 68
Rarity Normal
SetFontSize 30
### T2 Bases up to 70
Show
Class "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
ItemLevel <= 70
DropLevel > 64
Rarity Normal
SetFontSize 30
###### T3 Bases up to 65
Show
Class "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
ItemLevel <= 65
DropLevel > 59
Rarity Normal
SetFontSize 30
#### t4 Bases up to 60
Show
Class "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
ItemLevel <= 60
DropLevel > 53
Rarity Normal
SetFontSize 30
###### T5 up to 56
Show
Class "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
ItemLevel <= 56
DropLevel > 49
Rarity Normal
SetFontSize 30
##### t6 up to 50
Show
Class "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
ItemLevel <= 50
DropLevel > 44
Rarity Normal
SetFontSize 30
##### t7 up to 45
Show
Class "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
ItemLevel <= 45
DropLevel > 39
Rarity Normal
SetFontSize 30
##### t8 up to 39
Show
Class "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
ItemLevel <= 39
DropLevel > 33
Rarity Normal
SetFontSize 30
##### t9 up to 34
Show
Class "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
ItemLevel <= 34
DropLevel > 28
Rarity Normal
SetFontSize 30
#### t10 up to 30
Show
Class "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
ItemLevel <= 30
DropLevel > 27
Rarity Normal
SetFontSize 30
#t11 up to 29
Show
Class "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
ItemLevel <= 29
DropLevel > 21
Rarity Normal
SetFontSize 30
#t12 bases up to 27
Show
Class "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
ItemLevel <= 27
DropLevel > 20
Rarity Normal
SetFontSize 30
#T13 Bases up to 21
Show
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
ItemLevel <= 21
DropLevel > 15
Rarity Normal
SetFontSize 29
#### t14 up to 17
Show
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
ItemLevel <= 17
DropLevel > 10
Rarity Normal
SetFontSize 30
####t15 up to 15
Show
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
ItemLevel <= 14
DropLevel > 7
Rarity Normal
SetFontSize 29
###t16 up to 10
Show
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
ItemLevel <= 10
DropLevel > 5
Rarity Normal
SetFontSize 29
####t17 up to 7
Show
Class "Body Armour" "Gloves" "Boots" "Belt" "Helm" "Shield" "Quiver" "Bow" "Staves" "Two Hand Axes" "Claw" "One Hand Axe" "Wands" "One Hand Swords" "Thrusting One Hand Swords" "One Hand Mace" "Two Hand Mace" "Two Hand Sword" "Dagger" "Sceptre"
ItemLevel <= 7
DropLevel >= 1
Rarity Normal
SetFontSize 29
##################### WHITES RULES DONE
#### Show rings at all levels for progression
Show
Class Ring Amulet
ItemLevel < 70
Show
Class Boots Gloves Helmet Shield Belt
Rarity Magic
SetFontSize 25
ItemLevel < 20
#### Cant get map based level highlighting to work, DropLevel does not work for maps
Show
Class "Map Fragments" "Maps"
##### Flask based level visibility
### Small Flask to ~ End of A1N, REQ level 0
Show
BaseType "Small Life Flask" "Small Mana Flask"
ItemLevel < 12
SetFontSize 30
SetBorderColor 255 255 255
#### Medium Ends midway through a2, medium starts dropping around the same time as large, REQ LEVEL 4
Show
BaseType "Medium Life Flask" "Medium Mana Flask"
ItemLevel < 19
SetFontSize 30
SetBorderColor 255 255 255
#### Large Ends around the same time, these make mediums basically obsolete, i only keep mediums on because of 3x vendor recipe for another large REQ LEVEL 14
Show
BaseType "Large Life Flask" "Large Mana Flask"
ItemLevel < 20
SetFontSize 30
SetBorderColor 255 255 255
#### Greater ends near the end of a2/beginning of a3 REQ LEVEL 18
Show
BaseType "Greater Life Flask" "Greater Mana Flask"
ItemLevel < 24
SetFontSize 30
SetBorderColor 255 255 255
#### Hides Midway through A3N REQ LEVEL 26
Show
BaseType "Grand Life Flask" "Grand Mana Flask"
ItemLevel < 34
SetFontSize 30
SetBorderColor 255 255 255
####Hides Near the end of Normal difficulty REQ LEVEL 34
Show
BaseType "Giant Life Flask" "Giant Mana Flask"
ItemLevel < 38
SetFontSize 30
SetBorderColor 255 255 255
####Hides somewhere at the start of cruel REQ LEVEL 37
Show
BaseType "Colossal Life Flask" "Colossal Mana Flask"
ItemLevel < 45
SetFontSize 30
SetBorderColor 255 255 255
####### Hides Midway through cruel REQ LEVEL 45
Show
BaseType "Sacred Life Flask" "Sacred Mana Flask"
ItemLevel < 49
SetFontSize 30
SetBorderColor 255 255 255
### REQ LEVEL 53
Show
BaseType "Hallowed Life Flask" "Hallowed Mana Flask"
ItemLevel < 58
SetFontSize 30
SetBorderColor 255 255 255
##### REQ LEVEL 60
Show
BaseType "Sanctified Life Flask" "Sanctified Mana Flask"
ItemLevel < 70
SetFontSize 30
SetBorderColor 255 255 255
### REQ LEVEL 65 and 70 Respectively 2 best bases in game, always show
Show
BaseType "Divine Life Flask" "Eternal Life Flask" "Divine Mana Flask" "Eternal Mana Flask"
SetFontSize 30
SetBorderColor 255 255 255
Hide
SetFontSize 20
SetBackgroundColor 0 0 0 50

View File

@@ -1,39 +0,0 @@
# Item Filter Script created by Filtration v0.1 - www.github.com/XVar/filtration
# Begin Script Description
# This is a test script
#
# End Script Description
# First test condition booyah
Show
ItemLevel = 32
DropLevel >= 85
Quality >= 15
Sockets < 4
LinkedSockets >= 3
SetFontSize 12
# Section: Gud stuff u shud pick up m9
# Second test condition
Show
ItemLevel > 50
Quality >= 15
Rarity > Magic
Class "Test Class 1" "Test Class 2" "Test Class 3" "Test Class 4" "Test Class 5" "Test Class 6" "Test Class 7" "Test Class 8" "Test Class 9" "Test Class 10"
BaseType "Test Base Type 1" "Test Base Type 2"
Sockets <= 5
LinkedSockets = 2
SetFontSize 10
Show
ItemLevel > 50
Quality >= 15
Rarity > Magic
Class "Test Class 1" "Test Class 2" "Test Class 3" "Test Class 4" "Test Class 5" "Test Class 6" "Test Class 7" "Test Class 8" "Test Class 9" "Test Class 10"
BaseType "Test Base Type 1" "Test Base Type 2"
Sockets <= 5
LinkedSockets = 2
SetFontSize 10
Hide

View File

@@ -2,8 +2,8 @@
using System.Threading.Tasks;
using Filtration.Common.Services;
using Filtration.ObjectModel;
using Filtration.Parser.Interface.Services;
using Filtration.Services;
using Filtration.Translators;
using Moq;
using NUnit.Framework;

View File

@@ -1,121 +0,0 @@
using System.Collections.Generic;
using Filtration.ObjectModel;
using Filtration.Translators;
using NUnit.Framework;
namespace Filtration.Tests.Translators
{
[TestFixture]
public class TestBlockGroupHierarchyBuilder
{
[Test]
public void IntegrateStringListIntoBlockGroupHierarchy_ReturnsBlockGroupWithCorrectName()
{
// Arrange
var inputStrings = new List<string> {"Block Group", "Sub Block Group"};
var rootBlock = new ItemFilterBlockGroup("Root", null);
var builder = new BlockGroupHierarchyBuilder();
// Act
var result = builder.IntegrateStringListIntoBlockGroupHierarchy(inputStrings, rootBlock);
// Assert
Assert.AreEqual(1, rootBlock.ChildGroups.Count);
Assert.AreEqual("Sub Block Group", result.GroupName);
}
[Test]
public void IntegrateStringListIntoBlockGroupHierarchy_SingleBlockGroup()
{
// Arrange
var inputStrings = new List<string> { "Block Group" };
var rootBlock = new ItemFilterBlockGroup("Root", null);
var builder = new BlockGroupHierarchyBuilder();
// Act
var result = builder.IntegrateStringListIntoBlockGroupHierarchy(inputStrings, rootBlock);
// Assert
Assert.AreEqual(1, rootBlock.ChildGroups.Count);
Assert.AreEqual("Block Group", result.GroupName);
}
[Test]
public void IntegrateStringListIntoBlockGroupHierarchy_AdvancedBlockGroup_MarksBlockGroupAsAdvanced()
{
// Arrange
var inputStrings = new List<string> { "~Block Group" };
var rootBlock = new ItemFilterBlockGroup("Root", null);
var builder = new BlockGroupHierarchyBuilder();
// Act
var result = builder.IntegrateStringListIntoBlockGroupHierarchy(inputStrings, rootBlock);
// Assert
Assert.AreEqual(1, rootBlock.ChildGroups.Count);
Assert.AreEqual("Block Group", result.GroupName);
Assert.AreEqual(true, result.Advanced);
}
[Test]
public void IntegrateStringListIntoBlockGroupHierarchy_AdvancedBlockGroup_ChildrenAreCreatedAsAdvanced()
{
// Arrange
var inputStrings = new List<string> { "~Advanced Block Group", "This should be advanced too" };
var rootBlock = new ItemFilterBlockGroup("Root", null);
var builder = new BlockGroupHierarchyBuilder();
// Act
var result = builder.IntegrateStringListIntoBlockGroupHierarchy(inputStrings, rootBlock);
// Assert
Assert.AreEqual(1, rootBlock.ChildGroups.Count);
Assert.AreEqual(true, result.Advanced);
}
[Test]
public void IntegrateStringListIntoBlockGroupHierarchy_ExistingAdvancedBlockGroup_SetsParentCorrectly()
{
// Arrange
var inputStrings = new List<string> { "~Block Group" };
var rootBlock = new ItemFilterBlockGroup("Root", null);
var subBlock = new ItemFilterBlockGroup("Block Group", rootBlock, true);
rootBlock.ChildGroups.Add(subBlock);
var builder = new BlockGroupHierarchyBuilder();
// Act
var result = builder.IntegrateStringListIntoBlockGroupHierarchy(inputStrings, rootBlock);
// Assert
Assert.AreEqual(1, rootBlock.ChildGroups.Count);
Assert.AreEqual("Block Group", result.GroupName);
Assert.AreEqual(true, result.Advanced);
}
[Test]
public void IntegrateStringListIntoBlockGroupHierarchy_MultipleBlockGroups()
{
// Arrange
var rootBlock = new ItemFilterBlockGroup("Root", null);
var builder = new BlockGroupHierarchyBuilder();
// Act
var inputStrings = new List<string> { "Block Group" };
builder.IntegrateStringListIntoBlockGroupHierarchy(inputStrings, rootBlock);
inputStrings = new List<string> { "Block Group 2" };
builder.IntegrateStringListIntoBlockGroupHierarchy(inputStrings, rootBlock);
inputStrings = new List<string> { "Block Group", "Sub Block Group" };
var result = builder.IntegrateStringListIntoBlockGroupHierarchy(inputStrings, rootBlock);
// Assert
Assert.AreEqual(2, rootBlock.ChildGroups.Count);
Assert.AreEqual("Sub Block Group", result.GroupName);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,406 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using Filtration.ObjectModel;
using Filtration.ObjectModel.BlockItemTypes;
using Filtration.ObjectModel.Enums;
using Filtration.ObjectModel.ThemeEditor;
using Filtration.Properties;
using Filtration.Translators;
using Moq;
using NUnit.Framework;
using Resources = Filtration.Tests.Properties.Resources;
namespace Filtration.Tests.Translators
{
[TestFixture]
public class TestItemFilterScriptTranslator
{
private ItemFilterScriptTranslatorTestUtility _testUtility;
[SetUp]
public void ItemFilterScriptTranslatorTestSetup()
{
_testUtility = new ItemFilterScriptTranslatorTestUtility();
Settings.Default.Reset();
}
[Test]
public void TranslateStringToItemFilterScript_ReturnsScriptWithCorrectNumberOfBlocks()
{
// Arrange
var testInput = Resources.testscript;
_testUtility.MockItemFilterBlockTranslator.Setup(t => t.TranslateStringToItemFilterBlock(It.IsAny<string>(), It.IsAny<ThemeComponentCollection>())).Verifiable();
// Act
var script = _testUtility.ScriptTranslator.TranslateStringToItemFilterScript(testInput);
// Assert
Assert.AreEqual(5, script.ItemFilterBlocks.Count);
_testUtility.MockItemFilterBlockTranslator.Verify();
}
[Test]
public void TranslateStringToItemFilterScript_ReturnsScriptWithDescriptionCorrectlySet()
{
// Arrange
var testInput = Resources.testscript;
var expectedDescription = "Item Filter Script created by Filtration v0.1 - www.github.com/XVar/filtration" + Environment.NewLine +
"Begin Script Description" + Environment.NewLine +
"This is a test script" + Environment.NewLine +
Environment.NewLine +
"End Script Description";
var mockItemFilterBlockTranslator = new Mock<IItemFilterBlockTranslator>();
mockItemFilterBlockTranslator.Setup(t => t.TranslateStringToItemFilterBlock(It.IsAny<string>(), It.IsAny<ThemeComponentCollection>())).Verifiable();
// Act
var script = _testUtility.ScriptTranslator.TranslateStringToItemFilterScript(testInput);
// Assert
Assert.AreEqual(expectedDescription, script.Description);
}
[Test]
public void TranslateStringToItemFilterScript_ThioleItemFilterTest()
{
// Arrange
var testInput = Resources.ThioleItemFilter;
var blockTranslator = new ItemFilterBlockTranslator(_testUtility.MockBlockGroupHierarchyBuilder.Object);
var translator = new ItemFilterScriptTranslator(blockTranslator, _testUtility.MockBlockGroupHierarchyBuilder.Object);
// Act
translator.TranslateStringToItemFilterScript(testInput);
// Assert
// Not crashing out when loading a huge script means this integration test has passed!
}
[Test]
public void TranslateItemFilterScriptToString_OneBlock_CallsTranslator()
{
// Arrange
var testScript = new ItemFilterScript();
var testBlock = new ItemFilterBlock();
testBlock.BlockItems.Add(new ItemLevelBlockItem(FilterPredicateOperator.Equal, 5));
const string blockOutput = "Test Script Output";
testScript.ItemFilterBlocks.Add(testBlock);
_testUtility.MockItemFilterBlockTranslator.Setup(t => t.TranslateItemFilterBlockToString(testBlock)).Returns(blockOutput).Verifiable();
// Act
_testUtility.ScriptTranslator.TranslateItemFilterScriptToString(testScript);
// Assert
_testUtility.MockItemFilterBlockTranslator.Verify();
}
[Test]
public void TranslateItemFilterScriptToString_ExtraLineBetweenBlocksSettingFalse_ReturnsCorrectOutput()
{
Settings.Default.ExtraLineBetweenBlocks = false;
var script = new ItemFilterScript();
var block1 = new ItemFilterBlock { Description = "Test Filter 1" };
block1.BlockItems.Add(new ItemLevelBlockItem(FilterPredicateOperator.GreaterThan, 5));
var block2 = new ItemFilterBlock();
block2.BlockItems.Add(new QualityBlockItem(FilterPredicateOperator.LessThan, 15));
block2.BlockItems.Add(new FontSizeBlockItem(7));
block2.BlockItems.Add(new WidthBlockItem(FilterPredicateOperator.Equal, 3));
script.ItemFilterBlocks.Add(block1);
script.ItemFilterBlocks.Add(block2);
var expectedOutput = "# Script edited with Filtration - https://github.com/ben-wallis/Filtration" + Environment.NewLine +
"# Test Filter 1" + Environment.NewLine +
"Show" + Environment.NewLine +
" ItemLevel > 5" + Environment.NewLine +
"Show" + Environment.NewLine +
" Quality < 15" + Environment.NewLine +
" Width = 3" + Environment.NewLine +
" SetFontSize 7" + Environment.NewLine;
var blockTranslator = new ItemFilterBlockTranslator(_testUtility.MockBlockGroupHierarchyBuilder.Object);
var translator = new ItemFilterScriptTranslator(blockTranslator,
_testUtility.MockBlockGroupHierarchyBuilder.Object);
// Act
var result = translator.TranslateItemFilterScriptToString(script);
// Assert
Assert.AreEqual(expectedOutput, result);
}
[Test]
public void TranslateItemFilterScriptToString_FullScript_ReturnsCorrectOutput()
{
var script = new ItemFilterScript
{
Description = "Test script description" + Environment.NewLine +
"This is a really great script!" + Environment.NewLine +
"Multiple line script descriptions are fun!"
};
var block1 = new ItemFilterBlock {Description = "Test Filter 1"};
block1.BlockItems.Add(new ItemLevelBlockItem(FilterPredicateOperator.GreaterThan, 5));
var block2 = new ItemFilterBlock();
block2.BlockItems.Add(new QualityBlockItem(FilterPredicateOperator.LessThan, 15));
block2.BlockItems.Add(new FontSizeBlockItem(7));
block2.BlockItems.Add(new WidthBlockItem(FilterPredicateOperator.Equal, 3));
script.ItemFilterBlocks.Add(block1);
script.ItemFilterBlocks.Add(block2);
var expectedOutput = "# Script edited with Filtration - https://github.com/ben-wallis/Filtration" + Environment.NewLine +
"# Test script description" + Environment.NewLine +
"# This is a really great script!" + Environment.NewLine +
"# Multiple line script descriptions are fun!" + Environment.NewLine +
Environment.NewLine +
"# Test Filter 1" + Environment.NewLine +
"Show" + Environment.NewLine +
" ItemLevel > 5" + Environment.NewLine +
Environment.NewLine +
"Show" + Environment.NewLine +
" Quality < 15" + Environment.NewLine +
" Width = 3" + Environment.NewLine +
" SetFontSize 7" + Environment.NewLine + Environment.NewLine;
var blockTranslator = new ItemFilterBlockTranslator(_testUtility.MockBlockGroupHierarchyBuilder.Object);
var translator = new ItemFilterScriptTranslator(blockTranslator,
_testUtility.MockBlockGroupHierarchyBuilder.Object);
// Act
var result = translator.TranslateItemFilterScriptToString(script);
// Assert
Assert.AreEqual(expectedOutput, result);
}
[Test]
public void TranslateItemFilterScriptToString_FullScriptWithExistingFiltrationTagline_ReturnsCorrectOutput()
{
var script = new ItemFilterScript
{
Description = "Script edited with Filtration - https://github.com/ben-wallis/Filtration" + Environment.NewLine +
"Test script description" + Environment.NewLine
};
var expectedOutput = "# Script edited with Filtration - https://github.com/ben-wallis/Filtration" +
Environment.NewLine +
"# Test script description" + Environment.NewLine + Environment.NewLine;
// Act
var result = _testUtility.ScriptTranslator.TranslateItemFilterScriptToString(script);
// Assert
Assert.AreEqual(expectedOutput, result);
}
[Test]
public void TranslateStringToItemFilterScript_SectionDirectlyBeforeBlockWithoutDescription_ReturnsCorrectObject()
{
// Arrange
var testInputScript = "# My Script" + Environment.NewLine +
Environment.NewLine +
"# Section: Chance Bases" + Environment.NewLine +
"Show" + Environment.NewLine +
" BaseType \"Lapis Amulet\" \"Amber Amulet\"" + Environment.NewLine +
" SetBorderColor 255 0 255" + Environment.NewLine +
" SetFontSize 25";
var blockTranslator = new ItemFilterBlockTranslator(_testUtility.MockBlockGroupHierarchyBuilder.Object);
var translator = new ItemFilterScriptTranslator(blockTranslator,
_testUtility.MockBlockGroupHierarchyBuilder.Object);
// Act
var result = translator.TranslateStringToItemFilterScript(testInputScript);
// Assert
Assert.AreEqual(2, result.ItemFilterBlocks.Count);
var block = result.ItemFilterBlocks.First(l => l.GetType() != typeof(ItemFilterSection));
Assert.AreEqual(4, block.BlockItems.Count);
var baseTypeItem = block.BlockItems.OfType<BaseTypeBlockItem>().First();
Assert.AreEqual(2, baseTypeItem.Items.Count);
}
[Test]
public void TranslateStringToItemFilterScript_OneLineDescriptionNoBlockDescriptionAddsDescriptionToScript()
{
// Arrange
var testInputScript = "# Script edited with Filtration - https://github.com/ben-wallis/Filtration" +
Environment.NewLine +
"Show" + Environment.NewLine +
"BaseType \"Maelström Staff\"" + Environment.NewLine + Environment.NewLine;
var blockTranslator = new ItemFilterBlockTranslator(_testUtility.MockBlockGroupHierarchyBuilder.Object);
var translator = new ItemFilterScriptTranslator(blockTranslator,
_testUtility.MockBlockGroupHierarchyBuilder.Object);
// Act
var result = translator.TranslateStringToItemFilterScript(testInputScript);
// Assert
Assert.AreEqual("Script edited with Filtration - https://github.com/ben-wallis/Filtration", result.Description);
var firstBlock = result.ItemFilterBlocks.First();
Assert.IsNull(firstBlock.Description);
}
[Test]
public void TranslateStringToItemFilterScript_DisabledBlock_ReturnsCorrectBlockCount()
{
// Arrange
var testInputScript = "Show" + Environment.NewLine +
" ItemLevel > 2" + Environment.NewLine +
" SetTextColor 255 40 0" + Environment.NewLine +
Environment.NewLine +
"#Disabled Block Start" + Environment.NewLine +
"#Show" + Environment.NewLine +
"# ItemLevel > 2" + Environment.NewLine +
"# SetTextColor 255 215 0" + Environment.NewLine +
"# SetBorderColor 255 105 180" + Environment.NewLine +
"# SetFontSize 32" + Environment.NewLine +
"#Disabled Block End" + Environment.NewLine +
Environment.NewLine +
"Show" + Environment.NewLine +
" ItemLevel > 20" + Environment.NewLine +
" SetTextColor 255 255 0";
var blockTranslator = new ItemFilterBlockTranslator(_testUtility.MockBlockGroupHierarchyBuilder.Object);
var translator = new ItemFilterScriptTranslator(blockTranslator,
_testUtility.MockBlockGroupHierarchyBuilder.Object);
// Act
var result = translator.TranslateStringToItemFilterScript(testInputScript);
// Assert
Assert.AreEqual(3, result.ItemFilterBlocks.Count);
}
[Test]
public void TranslateStringToItemFilterScript_DisabledBlock_ReturnsCorrectBlocks()
{
// Arrange
var testInputScript = "Show" + Environment.NewLine +
" ItemLevel > 2" + Environment.NewLine +
" SetTextColor 255 40 0" + Environment.NewLine +
Environment.NewLine +
"#Disabled Block Start" + Environment.NewLine +
"#Show" + Environment.NewLine +
"# ItemLevel > 2" + Environment.NewLine +
"# SetTextColor 255 215 0" + Environment.NewLine +
"# SetBorderColor 255 105 180" + Environment.NewLine +
"# SetFontSize 32" + Environment.NewLine +
"#Disabled Block End" + Environment.NewLine +
Environment.NewLine +
"Show" + Environment.NewLine +
" ItemLevel > 20" + Environment.NewLine +
" SetTextColor 255 255 0";
var blockTranslator = new ItemFilterBlockTranslator(_testUtility.MockBlockGroupHierarchyBuilder.Object);
var translator = new ItemFilterScriptTranslator(blockTranslator,
_testUtility.MockBlockGroupHierarchyBuilder.Object);
// Act
var result = translator.TranslateStringToItemFilterScript(testInputScript);
// Assert
Assert.AreEqual(3, result.ItemFilterBlocks.Count);
var firstBlock = result.ItemFilterBlocks.First();
var secondBlock = result.ItemFilterBlocks.Skip(1).First();
var thirdBlock = result.ItemFilterBlocks.Skip(2).First();
Assert.AreEqual(3, firstBlock.BlockItems.Count);
Assert.AreEqual(5, secondBlock.BlockItems.Count);
Assert.AreEqual(3, thirdBlock.BlockItems.Count);
}
[Test]
public void TranslateStringToItemFilterScript_DisabledBlock_BlockDescriptionNotLost()
{
// Arrange
var testInputScript = "Show" + Environment.NewLine +
" ItemLevel > 2" + Environment.NewLine +
" SetTextColor 255 40 0" + Environment.NewLine +
Environment.NewLine +
"#Disabled Block Start" + Environment.NewLine +
"# This is a disabled block" + Environment.NewLine +
"#Show" + Environment.NewLine +
"# ItemLevel > 2" + Environment.NewLine +
"#Disabled Block End";
var blockTranslator = new ItemFilterBlockTranslator(_testUtility.MockBlockGroupHierarchyBuilder.Object);
var translator = new ItemFilterScriptTranslator(blockTranslator,
_testUtility.MockBlockGroupHierarchyBuilder.Object);
// Act
var result = translator.TranslateStringToItemFilterScript(testInputScript);
// Assert
Assert.AreEqual(2, result.ItemFilterBlocks.Count);
var secondBlock = result.ItemFilterBlocks.Skip(1).First();
Assert.AreEqual("This is a disabled block", secondBlock.Description);
}
[Test]
public void TranslateStringToItemFilterScript_DisabledBlockWithBlockGroup_ReturnsCorrectBlock()
{
// Arrange
var testInputScript = "Show" + Environment.NewLine +
" ItemLevel > 2" + Environment.NewLine +
" SetTextColor 255 40 0" + Environment.NewLine +
Environment.NewLine +
"#Disabled Block Start" + Environment.NewLine +
"# This is a disabled block" + Environment.NewLine +
"#Show#My Block Group" + Environment.NewLine +
"# ItemLevel > 2" + Environment.NewLine +
"#Disabled Block End";
var blockTranslator = new ItemFilterBlockTranslator(_testUtility.MockBlockGroupHierarchyBuilder.Object);
_testUtility.MockBlockGroupHierarchyBuilder.Setup(
b => b.IntegrateStringListIntoBlockGroupHierarchy(It.IsAny<IEnumerable<string>>()))
.Returns(new ItemFilterBlockGroup("My Block Group", null));
var translator = new ItemFilterScriptTranslator(blockTranslator,
_testUtility.MockBlockGroupHierarchyBuilder.Object);
// Act
var result = translator.TranslateStringToItemFilterScript(testInputScript);
// Assert
Assert.AreEqual(2, result.ItemFilterBlocks.Count);
var secondBlock = result.ItemFilterBlocks.Skip(1).First();
Assert.AreEqual("This is a disabled block", secondBlock.Description);
Assert.AreEqual("My Block Group", secondBlock.BlockGroup.GroupName);
}
private class ItemFilterScriptTranslatorTestUtility
{
public ItemFilterScriptTranslatorTestUtility()
{
// Mock setups
MockItemFilterBlockTranslator = new Mock<IItemFilterBlockTranslator>();
MockBlockGroupHierarchyBuilder = new Mock<IBlockGroupHierarchyBuilder>();
// Class under test instantiation
ScriptTranslator = new ItemFilterScriptTranslator(MockItemFilterBlockTranslator.Object, MockBlockGroupHierarchyBuilder.Object);
}
public ItemFilterScriptTranslator ScriptTranslator { get; }
public Mock<IItemFilterBlockTranslator> MockItemFilterBlockTranslator { get; }
public Mock<IBlockGroupHierarchyBuilder> MockBlockGroupHierarchyBuilder { get; }
}
}
}