Skip to content

Commit

Permalink
Merge pull request #24 from Tawmy/feature/item-level
Browse files Browse the repository at this point in the history
Parse item levels of gear
  • Loading branch information
Koenari authored Oct 19, 2024
2 parents 841d81a + 2f5a477 commit ce00458
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 31 deletions.
19 changes: 14 additions & 5 deletions NetStone.Test/Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,9 @@ public async Task CheckFreeCompanyRecruiting()
Assert.AreEqual("Immortal Flames", fc.GrandCompany);
Assert.AreEqual("Bedge Lords", fc.Name);
Assert.AreEqual("«BEDGE»", fc.Tag);
Assert.AreEqual("Friendly and active FC with 24/7 buffs, fun events and a cozy Large in Goblet. LF new Bedgers to join us! Check our Lodestone or come & chat for details! \u2665", fc.Slogan);
Assert.AreEqual("Friendly FC with 24/7 buffs, events and a large FC house in Goblet. LF more new amiable Bedgers to join us! Check our Lodestone & come chat for details.", fc.Slogan);
Assert.AreEqual(new DateTime(2022, 12, 04, 19, 47, 07), fc.Formed);
Assert.GreaterOrEqual(fc.ActiveMemberCount, 60);
Assert.GreaterOrEqual(fc.ActiveMemberCount, 50);
Assert.AreEqual(30, fc.Rank);

//Reputation
Expand Down Expand Up @@ -365,7 +365,7 @@ public async Task CheckCharacterFull()

//Gear
var gear = chara.Gear;
Assert.AreEqual($"Mandervillous Wings", gear.Mainhand?.ItemName);
Assert.AreEqual("Mandervillous Wings", gear.Mainhand?.ItemName);
Assert.IsFalse(gear.Mainhand.IsHq);
Assert.AreEqual("Mandervillous Wings", gear.Mainhand.StrippedItemName);

Expand All @@ -376,34 +376,43 @@ public async Task CheckCharacterFull()
Assert.IsNull(gear.Offhand);

Assert.AreEqual("Augmented Credendum Circlet of Healing", gear.Head?.ItemName);
Assert.AreEqual(660, gear.Head?.ItemLevel);
Assert.NotNull(gear.Head.ItemDatabaseLink);
Assert.AreEqual("The Emperor's New Hat",gear.Head.GlamourName);
Assert.NotNull(gear.Head.GlamourDatabaseLink);
Assert.AreEqual("Savage Aim Materia X",gear.Head.Materia[0]);
Assert.AreEqual("Heavens' Eye Materia X",gear.Head.Materia[1]);

Assert.AreEqual("Ascension Robe of Healing", gear.Body?.ItemName);
Assert.AreEqual(660, gear.Body?.ItemLevel);

Assert.AreEqual("Augmented Credendum Gauntlets of Healing", gear.Hands?.ItemName);
Assert.AreEqual(660, gear.Hands?.ItemLevel);

Assert.AreEqual("Augmented Credendum Hose of Healing", gear.Legs?.ItemName);
Assert.AreEqual(660, gear.Legs?.ItemLevel);

Assert.AreEqual("Ascension Sandals of Healing", gear.Feet?.ItemName);
Assert.AreEqual(660, gear.Feet?.ItemLevel);

Assert.AreEqual("Augmented Credendum Earrings of Healing", gear.Earrings?.ItemName);
Assert.AreEqual(660, gear.Earrings?.ItemLevel);

Assert.AreEqual("Ascension Necklace of Healing", gear.Necklace?.ItemName);
Assert.AreEqual(660, gear.Necklace?.ItemLevel);

Assert.AreEqual("Ascension Bracelet of Healing", gear.Bracelets?.ItemName);
Assert.AreEqual(660, gear.Bracelets?.ItemLevel);

Assert.AreEqual("Ascension Ring of Healing", gear.Ring1?.ItemName);
Assert.AreEqual(660, gear.Ring1?.ItemLevel);
Assert.IsFalse(gear.Ring1.IsHq);

Assert.AreEqual("Augmented Credendum Ring of Healing", gear.Ring2?.ItemName);
Assert.AreEqual(660, gear.Ring2?.ItemLevel);

Assert.AreEqual("Soul of the Sage", gear.Soulcrystal?.ItemName);



//Classes/Jobs
var classJob = await chara.GetClassJobInfo();
Assert.NotNull(classJob);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ public class GearEntryDefinition
/// </summary>
[JsonProperty("CREATOR_NAME")]
public DefinitionsPack CreatorName { get; set; }

/// <summary>
/// Item level of the item
/// </summary>
[JsonProperty("ITEM_LEVEL")]
public DefinitionsPack ItemLevel { get; set; }
}

/// <summary>
Expand Down
8 changes: 8 additions & 0 deletions NetStone/Model/Parseables/Character/Gear/GearEntry.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Linq;
using HtmlAgilityPack;
using NetStone.Definitions.Model.Character;
using NetStone.GameData;
Expand Down Expand Up @@ -84,6 +85,13 @@ public GearEntry(LodestoneClient client, HtmlNode rootNode, GearEntryDefinition
/// Name of this item's crafter.
/// </summary>
public string CreatorName => Parse(this.definition.CreatorName);

/// <summary>
/// Item level of this item
/// </summary>
public int ItemLevel => int.TryParse(Parse(definition.ItemLevel).Split(' ').LastOrDefault(), out var itemLevel)
? itemLevel
: 0;

/// <summary>
/// Indicating whether the item slot has an item equipped or not.
Expand Down
47 changes: 21 additions & 26 deletions NetStone/NetStone.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ce00458

Please sign in to comment.