View Single Post
07-29-19, 04:40 PM   #1
LudiusMaximus
A Rage Talon Dragon Guard
 
LudiusMaximus's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2018
Posts: 321
Inserting a line in GameTooltip at arbitrary position?

I want to put an extra line in the item tooltip directly beneath the "Sell price" line.

I am hooking OnTooltipSetItem to do so:

Code:
GameTooltip:HookScript("OnTooltipSetItem", function(self)
  -- my code
end)
The problem is that I have other addons running which also append their info to the item tooltip.
I guess there is no way to enforce that my addon gets to hook its script first, unless I put it into the optional dependencies of the other addons?

If so, is there another option than scanning the content of the current GameTooltip line by line and inserting my new line after the line beginning with SELL_PRICE?

What would be the most efficient way to do this?
Do I really have to read every line from GameTooltip to a new tooltip or table, then do a GameTooltip:ClearLines() and then GameTooltip:AddLine() everything back?
  Reply With Quote