Skip to content

Commit f624972

Browse files
committed
Fixed parsing of uncut gems
1 parent bf6a448 commit f624972

File tree

99 files changed

+805
-450
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+805
-450
lines changed

Game Localization.xlsm

4.84 KB
Binary file not shown.

src/Sidekick.Apis.Poe.Trade/Items/ApiInvariantItemProvider.cs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using Microsoft.Extensions.Logging;
22
using Sidekick.Apis.Poe.Trade.Clients;
33
using Sidekick.Apis.Poe.Trade.Items.Models;
4-
using Sidekick.Common;
54
using Sidekick.Common.Cache;
65
using Sidekick.Common.Enums;
76
using Sidekick.Common.Extensions;
@@ -25,7 +24,9 @@ ISettingsService settingsService
2524

2625
public Dictionary<string, ApiItem> NameDictionary { get; } = new();
2726

28-
public List<string> UncutGemIds { get; } = [];
27+
public string UncutSkillGemId { get; private set; } = string.Empty;
28+
public string UncutSupportGemId { get; private set; } = string.Empty;
29+
public string UncutSpiritGemId { get; private set; } = string.Empty;
2930

3031
/// <inheritdoc/>
3132
public int Priority => 100;
@@ -76,13 +77,19 @@ private void FillCategoryItems(GameType game, List<ApiCategory> categories, stri
7677

7778
private void InitializeUncutGemIds()
7879
{
79-
UncutGemIds.Clear();
80-
8180
foreach (var item in IdDictionary)
8281
{
83-
if (item.Value.Type == "Uncut Skill Gem" || item.Value.Type == "Uncut Spirit Gem" || item.Value.Type == "Uncut Support Gem")
82+
switch (item.Value.Type)
8483
{
85-
UncutGemIds.Add(item.Key);
84+
case "Uncut Skill Gem":
85+
UncutSkillGemId = item.Key;
86+
break;
87+
case "Uncut Spirit Gem":
88+
UncutSpiritGemId = item.Key;
89+
break;
90+
case "Uncut Support Gem":
91+
UncutSupportGemId = item.Key;
92+
break;
8693
}
8794
}
8895
}

src/Sidekick.Apis.Poe.Trade/Items/ApiItemProvider.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using Microsoft.Extensions.Logging;
33
using Sidekick.Apis.Poe.Trade.Clients;
44
using Sidekick.Apis.Poe.Trade.Items.Models;
5-
using Sidekick.Common;
65
using Sidekick.Common.Cache;
76
using Sidekick.Common.Enums;
87
using Sidekick.Common.Extensions;
@@ -26,6 +25,8 @@ ISettingsService settingsService
2625

2726
public Dictionary<string, List<ApiItem>> NameAndTypeDictionary { get; } = new();
2827

28+
public Dictionary<string, ApiItem> IdDictionary { get; } = new();
29+
2930
public List<(Regex Regex, ApiItem Item)> NameAndTypeRegex { get; } = new();
3031

3132
/// <inheritdoc/>
@@ -35,6 +36,7 @@ ISettingsService settingsService
3536
public async Task Initialize()
3637
{
3738
NameAndTypeDictionary.Clear();
39+
IdDictionary.Clear();
3840
NameAndTypeRegex.Clear();
3941

4042
var leagueId = await settingsService.GetString(SettingKeys.LeagueId);
@@ -73,6 +75,8 @@ private void FillCategoryItems(GameType game, List<ApiCategory> categories, stri
7375
entry.Game = game;
7476
entry.Category = category;
7577

78+
IdDictionary.Add(entry.Id, entry);
79+
7680
if (!string.IsNullOrEmpty(entry.Name))
7781
{
7882
FillDictionary(entry.Name, entry);

src/Sidekick.Apis.Poe.Trade/Items/IApiInvariantItemProvider.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,7 @@ public interface IApiInvariantItemProvider : IInitializableService
99

1010
Dictionary<string, ApiItem> NameDictionary { get; }
1111

12-
List<string> UncutGemIds { get; }
12+
string UncutSkillGemId { get; }
13+
string UncutSupportGemId { get; }
14+
string UncutSpiritGemId { get; }
1315
}

src/Sidekick.Apis.Poe.Trade/Items/IApiItemProvider.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,7 @@ public interface IApiItemProvider : IInitializableService
1010

1111
Dictionary<string, List<ApiItem>> NameAndTypeDictionary { get; }
1212

13+
Dictionary<string, ApiItem> IdDictionary { get; }
14+
1315
List<(Regex Regex, ApiItem Item)> NameAndTypeRegex { get; }
1416
}

0 commit comments

Comments
 (0)