Originally Posted by Kanegasi
Classic's skills tab is always in the same order: Class, Primary, Secondary, Weapon, Armor, and Language. Using the header text, the SKILLS global string, and some local tables:
Lua Code:
local section, primary, secondary, other = 0, {}, {}, {} for i = 1, GetNumSkillLines() do local name, header, _, rank, _, _, max = GetSkillLineInfo(i) if header then section = section + 1 if section == 2 then primary.n = name elseif section == 3 then secondary.n = name end else tinsert( section == 2 and primary or section == 3 and secondary or other, {name,rank..' / '..max,.75,.9,1,.3,1,.3} ) end end GameTooltip:AddLine(primary.n) for i = 1, #primary do GameTooltip:AddDoubleLine( unpack( primary[i] ) ) end GameTooltip:AddLine(" ") GameTooltip:AddLine(secondary.n) for i = 1, #secondary do GameTooltip:AddDoubleLine( unpack( secondary[i] ) ) end GameTooltip:AddLine(" ") GameTooltip:AddLine(SKILLS) for i = 1, #other do GameTooltip:AddDoubleLine( unpack( other[i] ) ) end
|
Thank You very much @Kanegasi and @Seerah for taking the time to help me with this.
With using @Kanegasi's main lay out I was able to get the perfect setup for my tooltip for my databar.
Here is the code in its final stage:
Code:
local section, primary, secondary, weapons, other = 0, {}, {}, {}, {}
for i = 1, GetNumSkillLines() do
local skillName, isHeader, _, skillRank, _, _, skillMaxRank = GetSkillLineInfo(i)
if isHeader then
section = section + 1
if section == 2 then
primary.n = skillName
elseif section == 3 then
secondary.n = skillName
elseif section == 4 then
weapons.n = skillName
end
else
tinsert( section == 2 and primary or section == 3 and secondary or section == 4 and weapons or other, {skillName,skillRank..' / '..skillMaxRank,.75,.9,1,.3,1,.3} )
end
end
GameTooltip:AddLine(primary.n)
for i = 1, #primary do
GameTooltip:AddDoubleLine( unpack( primary[i] ) )
end
GameTooltip:AddLine(" ")
GameTooltip:AddLine(secondary.n)
for i = 1, #secondary do
GameTooltip:AddDoubleLine( unpack( secondary[i] ) )
end
GameTooltip:AddLine(" ")
GameTooltip:AddLine(weapons.n)
for i = 1, #weapons do
GameTooltip:AddDoubleLine( unpack( weapons[i] ) )
end
GameTooltip:Show()
end)
and here is the screenshot of how it turned out:
Again thanks for the help.
Coke