Quantcast

Made separate panel for all specs.

Taracque [12-22-12 - 20:52]
Made separate panel for all specs.
Filename
Ele_GUI.lua
Elementarist.lua
modules/elemental.lua
modules/restoration.lua
diff --git a/Ele_GUI.lua b/Ele_GUI.lua
index 4b2f794..23db971 100755
--- a/Ele_GUI.lua
+++ b/Ele_GUI.lua
@@ -222,6 +222,9 @@ function Elementarist:ReStoreUIValues()
 end

 function Elementarist:CreateConfig()
+	if (Elementarist.configPanel ~= nil) then
+		return;
+	end
 	Elementarist.configPanel = CreateFrame( "Frame", "ElementaristConfigPanel", UIParent );
 	-- Register in the Interface Addon Options GUI
 	-- Set the name for the Category for the Options Panel
@@ -342,17 +345,11 @@ function Elementarist:CreateConfig()
 	ShieldAlpha:SetPoint("TOPLEFT",200,-218)
 	ShieldAlpha:Show()

-	local FSBehaviorMenu = Elementarist:CreateDropDownMenu(L.CONFIG_BEHAVIOR, Elementarist.configPanel, ElementaristDB, "Behavior", {{text = Elementarist.Behaviors["1"]}, {text = Elementarist.Behaviors["2"]}},200)
-	FSBehaviorMenu:SetPoint('TOPLEFT', 10, -268)
-
-	local EQEnableBtn = Elementarist:CreateCheckButton(L.CONFIG_ENABLE_EQ_SPELL, Elementarist.configPanel, ElementaristDB, "EnableEQ", false)
-	EQEnableBtn:SetPoint('TOPLEFT', 10, -298)
-
 	local ThreatWarnBtn = Elementarist:CreateCheckButton(L.CONFIG_THREAT_WARNING, Elementarist.configPanel, ElementaristDB, "ThreatWarning", false)
-	ThreatWarnBtn:SetPoint('TOPLEFT', 10, -328)
+	ThreatWarnBtn:SetPoint('TOPLEFT', 10, -268)

 	local EleLayout = Elementarist:CreateDropDownMenu(L.CONFIG_LAYOUT, Elementarist.configPanel, ElementaristDB, "Layout", {{text = Elementarist.EleLayout["1"]}, {text = Elementarist.EleLayout["2"]}},200)
-	EleLayout:SetPoint('TOPLEFT', 10, -358)
+	EleLayout:SetPoint('TOPLEFT', 10, -298)

 	local ResetBtn = Elementarist:CreateButton(L.CONFIG_RESET_POSITIONS, Elementarist.configPanel)
 	ResetBtn:SetWidth(160)
@@ -360,7 +357,7 @@ function Elementarist:CreateConfig()
 	ResetBtn:SetScript('OnClick', function()
 		Elementarist:ResetPosition()
 	end)
-	ResetBtn:SetPoint("TOPLEFT",10,-418)
+	ResetBtn:SetPoint("TOPLEFT",10,-328)
 	ResetBtn:Show()

 	Elementarist.configPanel.okay = function()
@@ -385,9 +382,7 @@ function Elementarist:CreateConfig()
 		ElementaristDB.alpha = 0.8
 		ElementaristDB.debuffalpha = 1
 		ElementaristDB.shieldalpha = 1
-		ElementaristDB.FireNova = true
 		ElementaristDB.Behavior = Elementarist.Behaviors["1"]
-		ElementaristDB.EnableUE = false
 		ElementaristDB.EnableEQ = false
 		ElementaristDB.ThreatWarning = true
 		ElementaristDB.Layout = Elementarist.EleLayout["1"]
@@ -407,6 +402,33 @@ function Elementarist:CreateConfig()
 	end)
 	-- Add the panel to the Interface Options
 	InterfaceOptions_AddCategory(Elementarist.configPanel)
+
+	-- create module panels
+	local i,i2,v,v2;
+
+	if (Elementarist.modules) then
+		for i,v in pairs(Elementarist.modules) do
+			local vposition = -40;
+			if (Elementarist[i].Configuration) then
+				local childPanel = CreateFrame( "Frame", "ElementaristConfigPanel" .. i, Elementarist.configPanel );
+				childPanel.name = i;
+				for i2,v2 in pairs(Elementarist[i].Configuration) do
+					if (v2.type == "DropDown") then
+						local dropDown = Elementarist:CreateDropDownMenu(v2.label, childPanel, ElementaristDB, i2, v2.options, 200);
+						dropDown:SetPoint('TOPLEFT', 10, vposition);
+						vposition = vposition - 30;
+					end
+					if (v2.type == "CheckBox") then
+						local checkBox = Elementarist:CreateDropDownMenu(v2.label, childPanel, ElementaristDB, i2, v2.options, 200);
+						checkBox:SetPoint('TOPLEFT', 10, vposition);
+						vposition = vposition - 30;
+					end
+				end
+				childPanel.parent = Elementarist.configPanel.name;
+				InterfaceOptions_AddCategory(childPanel);
+			end
+		end
+	end
 end

 function Elementarist.Options(msg)
diff --git a/Elementarist.lua b/Elementarist.lua
index 9c8c71c..90b98dc 100755
--- a/Elementarist.lua
+++ b/Elementarist.lua
@@ -125,9 +125,10 @@ Elementarist.eventFrame:SetScript("OnEvent", function(this, event, ...)
   Elementarist.events[event](...)
 end)

