Skip to content

Commit 2163a2d

Browse files
authored
Merge pull request #1025 from Sidekick-Poe/feature/imbued-results
Show imbued gems in trade results.
2 parents be4f00b + 78a26b8 commit 2163a2d

File tree

5 files changed

+34
-2
lines changed

5 files changed

+34
-2
lines changed

src/Sidekick.Apis.Poe.Trade/Parser/Stats/StatParser.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,18 @@ IEnumerable<Stat> MatchStats()
7474
}
7575
}
7676

77+
IEnumerable<StatDefinition> FilterDefinitions()
78+
{
79+
return item.Properties.ItemClass switch
80+
{
81+
ItemClass.ActiveGem => Definitions.Where(x => x.Category is StatCategory.Imbued),
82+
_ => Definitions,
83+
};
84+
}
85+
7786
IEnumerable<StatDefinition> MatchDefinitions(TextBlock block, int lineIndex)
7887
{
79-
foreach (var definition in Definitions)
88+
foreach (var definition in FilterDefinitions())
8089
{
8190
// Multiple line stats
8291
if (definition.LineCount > 1 && definition.Pattern.IsMatch(string.Join('\n', block.Lines.Skip(lineIndex).Take(definition.LineCount))))
@@ -106,7 +115,7 @@ List<StatDefinition> MatchDefinitionsFuzzily(TextBlock block, int lineIndex)
106115
var results = new List<(int Ratio, StatDefinition Definition)>();
107116
var resultsLock = new object();// Lock object to synchronize access to results
108117

109-
Parallel.ForEach(Definitions,
118+
Parallel.ForEach(FilterDefinitions(),
110119
definition =>
111120
{
112121
if (string.IsNullOrEmpty(definition.FuzzyText)) return;

src/Sidekick.Apis.Poe.Trade/Trade/Items/Models/ApiItem.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ public class ApiItem
5757

5858
public string? Note { get; set; }
5959

60+
public string? BuiltInSupport { get; set; }
61+
6062
public List<ApiItemLineContent> Requirements { get; set; } = [];
6163

6264
public List<ApiItemLineContent> Properties { get; set; } = [];

src/Sidekick.Apis.Poe.Trade/Trade/Items/Models/ExtendedHashes.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,7 @@ public class ExtendedHashes
3636

3737
[JsonPropertyName("sanctum")]
3838
public List<List<JsonElement>> Sanctum { get; set; } = [];
39+
40+
[JsonPropertyName("imbued")]
41+
public List<List<JsonElement>> Imbued { get; set; } = [];
3942
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
@using Sidekick.Apis.Poe.Trade.Trade.Items.Results
2+
@using Sidekick.Data.Items
3+
4+
@if (!string.IsNullOrEmpty(Result.Item.BuiltInSupport))
5+
{
6+
<ItemSeparator Rarity="Result.Item.Rarity"/>
7+
<ItemStatText Category="StatCategory.Enchant">@Result.Item.BuiltInSupport</ItemStatText>
8+
}
9+
10+
@code {
11+
12+
[Parameter]
13+
public required TradeResult Result { get; set; }
14+
15+
protected override bool ShouldRender() => false;
16+
17+
}

src/Sidekick.Modules.Items/Trade/Items/ItemComponent.razor

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
<ItemProperties Result="Result"/>
2424
<ItemRequirements Result="Result"/>
2525
<ItemGrantSkills Result="Result"/>
26+
<ItemBuiltInSupport Result="Result"/>
2627
<ItemStats Result="Result"/>
2728

2829
@if (!Result.Item.Identified)

0 commit comments

Comments
 (0)