WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   mouseover raid/party (https://www.wowinterface.com/forums/showthread.php?t=59442)

gmarco 01-07-23 03:34 PM

mouseover raid/party
 
Hi all,

I am using this code to add a line (m+ score) to a player tooltip.

Lua Code:
  1. if event == "UPDATE_MOUSEOVER_UNIT" then
  2.         if UnitIsPlayer("mouseover") then
  3.             local score = C_PlayerInfo.GetPlayerMythicPlusRatingSummary("mouseover").currentSeasonScore
  4.             local r, g, b = C_ChallengeMode.GetDungeonScoreRarityColor(C_PlayerInfo.GetPlayerMythicPlusRatingSummary("mouseover").currentSeasonScore):GetRGB()
  5.             GameTooltip:AddLine(" ")
  6.             GameTooltip:AddDoubleLine(_G["DUNGEON_SCORE"],score,1,1,0,r,g,b)       
  7.             GameTooltip:Show()
  8.         end
  9.     end

... and it works if I mouseover a player.

The strange things is that it seems to works also if I mouseover my (player) unitframe, but not always.
Sometime I am able to see the line, sometimes it doesnt show, sometimes it appears and then suddendly it is rewritten by a new tooltip without it.

On the raid/party frame it usually not display the line and if it happens only for a few nanoseconds :) and then disappears.

So I am here to ask if there is a specific thing to check when the mouse over the raid/party frames because I was not able to find it and I am arrived to think that probably it is not possible to do :)

Thanks to all as usually.

P.s.
I see that 10.0.2 has make a lot of changes in management in tooltip info, but as I can understand only in reading data from it and not to write data in it.

SDPhantom 01-07-23 08:35 PM

Quote:

Originally Posted by gmarco (Post 341920)
Sometime I am able to see the line, sometimes it doesnt show, sometimes it appears and then suddendly it is rewritten by a new tooltip without it.

The problem with hooking by event is the firing order for frames receiving any single event is completely random. You could possibly be trying to modify the tooltip before the tooltip itself handles the event sometimes.



Quote:

Originally Posted by gmarco (Post 341920)
On the raid/party frame it usually not display the line and if it happens only for a few nanoseconds :) and then disappears.

There's definitely some C-code trickery when it comes to SecureUnitButtons. Part of which is what supports mapping the mouseover unitID to the frame. My guess is the C-code maps the unit and as part of shared code, fires the tooltip to update with mouseover data. Later, the Lua-side of the UnitFrame implementation fires the OnEnter handler and re-renders the tooltip with its own unitID.



Quote:

Originally Posted by gmarco (Post 341920)
So I am here to ask if there is a specific thing to check when the mouse over the raid/party frames because I was not able to find it and I am arrived to think that probably it is not possible to do :)

You could check if GetMouseFocus() returns WorldFrame. If it returns anything else, it's probably a UnitFrame (would still be a good idea to verify if you plan on referencing the UnitFrame).



Quote:

Originally Posted by gmarco (Post 341920)
I see that 10.0.2 has make a lot of changes in management in tooltip info, but as I can understand only in reading data from it and not to write data in it.

There's a couple ways to write into tooltips with the new system. The more straightforward way is to register TooltipDataProcessor.AddTooltipPostCall() and call tooltip:AddLine() as you normally would. If for whatever reason you want to modify the original tooltip lines, you can register with TooltipDataProcessor.AddTooltipPreCall() and they would be located in the table at tooltip.tooltipData.lines. A more direct approach for editing a specific line type would be to register TooltipDataProcessor.AddLinePreCall().

Examples of callback functions can be found in SharedXML\Tooltip\TooltipDataRules.lua

Note: You can use TooltipUtil.GetDisplayedUnit() to fetch a tooltip's unit in the same way tooltip:GetUnit() used to work (is noted to be depreciated and only exists on GameTooltip).

gmarco 01-08-23 03:34 AM

Thanks SDPhantom for your reply.

You have give so much inputs that I have finally a clearer vision on the problem and a lot of new informations to work with :)

I'll begin to dig in :)

Thanks, your help is so much appreciated.


All times are GMT -6. The time now is 10:20 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI