diff --git a/Libs/DF/fw.lua b/Libs/DF/fw.lua index 717fbde57..590e5a8d5 100644 --- a/Libs/DF/fw.lua +++ b/Libs/DF/fw.lua @@ -1,6 +1,6 @@ -local dversion = 463 +local dversion = 464 local major, minor = "DetailsFramework-1.0", dversion local DF, oldminor = LibStub:NewLibrary(major, minor) diff --git a/Libs/DF/icon.lua b/Libs/DF/icon.lua index 4c9407c39..2fe0defdc 100644 --- a/Libs/DF/icon.lua +++ b/Libs/DF/icon.lua @@ -844,7 +844,9 @@ detailsFramework.IconMixin = { end end - width = width + (iconFrame.width * iconFrame:GetScale()) + xPadding + --icon.lua:847: attempt to perform arithmetic on field 'width'(a nil value) + --but .width is set on SetIconSimple and SetIcon, getting the width from the iconFrame it self instead from cache is the cache fails + width = width + ((iconFrame.width or iconFrame:GetWidth()) * iconFrame:GetScale()) + xPadding end if (self.options.center_alignment) then diff --git a/classes/class_utility.lua b/classes/class_utility.lua index b63c560a1..bfe247d77 100644 --- a/classes/class_utility.lua +++ b/classes/class_utility.lua @@ -1,3 +1,4 @@ + --lua locals local _cstr = string.format local _math_floor = math.floor @@ -7,6 +8,7 @@ local pairs = pairs local min = math.min local unpack = unpack local type = type + --api locals local _GetSpellInfo = Details.getspellinfo local GameTooltip = GameTooltip @@ -1706,54 +1708,86 @@ end function atributo_misc:ToolTipBuffUptime(instance, barFrame) local owner = self.owner if (owner and owner.classe) then - r, g, b = unpack(_detalhes.class_colors[owner.classe]) + r, g, b = unpack(Details.class_colors[owner.classe]) else - r, g, b = unpack(_detalhes.class_colors[self.classe]) + r, g, b = unpack(Details.class_colors[self.classe]) end - local actorTotal = self["buff_uptime"] - local actorTable = self.buff_uptime_spells._ActorTable - - local buffsUsed = {} local combatTime = instance.showing:GetCombatTime() + local buffUptimeSpells = self:GetSpellContainer("buff") + local buffUptimeTable = {} + + if (buffUptimeSpells) then + for spellId, spellTable in buffUptimeSpells:ListSpells() do + if (not Details.BuffUptimeSpellsToIgnore[spellId]) then + local uptime = spellTable.uptime or 0 + if (uptime > 0) then + buffUptimeTable[#buffUptimeTable+1] = {spellId, uptime} + end + end + end - for spellId, actor in pairs(actorTable) do - buffsUsed[#buffsUsed+1] = {spellId, actor.uptime or 0} - end - table.sort(buffsUsed, _detalhes.Sort2) + --check if this player has a augmentation buff container + local augmentedBuffContainer = self.received_buffs_spells + if (augmentedBuffContainer) then + for sourceNameSpellId, spellTable in augmentedBuffContainer:ListSpells() do + local sourceName, spellId = strsplit("@", sourceNameSpellId) + spellId = tonumber(spellId) + local spellName, _, spellIcon = Details.GetSpellInfo(spellId) - _detalhes:AddTooltipSpellHeaderText(Loc ["STRING_SPELLS"], headerColor, #buffsUsed, _detalhes.tooltip_spell_icon.file, unpack(_detalhes.tooltip_spell_icon.coords)) - _detalhes:AddTooltipHeaderStatusbar(r, g, b, barAlha) + if (spellName) then + sourceName = detailsFramework:RemoveRealmName(sourceName) + local uptime = spellTable.uptime or 0 + buffUptimeTable[#buffUptimeTable+1] = {spellId, uptime, sourceName} + end + end + end - local iconSizeInfo = _detalhes.tooltip.icon_size - local iconBorderInfo = _detalhes.tooltip.icon_border_texcoord + table.sort(buffUptimeTable, Details.Sort2) - if (#buffsUsed > 0) then - for i = 1, min(30, #buffsUsed) do - local spellTable = buffsUsed[i] - local percent = spellTable[2] / combatTime * 100 + Details:AddTooltipSpellHeaderText(Loc ["STRING_SPELLS"], headerColor, #buffUptimeTable, Details.tooltip_spell_icon.file, unpack(Details.tooltip_spell_icon.coords)) + Details:AddTooltipHeaderStatusbar(r, g, b, barAlha) - if (spellTable[2] > 0 and percent < 99.5) then - local spellName, _, spellIcon = _GetSpellInfo(spellTable[1]) + local iconSizeInfo = Details.tooltip.icon_size + local iconBorderInfo = Details.tooltip.icon_border_texcoord - local minutes, seconds = floor(spellTable[2] / 60), floor(spellTable[2] % 60) - if (spellTable[2] >= combatTime) then - --GameCooltip:AddLine(nome_magia, minutos .. "m " .. segundos .. "s" .. " (" .. _cstr ("%.1f", esta_habilidade[2] / _combat_time * 100) .. "%)", nil, "gray", "gray") - --GameCooltip:AddStatusBar (100, nil, 1, 0, 1, .3, false) + if (#buffUptimeTable > 0) then + for i = 1, min(30, #buffUptimeTable) do + local uptimeTable = buffUptimeTable[i] - elseif (minutes > 0) then - GameCooltip:AddLine(spellName, minutes .. "m " .. seconds .. "s" .. " (" .. _cstr("%.1f", percent) .. "%)") - _detalhes:AddTooltipBackgroundStatusbar(false, percent) + local spellId = uptimeTable[1] + local uptime = uptimeTable[2] + local sourceName = uptimeTable[3] - else - GameCooltip:AddLine(spellName, seconds .. "s" .. " (" .. _cstr("%.1f", percent) .. "%)") - _detalhes:AddTooltipBackgroundStatusbar(false, percent) - end + local uptimePercent = uptime / combatTime * 100 + + if (uptime > 0 and uptimePercent < 99.5) then + local spellName, _, spellIcon = _GetSpellInfo(spellId) + + if (sourceName) then + spellName = spellName .. " [" .. sourceName .. "]" + end - GameCooltip:AddIcon(spellIcon, nil, nil, iconSizeInfo.W, iconSizeInfo.H, iconBorderInfo.L, iconBorderInfo.R, iconBorderInfo.T, iconBorderInfo.B) + if (uptime <= combatTime) then + local minutes, seconds = math.floor(uptime / 60), math.floor(uptime % 60) + if (minutes > 0) then + GameCooltip:AddLine(spellName, minutes .. "m " .. seconds .. "s" .. " (" .. format("%.1f", uptimePercent) .. "%)") + Details:AddTooltipBackgroundStatusbar(false, uptimePercent, true, sourceName and "green") + else + GameCooltip:AddLine(spellName, seconds .. "s" .. " (" .. format("%.1f", uptimePercent) .. "%)") + Details:AddTooltipBackgroundStatusbar(false, uptimePercent, true, sourceName and "green") + end + + GameCooltip:AddIcon(spellIcon, nil, nil, iconSizeInfo.W, iconSizeInfo.H, iconBorderInfo.L, iconBorderInfo.R, iconBorderInfo.T, iconBorderInfo.B) + end + end end + else + GameCooltip:AddLine(Loc ["STRING_NO_SPELL"]) end else + Details:AddTooltipSpellHeaderText(Loc ["STRING_SPELLS"], headerColor, #buffUptimeTable, Details.tooltip_spell_icon.file, unpack(Details.tooltip_spell_icon.coords)) + Details:AddTooltipHeaderStatusbar(r, g, b, barAlha) GameCooltip:AddLine(Loc ["STRING_NO_SPELL"]) end diff --git a/core/control.lua b/core/control.lua index 7c4c1884b..f48caec14 100644 --- a/core/control.lua +++ b/core/control.lua @@ -6,6 +6,7 @@ local _tempo = time() local _ local addonName, Details222 = ... + local detailsFramework = DetailsFramework ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --local pointers @@ -1629,7 +1630,7 @@ GameCooltip:AddStatusBar (100, 1, 0, 0, 0, 0.8) end - function Details:AddTooltipBackgroundStatusbar (side, value, useSpark) + function Details:AddTooltipBackgroundStatusbar (side, value, useSpark, statusBarColor) Details.tooltip.background [4] = 0.8 Details.tooltip.icon_size.W = Details.tooltip.line_height Details.tooltip.icon_size.H = Details.tooltip.line_height @@ -1661,6 +1662,9 @@ if (not side) then local r, g, b, a = unpack(Details.tooltip.bar_color) + if (statusBarColor) then + r, g, b, a = detailsFramework:ParseColors(statusBarColor) + end local rBG, gBG, bBG, aBG = unpack(Details.tooltip.background) GameCooltip:AddStatusBar (value, 1, r, g, b, a, useSpark, {value = 100, color = {rBG, gBG, bBG, aBG}, texture = [[Interface\AddOns\Details\images\bar_serenity]]}) diff --git a/frames/window_breakdown/window_playerbreakdown_auras.lua b/frames/window_breakdown/window_playerbreakdown_auras.lua index 8b37c8dfd..4e8399143 100644 --- a/frames/window_breakdown/window_playerbreakdown_auras.lua +++ b/frames/window_breakdown/window_playerbreakdown_auras.lua @@ -6,7 +6,7 @@ local unpack = unpack local CreateFrame = CreateFrame local GetSpellInfo = GetSpellInfo -local buffs_to_ignore = { +Details.BuffUptimeSpellsToIgnore = { [186401] = true, --Sign of the Skirmisher [366646] = true, --Familiar Skies [403265] = true, --Bronze Attunement @@ -226,26 +226,26 @@ end local aurasTabFillCallback = function(tab, player, combat) ---@type actor - local miscActor = combat:GetActor(DETAILS_ATTRIBUTE_MISC, player:Name()) + local utilityActor = combat:GetActor(DETAILS_ATTRIBUTE_MISC, player:Name()) ---@type number local combatTime = combat:GetCombatTime() - if (miscActor) then + if (utilityActor) then do --buffs local newAuraTable = {} - local spellContainer = miscActor:GetSpellContainer("buff") + local spellContainer = utilityActor:GetSpellContainer("buff") if (spellContainer) then for spellId, spellTable in spellContainer:ListSpells() do local spellName, _, spellIcon = Details.GetSpellInfo(spellId) local uptime = spellTable.uptime or 0 - if (not buffs_to_ignore[spellId]) then + if (not Details.BuffUptimeSpellsToIgnore[spellId]) then table.insert(newAuraTable, {spellIcon, spellName, uptime, spellTable.appliedamt, spellTable.refreshamt, uptime / combatTime * 100, spellID = spellId}) end end end --check if this player has a augmentation buff container - local augmentedBuffContainer = miscActor.received_buffs_spells + local augmentedBuffContainer = utilityActor.received_buffs_spells if (augmentedBuffContainer) then for sourceNameSpellId, spellTable in augmentedBuffContainer:ListSpells() do local sourceName, spellId = strsplit("@", sourceNameSpellId) @@ -267,7 +267,7 @@ local aurasTabFillCallback = function(tab, player, combat) do --debuffs local newAuraTable = {} - local spellContainer = miscActor:GetSpellContainer("debuff") + local spellContainer = utilityActor:GetSpellContainer("debuff") if (spellContainer) then for spellId, spellTable in spellContainer:ListSpells() do local spellName, _, spellIcon = Details.GetSpellInfo(spellId)