LibInspect
The goal of this library is to provide a universal way to inspect players that doesn't compete with other addons. This library with achieve this by doing asynchronous requests.
In order to use the addon you will need to first load it as a library, then lib:AddHook('addonName', 'what', function(guid) YourFunction(guid, data); end); It will then only request the type of information for addons that have registered. For example what = items it will only run NotifyInspect() and get data.items , or what = {items,talents} then will return data.items and data.talents. 'what' will also include honor and arena information, and maybe more when I get in game and play around with it.
Then when you want to make a request lib:RequestData('what', target, force) or lib:RequestItems(target, force) where force will ignore cached data. It will return caninspect, cached, refreshing where CanInspect() is if fresh data is posable, cached is bool if there is cached information and refreshing is if a NotifyInspect() was sent out.
Speaking of cached data, the lib will store localy old inspect information. This will allow for faster retrevial. The max age that information will be stored is set by lib:MaxAge(seconds); where the lowest settng by any addon will win out.
The lib will try to not break the inspect window as well as try and fix a few issues in the default blizzard inspect.
Documentation
Supported Types
- all - use sparingly
- items - returns a table of items
- honor - not yet
- talents - not yet
- achivements - not yet
Methods
success = LibInspect:AddHook('MyAddon', type, function(guid, data, age) YourFunction(guid, data, age); end);
maxAge = LibInspect:SetMaxAge(seconds); default 1800
itemQuantity = LibInspect:SetRescan(items); default 10
caninspect, unitfound, refreshing = LibInspect:RequestData(type, target, force); or LibInspect:Request_Type_(target, force) ex. LibInspect:RequestItems(...)
Callbacks/Hooks
When the data is ready you YourFunction(guid, data, age) will be called
guid = UnitGUID(); -- use this to tie it to the inspect request data = false; -- Nothing was found/error or date = { items = { 1 = itemLink, -- the result of GetInventoryItemLink("unit", 1); 2 = itemLink, ... 19 = itemLink, }, honor = ..., talents = ..., achivements = ..., }; age = ##; -- how old in seconds the data is
Cant install it wiht curse client and have to download and update it manually.
@oscarucb
Cool, but LibInspect is primarily for inspecting gear/talents on anyone, they don't have to be in the group. It could be that LibGroupInspecT uses LibInspect for getting the information to avoid duplicate code.
If you want to take over LibInspect, I would be happy to pass it on or work with you on it. I'm not much for writing libraries and took the wrong approach setting it up in the first place (hence beta).
Have you checked out LibGroupInSpecT:
http://www.wowace.com/addons/libgroupinspect/
It's an established library serving much the same need. There's a strong potential for inspect interference between libraries of this nature, so it might be useful to coordinate our efforts..