Skip to content

Commit

Permalink
Fixed Unidentified influence parser case
Browse files Browse the repository at this point in the history
Related to #6
  • Loading branch information
leMicin committed Sep 3, 2021
1 parent 111699a commit 5299a42
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Sidekick.Apis.Poe/Metadatas/ItemMetadataProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
33 changes: 33 additions & 0 deletions tests/Sidekick.Apis.Poe.Tests/Parser/WeaponParsing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

}
}

0 comments on commit 5299a42

Please sign in to comment.