From 07dd1edc916fa8bed9cb759f9354321b6842266e Mon Sep 17 00:00:00 2001 From: Darthpred Date: Wed, 1 Apr 2015 19:41:47 +0400 Subject: [PATCH] A new option for chat textures --- ElvUI_SLE/defaults/profile.lua | 4 ++++ ElvUI_SLE/locales/russian.lua | 2 ++ ElvUI_SLE/modules/chat.lua | 14 +++++++++++++- ElvUI_SLE/options/chat_c.lua | 25 +++++++++++++++++++++++++ 4 files changed, 44 insertions(+), 1 deletion(-) diff --git a/ElvUI_SLE/defaults/profile.lua b/ElvUI_SLE/defaults/profile.lua index c415c54..6d5880a 100644 --- a/ElvUI_SLE/defaults/profile.lua +++ b/ElvUI_SLE/defaults/profile.lua @@ -117,6 +117,10 @@ P['sle'] = { ['chat'] = { ['guildmaster'] = false, ['dpsSpam'] = false, + ['textureAlpha'] = { + ['enable'] = false, + ['alpha'] = 0.5, + }, }, --Combat Icon diff --git a/ElvUI_SLE/locales/russian.lua b/ElvUI_SLE/locales/russian.lua index 8cb8e34..2bf72c4 100644 --- a/ElvUI_SLE/locales/russian.lua +++ b/ElvUI_SLE/locales/russian.lua @@ -56,6 +56,8 @@ L["Displays an icon near your Guild Master in chat.\n\n|cffFF0000Note:|r Some me L["Filter DPS meters' Spam"] = "Фильтровать отчеты о УВС" L["Replaces long reports from damage meters with a clickeble hyperlink to reduce chat spam.\nWorks correctly only with general reports such as DPS or HPS. May fail to filter te report of other things"] = "Заменяет длиные отчеты от аддонов для измерения УВС на гиперссылку, сокращая уровень спама в чате.\nКорректно работает с отчетами урона и исцеления. Может не отфильтровать другие специфические отчеты." L["Reported by %s"] = "Отчет от %s" +L["Texture Alpha"] = "Прозрачность текстур" +L["Allows separate alpha setting for textures in chat"] = "Включает отдельную настройку прозрачности для текстур в чате" --Raid utility-- L['Raid Utility'] = "Управление рейдом" diff --git a/ElvUI_SLE/modules/chat.lua b/ElvUI_SLE/modules/chat.lua index d4fd0c1..07c97ca 100644 --- a/ElvUI_SLE/modules/chat.lua +++ b/ElvUI_SLE/modules/chat.lua @@ -532,9 +532,21 @@ local function CreateChatPanels() RightChatTab:Point('BOTTOMLEFT', RightChatPanel, 'TOPLEFT', 2, -PANEL_HEIGHT) end +local function ChatTextures() + if not E.db['general'] or not E.private['general'] then return end --Prevent rare nil value errors + if not E.db.sle.chat.textureAlpha.enable then return end --our option enable check + + if LeftChatPanel and LeftChatPanel.tex and RightChatPanel and RightChatPanel.tex then + local a = E.db.sle.chat.textureAlpha.alpha or 0.5 + LeftChatPanel.tex:SetAlpha(a) + RightChatPanel.tex:SetAlpha(a) + end +end + hooksecurefunc(LO, "ToggleChatPanels", ChatPanels) hooksecurefunc(LO, "CreateChatPanels", CreateChatPanels) hooksecurefunc(CH, "StyleChat", Style) + hooksecurefunc(CH, "Initialize", function(self) if not E.private.chat.enable then return end if E.db.sle.chat.guildmaster then @@ -547,7 +559,7 @@ hooksecurefunc(CH, "Initialize", function(self) CH:SpamFilter() self:SecureHook("SetItemRef","ParseLink") - + hooksecurefunc(E, "UpdateMedia", ChatTextures) -- Borrowed from Deadly Boss Mods do local old = ItemRefTooltip.SetHyperlink -- we have to hook this function since the default ChatFrame code assumes that all links except for player and channel links are valid arguments for this function diff --git a/ElvUI_SLE/options/chat_c.lua b/ElvUI_SLE/options/chat_c.lua index d323de3..45000d8 100644 --- a/ElvUI_SLE/options/chat_c.lua +++ b/ElvUI_SLE/options/chat_c.lua @@ -58,6 +58,31 @@ 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 = { + order = 8, + type = "group", + name = L["Texture Alpha"], + guiInline = true, + args = { + enable = { + order = 1, + type = "toggle", + name = L["Enable"], + desc = L["Allows separate alpha setting for textures in chat"], + get = function(info) return E.db.sle.chat.textureAlpha.enable end, + set = function(info, value) E.db.sle.chat.textureAlpha.enable = value; E:UpdateMedia() end, + }, + alpha = { + order = 2, + type = "range", + name = L["Alpha"], + isPercent = true, + min = 0, max = 1, step = 0.01, + get = function(info) return E.db.sle.chat.textureAlpha.alpha end, + set = function(info, value) E.db.sle.chat.textureAlpha.alpha = value; E:UpdateMedia() end, + }, + }, + }, }, } end -- 1.7.9.5