Quantcast

UF options additions and reorganizing

Darth Predator [09-29-17 - 18:25]
UF options additions and reorganizing
Filename
ElvUI_SLE/defaults/profile.lua
ElvUI_SLE/modules/unitframes/unitframes.lua
ElvUI_SLE/options/unitframes_c.lua
diff --git a/ElvUI_SLE/defaults/profile.lua b/ElvUI_SLE/defaults/profile.lua
index a653db8..39b0b95 100644
--- a/ElvUI_SLE/defaults/profile.lua
+++ b/ElvUI_SLE/defaults/profile.lua
@@ -789,6 +789,18 @@ P["sle"] = {
 				["higherPortrait"] = false,
 				["portraitAlpha"] = 0.35,
 			},
+			["pet"] = {
+				["higherPortrait"] = false,
+				["portraitAlpha"] = 0.35,
+				["auras"] = {
+					["buffs"] = {
+						["threshold"] = 4,
+					},
+					["debuffs"] = {
+						["threshold"] = 4,
+					},
+				},
+			},
 			["target"] = {
 				["higherPortrait"] = false,
 				["portraitAlpha"] = 0.35,
diff --git a/ElvUI_SLE/modules/unitframes/unitframes.lua b/ElvUI_SLE/modules/unitframes/unitframes.lua
index 144d11f..f13bb04 100644
--- a/ElvUI_SLE/modules/unitframes/unitframes.lua
+++ b/ElvUI_SLE/modules/unitframes/unitframes.lua
@@ -86,7 +86,7 @@ end
 function SUF:ConfiguePortrait(frame, dontHide)
 	local db = E.db.sle.unitframes.unit
 	local portrait = frame.Portrait
-	if portrait.SLEHooked then return end
+	if portrait.SLEHooked or not db[frame.unitframeType] then return end
 	hooksecurefunc(portrait, "PostUpdate", SUF.PortraitUpdate)
 	portrait.SLEHooked = true
 end
diff --git a/ElvUI_SLE/options/unitframes_c.lua b/ElvUI_SLE/options/unitframes_c.lua
index faad56c..d6c6484 100644
--- a/ElvUI_SLE/options/unitframes_c.lua
+++ b/ElvUI_SLE/options/unitframes_c.lua
@@ -23,7 +23,6 @@ local function configTable()
 		local config = {
 			order = 5,
 			type = "group",
-			guiInline = true,
 			name = L["Offline Indicator"],
 			get = function(info) return E.db.sle.unitframes.unit[group].offline[ info[#info] ] end,
 			set = function(info, value) E.db.sle.unitframes.unit[group].offline[ info[#info] ] = value; UF:CreateAndUpdateHeaderGroup(group) end,
@@ -57,12 +56,36 @@ local function configTable()
 		return config
 	end

+	local function CreatePortraitConfig(unitID)
+		local config = {
+			order = 1,
+			type = 'group',
+			name = L["Portrait"],
+			get = function(info) return E.db.sle.unitframes.unit[unitID][ info[#info] ] end,
+			set = function(info, value) E.db.sle.unitframes.unit[unitID][ info[#info] ] = value; UF:CreateAndUpdateUF('player'); end,
+			args = {
+				higherPortrait = {
+					order = 1, type = "toggle",
+					name = L["Higher Overlay Portrait"],
+					desc = L["Makes frame portrait visible regardless of health level when overlay portrait is set."],
+				},
+				portraitAlpha = {
+					order = 2, type = 'range',
+					name = L["Overlay Portrait Alpha"],
+					isPercent = true,
+					 min = 0, max = 1, step = 0.01,
+				},
+			},
+		}
+
+		return config
+	end
+
 	local function CreateAurasConfig(unitID)
 		local config = {
 			order = 6,
 			name = L["Auras"],
 			type = "group",
-			guiInline = true,
 			args = {
 				buffs = {
 					order = 1,
@@ -142,26 +165,12 @@ local function configTable()
 				type = "group",
 				name = L["Player Frame"],
 				args = {
-					higherPortrait = {
-						order = 1, type = "toggle",
-						name = L["Higher Overlay Portrait"],
-						desc = L["Makes frame portrait visible regardless of health level when overlay portrait is set."],
-						get = function(info) return E.db.sle.unitframes.unit.player[ info[#info] ] end,
-						set = function(info, value) E.db.sle.unitframes.unit.player[ info[#info] ] = value; UF:CreateAndUpdateUF('player'); end,
-					},
-					portraitAlpha = {
-						order = 2, type = 'range',
-						name = L["Overlay Portrait Alpha"],
-						isPercent = true,
-						 min = 0, max = 1, step = 0.01,
-						get = function(info) return E.db.sle.unitframes.unit.player[ info[#info] ] end,
-						set = function(info, value) E.db.sle.unitframes.unit.player[ info[#info] ] = value; UF:CreateAndUpdateUF('player'); end,
-					},
+					portrait = CreatePortraitConfig("player"),
 					combaticon = {
 						order = 3,
 						type = "group",
 						name = L["Combat Icon"],
-						guiInline = true,
+						-- guiInline = true,
 						get = function(info) return E.db.sle.unitframes.unit.player.combatico[ info[#info] ] end,
 						set = function(info, value) E.db.sle.unitframes.unit.player.combatico[ info[#info] ] = value; ElvUF_Player.CombatIndicator:PostUpdate(); SUF:TestCombat() end,
 						args = {
@@ -189,7 +198,6 @@ local function configTable()
 						order = 4,
 						type = "group",
 						name = L["Rest Icon"],
-						guiInline = true,
 						get = function(info) return E.db.sle.unitframes.unit.player.rested[ info[#info] ] end,
 						set = function(info, value) E.db.sle.unitframes.unit.player.rested[ info[#info] ] = value; UF:Configure_RestingIndicator(_G["ElvUF_Player"]) end,
 						args = {
@@ -219,7 +227,6 @@ local function configTable()
 						order = 5,
 						type = "group",
 						name = L["PvP & Prestige Icon"],
-						guiInline = true,
 						get = function(info) return E.db.sle.unitframes.unit.player.pvpIconText[ info[#info] ] end,
 						set = function(info, value) E.db.sle.unitframes.unit.player.pvpIconText[ info[#info] ] = value; UF:Configure_PVPIcon(_G["ElvUF_Player"]) end,
 						args = {
@@ -232,49 +239,31 @@ local function configTable()
 					auras = CreateAurasConfig("player"),
 				},
 			},
-			target = {
+			pet = {
 				order = 11,
 				type = "group",
+				name = L["Pet Frame"],
+				args = {
+					portrait = CreatePortraitConfig("pet"),
+					auras = CreateAurasConfig("pet"),
+				},
+			},
+			target = {
+				order = 12,
+				type = "group",
 				name = L["Target Frame"],
 				args = {
-					higherPortrait = {
-						order = 1, type = "toggle",
-						name = L["Higher Overlay Portrait"],
-						desc = L["Makes frame portrait visible regardless of health level when overlay portrait is set."],
-						get = function(info) return E.db.sle.unitframes.unit.target[ info[#info] ] end,
-						set = function(info, value) E.db.sle.unitframes.unit.target[ info[#info] ] = value; UF:CreateAndUpdateUF('target'); end,
-					},
-					portraitAlpha = {
-						order = 2, type = 'range',
-						name = L["Overlay Portrait Alpha"],
-						isPercent = true,
-						 min = 0, max = 1, step = 0.01,
-						get = function(info) return E.db.sle.unitframes.unit.target[ info[#info] ] end,
-						set = function(info, value) E.db.sle.unitframes.unit.target[ info[#info] ] = value; UF:CreateAndUpdateUF('target'); end,
-					},
+					portrait = CreatePortraitConfig("target"),
 					auras = CreateAurasConfig("target"),
 				},
 			},
 			focus = {
-				order = 12,
+				order = 13,
 				type = "group",
 				name = L["Focus Frame"],
 				args = {
-					higherPortrait = {
-						order = 1, type = "toggle",
-						name = L["Higher Overlay Portrait"],
-						desc = L["Makes frame portrait visible regardless of health level when overlay portrait is set."],
-						get = function(info) return E.db.sle.unitframes.unit.focus[ info[#info] ] end,
-						set = function(info, value) E.db.sle.unitframes.unit.focus[ info[#info] ] = value; UF:CreateAndUpdateUF('focus'); end,
-					},
-					portraitAlpha = {
-						order = 2, type = 'range',
-						name = L["Overlay Portrait Alpha"],
-						isPercent = true,
-						 min = 0, max = 1, step = 0.01,
-						get = function(info) return E.db.sle.unitframes.unit.focus[ info[#info] ] end,
-						set = function(info, value) E.db.sle.unitframes.unit.focus[ info[#info] ] = value; UF:CreateAndUpdateUF('focus'); end,
-					},
+					portrait = CreatePortraitConfig("focus"),
+					auras = CreateAurasConfig("focus"),
 				},
 			},
 			party = {
@@ -283,29 +272,16 @@ local function configTable()
 				name = L["Party Frames"],
 				args = {
 					configureToggle = {
-						order = 1,
+						order = -10,
 						type = 'execute',
 						name = L["Display Frames"],
 						func = function()
 							UF:HeaderConfig(ElvUF_Party, ElvUF_Party.forceShow ~= true or nil)
 						end,
 					},
-					higherPortrait = {
-						order = 2, type = "toggle",
-						name = L["Higher Overlay Portrait"],
-						desc = L["Makes frame portrait visible regardless of health level when overlay portrait is set."],
-						get = function(info) return E.db.sle.unitframes.unit.party[ info[#info] ] end,
-						set = function(info, value) E.db.sle.unitframes.unit.party[ info[#info] ] = value; UF:CreateAndUpdateHeaderGroup('party') end,
-					},
-					portraitAlpha = {
-						order = 3, type = 'range',
-						name = L["Overlay Portrait Alpha"],
-						isPercent = true,
-						 min = 0, max = 1, step = 0.01,
-						get = function(info) return E.db.sle.unitframes.unit.party[ info[#info] ] end,
-						set = function(info, value) E.db.sle.unitframes.unit.party[ info[#info] ] = value; UF:CreateAndUpdateHeaderGroup('party') end,
-					},
-					offline = CreateOfflineConfig("party")
+					portrait = CreatePortraitConfig("party"),
+					offline = CreateOfflineConfig("party"),
+					auras = CreateAurasConfig("party"),
 				},
 			},
 			raid = {
@@ -314,29 +290,16 @@ local function configTable()
 				name = L["Raid Frames"],
 				args = {
 					configureToggle = {
-						order = 1,
+						order = -10,
 						type = 'execute',
 						name = L["Display Frames"],
 						func = function()
 							UF:HeaderConfig(_G['ElvUF_Raid'], _G['ElvUF_Raid'].forceShow ~= true or nil)
 						end,
 					},
-					higherPortrait = {
-						order = 2, type = "toggle",
-						name = L["Higher Overlay Portrait"],
-						desc = L["Makes frame portrait visible regardless of health level when overlay portrait is set."],
-						get = function(info) return E.db.sle.unitframes.unit.raid[ info[#info] ] end,
-						set = function(info, value) E.db.sle.unitframes.unit.raid[ info[#info] ] = value; UF:CreateAndUpdateHeaderGroup('raid') end,
-					},
-					portraitAlpha = {
-						order = 3, type = 'range',
-						name = L["Overlay Portrait Alpha"],
-						isPercent = true,
-						 min = 0, max = 1, step = 0.01,
-						get = function(info) return E.db.sle.unitframes.unit.raid[ info[#info] ] end,
-						set = function(info, value) E.db.sle.unitframes.unit.raid[ info[#info] ] = value; UF:CreateAndUpdateHeaderGroup('raid') end,
-					},
-					offline = CreateOfflineConfig("raid")
+					portrait = CreatePortraitConfig("raid"),
+					offline = CreateOfflineConfig("raid"),
+					auras = CreateAurasConfig("raid"),
 				},
 			},
 			raid40 = {
@@ -345,29 +308,16 @@ local function configTable()
 				name = L["Raid-40 Frames"],
 				args = {
 					configureToggle = {
-						order = 1,
+						order = -10,
 						type = 'execute',
 						name = L["Display Frames"],
 						func = function()
 							UF:HeaderConfig(_G['ElvUF_Raid40'], _G['ElvUF_Raid40'].forceShow ~= true or nil)
 						end,
 					},
-					higherPortrait = {
-						order = 2, type = "toggle",
-						name = L["Higher Overlay Portrait"],
-						desc = L["Makes frame portrait visible regardless of health level when overlay portrait is set."],
-						get = function(info) return E.db.sle.unitframes.unit.raid40[ info[#info] ] end,
-						set = function(info, value) E.db.sle.unitframes.unit.raid40[ info[#info] ] = value; UF:CreateAndUpdateHeaderGroup('raid40') end,
-					},
-					portraitAlpha = {
-						order = 3, type = 'range',
-						name = L["Overlay Portrait Alpha"],
-						isPercent = true,
-						 min = 0, max = 1, step = 0.01,
-						get = function(info) return E.db.sle.unitframes.unit.raid40[ info[#info] ] end,
-						set = function(info, value) E.db.sle.unitframes.unit.raid40[ info[#info] ] = value; UF:CreateAndUpdateHeaderGroup('raid40') end,
-					},
-					offline = CreateOfflineConfig("raid40")
+					portrait = CreatePortraitConfig("raid40"),
+					offline = CreateOfflineConfig("raid40"),
+					auras = CreateAurasConfig("raid40"),
 				},
 			},
 			boss = {
@@ -375,21 +325,8 @@ local function configTable()
 				type = "group",
 				name = L["Boss Frames"],
 				args = {
-					higherPortrait = {
-						order = 1, type = "toggle",
-						name = L["Higher Overlay Portrait"],
-						desc = L["Makes frame portrait visible regardless of health level when overlay portrait is set."],
-						get = function(info) return E.db.sle.unitframes.unit.boss[ info[#info] ] end,
-						set = function(info, value) E.db.sle.unitframes.unit.boss[ info[#info] ] = value; UF:CreateAndUpdateHeaderGroup('boss') end,
-					},
-					portraitAlpha = {
-						order = 2, type = 'range',
-						name = L["Overlay Portrait Alpha"],
-						isPercent = true,
-						 min = 0, max = 1, step = 0.01,
-						get = function(info) return E.db.sle.unitframes.unit.boss[ info[#info] ] end,
-						set = function(info, value) E.db.sle.unitframes.unit.boss[ info[#info] ] = value; UF:CreateAndUpdateHeaderGroup('boss') end,
-					},
+					portrait = CreatePortraitConfig("boss"),
+					auras = CreateAurasConfig("boss"),
 				},
 			},
 			arena = {
@@ -397,21 +334,8 @@ local function configTable()
 				type = "group",
 				name = L["Arena Frames"],
 				args = {
-					higherPortrait = {
-						order = 1, type = "toggle",
-						name = L["Higher Overlay Portrait"],
-						desc = L["Makes frame portrait visible regardless of health level when overlay portrait is set."],
-						get = function(info) return E.db.sle.unitframes.unit.arena[ info[#info] ] end,
-						set = function(info, value) E.db.sle.unitframes.unit.arena[ info[#info] ] = value; UF:CreateAndUpdateHeaderGroup('arena') end,
-					},
-					portraitAlpha = {
-						order = 2, type = 'range',
-						name = L["Overlay Portrait Alpha"],
-						isPercent = true,
-						 min = 0, max = 1, step = 0.01,
-						get = function(info) return E.db.sle.unitframes.unit.arena[ info[#info] ] end,
-						set = function(info, value) E.db.sle.unitframes.unit.arena[ info[#info] ] = value; UF:CreateAndUpdateHeaderGroup('arena') end,
-					},
+					portrait = CreatePortraitConfig("arena"),
+					auras = CreateAurasConfig("arena"),
 				},
 			},
 			statusbars = {