This is not a Blizzard API.
The intent of this page is to provide a simple, consistant API for addons to query the vendor sell value of an item without the need to individually support every sell value addon in existance. All sell value addons are asked to provide the following global function:
sellToVendorPrice = GetSellValue(item)
Requirements
- 'item' must take the same values GetItemInfo does
- Must return an int, or nil if unknown price. Only return 0 if you know the item cannot be sold to vendor.
Recommended
Check for existence of the global before you define it and hook it if present. This allows for other sell value addons to provide prices that are not known by your addon.
Example Code
The following code snippet is provided for ease of implementing this API.
local origGetSellValue = GetSellValue function GetSellValue(item) local id if type(item) == "number" then id = item elseif type(item) == "string" then -- Find the itemid local _, link = GetItemInfo(item) if not link then return end local _, _, itemid = string.find(link, "item:(%d+)") id = tonumber(itemid) end -- Return out if we didn't find an id if not id then return end local sellval = -- Retrieve the price here... if sellval then return sellval elseif origGetSellValue then -- Call our hook if present, pass the id to save processing it again return origGetSellValue(id) end end
Addons
Addons implementing this function:
- Informant of the Auctioneer AddOns Package by The Auctioneer AddOns Team.
- ItemDataCache (v1.11 and higher)
- ItemPrice-1.0 by Bam
- SellFish by Tuller
Addons using this function:
- VendorBait by Tekkub