Quantcast WoWInterface - View Single Post - get class spec of Enemy Unit in BG
View Single Post
01-06-13, 07:02 PM   #7
A Pyroguard Emberseer
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,251
I'm just going to leave here that you don't need that static table to get the spec name.
This should get you there and be dynamic to classes added as long as the API doesn't change significantly.

After you've validated your 'unit' in whatever method to ensure it's one you want to process this snippet will return you the relevant data.
local locClass, enClass, classID = UnitClass(unit)
local global_spec_id, spec_name, description, icon, background = GetSpecializationInfoForClassID(classID)
You don't need all those returns obviously I left them in for verbosity.

I think based on what you're trying to do, you might also be better served by embedding LibGroupInSpecT-1.0
and letting it handle all the gritty details.
  Reply With Quote