Hi Urtgard
I used the same code and added an or as follows;
Lua Code:
if(string.find(_G["TooltipTextLeft"..i]:GetText(), string.format(BIND_TRADE_TIME_REMAINING, ".*"))) or
(string.find(_G["TooltipTextLeft"..i]:GetText(), string.format(REFUND_TIME_REMAINING, ".*"))) then
return true
end
and an elseif;
Lua Code:
if(string.find(_G["TooltipTextLeft"..i]:GetText(), string.format(BIND_TRADE_TIME_REMAINING, ".*"))) then
return true
elseif(string.find(_G["TooltipTextLeft"..i]:GetText(), string.format(REFUND_TIME_REMAINING, ".*"))) then
return true
end
I also tried an elseif, but for some reason, I was only getting true on items that could be traded.
Right now I am using a combination of your tooltip scan code and getting the refund seconds as follows,
Lua Code:
local function isTradable(itemLocation)
local itemLink = C_Item.GetItemLink(itemLocation)
tip:SetOwner(UIParent, "ANCHOR_NONE")
tip:SetBagItem(itemLocation:GetBagAndSlot())
for i = 1,tip:NumLines() do
if(string.find(_G["TooltipTextLeft"..i]:GetText(), string.format(BIND_TRADE_TIME_REMAINING, ".*"))) then
return true
end
end
end
for bag = 0, 4 do
for slot = 0, GetContainerNumSlots(bag) do
local itemID = GetContainerItemID(bag, slot)
if itemID then
local _, itemLink = GetItemInfo(itemID)
local money, itemCount, refundSec = GetContainerItemPurchaseInfo(bag, slot)
local itemLocation = ItemLocation:CreateFromBagAndSlot(bag, slot)
if isTradable(itemLocation) or refundSec then
print("found",itemLink)
end
end
end
end
I just wish I could understand why scanning the tooltip works for one but not the other.