local tooltip
local function CreateToolTipFrame()
tooltip = CreateFrame("GameTooltip", "MyTempTooltip", UIParent, "GameTooltipTemplate")
tooltip:SetOwner(UIParent, "ANCHOR_NONE")
end
local function OnTooltipSetItemFromLink(itemLink)
if itemLink then
CreateToolTipFrame() -- Ensure tooltip is created
tooltip:SetHyperlink(itemLink)
local numLines = tooltip:NumLines()
if numLines > 0 then
for i = 1, numLines do
local line = getglobal(tooltip:GetName() .. "TextLeft" .. i)
if line then
DEFAULT_CHAT_FRAME:AddMessage(line:GetText())
end
end
end
tooltip:Hide()
end
end