Ty, you already helped alot
I was just confused because it worked for friendly units but I noticed for enemys it is a bit more tricky.
Blizzard gives opportunities to detect specialization in closed PvP areas (skrims, rated arena, normal-, epic-bgs, rated bgs).
Something like this worked well with friendly units and some Tooltip Addons use this and Inspect for friendly player specs too:
Code:
local specID = GetInspectSpecialization(unit)
if specID then
local _, _, _, icon = GetSpecializationInfoByID(specID)
texture = icon
For arena enemys/opponents its always something like that:
Code:
for i=1,5 do
if UnitIsUnit(nameplateId, "arena"..i) then
addIcon(data[i], nameplate);
end
end
end
-----------------------------------------------------------------------------------
function SetupIcons()
for i = 1, GetNumArenaOpponentSpecs() do
local specID = GetArenaOpponentSpec(i)
if specID > 0 then
local id, name, description, icon, role, class = GetSpecializationInfoByID(specID);
data[i] = icon;
end
end
end