From 5299a4200d2a493b44ce5a24a769cc09afb28e46 Mon Sep 17 00:00:00 2001 From: Yanic Lemire Date: Thu, 2 Sep 2021 23:23:01 -0400 Subject: [PATCH] Fixed Unidentified influence parser case Related to #6 --- .../Metadatas/ItemMetadataProvider.cs | 3 +- .../Parser/WeaponParsing.cs | 33 +++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/src/Sidekick.Apis.Poe/Metadatas/ItemMetadataProvider.cs b/src/Sidekick.Apis.Poe/Metadatas/ItemMetadataProvider.cs index 4cc00f0d1..5a5e65dc6 100644 --- a/src/Sidekick.Apis.Poe/Metadatas/ItemMetadataProvider.cs +++ b/src/Sidekick.Apis.Poe/Metadatas/ItemMetadataProvider.cs @@ -155,11 +155,12 @@ public ItemMetadata Parse(ParsingItem parsingItem) } else if (parsingBlock.Lines.Count == 3) { + type = parsingBlock.Lines[2].Text; name = parsingBlock.Lines[2].Text; } // Rares may have conflicting names, so we don't want to search any unique items that may have that name. Like "Ancient Orb" which can be used by abyss jewels. - if (itemRarity == Rarity.Rare) + if (itemRarity == Rarity.Rare || itemRarity == Rarity.Magic) { name = null; } diff --git a/tests/Sidekick.Apis.Poe.Tests/Parser/WeaponParsing.cs b/tests/Sidekick.Apis.Poe.Tests/Parser/WeaponParsing.cs index f1c936c60..1968cb85a 100644 --- a/tests/Sidekick.Apis.Poe.Tests/Parser/WeaponParsing.cs +++ b/tests/Sidekick.Apis.Poe.Tests/Parser/WeaponParsing.cs @@ -293,5 +293,38 @@ And tore out her heart. Assert.Equal("Fishing Rod", actual.Metadata.Type); } + [Fact] + public void UnidentifiedHunterItem() + { + var actual = parser.ParseItem(@"Item Class: One Hand Maces +Rarity: Rare +Ornate Mace +-------- +One Handed Mace +Physical Damage: 53-67 +Critical Strike Chance: 5.00% +Attacks per Second: 1.20 +Weapon Range: 11 +-------- +Requirements: +Strength: 161 +-------- +Sockets: R-R-R +-------- +Item Level: 76 +-------- +15% reduced Enemy Stun Threshold (implicit) +-------- +Unidentified +-------- +Hunter Item"); + + Assert.Equal(Class.OneHandMaces, actual.Metadata.Class); + Assert.Equal(Rarity.Rare, actual.Metadata.Rarity); + Assert.Equal(Category.Weapon, actual.Metadata.Category); + Assert.Equal("Ornate Mace", actual.Metadata.Type); + Assert.True(actual.Influences.Hunter); + } + } }