From 5b3293746aafcce1c3e70c5231aa5833c4aab35b Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Wed, 8 Sep 2021 09:58:08 -0300 Subject: [PATCH] Added the option to change the colors on Death Log tooltip, this options in within the 'Modify Class Colors' panel --- Libs/LibRaidStatus/ThingsToMantain.lua | 16 +++++ classes/class_utility.lua | 22 +++--- frames/window_classcolor.lua | 98 +++++++++++++++++++++++++- functions/profiles.lua | 8 +++ 4 files changed, 133 insertions(+), 11 deletions(-) diff --git a/Libs/LibRaidStatus/ThingsToMantain.lua b/Libs/LibRaidStatus/ThingsToMantain.lua index 42530d8f..36f2e540 100644 --- a/Libs/LibRaidStatus/ThingsToMantain.lua +++ b/Libs/LibRaidStatus/ThingsToMantain.lua @@ -14,6 +14,22 @@ LIB_RAID_STATUS_COVENANT_ICONS = { [[Interface\ICONS\UI_Sigil_Necrolord]], --necrolords } +LIB_RAID_STATUS_MELEE_SPECS = { + [251] = "DEATHKNIGHT", + [252] = "DEATHKNIGHT", + [577] = "DEMONHUNTER", + [103] = "DRUID", + --[255] = "Survival", --not in the list due to the long interrupt time + [269] = "MONK", + [70] = "PALADIN", + [259] = "ROGUE", + [260] = "ROGUE", + [261] = "ROGUE", + [263] = "SHAMAN", + [71] = "WARRIOR", + [72] = "WARRIOR", +} + --which gear slots can be enchanted on the latest retail version of the game --when the value is a number, the slot only receives enchants for a specific attribute LIB_RAID_STATUS_ENCHANT_SLOTS = { diff --git a/classes/class_utility.lua b/classes/class_utility.lua index 0bd4a681..e8dbb7e5 100644 --- a/classes/class_utility.lua +++ b/classes/class_utility.lua @@ -215,6 +215,8 @@ function _detalhes:ToolTipDead (instancia, morte, esta_barra, keydown) GameCooltip:AddIcon ([[Interface\TUTORIALFRAME\UI-TUTORIAL-FRAME]], 1, 1, 12, 16, 0.015625, 0.13671875, 0.4375, 0.59765625) GameCooltip:AddStatusBar (0, 1, 1, 1, 1, 1, false, {value = 100, color = {.3, .3, .3, 1}, specialSpark = false, texture = [[Interface\AddOns\Details\images\bar_serenity]]}) + local barTypeColors = Details.death_log_colors + --death parser for index, event in _ipairs (eventos) do @@ -261,24 +263,24 @@ function _detalhes:ToolTipDead (instancia, morte, esta_barra, keydown) if (event [9]) then --> friendly fire - GameCooltip:AddStatusBar (hp, 1, "darkorange", true, backgroud_bar_damage) + GameCooltip:AddStatusBar (hp, 1, barTypeColors.friendlyfire, true, backgroud_bar_damage) else --> from a enemy - GameCooltip:AddStatusBar (hp, 1, "red", true, backgroud_bar_damage) + GameCooltip:AddStatusBar (hp, 1, barTypeColors.damage, true, backgroud_bar_damage) end else --> heal if (amount > _detalhes.deathlog_healingdone_min) then if (combatObject.is_arena) then if (amount > _detalhes.deathlog_healingdone_min_arena) then - GameCooltip:AddLine ("" .. _cstr ("%.1f", time - hora_da_morte) .. "s " .. spellname .. " (|cFFC6B0D9" .. source .. "|r)", "+" .. _detalhes:ToK (amount) .. " (" .. hp .. "%)", 1, "white", "white") - GameCooltip:AddIcon (spellicon) - GameCooltip:AddStatusBar (hp, 1, "green", true) + GameCooltip:AddLine("" .. _cstr ("%.1f", time - hora_da_morte) .. "s " .. spellname .. " (|cFFC6B0D9" .. source .. "|r)", "+" .. _detalhes:ToK (amount) .. " (" .. hp .. "%)", 1, "white", "white") + GameCooltip:AddIcon(spellicon) + GameCooltip:AddStatusBar(hp, 1, barTypeColors.heal, true) end else - GameCooltip:AddLine ("" .. _cstr ("%.1f", time - hora_da_morte) .. "s " .. spellname .. " (|cFFC6B0D9" .. source .. "|r)", "+" .. _detalhes:ToK (amount) .. " (" .. hp .. "%)", 1, "white", "white") - GameCooltip:AddIcon (spellicon) - GameCooltip:AddStatusBar (hp, 1, "green", true) + GameCooltip:AddLine("" .. _cstr ("%.1f", time - hora_da_morte) .. "s " .. spellname .. " (|cFFC6B0D9" .. source .. "|r)", "+" .. _detalhes:ToK (amount) .. " (" .. hp .. "%)", 1, "white", "white") + GameCooltip:AddIcon(spellicon) + GameCooltip:AddStatusBar(hp, 1, barTypeColors.heal, true) end end end @@ -288,7 +290,7 @@ function _detalhes:ToolTipDead (instancia, morte, esta_barra, keydown) --> cooldown GameCooltip:AddLine ("" .. _cstr ("%.1f", time - hora_da_morte) .. "s " .. spellname .. " (" .. source .. ")", "cooldown (" .. hp .. "%)", 1, "white", "white") GameCooltip:AddIcon (spellicon) - GameCooltip:AddStatusBar (100, 1, "yellow", true) + GameCooltip:AddStatusBar (100, 1, barTypeColors.cooldown, true) elseif (evtype == 2 and not battleress) then --> battle ress @@ -302,7 +304,7 @@ function _detalhes:ToolTipDead (instancia, morte, esta_barra, keydown) --> debuff GameCooltip:AddLine ("" .. _cstr ("%.1f", time - hora_da_morte) .. "s [x" .. amount .. "] " .. spellname .. " (" .. source .. ")", "debuff (" .. hp .. "%)", 1, "white", "white") GameCooltip:AddIcon (spellicon) - GameCooltip:AddStatusBar (100, 1, "purple", true) + GameCooltip:AddStatusBar (100, 1, barTypeColors.debuff, true) end end diff --git a/frames/window_classcolor.lua b/frames/window_classcolor.lua index e39fec0b..cacd6fcf 100644 --- a/frames/window_classcolor.lua +++ b/frames/window_classcolor.lua @@ -7,7 +7,7 @@ local Loc = _G.LibStub("AceLocale-3.0"):GetLocale("Details") --> config class colors function Details:OpenClassColorsConfig() if (not _G.DetailsClassColorManager) then - DF:CreateSimplePanel (UIParent, 300, 280, Loc ["STRING_OPTIONS_CLASSCOLOR_MODIFY"], "DetailsClassColorManager") + DF:CreateSimplePanel (UIParent, 300, 425, Loc ["STRING_OPTIONS_CLASSCOLOR_MODIFY"], "DetailsClassColorManager") local panel = _G.DetailsClassColorManager DF:ApplyStandardBackdrop (panel) @@ -85,6 +85,102 @@ function Details:OpenClassColorsConfig() button:SetClickFunction (reset_color, nil, nil, "RightClick") panel.buttons [class_name] = button end + + --make color options for death log bars + local function hex (num) + local hexstr = '0123456789abcdef' + local s = '' + while num > 0 do + local mod = math.fmod(num, 16) + s = string.sub(hexstr, mod+1, mod+1) .. s + num = math.floor(num / 16) + end + if s == '' then s = '00' end + if (string.len (s) == 1) then + s = "0"..s + end + return s + end + + local function sort_color (t1, t2) + return t1[1][3] > t2[1][3] + end + + local colorSelected = function(self, fixParam, value) + local colorName, barType = value:match("^(%w+)@(%w+)") + Details.death_log_colors[barType] = colorName + end + + local buildColorList = function(barType) + --all colors + local allColors = {} + for colorName, colorTable in pairs(DF:GetDefaultColorList()) do + tinsert(allColors, {colorTable, colorName, hex(colorTable[1]*255) .. hex(colorTable[2]*255) .. hex(colorTable[3]*255)}) + end + table.sort(allColors, sort_color) + + local result = {} + for index, colorTable in ipairs(allColors) do + local colortable = colorTable[1] + local colorname = colorTable[2] + local value = colorname .. "@" .. barType + tinsert (result, {label = colorname, value = value, color = colortable, onclick = colorSelected}) + end + + return result + end + + local deathLogOptions = { + {--damage + type = "select", + get = function() return Details.death_log_colors.damage end, + values = function() + return buildColorList("damage") + end, + name = "Damage", + desc = "Damage", + }, + {--heal + type = "select", + get = function() return Details.death_log_colors.heal end, + values = function() + return buildColorList("heal") + end, + name = "Heal", + desc = "Heal", + }, + {--friendlyfire + type = "select", + get = function() return Details.death_log_colors.friendlyfire end, + values = function() + return buildColorList("friendlyfire") + end, + name = "Friendly Fire", + desc = "Friendly Fire", + }, + {--cooldown + type = "select", + get = function() return Details.death_log_colors.cooldown end, + values = function() + return buildColorList("cooldown") + end, + name = "Cooldown", + desc = "Cooldown", + }, + {--debuff + type = "select", + get = function() return Details.death_log_colors.debuff end, + values = function() + return buildColorList("debuff") + end, + name = "Debuff", + desc = "Debuff", + }, + } + DetailsFramework:BuildMenu(panel, deathLogOptions, 5, -285, 700, true) + + local deathLogColorsLabel = DF:CreateLabel(panel, "Colors on Death Log:", 12, "yellow") + deathLogColorsLabel:SetPoint("topleft", panel, "topleft", 5, -265) end for class, button in pairs (_G.DetailsClassColorManager.buttons) do diff --git a/functions/profiles.lua b/functions/profiles.lua index 68f51171..d876da21 100644 --- a/functions/profiles.lua +++ b/functions/profiles.lua @@ -837,6 +837,14 @@ local default_profile = { }, }, + death_log_colors = { + damage = "red", + heal = "green", + friendlyfire = "darkorange", + cooldown = "yellow", + debuff = "purple", + }, + fade_speed = 0.15, --> minimap