From ea54927ad1d36271c5668c8dd9a4bcd701e85979 Mon Sep 17 00:00:00 2001 From: Darthpred Date: Fri, 10 Apr 2015 23:25:25 +0400 Subject: [PATCH] Hide chat in combat option. For #99 --- ElvUI_SLE/defaults/profile.lua | 1 + ElvUI_SLE/modules/chat.lua | 18 ++++++++++++++++++ ElvUI_SLE/options/chat_c.lua | 9 ++++++++- 3 files changed, 27 insertions(+), 1 deletion(-) 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, -- 1.7.9.5