View Single Post
Old 07-08-12, 09:55 PM   #3
blacknight
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Feb 2005
Posts: 8
this is my exact code for exporting talents and glyphs for both specs from ingame to a lua file

Code:
unit = "player";
	local numTabs,numPts,state,petName;
	local numSpecs = GetNumSpecializations(false, "player");
	local structTalent={};
	local structTalents={};

	xstat["Talents"] = {};

	numSpecGroups = GetNumSpecGroups(false, "player");
	state = "Talents";
	local tabName,iconTexture,pointsSpent,background;
	local cnt=0;
	local nameTalent,iconTexture,tier,column,currentRank,maxRank,isExceptional,meetsPrereq;
	
	for i = 1, numSpecGroups do
		tindex = i;
		structTalent[tindex]={};
		if (GetActiveSpecGroup(false, "player") == i) then
			Act = true;
		else
			Act = false;
		end
		local id, sname, description, sicon, background= GetSpecializationInfo(i);
		local role = GetSpecializationRole(i);
		
		structTalent[tindex]={
			Icon	=	frame.scanIcon(sicon),
			Background	=	frame.scanIcon(background),
			Name		=	sname,
			Desc 		=	description,
			Active		=	Act,
			Role		=	role,
		};
		structTalent[tindex]["Talents"] = {};
		for talentIndex=1,18 do
			--name, iconTexture, tier, column, selected, available = GetTalentInfo(talentIndex ,null, "player", i) 
			name, iconTexture, tier, column, selected, available = GetTalentInfo(talentIndex, "player", i, false, frame.UnitClass("player"));

			if( name ) then
				structTalent[tindex]["Talents"][name]={
					Location	= strjoin(":", tier,column),
					Texture		=	frame.scanIcon(iconTexture),
					Selected	=	selected,
					Available	=	available,
					Name		=	name,
				};
			end
		end
		local structGlyphs={};
		structTalent[tindex]["Glyphs"] = {};
			for index=1, GetNumGlyphSockets() do
				local enabled, glyphType, glyphTooltipIndex, glyphSpell, icon = GetGlyphSocketInfo(index,i);
				if(enabled == 1 and glyphSpell) then
					name, rank, icon, powerCost, isFunnel, powerType, castingTime, minRange, maxRange = GetSpellInfo(glyphSpell)
					structGlyphs[index] = {
						Name	= name,
						Type	= glyphType,
						Icon	= frame.scanIcon(icon),
					};
				else
					structGlyphs[index] = nil;
				end
			end
		structTalent[tindex]["Glyphs"] = structGlyphs;

	end
__________________
blacknight is offline