Tekkub56883@legacy41576006 (talk | contribs) (→Addons: ItemPriceTooltip does not use this API, but ItemPrice-1.0 does implement it) |
(Created page with "{{Patchbox | Patchname = | Image = | Caption = | Release = 2011-02-08 | Version = 13596 | toc = 40000 | Highlights = | Related = | Pr...") |
||
Line 1: | Line 1: | ||
+ | {{Patchbox |
||
− | '''''This is <u>not</u> a Blizzard API.''''' |
||
+ | | Patchname = |
||
+ | | Image = |
||
+ | | Caption = |
||
+ | | Release = 2011-02-08 |
||
+ | | Version = 13596 |
||
+ | | toc = 40000 |
||
+ | | Highlights = |
||
+ | | Related = |
||
+ | | Prev = 4.0.6 |
||
+ | | Current = 4.0.6a |
||
+ | | Next = 4.1.0 |
||
+ | }} |
||
+ | ==User interface== |
||
− | 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: |
||
+ | * The [[Gear Manager]] makes a sound if you switch gear. |
||
+ | ==References== |
||
+ | <references /> |
||
+ | {{patches}} |
||
− | sellToVendorPrice = GetSellValue(item) |
||
+ | [[Category:World of Warcraft patches|4.0.6 (undocumented changes)]] |
||
− | |||
− | == Requirements == |
||
− | * 'item' must take the same values [[API GetItemInfo|GetItemInfo]] does |
||
− | * Must return an int, or nil if no price. Never return 0. |
||
− | |||
− | == 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. |
||
− | <pre> |
||
− | 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 |
||
− | </pre> |
||
− | |||
− | == Addons == |
||
− | Addons implementing this function: |
||
− | * [[Informant]] of the [[Auctioneer (AddOn)|Auctioneer]] [[AddOns]] Package by [http://auctioneeraddon.com/ The Auctioneer AddOns Team]. |
||
− | * [[ItemDataCache]] (v1.11 and higher) |
||
− | * [http://www.wowace.com/wiki/ItemPrice-1.0 ItemPrice-1.0] by [[User:Bam|Bam]] |
||
− | * [[SellFish]] by Tuller |
||
− | |||
− | Addons using this function: |
||
− | * [[VendorBait]] by [[User:Tekkub|Tekkub]] |
Revision as of 11:01, 26 February 2011
Patch 4.0.6a (undocumented changes) | |||||
---|---|---|---|---|---|
Release date | 2011-02-08 | ||||
Initial version | 13596 | ||||
Interface .toc | 40000 | ||||
| |||||
Patch chronology | |||||
| |||||
Useful links | |||||
Patches • Patches category |
User interface
- The Gear Manager makes a sound if you switch gear.
References
|