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 ffff0da commit aca6041
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions NetStone/Model/LodestoneParseable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,21 @@ protected string ParseInnerText(DefinitionsPack pack, bool noAttribute = false)

return !string.IsNullOrEmpty(text) ? HttpUtility.HtmlDecode(text) : "";
}
/// <summary>
/// Get the inner html of a node
/// </summary>
/// <param name="pack">Definition of node</param>
/// <param name="noAttribute">Indicates to not parse attributes</param>
/// <returns>Text inside node</returns>
protected string ParseInnerHtml(DefinitionsPack pack, bool noAttribute = false)
{
var node = QueryNode(pack);

// Handle default attribute parsing
var text = !string.IsNullOrEmpty(pack.Attribute) && !noAttribute ? ParseAttribute(pack) : node?.InnerHtml;

return !string.IsNullOrEmpty(text) ? HttpUtility.HtmlDecode(text) : "";
}

/// <summary>
/// Parse the InnerText via selector, then parse out regex groups.
Expand All @@ -112,7 +127,7 @@ protected string ParseInnerText(DefinitionsPack pack, bool noAttribute = false)
/// <returns>Matched Regex groups.</returns>
protected GroupCollection ParseRegex(DefinitionsPack pack)
{
var text = ParseInnerText(pack);
var text = ParseInnerHtml(pack);

var regex = new Regex(pack.Regex ?? "");
var match = regex.Match(text);
Expand Down Expand Up @@ -168,13 +183,7 @@ protected string ParseTooltip(DefinitionsPack pack)
{
var node = QueryNode(pack);

if (node == null)
return null;

if (node.Attributes.All(x => x.Name != attribute))
return null;

return node.Attributes[attribute].Value;
return node?.Attributes.FirstOrDefault(x => x.Name == attribute)?.Value;
}

/// <summary>
Expand Down

0 comments on commit aca6041

Please sign in to comment.