RaiderIO / raiderio-addon

RaiderIO AddOn
https://raider.io/addon
Other
40 stars 21 forks source link

Appending text to LFG Tooltip #169

Closed Marahin closed 3 years ago

Marahin commented 3 years ago

Hi,

I think it goes without saying, but I still will: awesome work with the addon!

I'm developing an addon right now that was hugely inspired by Raider.io, and it also aims to enrich player tooltips with another set of data. While it works great with Raider.io for on-hover player frames or characters (screen 3) it seems to break on LFG applicant tooltips.

Screen 1 LFG Applicant Tooltip (Raider.io DISABLED)

raider.io disabled lfg tooltip

Screen 2 LFG Applicant Tooltip (Raider.io ENABLED)

raider.io enabled lfg tooltip

Screen 3 GameTooltip when hovering on character (Raider.io ENABLED)

raider.io enabled gametooltip

The code

Code responsible for writing to GameTooltip through LFG Applicant hooking: https://github.com/Marahin/wowrepio-addon/blob/master/main.lua#L168

Marahin commented 3 years ago

Also; quick update on my issue. It seems that what was breaking the compatibility was actually setting the ownership of the GameTooltip. Instead, I stopped setting the ownership, and also I removed :Show() call. After that, it started working nicely with Raider.IO.

Though I can already see there are compatibility issues with other addons.

I'd still like to hear what would be the go-to way on approaching compatibility with Raider.io and other addons' tooltips. Looking forward to hear from you!

Vladinator commented 3 years ago

In the case of unit related tooltips you can rely on the GameTooltip OnTooltipSetUnit script handler and append your lines as the event fires. Perhaps with a padding line just to divide the stuff above and your own lines.

If you simply want to display GameTooltip on anything and fear of collision with another addon, you can in your OnEnter script handler check if GameTooltip:GetOwner() returns something, if it does it means GameTooltip is already visible and probably then set by another addon, and in that case you can append your thing with potential padding line, otherwise you need to GameTooltip:SetOwner and you'll also in this case be the first addon to write the tooltip so you can drop the padding line.

These are the best guidances I can give regarding addon collision with sharing the GameTooltip widget.