LibTalentQuery-1.0

From WowAce Wiki
Jump to: navigation, search
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

Description

A library to make querying talents a lot easier and less problematic.

Problems with blizzards talent query api:

  1. When the INSPECT_TALENT_READY event is fired, it doesn't tell you which unit it's ready for.
  2. Because of 1 you can not query multiple units at once.
  3. 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:

  1. A callback "event" that will provide the name and realm of the unit which the talents are ready for.
  2. A queueing system that will only do one NotifyInspect() at a time on a unit who is visible and connected.
  3. A secure hook on NotifyInspect that will take preventive measures to stop another addon from confusing a query.

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

Used in

GridLayoutPlus, MoBuffs, LibDogTag-3.0 (PitBull, CowTip)


API Documentation

Note: This documentation is auto-generated. Please note that direct modifications may be overwritten on next autogenerate.

:CheckInspectQueue()

No arguments

:NameToUnitID(name)

Arguments

name
type - (needs documentation)


:UnitNameRealm(unit)

Arguments

unit
type - (needs documentation)



Callbacks fired

TalentQuery_Ready

Fires when the talents are ready to be read.

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