View Single Post
07-16-10, 02:42 PM   #6
IQgryn
A Cyclonian
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 46
Originally Posted by ckaotik View Post
Currently, as far as I know, there ist LibTalentQuery which can be combined with LibGroupTalents, both written by Zeksie, the author of ZOMG!Buffs.
Oh, I didn't know about that one. I'd probably just (help) update it to handle the timeouts properly. The gear can be grabbed at the same time as the talent data the way it appears to work currently, or I could add a function that gathered the appropriate data (specified with flags) and passed that to your callback function instead.

Actually, I rather like that second option. Why should each addon have to handle the complexities of the talent tree API when you could just return a table with subtables for each tree (indexed by both name and tree number) that had rank numbers for each talent (indexed by both name and talent number). Gear could be done as a table indexed by slot name and/or number, too.

Code:
...
-- the last two args specify whether to return gear/talent info, respectively
TalentQuery.RegisterCallback(self, "hasTitansGrip", false, true)
...
TalentQuery:Query(unit)

function hasTitansGrip(event, pname, prealm, unitid, talents, gear)
    return talents["Fury"]["Titan's Grip"] == 1
end