Quantcast

Show Raid Marker module only in instance option.

Repooc [10-22-12 - 19:38]
Show Raid Marker module only in instance option.

Signed-off-by: Repooc <repooc@tukui.org>
Filename
ElvUI_SLE/config/profile.lua
ElvUI_SLE/modules/marks/marks.lua
ElvUI_SLE/modules/marks/options.lua
diff --git a/ElvUI_SLE/config/profile.lua b/ElvUI_SLE/config/profile.lua
index f5b5a93..0bc6f59 100644
--- a/ElvUI_SLE/config/profile.lua
+++ b/ElvUI_SLE/config/profile.lua
@@ -49,6 +49,7 @@ P['sle'] = {
 	['marks'] = {
 		['enabled'] = true,
 		['growth'] = "RIGHT",
+		['showinside'] = false,
 		['size'] = 18,
 	},

diff --git a/ElvUI_SLE/modules/marks/marks.lua b/ElvUI_SLE/modules/marks/marks.lua
index 336a27c..fc67c9d 100644
--- a/ElvUI_SLE/modules/marks/marks.lua
+++ b/ElvUI_SLE/modules/marks/marks.lua
@@ -185,8 +185,16 @@ end

 --Visibility/enable check
 function RM:UpdateVisibility()
+	local inInstance, instanceType = IsInInstance()
+
 	if E.db.sle.marks.enabled then
-		mark_menu:Show()
+		if inInstance and E.db.sle.marks.showinside then
+			mark_menu:Show()
+		elseif not inInstance and E.db.sle.marks.showinside then
+			mark_menu:Hide()
+		elseif not E.db.sle.marks.showinside then
+			mark_menu:Show()
+		end
 	else
 		mark_menu:Hide()
 	end
@@ -198,7 +206,8 @@ function RM:Initialize()
 	RM:FrameButtonsGrowth()
 	RM:SetButtonAttributes()
 	RM:UpdateVisibility()
-
+	self:RegisterEvent("PLAYER_ENTERING_WORLD", "UpdateVisibility");
+
 	E:CreateMover(mark_menu, "MarkMover", "RM", nil, nil, nil, "ALL,S&L")
 end

diff --git a/ElvUI_SLE/modules/marks/options.lua b/ElvUI_SLE/modules/marks/options.lua
index 46430d5..6aa0cab 100644
--- a/ElvUI_SLE/modules/marks/options.lua
+++ b/ElvUI_SLE/modules/marks/options.lua
@@ -20,8 +20,16 @@ E.Options.args.sle.args.marks = {
 			get = function(info) return E.db.sle.marks.enabled end,
 			set = function(info, value) E.db.sle.marks.enabled = value; RM:UpdateVisibility() end
 		},
-		size = {
+		showinside = {
 			order = 3,
+			type = "toggle",
+			name = "Show in an instance only.",
+			desc = "Selecting this option will have the Raid Markers appear only while in a raid or dungeon.",
+			get = function(info) return E.db.sle.marks.showinside end,
+			set = function(info, value) E.db.sle.marks.showinside = value; RM:UpdateVisibility() end
+		},
+		size = {
+			order = 4,
 			type = "range",
 			name = L['Size'],
 			desc = L["Sets size of buttons"],
@@ -30,7 +38,7 @@ E.Options.args.sle.args.marks = {
 			set = function(info, value) E.db.sle.marks.size = value; RM:FrameButtonsGrowth(); RM:FrameButtonsSize() end,
 		},
 		growth = {
-			order = 4,
+			order = 5,
 			type = "select",
 			name = L["Direction"],
 			desc = L["Change the direction of buttons growth from the skull marker"],