Skip to content

Commit

Permalink
Reverted artifact substat accidentally rounding % substats #503
Browse files Browse the repository at this point in the history
  • Loading branch information
Cupcak3 committed Feb 3, 2024
1 parent ca42598 commit f1672d5
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions InventoryKamera/scraping/ArtifactScraper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ private static List<SubStat> ScanArtifactSubStats(Bitmap artifactImage)
if (line.Any(char.IsDigit))
{
SubStat substat = new SubStat();
Regex re = new Regex(@"^(.*?)(\d+)");
Regex re = new Regex(@"^(.*?)(\d+.*)");
var result = re.Match(line);
var stat = Regex.Replace(result.Groups[1].Value, @"[^\w]", string.Empty);
var value = result.Groups[2].Value;
Expand All @@ -460,13 +460,17 @@ private static List<SubStat> ScanArtifactSubStats(Bitmap artifactImage)
value = Regex.Replace(value, @"[^0-9]", string.Empty);

// Try to parse number
if (!decimal.TryParse(value, NumberStyles.Number, CultureInfo.CurrentCulture, out substat.value))
if (!decimal.TryParse(value, out substat.value))
{
Logger.Debug("Failed to parse stat value from: {1}", line);
substat.value = -1;
}
else if (substat.stat.Contains("_"))
{
substat.value /= 10;
}

if (string.IsNullOrWhiteSpace(substat.stat))
if (string.IsNullOrWhiteSpace(substat.stat) || substat.value == -1)
{
Logger.Debug("Failed to parse stat from: {1}", line);
}
Expand Down

0 comments on commit f1672d5

Please # to comment.