-Elementarist.eventFrame:RegisterEvent("ADDON_LOADED")
-Elementarist.eventFrame:RegisterEvent("PLAYER_LOGIN")
-Elementarist.eventFrame:RegisterEvent("PLAYER_ALIVE")
+Elementarist.eventFrame:RegisterEvent("ADDON_LOADED");
+Elementarist.eventFrame:RegisterEvent("PLAYER_LOGIN");
+Elementarist.eventFrame:RegisterEvent("PLAYER_ALIVE");
+Elementarist.eventFrame:RegisterEvent("PLAYER_ENTERING_WORLD");

 -- Define our Event Handlers here
 Elementarist.events = {}
@@ -171,6 +172,9 @@ function Elementarist.events.PLAYER_ALIVE()
 end

 function Elementarist.events.PLAYER_ENTERING_WORLD()
+	-- Create config page
+	Elementarist:CreateConfig()
+
 	Elementarist:detectTalent()
 end

@@ -223,9 +227,6 @@ function Elementarist.events.ADDON_LOADED(addon)
 	Elementarist.OmniCC = _G['OmniCC']
 	Elementarist.SpellFlash = _G['SpellFlashAddon']

-	-- Create config page
-	Elementarist:CreateConfig()
-
 	-- Register for Function Events
 	Elementarist.eventFrame:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
 	Elementarist.eventFrame:RegisterEvent("COMBAT_RATING_UPDATE") -- Monitor the all-mighty haste
@@ -240,6 +241,7 @@ end

 function Elementarist:RegisterModule(talent)
 	Elementarist.modules[talent] = true;
+	print (talent .. " Elementarist module registered");
 end;

 function Elementarist:CallModule( funcName, ... )
@@ -273,10 +275,8 @@ function Elementarist:InitSettings()
 	if ElementaristDB.alpha == nil then ElementaristDB.alpha = 0.8 end
 	if ElementaristDB.debuffalpha == nil then ElementaristDB.debuffalpha = 1 end
 	if ElementaristDB.shieldalpha == nil then ElementaristDB.shieldalpha = 1 end
-	if ElementaristDB.FireNova == nil then ElementaristDB.FireNova = true end
 	if ElementaristDB.Behavior == nil then ElementaristDB.Behavior = Elementarist.Behaviors["1"] end
 	if ElementaristDB.CLBehavior == nil then ElementaristDB.CLBehavior = Elementarist.CLBehaviors["0"] end
-	if ElementaristDB.EnableUE == nil then ElementaristDB.EnableUE = false end
 	if ElementaristDB.ThreatWarning == nil then ElementaristDB.ThreatWarning = true end
 	if ElementaristDB.EnableEQ == nil then ElementaristDB.EnableEQ = false end
 	if not ElementaristDB.x then ElementaristDB.x = -200 end
diff --git a/modules/elemental.lua b/modules/elemental.lua
index 8e8012d..380ff6d 100755
--- a/modules/elemental.lua
+++ b/modules/elemental.lua
@@ -3,6 +3,20 @@ local L = Elementarist.Locals;
 Elementarist:RegisterModule("elemental");

 Elementarist.elemental = {
+	["Configuration"] = {
+		["Behvaior"] = {
+			["type"]	= "DropDown",
+			["label"]	=	L.CONFIG_BEHAVIOR,
+			["options"]	= {
+				["text"]	=	L.BEHAVIOR_KEEP_FS_UP,
+				["text"]	=	L.BEHAVIOR_FS_BEFORE_LVB
+			}
+		},
+		["EnableEQ"] = {
+			["type"]	=	"CheckBox",
+			["label"]	=	L.CONFIG_ENABLE_EQ_SPELL
+		}
+	};
 	Initialize = function(self)
 		Elementarist:LoadSpells({
 			["Glyph of Flame Shock"] = GetSpellInfo(55447),
diff --git a/modules/restoration.lua b/modules/restoration.lua
index de8521f..b8db8e9 100755
--- a/modules/restoration.lua
+++ b/modules/restoration.lua
@@ -88,12 +88,15 @@ Elementarist.restoration = {
 			if (not Elementarist.auraCooldowns["0"]) then
 				Elementarist.auraCooldowns["0"] = {}
 			end;
-			if (not Elementarist.auraCooldowns["0"]) or (not Elementarist.auraCooldowns["0"].charges) or (Elementarist.auraCooldowns["0"].charges == 0) or (Elementarist.auraCooldowns["0"].charges ~= count) then
+			if (not Elementarist.auraCooldowns["0"]) or (not Elementarist.auraCooldowns["0"].charges) or (Elementarist.auraCooldowns["0"].charges ~= count) then
 				Elementarist:SetTexture(Elementarist.textureList["debuff"],select(3, GetSpellInfo(Elementarist.SpellList["Earth Shield"])));
-				Elementarist.textureList["debuff"]:Show();
-				Elementarist.textList['debuff']:SetText( count );
-			else
-				Elementarist.textList['debuff']:SetText("");
+				if ( Elementarist.auraCooldowns["0"].charges == 0 ) then
+					Elementarist.textureList["debuff"]:SetTexture(Elementarist.textureList["debuff"],"");
+					Elementarist.textList['debuff']:SetText("");
+				else
+					Elementarist.textureList["debuff"]:Show();
+					Elementarist.textList['debuff']:SetText( Elementarist.auraCooldowns["0"].charges );
+				end
 			end;
 			Elementarist.auraCooldowns["0"].charges = count;
 			Elementarist.auraCooldowns["0"].seen = GetTime();