RaiderIO / raiderio-addon

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

FriendsTooltip hook issue. #141

Closed CreepyJoker closed 3 years ago

CreepyJoker commented 3 years ago

Hello there.

Line core.lua:3697 ( GameTooltip:Hide() ) causes issues to AddOns that hook the 'FriendsTooltip' before yours and try to show stuff there while using 'FriendsTooltip:HookScript("OnShow", function(self)' template. That line is unnecesary as you already 'render:ShowProfile' check beforehand and causes whatever comes before your hook to forcibly hide.

Using a local func & hooksecurefunc(FriendsTooltip) after works, but other addons have other type of hooks like previously commented and that causes issues.

Thank you for your understanding.

Vladinator commented 3 years ago

Thanks for the report. I can see in a couple of places the code can be updated to play nicer with other addons.

If you have a specific addon in mind please do mention it. I wanted to try it out and see that the issue gets resolved properly.

CreepyJoker commented 3 years ago

Hello again, thanks for the reply. I don't have a public one in mind, but I can give you a snipped I was working with while encountering this issue.

`FriendsTooltip:HookScript("OnShow", function(self, ...)

local bnetIndex = nil 

for k, v in pairs(self.button) do
    if k == "id" then
        bnetIndex = v
    end
end

local _, name, client, realm = BNGetFriendGameAccountInfo(bnetIndex, 1)

if name == "" and realm == "" or name == nil or realm == nil then
    return 
end

-- here you can add a SetOwner, add some lines and :Show() the tooltip. I have my own function that shows the tooltip which uses SetOwner if it has a parameter, but you can hardcode it.

end)`

This is the snippet you can test with. I've commented stuff into it so you can fiddle with SetOwner, without setting the owner, adding to the already shown one and such.

I've fixed the problem on my end, but it's a good refference for others that may encounter this issue using the hook this way.

Note: Make sure the Addon is loaded before RIO, naming it something like "ATestAddon" when you create it, so you can see that's a hierarchy issue.

Best regards!

Vladinator commented 3 years ago

Thanks, I'll see what I can do about this, but if there is a concrete case do let me know as I dont want to break compatibility with other addons.