ItemDataCache v1.03

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 have to install "Informant" from "Auctioneer" package.

Features:
- Static "sell to vendor" prices database for ~10750 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.
- Informant addon override: if you have Informant installed, ItemDataCache will supply it with data it knows, allowing Informant to display prices for items it does not know internally (like new TBC items, for example).

Changes:
v1.03
- Added 2236 items to "sell to vendor" DB, item count is now 10757.
- Ignore damaged items in scan for "sell to vendor" price.
- Informant hook now returns nil if it got nil from Informant.
- Alchemy/enchanting/engineering recipes with charges listed for items they teach are no longer treated as items with charges for "sell to vendor" price scan.
- Added experimental and not yet documented functions to get locale-independent class and subclass ID for item (charged recipe ignore feature uses it, as well as latest version of Titan Panel - Itemized Deductions (ReBorn) - you can check those for examples). List of available IDs is limited right now and all of them will be added in later releases. This feature SHOULD work for anyone without problem, but in case I did something wrong it could cause disconnect on startup. If this happens, please disable ItemDataCache and report to me as soon as possible.

v1.02
- Added 723 items to "sell to vendor" DB, item count is now 8521.
- Added support for charged items ID saving. This was done to correctly ignore price changes for items with just one charge left, as they look like standard consumable items without any additional indication that they had more charges.
- Made capture transformation format for charges in scanner more universal, fixing issues with German client using slightly different string.
- Fixed scanner stopping after finding first item with charges in bags.
  Thanks to Dragzal and Abu-Dun for reporting issues with charges scanning and German client and for helping to test fixes.
v1.01
- Fixed stupid bug introduced in last minute changes before first public release that caused database cleaner remove all local gathered data on every startup.
- Cleaned static database from duplicates (just another thing that I forgot to do before release). Correct item count is 7798.
- Made scanner ignore items with spell charges until I decide how to better handle them.

Messages:
Since this is in active development, there's no option yet to turn off informative messages, but since they only appear when you got new data or on game start, that shouldn't be much of a problem. 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 change item prices.
- "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 is "true" if item with that ID can have charges.

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 have 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 to hook into that is get called every time when data in that table is updated. 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 are done as usual:
	local hook=ItemDataCache.OnUpdate.ByID_selltovendor
	ItemDataCache.OnUpdate.ByID_selltovendor=function() MyAddon.UpdateFrames() return hook() end

Other addons support and overrides:
- Titan Panel - Itemized Deductions (ReBorn) 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. :)
- Informant: ItemDataCache hooks Informant.GetItem and inserts its own "sell to vendor" values. This allows Informant to display correct updated and previously unknown prices. Also if you have any addons that use Informant for price data (like Bottom Scanner), they will receive this new data too.