Quantcast WoWInterface - View Single Post - WoW Classic Professions
View Single Post
01-23-20, 07:41 AM   #6
cokedrivers
A Rage Talon Dragon Guard
 
cokedrivers's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 305
Originally Posted by Kanegasi View Post
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:
  1. local section, primary, secondary, other = 0, {}, {}, {}
  2.  
  3. for i = 1, GetNumSkillLines() do
  4.     local name, header, _, rank, _, _, max = GetSkillLineInfo(i)
  5.     if header then
  6.         section = section + 1
  7.         if section == 2 then
  8.             primary.n = name
  9.         elseif section == 3 then
  10.             secondary.n = name
  11.         end
  12.     else
  13.         tinsert( section == 2 and primary or section == 3 and secondary or other, {name,rank..' / '..max,.75,.9,1,.3,1,.3} )
  14.     end
  15. end
  16.  
  17. GameTooltip:AddLine(primary.n)
  18. for i = 1, #primary do
  19.     GameTooltip:AddDoubleLine( unpack( primary[i] ) )
  20. end
  21.  
  22. GameTooltip:AddLine(" ")
  23. GameTooltip:AddLine(secondary.n)
  24. for i = 1, #secondary do
  25.     GameTooltip:AddDoubleLine( unpack( secondary[i] ) )
  26. end
  27.  
  28. GameTooltip:AddLine(" ")
  29. GameTooltip:AddLine(SKILLS)
  30. for i = 1, #other do
  31.     GameTooltip:AddDoubleLine( unpack( other[i] ) )
  32. 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
  Reply With Quote