You get it from COMBAT_LOG_EVENT, i havent found the direct lua function for it.
If not usable, go with reversing.
On topic :
By the merchant I go over each item and check the texture, if texture matches to what i want, and its highest level available that i can use, and its a consumable ...
This has not failed me yet when it comes to restocking drink / food from vendor, note that its untested with all items, just 0-40ish with horde.
Now, there is an even "better" solution. This is written in lua.
Code:
function ParseMerchantToopTips()
local mytext, my2text
local text, metext
local numItems = GetMerchantNumItems()
for i=1, numItems do
ToolTipForMerchant:SetOwner(UIParent, "ANCHOR_NONE")
ToolTipForMerchant:ClearLines()
ToolTipForMerchant:SetMerchantItem(i)
for i=1,MerchantTooltip:NumLines() do
mytext, my2text = getglobal("MerchantTooltipTextLeft" .. i), getglobal("MerchantTooltipTextRight" .. i)
text, metext = mytext:GetText(), my2text:GetText()
-- this will print all tooltip lines for all items at a merchant.
print(text,metext)
end
ToolTipForMerchant:Hide()
end
end
ToolTipForMerchant = CreateFrame("GameTooltip", "MerchantTooltip", UIParent, "GameTooltipTemplate")