Thread Tools Display Modes
Prev Previous Post   Next Post Next
05-16-21, 04:14 PM   #1
Saspatoon
A Defias Bandit
Join Date: May 2021
Posts: 2
Hyperlink Tooltip Change

WoW Classic 1.3.7 / TBC

Hey guys, I am working on an addon that changes the tooltip of particular item ID's and adds a description to them. I have it working for items that you hover over in your bags, but when you Shift-Click an item into the chat window (Or click an item you recently looted from mobs) the hyper-link tooltip seems to be different from the bags version.

I couldn't find anything other than the WoWAPI website example, and the example doesnt even seem to work anymore. Is this still possible? or did they remove our ability to change hyperlink tooltips?

The Code i tried to use from the WoW Api Hooking functions page, didnt work out right and even after playing with it trying to make it work i had no success. Thank you

Code from the WoWApi Example:
Code:
local origChatFrame_OnHyperlinkShow = ChatFrame_OnHyperlinkShow; -- (1)
ChatFrame_OnHyperlinkShow = function(...) -- (2)
 local chatFrame, link, text, button = ...; -- (3)
 if type(text) == "string" and text:match("%[Tinfoil Hat%]") and not IsModifiedClick() then --(4)
  return ShowTinfoilHat(); -- (5)
 end
 return origChatFrame_OnHyperlinkShow(...); -- (6)
end
print("Click me: \124cff0070dd\124Hitem:8191:0:0:0:0:0:0:0:0:1\124h[Tinfoil Hat]\124h\124r"); -- (7)

-- The code below deals mostly with the tinfoil hat tooltip and is irrelevant to hooking
local function addLine(a, ...) 
 if a then
  return ItemRefTooltip:AddLine(a,1,1,1,1), addLine(...);
 end
end
function ShowTinfoilHat()
 ShowUIPanel(ItemRefTooltip);
 if (not ItemRefTooltip:IsVisible()) then
  ItemRefTooltip:SetOwner(UIParent, "ANCHOR_PRESERVE");
 end
 ItemRefTooltip:ClearLines();
 addLine("\124cff0070ddTinfoil Hat\124r", "Binds when equipped");
 ItemRefTooltip:AddDoubleLine("Head","Cloth",1,1,1,1,1,1);
 addLine("10 Armor", "-10 Intellect", "+10 Spirit", (UnitLevel("player") < 10) and "\124cffff0000Requires Level 10\124r" or "Requires Level 10");
 addLine("\124cff00ff00Equip: Hides the wearer's profile from the Armory.\124r");
 addLine("\124cff00ff00Equip: Allows the wearer to see \"the truth.\" May lead to an incontrollable urge to share \"the truth\" with others.\124r");
 addLine("\124cff00ff00Use: Grants the wearer immunity to all forms of mind control for the next 10 seconds... or does it?\124r");
 addLine("\124cffffd517On behalf of the International Gnomish Conspiracy, I've got to inform you that we're almost out of tinfoil.\124r");
 ItemRefTooltip:Show(); ItemRefTooltip:Show();
end
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » Hyperlink Tooltip Change


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