Thread Tools Display Modes
Prev Previous Post   Next Post Next
08-10-24, 09:06 AM   #1
cokedrivers
A Rage Talon Dragon Guard
 
cokedrivers's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 328
SoD Active Spec

Im having a issue getting the secondary spec to show correctly.

Here is the code:
Code:
local specPlugin = CreateFrame('Frame', nil, UIParent, BackdropTemplateMixin and "BackdropTemplate")
		specPlugin:EnableMouse(true)
		specPlugin:SetFrameStrata('BACKGROUND')
		specPlugin:SetFrameLevel(3)

		local Text = specPlugin:CreateFontString(nil, 'OVERLAY')
		Text:SetFont(db.font, db.fontSize,'THINOUTLINE')
		PlacePlugin(db.spec, Text)

		local talent = {}
		local active
		local talentString = string.join('', '|cffFFFFFF%s|r ')
		local activeString = string.join('', '|cff00FF00' , ACTIVE_PETS, '|r')
		local inactiveString = string.join('', '|cffFF0000', FACTION_INACTIVE, '|r')



		local function LoadTalentTrees()
			for i = 1, GetNumTalentGroups(false, false) do
				talent[i] = {} -- init talent group table
				for j = 1, GetNumTalentTabs(false, false) do
					talent[i][j] = select(6, GetSpecializationInfo(j, false, false, i))
				end
			end
		end

		local int = 5
		local function Update(self, t)
			
			int = int - t
			if int > 0 then return end
			active = GetActiveSpecGroup(false, false)
			if MODULE.playerRole ~= nil then
				Text:SetFormattedText(talentString, hexa..select(2, GetSpecializationInfo(GetSpecialization(false, false, active)))..hexb)
			else
				Text:SetText(hexa.."No Spec"..hexb)
			end
			int = 2

			--disable script	
			self:SetScript('OnUpdate', nil)
			
		end


		specPlugin:SetScript('OnEnter', function(self)
			local anchor, panel, xoff, yoff = DataTextTooltipAnchor(Text)
			GameTooltip:SetOwner(panel, anchor, xoff, yoff)

			GameTooltip:ClearLines()
			GameTooltip:AddLine(hexa..PLAYER_NAME.."'s"..hexb.." Spec")
			GameTooltip:AddLine' '
			if MODULE.playerRole ~= nil then
				for i = 1, GetNumTalentGroups() do
					if GetSpecialization(false, false, i) then
						GameTooltip:AddLine(string.join('- ', string.format(talentString, select(2, GetSpecializationInfo(GetSpecialization(false, false, i)))), (i == active and activeString or inactiveString)),1,1,1)
					end
				end
			else
				GameTooltip:AddLine("You have not chosen a Spec yet.")
			end
			GameTooltip:AddLine' '		
			GameTooltip:AddLine("|cffeda55fClick|r to Open Talent Tree")
			GameTooltip:Show()
		end)

		specPlugin:SetScript('OnLeave', function() GameTooltip:Hide() end)

		local function OnEvent(self, event, ...)
			if event == 'PLAYER_ENTERING_WORLD' then
				self:UnregisterEvent('PLAYER_ENTERING_WORLD')
			end
			
			-- load talent information
			LoadTalentTrees()

			-- Setup Talents Tooltip
			self:SetAllPoints(Text)

			-- update datatext
			if event ~= 'PLAYER_ENTERING_WORLD' then
				self:SetScript('OnUpdate', Update)
			end
		end



		specPlugin:RegisterEvent('PLAYER_ENTERING_WORLD');
		specPlugin:RegisterEvent('CHARACTER_POINTS_CHANGED');
		specPlugin:RegisterEvent('PLAYER_TALENT_UPDATE');
		specPlugin:RegisterEvent('ACTIVE_TALENT_GROUP_CHANGED')
		specPlugin:RegisterEvent("EQUIPMENT_SETS_CHANGED")
		specPlugin:SetScript('OnEvent', OnEvent)
		specPlugin:SetScript('OnUpdate', Update)

		specPlugin:SetScript("OnMouseDown", function() ToggleTalentFrame() end)
And here is how it looks currently:


Any help would be great.
Thank You in Adavance..
  Reply With Quote
 

WoWInterface » Classic - AddOns, Compliations, Macros » Classic - AddOn Help/Support » SoD Active Spec

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off