WowRarity / Rarity

Collectibles and statistics tracking addon for World of Warcraft
https://www.curseforge.com/wow/addons/rarity
GNU General Public License v2.0
56 stars 35 forks source link

Update tooltip scanning logic to use the C_TooltipInfo APIs #506

Open rdw-software opened 2 years ago

rdw-software commented 2 years ago

The old code should still work, so updating it is less urgent (and will require clearing out some technical debt).

Note: Tooltip scanning is referring to the "hacky" way of using __Rarity_ScanTip and GameTooltip in the code.


Leftover from #501 .

filliph commented 2 years ago

Is the API change the reason why my tooltips look like this:

image

Or should I raise a separate issue?

rdw-software commented 2 years ago

Maybe... probably? I was unable to reproduce that particular issue, which makes me think it's caused by another addon interfering with the tooltip handler that Rarity sets. Can you try disabling all other addons?

d4mich4 commented 2 years ago

I have the same Problem but it seems only to happen on lifing(alife) mobs.

For me it seams to be my the enemy healthbar addon "NeatPlate" which causes this reaction.

rdw-software commented 2 years ago

I think this is what's happening:

  1. Any addon creates a tooltip scanning frame - basically, anything that inherits the GameTooltipTemplate
  2. Rarity registers its tooltip handler (just once)
  3. Whenever any tooltip frame updates, ALL hooks are called (instead of just GameTooltip, as previously/intended)
  4. This means Rarity's tooltip handler is called whenever any other addon does "something" with their own tooltips

If my suspicions are correct, then it's due to Blizzard's awkward design, where a "global" registry is used but there aren't really any events to subscribe to, except TOOLTIP_DATA_UPDATE, which is useless in this context.

Before the patch, whenever GameTooltip (the standard tooltip frame) was shown, Rarity would add its status line as appropriate. Now it is adding the status line to the standard tooltip once for each tooltip that is triggering the hook via Blizzard's internal ProcessTooltipPostCalls function. This means we have to check which tooltip causes the activity and exit early if it wasn't the standard tooltip.

I'll test this theory shortly and try out the fix. But I'll add that all of this has actually nothing to do with the original issue, which is referencing the tooltip scanning that Rarity performs to get instance lockouts (IIRC). In theory, it should actually cause the duplicate lines to be added while using that tooltip, as well. Not sure why this isn't the case, though.

rdw-software commented 2 years ago

Unfortunately I still can't replicate the problem, so I'll just push a (presumed) fix and see if it helps.

Furydins commented 2 years ago

I was able to reliably reproduce this issue the last couple of days.

Despite a determined attempt to reproduce it today I haven't been able to - so the fix appears to have resolved it, at least for me..