Skip to content

Commit

Permalink
Separate implicit from normal affixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
josdemmers committed Aug 14, 2024
1 parent 9d88d53 commit 8f3d733
Showing 1 changed file with 30 additions and 2 deletions.
32 changes: 30 additions & 2 deletions D4Companion.Services/ScreenProcessHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -864,6 +864,36 @@ private void UpdateItemAffixAreas()
int implicitBeginY = splittersTop[0].Location.Y;
int implicitEndY = splitters[0].Location.Y;

// Validate implicit area
// - No greater affixes
// - No tempered affixes
foreach (var itemAffixArea in _currentTooltip.ItemAffixAreas)
{
if (implicitBeginY <= itemAffixArea.Location.Y && itemAffixArea.Location.Y <= implicitEndY)
{
if (itemAffixArea.AffixType.Equals(AffixTypeConstants.Greater) ||
itemAffixArea.AffixType.Equals(AffixTypeConstants.Tempered))
{
// Skip implicit affixes for this item. Implicit area is invalid.
// Probably caused because one of the splitter icons was not detected.
return;
}
}
}

// Validate implicit area
// - No aspects
if (!_currentTooltip.ItemAspectLocation.IsEmpty)
{
if (implicitBeginY <= _currentTooltip.ItemAspectLocation.Location.Y && _currentTooltip.ItemAspectLocation.Location.Y <= implicitEndY)
{
// Skip implicit affixes for this item. Implicit area is invalid.
// Probably caused because one of the splitter icons was not detected.
return;
}
}

// Set implicit affix
foreach (var itemAffixArea in _currentTooltip.ItemAffixAreas)
{
if (implicitBeginY <= itemAffixArea.Location.Y && itemAffixArea.Location.Y <= implicitEndY)
Expand Down Expand Up @@ -891,8 +921,6 @@ private bool FindItemAffixes()
{
_currentTooltip.ItemAffixAreas.RemoveAll(a => a.AffixType.Equals(Constants.AffixTypeConstants.Tempered));
}
// TODO: Check AffixType property and implement for implicits.


// Create image for each area
var currentScreenTooltip = _currentScreenTooltipFilter.Convert<Bgr, byte>();
Expand Down

0 comments on commit 8f3d733

Please sign in to comment.