Skip to content

Commit

Permalink
Updated data for v2.0.2.58474
Browse files Browse the repository at this point in the history
  • Loading branch information
josdemmers committed Oct 8, 2024
1 parent 4ed3e55 commit d990e21
Show file tree
Hide file tree
Showing 86 changed files with 33,095 additions and 28,167 deletions.
20 changes: 20 additions & 0 deletions D4Companion.Services/AffixManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ private void HandleAffixLanguageChangedEvent()

private void HandleApplicationLoadedEvent()
{
ValidateAffixPresets();
ValidateMultiBuild();
}

Expand Down Expand Up @@ -813,6 +814,25 @@ private void LoadAffixPresets()
SaveAffixPresets();
}

private void ValidateAffixPresets()
{
foreach (AffixPreset preset in _affixPresets)
{
foreach (var affix in preset.ItemAffixes)
{
var affixInfo = _affixes.FirstOrDefault(a => a.IdName.Equals(affix.Id));
if (affixInfo == null)
{
_eventAggregator.GetEvent<ErrorOccurredEvent>().Publish(new ErrorOccurredEventParams
{
Message = $"Build: \"{preset.Name}\": Affix not found. Replace missing affix or import build again."
});
break;
}
}
}
}

public void SaveAffixPresets()
{
// Sort affixes
Expand Down
9 changes: 6 additions & 3 deletions D4Companion.Services/OcrHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -732,13 +732,16 @@ private double TextToAffixValue(string text)
(c != '%'))).Trim();

string textValue = Regex.Match(textClean, @"\d+\.\d+|\d+\,\d+|\d+").Value;
if (string.IsNullOrEmpty(textValue))
{
return 0.0;
}

textValue = textValue.IndexOf(".") == textValue.Length - 2 ? textValue : textValue.Replace(".", string.Empty);
textValue = textValue.IndexOf(",") == textValue.Length - 2 ? textValue : textValue.Replace(",", string.Empty);

textValue = textValue.Replace(',', '.');
double affixValue = double.Parse(textValue, CultureInfo.InvariantCulture);

return affixValue;
return double.Parse(textValue, CultureInfo.InvariantCulture);
}

private string TextToAspect(string text)
Expand Down
Loading

0 comments on commit d990e21

Please sign in to comment.