From b1a7c5e278184570142eea15f56e26123fb3164c Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Sun, 3 Mar 2024 15:18:10 -0300 Subject: [PATCH] Applied a round of polishing to the Breakdown Window --- Definitions.lua | 4 +- Libs/DF/definitions.lua | 2 + Libs/DF/fw.lua | 15 +++- Libs/DF/panel.lua | 14 +++- Libs/DF/picture.lua | 21 +++++ Libs/DF/slider.lua | 57 ++++++++++++- Libs/LibLuaServer/LibLuaServer.lua | 1 + classes/class_combat.lua | 14 ++-- .../breakdown_spells_spellframes.lua | 1 + .../window_playerbreakdown_auras.lua | 12 ++- .../window_playerbreakdown_list.lua | 22 ++++- frames/window_main.lua | 8 +- functions/profiles.lua | 25 ++++-- plugins/Details_Compare2/Details_Compare2.lua | 84 +++++++++++++++++-- 14 files changed, 246 insertions(+), 34 deletions(-) diff --git a/Definitions.lua b/Definitions.lua index 2a122a860..a7a3437ca 100644 --- a/Definitions.lua +++ b/Definitions.lua @@ -257,7 +257,7 @@ ---@field GetMSTime fun(combat: combat) : number, number ---@field GetSegmentSlotId fun(combat: combat) : segmentid ---@field GetCombatName fun(combat: combat, bOnlyName: boolean?, bTryFind: boolean?) : string, number?, number?, number?, number? get the name of the combat ----@field GetCombatIcon fun(combat: combat) : df_atlasinfo +---@field GetCombatIcon fun(combat: combat) : df_atlasinfo, df_atlasinfo? ---@field GetTrinketProcsForPlayer fun(self: combat, playerName: string) : table return a key|value table containing the spellId as key and a table with information about the trinket as value ---@field IsMythicDungeon fun(combat: combat) : boolean, number return a boolean indicating if the combat is from a mythic+ dungeon, if true, also return the runId ---@field GetMythicDungeonInfo fun(combat: combat) : mythicdungeoninfo @@ -546,6 +546,7 @@ ---@class breakdownsegmentline : button ---@field segmentText df_label ---@field segmentIcon df_image +---@field segmentSubIcon df_image ---@field UpdateLine function ---@field combatUniqueID uniquecombatid ---@field isSelected boolean @@ -554,6 +555,7 @@ ---@field UID uniquecombatid ---@field combatName string ---@field combatIcon df_atlasinfo +---@field combatIcon2 df_atlasinfo? used for the second icon in the segment line, this shows the trash or boss icon where the primary icon shows the mythic+ icon for example ---@field r number ---@field g number ---@field b number diff --git a/Libs/DF/definitions.lua b/Libs/DF/definitions.lua index ee2314931..a739c7934 100644 --- a/Libs/DF/definitions.lua +++ b/Libs/DF/definitions.lua @@ -192,8 +192,10 @@ ---@field ParseTexture fun(self:table, texture:texturepath|textureid|atlasname|atlasinfo, width: number?, height: number?, leftTexCoord: number?, rightTexCoord: number?, topTexCoord: number?, bottomTexCoord: number?, vertexRed:number|string?, vertexGreenvertexRed:number?, vertexBluevertexRed:number?, vertexAlphavertexRed:number?) : any, number?, number?, number?, number?, number?, number?, number?, number?, number?, number?, number?, number? ---@field IsTexture fun(self:table, texture:any, bCheckTextureObject: boolean?) : boolean ---@field CreateAtlasString fun(self:table, atlas:atlasinfo|atlasname, textureHeight:number?, textureWidth:number?) : string +---@field SetMask fun(self:table, texture:texture, maskTexture:atlasname|texturepath|textureid) : nil ---@field + --[=[ Wrapped objects: when using the following functions, the object will be wrapped in a table, e.g. detailsFramework:CreateButton() will return a table with the button, the button will be accessible through the "button" key. The wrapper table will have the same metatable as the wrapped object, so you can call methods on the wrapper table as if it was the wrapped object. diff --git a/Libs/DF/fw.lua b/Libs/DF/fw.lua index 3114f177e..8c68c9b53 100644 --- a/Libs/DF/fw.lua +++ b/Libs/DF/fw.lua @@ -1,6 +1,6 @@ -local dversion = 517 +local dversion = 518 local major, minor = "DetailsFramework-1.0", dversion local DF, oldminor = LibStub:NewLibrary(major, minor) @@ -2694,6 +2694,19 @@ DF.slider_templates["OPTIONS_SLIDER_TEMPLATE"] = { thumbcolor = {0, 0, 0, 0.5}, } +DF.slider_templates["MODERN_SLIDER_TEMPLATE"] = { + thumbtexture = "Minimal_SliderBar_Button", --atlas name + thumbwidth = 20, + thumbheight = 19, + thumbcolor = {1, 1, 1, 0.924}, + slider_left = "Minimal_SliderBar_Left", + slider_right = "Minimal_SliderBar_Right", + slider_middle = "_Minimal_SliderBar_Middle", + amount_color = "white", + amount_size = 12, + amount_outline = "outline", +} + ---install a template ---@param widgetType string ---@param templateName string diff --git a/Libs/DF/panel.lua b/Libs/DF/panel.lua index 55615de61..1f03bfdcc 100644 --- a/Libs/DF/panel.lua +++ b/Libs/DF/panel.lua @@ -4229,9 +4229,18 @@ detailsFramework.RadioGroupCoreFunctions = { end if (optionTable.mask) then - checkbox.Icon:SetMask(optionTable.mask) + if (not checkbox.Icon.Mask) then + checkbox.Icon.Mask = checkbox:CreateMaskTexture(nil, "overlay") + checkbox.Icon.Mask:SetAllPoints(checkbox.Icon.widget) + checkbox.Icon.Mask:SetTexture(optionTable.mask) + checkbox.Icon:AddMaskTexture(checkbox.Icon.Mask) + end + checkbox.Icon.Mask:SetTexture(optionTable.mask) else - checkbox.Icon:SetMask("") + --checkbox.Icon:SetMask("") + if (checkbox.Icon.Mask) then + checkbox.Icon.Mask:SetTexture("") + end end else checkbox.Icon:SetTexture("") @@ -4324,6 +4333,7 @@ detailsFramework.RadioGroupCoreFunctions = { ---@field param any? ---@field texture string? ---@field texcoord table? +---@field mask any? ---@field width number? ---@field height number? ---@field text_size number? diff --git a/Libs/DF/picture.lua b/Libs/DF/picture.lua index c95f099ac..c06f7d759 100644 --- a/Libs/DF/picture.lua +++ b/Libs/DF/picture.lua @@ -493,6 +493,10 @@ function detailsFramework:SetAtlas(textureObject, atlas, useAtlasSize, filterMod textureObject:SetVertexColor(atlasInfo.vertexRed or 1, atlasInfo.vertexGreen or 1, atlasInfo.vertexBlue or 1, atlasInfo.vertexAlpha or 1) end end + + elseif (type(atlas) == "string" or type(atlas) == "number") then + ---@cast atlas string + textureObject:SetTexture(atlas) end end @@ -680,3 +684,20 @@ function detailsFramework:IsTexture(texture, bCheckTextureObject) return false end + +---Receives a texture object and a texture to use as mask +---If the mask texture is not created, it will be created and added to a key named MaskTexture +---@param self table +---@param texture texture +---@param maskTexture string|number +function detailsFramework:SetMask(texture, maskTexture) + if (not texture.MaskTexture) then + local parent = texture:GetParent() + local maskTextureObject = parent:CreateMaskTexture(nil, "artwork") + maskTextureObject:SetAllPoints(texture) + texture:AddMaskTexture(maskTextureObject) + texture.MaskTexture = maskTextureObject + end + texture.MaskTexture:SetTexture(maskTexture) +end + diff --git a/Libs/DF/slider.lua b/Libs/DF/slider.lua index ca8a6dd22..6004bf523 100644 --- a/Libs/DF/slider.lua +++ b/Libs/DF/slider.lua @@ -918,6 +918,7 @@ local set_as_checkbok = function(self) self.SetCheckedTexture = setCheckedTexture self.SetChecked = switch_set_value + self.GetChecked = switch_get_value self._thumb:Hide() self._text:Hide() @@ -1059,7 +1060,10 @@ function DFSliderMetaFunctions:SetTemplate(template) local templateName = template template = DF:GetTemplate("switch", templateName) if (not template) then - print("no template found", templateName) + template = DF:GetTemplate("slider", templateName) + if (not template) then + print("no template found", templateName) + end end end @@ -1096,9 +1100,30 @@ function DFSliderMetaFunctions:SetTemplate(template) if (template.thumbtexture) then if (self.thumb) then - self.thumb:SetTexture(template.thumbtexture) + DF:SetAtlas(self.thumb, template.thumbtexture) + end + end + + if (template.slider_left) then + if (self.slider_left) then + DF:SetAtlas(self.slider_left, template.slider_left) + end + end + + if (template.slider_right) then + if (self.slider_right) then + DF:SetAtlas(self.slider_right, template.slider_right) + end + end + + if (template.slider_middle) then + if (self.slider_middle) then + self:SetBackdrop(nil) + DF:SetAtlas(self.slider_middle, template.slider_middle) end end + + if (template.thumbwidth) then if (self.thumb) then self.thumb:SetWidth(template.thumbwidth) @@ -1116,6 +1141,18 @@ function DFSliderMetaFunctions:SetTemplate(template) end end + if (template.amount_color) then + DF:SetFontColor(self.amt, template.amount_color) + end + + if (template.amount_outline) then + DF:SetFontOutline(self.amt, template.amount_outline) + end + + if (template.amount_size) then + DF:SetFontSize(self.amt, template.amount_size) + end + --switch only if (template.enabled_backdropcolor) then local r, g, b, a = DF:ParseColors(template.enabled_backdropcolor) @@ -1261,6 +1298,22 @@ function DF:NewSlider (parent, container, name, member, width, height, minValue, SliderObject.slider:SetThumbTexture (SliderObject.thumb) SliderObject.slider.thumb = SliderObject.thumb + SliderObject.slider_left = SliderObject.slider:CreateTexture("$parentLeft", "artwork") + SliderObject.slider_left:SetPoint("topright", SliderObject.slider, "topleft", 0, 0) + SliderObject.slider_left:SetPoint("bottomright", SliderObject.slider, "bottomleft", 0, 0) + SliderObject.slider_left:SetWidth(11) + + SliderObject.slider_right = SliderObject.slider:CreateTexture("$parentRight", "artwork") + SliderObject.slider_right:SetPoint("topleft", SliderObject.slider, "topright", 0, 0) + SliderObject.slider_right:SetPoint("bottomleft", SliderObject.slider, "bottomright", 0, 0) + SliderObject.slider_right:SetWidth(11) + + SliderObject.slider_middle = SliderObject.slider:CreateTexture("$parentMiddle", "artwork") + SliderObject.slider_middle:SetPoint("topleft", SliderObject.slider_left, "topright", 0, 0) + SliderObject.slider_middle:SetPoint("bottomleft", SliderObject.slider_left, "bottomright", 0, 0) + SliderObject.slider_middle:SetPoint("topright", SliderObject.slider_right, "topleft", 0, 0) + SliderObject.slider_middle:SetPoint("bottomright", SliderObject.slider_right, "bottomleft", 0, 0) + if (not isSwitch) then SliderObject.have_tooltip = "Right Click to Type the Value" end diff --git a/Libs/LibLuaServer/LibLuaServer.lua b/Libs/LibLuaServer/LibLuaServer.lua index e83deee92..cc02013df 100644 --- a/Libs/LibLuaServer/LibLuaServer.lua +++ b/Libs/LibLuaServer/LibLuaServer.lua @@ -651,6 +651,7 @@ function LibStub:IterateLibraries()end ---@field GetTextTruncateLines fun(self: fontstring) : number ---@class texture : region +---@field AddMaskTexture fun(self: texture, maskTexture: texture) ---@field SetDrawLayer fun(self: texture, layer: drawlayer, subLayer: number?) ---@field GetTexture fun(self: texture) : any ---@field SetTexture fun(self: texture, path: textureid|texturepath, horizontalWrap: texturewrap?, verticalWrap: texturewrap?, filter: texturefilter?) diff --git a/classes/class_combat.lua b/classes/class_combat.lua index 31bdbc24b..9cae8f9b3 100644 --- a/classes/class_combat.lua +++ b/classes/class_combat.lua @@ -369,6 +369,7 @@ local segmentTypeToString = { ---return the atlasinfo for the combat icon ---@param self combat ---@return df_atlasinfo + ---@return df_atlasinfo? function classCombat:GetCombatIcon() local textureAtlas = Details:GetTextureAtlasTable() @@ -381,20 +382,23 @@ local segmentTypeToString = { if (combatType == DETAILS_SEGMENTTYPE_OVERALL) then return textureAtlas["segment-icon-overall"] - elseif (combatType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_OVERALL or combatType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON) then + elseif (combatType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON) then return textureAtlas["segment-icon-mythicplus"] + elseif (combatType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_OVERALL) then + return textureAtlas["segment-icon-mythicplus"], textureAtlas["segment-icon-mythicplus-overall"] + elseif (combatType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_BOSSTRASH) then - return textureAtlas["segment-icon-mythicplus"] + return textureAtlas["segment-icon-mythicplus"], textureAtlas["segment-icon-broom"] elseif (combatType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_BOSSWIPE) then - return textureAtlas["segment-icon-mythicplus"] + return textureAtlas["segment-icon-mythicplus"], textureAtlas["segment-icon-skull"] elseif (combatType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_BOSS) then - return textureAtlas["segment-icon-mythicplus"] + return textureAtlas["segment-icon-mythicplus"], textureAtlas["segment-icon-skull"] elseif (combatType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_TRASH) then - return textureAtlas["segment-icon-mythicplus"] + return textureAtlas["segment-icon-mythicplus"], textureAtlas["segment-icon-broom"] elseif (combatType == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_GENERIC) then return textureAtlas["segment-icon-mythicplus"] diff --git a/frames/window_breakdown/breakdown_spells_spellframes.lua b/frames/window_breakdown/breakdown_spells_spellframes.lua index b1a2acc80..d9e5f03ff 100644 --- a/frames/window_breakdown/breakdown_spells_spellframes.lua +++ b/frames/window_breakdown/breakdown_spells_spellframes.lua @@ -1538,6 +1538,7 @@ function spellsTab.CreateSpellBar(self, index) --~spellbar ~spellline ~spell ~cr local spellIcon = spellIconFrame:CreateTexture("$parentTexture", "overlay") spellIcon:SetAllPoints() spellIcon:SetTexCoord(.1, .9, .1, .9) + detailsFramework:SetMask(spellIcon, [[Interface\COMMON\common-iconmask]]) spellBar.spellIcon = spellIcon --create a square frame which is placed at the right side of the line to show which targets for damaged by the spell diff --git a/frames/window_breakdown/window_playerbreakdown_auras.lua b/frames/window_breakdown/window_playerbreakdown_auras.lua index 9bc2a61bd..bc2a98d1e 100644 --- a/frames/window_breakdown/window_playerbreakdown_auras.lua +++ b/frames/window_breakdown/window_playerbreakdown_auras.lua @@ -1,10 +1,14 @@ +---@type details local Details = Details -local GameTooltip = GameTooltip +---@type detailsframework local detailsFramework = DetailsFramework + +local GameTooltip = GameTooltip local unpack = unpack local CreateFrame = CreateFrame -local GetSpellInfo = GetSpellInfo + +local _ Details.BuffUptimeSpellsToIgnore = { [186401] = true, --Sign of the Skirmisher @@ -70,7 +74,9 @@ local createAuraTabOnBreakdownWindow = function(tab, frame) local iconTexture = line:CreateTexture("$parentIcon", "overlay") iconTexture:SetSize(scroll_line_height -2 , scroll_line_height - 2) - iconTexture:SetAlpha(0.834) + iconTexture:SetAlpha(0.924) + detailsFramework:SetMask(iconTexture, [[Interface\COMMON\common-iconmask]]) + local nameLabel = line:CreateFontString("$parentName", "overlay", "GameFontNormal") local uptimeLabel = line:CreateFontString("$parentUptime", "overlay", "GameFontNormal") local uptimePercentLabel = line:CreateFontString("$parentPercent", "overlay", "GameFontNormal") diff --git a/frames/window_breakdown/window_playerbreakdown_list.lua b/frames/window_breakdown/window_playerbreakdown_list.lua index e122b7750..a7f8dfff1 100644 --- a/frames/window_breakdown/window_playerbreakdown_list.lua +++ b/frames/window_breakdown/window_playerbreakdown_list.lua @@ -331,6 +331,7 @@ local createPlayerScrollBox = function(breakdownWindowFrame, breakdownSideMenu, local specIcon = upFrame:CreateTexture("$parentSpecIcon", "artwork") specIcon:SetSize(headerTable[1].width - 1, headerTable[1].width - 1) specIcon:SetAlpha(0.71) + detailsFramework:SetMask(specIcon, [[Interface\COMMON\common-iconmask]]) local roleIcon = upFrame:CreateTexture("$parentRoleIcon", "overlay") roleIcon:SetSize((player_line_height-2) / 2, (player_line_height-2) / 2) @@ -505,13 +506,19 @@ local createSegmentsScrollBox = function(breakdownWindowFrame, breakdownSideMenu local updateSegmentLine = function(self, index, segmentData) --~update local combatName = segmentData.combatName local r, g, b = segmentData.r, segmentData.g, segmentData.b - local atlasInfo = segmentData.combatIcon + local combatIcon1 = segmentData.combatIcon + local combatIcon2 = segmentData.combatIcon2 self.segmentText:SetText(combatName) self.segmentText:SetTextColor(r, g, b) detailsFramework:TruncateText(self.segmentText, player_scroll_size[1] - 20) + detailsFramework:SetAtlas(self.segmentIcon, combatIcon1) - detailsFramework:SetAtlas(self.segmentIcon, atlasInfo) + if (combatIcon2) then + detailsFramework:SetAtlas(self.segmentSubIcon, combatIcon2) + else + self.segmentSubIcon:SetTexture("") + end self.combatUniqueID = segmentData.UID @@ -569,6 +576,10 @@ local createSegmentsScrollBox = function(breakdownWindowFrame, breakdownSideMenu segmentIcon:SetSize(player_line_height - 4, player_line_height - 4) segmentIcon:SetAlpha(0.834) + local segmentSubIcon = detailsFramework:CreateTexture(line, "", player_line_height, player_line_height - 1, "artwork") + segmentSubIcon:SetSize(player_line_height - 4, player_line_height - 4) + segmentSubIcon:SetAlpha(0.834) + local segmentText = detailsFramework:CreateLabel(line, "", fontSize or 11, "white", "GameFontNormal") segmentText.outline = fontOutline or "none" segmentText.textcolor = {1, 1, 1, .9} @@ -578,9 +589,11 @@ local createSegmentsScrollBox = function(breakdownWindowFrame, breakdownSideMenu line.segmentText = segmentText line.segmentIcon = segmentIcon + line.segmentSubIcon = segmentSubIcon segmentIcon:SetPoint("left", line, "left", 2, 0) - segmentText:SetPoint("left", segmentIcon, "right", 3, 1) + segmentSubIcon:SetPoint("left", segmentIcon, "right", 2, 0) + segmentText:SetPoint("left", segmentSubIcon, "right", 3, 1) line.UpdateLine = updateSegmentLine @@ -773,12 +786,13 @@ function breakdownWindowPlayerList.CreatePlayerListFrame() local UID = combatObject:GetCombatUID() local combatName, r, g, b = combatObject:GetCombatName(true) - local combatIcon = combatObject:GetCombatIcon() + local combatIcon, combatSubIcon = combatObject:GetCombatIcon() segmentsData[i] = { UID = UID, combatName = combatName, combatIcon = combatIcon, + combatIcon2 = combatSubIcon, r = r or 1, g = g or 1, b = b or 1, diff --git a/frames/window_main.lua b/frames/window_main.lua index 13c7251d8..0723c9095 100644 --- a/frames/window_main.lua +++ b/frames/window_main.lua @@ -6368,7 +6368,7 @@ local buildSegmentTooltip = function(self, deltaTime) local mythicDungeonRunId local statusBarTexture = "Skyline" - local combatTimeColor = "silver" + local combatTimeColor = "gray" local combatTimeColorGeneric = "gray" for i = Details.segments_amount, 1, -1 do @@ -6424,7 +6424,8 @@ local buildSegmentTooltip = function(self, deltaTime) --dumpt(mythicDungeonInfo) gameCooltip:AddLine(broomStick .. " " .. combatName, detailsFramework:IntegerToTimer(thisCombat:GetCombatTime()), 1, dungeonColor, combatTimeColor) - gameCooltip:AddIcon(thisCombat:GetCombatIcon(), "main", "left", nil, nil, nil, nil, nil, nil, nil, nil, true) + local bDesaturated = false + gameCooltip:AddIcon(thisCombat:GetCombatIcon(), "main", "left", nil, nil, nil, nil, nil, nil, nil, nil, bDesaturated) --submenu gameCooltip:AddLine(Loc["STRING_SEGMENT_TRASH"], nil, 2, "white", "white") @@ -6651,7 +6652,7 @@ local buildSegmentTooltip = function(self, deltaTime) else mythicDungeonRunId = false local bFindEnemyName = true - gameCooltip:AddLine(thisCombat:GetCombatName(false, bFindEnemyName), formattedElapsedTime, 1, "yellow", combatTimeColorGeneric) + gameCooltip:AddLine(thisCombat:GetCombatName(false, bFindEnemyName), _, 1, "yellow", combatTimeColorGeneric) --formattedElapsedTime gameCooltip:AddIcon(thisCombat:GetCombatIcon(), "main", "left") --print("passing here...") @@ -6696,6 +6697,7 @@ local buildSegmentTooltip = function(self, deltaTime) GameCooltip:AddLine("$div", nil, nil, -5, -13) + --------------------------------------------------------------------------------------------------------------------------------------------------- --> current combat local thisCombat = Details:GetCurrentCombat() local dateStart, dateEnd = thisCombat:GetDate() diff --git a/functions/profiles.lua b/functions/profiles.lua index 67b2915f8..4eeb8f69c 100644 --- a/functions/profiles.lua +++ b/functions/profiles.lua @@ -1723,20 +1723,32 @@ function Details:SaveProfileSpecial() end --save things for the mythic dungeon run -function Details:SaveState_CurrentMythicDungeonRun (runID, zoneName, zoneID, startAt, segmentID, level, ejID, latestBossAt) +function Details:SaveState_CurrentMythicDungeonRun(runID, zoneName, zoneID, startAt, segmentID, level, ejID, latestBossAt) + local zoneName, _, _, _, _, _, _, currentZoneID = GetInstanceInfo() + local savedTable = Details.mythic_dungeon_currentsaved savedTable.started = true savedTable.run_id = runID savedTable.dungeon_name = zoneName - savedTable.dungeon_zone_id = zoneID + savedTable.dungeon_zone_id = currentZoneID savedTable.started_at = startAt savedTable.segment_id = segmentID savedTable.level = level savedTable.ej_id = ejID savedTable.previous_boss_killed_at = latestBossAt + + local playersOnTheRun = {} + for i = 1, GetNumGroupMembers() do + local unitGUID = UnitGUID("party" .. i) + if (unitGUID) then + playersOnTheRun[#playersOnTheRun+1] = unitGUID + end + end + + savedTable.players = playersOnTheRun end -function Details:UpdateState_CurrentMythicDungeonRun (stillOngoing, segmentID, latestBossAt) +function Details:UpdateState_CurrentMythicDungeonRun(stillOngoing, segmentID, latestBossAt) local savedTable = Details.mythic_dungeon_currentsaved if (not stillOngoing) then @@ -1753,7 +1765,6 @@ function Details:UpdateState_CurrentMythicDungeonRun (stillOngoing, segmentID, l end function Details:RestoreState_CurrentMythicDungeonRun() - --no need to check for mythic+ if the user is playing on classic wow if (DetailsFramework.IsTimewalkWoW()) then return @@ -1762,7 +1773,7 @@ function Details:RestoreState_CurrentMythicDungeonRun() local savedTable = Details.mythic_dungeon_currentsaved local mythicLevel = C_ChallengeMode.GetActiveKeystoneInfo() local zoneName, _, _, _, _, _, _, currentZoneID = GetInstanceInfo() - local mapID = C_Map.GetBestMapForUnit ("player") + local mapID = C_Map.GetBestMapForUnit("player") if (not mapID) then --print("D! no mapID to restored mythic dungeon state.") @@ -1772,7 +1783,7 @@ function Details:RestoreState_CurrentMythicDungeonRun() local ejID = 0 if (mapID) then - ejID = DetailsFramework.EncounterJournal.EJ_GetInstanceForMap (mapID) or 0 + ejID = DetailsFramework.EncounterJournal.EJ_GetInstanceForMap(mapID) or 0 end --is there a saved state for the dungeon? @@ -1793,7 +1804,7 @@ function Details:RestoreState_CurrentMythicDungeonRun() Details.MythicPlus.IsRestoredState = true DetailsMythicPlusFrame.IsDoingMythicDungeon = true - print("D! (debug) mythic dungeon state restored.") + Details:Msg("D! (debug) mythic dungeon state restored.") C_Timer.After(2, function() Details:SendEvent("COMBAT_MYTHICDUNGEON_START") diff --git a/plugins/Details_Compare2/Details_Compare2.lua b/plugins/Details_Compare2/Details_Compare2.lua index bdd467e28..a3a053a84 100644 --- a/plugins/Details_Compare2/Details_Compare2.lua +++ b/plugins/Details_Compare2/Details_Compare2.lua @@ -44,6 +44,7 @@ do ---@class compareplayerframe : frame object containing two scrollboxes, one for spells and another for targets, is used to show comparison data of another player ---@field spellsScroll comparescrollbox ---@field targetsScroll comparescrollbox + ---@field titleIcon df_image shows the combat icon ---@field titleLabel df_label text to show the player name or segment name above the frame scroll, indicates the name or segment being compared ---@field playerObject actor ---@field mainPlayer actor @@ -169,10 +170,14 @@ do targetMaxLines = 16, targetTooltipLineHeight = 16, + compareTitleIconSize = 15, + --font settings fontSize = 10, - playerNameSize = 12, - playerNameYOffset = 12, + playerNameSize = 11, + playerNameYOffset = 15, + + spellIconAlpha = 0.923, --line colors lineOnEnterColor = {.85, .85, .85, .5}, @@ -1100,7 +1105,6 @@ do compareTwo.combatObject = combat --update player name - comparePlugin.mainPlayerName.text = playerActorObject:GetDisplayName() comparePlugin.mainPlayerObject = playerActorObject comparePlugin.mainSpellFrameScroll.mainPlayerObject = playerActorObject @@ -1132,6 +1136,8 @@ do local actorObjectsToCompare = {} setmetatable(actorObjectsToCompare, weakTable) + local maxCompares = compareTwo.db.max_compares + if (compareTwo.db.compare_type == CONST_COMPARETYPE_SEGMENT) then --get the segmentId from the combat local segmentId = combat:GetSegmentSlotId() @@ -1155,9 +1161,16 @@ do combat = combatObject } actorObjectsToCompare[#actorObjectsToCompare + 1] = setmetatable(actorCompareTable, weakTable) + + --stop the loop the the max amount of compares is reached + if (#actorObjectsToCompare >= maxCompares) then + break + end end end + comparePlugin.mainPlayerName.text = combat:GetCombatName() + elseif (compareTwo.db.compare_type == CONST_COMPARETYPE_SPEC) then local actorContainer = combat:GetContainer(displayId) for _, actorObject in actorContainer:ListActors() do @@ -1165,8 +1178,14 @@ do ---@type compareactortable local actorCompareTable = {actor = actorObject, total = actorObject.total, combat = combat} actorObjectsToCompare[#actorObjectsToCompare + 1] = setmetatable(actorCompareTable, weakTable) + + --stop the loop the the max amount of compares is reached + if (#actorObjectsToCompare >= maxCompares) then + break + end end end + comparePlugin.mainPlayerName.text = playerActorObject:GetDisplayName() end table.sort(actorObjectsToCompare, sortByTotalKey) @@ -1184,6 +1203,10 @@ do --other player with the same spec local actorCompareTable = actorObjectsToCompare[idx] + if (not actorCompareTable) then + print("index", idx, "is nil, actorObjectsToCompare", #actorObjectsToCompare, "maxCompares", maxCompares) + end + local playerObject = actorCompareTable.actor local combatObject = actorCompareTable.combat @@ -1207,9 +1230,17 @@ do --depending on the compare mode, the "player name" will be the segment name or the player name if (compareTwo.db.compare_type == CONST_COMPARETYPE_SPEC) then comparisonFrame.titleLabel.text = detailsFramework:RemoveRealmName(playerObject:Name()) + elseif (compareTwo.db.compare_type == CONST_COMPARETYPE_SEGMENT) then + local combatIcon, subIcon = combatObject:GetCombatIcon() + detailsFramework:SetAtlas(comparisonFrame.titleIcon, subIcon or combatIcon) + comparisonFrame.titleIcon:SetSize(comparisonFrameSettings.compareTitleIconSize, comparisonFrameSettings.compareTitleIconSize) + local bOnlyName = true comparisonFrame.titleLabel.text = combatObject:GetCombatName(bOnlyName) + --the combat name can sometimes have pharentesis, remove them + comparisonFrame.titleLabel.text = comparisonFrame.titleLabel.text:gsub("%(.*%)", "") + detailsFramework:TruncateText(comparisonFrame.titleLabel, 124) end --iterate among spells of the main player and check if the spell exists on this player @@ -1289,8 +1320,6 @@ do comparisonFrame.targetsScroll:SetData(otherPlayerResultTargetsTable) comparisonFrame.targetsScroll:Refresh() end - - --comparePlugin.radioGroup:Select(compareTwo.db.compare_type) end --called when the tab is created @@ -1354,6 +1383,7 @@ do text_size = 20, texcoord = {0, 64/512, 211/512, 275/512}, callback = selectCompareMode, + mask = [[Interface\COMMON\common-iconmask]], }, { name = "Compare Segments", --localize-me @@ -1366,6 +1396,7 @@ do height = 32, text_size = 20, callback = selectCompareMode, + mask = [[Interface\COMMON\common-iconmask]], } } @@ -1417,6 +1448,15 @@ do radioGroup:SetPoint("bottomleft", comparePlugin, "bottomleft", 5, 5) comparePlugin.radioGroup = radioGroup + --get all checkboxes from the radio group + local radioCheckboxes = radioGroup:GetAllCheckboxes() + for i = 1, #radioCheckboxes do + local thisCheckBox = radioCheckboxes[i] + if (thisCheckBox:GetChecked()) then + thisCheckBox.SelectedTexture:Show() + end + end + local radioGroupBackgroundTexture = comparePlugin:CreateTexture(nil, "artwork") radioGroupBackgroundTexture:SetColorTexture(.2, .2, .2, 0.834) radioGroupBackgroundTexture:SetPoint("bottomleft", comparePlugin, "bottomleft", 5, 8) @@ -1424,6 +1464,26 @@ do radioGroupBackgroundTexture:SetHeight(35) comparePlugin.radioGroupBackgroundTexture = radioGroupBackgroundTexture + --create a slider to select how many comparison frames will be shown + local minValue, maxValue = 4, 16 + local currentValue = compareTwo.db.max_compares + local scrollStep = 1 + local bIsDecimals = false + local amountOfComparisonsSlider = detailsFramework:CreateSlider(comparePlugin, 160, 20, minValue, maxValue, scrollStep, currentValue, bIsDecimals) + amountOfComparisonsSlider:SetPoint("bottomright", comparePlugin, "bottomright", -30, 14) + amountOfComparisonsSlider:SetTemplate("MODERN_SLIDER_TEMPLATE") + local bObeyStep = true + amountOfComparisonsSlider:SetObeyStepOnDrag(bObeyStep) + amountOfComparisonsSlider:SetHook("OnValueChanged", function(self, fixedValue, value) + if (value == compareTwo.db.max_compares) then + return + end + value = math.floor(value) + compareTwo.db.max_compares = value + compareTwo.Refresh() + end) + comparePlugin.comparisonFramesSlider = amountOfComparisonsSlider + ---create a line for the main player spells(scroll box with the spells the player used) ---@param self comparescrollbox ---@param index number @@ -1446,6 +1506,8 @@ do local spellIcon = line:CreateTexture("$parentIcon", "overlay") spellIcon:SetSize(lineHeight -2 , lineHeight - 2) + detailsFramework:SetMask(spellIcon, [[Interface\COMMON\common-iconmask]]) + spellIcon:SetAlpha(comparisonFrameSettings.spellIconAlpha) local spellName = line:CreateFontString("$parentName", "overlay", "GameFontNormal") local spellAmount = line:CreateFontString("$parentAmount", "overlay", "GameFontNormal") @@ -1804,12 +1866,21 @@ do newComparisonFrame:SetPoint("topleft", comparePlugin.comparisonFrames [comparePlugin.comparisonScrollFrameIndex - 1], "topright", 10, 0) end + --texture to show the combat icon at the left side of the titleLabel + newComparisonFrame.titleIcon = detailsFramework:CreateTexture(newComparisonFrame) + newComparisonFrame.titleIcon:SetPoint("topleft", newComparisonFrame, "topleft", 0, comparisonFrameSettings.playerNameYOffset) + --player name shown above the scrolls ---@type df_label newComparisonFrame.titleLabel = detailsFramework:CreateLabel(newComparisonFrame, "") - newComparisonFrame.titleLabel:SetPoint("topleft", newComparisonFrame, "topleft", 2, comparisonFrameSettings.playerNameYOffset) + newComparisonFrame.titleLabel:SetPoint("left", newComparisonFrame.titleIcon, "right", 2, 0) newComparisonFrame.titleLabel.fontsize = comparisonFrameSettings.playerNameSize + --grandient texture above the comparison frame + local gradientTitle = detailsFramework:CreateTexture(newComparisonFrame, {gradient = "vertical", fromColor = {0, 0, 0, 0.25}, toColor = "transparent"}, 1, 16, "artwork", {0, 1, 0, 1}) + gradientTitle:SetPoint("bottomleft", newComparisonFrame, "topleft", 0, 0) + gradientTitle:SetPoint("bottomright", newComparisonFrame, "topright", 0, 0) + --spells scroll ---@type comparescrollbox local spellsScroll = detailsFramework:CreateScrollBox(newComparisonFrame, "$parentComparisonPlayerSpellsScroll", comparisonPlayerRefreshSpellScroll, {}, comparisonFrameSettings.comparisonScrollWidth, comparisonFrameSettings.spellScrollHeight, comparisonFrameSettings.spellLineAmount, comparisonFrameSettings.spellLineHeight) @@ -1925,6 +1996,7 @@ do local defaultSettings = { compare_type = CONST_COMPARETYPE_SPEC, --1 == player, 2 == segment + max_compares = 4, } --> Install: install -> if successful installed; saveddata -> a table saved inside details db, used to save small amount of data like configs