View Single Post
10-10-20, 01:59 AM   #3
Urtgard
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Apr 2016
Posts: 25
I scan the tooltip for the BIND_TRADE_TIME_REMAINING string

Code:
local tip = CreateFrame("GameTooltip","Tooltip",nil,"GameTooltipTemplate")

local function isTradable(itemLocation)
	local itemLink = C_Item.GetItemLink(itemLocation)
	tip:SetOwner(UIParent, "ANCHOR_NONE")
	tip:SetBagItem(itemLocation:GetBagAndSlot())
	tip:Show()
	for i = 1,tip:NumLines() do
		if(string.find(_G["TooltipTextLeft"..i]:GetText(), string.format(BIND_TRADE_TIME_REMAINING, ".*"))) then
			return true
		end
	end
	
	tip:Hide()
    return false
end
  Reply With Quote