Thread Tools Display Modes
01-07-23, 03:34 PM   #1
gmarco
An Onyxian Warder
 
gmarco's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 362
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.
__________________
This is Unix-Land. In quiet nights, you can hear the Windows machines reboot.
  Reply With Quote
01-07-23, 08:35 PM   #2
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,326
Originally Posted by gmarco View Post
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.



Originally Posted by gmarco View Post
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.



Originally Posted by gmarco View Post
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).



Originally Posted by gmarco View Post
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).
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)

Last edited by SDPhantom : 01-07-23 at 09:02 PM.
  Reply With Quote
01-08-23, 03:34 AM   #3
gmarco
An Onyxian Warder
 
gmarco's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 362
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.
__________________
This is Unix-Land. In quiet nights, you can hear the Windows machines reboot.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » mouseover raid/party


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off