Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented filters with values at 20% quality #478

Merged
merged 7 commits into from
Jan 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ public override void Parse(ItemProperties itemProperties, ParsingItem parsingIte
Text = gameLanguageProvider.Language.DescriptionArmour,
NormalizeEnabled = true,
NormalizeValue = normalizeValue,
Value = item.Properties.Armour,
Value = item.Properties.ArmourWithQuality,
OriginalValue = item.Properties.Armour,
Checked = false,
};
filter.NormalizeMinValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public override void Parse(ItemProperties itemProperties, ParsingItem parsingIte
NormalizeEnabled = true,
NormalizeValue = normalizeValue,
Value = item.Properties.BlockChance,
ValueSuffix = "%",
Checked = false,
};
filter.NormalizeMinValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public override void Parse(ItemProperties itemProperties, ParsingItem parsingIte
NormalizeEnabled = true,
NormalizeValue = normalizeValue,
Value = item.Properties.CriticalHitChance,
ValueSuffix = "%",
Checked = false,
};
filter.NormalizeMinValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ public override void Parse(ItemProperties itemProperties, ParsingItem parsingIte
Text = text,
NormalizeEnabled = true,
NormalizeValue = normalizeValue,
Value = item.Properties.EnergyShield,
Value = item.Properties.EnergyShieldWithQuality,
OriginalValue = item.Properties.EnergyShield,
Checked = false,
};
filter.NormalizeMinValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ public override void Parse(ItemProperties itemProperties, ParsingItem parsingIte
Text = gameLanguageProvider.Language.DescriptionEvasion,
NormalizeEnabled = true,
NormalizeValue = normalizeValue,
Value = item.Properties.EvasionRating,
Value = item.Properties.EvasionRatingWithQuality,
OriginalValue = item.Properties.EvasionRating,
Checked = false,
};
filter.NormalizeMinValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ public override void Parse(ItemProperties itemProperties, ParsingItem parsingIte
NormalizeEnabled = true,
NormalizeValue = normalizeValue,
Value = item.Properties.ItemQuantity,
ValuePrefix = "+",
ValueSuffix = "%",
Checked = false,
};
filter.NormalizeMinValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ public override void Parse(ItemProperties itemProperties, ParsingItem parsingIte
NormalizeEnabled = true,
NormalizeValue = normalizeValue,
Value = item.Properties.ItemRarity,
ValuePrefix = "+",
ValueSuffix = "%",
Checked = false,
};
filter.NormalizeMinValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ public override void Parse(ItemProperties itemProperties, ParsingItem parsingIte
NormalizeEnabled = true,
NormalizeValue = normalizeValue,
Value = item.Properties.MonsterPackSize,
ValuePrefix = "+",
ValueSuffix = "%",
Checked = false,
};
filter.NormalizeMinValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,16 @@ public override void Parse(ItemProperties itemProperties, ParsingItem parsingIte

public override BooleanPropertyFilter? GetFilter(Item item, double normalizeValue)
{
if (item.Properties.GemLevel <= 0) return null;
if (item.Properties.Quality <= 0) return null;

var filter = new IntPropertyFilter(this)
{
Text = gameLanguageProvider.Language.DescriptionQuality,
NormalizeEnabled = false,
NormalizeValue = normalizeValue,
Value = item.Properties.Quality,
ValuePrefix = "+",
ValueSuffix = "%",
Checked = item.Header.Rarity == Rarity.Gem,
};
filter.NormalizeMinValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ public class WeaponDamageProperty
IStringLocalizer<FilterResources> localizer
) : PropertyDefinition
{
public const string DamageKey = "Damage";

public override List<Category> ValidCategories { get; } = [Category.Weapon];

public override void Initialize()
Expand Down Expand Up @@ -57,8 +55,8 @@ public override void ParseAfterModifiers(ItemProperties properties, ParsingItem
continue;
}

double.TryParse(matches[0].Groups[1].Value, NumberStyles.Any, CultureInfo.InvariantCulture, out var min);
double.TryParse(matches[0].Groups[2].Value, NumberStyles.Any, CultureInfo.InvariantCulture, out var max);
int.TryParse(matches[0].Groups[1].Value, NumberStyles.Any, CultureInfo.InvariantCulture, out var min);
int.TryParse(matches[0].Groups[2].Value, NumberStyles.Any, CultureInfo.InvariantCulture, out var max);

var range = new DamageRange(min, max);
if (isPhysical) properties.PhysicalDamage = range;
Expand Down Expand Up @@ -86,8 +84,8 @@ private void ParseElementalDamage(ParsingLine line, ItemProperties itemPropertie
continue;
}

double.TryParse(match.Groups[1].Value, NumberStyles.Any, CultureInfo.InvariantCulture, out var min);
double.TryParse(match.Groups[2].Value, NumberStyles.Any, CultureInfo.InvariantCulture, out var max);
int.TryParse(match.Groups[1].Value, NumberStyles.Any, CultureInfo.InvariantCulture, out var min);
int.TryParse(match.Groups[2].Value, NumberStyles.Any, CultureInfo.InvariantCulture, out var max);
var range = new DamageRange(min, max);

var ids = itemMods[matchIndex].Modifiers.Where(x => x.Id != null).Select(x => x.Id!).ToList();
Expand Down Expand Up @@ -125,14 +123,14 @@ private void ParseElementalDamage(ParsingLine line, ItemProperties itemPropertie

if (item.Properties.TotalDamage > 0)
{
var filter = new DoublePropertyFilter(this)
var filter = new WeaponDamagePropertyFilter(this)
{
Text = localizer["Damage"],
NormalizeEnabled = true,
NormalizeValue = normalizeValue,
Value = item.Properties.TotalDamage ?? 0,
Value = item.Properties.TotalDamageWithQuality ?? 0,
OriginalValue = item.Properties.TotalDamage ?? 0,
Checked = false,
IndentifyingKey = DamageKey,
};
filter.NormalizeMinValue();
results.Add(filter);
Expand All @@ -145,7 +143,8 @@ private void ParseElementalDamage(ParsingLine line, ItemProperties itemPropertie
Text = localizer["PhysicalDps"],
NormalizeEnabled = true,
NormalizeValue = normalizeValue,
Value = item.Properties.PhysicalDps ?? 0,
Value = item.Properties.PhysicalDpsWithQuality ?? 0,
OriginalValue = item.Properties.PhysicalDps ?? 0,
Checked = false,
};
filter.NormalizeMinValue();
Expand Down Expand Up @@ -187,7 +186,8 @@ private void ParseElementalDamage(ParsingLine line, ItemProperties itemPropertie
Text = localizer["Dps"],
NormalizeEnabled = true,
NormalizeValue = normalizeValue,
Value = item.Properties.TotalDps ?? 0,
Value = item.Properties.TotalDpsWithQuality ?? 0,
OriginalValue = item.Properties.TotalDps ?? 0,
Checked = false,
};
filter.NormalizeMinValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@ namespace Sidekick.Apis.Poe.Parser.Properties.Filters;

public class BooleanPropertyFilter(PropertyDefinition definition)
{
/// <summary>
/// Represents a key used to uniquely identify a property filter to do custom work on this filter.
/// </summary>
public string? IndentifyingKey { get; init; }

public bool ShowRow { get; init; } = true;

public bool Checked { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,14 @@ internal DoublePropertyFilter(

public required double NormalizeValue { get; set; }

public string? ValuePrefix { get; set; }

public string? ValueSuffix { get; set; }

public required double Value { get; set; }

public double OriginalValue { get; set; }

public double? Min { get; set; }

public double? Max { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,14 @@ internal IntPropertyFilter(

public required double NormalizeValue { get; set; }

public string? ValuePrefix { get; set; }

public string? ValueSuffix { get; set; }

public required int Value { get; set; }

public int OriginalValue { get; set; }

public int? Min { get; set; }

public int? Max { get; set;}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace Sidekick.Apis.Poe.Parser.Properties.Filters;

public class WeaponDamagePropertyFilter : DoublePropertyFilter
{
internal WeaponDamagePropertyFilter(
PropertyDefinition definition) : base(definition)
{
}
}
3 changes: 2 additions & 1 deletion src/Sidekick.Apis.Poe/Trade/TradeSearchService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,7 @@ private TradeItem GetItem(GameType game, Result result)

var properties = new ItemProperties()
{
Quality = 20,
ItemLevel = result.Item?.ItemLevel ?? 0,
Corrupted = result.Item?.Corrupted ?? false,
Unidentified = result.Item?.Identified ?? false,
Expand All @@ -405,7 +406,7 @@ private TradeItem GetItem(GameType game, Result result)
TotalDps = result.Item?.Extended?.DamagePerSecond ?? 0,
ElementalDps = result.Item?.Extended?.ElementalDps ?? 0,
PhysicalDps = result.Item?.Extended?.PhysicalDps ?? 0,
BaseDefencePercentile = result.Item?.Extended?.BaseDefencePercentile,
BaseDefencePercentile = result.Item?.Extended?.BaseDefencePercentile ?? 0,
Influences = result.Item?.Influences ?? new(),
};

Expand Down
129 changes: 129 additions & 0 deletions src/Sidekick.Common.Blazor/Main.razor
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
@using Microsoft.Extensions.Options;
@using Sidekick.Common.Ui.Views
@using MudBlazor.Utilities
@using MudBlazor
@inject IOptions<SidekickConfiguration> Configuration;
@inject IViewLocator ViewLocator

Expand All @@ -25,3 +27,130 @@
</NotFound>
</Router>
</AppWrapper>

<MudThemeProvider IsDarkMode="true" Theme="@theme"/>
<MudDialogProvider/>
<MudSnackbarProvider/>
<div class="[&_.mud-popover]:left-0 [&_.mud-popover]:top-0">
<MudPopoverProvider/>
</div>

@code {

private MudTheme theme = new MudTheme()
{
PaletteDark = new PaletteDark()
{
Background = new MudColor("#1c1917"),
Black = new MudColor("#000000"),
Dark = new MudColor("#44403c"),
Error = new MudColor("#b91c1c"),
Info = new MudColor("#14b8a6"),
Primary = new MudColor("#6d28d9"),
AppbarText = new MudColor("#ffffff"),
},
Typography = new Typography()
{
Body1 = new Body1()
{
FontSize = "14px",
FontFamily = ["fontin", "sans", "serif", "mono"],
FontWeight = 400,
LetterSpacing = "0",
LineHeight = 1.2,
TextTransform = "none",
},
Body2 = new Body2()
{
FontSize = "14px",
FontFamily = ["fontin", "sans", "serif", "mono"],
FontWeight = 400,
LetterSpacing = "0",
LineHeight = 1.2,
TextTransform = "none",
},
Subtitle1 = new Subtitle1()
{
FontSize = "16px",
FontFamily = ["fontin", "sans", "serif", "mono"],
FontWeight = 400,
LetterSpacing = "0",
LineHeight = 1.2,
TextTransform = "none",
},
Subtitle2 = new Subtitle2()
{
FontSize = "16px",
FontFamily = ["fontin", "sans", "serif", "mono"],
FontWeight = 400,
LetterSpacing = "0",
LineHeight = 1.2,
TextTransform = "none",
},
H6 = new H6()
{
FontSize = "16px",
FontFamily = ["fontin", "sans", "serif", "mono"],
FontWeight = 400,
LetterSpacing = "0",
LineHeight = 1.2,
TextTransform = "none",
},
H5 = new H5()
{
FontSize = "16px",
FontFamily = ["fontin", "sans", "serif", "mono"],
FontWeight = 400,
LetterSpacing = "0",
LineHeight = 1.2,
TextTransform = "none",
},
H4 = new H4()
{
FontSize = "16px",
FontFamily = ["fontin", "sans", "serif", "mono"],
FontWeight = 400,
LetterSpacing = "0",
LineHeight = 1.2,
TextTransform = "none",
},
H3 = new H3()
{
FontSize = "18px",
FontFamily = ["fontin", "sans", "serif", "mono"],
FontWeight = 400,
LetterSpacing = "0",
LineHeight = 1.2,
TextTransform = "none",
},
H2 = new H2()
{
FontSize = "24px",
FontFamily = ["fontin", "sans", "serif", "mono"],
FontWeight = 400,
LetterSpacing = "0",
LineHeight = 1.2,
TextTransform = "none",
},
H1 = new H1()
{
FontSize = "30px",
FontFamily = ["fontin", "sans", "serif", "mono"],
FontWeight = 400,
LetterSpacing = "0",
LineHeight = 1.2,
TextTransform = "none",
},
Default = new Default()
{
FontSize = "14px",
FontFamily = ["fontin", "sans", "serif", "mono"],
FontWeight = 400,
LetterSpacing = "0",
LineHeight = 1.2,
TextTransform = "none",
},
}
};

}
4 changes: 3 additions & 1 deletion src/Sidekick.Common.Ui/App/AppWrapper.razor
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
@ChildContent
</div>

<SectionOutlet SectionName="sidekick-overlay"/>
<div class="font-sans text-base">
<SectionOutlet SectionName="sidekick-overlay"/>
</div>
</ErrorFullScreenBoundary>

@code {
Expand Down
4 changes: 2 additions & 2 deletions src/Sidekick.Common.Ui/Forms/FormCheckbox.razor
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
@onmouseenter="OnMouseEnter"
@onmousedown="OnMouseDown"
@onclick:preventDefault="true"
class="leading-none peer-checked:[&_svg]:scale-100 peer-checked:text-zinc-600 [&_svg]:scale-0 peer-checked:[&_.custom-checkbox]:border-zinc-500 peer-checked:[&_.custom-checkbox]:bg-zinc-500 select-none flex items-center space-x-2">
class="leading-none peer-checked:[&_svg.check]:scale-100 peer-checked:text-zinc-600 [&_svg.check]:scale-0 peer-checked:[&_.custom-checkbox]:border-zinc-500 peer-checked:[&_.custom-checkbox]:bg-zinc-500 select-none flex items-center space-x-2">
<span class="flex items-center justify-center w-5 h-5 min-w-5 min-h-5 border-2 rounded custom-checkbox dark:bg-zinc-700 dark:border-zinc-600">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="3" stroke="currentColor" class="w-3 h-3 text-white duration-300 ease-out">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="3" stroke="currentColor" class="w-3 h-3 text-white duration-300 ease-out check">
<path stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"/>
</svg>
</span>
Expand Down
Loading
Loading