From c1e1191c0737e88ab2de1d532326914524c1cd1c Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Thu, 7 Mar 2024 21:20:08 -0300 Subject: [PATCH] Several tooltips now has thicker lines, bigger icons and smooth rounded corners --- Definitions.lua | 4 + Libs/DF/cooltip.lua | 50 +++++++-- Libs/DF/fw.lua | 2 +- boot.lua | 2 + classes/class_damage.lua | 217 ++++++++++++++++++++++----------------- classes/class_heal.lua | 34 +++--- core/control.lua | 13 +-- frames/window_main.lua | 2 +- frames/window_switch.lua | 5 +- 9 files changed, 191 insertions(+), 138 deletions(-) diff --git a/Definitions.lua b/Definitions.lua index 07c8745f9..98eb13e01 100644 --- a/Definitions.lua +++ b/Definitions.lua @@ -139,6 +139,9 @@ ---@field TextureAtlas table ---@field playername string ---@field breakdown_general profile_breakdown_settings +---@field DefaultTooltipIconSize number default size of the icons in the tooltip, this also dictates the size of each line in the tooltip +---@field +---@field ---@field ---@field GetDisplayClassByDisplayId fun(self: details, displayId: number) : table -return the class object for the given displayId (attributeId) ---@field GetTextureAtlas fun(self: details, atlasName: atlasname) : df_atlasinfo return the texture atlas data @@ -389,6 +392,7 @@ ---@field serial string ---@field spec number ---@field grupo boolean +---@field classe string ---@field fight_component boolean ---@field boss_fight_component boolean ---@field pvp_component boolean diff --git a/Libs/DF/cooltip.lua b/Libs/DF/cooltip.lua index 4c3622d8a..f0c581c91 100644 --- a/Libs/DF/cooltip.lua +++ b/Libs/DF/cooltip.lua @@ -17,7 +17,7 @@ local max = math.max --api locals local PixelUtil = PixelUtil or DFPixelUtil -local version = 22 +local version = 23 local CONST_MENU_TYPE_MAINMENU = "main" local CONST_MENU_TYPE_SUBMENU = "sub" @@ -106,7 +106,7 @@ function DF:CreateCoolTip() --options table gameCooltip.OptionsList = { - ["RightTextMargin"] = true, + ["RightTextMargin"] = true, --offset between the right text to the right icon, default: -3 ["IconSize"] = true, ["HeightAnchorMod"] = true, ["WidthAnchorMod"] = true, @@ -122,10 +122,10 @@ function DF:CreateCoolTip() ["TextHeightMod"] = true, ["ButtonHeightMod"] = true, ["ButtonHeightModSub"] = true, - ["YSpacingMod"] = true, + ["YSpacingMod"] = true, --space between each line, does not work with 'IgnoreButtonAutoHeight' and 'AlignAsBlizzTooltip' ["YSpacingModSub"] = true, - ["ButtonsYMod"] = true, - ["ButtonsYModSub"] = true, + ["ButtonsYMod"] = true, --amount of space to leave between the top border and the first line of the tooltip, default: 0 + ["ButtonsYModSub"] = true, --amount of space to leave between the top border and the first line of the tooltip, default: 0 ["IconHeightMod"] = true, ["StatusBarHeightMod"] = true, ["StatusBarTexture"] = true, @@ -144,8 +144,8 @@ function DF:CreateCoolTip() ["RelativeAnchor"] = true, ["NoLastSelectedBar"] = true, ["SubMenuIsTooltip"] = true, - ["LeftBorderSize"] = true, - ["RightBorderSize"] = true, + ["LeftBorderSize"] = true, --offset between the left border and the left icon, default: 10 + offset + ["RightBorderSize"] = true, --offset between the right border and the right icon, default: -10 + offset ["HeighMod"] = true, ["HeighModSub"] = true, ["IconBlendMode"] = true, @@ -192,7 +192,7 @@ function DF:CreateCoolTip() --move each line in the Y axis (vertical offsett) ["LineYOffset"] = "ButtonsYMod", - ["VerticalOffset"] = "ButtonsYMod", + ["VerticalOffset"] = "ButtonsYMod", --amount of space to leave between the top border and the first line of the tooltip, default: 0 ["LineYOffsetSub"] = "ButtonsYModSub", ["VerticalOffsetSub"] = "ButtonsYModSub", } @@ -232,7 +232,7 @@ function DF:CreateCoolTip() gameCooltip.RoundedFramePreset = { color = {.075, .075, .075, 1}, - border_color = {.2, .2, .2, 1}, + border_color = {.3, .3, .3, 1}, roundness = 8, } @@ -378,6 +378,9 @@ function DF:CreateCoolTip() frame1.frameBackgroundTexture:Hide() frame2.frameBackgroundTexture:Hide() + + frame1.gradientTexture:Hide() + frame2.gradientTexture:Hide() end function GameCooltip:HideRoundedCorner() @@ -390,6 +393,9 @@ function DF:CreateCoolTip() frame1.frameBackgroundTexture:Show() frame2.frameBackgroundTexture:Show() + + frame1.gradientTexture:Show() + frame2.gradientTexture:Show() end gameCooltip.frame1 = frame1 @@ -613,10 +619,18 @@ function DF:CreateCoolTip() statusbar.leftIcon:SetSize(16, 16) statusbar.leftIcon:SetPoint("LEFT", statusbar, "LEFT", 0, 0) + statusbar.leftIconMask = statusbar:CreateMaskTexture("$parent_LeftIconMask", "artwork") + statusbar.leftIconMask:SetAllPoints(statusbar.leftIcon) + statusbar.leftIcon:AddMaskTexture(statusbar.leftIconMask) + statusbar.rightIcon = statusbar:CreateTexture("$parent_RightIcon", "OVERLAY") statusbar.rightIcon:SetSize(16, 16) statusbar.rightIcon:SetPoint("RIGHT", statusbar, "RIGHT", 0, 0) + statusbar.rightIconMask = statusbar:CreateMaskTexture("$parent_RightIconMask", "artwork") + statusbar.rightIconMask:SetAllPoints(statusbar.rightIcon) + statusbar.rightIcon:AddMaskTexture(statusbar.rightIconMask) + statusbar.spark2 = statusbar:CreateTexture("$parent_Spark2", "OVERLAY") statusbar.spark2:SetSize(32, 32) statusbar.spark2:SetPoint("LEFT", statusbar, "RIGHT", -17, -1) @@ -659,6 +673,8 @@ function DF:CreateCoolTip() self:RegisterForClicks("LeftButtonDown") self.leftIcon = self.statusbar.leftIcon self.rightIcon = self.statusbar.rightIcon + self.leftIconMask = self.statusbar.leftIconMask + self.rightIconMask = self.statusbar.rightIconMask self.texture = self.statusbar.texture self.spark = self.statusbar.spark self.spark2 = self.statusbar.spark2 @@ -1183,6 +1199,12 @@ function DF:CreateCoolTip() textureObject:SetHeight(leftIconSettings[3]) textureObject:SetTexCoord(leftIconSettings[4], leftIconSettings[5], leftIconSettings[6], leftIconSettings[7]) + if (leftIconSettings[10]) then + menuButton.leftIconMask:SetTexture(leftIconSettings[10]) + else + menuButton.leftIconMask:SetTexture([[Interface\COMMON\common-iconmask]]) + end + local colorRed, colorGreen, colorBlue, colorAlpha = DF:ParseColors(leftIconSettings[8]) textureObject:SetVertexColor(colorRed, colorGreen, colorBlue, colorAlpha) @@ -1240,6 +1262,12 @@ function DF:CreateCoolTip() menuButton.rightIcon:SetHeight(rightIconSettings[3]) menuButton.rightIcon:SetTexCoord(rightIconSettings[4], rightIconSettings[5], rightIconSettings[6], rightIconSettings[7]) + if (rightIconSettings[10]) then + menuButton.rightIconMask:SetTexture(rightIconSettings[10]) + else + menuButton.rightIconMask:SetTexture([[Interface\COMMON\common-iconmask]]) + end + local colorRed, colorGreen, colorBlue, colorAlpha = DF:ParseColors(rightIconSettings[8]) menuButton.rightIcon:SetVertexColor(colorRed, colorGreen, colorBlue, colorAlpha) @@ -3186,7 +3214,7 @@ function DF:CreateCoolTip() return gameCooltip:AddIcon(iconTexture, menuType, side, iconWidth, iconHeight, leftCoord, rightCoord, topCoord, bottomCoord, overlayColor, point, desaturated) end - function gameCooltip:AddIcon(iconTexture, menuType, side, iconWidth, iconHeight, leftCoord, rightCoord, topCoord, bottomCoord, overlayColor, point, desaturated) + function gameCooltip:AddIcon(iconTexture, menuType, side, iconWidth, iconHeight, leftCoord, rightCoord, topCoord, bottomCoord, overlayColor, point, desaturated, mask) --need a previous line if (gameCooltip.Indexes == 0) then return gameCooltip:PrintDebug("AddIcon() requires an already added line (Cooltip:AddLine()).") @@ -3248,6 +3276,7 @@ function DF:CreateCoolTip() gameCooltip.TopIconTableSub[gameCooltip.Indexes][7] = bottomCoord or 1 gameCooltip.TopIconTableSub[gameCooltip.Indexes][8] = overlayColor or defaultWhiteColor gameCooltip.TopIconTableSub[gameCooltip.Indexes][9] = desaturated + gameCooltip.TopIconTableSub[gameCooltip.Indexes][10] = mask return end @@ -3280,6 +3309,7 @@ function DF:CreateCoolTip() iconTable[7] = bottomCoord or 1 --default 1 iconTable[8] = overlayColor or defaultWhiteColor --default 1, 1, 1 iconTable[9] = desaturated + iconTable[10] = mask return true end diff --git a/Libs/DF/fw.lua b/Libs/DF/fw.lua index ea8b3c053..ca68c24c3 100644 --- a/Libs/DF/fw.lua +++ b/Libs/DF/fw.lua @@ -1,6 +1,6 @@ -local dversion = 519 +local dversion = 520 local major, minor = "DetailsFramework-1.0", dversion local DF, oldminor = LibStub:NewLibrary(major, minor) diff --git a/boot.lua b/boot.lua index 0cb709341..988d3ed27 100644 --- a/boot.lua +++ b/boot.lua @@ -65,6 +65,8 @@ return Details.gameVersionPrefix .. " " .. Details.build_counter .. " " .. alphaId .. " " .. Details.game_version .. "" end + Details.DefaultTooltipIconSize = 20 + --namespace for the player breakdown window Details.PlayerBreakdown = {} Details222.PlayerBreakdown = { diff --git a/classes/class_damage.lua b/classes/class_damage.lua index 7705c5ea1..a486388fa 100644 --- a/classes/class_damage.lua +++ b/classes/class_damage.lua @@ -738,17 +738,22 @@ end bs_tooltip_table = Targets bs_tooltip_table.damage_total = total + --Details:FormatCooltipForSpells() GameCooltip:SetOption("StatusBarTexture", "Interface\\AddOns\\Details\\images\\bar_serenity") local spellname, _, spellicon = select(1, _GetSpellInfo(from_spell)) - GameCooltip:AddLine(spellname .. " " .. Loc ["STRING_CUSTOM_ATTRIBUTE_DAMAGE"], nil, nil, headerColor, nil, 10) - GameCooltip:AddIcon (spellicon, 1, 1, 14, 14, 0.078125, 0.921875, 0.078125, 0.921875) - GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_shift]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay2) - Details:AddTooltipHeaderStatusbar (1, 1, 1, 0.5) + --GameCooltip:AddLine(spellname .. " " .. Loc ["STRING_CUSTOM_ATTRIBUTE_DAMAGE"], nil, nil, headerColor, nil, 10) + --GameCooltip:AddIcon (spellicon, 1, 1, 14, 14, 0.078125, 0.921875, 0.078125, 0.921875) + --GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_shift]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay2) + --Details:AddTooltipHeaderStatusbar (1, 1, 1, 0.5) local top = Targets[1] and Targets[1][2] - local lineHeight = Details.tooltip.line_height + local iconSize = Details.DefaultTooltipIconSize + GameCooltip:SetOption("AlignAsBlizzTooltip", false) + GameCooltip:SetOption("AlignAsBlizzTooltipFrameHeightOffset", -6) + GameCooltip:SetOption("YSpacingMod", -6) + GameCooltip:ShowRoundedCorner() for index, t in ipairs(Targets) do GameCooltip:AddLine(Details:GetOnlyName(t[1]), Details:ToK(t[2]) .. " (" .. format("%.1f", t[2]/total*100) .. "%)") @@ -760,24 +765,22 @@ end local specID = Details:GetSpec(t[1]) if (specID) then local texture, l, r, t, b = Details:GetSpecIcon (specID, false) - GameCooltip:AddIcon (texture, 1, 1, lineHeight, lineHeight, l, r, t, b) + GameCooltip:AddIcon (texture, 1, 1, iconSize, iconSize, l, r, t, b) else local texture, l, r, t, b = Details:GetClassIcon(class) - GameCooltip:AddIcon ("Interface\\AddOns\\Details\\images\\classes_small_alpha", 1, 1, lineHeight, lineHeight, l, r, t, b) + GameCooltip:AddIcon ("Interface\\AddOns\\Details\\images\\classes_small_alpha", 1, 1,iconSize,iconSize, l, r, t, b) end elseif (t[1] == Loc ["STRING_TARGETS_OTHER1"]) then - GameCooltip:AddIcon ("Interface\\AddOns\\Details\\images\\classes_small_alpha", 1, 1, lineHeight, lineHeight, 0.25, 0.49609375, 0.75, 1) + GameCooltip:AddIcon ("Interface\\AddOns\\Details\\images\\classes_small_alpha", 1, 1,iconSize,iconSize, 0.25, 0.49609375, 0.75, 1) end end GameCooltip:AddLine(" ") Details:AddTooltipReportLineText() - GameCooltip:SetOption("YSpacingMod", 0) GameCooltip:SetOwner(thisLine) GameCooltip:Show() - end local function RefreshBarraBySpell (tabela, barra, instancia) @@ -1175,9 +1178,15 @@ end _table_sort(damage_taken_table, Details.Sort2) - Details:AddTooltipSpellHeaderText (Loc ["STRING_DAMAGE_FROM"], headerColor, #damage_taken_table, [[Interface\Addons\Details\images\icons]], 0.126953125, 0.1796875, 0, 0.0546875) - Details:AddTooltipHeaderStatusbar (1, 1, 1, 0.5) - GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_shift]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay2) + local iconSize = Details.DefaultTooltipIconSize + GameCooltip:SetOption("AlignAsBlizzTooltip", false) + GameCooltip:SetOption("AlignAsBlizzTooltipFrameHeightOffset", -6) + GameCooltip:SetOption("YSpacingMod", -6) + GameCooltip:ShowRoundedCorner() + + --Details:AddTooltipSpellHeaderText (Loc ["STRING_DAMAGE_FROM"], headerColor, #damage_taken_table, [[Interface\Addons\Details\images\icons]], 0.126953125, 0.1796875, 0, 0.0546875) + --Details:AddTooltipHeaderStatusbar (1, 1, 1, 0.5) + --GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_shift]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay2) local min = 6 local ismaximized = false @@ -1188,9 +1197,9 @@ end end if (ismaximized) then - GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_shift]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay2) + --GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_shift]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay2) else - GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_shift]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay1) + --GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_shift]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay1) end local top = damage_taken_table[1] and damage_taken_table[1][2] @@ -1210,15 +1219,15 @@ end end if (classe == "UNKNOW") then - GameCooltip:AddIcon ("Interface\\LFGFRAME\\LFGROLE_BW", nil, nil, lineHeight, lineHeight, .25, .5, 0, 1) + GameCooltip:AddIcon ("Interface\\LFGFRAME\\LFGROLE_BW", nil, nil, iconSize, iconSize, .25, .5, 0, 1) else local specID = Details:GetSpec(t[1]) if (specID) then local texture, l, r, t, b = Details:GetSpecIcon (specID, false) - GameCooltip:AddIcon (texture, 1, 1, lineHeight, lineHeight, l, r, t, b) + GameCooltip:AddIcon (texture, 1, 1, iconSize, iconSize, l, r, t, b) else - GameCooltip:AddIcon ([[Interface\AddOns\Details\images\classes_small_alpha]], nil, nil, lineHeight, lineHeight, unpack(Details.class_coords [classe])) + GameCooltip:AddIcon ([[Interface\AddOns\Details\images\classes_small_alpha]], nil, nil, iconSize, iconSize, unpack(Details.class_coords [classe])) end end @@ -1591,9 +1600,9 @@ end local GameCooltip = GameCooltip local spellname, _, spellicon = _GetSpellInfo(actor.damage_spellid) - Details:AddTooltipSpellHeaderText (spellname .. " " .. Loc ["STRING_VOIDZONE_TOOLTIP"], headerColor, #tooltip_void_zone_temp, spellicon, 0.078125, 0.921875, 0.078125, 0.921875) - Details:AddTooltipHeaderStatusbar (1, 1, 1, 0.5) - GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_shift]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay2) + --Details:AddTooltipSpellHeaderText (spellname .. " " .. Loc ["STRING_VOIDZONE_TOOLTIP"], headerColor, #tooltip_void_zone_temp, spellicon, 0.078125, 0.921875, 0.078125, 0.921875) + --Details:AddTooltipHeaderStatusbar (1, 1, 1, 0.5) + --GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_shift]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay2) --for target_name, debuff_table in pairs(container) do local first = tooltip_void_zone_temp [1] and tooltip_void_zone_temp [1][3] @@ -1604,7 +1613,13 @@ end tooltip_void_zone_temp.spellid = actor.damage_spellid tooltip_void_zone_temp.current_actor = actor - local lineHeight = Details.tooltip.line_height + local iconSize = Details.DefaultTooltipIconSize + GameCooltip:SetOption("AlignAsBlizzTooltip", false) + GameCooltip:SetOption("AlignAsBlizzTooltipFrameHeightOffset", -6) + GameCooltip:SetOption("YSpacingMod", -6) + GameCooltip:ShowRoundedCorner() + + --local lineHeight = Details.tooltip.line_height for index, t in ipairs(tooltip_void_zone_temp) do @@ -1626,12 +1641,12 @@ end local specID = Details:GetSpec(t[1]) if (specID) then local texture, l, r, t, b = Details:GetSpecIcon (specID, false) - GameCooltip:AddIcon (texture, 1, 1, lineHeight, lineHeight, l, r, t, b) + GameCooltip:AddIcon (texture, 1, 1, iconSize, iconSize, l, r, t, b) else - GameCooltip:AddIcon ([[Interface\AddOns\Details\images\classes_small_alpha]], nil, nil, lineHeight, lineHeight, unpack(Details.class_coords [classe])) + GameCooltip:AddIcon ([[Interface\AddOns\Details\images\classes_small_alpha]], nil, nil, iconSize, iconSize, unpack(Details.class_coords [classe])) end else - GameCooltip:AddIcon ("Interface\\LFGFRAME\\LFGROLE_BW", nil, nil, lineHeight, lineHeight, .25, .5, 0, 1) + GameCooltip:AddIcon ("Interface\\LFGFRAME\\LFGROLE_BW", nil, nil, iconSize, iconSize, .25, .5, 0, 1) end local _, _, _, _, _, r, g, b = Details:GetClass(t[1]) @@ -3933,15 +3948,15 @@ function damageClass:ToolTip_DamageDone (instancia, numero, barra, keydown) end --MOSTRA HABILIDADES - Details:AddTooltipSpellHeaderText (Loc ["STRING_SPELLS"], headerColor, #ActorSkillsSortTable, Details.tooltip_spell_icon.file, unpack(Details.tooltip_spell_icon.coords)) + --Details:AddTooltipSpellHeaderText (Loc ["STRING_SPELLS"], headerColor, #ActorSkillsSortTable, Details.tooltip_spell_icon.file, unpack(Details.tooltip_spell_icon.coords)) if (is_maximized) then --highlight shift key - GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_shift]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay2) - Details:AddTooltipHeaderStatusbar (r, g, b, 1) + --GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_shift]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay2) + --Details:AddTooltipHeaderStatusbar (r, g, b, 1) else - GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_shift]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay1) - Details:AddTooltipHeaderStatusbar (r, g, b, barAlha) + --GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_shift]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay1) + --Details:AddTooltipHeaderStatusbar (r, g, b, barAlha) end local topAbility = ActorSkillsSortTable [1] and ActorSkillsSortTable [1][2] or 0.0001 @@ -4277,84 +4292,89 @@ function damageClass:ReportSingleFragsLine (frag, instance, ShiftKeyDown, Contro return Details:Reportar (report_table, {_no_current = true, _no_inverse = true, _custom = true}) end -function damageClass:ToolTip_Enemies (instancia, numero, barra, keydown) - - local owner = self.owner - if (owner and owner.classe) then - r, g, b = unpack(Details.class_colors [owner.classe]) +---@param self actor +---@param instanceObject instance +function damageClass:ToolTip_Enemies(instanceObject, numero, barra, keydown) + --check if the actor has an owner, if it does, it's a pet + local ownerObject = self.owner + if (ownerObject and ownerObject.classe) then + r, g, b = unpack(Details.class_colors[ownerObject.classe]) else - r, g, b = unpack(Details.class_colors [self.classe]) + r, g, b = unpack(Details.class_colors[self.classe]) end - local combat = instancia:GetShowingCombat() - local enemy_name = self:name() + local combatObject = instanceObject:GetCombat() + local enemyName = self:Name() Details:Destroy(tooltip_temp_table) --fix for translit bug report, 'player' is nil --enemy damage taken local i = 1 - local damage_taken = 0 - for _, actor in ipairs(combat[1]._ActorTable) do - if (actor.grupo and actor.targets [self.nome]) then - local t = tooltip_temp_table [i] - if (not t) then - tooltip_temp_table [i] = {} - t = tooltip_temp_table [i] + local damageTaken = 0 + ---@type actorcontainer + local damageContainer = combatObject:GetContainer(DETAILS_ATTRIBUTE_DAMAGE) + + ---@type number, actor + for idx, actor in damageContainer:ListActors() do + if (actor:IsGroupPlayer() and actor.targets[enemyName]) then + ---@type table + local agressorsTable = tooltip_temp_table[i] + + if (not agressorsTable) then + tooltip_temp_table[i] = {} + agressorsTable = tooltip_temp_table[i] end - t [1] = actor - t [2] = actor.targets [enemy_name] or 0 - damage_taken = damage_taken + t [2] + + agressorsTable[1] = actor + agressorsTable[2] = (actor.targets[enemyName]) or 0 + damageTaken = damageTaken + agressorsTable[2] + i = i + 1 end end for o = i, #tooltip_temp_table do - local t = tooltip_temp_table [o] + local t = tooltip_temp_table[o] t[2] = 0 t[1] = 0 end _table_sort(tooltip_temp_table, Details.Sort2) - -- enemy damage taken - Details:AddTooltipSpellHeaderText (Loc ["STRING_DAMAGE_TAKEN_FROM"], headerColor, i-1, [[Interface\Buttons\UI-MicroStream-Red]], 0.1875, 0.8125, 0.15625, 0.78125) - GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_shift]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay2) - - Details:AddTooltipHeaderStatusbar (1, 1, 1, 0.5) - --build the tooltip - local top = (tooltip_temp_table [1] and tooltip_temp_table [1][2]) or 0 - tooltip_temp_table.damage_total = damage_taken + local top = (tooltip_temp_table[1] and tooltip_temp_table[1][2]) or 0 + tooltip_temp_table.damage_total = damageTaken - local lineHeight = Details.tooltip.line_height + local iconSize = Details.DefaultTooltipIconSize + GameCooltip:SetOption("AlignAsBlizzTooltip", false) + GameCooltip:SetOption("YSpacingMod", -6) for o = 1, i-1 do + local actorAggressor = tooltip_temp_table[o][1] + local damageDone = tooltip_temp_table[o][2] + local playerName = Details:GetOnlyName(actorAggressor:name()) - local player = tooltip_temp_table [o][1] - local total = tooltip_temp_table [o][2] - local player_name = Details:GetOnlyName(player:name()) + GameCooltip:AddLine(playerName .. " ", FormatTooltipNumber (_, damageDone) .." (" .. format("%.1f", (damageDone / damageTaken) * 100) .. "%)") - GameCooltip:AddLine(player_name .. " ", FormatTooltipNumber (_, total) .." (" .. format("%.1f", (total / damage_taken) * 100) .. "%)") - - local classe = player:class() + local classe = actorAggressor:class() if (not classe) then classe = "UNKNOW" end + if (classe == "UNKNOW") then - GameCooltip:AddIcon ("Interface\\LFGFRAME\\LFGROLE_BW", nil, nil, lineHeight, lineHeight, .25, .5, 0, 1) + GameCooltip:AddIcon("Interface\\LFGFRAME\\LFGROLE_BW", nil, nil, iconSize, iconSize, .25, .5, 0, 1) else - local specID = player.spec + local specID = actorAggressor.spec if (specID) then - local texture, l, r, t, b = Details:GetSpecIcon (specID, false) - GameCooltip:AddIcon (texture, 1, 1, lineHeight, lineHeight, l, r, t, b) + local texture, l, r, t, b = Details:GetSpecIcon(specID, false) + GameCooltip:AddIcon(texture, 1, 1, iconSize, iconSize, l, r, t, b) else - GameCooltip:AddIcon (instancia.row_info.icon_file, nil, nil, lineHeight, lineHeight, unpack(Details.class_coords [classe])) + GameCooltip:AddIcon(instanceObject.row_info.icon_file, nil, nil, iconSize, iconSize, unpack(Details.class_coords [classe])) end end - local r, g, b = unpack(Details.class_colors [classe]) - GameCooltip:AddStatusBar (total/top*100, 1, r, g, b, 1, false, enemies_background) - + local r, g, b = unpack(Details.class_colors[classe]) + GameCooltip:AddStatusBar(damageDone/top*100, 1, r, g, b, 1, false, enemies_background) end GameCooltip:SetOption("StatusBarTexture", "Interface\\AddOns\\Details\\images\\bar_serenity") @@ -4363,23 +4383,21 @@ function damageClass:ToolTip_Enemies (instancia, numero, barra, keydown) GameCooltip:AddLine(" ") GameCooltip:AddLine(Loc ["STRING_ATTRIBUTE_DAMAGE_ENEMIES_DONE"], FormatTooltipNumber (_, _math_floor(self.total))) local half = 0.00048828125 - GameCooltip:AddIcon (instancia:GetSkinTexture(), 1, 1, 14, 14, 0.005859375 + half, 0.025390625 - half, 0.3623046875, 0.3818359375) + GameCooltip:AddIcon (instanceObject:GetSkinTexture(), 1, 1, 14, 14, 0.005859375 + half, 0.025390625 - half, 0.3623046875, 0.3818359375) GameCooltip:AddStatusBar (0, 1, r, g, b, 1, false, enemies_background) - local heal_actor = instancia.showing (2, self.nome) + local heal_actor = instanceObject.showing (2, self.nome) if (heal_actor) then GameCooltip:AddLine(Loc ["STRING_ATTRIBUTE_HEAL_ENEMY"], FormatTooltipNumber (_, _math_floor(heal_actor.heal_enemy_amt))) else GameCooltip:AddLine(Loc ["STRING_ATTRIBUTE_HEAL_ENEMY"], 0) end - GameCooltip:AddIcon (instancia:GetSkinTexture(), 1, 1, 14, 14, 0.037109375 + half, 0.056640625 - half, 0.3623046875, 0.3818359375) + GameCooltip:AddIcon (instanceObject:GetSkinTexture(), 1, 1, 14, 14, 0.037109375 + half, 0.056640625 - half, 0.3623046875, 0.3818359375) GameCooltip:AddStatusBar (0, 1, r, g, b, 1, false, enemies_background) GameCooltip:AddLine(" ") Details:AddTooltipReportLineText() - GameCooltip:SetOption("YSpacingMod", 0) - return true end @@ -4461,31 +4479,36 @@ function damageClass:ToolTip_DamageTaken(instance, numero, barra, keydown) end if (subAttribute == DETAILS_SUBATTRIBUTE_ENEMIES) then - Details:AddTooltipSpellHeaderText(Loc ["STRING_DAMAGE_TAKEN_FROM"], headerColor, #damageTakenDataSorted, [[Interface\Buttons\UI-MicroStream-Red]], 0.1875, 0.8125, 0.15625, 0.78125) + --Details:AddTooltipSpellHeaderText(Loc ["STRING_DAMAGE_TAKEN_FROM"], headerColor, #damageTakenDataSorted, [[Interface\Buttons\UI-MicroStream-Red]], 0.1875, 0.8125, 0.15625, 0.78125) else - Details:AddTooltipSpellHeaderText(Loc ["STRING_FROM"], headerColor, #damageTakenDataSorted, [[Interface\Addons\Details\images\icons]], 0.126953125, 0.1796875, 0, 0.0546875) + --Details:AddTooltipSpellHeaderText(Loc ["STRING_FROM"], headerColor, #damageTakenDataSorted, [[Interface\Addons\Details\images\icons]], 0.126953125, 0.1796875, 0, 0.0546875) end if (bIsMaximized) then --highlight - GameCooltip:AddIcon([[Interface\AddOns\Details\images\key_shift]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay2) - if (subAttribute == DETAILS_SUBATTRIBUTE_ENEMIES) then - GameCooltip:AddStatusBar(100, 1, 0.7, g, b, 1) - else - Details:AddTooltipHeaderStatusbar(r, g, b, 1) - end + --GameCooltip:AddIcon([[Interface\AddOns\Details\images\key_shift]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay2) + --if (subAttribute == DETAILS_SUBATTRIBUTE_ENEMIES) then + -- GameCooltip:AddStatusBar(100, 1, 0.7, g, b, 1) + --else + -- Details:AddTooltipHeaderStatusbar(r, g, b, 1) + --end else - GameCooltip:AddIcon([[Interface\AddOns\Details\images\key_shift]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay1) - if (subAttribute == DETAILS_SUBATTRIBUTE_ENEMIES) then - GameCooltip:AddStatusBar(100, 1, 0.7, 0, 0, barAlha) - else - Details:AddTooltipHeaderStatusbar(r, g, b, barAlha) - end + --GameCooltip:AddIcon([[Interface\AddOns\Details\images\key_shift]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay1) + --if (subAttribute == DETAILS_SUBATTRIBUTE_ENEMIES) then + -- GameCooltip:AddStatusBar(100, 1, 0.7, 0, 0, barAlha) + --else + -- Details:AddTooltipHeaderStatusbar(r, g, b, barAlha) + --end end - local iconSize = Details.tooltip.icon_size + --local iconSize = Details.tooltip.icon_size local iconBorderTexCoord = Details.tooltip.icon_border_texcoord + GameCooltip:SetOption("AlignAsBlizzTooltip", false) + GameCooltip:SetOption("AlignAsBlizzTooltipFrameHeightOffset", -6) + GameCooltip:SetOption("YSpacingMod", -6) + local iconSize = Details.DefaultTooltipIconSize + -- create a full list of incoming damage, before adding any lines to the tooltip, so we can sort them appropriately ---@class cooltip_icon @@ -4534,7 +4557,7 @@ function damageClass:ToolTip_DamageTaken(instance, numero, barra, keydown) local spellName, _, spellIcon = _GetSpellInfo(spellId) local addTextArgs = {spellName .. " (|cFFFFFF00" .. thisActorName .. "|r)", Details:Format(valueAmount) .. " (" .. string.format("%.1f", (valueAmount / totalDamageTaken) * 100) .. "%)"} ---@type cooltip_icon - local addIconArgs = {spellIcon, 1, 1, iconSize.W, iconSize.H, iconBorderTexCoord.L, iconBorderTexCoord.R, iconBorderTexCoord.T, iconBorderTexCoord.B} + local addIconArgs = {spellIcon, 1, 1, iconSize, iconSize, iconBorderTexCoord.L, iconBorderTexCoord.R, iconBorderTexCoord.T, iconBorderTexCoord.B} tinsert(lines_to_add, { valueAmount, @@ -4567,9 +4590,9 @@ function damageClass:ToolTip_DamageTaken(instance, numero, barra, keydown) end if (class == "UNKNOW") then - addIconArgs = {"Interface\\LFGFRAME\\LFGROLE_BW", nil, nil, iconSize.W, iconSize.H, .25, .5, 0, 1} + addIconArgs = {"Interface\\LFGFRAME\\LFGROLE_BW", nil, nil, iconSize, iconSize, .25, .5, 0, 1} else - addIconArgs= {instance.row_info.icon_file, nil, nil, iconSize.W, iconSize.H, unpack(Details.class_coords [class])} + addIconArgs= {instance.row_info.icon_file, nil, nil, iconSize, iconSize, unpack(Details.class_coords [class])} end tinsert(lines_to_add, {amount, addLineArgs, addIconArgs}) end @@ -4587,7 +4610,7 @@ function damageClass:ToolTip_DamageTaken(instance, numero, barra, keydown) GameCooltip:AddLine(" ") GameCooltip:AddLine(Loc ["STRING_ATTRIBUTE_DAMAGE_DONE"], FormatTooltipNumber (_, _math_floor(self.total))) local half = 0.00048828125 - GameCooltip:AddIcon (instance:GetSkinTexture(), 1, 1, iconSize.W, iconSize.H, 0.005859375 + half, 0.025390625 - half, 0.3623046875, 0.3818359375) + GameCooltip:AddIcon (instance:GetSkinTexture(), 1, 1, iconSize, iconSize, 0.005859375 + half, 0.025390625 - half, 0.3623046875, 0.3818359375) Details:AddTooltipBackgroundStatusbar() local heal_actor = instance.showing (2, self.nome) @@ -4596,7 +4619,7 @@ function damageClass:ToolTip_DamageTaken(instance, numero, barra, keydown) else GameCooltip:AddLine(Loc ["STRING_ATTRIBUTE_HEAL_DONE"], 0) end - GameCooltip:AddIcon (instance:GetSkinTexture(), 1, 1, iconSize.W, iconSize.H, 0.037109375 + half, 0.056640625 - half, 0.3623046875, 0.3818359375) + GameCooltip:AddIcon (instance:GetSkinTexture(), 1, 1, iconSize, iconSize, 0.037109375 + half, 0.056640625 - half, 0.3623046875, 0.3818359375) Details:AddTooltipBackgroundStatusbar() end diff --git a/classes/class_heal.lua b/classes/class_heal.lua index 6baffba1d..22c2c10b9 100644 --- a/classes/class_heal.lua +++ b/classes/class_heal.lua @@ -1062,17 +1062,17 @@ function healingClass:ToolTip_HealingDenied (instancia, numero, barra, keydown) --Spells table.sort (spellList, _detalhes.Sort2) - _detalhes:AddTooltipSpellHeaderText ("Spells", headerColor, #spellList, [[Interface\TUTORIALFRAME\UI-TutorialFrame-LevelUp]], 0.10546875, 0.89453125, 0.05859375, 0.6796875) - _detalhes:AddTooltipHeaderStatusbar (r, g, b, barAlha) + --_detalhes:AddTooltipSpellHeaderText ("Spells", headerColor, #spellList, [[Interface\TUTORIALFRAME\UI-TutorialFrame-LevelUp]], 0.10546875, 0.89453125, 0.05859375, 0.6796875) + --_detalhes:AddTooltipHeaderStatusbar (r, g, b, barAlha) local ismaximized = false if (keydown == "shift" or TooltipMaximizedMethod == 2 or TooltipMaximizedMethod == 3) then - GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_shift]], 1, 2, _detalhes.tooltip_key_size_width, _detalhes.tooltip_key_size_height, 0, 1, 0, 0.640625, _detalhes.tooltip_key_overlay2) - _detalhes:AddTooltipHeaderStatusbar (r, g, b, 1) + --GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_shift]], 1, 2, _detalhes.tooltip_key_size_width, _detalhes.tooltip_key_size_height, 0, 1, 0, 0.640625, _detalhes.tooltip_key_overlay2) + --_detalhes:AddTooltipHeaderStatusbar (r, g, b, 1) ismaximized = true else - GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_shift]], 1, 2, _detalhes.tooltip_key_size_width, _detalhes.tooltip_key_size_height, 0, 1, 0, 0.640625, _detalhes.tooltip_key_overlay1) - _detalhes:AddTooltipHeaderStatusbar (r, g, b, barAlha) + --GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_shift]], 1, 2, _detalhes.tooltip_key_size_width, _detalhes.tooltip_key_size_height, 0, 1, 0, 0.640625, _detalhes.tooltip_key_overlay1) + --_detalhes:AddTooltipHeaderStatusbar (r, g, b, barAlha) end local tooltip_max_abilities = _detalhes.tooltip.tooltip_max_abilities @@ -1239,18 +1239,18 @@ function healingClass:ToolTip_HealingTaken (instancia, numero, barra, keydown) end end - _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_FROM"], headerColor, #meus_curadores, [[Interface\TUTORIALFRAME\UI-TutorialFrame-LevelUp]], 0.10546875, 0.89453125, 0.05859375, 0.6796875) - _detalhes:AddTooltipHeaderStatusbar (r, g, b, barAlha) + --_detalhes:AddTooltipSpellHeaderText (Loc ["STRING_FROM"], headerColor, #meus_curadores, [[Interface\TUTORIALFRAME\UI-TutorialFrame-LevelUp]], 0.10546875, 0.89453125, 0.05859375, 0.6796875) + --_detalhes:AddTooltipHeaderStatusbar (r, g, b, barAlha) local ismaximized = false if (keydown == "shift" or TooltipMaximizedMethod == 2 or TooltipMaximizedMethod == 3) then - GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_shift]], 1, 2, _detalhes.tooltip_key_size_width, _detalhes.tooltip_key_size_height, 0, 1, 0, 0.640625, _detalhes.tooltip_key_overlay2) - _detalhes:AddTooltipHeaderStatusbar (r, g, b, 1) + --GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_shift]], 1, 2, _detalhes.tooltip_key_size_width, _detalhes.tooltip_key_size_height, 0, 1, 0, 0.640625, _detalhes.tooltip_key_overlay2) + --_detalhes:AddTooltipHeaderStatusbar (r, g, b, 1) ismaximized = true else - GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_shift]], 1, 2, _detalhes.tooltip_key_size_width, _detalhes.tooltip_key_size_height, 0, 1, 0, 0.640625, _detalhes.tooltip_key_overlay1) - _detalhes:AddTooltipHeaderStatusbar (r, g, b, barAlha) + --GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_shift]], 1, 2, _detalhes.tooltip_key_size_width, _detalhes.tooltip_key_size_height, 0, 1, 0, 0.640625, _detalhes.tooltip_key_overlay1) + --_detalhes:AddTooltipHeaderStatusbar (r, g, b, barAlha) end _table_sort (meus_curadores, function(a, b) return a[2] > b[2] end) @@ -1385,16 +1385,16 @@ function healingClass:ToolTip_HealingDone (instancia, numero, barra, keydown) _table_sort (ActorHealingTargets, _detalhes.Sort2) --Mostra as habilidades no tooltip - _detalhes:AddTooltipSpellHeaderText (Loc ["STRING_SPELLS"], headerColor, #ActorHealingTable, [[Interface\RAIDFRAME\Raid-Icon-Rez]], 0.109375, 0.890625, 0.0625, 0.90625) + --_detalhes:AddTooltipSpellHeaderText (Loc ["STRING_SPELLS"], headerColor, #ActorHealingTable, [[Interface\RAIDFRAME\Raid-Icon-Rez]], 0.109375, 0.890625, 0.0625, 0.90625) local ismaximized = false if (keydown == "shift" or TooltipMaximizedMethod == 2 or TooltipMaximizedMethod == 3) then - GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_shift]], 1, 2, _detalhes.tooltip_key_size_width, _detalhes.tooltip_key_size_height, 0, 1, 0, 0.640625, _detalhes.tooltip_key_overlay2) - _detalhes:AddTooltipHeaderStatusbar (r, g, b, 1) + --GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_shift]], 1, 2, _detalhes.tooltip_key_size_width, _detalhes.tooltip_key_size_height, 0, 1, 0, 0.640625, _detalhes.tooltip_key_overlay2) + --_detalhes:AddTooltipHeaderStatusbar (r, g, b, 1) ismaximized = true else - GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_shift]], 1, 2, _detalhes.tooltip_key_size_width, _detalhes.tooltip_key_size_height, 0, 1, 0, 0.640625, _detalhes.tooltip_key_overlay1) - _detalhes:AddTooltipHeaderStatusbar (r, g, b, barAlha) + --GameCooltip:AddIcon ([[Interface\AddOns\Details\images\key_shift]], 1, 2, _detalhes.tooltip_key_size_width, _detalhes.tooltip_key_size_height, 0, 1, 0, 0.640625, _detalhes.tooltip_key_overlay1) + --_detalhes:AddTooltipHeaderStatusbar (r, g, b, barAlha) end local tooltip_max_abilities = _detalhes.tooltip.tooltip_max_abilities diff --git a/core/control.lua b/core/control.lua index a950bb59d..667f53229 100644 --- a/core/control.lua +++ b/core/control.lua @@ -1586,10 +1586,10 @@ GameCooltip:SetOption("TextColorRight", Details.tooltip.fontcolor_right) GameCooltip:SetOption("TextShadow", Details.tooltip.fontshadow and "OUTLINE") - GameCooltip:SetOption("LeftBorderSize", -5) - GameCooltip:SetOption("RightBorderSize", 5) - GameCooltip:SetOption("RightTextMargin", 0) - GameCooltip:SetOption("VerticalOffset", 9) + GameCooltip:SetOption("LeftBorderSize", -2) --offset between the left border and the left icon, default: 10 + offset + GameCooltip:SetOption("RightBorderSize", 2) --offset between the right border and the right icon, default: -10 + offset + GameCooltip:SetOption("VerticalOffset", 5) --amount of space to leave between the top border and the first line of the tooltip, default: 0 + GameCooltip:SetOption("RightTextMargin", 0) --offset between the right text to the right icon, default: -3 GameCooltip:SetOption("AlignAsBlizzTooltip", true) GameCooltip:SetOption("AlignAsBlizzTooltipFrameHeightOffset", -8) GameCooltip:SetOption("LineHeightSizeOffset", 4) @@ -1670,6 +1670,7 @@ end end + GameCooltip:ShowRoundedCorner() GameCooltip:ShowCooltip() end end @@ -1843,12 +1844,8 @@ if (not panel) then panel = CreateFrame("frame", "DetailsEraseDataConfirmation", UIParent, "BackdropTemplate") panel:SetSize(400, 85) - --panel:SetBackdrop({bgFile = [[Interface\AddOns\Details\images\background]], tile = true, tileSize = 16, - --edgeFile = [[Interface\AddOns\Details\images\border_2]], edgeSize = 12}) - --panel:SetBackdropColor(0, 0, 0, 0.4) panel:SetPoint("center", UIParent) - --DetailsFramework:ApplyStandardBackdrop(panel) DetailsFramework:AddRoundedCornersToFrame(panel, Details.PlayerBreakdown.RoundedCornerPreset) local LibWindow = LibStub("LibWindow-1.1") diff --git a/frames/window_main.lua b/frames/window_main.lua index 05a34b8de..4294938d7 100644 --- a/frames/window_main.lua +++ b/frames/window_main.lua @@ -9057,7 +9057,7 @@ end Details:SetMenuOwner(self, self.instance) gameCooltip:ShowRoundedCorner() - + gameCooltip:ShowCooltip() end diff --git a/frames/window_switch.lua b/frames/window_switch.lua index 3fa1b5929..466647b32 100644 --- a/frames/window_switch.lua +++ b/frames/window_switch.lua @@ -38,10 +38,7 @@ function Details222.CreateAllDisplaysFrame() DetailsSwitchPanel.all_switch = allDisplaysFrame detailsFramework:AddRoundedCornersToFrame(allDisplaysFrame, Details.PlayerBreakdown.RoundedCornerPreset) - - --DetailsFramework:ApplyStandardBackdrop(allDisplaysFrame) - --allDisplaysFrame.BackgroundGradientTexture = DetailsFramework:CreateTexture(allDisplaysFrame, {gradient = "vertical", fromColor = "transparent", toColor = {0, 0, 0, 0.2}}, 1, 1, "artwork", {0, 1, 0, 1}) - --allDisplaysFrame.BackgroundGradientTexture:SetAllPoints() + Details:RegisterFrameToColor(allDisplaysFrame) allDisplaysFrame:SetScript("OnMouseDown", function(self, button) if (button == "RightButton") then