Originally Posted by
Eommus
I see. It's still nice its color can be changed as I did. So, I understand there's no way to "insert" a line after, say, 1st line of the tooltip. Still curious about how the game displays the item level line on armor and weapon items.
From what I understand, the function that decides what to display in an item tooltip is the inherited frame function GameTooltip:SetItemByID(id), which I haven't looked into and could be internal C/C++/basic C code since searching for that in the UI code doesn't reveal a declaration.
Originally Posted by
Eommus
I also checked your addon code but couldn't understand what you meant.
Here's the function in question.
Code:
hooksecurefunc('EmbeddedItemTooltip_SetItemByQuestReward',function(t) update()
if t==rpt.ItemTooltip and rpt.factionID and f[rpt.factionID] and f[rpt.factionID].c then
local c=format(ARCHAEOLOGY_COMPLETION,f[rpt.factionID].c)
rpt:AddLine(c) t.Tooltip:AddLine('\n') t.Tooltip:Show()
for i=1,rpt:NumLines() do if _G[rpt:GetName()..'TextLeft'..i]:GetText()==c then
_G[rpt:GetName()..'TextLeft'..i]:SetPoint('BOTTOMLEFT',0,-70)
end end
end
end)
Boiling that down to just the tooltip interaction. Also note that the paragon tooltip is a special double tooltip, with the faction description and rep bar in the main part and the reward item a tooltip-within-a-tooltip. Screenshot of the tooltip. I add a blank line to the itemtooltip and then manually move an added line in the maintooltip down to that new space. I can't directly add a line to the itemtooltip since the text is indented due to the item icon. In the screenshot, the "number of times completed" line is actually supposed to be directly under "rewards".
Code:
local text="text"
maintooltip:AddLine(c)
itemtooltip:AddLine('\n')
itemtooltip:Show() -- refreshes the tooltip to show the new line
for i=1,maintooltip:NumLines() do -- loops through maintooltip lines
if _G[maintooltip:GetName()..'TextLeft'..i]:GetText()==text then -- gets the text of each line and looks for "text"
_G[maintooltip:GetName()..'TextLeft'..i]:SetPoint('BOTTOMLEFT',0,-70) -- changes anchor and moves 70 units down
end
end