Skip to content

Commit

Permalink
add Race, Tribe and Gender
Browse files Browse the repository at this point in the history
  • Loading branch information
Koenari committed Jun 15, 2024
1 parent 878de85 commit ffff0da
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 25 deletions.
4 changes: 4 additions & 0 deletions NetStone.Test/Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.IO;
using System.Threading.Tasks;
using NetStone.GameData.Packs;
using NetStone.Model.Parseables.Character;
using NetStone.Model.Parseables.Character.Gear;
using NetStone.Search.Character;
using NetStone.Search.FreeCompany;
Expand Down Expand Up @@ -229,6 +230,9 @@ public async Task CheckCharacterFull()
Assert.AreEqual(chara.ToString(), "Arcane Disgea on Leviathan");
Assert.AreEqual(chara.Server, "Leviathan");
Assert.AreEqual(chara.Name, "Arcane Disgea");
Assert.AreEqual("Miqo'te",chara.Race);
Assert.AreEqual("Seeker of the Sun", chara.Tribe);
Assert.AreEqual(LodestoneCharacter.FemaleChar, chara.Gender);
Assert.True(chara.Bio.StartsWith(
"This is a test of the emergency alert system.AHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH"));
Assert.AreEqual(chara.GuardianDeityName, "Menphina, the Lover");
Expand Down
2 changes: 1 addition & 1 deletion NetStone/Model/LodestoneParseable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public abstract class LodestoneParseable
protected readonly HtmlNode RootNode;

/// <summary>
/// Constructs a instance of parseable data for given node
/// Constructs an instance of parseable data for given node
/// </summary>
/// <param name="rootNode"></param>
protected LodestoneParseable(HtmlNode rootNode)
Expand Down
31 changes: 30 additions & 1 deletion NetStone/Model/Parseables/Character/LodestoneCharacter.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using HtmlAgilityPack;
using NetStone.Definitions;
Expand All @@ -15,6 +16,16 @@ namespace NetStone.Model.Parseables.Character;
/// </summary>
public class LodestoneCharacter : LodestoneParseable
{
/// <summary>
/// Unicode character used to represent female characters
/// </summary>
public const char FemaleChar = '\u2640';

/// <summary>
/// Unicode character used to represent male characters
/// </summary>
public const char MaleChar = '\u2642';

private readonly LodestoneClient client;

private readonly string charId;
Expand Down Expand Up @@ -109,12 +120,30 @@ public LodestoneCharacter(LodestoneClient client, HtmlNode rootNode, Definitions
/// </summary>
public SocialGroup? PvPTeam => new SocialGroup(this.RootNode, this.charDefinition.PvPTeam).GetOptional();

//TODO: parse

private GroupCollection RaceClanGenderRegex => ParseRegex(this.charDefinition.RaceClanGender);

/// <summary>
/// String containing information on clan, race and gender
/// </summary>
[Obsolete("Use Race, Tribe or Gender")]
public string RaceClanGender => Parse(this.charDefinition.RaceClanGender);

/// <summary>
/// Race of the character
/// </summary>
public string Race => this.RaceClanGenderRegex["Race"].Value;

/// <summary>
/// Tribe this chacracter belongs to
/// </summary>
public string Tribe => this.RaceClanGenderRegex["Tribe"].Value;

/// <summary>
/// Character representing the characters gender <see cref="FemaleChar"/> and <see cref="MaleChar"/>
/// </summary>
public char Gender => this.RaceClanGenderRegex["Gender"].Value[0];

/// <summary>
/// The server/world of the character.
/// </summary>
Expand Down
69 changes: 46 additions & 23 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 ffff0da

Please sign in to comment.