View Single Post
01-01-15, 12:34 AM   #2
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Battle pets have their own tooltip object; they don't use the GameTooltip at all. Battle pet abilities, garrison followers, follower abilities, and missions also have their own tooltips objects. You can see how the default UI handles those here, though really it would be a lot easier to just call the click function on mouseover instead of recreating it:

Code:
chat:HookScript('OnHyperlinkEnter', ChatFrame_OnHyperlinkShow)
If you wanted to filter out certain types of links, and/or not have it treat "mouseover while shift is down" as a shift-click, then this would still be simpler:

Code:
local linktypes = {
	-- These use GameTooltip:
	achievement    = true,
	enchant        = true,
	glyph          = true,
	item           = true,
	instancelock   = true,
	quest          = true,
	spell          = true,
	talent         = true,
	unit           = true,
	-- This uses FloatingBattlePetTooltip:
	battlepet      = true,
	-- This uses FloatingPetBattleAbilityTooltip:
	battlePetAbil = true,
	-- This uses FloatingGarrisonFollowerTooltip:
	garrfollower  = true,
	-- This uses FloatingGarrisonFollowerAbilityTooltip:
	garrfollowerability = true,
	-- This uses FloatingGarrisonMissionTooltip:
	garrmission   = true,
}

local function OnHyperlinkEnter(frame, link, text)
	local linkType = strsplit(":", link)
	if linktypes[linktype] and not IsModifiedClick() then
		ChatFrame_OnHyperlinkShow(frame, link, text, "LeftButton")
	end
end

chat:HookScript('OnHyperlinkEnter', OnHyperlinkEnter)
Remember to update your OnHyperlinkLeave script to also hide those additional tooltip objects.

Also you can just use HookScript instead of manually storing and replacing and calling the original script. If there is no original script then HookScript behaves exactly like SetScript.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.

Last edited by Phanx : 01-01-15 at 12:50 AM.
  Reply With Quote