(GetSellValue support is now in the addon instead of the library (ItemPriceTooltip/ItemPrice-1.1))
(Addons: Added a link for SellFish)
Line 47: Line 47:
* [[User:Rowaasr13#My_addons|ItemDataCache]] (v1.11 and higher).
* [[User:Rowaasr13#My_addons|ItemDataCache]] (v1.11 and higher).
* [ ItemPriceTooltip] by [[User:Bam|Bam]].
* [ ItemPriceTooltip] by [[User:Bam|Bam]].
* [[SellFish]] by Tuller.
* [ SellFish] by [[User:Tuller|Tuller]].
* [ Valuation] by [[User:Polarina|Polarina]].
* [ Valuation] by [[User:Polarina|Polarina]].

Revision as of 19:13, October 20, 2007

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 existence. All sell value addons are asked to provide the following global function:

sellToVendorPrice = GetSellValue(item)


  • '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.


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)
	-- 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)


Addons implementing this function:

Addons using this function:

Community content is available under CC-BY-SA unless otherwise noted.