Quantcast

Hide chat in combat option.

Darthpred [04-10-15 - 19:25]
Hide chat in combat option.
For #99
Filename
ElvUI_SLE/defaults/profile.lua
ElvUI_SLE/modules/chat.lua
ElvUI_SLE/options/chat_c.lua
diff --git a/ElvUI_SLE/defaults/profile.lua b/ElvUI_SLE/defaults/profile.lua
index 6d5880a..f13d985 100644
--- a/ElvUI_SLE/defaults/profile.lua
+++ b/ElvUI_SLE/defaults/profile.lua
@@ -121,6 +121,7 @@ P['sle'] = {
 			['enable'] = false,
 			['alpha'] = 0.5,
 		},
+		['combathide'] = false,
 	},

 	--Combat Icon
diff --git a/ElvUI_SLE/modules/chat.lua b/ElvUI_SLE/modules/chat.lua
index b60cce6..039acf0 100644
--- a/ElvUI_SLE/modules/chat.lua
+++ b/ElvUI_SLE/modules/chat.lua
@@ -447,6 +447,21 @@ function CH:SpamFilter()
 	end
 end

+function CH:Combat(event)
+	if not E.db.sle.chat.combathide then return end
+	if event == "PLAYER_REGEN_DISABLED" then
+		RightChatPanel:Hide()
+		RightChatToggleButton:Hide()
+		LeftChatPanel:Hide()
+		LeftChatToggleButton:Hide()
+	elseif event == "PLAYER_REGEN_ENABLED" then
+		RightChatPanel:Show()
+		RightChatToggleButton:Show()
+		LeftChatPanel:Show()
+		LeftChatToggleButton:Show()
+	end
+end
+
 --Previously layout.lua
 local LO = E:GetModule('Layout');
 local PANEL_HEIGHT = 22;
@@ -570,4 +585,7 @@ hooksecurefunc(CH, "Initialize", function(self)
 			return old(self, link, ...)
 		end
 	end
+
+	self:RegisterEvent("PLAYER_REGEN_ENABLED", "Combat")
+	self:RegisterEvent("PLAYER_REGEN_DISABLED", "Combat")
 end)
\ No newline at end of file
diff --git a/ElvUI_SLE/options/chat_c.lua b/ElvUI_SLE/options/chat_c.lua
index bd0020b..066a434 100644
--- a/ElvUI_SLE/options/chat_c.lua
+++ b/ElvUI_SLE/options/chat_c.lua
@@ -58,8 +58,15 @@ local function configTable()
 				get = function(info) return E.db.sle.chat.dpsSpam end,
 				set = function(info, value)	E.db.sle.chat.dpsSpam = value; CH:SpamFilter() end,
 			},
-			textureAlpha = {
+			combathide = {
 				order = 8,
+				type = "toggle",
+				name = L["Hide In Combat"],
+				get = function(info) return E.db.sle.chat.combathide end,
+				set = function(info, value)	E.db.sle.chat.combathide = value; end,
+			},
+			textureAlpha = {
+				order = 10,
 				type = "group",
 				name = L["Texture Alpha"],
 				guiInline = true,