Skip to content

Instantly share code, notes, and snippets.

@nefftd
Last active August 29, 2015 14:13
Show Gist options
  • Save nefftd/fa3c290aa560741a78e1 to your computer and use it in GitHub Desktop.
Save nefftd/fa3c290aa560741a78e1 to your computer and use it in GitHub Desktop.
local tooltip
local function create_tooltip()
local tip, fontstrings = CreateFrame("GameTooltip", "temptt", nil, "GameTooltipTemplate"), {}
for i = 1, 8 do
local L,R = tip:CreateFontString(), tip:CreateFontString()
L:SetFontObject(GameFontNormal)
R:SetFontObject(GameFontNormal)
tip:AddFontStrings(L,R)
table.insert(fontstrings,L)
table.insert(fontstrings,R)
end
tip.fontstrings = fontstrings
return tip
end
local function is_soulbound_item(bag, slot) -- returns boolean
tooltip = tooltip or create_tooltip()
tooltip:SetOwner(UIParent,"ANCHOR_NONE")
tooltip:ClearLines()
tooltip:SetBagItem(bag, slot)
for i,v in ipairs(tooltip.fontstrings) do
if v:GetText() == ITEM_SOULBOUND then
tooltip:Hide()
return true
end
end
tooltip:Hide()
return false
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment