Quantcast

Making sure stuff is loaded only when corresponding ElvUI module is enabled

Darthpred [07-21-16 - 04:31]
Making sure stuff is loaded only when corresponding ElvUI module is enabled
Filename
ElvUI_SLE/modules/actionbars.lua
ElvUI_SLE/modules/auras.lua
ElvUI_SLE/modules/baginfo.lua
ElvUI_SLE/modules/bags.lua
ElvUI_SLE/modules/chat/chat.lua
ElvUI_SLE/modules/load_modules.xml
ElvUI_SLE/modules/minimap/instance.lua
ElvUI_SLE/modules/minimap/minimapcoords.lua
ElvUI_SLE/modules/minimap/minimapicons.lua
ElvUI_SLE/modules/misc.lua
ElvUI_SLE/modules/nameplates.lua
ElvUI_SLE/modules/tooltips/tooltip.lua
ElvUI_SLE/modules/unitframes/unitframes.lua
ElvUI_SLE/modules/vehicle.lua
ElvUI_SLE/options/chat/chat_c.lua
ElvUI_SLE/options/minimap/coords_c.lua
ElvUI_SLE/options/minimap/instance_c.lua
ElvUI_SLE/options/nameplates_c.lua
ElvUI_SLE/options/tooltip_c.lua
diff --git a/ElvUI_SLE/modules/actionbars.lua b/ElvUI_SLE/modules/actionbars.lua
index c2e4d2c..16f5d2e 100644
--- a/ElvUI_SLE/modules/actionbars.lua
+++ b/ElvUI_SLE/modules/actionbars.lua
@@ -54,8 +54,7 @@ function A:ButtonsBackdrop()
 end

 function A:Initialize()
-	if not SLE.initialized then return end
-	if E.private.actionbar.enable ~= true then return; end
+	if not SLE.initialized or E.private.actionbar.enable ~= true then return; end
 	A.MaxBars = T.IsAddOnLoaded('ElvUI_ExtraActionBars') and 10 or 6

 	if E.private.sle.actionbars.oorBind then
diff --git a/ElvUI_SLE/modules/auras.lua b/ElvUI_SLE/modules/auras.lua
index 8e36e95..f53c892 100644
--- a/ElvUI_SLE/modules/auras.lua
+++ b/ElvUI_SLE/modules/auras.lua
@@ -38,8 +38,7 @@ function SA:UpdateAura(button, index)
 end

 function SA:Initialize()
-	if E.private.auras.enable ~= true then return end
-	if not SLE.initialized then return end
+	if not SLE.initialized or E.private.auras.enable ~= true then return end
 	SA.db = E.db.sle.auras
 	hooksecurefunc(A, 'UpdateAura', SA.UpdateAura)

diff --git a/ElvUI_SLE/modules/baginfo.lua b/ElvUI_SLE/modules/baginfo.lua
index 903a3f9..c422f22 100644
--- a/ElvUI_SLE/modules/baginfo.lua
+++ b/ElvUI_SLE/modules/baginfo.lua
@@ -126,8 +126,7 @@ function BI:ToggleSettings()
 end

 function BI:Initialize()
-	if not SLE.initialized then return end
-	if not E.private.bags.enable then return end
+	if not SLE.initialized or not E.private.bags.enable then return end

 	T.tinsert(BI.containers, _G["ElvUI_ContainerFrame"])
 	self:SecureHook(B, "OpenBank", function()
diff --git a/ElvUI_SLE/modules/bags.lua b/ElvUI_SLE/modules/bags.lua
index c742694..5e6d7e2 100755
--- a/ElvUI_SLE/modules/bags.lua
+++ b/ElvUI_SLE/modules/bags.lua
@@ -161,8 +161,7 @@ end

 function SB:Initialize()
 	self.hookedBags = {};
-	if not SLE.initialized then return end
-	if not E.private.bags.enable then return end
+	if not SLE.initialized or not E.private.bags.enable then return end

 	function SB:ForUpdateAll()
 		SB.db = E.db.sle.bags
diff --git a/ElvUI_SLE/modules/chat/chat.lua b/ElvUI_SLE/modules/chat/chat.lua
index 4a42318..e2d01f8 100644
--- a/ElvUI_SLE/modules/chat/chat.lua
+++ b/ElvUI_SLE/modules/chat/chat.lua
@@ -243,8 +243,7 @@ end
 hooksecurefunc(CH, "Initialize", C.UpdateChatMax)

 function C:Initialize()
-	if not SLE.initialized then return end
-	if not E.private.chat.enable then return end
+	if not SLE.initialized or not E.private.chat.enable then return end
 	C.db = E.db.sle.chat

 	function C:ForUpdateAll()
diff --git a/ElvUI_SLE/modules/load_modules.xml b/ElvUI_SLE/modules/load_modules.xml
index 9a14b50..f4af73d 100644
--- a/ElvUI_SLE/modules/load_modules.xml
+++ b/ElvUI_SLE/modules/load_modules.xml
@@ -24,10 +24,8 @@
 	<Include file='quests\load_quests.xml'/>
 	<Script file='raidmarkers.lua'/>
 	<Script file='raidroleicons.lua'/>
-	<Script file='raidutility.lua'/>
 	<Include file='sledatatexts\load_datatexts.xml'/>
 	<Include file='tooltips\load_tooltips.xml'/>
-	<Script file='threat.lua'/>
 	<Script file='uibuttons.lua'/>
 	<Include file='unitframes\load_unitframes.xml'/>
 	<Script file='vehicle.lua'/>
diff --git a/ElvUI_SLE/modules/minimap/instance.lua b/ElvUI_SLE/modules/minimap/instance.lua
index 3d8c6ee..062d5f9 100644
--- a/ElvUI_SLE/modules/minimap/instance.lua
+++ b/ElvUI_SLE/modules/minimap/instance.lua
@@ -120,7 +120,7 @@ function I:GenerateText(event, guild, force)
 end

 function I:Initialize()
-	if not SLE.initialized then return end
+	if not SLE.initialized or not E.private.general.minimap.enable then return end
 	I.db = E.db.sle.minimap.instance
 	self:CreateText()
 	MiniMapInstanceDifficulty:HookScript("OnShow", function(self) if not I.db.flag then self:Hide() end end)
diff --git a/ElvUI_SLE/modules/minimap/minimapcoords.lua b/ElvUI_SLE/modules/minimap/minimapcoords.lua
index 98af2f8..d2330b6 100644
--- a/ElvUI_SLE/modules/minimap/minimapcoords.lua
+++ b/ElvUI_SLE/modules/minimap/minimapcoords.lua
@@ -112,7 +112,7 @@ function MM:UpdateSettings()
 end

 function MM:Initialize()
-	if not SLE.initialized then return end
+	if not SLE.initialized or not E.private.general.minimap.enable then return end

 	hooksecurefunc(M, 'UpdateSettings', MM.UpdateSettings)

diff --git a/ElvUI_SLE/modules/minimap/minimapicons.lua b/ElvUI_SLE/modules/minimap/minimapicons.lua
index 72c5728..f706fea 100644
--- a/ElvUI_SLE/modules/minimap/minimapicons.lua
+++ b/ElvUI_SLE/modules/minimap/minimapicons.lua
@@ -319,8 +319,7 @@ function SMB:Update()
 end

 function SMB:Initialize()
-	if not SLE.initialized then return end
-	if not E.private.sle.minimap.mapicons.enable then return end
+	if not SLE.initialized or not E.private.general.minimap.enable then return end

 	QueueStatusMinimapButton:SetParent(Minimap)

diff --git a/ElvUI_SLE/modules/misc.lua b/ElvUI_SLE/modules/misc.lua
index a357cb8..3b19992 100644
--- a/ElvUI_SLE/modules/misc.lua
+++ b/ElvUI_SLE/modules/misc.lua
@@ -23,23 +23,24 @@ end
 function M:UpdateThreatConfig()
 	if IsAddOnLoaded("ElvUI_Config") then
 		if M.db.threat.enable then
-			E.Options.args.general.args.threat.args.position = {
-				order = 2,
+			E.Options.args.general.args.general.args.threatPosition = {
+				order = 42,
 				name = L["Position"],
 				desc = L["This option have been disabled by Shadow & Light. To return it you need to disable S&L's option. Click here to see it's location."],
 				type = "execute",
 				func = function() SLE.ACD:SelectGroup("ElvUI", "sle") end,
 			}
 		else
-			E.Options.args.general.args.threat.args.position = {
-				order = 2,
+			E.Options.args.general.args.general.args.threatPosition = {
+				order = 42,
 				type = 'select',
 				name = L["Position"],
 				desc = L["Adjust the position of the threat bar to either the left or right datatext panels."],
 				values = {
-					["LEFTCHAT"] = L["Left Chat"],
-					["RIGHTCHAT"] = L["Right Chat"],
+					['LEFTCHAT'] = L["Left Chat"],
+					['RIGHTCHAT'] = L["Right Chat"],
 				},
+				get = function(info) return E.db.general.threat.position end,
 				set = function(info, value) E.db.general.threat[ info[#info] ] = value; T:UpdatePosition() end,
 			}
 		end
@@ -57,7 +58,6 @@ function M:SetViewport()
 	local scale = 768 / UIParent:GetHeight()
 	WorldFrame:SetPoint("TOPLEFT", ( M.db.viewport.left * scale ), -( M.db.viewport.top * scale ) )
 	WorldFrame:SetPoint("BOTTOMRIGHT", -( M.db.viewport.right * scale ), ( M.db.viewport.bottom * scale ) )
-	-- SLE:GetModule("Nameplates"):RegisterViewport()
 end

 function M:Initialize()
diff --git a/ElvUI_SLE/modules/nameplates.lua b/ElvUI_SLE/modules/nameplates.lua
index daddf91..f1196f3 100644
--- a/ElvUI_SLE/modules/nameplates.lua
+++ b/ElvUI_SLE/modules/nameplates.lua
@@ -115,8 +115,7 @@ function N:StartRosterUpdate()
 end

 function N:Initialize()
-	if not SLE.initialized then return end
-	if not E.private.nameplates.enable then return end
+	if not SLE.initialized or not E.private.nameplates.enable then return end
 	N.db = E.db.sle.nameplate
 	N.viewPort = NP.viewPort
 	self:RegisterEvent("GROUP_ROSTER_UPDATE", "StartRosterUpdate")
diff --git a/ElvUI_SLE/modules/tooltips/tooltip.lua b/ElvUI_SLE/modules/tooltips/tooltip.lua
index f43053e..9f60253 100644
--- a/ElvUI_SLE/modules/tooltips/tooltip.lua
+++ b/ElvUI_SLE/modules/tooltips/tooltip.lua
@@ -9,7 +9,7 @@ local _G = _G
 --GLOBALS: UIParent, hooksecurefunc

 local function AnchorFrameToMouse()
-	if not SLE.initialized then return end
+	if not SLE.initialized or not E.private.tooltip.enable then return end
 	if not E.db.tooltip.cursorAnchor or (E.db.sle.tooltip.xOffset == 0 and E.db.sle.tooltip.yOffset == 0) then return end

 	local frame = GameTooltip
diff --git a/ElvUI_SLE/modules/unitframes/unitframes.lua b/ElvUI_SLE/modules/unitframes/unitframes.lua
index 48e939e..ce8524f 100644
--- a/ElvUI_SLE/modules/unitframes/unitframes.lua
+++ b/ElvUI_SLE/modules/unitframes/unitframes.lua
@@ -121,7 +121,7 @@ function SUF:HealthPredictUpdate(frame)
 end

 function SUF:Initialize()
-if not SLE.initialized then return end
+	if not SLE.initialized or not E.private.unitframe.enable then return end
 	SUF:NewTags()
 	SUF:InitPlayer()

diff --git a/ElvUI_SLE/modules/vehicle.lua b/ElvUI_SLE/modules/vehicle.lua
index 51dc1c6..bd4622b 100644
--- a/ElvUI_SLE/modules/vehicle.lua
+++ b/ElvUI_SLE/modules/vehicle.lua
@@ -77,7 +77,7 @@ end

 function EVB:Initialize()
 	if not SLE.initialized then return end
-	if (not E.private.sle.vehicle.enable) then return end;
+	if not E.private.sle.vehicle.enable or not E.private.actionbar.enable then return end;

 	local visibility = "[petbattle] hide; [vehicleui][overridebar][shapeshift][possessbar] hide;"
 	local page = T.format("[vehicleui] %d; [possessbar] %d; [overridebar] %d; [shapeshift] 13;", GetVehicleBarIndex(), GetVehicleBarIndex(), GetOverrideBarIndex());
diff --git a/ElvUI_SLE/options/chat/chat_c.lua b/ElvUI_SLE/options/chat/chat_c.lua
index a31b87a..e422085 100644
--- a/ElvUI_SLE/options/chat/chat_c.lua
+++ b/ElvUI_SLE/options/chat/chat_c.lua
@@ -24,6 +24,7 @@ local function configTable()
 		type = "group",
 		name = L["Chat"],
 		childGroups = 'select',
+		disabled = function() return not E.private.chat.enable end,
 		args = {
 			header = { order = 1, type = "header", name = L["Chat"] },
 			editreset = {
diff --git a/ElvUI_SLE/options/minimap/coords_c.lua b/ElvUI_SLE/options/minimap/coords_c.lua
index 4736083..f240e7b 100644
--- a/ElvUI_SLE/options/minimap/coords_c.lua
+++ b/ElvUI_SLE/options/minimap/coords_c.lua
@@ -6,6 +6,7 @@ local function configTable()
 		type = "group",
 		name = L["Minimap Coordinates"],
 		order = 5,
+		disabled = function() return not E.private.general.minimap.enable end,
 		get = function(info) return E.db.sle.minimap.coords[ info[#info] ] end,
 		set = function(info, value) E.db.sle.minimap.coords[ info[#info] ] = value; MM:UpdateSettings() end,
 		args = {
diff --git a/ElvUI_SLE/options/minimap/instance_c.lua b/ElvUI_SLE/options/minimap/instance_c.lua
index f24d0bd..7be9bdc 100644
--- a/ElvUI_SLE/options/minimap/instance_c.lua
+++ b/ElvUI_SLE/options/minimap/instance_c.lua
@@ -8,6 +8,7 @@ local function configTable()
 		type = "group",
 		name = L["Instance indication"],
 		order = 7,
+		disabled = function() return not E.private.general.minimap.enable end,
 		get = function(info) return E.db.sle.minimap.instance[ info[#info] ] end,
 		set = function(info, value) E.db.sle.minimap.instance[ info[#info] ] = value; I:UpdateFrame() end,
 		args = {
diff --git a/ElvUI_SLE/options/nameplates_c.lua b/ElvUI_SLE/options/nameplates_c.lua
index 914ef24..0a8dbee 100644
--- a/ElvUI_SLE/options/nameplates_c.lua
+++ b/ElvUI_SLE/options/nameplates_c.lua
@@ -6,6 +6,7 @@ local function configTable()
 		type = "group",
 		name = L["NamePlates"],
 		order = 14,
+		disabled = function() return not E.private.nameplates.enable end,
 		get = function(info) return E.db.sle.nameplate[ info[#info] ] end,
 		set = function(info, value) E.db.sle.nameplate[ info[#info] ] = value; E:GetModule('NamePlates'):ConfigureAll() end,
 		args = {
diff --git a/ElvUI_SLE/options/tooltip_c.lua b/ElvUI_SLE/options/tooltip_c.lua
index d9f4ecd..9c60f88 100644
--- a/ElvUI_SLE/options/tooltip_c.lua
+++ b/ElvUI_SLE/options/tooltip_c.lua
@@ -6,6 +6,7 @@ local function configTable()
 	E.Options.args.sle.args.modules.args.tooltip = {
 		order = 20,
 		type = "group",
+		disabled = function() return not E.private.toltip.enable end,
 		get = function(info) return E.db.sle.tooltip[ info[#info] ] end,
 		name = L["Tooltip"],
 		args = {