LibTalentQuery-1.0
From WowAce Wiki
| Summary | |
|---|---|
| Lib: TalentQuery 1.0 | |
| Library to help with querying unit talents. | |
| TOC | 2.4 (20400) |
| Category | Libraries |
| Author | Peragor |
| Details | |
| Version | $Rev$ |
| Links | |
| Betas | Ace SVN Zip |
| Changelog | FishEye |
Contents |
[edit]
Description
A library to make querying talents a lot easier and less problematic.
Problems with blizzards talent query api:
- When the INSPECT_TALENT_READY event is fired, it doesn't tell you which unit it's ready for.
- Because of 1 you can not query multiple units at once.
- If two addons call NotifyInspect() at the same time, neither addon knows if the INSPECT_TALENT_READY event is "theirs".
This library attempts to fix this problem by providing:
- A callback "event" that will provide the name and realm of the unit which the talents are ready for.
- A queueing system that will only do one NotifyInspect() at a time on a unit who is visible and connected.
- A secure hook on NotifyInspect that will take preventive measures to stop another addon from confusing a query.
[edit]
Usage
local TalentQuery = LibStub:GetLibrary("LibTalentQuery-1.0")
TalentQuery.RegisterCallback(self, "TalentQuery_Ready")
local spec = {}
...
if UnitIsUnit(unit, "player") then
self:TalentQuery_Ready(_, UnitName(unit))
else
TalentQuery:Query(unit)
end
...
function MyAddon:TalentQuery_Ready(e, name, realm)
local namerealm = realm and realm ~= "" and name .. "-" .. realm or name
local isnotplayer = (name ~= UnitName("player"))
for tab = 1, GetNumTalentTabs(isnotplayer) do
local treename, _, pointsspent = GetTalentTabInfo(tab, isnotplayer)
if pointsspent > 30 then
spec[namerealm] = treename
end
end
...
end
[edit]
Used in
GridLayoutPlus, MoBuffs, LibDogTag-3.0 (PitBull, CowTip)
[edit]
API Documentation
Note: This documentation is auto-generated. Please note that direct modifications may be overwritten on next autogenerate.
[edit]
:CheckInspectQueue()
No arguments
[edit]
:NameToUnitID(name)
[edit]
Arguments
- name
- type - (needs documentation)
[edit]
:UnitNameRealm(unit)
[edit]
Arguments
- unit
- type - (needs documentation)
[edit]
Callbacks fired
[edit]
TalentQuery_Ready
Fires when the talents are ready to be read.
[edit]
Args
- event
- "TalentQuery_Ready"
- unitname
- the unit name of the unit whose talents are ready to be read
- realm
- the realm name of the unit whose talents are ready to be read

