ItemDataCache v1.308

This update includes 133 more items, and dozens of price updates reflected
in patch 3.0.8.
 

This addon is both a static database and active scanner for item data. Note,
 this addon does not display gathered data by itself - it supplies data to
 other addons. For example if you want to see "sell to vendor" prices you've
 gathered, you would need to install an addon such as 'ItemNotes'.

Features:
- Static "sell to vendor" prices database for ~31000 items.
- Active "sell to vendor" scanner that will save unknown or new prices for all
 items in your bags every time you visit a merchant.

Notes:
- Since this addon is currently in active development, there's no interface option yet to turn off messages, however ItemDataCache should report every item only once, so that shouldn't be much of a problem.
- *** WARNING! *** If you get repeated messages about same item on every visit to the vendor, that most likely means you've found some error in the scanner. Please report to me name of affected item and what properties (soulbound/quest/charges/etc) it has.
- If you really want to disable those messages, even considering that with current size of database you'll probably will not even see one in a week, you can use "/script ItemDataCacheLocal.Settings.noNewDataMessages=true" and "/script ItemDataCacheLocal.Settings.noUpdatedDataMessages=true" commands to do that. Note, however, that bug reports without information from those messages are much less useful to me and it will take more time to find and fix them, unless you'll be able to turn messages on again and reproduce the bug.

- This addon does nothing with collected data by itself, so you will most likely want to install one of addons that can display data collected by ItemDataCache or use it in its calculations:

 * ItemNotes,  add the vendor sell prices to item tooltips

 * Informant from Auctioneer package: Informant's own database is updated periodically, but there are always some new unknown items or price changes. ItemDataCache hooks Informant.GetItem and inserts its own "sell to vendor" values. This allows Informant to display correct updated and previously unknown prices.
 * BottomScanner from Auctioneer package: just like with Informant, BottomScanner's database sometimes do not have most recent prices. ItemDataCache will provide BottomScanner with prices it knows.
 * Titan Panel - Itemized Deductions (ReBorn): this addon, created to help you free space in your bags by selling junk, dropping cheap items or combining incomplete stacks, uses ItemDataCache as primary source of prices. In fact ItemDataCache was written specifically to replace Itemized Deductions' old database and everything else is just a nice side effect. :)
 * MobInfo-3: tracks information about monsters you fight, like their HP or what items they drop. ItemDataCache is the source  for item prices data displayed in tooltips and used in calculating total monster value for this addon.
 * Greyprice: minimal solution to track your looting progress. This addon displays a small window with total cost of all the junk loot in your bags.
 * SwitchRod: uses ItemDataCache class data to find fishing pole in bags and equip it on command or switches your equipment back.
 * Additionally, any addon that uses either Informant (for example: GarbageFu) or GetSellValue API (for example: VendorBait) for item prices will work with ItemDataCache too.

Changes:

v.1.302

- updated many items prices for 3.0.8
- add 133 new items
- added code to try and protect against itemized deduction calling into internals
- tried to fix parsing issue for zhCH
- made tooltip scanner mode robust against a case it would stop seeing items
 had durabilty

v1.242

- TOC update for 3.0 WoW client
- Updated 513 items
- include change to make it work with WoW 2.4.2 (still works with 3.0.2)

 
Messages:
You may encounter following messages:
- "Found new data for table sometable [Item]: value."
 * This means that ItemDataCache scanner discovered some new data that it doesn't have. Since built-in static database with this version is not that big, you should see it often enough when you visit merchant with new items.
- "Found UPDATED data for table sometable [Item]: value."
 * This is more rare and interesting: scanner discovered data that doesn't match what it already knows. This may happen when Blizzard changes item prices, for example.
- "Resetting local data for table sometable item [Item]."
 * Local cache had some data for item that is no longer considered more recent than static cache and that data is now removed.
- "Finished local data purge for sometable. X entries matching static cache freed. Y entries with data more recent than static cache found."
 * This message appears on startup or UI reload (that includes continent changes and going into instance). X, number of matching entries tells you that your dynamic local cache (saved in your addon settings) had X entries that already exists in built-in static database and that those entries were freed to save memory, because there's no point to keep duplicate data. This number will often be 0 and should only change when you install new static database (with new version of addon, most likely). Y, number of more recent entries is number of entries in your local cache that are also present in static database, but have more accurate data in local cache because scanner updated it.

Tables
Two tables are available at present:
- ByID_selltovendor - table of prices for selling items to vendor. Values for this table are item worth in copper.
- ByID_maxcharges - table of items that can have charges. Values for this table are "true" if item with that ID can have charges or nil.

API:  
If your addon deals with any data that can be provided by ItemDataCache you may want to use it as one of alternative sources.
Generally every table has two functions available: ItemDataCache.Get.TableName and ItemDataCache.OnUpdate.TableName. First function returns most recent value from all tables, giving priority to data in local cache. Second is a function that is called every time when data in that table is updated so you can hook it and act accordingly on every change. You may want to use it if you addon needs to update shown data on-the-fly, for example if it shows some tracking window or panel that is always on screen.
Example:
- ItemDataCache.Get.ByID_selltovendor(itemID)
 * Returns "sell to vendor" price of known item in copper or nil if price is unknown.
- ItemDataCache.OnUpdate.ByID_selltovendor()
 * Hook function that allows you to catch updates to prices as they happen, if you addon displays information in real-time (for example if it is plugin for Titan or any other panel addon). Hooking is done as usual:
	local hook=ItemDataCache.OnUpdate.ByID_selltovendor
	ItemDataCache.OnUpdate.ByID_selltovendor=function() MyAddon.UpdateFrames() return hook() end

Additonally ItemDataCache support GetSellValue API (http://www.wowwiki.com/API_GetSellValue) for values from "ByID_selltovendor" table. Please see WoWWiki page for more information.
