PageRenderTime 79ms CodeModel.GetById 73ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/Tukui/modules/addonskins/balancepower.lua

http://github.com/Asphyxia/Tukui
Lua | 42 lines | 37 code | 2 blank | 3 comment | 3 complexity | 0249623eed12141d7f6066d877a69b32 MD5 | raw file
 1local T, C, L = unpack(select(2, ...)) -- Import: T - functions, constants, variables; C - config; L - locales
 2
 3------------------------------------------------------------------------
 4	-- Balance Power Panel              [EPICGRIM]
 5------------------------------------------------------------------------
 6if IsAddOnLoaded("BalancePowerTracker") then
 7if (T.myclass == "DRUID") then
 8	local eclipseBar = CreateFrame("Frame", "EclipseBar", UIParent)
 9	eclipseBar:CreatePanel(nil, 1, 1, "CENTER", BalancePowerTrackerBackgroundFrame, "CENTER", 0, 0)
10	eclipseBar:ClearAllPoints()
11	eclipseBar:Point("TOPLEFT", BalancePowerTrackerBackgroundFrame, "TOPLEFT", 0, 0)
12	eclipseBar:Point("BOTTOMRIGHT", BalancePowerTrackerBackgroundFrame, "BOTTOMRIGHT", 0, 0)
13	eclipseBar:CreateShadow("Default")
14	
15	local eclipseBarfunc = CreateFrame("Frame")
16	eclipseBarfunc:RegisterEvent("PLAYER_ENTERING_WORLD")
17	eclipseBarfunc:RegisterEvent("UNIT_AURA")
18	eclipseBarfunc:RegisterEvent("UPDATE_SHAPESHIFT_FORM")
19	eclipseBarfunc:RegisterEvent("PLAYER_TALENT_UPDATE")
20	eclipseBarfunc:RegisterEvent("UNIT_TARGET")
21	eclipseBarfunc:SetScript("OnEvent", function(self)
22    local activeTalent = GetPrimaryTalentTree()
23    local shift = GetShapeshiftForm()
24	local grace = select(7, UnitAura("player", "Nature's Grace", nil, "HELPFUL"))
25    	if grace then
26			eclipseBar:SetBackdropBorderColor(205, 25, 0, 1)
27		else
28			eclipseBar:SetBackdropBorderColor(unpack(C["media"].bordercolor))
29		end
30
31		if activeTalent == 1 then
32		    if shift == 1 or shift == 2 or shift == 3 or shift == 4 or shift == 6 then
33		        eclipseBar:Hide()
34			else
35			    eclipseBar:Show()
36			end
37		else
38		    eclipseBar:Hide()
39		end
40	end)
41end
42end