Earlier Versions
Name | Size | Uploaded | Game Version | Downloads | |
beta | Jan 1, 1970 | Download |
Description
Overview
MooInspect-1.0 is a library that provides an API for asynchronous inspection of unit specialization, talents, and equipment.
The native API for asynchronous inspection uses NotifyInspect for an inspection request and waiting for the INSPECT_READY event to indicate the inspection data is available. However the server will drop all inspection requests originating from the account if too many requests are initiated in too short a period of time.
MooInspect-1.0 limits the frequency of calls to NotifyInspect and keeps a queue of pending inspection requests to send to the server while out of combat. When the inspection data from a request becomes available, the message MooInspect_InspectReady is fired.
API Methods
QueueInspect
Queues an inspection request for a GUID.
lib:QueueInspect(guid)
Arguments:
guid
– string: GUID
CancelInspect
Cancels any pending inspection request for a GUID.
lib:CancelInspect(guid)
Arguments:
guid
– string: GUID
GetInspectAge
Returns the number of seconds since the inspection data for a GUID was received from the server. If no inspection data has ever been received, then this returns nil
.
age = lib:GetInspectAge(guid)
Arguments:
guid
– string: GUID
Returns:
age
– number ornil
: seconds since the data was received
RegisterCallback
Registers a function to handle the specified callback.
lib.RegisterCallback(handler, callback, method, arg)
Arguments:
handler
– table/string: your addon object or another table containing a function athandler[method]
, or a string identifying your addoncallback
– string: the name of the callback to be registeredmethod
– string/function/nil: a key into thehandler
table, or a function to be called, ornil
ifhandler
is a table and a function exists athandler[callback]
arg
– a value to be passed as the first argument to the callback function specified bymethod
Notes:
- If
handler
is a table,method
is a string, andhandler[method]
is a function, then that function will be called withhandler
as its first argument, followed by the callback name and the callback-specific arguments. - If
handler
is a table,method
is nil, andhandler[callback]
is a function, then that function will be called withhandler
as its first argument, followed by the callback name and the callback-specific arguments. - If
handler
is a string andmethod
is a function, then that function will be called with the callback name as its first argument, followed by the callback-specific arguments. - If
arg
is non-nil, then it will be passed to the specified function. Ifhandler
is a table, thenarg
will be passed as the second argument, pushing the callback name to the third position. Otherwise,arg
will be passed as the first argument.
UnregisterCallback
Unregisters a specified callback.
lib.UnregisterCallback(handler, callback)
Arguments:
handler
– table/string: your addon object or a string identifying your addoncallback
– string: the name of the callback to be unregistered
Callbacks
MooInspect-1.0 provides the following callbacks to notify interested addons.
MooInspect_InspectReady
Fires when the inspection data for a GUID is available for talent and equipment queries.
Arguments:
guid
– string: GUID
License
MooInspect-1.0 is released under the 2-clause BSD license.
Feedback
- Report a bug or suggest a feature.
Add a comment