Skip to content

Commit

Permalink
General Updates and fixed (see commit description)
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
Tercioo committed Dec 21, 2023
1 parent 0bd0343 commit 2efc5a5
Show file tree
Hide file tree
Showing 9 changed files with 114 additions and 30 deletions.
56 changes: 55 additions & 1 deletion Libs/DF/fw.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


local dversion = 493
local dversion = 495
local major, minor = "DetailsFramework-1.0", dversion
local DF, oldminor = LibStub:NewLibrary(major, minor)

Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion Libs/DF/panel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Libs/LibOpenRaid/LibOpenRaid.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions Libs/LibOpenRaid/ThingsToMantain_Dragonflight.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
42 changes: 22 additions & 20 deletions classes/class_custom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -388,18 +388,18 @@

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]
if (iter_last == instance.rows_fit_in_window) then
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)
Expand All @@ -411,31 +411,31 @@
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]
if (iter_last == instance.rows_fit_in_window) then
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)
Expand All @@ -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
Expand All @@ -468,6 +468,8 @@
end
end

instance:AutoAlignInLineFontStrings()

end

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -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("")
Expand Down
15 changes: 15 additions & 0 deletions classes/container_actors.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
8 changes: 5 additions & 3 deletions classes/container_segments.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
12 changes: 8 additions & 4 deletions frames/window_main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9005,22 +9005,26 @@ end

Details:SetTooltipMinWidth()

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("Reset, but keep Mythic+ Overall Segments", nil, 1, "white", nil, Details.font_sizes.menus, Details.font_faces.menus)
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("m+overall"); GameCooltip:Hide() end)
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)
Expand Down
4 changes: 4 additions & 0 deletions functions/mixin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2efc5a5

Please sign in to comment.