View Single Post
02-15-14, 06:58 PM   #2
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
You can't use GameTooltip:SetHyperlink with caged battle pets. So, you need to check whether the link you're working with is for a caged battle pet, and use a different method to display those:

Code:
-- You must set the GameTooltip's position first, even for battle pets:
GameTooltip:SetOwner(YOUR_FRAME_HERE, "ANCHOR_TOPLEFT")
-- Check the link type:
if strmatch(link, "|Hbattlepet:") then
     -- Battle pet link
     local _, speciesID, level, breedQuality, maxHealth, power, speed, name = strsplit(":", link)
     BattlePetToolTip_Show(tonumber(speciesID), tonumber(level), tonumber(breedQuality), tonumber(maxHealth), tonumber(power), tonumber(speed), name)
else
    -- Other kind of link, OK to use GameTooltip
    GameTooltip:SetHyperlink(link)
end
__________________
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.
  Reply With Quote