From 506e26e839513a7eb0e5a36300e6e08084ba3930 Mon Sep 17 00:00:00 2001 From: Darthpred Date: Wed, 22 Apr 2015 17:10:38 +0400 Subject: [PATCH] Couple of options for durability --- ElvUI_SLE/defaults/profile.lua | 4 ++++ ElvUI_SLE/locales/russian.lua | 5 +++++ ElvUI_SLE/modules/sledatatexts/durability.lua | 21 ++++++++++++++---- ElvUI_SLE/options/datatexts_c.lua | 29 +++++++++++++++++++++++++ 4 files changed, 55 insertions(+), 4 deletions(-) diff --git a/ElvUI_SLE/defaults/profile.lua b/ElvUI_SLE/defaults/profile.lua index e1d3044..b8818d6 100644 --- a/ElvUI_SLE/defaults/profile.lua +++ b/ElvUI_SLE/defaults/profile.lua @@ -220,6 +220,10 @@ P['sle'] = { ['mail'] = { ['icon'] = true, }, + ['durability'] = { + ['gradient'] = true, + ['threshold'] = 50, + } }, --Exp/Rep Bar diff --git a/ElvUI_SLE/locales/russian.lua b/ElvUI_SLE/locales/russian.lua index 2218573..af4dce9 100644 --- a/ElvUI_SLE/locales/russian.lua +++ b/ElvUI_SLE/locales/russian.lua @@ -295,6 +295,11 @@ L['Show Zero Currency'] = "Показывать отсутствующую ва L['Show Icons'] = "Показывать иконки" L['Show Faction Totals'] = "Показывать сумму по фракциям" L['Show Unsed Currency'] = "Показывать неиспользуемую валюту" +L["Gradient"] = "Градиент" +L["If enabled will color durability text based on it's value."] = "Если включено, будет окрашивать текст прочности в зависимости от значения." +L["Durability Threshold"] = "Порог прочности" +L["Datatext will flash if durability shown will be equal or lower that this value."] = "Инфотекст начнет мигать, если показанная прочность будет меньшей либо равной заданному числу." +L["Any changes made will take effect only after:\n - Opening vendor\n - Item durability changes\n - Experiencing loading screen."] = "Изменения данных параметров вступят в силу только после одного из следующих действий:\n - Взаимодействия с торговцем\n - Изменения прочности предметов\n - Окончания экрана загрузки." --Equip Manager-- L['Equipment Manager'] = "Менеджер экипировки" diff --git a/ElvUI_SLE/modules/sledatatexts/durability.lua b/ElvUI_SLE/modules/sledatatexts/durability.lua index 435d1b7..4058d36 100644 --- a/ElvUI_SLE/modules/sledatatexts/durability.lua +++ b/ElvUI_SLE/modules/sledatatexts/durability.lua @@ -34,14 +34,18 @@ local function OnEvent(self, event, ...) end end end - if totalDurability <= 89 then + if totalDurability <= E.db.sle.dt.durability.threshold then E:Flash(self, 0.53, true) else E:StopFlash(self) end - local r,g,b = E:ColorGradient(totalDurability/100, .9,.2,.2, .9,.9,.2, .2,.9,.2) - local hex = E:RGBToHex(r,g,b) - self.text:SetFormattedText("%s: %s%d%%|r", DURABILITY, hex, totalDurability) + if E.db.sle.dt.durability.gradient then + local r,g,b = E:ColorGradient(totalDurability/100, .9,.2,.2, .9,.9,.2, .2,.9,.2) + local hex = E:RGBToHex(r,g,b) + self.text:SetFormattedText("%s: %s%d%%|r", DURABILITY, hex, totalDurability) + else + self.text:SetFormattedText(displayString, totalDurability) + end end local function Click() @@ -58,5 +62,14 @@ local function OnEnter(self) DT.tooltip:Show() end +local function ValueColorUpdate(hex, r, g, b) + displayString = join("", DURABILITY, ": ", hex, "%d%%|r") + + if lastPanel ~= nil then + OnEvent(lastPanel, 'ELVUI_COLOR_UPDATE') + end +end +E['valueColorUpdateFuncs'][ValueColorUpdate] = true + DT:RegisterDatatext('Durability', {'PLAYER_ENTERING_WORLD', "UPDATE_INVENTORY_DURABILITY", "MERCHANT_SHOW"}, OnEvent, nil, Click, OnEnter) diff --git a/ElvUI_SLE/options/datatexts_c.lua b/ElvUI_SLE/options/datatexts_c.lua index 7e9109b..a98f196 100644 --- a/ElvUI_SLE/options/datatexts_c.lua +++ b/ElvUI_SLE/options/datatexts_c.lua @@ -513,6 +513,35 @@ local function configTable() } }, }, + sldurability = { + type = "group", + name = DURABILITY, + order = 6, + args = { + header = { + order = 1, + type = "description", + name = L["Any changes made will take effect only after:\n - Opening vendor\n - Item durability changes\n - Experiencing loading screen."], + }, + gradient = { + order = 2, + type = "toggle", + name = L["Gradient"], + desc = L["If enabled will color durability text based on it's value."], + get = function(info) return E.db.sle.dt.durability.gradient end, + set = function(info, value) E.db.sle.dt.durability.gradient = value end, + }, + threshold = { + order = 3, + type = "range", + min = 5, max = 99, step = 1, + name = L["Durability Threshold"], + desc = L["Datatext will flash if durability shown will be equal or lower that this value."], + get = function(info) return E.db.sle.dt.durability.threshold end, + set = function(info, value) E.db.sle.dt.durability.threshold = value end, + } + }, + }, }, } end -- 1.7.9.5