From 2efc5a58f85fd865dbfe8b7b0bcf9da880fd7c2f Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Thu, 21 Dec 2023 14:34:21 -0300 Subject: [PATCH] General Updates and fixed (see commit description) - Added the 'Remove Battleground Segments' option to the menu that opens when hovering over the erase button. - Attempt to fix Battleground faction icons, shown on enemy players damage bars. - Fixed custom scripts showing the damage text too close to the dps text. - Lib OpenRaid updated. - Framework Updated. --- Libs/DF/fw.lua | 56 ++++++++++++++++++- Libs/DF/panel.lua | 3 +- Libs/LibOpenRaid/LibOpenRaid.lua | 2 +- .../ThingsToMantain_Dragonflight.lua | 2 + classes/class_custom.lua | 42 +++++++------- classes/container_actors.lua | 15 +++++ classes/container_segments.lua | 8 ++- frames/window_main.lua | 16 ++++-- functions/mixin.lua | 4 ++ 9 files changed, 116 insertions(+), 32 deletions(-) diff --git a/Libs/DF/fw.lua b/Libs/DF/fw.lua index 408cf221..8b0ebf3b 100644 --- a/Libs/DF/fw.lua +++ b/Libs/DF/fw.lua @@ -1,6 +1,6 @@ -local dversion = 493 +local dversion = 495 local major, minor = "DetailsFramework-1.0", dversion local DF, oldminor = LibStub:NewLibrary(major, minor) @@ -523,6 +523,60 @@ function DF.table.find(t, value) end end +function DF:GetParentKeyPath(object) + local parentKey = object:GetParentKey() + if (not parentKey) then + return "" + end + + local path = "" .. parentKey + local parent = object:GetParent() + + while (parent) do + parentKey = parent:GetParentKey() + + if (parentKey) then + path = parentKey .. "." .. path + else + return path + end + + parent = parent:GetParent() + end + + return path +end + +function DF:GetParentNamePath(object) + local parent = object + local path = "" + while (parent) do + local parentName = parent:GetName() + + if (not parentName) then + local parentOfParent = parent:GetParent() + if (parentOfParent) then + local parentKey = parentOfParent:GetParentKey() + if (parentKey) then + parentName = parentKey + else + return path:gsub("%.$", "") + end + end + end + + if (parentName) then + path = parentName .. "." .. path + else + return path:gsub("%.$", "") + end + + parent = parent:GetParent() + end + + return path:gsub("%.$", "") +end + ---get a value from a table using a path, e.g. getfrompath(tbl, "a.b.c") is the same as tbl.a.b.c ---@param t table ---@param path string diff --git a/Libs/DF/panel.lua b/Libs/DF/panel.lua index 16dbd814..b3eecced 100644 --- a/Libs/DF/panel.lua +++ b/Libs/DF/panel.lua @@ -2074,10 +2074,11 @@ function detailsFramework:CreateSimplePanel(parent, width, height, title, frameN --set the backdrop if (panelOptions.RoundedCorners) then local tRoundedCornerPreset = { - roundness = 6, + roundness = 3, color = {.1, .1, .1, 0.98}, border_color = {.05, .05, .05, 0.834}, use_titlebar = true, + titlebar_height = 26, } detailsFramework:AddRoundedCornersToFrame(simplePanel, tRoundedCornerPreset) else diff --git a/Libs/LibOpenRaid/LibOpenRaid.lua b/Libs/LibOpenRaid/LibOpenRaid.lua index 520f83c3..527ddfb7 100644 --- a/Libs/LibOpenRaid/LibOpenRaid.lua +++ b/Libs/LibOpenRaid/LibOpenRaid.lua @@ -43,7 +43,7 @@ if (WOW_PROJECT_ID ~= WOW_PROJECT_MAINLINE and not isExpansion_Dragonflight()) t end local major = "LibOpenRaid-1.0" -local CONST_LIB_VERSION = 116 +local CONST_LIB_VERSION = 117 if (LIB_OPEN_RAID_MAX_VERSION) then if (CONST_LIB_VERSION <= LIB_OPEN_RAID_MAX_VERSION) then diff --git a/Libs/LibOpenRaid/ThingsToMantain_Dragonflight.lua b/Libs/LibOpenRaid/ThingsToMantain_Dragonflight.lua index ba243fe8..bc54544d 100644 --- a/Libs/LibOpenRaid/ThingsToMantain_Dragonflight.lua +++ b/Libs/LibOpenRaid/ThingsToMantain_Dragonflight.lua @@ -217,6 +217,7 @@ do } LIB_OPEN_RAID_ALL_POTIONS = { + [415569] = 1, --Dreamwalker's Healing Potion [370511] = 1, --Refreshing Healing Potion [371039] = 1, --Potion of Withering Vitality [370607] = 1, --Aerated Mana Potion @@ -229,6 +230,7 @@ do --spellId of healing from potions LIB_OPEN_RAID_HEALING_POTIONS = { + [415569] = 1, --Dreamwalker's Healing Potion [370511] = 1, --Refreshing Healing Potion [371039] = 1, --Potion of Withering Vitality [6262] = 1, --Warlock's Healthstone diff --git a/classes/class_custom.lua b/classes/class_custom.lua index 59a40653..a410b1c4 100644 --- a/classes/class_custom.lua +++ b/classes/class_custom.lua @@ -363,19 +363,19 @@ function classCustom:Refresh (instance, instance_container, combat, force, total, top, custom_object) local whichRowLine = 1 - local barras_container = instance.barras - local percentage_type = instance.row_info.percent_type + local barContainer = instance.barras + local percentageType = instance.row_info.percent_type - local combat_time = combat:GetCombatTime() + local combatElapsedTime = combat:GetCombatTime() UsingCustomLeftText = instance.row_info.textL_enable_custom_text UsingCustomRightText = instance.row_info.textR_enable_custom_text --total bar - local use_total_bar = false + local bUseTotalbar = false if (instance.total_bar.enabled) then - use_total_bar = true + bUseTotalbar = true if (instance.total_bar.only_in_group and (not IsInGroup() and not IsInRaid())) then - use_total_bar = false + bUseTotalbar = false end end @@ -388,7 +388,7 @@ if (instance.bars_sort_direction == 1) then --top to bottom - if (use_total_bar and instance.barraS[1] == 1) then + if (bUseTotalbar and instance.barraS[1] == 1) then whichRowLine = 2 local iter_last = instance.barraS[2] @@ -396,10 +396,10 @@ iter_last = iter_last - 1 end - local row1 = barras_container [1] + local row1 = barContainer [1] row1.minha_tabela = nil row1.lineText1:SetText(Loc ["STRING_TOTAL"]) - row1.lineText4:SetText(_detalhes:ToK2 (total) .. " (" .. _detalhes:ToK (total / combat_time) .. ")") + row1.lineText4:SetText(_detalhes:ToK2 (total) .. " (" .. _detalhes:ToK (total / combatElapsedTime) .. ")") row1:SetValue(100) local r, g, b = unpack(instance.total_bar.color) @@ -411,20 +411,20 @@ Details.FadeHandler.Fader(row1, "out") for i = instance.barraS[1], iter_last, 1 do - instance_container._ActorTable[i]:UpdateBar (barras_container, whichRowLine, percentage_type, i, total, top, instance, force, percent_script, total_script, combat, bars_show_data, bars_brackets, bars_separator) + instance_container._ActorTable[i]:UpdateBar (barContainer, whichRowLine, percentageType, i, total, top, instance, force, percent_script, total_script, combat, bars_show_data, bars_brackets, bars_separator) whichRowLine = whichRowLine+1 end else for i = instance.barraS[1], instance.barraS[2], 1 do - instance_container._ActorTable[i]:UpdateBar (barras_container, whichRowLine, percentage_type, i, total, top, instance, force, percent_script, total_script, combat, bars_show_data, bars_brackets, bars_separator) + instance_container._ActorTable[i]:UpdateBar (barContainer, whichRowLine, percentageType, i, total, top, instance, force, percent_script, total_script, combat, bars_show_data, bars_brackets, bars_separator) whichRowLine = whichRowLine+1 end end elseif (instance.bars_sort_direction == 2) then --bottom to top - if (use_total_bar and instance.barraS[1] == 1) then + if (bUseTotalbar and instance.barraS[1] == 1) then whichRowLine = 2 local iter_last = instance.barraS[2] @@ -432,10 +432,10 @@ iter_last = iter_last - 1 end - local row1 = barras_container [1] + local row1 = barContainer [1] row1.minha_tabela = nil row1.lineText1:SetText(Loc ["STRING_TOTAL"]) - row1.lineText4:SetText(_detalhes:ToK2 (total) .. " (" .. _detalhes:ToK (total / combat_time) .. ")") + row1.lineText4:SetText(_detalhes:ToK2 (total) .. " (" .. _detalhes:ToK (total / combatElapsedTime) .. ")") row1:SetValue(100) local r, g, b = unpack(instance.total_bar.color) @@ -447,13 +447,13 @@ Details.FadeHandler.Fader(row1, "out") for i = iter_last, instance.barraS[1], -1 do --vai atualizar s� o range que esta sendo mostrado - instance_container._ActorTable[i]:UpdateBar (barras_container, whichRowLine, percentage_type, i, total, top, instance, force, percent_script, total_script, combat, bars_show_data, bars_brackets, bars_separator) + instance_container._ActorTable[i]:UpdateBar (barContainer, whichRowLine, percentageType, i, total, top, instance, force, percent_script, total_script, combat, bars_show_data, bars_brackets, bars_separator) whichRowLine = whichRowLine+1 end else for i = instance.barraS[2], instance.barraS[1], -1 do --vai atualizar s� o range que esta sendo mostrado - instance_container._ActorTable[i]:UpdateBar (barras_container, whichRowLine, percentage_type, i, total, top, instance, force, percent_script, total_script, combat, bars_show_data, bars_brackets, bars_separator) + instance_container._ActorTable[i]:UpdateBar (barContainer, whichRowLine, percentageType, i, total, top, instance, force, percent_script, total_script, combat, bars_show_data, bars_brackets, bars_separator) whichRowLine = whichRowLine+1 end end @@ -468,6 +468,8 @@ end end + instance:AutoAlignInLineFontStrings() + end ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- @@ -531,14 +533,14 @@ row.lineText2:SetText("") end else - local formated_value = SelectedToKFunction (_, self.value) - local rightText = formated_value .. bars_brackets[1] .. percent .. bars_brackets[2] + local formatedValue = SelectedToKFunction(_, self.value) + local rightText = formatedValue .. bars_brackets[1] .. percent .. bars_brackets[2] if (UsingCustomRightText) then - row.lineText4:SetText(stringReplace (instance.row_info.textR_custom_text, formated_value, "", percent, self, combat, instance, rightText)) + row.lineText4:SetText(stringReplace(instance.row_info.textR_custom_text, formatedValue, "", percent, self, combat, instance, rightText)) else if (instance.use_multi_fontstrings) then - instance:SetInLineTexts(row, "", formated_value, percent) + instance:SetInLineTexts(row, "", formatedValue, percent) else row.lineText4:SetText(rightText) row.lineText3:SetText("") diff --git a/classes/container_actors.lua b/classes/container_actors.lua index 0b57088b..60c5a2e7 100644 --- a/classes/container_actors.lua +++ b/classes/container_actors.lua @@ -508,15 +508,22 @@ end local checkValidNickname = function(nickname, playerName) if (nickname and type(nickname) == "string") then nickname = nickname:trim() + if (nickname == "" or nickname:len() < 2) then return playerName end + if (nickname:len() > 20) then return playerName end + + if (not UnitIsInMyGuild(playerName)) then + return playerName + end else return playerName end + return nickname end @@ -525,6 +532,8 @@ end if (actorFlags) then local _, zoneType = GetInstanceInfo() + --UnitIsInMyGuild + --on retail post 100200 patch, actorName is formatted as "name-realm" --this is player actor @@ -867,6 +876,12 @@ end end --enemy player + if (Details.zone_type == "pvp") then + if (bitBand(actorFlags, REACTION_HOSTILE) ~= 0) then --is hostile + newActor.enemy = true + end + end + if (newActor.classe == "UNGROUPPLAYER") then --is a player if (bitBand(actorFlags, REACTION_HOSTILE) ~= 0) then --is hostile newActor.enemy = true diff --git a/classes/container_segments.lua b/classes/container_segments.lua index 27b1ce8a..d99437a3 100644 --- a/classes/container_segments.lua +++ b/classes/container_segments.lua @@ -768,13 +768,15 @@ function segmentClass:ResetDataByCombatType(combatType) if (combatType == "m+overall") then combatType = DETAILS_SEGMENTTYPE_MYTHICDUNGEON_OVERALL - bIsException = true + bIsException = true --remove all, except mythic+ overall + elseif (combatType == "generic") then combatTypesInclusion[DETAILS_SEGMENTTYPE_GENERIC] = true combatTypesInclusion[DETAILS_SEGMENTTYPE_RAID_TRASH] = true - end - --if true then return end + elseif (combatType == "battleground") then + combatTypesInclusion[DETAILS_SEGMENTTYPE_PVP_BATTLEGROUND] = true + end --destroy the overall combat object segmentClass:ResetOverallData() diff --git a/frames/window_main.lua b/frames/window_main.lua index 2c238957..37df9084 100644 --- a/frames/window_main.lua +++ b/frames/window_main.lua @@ -9005,22 +9005,26 @@ end Details:SetTooltipMinWidth() - gameCooltip:AddLine("Remove Common Segments", nil, 1, "white", nil, Details.font_sizes.menus, Details.font_faces.menus) - gameCooltip:AddIcon([[Interface\Buttons\UI-StopButton]], 1, 1, 14, 14, 0, 1, 0, 1, "orange") - gameCooltip:AddMenu(1, function() Details.tabela_historico:ResetDataByCombatType("generic"); GameCooltip:Hide() end) - gameCooltip:AddLine("Reset, but keep Mythic+ Overall Segments", nil, 1, "white", nil, Details.font_sizes.menus, Details.font_faces.menus) gameCooltip:AddIcon([[Interface\Buttons\UI-StopButton]], 1, 1, 14, 14, 0, 1, 0, 1, "orange") gameCooltip:AddMenu(1, function() Details.tabela_historico:ResetDataByCombatType("m+overall"); GameCooltip:Hide() end) gameCooltip:AddLine("$div", nil, 1, nil, -5, -11) + gameCooltip:AddLine("Remove Common Segments", nil, 1, "white", nil, Details.font_sizes.menus, Details.font_faces.menus) + gameCooltip:AddIcon([[Interface\Buttons\UI-StopButton]], 1, 1, 14, 14, 0, 1, 0, 1, "orange") + gameCooltip:AddMenu(1, function() Details.tabela_historico:ResetDataByCombatType("generic"); GameCooltip:Hide() end) + + gameCooltip:AddLine("Remove Battleground Segments", nil, 1, "white", nil, Details.font_sizes.menus, Details.font_faces.menus) + gameCooltip:AddIcon([[Interface\Buttons\UI-StopButton]], 1, 1, 14, 14, 0, 1, 0, 1, "orange") + gameCooltip:AddMenu(1, function() Details.tabela_historico:ResetDataByCombatType("battleground"); GameCooltip:Hide() end) + + gameCooltip:AddLine("$div", nil, 1, nil, -5, -11) + gameCooltip:AddLine(Loc["STRING_ERASE_DATA_OVERALL"], nil, 1, "white", nil, Details.font_sizes.menus, Details.font_faces.menus) gameCooltip:AddIcon([[Interface\Buttons\UI-StopButton]], 1, 1, 14, 14, 0, 1, 0, 1, "orange") gameCooltip:AddMenu(1, Details.tabela_historico.ResetOverallData) - gameCooltip:AddLine("$div", nil, 1, nil, -5, -11) - gameCooltip:AddLine(Loc["STRING_ERASE_DATA"], nil, 1, "white", nil, Details.font_sizes.menus, Details.font_faces.menus) gameCooltip:AddIcon([[Interface\Buttons\UI-StopButton]], 1, 1, 14, 14, 0, 1, 0, 1, "red") gameCooltip:AddMenu(1, Details.tabela_historico.ResetAllCombatData) diff --git a/functions/mixin.lua b/functions/mixin.lua index 761f065d..178852ed 100644 --- a/functions/mixin.lua +++ b/functions/mixin.lua @@ -45,6 +45,10 @@ Details222.Mixins.ActorMixin = { ---@cast actor actorutility return actor.dispell_spells + elseif (containerType == "dispelwhat") then + ---@cast actor actorutility + return actor.dispell_oque + elseif (containerType == "interrupt") then ---@cast actor actorutility return actor.interrupt_spells