diff --git a/.gitignore b/.gitignore index c89b853b1..c86ea30ac 100644 --- a/.gitignore +++ b/.gitignore @@ -62,3 +62,4 @@ images/package_addons.png images/patreon_stuff.png images/plater_darktheme_skin.png images/Tutorial/DetailsMainWindow.png +Details.cpp diff --git a/Definitions.lua b/Definitions.lua index 98eb13e01..b70d06ee8 100644 --- a/Definitions.lua +++ b/Definitions.lua @@ -179,7 +179,7 @@ ---@field GetCombatSegments fun(self: details) : combat[] return a table with all the combat segments ---@field ListInstances fun(self: details) : instance[] return a table with all the instances ---@field UnpackMythicDungeonInfo fun(self: details, mythicDungeonInfo: mythicdungeoninfo) : boolean, segmentid, number, number, number, string, number, string, number, number, number unpack the mythic dungeon info and return the values ----@field +---@field CreateRightClickToCloseLabel fun(self: details, parent: frame) : df_label return a df_label with the text "Right click to close", need to set point ---@field ---@field diff --git a/Libs/DF/definitions.lua b/Libs/DF/definitions.lua index 6067a10b3..822548cf3 100644 --- a/Libs/DF/definitions.lua +++ b/Libs/DF/definitions.lua @@ -11,7 +11,8 @@ ---@field removeduplicate fun(tbl1:table, tbl2:table) remove the keys from table1 which also exists in table2 with the same value ---@field getfrompath fun(tbl:table, path:string, subOffset:number?) : any get a value from a table using a path, e.g. getfrompath(tbl, "a.b.c") is the same as tbl.a.b.c; if subOffset is passed, return the subOffset'th value of the path ---@field setfrompath fun(tbl:table, path:string, value:any) : boolean set the value of a table using a path, e.g. setfrompath(tbl, "a.b.c", 10) is the same as tbl.a.b.c = 10 ----@field dump fun(tbl:table) : string dump a table to a string +---@field dump fun(tbl:table, resultString:string, deep:number) : string dump a table to a string +---@field findsubtable fun(tbl:table, index:number, value:any) : integer|nil find the value passed inside a sub table, return the index of the main table where the sub table with the value found is located ---@class df_language : table ---@field Register fun(addonId:any, languageId:string, gameLanguageOnly:boolean?) : table @@ -36,6 +37,19 @@ ---@field RegisterTableKeyWithLocTable fun(table:table, key:any, locTable:table, silence:boolean?) ---@field RegisterObjectWithLocTable fun(object:uiobject, locTable:table, silence:boolean?) +---@class df_anttable : table +---@field Throttle number +---@field AmountParts number +---@field TexturePartsWidth number +---@field TexturePartsHeight number +---@field TextureWidth number +---@field TextureHeight number +---@field BlendMode string? +---@field Color any? +---@field Texture any + +---df version of an atlasinfo from the game API, it include color and desaturation information +---a df atlas can be created using DetailsFramework:CreateAtlas() and then used with DetailsFramework:SetAtlas() ---@class df_atlasinfo : atlasinfo ---@field vertexRed number? ---@field vertexGreen number? @@ -50,6 +64,7 @@ ---@alias df_templatename string +---a template is a table with keys and values that mandate how a widget should look like ---@class df_template : table ---@field width any ---@field height any @@ -103,6 +118,7 @@ ---| "switch" ---| "slider" + ---@class detailsframework ---@field dversion number ---@field internalFunctions table @@ -130,6 +146,19 @@ ---@field button_templates table ---@field slider_templates table ---@field font_templates table +---@field FrameWorkVersion string the version of the framework +---@field LabelNameCounter number when no name is given, a string plus an incremental number is used instead +---@field PictureNameCounter number when no name is given, a string plus an incremental number is used instead +---@field BarNameCounter number when no name is given, a string plus an incremental number is used instead +---@field DropDownCounter number when no name is given, a string plus an incremental number is used instead +---@field PanelCounter number when no name is given, a string plus an incremental number is used instead +---@field SimplePanelCounter number when no name is given, a string plus an incremental number is used instead +---@field ButtonCounter number when no name is given, a string plus an incremental number is used instead +---@field SliderCounter number when no name is given, a string plus an incremental number is used instead +---@field SwitchCounter number when no name is given, a string plus an incremental number is used instead +---@field SplitBarCounter number when no name is given, a string plus an incremental number is used instead +---@field FormatNumber fun(number:number) : string abbreviate a number, e.g. 1000 -> 1k 1000 -> 1천, depending on the client language +---@field UnitGroupRolesAssigned fun(unitId: unit, bUseSupport:boolean?, specId: specializationid?) : string there's no self here ---@field LoadSpellCache fun(self:table, hashMap:table, indexTable:table, allSpellsSameName:table) : hashMap:table, indexTable:table, allSpellsSameName:table load all spells in the game and add them into the passed tables ---@field UnloadSpellCache fun(self:table) wipe the table contents filled with LoadSpellCache() ---@field GetCurrentClassName fun(self:table) : string return the name of the class the player is playing @@ -172,10 +201,9 @@ ---@field GroupIterator fun(self:table, callback:function, ...) iterate over the group, calling the callback function for each group member ---@field CommaValue fun(self:table, value:number) : string convert a number to a string with commas, e.g. 1000000 -> 1,000,000 ---@field SplitTextInLines fun(self:table, text:string) : string[] split a text into lines ----@field UnitGroupRolesAssigned fun(unitId: unit, bUseSupport:boolean?, specId: specializationid?) : string there's no self here ---@field SetAnchor fun(self:table, widget:uiobject, anchorTable:df_anchor, anchorTo:uiobject?) only adjust the anchors of a widget, does not save values ----@field AddTextureToText fun(text:string, textureInfo:table, bAddSpace:boolean?, bAddAfterText:boolean) : string textureInfo is a table with .texture .width .height .coords{left, right, top, bottom} ----@field CreateTextureInfo fun(texture:atlasname|texturepath|textureid, width:number?, height:number?, left:number?, right:number?, top:number?, bottom:number?, imageWidthnumber?, imageHeightnumber?) : table +---@field AddTextureToText fun(self:table, text:string, textureInfo:table, bAddSpace:boolean?, bAddAfterText:any) : string textureInfo is a table with .texture .width .height .coords{left, right, top, bottom} +---@field CreateTextureInfo fun(self:table, texture:atlasname|texturepath|textureid, width:number?, height:number?, left:number?, right:number?, top:number?, bottom:number?, imageWidthnumber?, imageHeightnumber?) : table deprecated, use: DetailsFramework:CreateAtlas() ---@field ApplyStandardBackdrop fun(self:table, frame:frame, bUseSolidColor:boolean?, alphaScale:number?) ---@field NewLabel fun(self:table, parent:frame, container:frame, name:string?, member:string?, text:string|table, font:string?, size:any?, color:any?, layer:drawlayer?) : df_label ---@field CreateLabel fun(self:table, parent:frame, text:string, size:any?, color:any?, font:string?, member:string?, name:string?, layer:drawlayer?) : df_label @@ -238,6 +266,8 @@ ---@field SortOrder3R fun(t1:table, t2:table) : boolean ---@field Trim fun(self:table, string:string) : string ---@field trim fun(self:table, string:string) : string +---@field TruncateTextBinarySearch fun(self:table, fontString:fontstring, maxWidth:number) : nil +---@field TruncateTextSafeBinarySearch fun(self:table, fontString:fontstring, maxWidth:number) : nil ---@field TruncateTextSafe fun(self:table, fontString:fontstring, maxWidth:number) : nil ---@field TruncateText fun(self:table, fontString:fontstring, maxWidth:number) : nil ---@field CleanTruncateUTF8String fun(self:table, text:string) : string @@ -255,6 +285,14 @@ ---@field ParseTemplate fun(self:table, templateCategory:string, template:string|table) : table ---@field GetParentName fun(self:table, frame:uiobject) : string ---@field IsLatinLanguage fun(self:table, languageId:string) : boolean +---@field PrintVersion fun(self:table) : nil print to chat the version of the framework +---@field GetParentKeyPath fun(self:table, object:uiobject) : string +---@field GetParentNamePath fun(self:table, object:uiobject) : string +---@field GetAsianNumberSymbols fun(self:table) : string, string, string return the abbreviation for 1,000 10,000 and 100,000,000 +---@field GetBestFontForLanguage fun(self:table, languageId:string?, western:string?, cyrillic:string?, china:string? korean:string?, taiwan:string?) : string +---@field CreateGlowOverlay fun(self:table, parent:frame, antsColor:any, glowColor:any) : frame +---@field CreateAnts fun(self:table, parent:frame, antTable:df_anttable, leftOffset:number?, rightOffset:number?, topOffset:number?, bottomOffset:number?) : frame +---@field CreateBorder fun(self:table, parent:frame, alpha1:number?, alpha2:number?, alpha3:number?) : frame ---@field ---@field ---@field diff --git a/Libs/DF/fw.lua b/Libs/DF/fw.lua index 2fccc5848..c065784b5 100644 --- a/Libs/DF/fw.lua +++ b/Libs/DF/fw.lua @@ -1,6 +1,6 @@ -local dversion = 520 +local dversion = 521 local major, minor = "DetailsFramework-1.0", dversion local DF, oldminor = LibStub:NewLibrary(major, minor) @@ -21,11 +21,6 @@ local SharedMedia = LibStub:GetLibrary("LibSharedMedia-3.0") local _ local type = type local unpack = unpack -local upper = string.upper -local string_match = string.match -local tinsert = table.insert -local abs = _G.abs -local tremove = _G.tremove local IS_WOW_PROJECT_MAINLINE = WOW_PROJECT_ID == WOW_PROJECT_MAINLINE local IS_WOW_PROJECT_NOT_MAINLINE = WOW_PROJECT_ID ~= WOW_PROJECT_MAINLINE @@ -220,7 +215,7 @@ function DF:GetRoleByClassicTalentTree() --tab information local name, iconTexture, pointsSpent, fileName = GetTalentTabInfo(i) if (name) then - tinsert(pointsPerSpec, {name, pointsSpent, fileName}) + table.insert(pointsPerSpec, {name, pointsSpent, fileName}) end end end @@ -460,7 +455,6 @@ local embedFunctions = { "NewSpecialLuaEditorEntry", "ShowPromptPanel", "ShowTextPromptPanel", - "www_icons", "GetTemplate", "InstallTemplate", "GetFrameworkFolder", @@ -559,7 +553,11 @@ function DF.table.findsubtable(t, index, value) end end - +---Loop through parent of the passed object, making a string with parentKeys separated by a dot. +---The loop continues until a parentKey is not found or if the frame has no parent (reach UIParent). +---@param self table +---@param object any +---@return string function DF:GetParentKeyPath(object) local parentKey = object:GetParentKey() if (not parentKey) then @@ -584,6 +582,11 @@ function DF:GetParentKeyPath(object) return path end +---Loop through the parent of the passed object, creating a string with parent names and parent keys separated by dots, if the object has no name. +---The loop continues until a parentName is not found or if the frame has no parent (reach UIParent). +---@param self table +---@param object any +---@return string function DF:GetParentNamePath(object) local parent = object local path = "" @@ -597,7 +600,8 @@ function DF:GetParentNamePath(object) if (parentKey) then parentName = parentKey else - return path:gsub("%.$", "") + local result = path:gsub("%.$", "") + return result end end end @@ -605,13 +609,15 @@ function DF:GetParentNamePath(object) if (parentName) then path = parentName .. "." .. path else - return path:gsub("%.$", "") + local result = path:gsub("%.$", "") + return result end parent = parent:GetParent() end - return path:gsub("%.$", "") + local result = path:gsub("%.$", "") + return result 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 @@ -694,7 +700,7 @@ function DF.table.addunique(t, index, value) end end - tinsert(t, index, value) + table.insert(t, index, value) return true end @@ -904,53 +910,7 @@ end ---@param deep integer ---@return string function DF.table.dump(t, resultString, deep) - - if true then return tableToStringSafe(t) end - - resultString = resultString or "" - deep = deep or 0 - local space = "" - for i = 1, deep do - space = space .. " " - end - - for key, value in pairs(t) do - local valueType = type(value) - - if (type(key) == "function") then - key = "#function#" - elseif (type(key) == "table") then - key = "#table#" - end - - if (type(key) ~= "string" and type(key) ~= "number") then - key = "unknown?" - end - - if (valueType == "table") then - if (type(key) == "number") then - resultString = resultString .. space .. "[" .. key .. "] = |cFFa9ffa9 {|r\n" - else - resultString = resultString .. space .. "[\"" .. key .. "\"] = |cFFa9ffa9 {|r\n" - end - resultString = resultString .. DF.table.dump (value, nil, deep+1) - resultString = resultString .. space .. "|cFFa9ffa9},|r\n" - - elseif (valueType == "string") then - resultString = resultString .. space .. "[\"" .. key .. "\"] = \"|cFFfff1c1" .. value .. "|r\",\n" - - elseif (valueType == "number") then - resultString = resultString .. space .. "[\"" .. key .. "\"] = |cFFffc1f4" .. value .. "|r,\n" - - elseif (valueType == "function") then - resultString = resultString .. space .. "[\"" .. key .. "\"] = function()end,\n" - - elseif (valueType == "boolean") then - resultString = resultString .. space .. "[\"" .. key .. "\"] = |cFF99d0ff" .. (value and "true" or "false") .. "|r,\n" - end - end - - return resultString + return tableToStringSafe(t) end ---grab a text and split it into lines adding each line to an array table @@ -963,14 +923,14 @@ function DF:SplitTextInLines(text) while (startScope) do if (startScope ~= 1) then - tinsert(lines, text:sub(position, startScope-1)) + table.insert(lines, text:sub(position, startScope-1)) end position = endScope + 1 startScope, endScope = text:find("\n", position, true) end if (position <= #text) then - tinsert(lines, text:sub(position)) + table.insert(lines, text:sub(position)) end return lines @@ -1013,13 +973,6 @@ function DF.strings.stringtotable(thisString, bDoCompression) return newTable end -DF.www_icons = { - texture = "feedback_sites", - wowi = {0, 0.7890625, 0, 37/128}, - curse = {0, 0.7890625, 38/123, 79/128}, - mmoc = {0, 0.7890625, 80/123, 123/128}, -} - local symbol_1K, symbol_10K, symbol_1B if (GetLocale() == "koKR") then symbol_1K, symbol_10K, symbol_1B = "천", "만", "억" @@ -1101,7 +1054,7 @@ function DF:CommaValue(value) end --source http://richard.warburton.it - local left, num, right = string_match (value, '^([^%d]*%d)(%d*)(.-)$') + local left, num, right = string.match(value, '^([^%d]*%d)(%d*)(.-)$') return left .. (num:reverse():gsub('(%d%d%d)','%1,'):reverse()) .. right end @@ -1377,7 +1330,7 @@ function DF:AddClassIconToText(text, playerName, englishClassName, useSpec, icon return text end ----create a table with information about a texture +---create a table with information about a texture (deprecated, use: DetailsFramework:CreateAtlas()) ---@param texture any ---@param textureWidth any ---@param textureHeight any @@ -2364,12 +2317,12 @@ end TutorialAlertFrame:Show() end - function DF:CreateOptionsFrame(name, title, template) + function DF:CreateOptionsFrame(name, title, template) --deprecated? template = template or 1 if (template == 2) then local newOptionsFrame = CreateFrame("frame", name, UIParent, "ButtonFrameTemplate") - tinsert(UISpecialFrames, name) + table.insert(UISpecialFrames, name) newOptionsFrame:SetSize(500, 200) newOptionsFrame.RefreshOptions = DF.internalFunctions.RefreshOptionsPanel @@ -2407,7 +2360,7 @@ end elseif (template == 1) then local newOptionsFrame = CreateFrame("frame", name, UIParent) - tinsert(UISpecialFrames, name) + table.insert(UISpecialFrames, name) newOptionsFrame:SetSize(500, 200) newOptionsFrame.RefreshOptions = DF.internalFunctions.RefreshOptionsPanel @@ -2549,7 +2502,14 @@ function DF:IsLatinLanguage(languageId) return latinLanguageIdsMap[languageId] end ---return the best font to use for the client language +---return a font name to use for the client language +---@param self table +---@param languageId string? +---@param western string? +---@param cyrillic string? +---@param china string? +---@param korean string? +---@param taiwan string? function DF:GetBestFontForLanguage(languageId, western, cyrillic, china, korean, taiwan) if (not languageId) then languageId = DF.ClientLanguage @@ -3362,13 +3322,13 @@ frameshake_DoUpdate = function(parent, shakeObject, deltaTime) local newX, newY if (shakeObject.AbsoluteSineX) then --absoluting only the sine wave, passing a negative scale will reverse the absolute direction - newX = shakeObject.Amplitude * abs(math.sin(shakeObject.XSineOffset)) * scaleShake * shakeObject.ScaleX + newX = shakeObject.Amplitude * math.abs(math.sin(shakeObject.XSineOffset)) * scaleShake * shakeObject.ScaleX else newX = shakeObject.Amplitude * math.sin(shakeObject.XSineOffset) * scaleShake * shakeObject.ScaleX end if (shakeObject.AbsoluteSineY) then - newY = shakeObject.Amplitude * abs(math.sin(shakeObject.YSineOffset)) * scaleShake * shakeObject.ScaleY + newY = shakeObject.Amplitude * math.abs(math.sin(shakeObject.YSineOffset)) * scaleShake * shakeObject.ScaleY else newY = shakeObject.Amplitude * math.sin(shakeObject.YSineOffset) * scaleShake * shakeObject.ScaleY end @@ -3573,7 +3533,7 @@ function DF:CreateFrameShake(parent, duration, amplitude, frequency, absoluteSin FrameshakeUpdateFrame.RegisterFrame (parent) end - tinsert(parent.__frameshakes, frameShake) + table.insert(parent.__frameshakes, frameShake) return frameShake end @@ -3650,23 +3610,29 @@ local glow_overlay_setcolor = function(self, antsColor, glowColor) end local glow_overlay_onshow = function(self) - glow_overlay_play (self) + glow_overlay_play(self) end local glow_overlay_onhide = function(self) - glow_overlay_stop (self) + glow_overlay_stop(self) end ---this is most copied from the wow client code, few changes applied to customize it -function DF:CreateGlowOverlay (parent, antsColor, glowColor) - local pName = parent:GetName() - local fName = pName and (pName.."Glow2") or "OverlayActionGlow" .. math.random(1, 10000000) - if fName and string.len(fName) > 50 then -- shorten to work around too long names - fName = strsub(fName, string.len(fName)-49) +---create a glow overlay around a frame, return a frame and also add parent.overlay to the parent frame +---@param self table +---@param parent frame +---@param antsColor any +---@param glowColor any +function DF:CreateGlowOverlay(parent, antsColor, glowColor) + local parentName = parent:GetName() + local frameName = parentName and (parentName .. "Glow2") or "OverlayActionGlow" .. math.random(1, 10000000) + + if (frameName and string.len(frameName) > 50) then --shorten to work around too long names + frameName = string.sub(frameName, string.len(frameName)-49) end - local glowFrame = CreateFrame("frame", fName, parent, "ActionBarButtonSpellActivationAlert") - glowFrame:HookScript ("OnShow", glow_overlay_onshow) - glowFrame:HookScript ("OnHide", glow_overlay_onhide) + + local glowFrame = CreateFrame("frame", frameName, parent, "ActionBarButtonSpellActivationAlert") + glowFrame:HookScript("OnShow", glow_overlay_onshow) + glowFrame:HookScript("OnHide", glow_overlay_onhide) glowFrame.Play = glow_overlay_play glowFrame.Stop = glow_overlay_stop @@ -3681,23 +3647,24 @@ function DF:CreateGlowOverlay (parent, antsColor, glowColor) local scale = 1.4 - --Make the height/width available before the next frame: - parent.overlay:SetSize(frameWidth * scale, frameHeight * scale) - parent.overlay:SetPoint("TOPLEFT", parent, "TOPLEFT", -frameWidth * 0.32, frameHeight * 0.36) - parent.overlay:SetPoint("BOTTOMRIGHT", parent, "BOTTOMRIGHT", frameWidth * 0.32, -frameHeight * 0.36) + --make the height/width available before the next frame: + glowFrame:SetSize(frameWidth * scale, frameHeight * scale) + glowFrame:SetPoint("topleft", parent, "topleft", -frameWidth * 0.32, frameHeight * 0.36) + glowFrame:SetPoint("bottomright", parent, "bottomright", frameWidth * 0.32, -frameHeight * 0.36) if (glowFrame.outerGlow) then glowFrame.outerGlow:SetScale(1.2) end + if (glowFrame.ProcStartFlipbook) then glowFrame.ProcStartAnim:Stop() glowFrame.ProcStartFlipbook:ClearAllPoints() - --glowFrame.ProcStartFlipbook:SetAllPoints() - --glowFrame.ProcStartFlipbook:SetSize(frameWidth * scale, frameHeight * scale) glowFrame.ProcStartFlipbook:SetPoint("TOPLEFT", glowFrame, "TOPLEFT", -frameWidth * scale, frameHeight * scale) glowFrame.ProcStartFlipbook:SetPoint("BOTTOMRIGHT", glowFrame, "BOTTOMRIGHT", frameWidth * scale, -frameHeight * scale) end + glowFrame:EnableMouse(false) + return glowFrame end @@ -3713,32 +3680,41 @@ local ants_set_texture_offset = function(self, leftOffset, rightOffset, topOffse self:SetPoint("bottomright", rightOffset, bottomOffset) end -function DF:CreateAnts (parent, antTable, leftOffset, rightOffset, topOffset, bottomOffset, antTexture) + +---create an "ant" animation around the frame, the name "ant" comes from the animation looking like small bright dots moving around the frame +---@param parent frame +---@param antTable df_anttable +---@param leftOffset number? +---@param rightOffset number? +---@param topOffset number? +---@param bottomOffset number? +---@return frame +function DF:CreateAnts(parent, antTable, leftOffset, rightOffset, topOffset, bottomOffset) leftOffset = leftOffset or 0 rightOffset = rightOffset or 0 topOffset = topOffset or 0 bottomOffset = bottomOffset or 0 - local f = CreateFrame("frame", nil, parent) - f:SetPoint("topleft", leftOffset, topOffset) - f:SetPoint("bottomright", rightOffset, bottomOffset) + local antsFrame = CreateFrame("frame", nil, parent) + antsFrame:SetPoint("topleft", leftOffset, topOffset) + antsFrame:SetPoint("bottomright", rightOffset, bottomOffset) - f.SetOffset = ants_set_texture_offset + antsFrame.SetOffset = ants_set_texture_offset - local t = f:CreateTexture(nil, "overlay") - t:SetAllPoints() - t:SetTexture(antTable.Texture) - t:SetBlendMode(antTable.BlendMode or "ADD") - t:SetVertexColor(DF:ParseColors(antTable.Color or "white")) - f.Texture = t + local texture = antsFrame:CreateTexture(nil, "overlay") + texture:SetAllPoints() + texture:SetTexture(antTable.Texture) + texture:SetBlendMode(antTable.BlendMode or "ADD") + texture:SetVertexColor(DF:ParseColors(antTable.Color or "white")) + antsFrame.Texture = texture - f.AntTable = antTable + antsFrame.AntTable = antTable - f:SetScript("OnUpdate", function(self, deltaTime) - AnimateTexCoords (t, self.AntTable.TextureWidth, self.AntTable.TextureHeight, self.AntTable.TexturePartsWidth, self.AntTable.TexturePartsHeight, self.AntTable.AmountParts, deltaTime, self.AntTable.Throttle or 0.025) + antsFrame:SetScript("OnUpdate", function(self, deltaTime) + AnimateTexCoords(texture, self.AntTable.TextureWidth, self.AntTable.TextureHeight, self.AntTable.TexturePartsWidth, self.AntTable.TexturePartsHeight, self.AntTable.AmountParts, deltaTime, self.AntTable.Throttle or 0.025) end) - return f + return antsFrame end --[=[ --test ants @@ -3784,18 +3760,25 @@ end local SetLayerVisibility = function(self, layer1Shown, layer2Shown, layer3Shown) for _, texture in ipairs(self.Borders.Layer1) do - texture:SetShown (layer1Shown) + texture:SetShown(layer1Shown) end for _, texture in ipairs(self.Borders.Layer2) do - texture:SetShown (layer2Shown) + texture:SetShown(layer2Shown) end for _, texture in ipairs(self.Borders.Layer3) do - texture:SetShown (layer3Shown) + texture:SetShown(layer3Shown) end end +---create a border using three textures for each side of the frame, each texture has a different transparency creating a smooth gradient effect +---the parent frame receives three new methods: SetBorderAlpha(a1, a2, a3), SetBorderColor(r, g, b), SetLayerVisibility(layer1Shown, layer2Shown, layer3Shown) +---@param self table +---@param parent frame +---@param alpha1 number? +---@param alpha2 number? +---@param alpha3 number? function DF:CreateBorder(parent, alpha1, alpha2, alpha3) parent.Borders = { Layer1 = {}, @@ -3810,73 +3793,89 @@ function DF:CreateBorder(parent, alpha1, alpha2, alpha3) parent.SetBorderColor = SetBorderColor parent.SetLayerVisibility = SetLayerVisibility - local border1 = parent:CreateTexture(nil, "background") - PixelUtil.SetPoint(border1, "topleft", parent, "topleft", -1, 1) - PixelUtil.SetPoint(border1, "bottomleft", parent, "bottomleft", -1, -1) - border1:SetColorTexture(0, 0, 0, alpha1 or default_border_color1) - local border2 = parent:CreateTexture(nil, "background") - PixelUtil.SetPoint(border2, "topleft", parent, "topleft", -2, 2) - PixelUtil.SetPoint(border2, "bottomleft", parent, "bottomleft", -2, -2) - border2:SetColorTexture(0, 0, 0, alpha2 or default_border_color2) - local border3 = parent:CreateTexture(nil, "background") - PixelUtil.SetPoint(border3, "topleft", parent, "topleft", -3, 3) - PixelUtil.SetPoint(border3, "bottomleft", parent, "bottomleft", -3, -3) - border3:SetColorTexture(0, 0, 0, alpha3 or default_border_color3) + do + local leftBorder1 = parent:CreateTexture(nil, "background") + PixelUtil.SetPoint(leftBorder1, "topleft", parent, "topleft", -1, 1) + PixelUtil.SetPoint(leftBorder1, "bottomleft", parent, "bottomleft", -1, -1) + leftBorder1:SetColorTexture(0, 0, 0, alpha1 or default_border_color1) - tinsert(parent.Borders.Layer1, border1) - tinsert(parent.Borders.Layer2, border2) - tinsert(parent.Borders.Layer3, border3) + local leftBorder2 = parent:CreateTexture(nil, "background") + PixelUtil.SetPoint(leftBorder2, "topleft", parent, "topleft", -2, 2) + PixelUtil.SetPoint(leftBorder2, "bottomleft", parent, "bottomleft", -2, -2) + leftBorder2:SetColorTexture(0, 0, 0, alpha2 or default_border_color2) - local border1 = parent:CreateTexture(nil, "background") - PixelUtil.SetPoint(border1, "topleft", parent, "topleft", 0, 1) - PixelUtil.SetPoint(border1, "topright", parent, "topright", 1, 1) - border1:SetColorTexture(0, 0, 0, alpha1 or default_border_color1) - local border2 = parent:CreateTexture(nil, "background") - PixelUtil.SetPoint(border2, "topleft", parent, "topleft", -1, 2) - PixelUtil.SetPoint(border2, "topright", parent, "topright", 2, 2) - border2:SetColorTexture(0, 0, 0, alpha2 or default_border_color2) - local border3 = parent:CreateTexture(nil, "background") - PixelUtil.SetPoint(border3, "topleft", parent, "topleft", -2, 3) - PixelUtil.SetPoint(border3, "topright", parent, "topright", 3, 3) - border3:SetColorTexture(0, 0, 0, alpha3 or default_border_color3) + local leftBorder3 = parent:CreateTexture(nil, "background") + PixelUtil.SetPoint(leftBorder3, "topleft", parent, "topleft", -3, 3) + PixelUtil.SetPoint(leftBorder3, "bottomleft", parent, "bottomleft", -3, -3) + leftBorder3:SetColorTexture(0, 0, 0, alpha3 or default_border_color3) - tinsert(parent.Borders.Layer1, border1) - tinsert(parent.Borders.Layer2, border2) - tinsert(parent.Borders.Layer3, border3) + table.insert(parent.Borders.Layer1, leftBorder1) + table.insert(parent.Borders.Layer2, leftBorder2) + table.insert(parent.Borders.Layer3, leftBorder3) + end - local border1 = parent:CreateTexture(nil, "background") - PixelUtil.SetPoint(border1, "topright", parent, "topright", 1, 0) - PixelUtil.SetPoint(border1, "bottomright", parent, "bottomright", 1, -1) - border1:SetColorTexture(0, 0, 0, alpha1 or default_border_color1) - local border2 = parent:CreateTexture(nil, "background") - PixelUtil.SetPoint(border2, "topright", parent, "topright", 2, 1) - PixelUtil.SetPoint(border2, "bottomright", parent, "bottomright", 2, -2) - border2:SetColorTexture(0, 0, 0, alpha2 or default_border_color2) - local border3 = parent:CreateTexture(nil, "background") - PixelUtil.SetPoint(border3, "topright", parent, "topright", 3, 2) - PixelUtil.SetPoint(border3, "bottomright", parent, "bottomright", 3, -3) - border3:SetColorTexture(0, 0, 0, alpha3 or default_border_color3) + do + local topBorder1 = parent:CreateTexture(nil, "background") + PixelUtil.SetPoint(topBorder1, "topleft", parent, "topleft", 0, 1) + PixelUtil.SetPoint(topBorder1, "topright", parent, "topright", 1, 1) + topBorder1:SetColorTexture(0, 0, 0, alpha1 or default_border_color1) - tinsert(parent.Borders.Layer1, border1) - tinsert(parent.Borders.Layer2, border2) - tinsert(parent.Borders.Layer3, border3) + local topBorder2 = parent:CreateTexture(nil, "background") + PixelUtil.SetPoint(topBorder2, "topleft", parent, "topleft", -1, 2) + PixelUtil.SetPoint(topBorder2, "topright", parent, "topright", 2, 2) + topBorder2:SetColorTexture(0, 0, 0, alpha2 or default_border_color2) - local border1 = parent:CreateTexture(nil, "background") - PixelUtil.SetPoint(border1, "bottomleft", parent, "bottomleft", 0, -1) - PixelUtil.SetPoint(border1, "bottomright", parent, "bottomright", 0, -1) - border1:SetColorTexture(0, 0, 0, alpha1 or default_border_color1) - local border2 = parent:CreateTexture(nil, "background") - PixelUtil.SetPoint(border2, "bottomleft", parent, "bottomleft", -1, -2) - PixelUtil.SetPoint(border2, "bottomright", parent, "bottomright", 1, -2) - border2:SetColorTexture(0, 0, 0, alpha2 or default_border_color2) - local border3 = parent:CreateTexture(nil, "background") - PixelUtil.SetPoint(border3, "bottomleft", parent, "bottomleft", -2, -3) - PixelUtil.SetPoint(border3, "bottomright", parent, "bottomright", 2, -3) - border3:SetColorTexture(0, 0, 0, alpha3 or default_border_color3) + local topBorder3 = parent:CreateTexture(nil, "background") + PixelUtil.SetPoint(topBorder3, "topleft", parent, "topleft", -2, 3) + PixelUtil.SetPoint(topBorder3, "topright", parent, "topright", 3, 3) + topBorder3:SetColorTexture(0, 0, 0, alpha3 or default_border_color3) + + table.insert(parent.Borders.Layer1, topBorder1) + table.insert(parent.Borders.Layer2, topBorder2) + table.insert(parent.Borders.Layer3, topBorder3) + end + + do + local rightBorder1 = parent:CreateTexture(nil, "background") + PixelUtil.SetPoint(rightBorder1, "topright", parent, "topright", 1, 0) + PixelUtil.SetPoint(rightBorder1, "bottomright", parent, "bottomright", 1, -1) + rightBorder1:SetColorTexture(0, 0, 0, alpha1 or default_border_color1) + + local rightBorder2 = parent:CreateTexture(nil, "background") + PixelUtil.SetPoint(rightBorder2, "topright", parent, "topright", 2, 1) + PixelUtil.SetPoint(rightBorder2, "bottomright", parent, "bottomright", 2, -2) + rightBorder2:SetColorTexture(0, 0, 0, alpha2 or default_border_color2) + + local rightBorder3 = parent:CreateTexture(nil, "background") + PixelUtil.SetPoint(rightBorder3, "topright", parent, "topright", 3, 2) + PixelUtil.SetPoint(rightBorder3, "bottomright", parent, "bottomright", 3, -3) + rightBorder3:SetColorTexture(0, 0, 0, alpha3 or default_border_color3) + + table.insert(parent.Borders.Layer1, rightBorder1) + table.insert(parent.Borders.Layer2, rightBorder2) + table.insert(parent.Borders.Layer3, rightBorder3) + end + + do + local bottomBorder1 = parent:CreateTexture(nil, "background") + PixelUtil.SetPoint(bottomBorder1, "bottomleft", parent, "bottomleft", 0, -1) + PixelUtil.SetPoint(bottomBorder1, "bottomright", parent, "bottomright", 0, -1) + bottomBorder1:SetColorTexture(0, 0, 0, alpha1 or default_border_color1) - tinsert(parent.Borders.Layer1, border1) - tinsert(parent.Borders.Layer2, border2) - tinsert(parent.Borders.Layer3, border3) + local bottomBorder2 = parent:CreateTexture(nil, "background") + PixelUtil.SetPoint(bottomBorder2, "bottomleft", parent, "bottomleft", -1, -2) + PixelUtil.SetPoint(bottomBorder2, "bottomright", parent, "bottomright", 1, -2) + bottomBorder2:SetColorTexture(0, 0, 0, alpha2 or default_border_color2) + + local bottomBorder3 = parent:CreateTexture(nil, "background") + PixelUtil.SetPoint(bottomBorder3, "bottomleft", parent, "bottomleft", -2, -3) + PixelUtil.SetPoint(bottomBorder3, "bottomright", parent, "bottomright", 2, -3) + bottomBorder3:SetColorTexture(0, 0, 0, alpha3 or default_border_color3) + + table.insert(parent.Borders.Layer1, bottomBorder1) + table.insert(parent.Borders.Layer2, bottomBorder2) + table.insert(parent.Borders.Layer3, bottomBorder3) + end end --DFNamePlateBorder as copy from "NameplateFullBorderTemplate" -> DF:CreateFullBorder (name, parent) @@ -3942,7 +3941,7 @@ function DF:CreateFullBorder (name, parent) left:SetPoint("TOPRIGHT", border, "TOPLEFT", 0, 1.0) left:SetPoint("BOTTOMRIGHT", border, "BOTTOMLEFT", 0, -1.0) border.Left = left - tinsert(border.Textures, left) + table.insert(border.Textures, left) local right = border:CreateTexture("$parentRight", "BACKGROUND", nil, -8) --right:SetDrawLayer("BACKGROUND", -8) @@ -3951,7 +3950,7 @@ function DF:CreateFullBorder (name, parent) right:SetPoint("TOPLEFT", border, "TOPRIGHT", 0, 1.0) right:SetPoint("BOTTOMLEFT", border, "BOTTOMRIGHT", 0, -1.0) border.Right = right - tinsert(border.Textures, right) + table.insert(border.Textures, right) local bottom = border:CreateTexture("$parentBottom", "BACKGROUND", nil, -8) --bottom:SetDrawLayer("BACKGROUND", -8) @@ -3960,7 +3959,7 @@ function DF:CreateFullBorder (name, parent) bottom:SetPoint("TOPLEFT", border, "BOTTOMLEFT", 0, 0) bottom:SetPoint("TOPRIGHT", border, "BOTTOMRIGHT", 0, 0) border.Bottom = bottom - tinsert(border.Textures, bottom) + table.insert(border.Textures, bottom) local top = border:CreateTexture("$parentTop", "BACKGROUND", nil, -8) --top:SetDrawLayer("BACKGROUND", -8) @@ -3969,7 +3968,7 @@ function DF:CreateFullBorder (name, parent) top:SetPoint("BOTTOMLEFT", border, "TOPLEFT", 0, 0) top:SetPoint("BOTTOMRIGHT", border, "TOPRIGHT", 0, 0) border.Top = top - tinsert(border.Textures, top) + table.insert(border.Textures, top) return border end @@ -4015,9 +4014,9 @@ function DF:CreateBorderWithSpread(parent, alpha1, alpha2, alpha3, size, spread) border3:SetColorTexture(0, 0, 0, alpha3 or default_border_color3) PixelUtil.SetWidth (border3, size, minPixels) - tinsert(parent.Borders.Layer1, border1) - tinsert(parent.Borders.Layer2, border2) - tinsert(parent.Borders.Layer3, border3) + table.insert(parent.Borders.Layer1, border1) + table.insert(parent.Borders.Layer2, border2) + table.insert(parent.Borders.Layer3, border3) --top local border1 = parent:CreateTexture(nil, "background") @@ -4038,9 +4037,9 @@ function DF:CreateBorderWithSpread(parent, alpha1, alpha2, alpha3, size, spread) border3:SetColorTexture(0, 0, 0, alpha3 or default_border_color3) PixelUtil.SetHeight(border3, size, minPixels) - tinsert(parent.Borders.Layer1, border1) - tinsert(parent.Borders.Layer2, border2) - tinsert(parent.Borders.Layer3, border3) + table.insert(parent.Borders.Layer1, border1) + table.insert(parent.Borders.Layer2, border2) + table.insert(parent.Borders.Layer3, border3) --right local border1 = parent:CreateTexture(nil, "background") @@ -4061,9 +4060,9 @@ function DF:CreateBorderWithSpread(parent, alpha1, alpha2, alpha3, size, spread) border3:SetColorTexture(0, 0, 0, alpha3 or default_border_color3) PixelUtil.SetWidth (border3, size, minPixels) - tinsert(parent.Borders.Layer1, border1) - tinsert(parent.Borders.Layer2, border2) - tinsert(parent.Borders.Layer3, border3) + table.insert(parent.Borders.Layer1, border1) + table.insert(parent.Borders.Layer2, border2) + table.insert(parent.Borders.Layer3, border3) local border1 = parent:CreateTexture(nil, "background") PixelUtil.SetPoint(border1, "bottomleft", parent, "bottomleft", 0 + spread, -1 + spread) @@ -4083,9 +4082,9 @@ function DF:CreateBorderWithSpread(parent, alpha1, alpha2, alpha3, size, spread) border3:SetColorTexture(0, 0, 0, alpha3 or default_border_color3) PixelUtil.SetHeight(border3, size, minPixels) - tinsert(parent.Borders.Layer1, border1) - tinsert(parent.Borders.Layer2, border2) - tinsert(parent.Borders.Layer3, border3) + table.insert(parent.Borders.Layer1, border1) + table.insert(parent.Borders.Layer2, border2) + table.insert(parent.Borders.Layer3, border3) end @@ -4295,6 +4294,51 @@ function DF:GetClassSpecIds(engClass) --naming conventions return DF:GetClassSpecIDs(engClass) end +local getDragonflightTalents = function() + if (not ClassTalentFrame) then + ClassTalentFrame_LoadUI() + end + + if (not DF.TalentExporter) then + local talentExporter = CreateFromMixins(ClassTalentImportExportMixin) + DF.TalentExporter = talentExporter + end + + local exportStream = ExportUtil.MakeExportDataStream() + + local configId = C_ClassTalents.GetActiveConfigID() + if (not configId) then + return "" + end + + local configInfo = C_Traits.GetConfigInfo(configId) + if (not configInfo) then + return "" + end + + local currentSpecID = PlayerUtil.GetCurrentSpecID() + + local treeInfo = C_Traits.GetTreeInfo(configId, configInfo.treeIDs[1]) + local treeHash = C_Traits.GetTreeHash(treeInfo.ID) + + local serializationVersion = C_Traits.GetLoadoutSerializationVersion() + + DF.TalentExporter:WriteLoadoutHeader(exportStream, serializationVersion, currentSpecID, treeHash) + DF.TalentExporter:WriteLoadoutContent(exportStream, configId, treeInfo.ID) + + return exportStream:GetExportString() +end + +--/dump DetailsFramework:GetDragonlightTalentExportString() +function DF:GetDragonlightTalentString() + local talentString, errorText = pcall(getDragonflightTalents) + if (errorText) then + return "" + else + return talentString + end +end + local dispatch_error = function(context, errortext) error((context or "") .. (errortext or "")) end @@ -4471,13 +4515,13 @@ function DF:GetCharacterRaceList() for i = 1, 100 do local raceInfo = C_CreatureInfo.GetRaceInfo(i) if (raceInfo and DF.RaceList [raceInfo.raceID]) then - tinsert(DF.RaceCache, {Name = raceInfo.raceName, FileString = raceInfo.clientFileString, ID = raceInfo.raceID}) + table.insert(DF.RaceCache, {Name = raceInfo.raceName, FileString = raceInfo.clientFileString, ID = raceInfo.raceID}) end if IS_WOW_PROJECT_MAINLINE then local alliedRaceInfo = C_AlliedRaces.GetRaceInfoByID(i) if (alliedRaceInfo and DF.AlliedRaceList [alliedRaceInfo.raceID]) then - tinsert(DF.RaceCache, {Name = alliedRaceInfo.maleName, FileString = alliedRaceInfo.raceFileString, ID = alliedRaceInfo.raceID}) + table.insert(DF.RaceCache, {Name = alliedRaceInfo.maleName, FileString = alliedRaceInfo.raceFileString, ID = alliedRaceInfo.raceID}) end end end @@ -4570,7 +4614,7 @@ function DF:GetCharacterPvPTalents(onlySelected, onlySelectedHash) if (onlySelectedHash) then talentList [talentID] = true else - tinsert(talentList, {Name = talentName, ID = talentID, Texture = texture, IsSelected = true}) + table.insert(talentList, {Name = talentName, ID = talentID, Texture = texture, IsSelected = true}) end end return talentList @@ -4584,7 +4628,7 @@ function DF:GetCharacterPvPTalents(onlySelected, onlySelectedHash) for _, talentID in ipairs(slotInfo.availableTalentIDs) do if (not alreadyAdded [talentID]) then local _, talentName, texture, selected = GetPvpTalentInfoByID (talentID) - tinsert(talentList, {Name = talentName, ID = talentID, Texture = texture, IsSelected = selected}) + table.insert(talentList, {Name = talentName, ID = talentID, Texture = texture, IsSelected = selected}) alreadyAdded [talentID] = true end end @@ -5089,9 +5133,9 @@ end do local get = function(self) - local object = tremove(self.notUse, #self.notUse) + local object = table.remove(self.notUse, #self.notUse) if (object) then - tinsert(self.inUse, object) + table.insert(self.inUse, object) if (self.onAcquire) then DF:QuickDispatch(self.onAcquire, object) end @@ -5100,7 +5144,7 @@ do --need to create the new object local newObject = self.newObjectFunc(self, unpack(self.payload)) if (newObject) then - tinsert(self.inUse, newObject) + table.insert(self.inUse, newObject) if (self.onAcquire) then DF:QuickDispatch(self.onAcquire, newObject) end @@ -5116,8 +5160,8 @@ do local release = function(self, object) for i = #self.inUse, 1, -1 do if (self.inUse[i] == object) then - tremove(self.inUse, i) - tinsert(self.notUse, object) + table.remove(self.inUse, i) + table.insert(self.notUse, object) if (self.onRelease) then DF:QuickDispatch(self.onRelease, object) @@ -5129,8 +5173,8 @@ do local reset = function(self) for i = #self.inUse, 1, -1 do - local object = tremove(self.inUse, i) - tinsert(self.notUse, object) + local object = table.remove(self.inUse, i) + table.insert(self.notUse, object) if (self.onReset) then DF:QuickDispatch(self.onReset, object) diff --git a/Libs/DF/rounded_panel.lua b/Libs/DF/rounded_panel.lua index e601714f7..aab3aa075 100644 --- a/Libs/DF/rounded_panel.lua +++ b/Libs/DF/rounded_panel.lua @@ -201,6 +201,9 @@ detailsFramework.RoundedCornerPanelMixin = { PixelUtil.SetPoint(centerBlock, "bottomright", self.CornerTextures["BottomRight"], "topright", 0, 0) centerBlock:SetColorTexture(unpack(defaultColorTable)) + self:CreateBorder() + self:SetBorderCornerColor(0, 0, 0, 0) + self.CenterTextures[#self.CenterTextures+1] = topHorizontalEdge self.CenterTextures[#self.CenterTextures+1] = bottomHorizontalEdge self.CenterTextures[#self.CenterTextures+1] = centerBlock diff --git a/Libs/LibLuaServer/LibLuaServer.lua b/Libs/LibLuaServer/LibLuaServer.lua index efc86dddc..463419ce0 100644 --- a/Libs/LibLuaServer/LibLuaServer.lua +++ b/Libs/LibLuaServer/LibLuaServer.lua @@ -320,7 +320,9 @@ function LibStub:IterateLibraries()end ---@alias actorid string unique id of a unit (GUID) ---@alias serial string unique id of a unit (GUID) ---@alias guid string unique id of a unit (GUID) ----@alias mapid nmber each map in the game has a unique map id, this id can be used to identify a map. +---@alias keylevel number the level of a mythic dungeon key +---@alias mapid number each map in the game has a unique map id, this id can be used to identify a map. +---@alias challengemapid number each challenge mode map in the game has a unique map id, this id can be used to identify a challenge mode map. ---@alias specializationid number the ID of a class specialization ---@alias controlflags number flags telling what unit type the is (player, npc, pet, etc); it's relatiotionship to the player (friendly, hostile, etc); who controls the unit (controlled by the player, controlled by the server, etc) ---@alias color table @table(r: red|number, g: green|number, b: blue|number, a: alpha|number) @table(number, number, number, number) @string(color name) @hex (000000-ffffff) value representing a color, the value must be a table with the following fields: r, g, b, a. r, g, b are numbers between 0 and 1, a is a number between 0 and 1. To retrieve a color from a string or table use: local red, green, blue, alpha = DetailsFramework:ParseColors(color) @@ -338,6 +340,7 @@ function LibStub:IterateLibraries()end ---@alias combattime number elapsed time of a combat or time in seconds that a unit has been in combat. ---@alias auraduration number ---@alias gametime number number of seconds that have elapsed since the start of the game session. +---@alias milliseconds number a number in milliseconds, usually need to divide by 1000 to get the seconds. ---@alias coordleft number ---@alias coordright number ---@alias coordtop number diff --git a/boot.lua b/boot.lua index 038b8003c..e31d9f70c 100644 --- a/boot.lua +++ b/boot.lua @@ -1271,12 +1271,7 @@ do SharedMedia:Register("sound", "Details Horn", [[Interface\Addons\Details\sounds\Details Horn.ogg]]) SharedMedia:Register("sound", "Details Warning", [[Interface\Addons\Details\sounds\Details Warning 100.ogg]]) - --SharedMedia:Register("sound", "Details Warning (Volume 75%)", [[Interface\Addons\Details\sounds\Details Warning 75.ogg]]) - --SharedMedia:Register("sound", "Details Warning Volume 50%", [[Interface\Addons\Details\sounds\Details Warning 50.ogg]]) - --SharedMedia:Register("sound", "Details Warning Volume 25%", [[Interface\Addons\Details\sounds\Details Warning 25.ogg]]) - - - + SharedMedia:Register("sound", "Details Truck", [[Interface\Addons\Details\sounds\Details Truck.ogg]]) --dump table contents over chat panel function Details.VarDump(t) diff --git a/classes/class_damage.lua b/classes/class_damage.lua index af46390a5..b62c44221 100644 --- a/classes/class_damage.lua +++ b/classes/class_damage.lua @@ -3961,7 +3961,6 @@ function damageClass:ToolTip_DamageDone (instancia, numero, barra, keydown) end GameCooltip:SetOption("AlignAsBlizzTooltip", false) - GameCooltip:SetOption("AlignAsBlizzTooltipFrameHeightOffset", -6) GameCooltip:SetOption("YSpacingMod", -6) local iconSize = Details.DefaultTooltipIconSize diff --git a/classes/class_instance.lua b/classes/class_instance.lua index db1e4f7ba..6d150aa00 100644 --- a/classes/class_instance.lua +++ b/classes/class_instance.lua @@ -1041,6 +1041,13 @@ end end end + ---reopen all closed windows that does not have the option "Ignore Mass Toogle" enabled + ---@param ... unknown + ---@return nil + function Details:ReopenAllWindows(...) + return Details:ReabrirTodasInstancias(...) + end + -- reabre todas as instancias function Details:ReabrirTodasInstancias (temp) for index = math.min (#Details.tabela_instancias, Details.instances_amount), 1, -1 do @@ -3180,6 +3187,19 @@ function Details:ChangeIcon(icon) skin = Details.skins [Details.default_skin_to_use] end + local titleBarIconSize + + local iconSizeFromInstance = self.attribute_icon_size + if (iconSizeFromInstance and iconSizeFromInstance ~= 0) then + titleBarIconSize = iconSizeFromInstance + + elseif (skin.attribute_icon_size) then + titleBarIconSize = skin.attribute_icon_size + + else + titleBarIconSize = 16 + end + if (not self.hide_icon) then if (skin.icon_on_top) then self.baseframe.cabecalho.atributo_icon:SetParent(self.floatingframe) @@ -3194,8 +3214,7 @@ function Details:ChangeIcon(icon) self.baseframe.cabecalho.atributo_icon:SetTexCoord(5/64, 60/64, 3/64, 62/64) local icon_size = skin.icon_plugins_size - self.baseframe.cabecalho.atributo_icon:SetWidth(icon_size[1]) - self.baseframe.cabecalho.atributo_icon:SetHeight(icon_size[2]) + self.baseframe.cabecalho.atributo_icon:SetSize(titleBarIconSize, titleBarIconSize) local icon_anchor = skin.icon_anchor_plugins self.baseframe.cabecalho.atributo_icon:ClearAllPoints() @@ -3214,8 +3233,7 @@ function Details:ChangeIcon(icon) self.baseframe.cabecalho.atributo_icon:SetTexCoord(5/64, 60/64, 3/64, 62/64) local icon_size = skin.icon_plugins_size - self.baseframe.cabecalho.atributo_icon:SetWidth(icon_size[1]) - self.baseframe.cabecalho.atributo_icon:SetHeight(icon_size[2]) + self.baseframe.cabecalho.atributo_icon:SetSize(titleBarIconSize, titleBarIconSize) local icon_anchor = skin.icon_anchor_plugins self.baseframe.cabecalho.atributo_icon:ClearAllPoints() @@ -3233,7 +3251,7 @@ function Details:ChangeIcon(icon) local p = 0.125 --32/256 self.baseframe.cabecalho.atributo_icon:SetTexCoord(p * (self.sub_atributo-1), p * (self.sub_atributo), 0, 1) - self.baseframe.cabecalho.atributo_icon:SetSize(16, 16) + self.baseframe.cabecalho.atributo_icon:SetSize(titleBarIconSize, titleBarIconSize) self.baseframe.cabecalho.atributo_icon:ClearAllPoints() if (self.menu_attribute_string) then @@ -3245,13 +3263,8 @@ function Details:ChangeIcon(icon) self.baseframe.cabecalho.atributo_icon:ClearAllPoints() self.baseframe.cabecalho.atributo_icon:SetPoint("topleft", self.baseframe.cabecalho.ball_point, "topleft", skin.attribute_icon_anchor[1], skin.attribute_icon_anchor[2]) end - - if (skin.attribute_icon_size) then - self.baseframe.cabecalho.atributo_icon:SetSize(unpack(skin.attribute_icon_size)) - end - - end + elseif (self.modo == modo_raid) then --raid --icon is set by the plugin end diff --git a/classes/include_instance.lua b/classes/include_instance.lua index eb45d49c3..ee8f9d853 100644 --- a/classes/include_instance.lua +++ b/classes/include_instance.lua @@ -182,6 +182,8 @@ _detalhes.instance_defaults = { show_timer_bg = true, --show the timer within battleground, the timer is the elapsed battleground time show_timer_arena = true, ---show the timer within arena, the timer is the elapsed time of the arena match }, + --attribute icon size + attribute_icon_size = 0, --auto hide window borders statusbar main menu menu_alpha = {enabled = false, iconstoo = true, onenter = 1, onleave = 1, ignorebars = false}, --instance button anchor store the anchor point of instance and delete button @@ -191,6 +193,8 @@ _detalhes.instance_defaults = { --row animation when show row_show_animation = {anim = "Fade", options = {}}, + rounded_corner_enabled = false, + --use one fontstring for each value in the lines, e.g. one fontstring to damage done, another fontstring to dps and another to percent amount use_multi_fontstrings = true, use_auto_align_multi_fontstrings = true, @@ -284,12 +288,14 @@ _detalhes.instance_defaults = { fixed_texture_background_color = {0, 0, 0, 0}, --space between bars space = {left = 3, right = -5, between = 1}, + row_offsets = {left = 0, right = 0, top = 0, bottom = 0}, --icon file icon_size_offset = 0, icon_file = [[Interface\AddOns\Details\images\classes_small]], no_icon = false, start_after_icon = true, icon_grayscale = false, + icon_mask = "", --icon offset icon_offset = {0, 0}, --x y --percent type diff --git a/core/control.lua b/core/control.lua index fb91b8a12..721f33d24 100644 --- a/core/control.lua +++ b/core/control.lua @@ -1499,24 +1499,24 @@ GameCooltip:AddStatusBar (100, 1, 0, 0, 0, 0.8) end - function Details:AddTooltipBackgroundStatusbar (side, value, useSpark, statusBarColor) + 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 --[[spark options - ["SparkTexture"] = true, - ["SparkHeightOffset"] = true, - ["SparkWidthOffset"] = true, - ["SparkHeight"] = true, - ["SparkWidth"] = true, - ["SparkAlpha"] = true, - ["SparkColor"] = true, - ["SparkPositionXOffset"] = true, - ["SparkPositionYOffset"] = true, + ["SparkTexture"] = true, + ["SparkHeightOffset"] = true, + ["SparkWidthOffset"] = true, + ["SparkHeight"] = true, + ["SparkWidth"] = true, + ["SparkAlpha"] = true, + ["SparkColor"] = true, + ["SparkPositionXOffset"] = true, + ["SparkPositionYOffset"] = true, --]] - useSpark = true + useSpark = value ~= 100 --GameCooltip:SetOption("SparkHeightOffset", 6) GameCooltip:SetOption("SparkTexture", [[Interface\Buttons\WHITE8X8]]) GameCooltip:SetOption("SparkWidth", 1) @@ -1536,7 +1536,6 @@ 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]]}) - else GameCooltip:AddStatusBar (value, 2, unpack(Details.tooltip.bar_color)) end @@ -1549,7 +1548,7 @@ -- /run local a,b=Details.tooltip.header_statusbar,0.3;a[1]=b;a[2]=b;a[3]=b;a[4]=0.8; - function Details:AddTooltipSpellHeaderText (headerText, headerColor, amount, iconTexture, L, R, T, B, separator, iconSize) + function Details:AddTooltipSpellHeaderText(headerText, headerColor, amount, iconTexture, L, R, T, B, separator, iconSize) if (separator and separator == true) then GameCooltip:AddLine ("", "", nil, nil, 1, 1, 1, 1, 8) return @@ -1576,9 +1575,10 @@ local GameCooltip = GameCooltip GameCooltip:Reset() - GameCooltip:SetType ("tooltip") + GameCooltip:SetType("tooltip") - GameCooltip:SetOption("StatusBarTexture", [[Interface\AddOns\Details\images\bar_background_dark_withline]]) + --GameCooltip:SetOption("StatusBarTexture", [[Interface\AddOns\Details\images\bar_background_dark_withline]]) + GameCooltip:SetOption("StatusBarTexture", [[Interface\AddOns\Details\images\bar_textures\bar_rounded.png]]) GameCooltip:SetOption("TextSize", Details.tooltip.fontsize) GameCooltip:SetOption("TextFont", Details.tooltip.fontface) @@ -1586,8 +1586,8 @@ GameCooltip:SetOption("TextColorRight", Details.tooltip.fontcolor_right) GameCooltip:SetOption("TextShadow", Details.tooltip.fontshadow and "OUTLINE") - 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("LeftBorderSize", -0) --offset between the left border and the left icon, default: 10 + offset + GameCooltip:SetOption("RightBorderSize", 0) --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", false) diff --git a/core/parser.lua b/core/parser.lua index 9d6771be4..6138b23d2 100755 --- a/core/parser.lua +++ b/core/parser.lua @@ -5888,42 +5888,12 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 end) end - local okay, errorText = pcall(function() - local mapChallengeModeID, mythicLevel, time, onTime, keystoneUpgradeLevels, practiceRun, oldOverallDungeonScore, newOverallDungeonScore, IsMapRecord, IsAffixRecord, PrimaryAffix, isEligibleForScore, members = C_ChallengeMode.GetCompletionInfo() - if (mapChallengeModeID) then - local statName = "mythicdungeoncompletedDF2" - local mythicDungeonRuns = Details222.PlayerStats:GetStat(statName) - mythicDungeonRuns = mythicDungeonRuns or {} - - mythicDungeonRuns[mapChallengeModeID] = mythicDungeonRuns[mapChallengeModeID] or {} - mythicDungeonRuns[mapChallengeModeID][mythicLevel] = mythicDungeonRuns[mapChallengeModeID][mythicLevel] or {} - - local currentRun = mythicDungeonRuns[mapChallengeModeID][mythicLevel] - currentRun.completed = (currentRun.completed or 0) + 1 - currentRun.totalTime = (currentRun.totalTime or 0) + time - if (not currentRun.minTime or time < currentRun.minTime) then - currentRun.minTime = time - end - - currentRun.history = currentRun.history or {} - local day, month, year = tonumber(date("%d")), tonumber(date("%m")), tonumber(date("%Y")) - local amountDeaths = C_ChallengeMode.GetDeathCount() or 0 - tinsert(currentRun.history, {day = day, month = month, year = year, runTime = time, onTime = onTime, deaths = amountDeaths, affix = PrimaryAffix}) - - Details222.PlayerStats:SetStat("mythicdungeoncompletedDF2", mythicDungeonRuns) - end - end) - --send mythic dungeon end event local zoneName, instanceType, difficultyID, difficultyName, maxPlayers, dynamicDifficulty, isDynamic, instanceMapID, instanceGroupSize = GetInstanceInfo() if (difficultyID == 8) then Details:SendEvent("COMBAT_MYTHICDUNGEON_END") end - if (not okay) then - Details:Msg("something went wrong (0x7878):", errorText) - end - Details222.MythicPlus.LogStep("===== Mythic+ Finished =====") end diff --git a/core/plugins.lua b/core/plugins.lua index 3b1ba014e..11c791a22 100644 --- a/core/plugins.lua +++ b/core/plugins.lua @@ -495,6 +495,15 @@ end end + function Details:CreateRightClickToCloseLabel(parent) + local mouseIcon = detailsFramework:CreateAtlasString(Details:GetTextureAtlas("right-mouse-click"), 12, 9) + local rightClickToBackLabel = detailsFramework:CreateLabel(parent, mouseIcon .. " right click to close", "GameFontNormal") + rightClickToBackLabel:SetAlpha(0.834) + rightClickToBackLabel.textcolor = "gray" + parent.RightClickLabel = rightClickToBackLabel + return rightClickToBackLabel + end + function Details:CreatePluginWindowContainer() local pluginContainerFrame = CreateFrame("frame", "DetailsPluginContainerWindow", UIParent, "BackdropTemplate") pluginContainerFrame:EnableMouse(true) @@ -548,10 +557,8 @@ DetailsFramework:BuildStatusbarAuthorInfo(statusBar) - local rightClickToBackLabel = detailsFramework:CreateLabel(statusBar, "right click to close", "GameFontNormal") + local rightClickToBackLabel = Details:CreateRightClickToCloseLabel(statusBar) rightClickToBackLabel:SetPoint("bottomright", statusBar, "bottomright", -150, 5) - rightClickToBackLabel:SetAlpha(0.834) - rightClickToBackLabel.textcolor = "gray" local bigDogTexture = detailsFramework:NewImage(optionsLeftSideBarMenu, [[Interface\MainMenuBar\UI-MainMenuBar-EndCap-Human]], 180*0.7, 200*0.7, "overlay", {0, 1, 0, 1}, "backgroundBigDog", "$parentBackgroundBigDog") bigDogTexture:SetPoint("bottomleft", custom_window, "bottomleft", 0, 1) diff --git a/core/windows.lua b/core/windows.lua index df31095c6..2462ba689 100644 --- a/core/windows.lua +++ b/core/windows.lua @@ -720,8 +720,9 @@ self.barras [index]:SetWidth(self.baseframe:GetWidth()+self.bar_mod) end else + local rightOffset = self.row_info.row_offsets.right for index = 1, self.rows_fit_in_window do - self.barras [index]:SetWidth(self.baseframe:GetWidth()+self.row_info.space.right) + self.barras [index]:SetWidth(self.baseframe:GetWidth()+self.row_info.space.right + rightOffset) end end diff --git a/frames/window_breakdown/window_playerbreakdown.lua b/frames/window_breakdown/window_playerbreakdown.lua index 0d18855f8..a5a7be807 100644 --- a/frames/window_breakdown/window_playerbreakdown.lua +++ b/frames/window_breakdown/window_playerbreakdown.lua @@ -317,6 +317,19 @@ function Details:SetWindowColor(r, g, b, a) colorTable[2] = g colorTable[3] = b colorTable[4] = a + + local instanceTable = Details:GetAllInstances() + for _, instance in ipairs(instanceTable) do + if (instance:IsEnabled()) then + local baseFrame = instance.baseframe + local fullWindowFrame = baseFrame.fullWindowFrame + if (fullWindowFrame.__rcorners) then + if (fullWindowFrame.BottomHorizontalEdge:IsShown()) then + fullWindowFrame:SetColor(r, g, b, a) + end + end + end + end end ---open the breakdown window @@ -870,6 +883,9 @@ function Details:CreateBreakdownWindow() statusBar.Text.fontcolor = fontColor end + local rightClickToCloseLabel = Details:CreateRightClickToCloseLabel(statusBar) + rightClickToCloseLabel:SetPoint("right", -332, 4) + --set default text breakdownWindowFrame:SetStatusbarText() diff --git a/frames/window_breakdown/window_playerbreakdown_spells_options.lua b/frames/window_breakdown/window_playerbreakdown_spells_options.lua index 683a08f06..c40fac8e0 100644 --- a/frames/window_breakdown/window_playerbreakdown_spells_options.lua +++ b/frames/window_breakdown/window_playerbreakdown_spells_options.lua @@ -33,6 +33,9 @@ local createOptionsPanel = function() --apply rounded corners with the breakdown window preset DF:AddRoundedCornersToFrame(optionsFrame, Details.PlayerBreakdown.RoundedCornerPreset) + local closeButton = DF:CreateCloseButton(optionsFrame, "$parentTopRightCloseButton") + closeButton:SetPoint("topright", optionsFrame, "topright", -5, -5) + Details:RefreshWindowColor() local resetSettings = function() @@ -93,16 +96,16 @@ local createOptionsPanel = function() --/run Details.frame_background_color = {0.1215, 0.1176, 0.1294, 0.934} - local normalizedRed = DF.Math.MapRangeClamped(0, 1, 0, 0.1215, r) - local normalizedGreen = DF.Math.MapRangeClamped(0, 1, 0, 0.1176, g) - local normalizedBlue = DF.Math.MapRangeClamped(0, 1, 0, 0.1294, b) - local normalizedAlpha = DF.Math.MapRangeClamped(0, 1, 0.8, 0.98, a) + r = math.min(r, 0.1215) + g = math.min(g, 0.1176) + b = math.min(b, 0.1294) + a = math.min(a, 0.934) - colorTable[1] = normalizedRed - colorTable[2] = normalizedGreen - colorTable[3] = normalizedBlue - colorTable[4] = normalizedAlpha - Details:SetWindowColor(normalizedRed, normalizedGreen, normalizedBlue, normalizedAlpha) + colorTable[1] = r + colorTable[2] = g + colorTable[3] = b + colorTable[4] = a + Details:SetWindowColor(r, g, b, a) end, name = "Background Color", desc = "Background Color", diff --git a/frames/window_main.lua b/frames/window_main.lua index 4294938d7..3f27e1af2 100644 --- a/frames/window_main.lua +++ b/frames/window_main.lua @@ -2074,7 +2074,7 @@ local iconFrame_OnEnter = function(self) local spellid = actor.damage_spellid or actor.id or actor[1] if (spellid) then GameTooltip:SetOwner(self, "ANCHOR_TOPLEFT", 0, 10) - Details:GameTooltipSetSpellByID (spellid) + Details:GameTooltipSetSpellByID(spellid) GameTooltip:Show() end @@ -2156,10 +2156,6 @@ local iconFrame_OnEnter = function(self) Details:AddTooltipBackgroundStatusbar() end - GameCooltip:SetOption("StatusBarTexture", [[Interface\AddOns\Details\images\bar_skyline]]) - GameCooltip:SetOption("MinButtonHeight", 15) - GameCooltip:SetOption("IgnoreButtonAutoHeight", false) - local height = 66 if (not gotInfo) then GameCooltip:AddLine(Loc["STRING_QUERY_INSPECT"], nil, 1, "orange") @@ -2198,6 +2194,8 @@ local iconFrame_OnEnter = function(self) local actorName = actor:GetName() local RaiderIO = _G.RaiderIO + local lineHeight = 21 + if (RaiderIO) then local addedInfo = false @@ -2237,7 +2235,7 @@ local iconFrame_OnEnter = function(self) GameCooltip:AddIcon([[]], 1, 1, 1, 20) Details:AddTooltipBackgroundStatusbar() --increase frame height - height = height + 19 + height = height + lineHeight end else if (WOW_PROJECT_ID == WOW_PROJECT_MAINLINE and C_PlayerInfo) then --is retail? @@ -2249,7 +2247,7 @@ local iconFrame_OnEnter = function(self) GameCooltip:AddIcon([[]], 1, 1, 1, 20) Details:AddTooltipBackgroundStatusbar() --increase frame height - height = height + 19 + height = height + lineHeight end end end @@ -2260,7 +2258,7 @@ local iconFrame_OnEnter = function(self) GameCooltip:AddLine("Evoker Predicted Damage:", Details:Format(damageDone) .. " (" .. Details:Format(damageDone / Details:GetCurrentCombat():GetCombatTime()) .. ")", 1, "white") GameCooltip:AddIcon([[]], 1, 1, 1, 20) Details:AddTooltipBackgroundStatusbar() - height = height + 19 + height = height + lineHeight end if (actor.classe == "UNKNOW") then @@ -2273,11 +2271,14 @@ local iconFrame_OnEnter = function(self) GameCooltip:AddLine("NpcID:", npcId) GameCooltip:AddIcon([[]], 1, 1, 1, 20) Details:AddTooltipBackgroundStatusbar() - height = height + 19 + height = height + lineHeight end end - GameCooltip:SetOption("FixedHeight", height) + GameCooltip:SetOption("StatusBarTexture", [[Interface\AddOns\Details\images\bar_skyline]]) + GameCooltip:SetOption("FixedHeight", height+11) + GameCooltip:SetOption("LineHeightSizeOffset", -8) + GameCooltip:ShowRoundedCorner() GameCooltip:ShowCooltip() self.unitname = name @@ -3940,13 +3941,20 @@ function Details:SetBarGrowDirection (direction) end self.bars_grow_direction = direction - local x = self.row_info.space.left + + local topOffset = self.row_info.row_offsets.top + local bottomOffset = self.row_info.row_offsets.bottom + local leftOffset = self.row_info.row_offsets.left + + local x = self.row_info.space.left + leftOffset local bars = self.barras or self.Bars --.Bars for third-party plugins local baseframe = self.baseframe or self.Frame --.Frame for plugins local height = self.row_height if (direction == 1) then --top to bottom + local row_y_offset = topOffset + for index, row in ipairs(bars) do local y = height * (index - 1) y = y * -1 @@ -3954,23 +3962,25 @@ function Details:SetBarGrowDirection (direction) if (self.toolbar_side == 1) then --if titlebar is attached to the top side, don't add any midifiers - row:SetPoint("topleft", baseframe, "topleft", x, y) + row:SetPoint("topleft", baseframe, "topleft", x, y + row_y_offset) else --if the titlebar is on the bottom side, remove the gap between the baseframe and the titlebar - row:SetPoint("topleft", baseframe, "topleft", x, y - 1) + row:SetPoint("topleft", baseframe, "topleft", x, y - 1 + row_y_offset) end end elseif (direction == 2) then --bottom to top + local row_y_offset = bottomOffset + for index, row in ipairs(bars) do local y = height * (index - 1) row:ClearAllPoints() if (self.toolbar_side == 1) then --if the titlebar is attached to the top side, we want to align bars a little above - row:SetPoint("bottomleft", baseframe, "bottomleft", x, y + 2) + row:SetPoint("bottomleft", baseframe, "bottomleft", x, y + 2 + row_y_offset) else --the titlebar is on the bottom side, align bars on the bottom - row:SetPoint("bottomleft", baseframe, "bottomleft", x, y + 0) + row:SetPoint("bottomleft", baseframe, "bottomleft", x, y + 0 + row_y_offset) end end end @@ -3978,11 +3988,13 @@ function Details:SetBarGrowDirection (direction) --update all row width if (self.bar_mod and self.bar_mod ~= 0) then for index = 1, #bars do - bars [index]:SetWidth(baseframe:GetWidth() + self.bar_mod) + bars[index]:SetWidth(baseframe:GetWidth() + self.bar_mod) end else + --width also set on windows.lua > Reajusta Gump () + local rightOffset = self.row_info.row_offsets.right for index = 1, #bars do - bars [index]:SetWidth(baseframe:GetWidth() + self.row_info.space.right) + bars[index]:SetWidth(baseframe:GetWidth() + self.row_info.space.right + rightOffset) end end end @@ -4076,7 +4088,7 @@ function gump:CreateNewLine(instance, index) --row height newLine:SetHeight(instance.row_info.height) - newLine:SetWidth(baseframe:GetWidth()+instance.row_info.space.right) + newLine:SetWidth(baseframe:GetWidth()+instance.row_info.space.right + instance.row_info.row_offsets.right) newLine:SetFrameLevel(baseframe:GetFrameLevel() + 4) newLine.last_value = 0 newLine.w_mod = 0 @@ -4792,6 +4804,8 @@ function Details:InstanceRefreshRows(instance) local start_after_icon = self.row_info.start_after_icon local isDesaturated = self.row_info.icon_grayscale local icon_offset_x, icon_offset_y = unpack(self.row_info.icon_offset) + local iconMask = self.row_info.icon_mask + local bHasIconMask = iconMask ~= "" --line border local lineBorderEnabled = self.row_info.backdrop.enabled @@ -4911,6 +4925,21 @@ function Details:InstanceRefreshRows(instance) end end + if (bHasIconMask) then + if (not row.icone_classe.maskTexture) then + row.icone_classe.maskTexture = row:CreateMaskTexture("$parentClassIconMask", "overlay") + row.icone_classe.maskTexture:SetAllPoints(row.icone_classe) + row.icone_classe:AddMaskTexture(row.icone_classe.maskTexture) + end + row.icone_classe.maskTexture:SetTexture(iconMask) + row.icone_classe.maskTexture:Show() + else + if (row.icone_classe.maskTexture) then + row.icone_classe.maskTexture:Hide() + row.icone_classe.maskTexture:SetTexture("") + end + end + if (not self.row_info.texture_background_class_color) then local color = self.row_info.fixed_texture_background_color row.background:SetVertexColor(color[1], color[2], color[3], color[4]) @@ -7359,32 +7388,27 @@ function Details:ChangeSkin(skin_name) self.bgframe:SetScript("OnUpdate", nil) self.bgframe.skin_script = nil - --check if the skin has control scripts to run - if (not just_updating or Details.initializing) then - local callbackFunc = this_skin.callback - if (callbackFunc) then - DetailsFramework:SetEnvironment(callbackFunc) - local okey, result = pcall(callbackFunc, this_skin, self, just_updating) - if (not okey) then - Details:Msg("|cFFFF9900error on skin callback function|r:", result) - end - end + local baseFrame = self.baseframe + local fullWindowFrame = baseFrame.fullWindowFrame - if (this_skin.control_script) then - local onStartScript = this_skin.control_script_on_start - if (onStartScript) then - DetailsFramework:SetEnvironment(onStartScript) - local okey, result = pcall(onStartScript, this_skin, self) - if (not okey) then - Details:Msg("|cFFFF9900error on skin control on start function|r:", result) - end - end + if (self.rounded_corner_enabled) then + baseFrame:SetBackdropColor(0, 0, 0, 0) + baseFrame:SetBackdropBorderColor(0, 0, 0, 0) + baseFrame:SetBackdrop(nil) - local controlFunc = this_skin.control_script - DetailsFramework:SetEnvironment(controlFunc) - self.bgframe:SetScript("OnUpdate", controlFunc) - self.bgframe.skin_script = true - self.bgframe.skin = this_skin + fullWindowFrame = baseFrame.fullWindowFrame + if (not fullWindowFrame.__rcorners) then + local preset = Details.PlayerBreakdown.RoundedCornerPreset + DetailsFramework:AddRoundedCornersToFrame(fullWindowFrame, preset) + else + fullWindowFrame:EnableRoundedCorners() + end + + self.menu_attribute_string:SetParent(fullWindowFrame) + else + if (fullWindowFrame.__rcorners) then + fullWindowFrame:DisableRoundedCorners() + self.menu_attribute_string:SetParent(baseFrame) end end @@ -8125,6 +8149,7 @@ function Details:AttributeMenu (enabled, pos_x, pos_y, font, size, color, side, if (not self.menu_attribute_string) then --local label = gump:NewLabel(self.floatingframe, nil, "DetailsAttributeStringInstance" .. self.meu_id, nil, "", "GameFontHighlightSmall") local label = gump:NewLabel(self.baseframe, nil, "DetailsAttributeStringInstance" .. self.meu_id, nil, "", "GameFontHighlightSmall") + self.baseframe.titleText = label self.menu_attribute_string = label self.menu_attribute_string.owner_instance = self self.menu_attribute_string.Enabled = true diff --git a/frames/window_mythicplus/window_end_of_run.lua b/frames/window_mythicplus/window_end_of_run.lua index 2a658a1b5..ac50afe13 100644 --- a/frames/window_mythicplus/window_end_of_run.lua +++ b/frames/window_mythicplus/window_end_of_run.lua @@ -896,6 +896,9 @@ function mythicDungeonFrames.ShowEndOfMythicPlusPanel() readyFrame.StartTextDotAnimation() + --/run PlaySound(SOUNDKIT.UI_70_CHALLENGE_MODE_KEYSTONE_UPGRADE); + --PlaySound(SOUNDKIT.UI_70_CHALLENGE_MODE_COMPLETE_NO_UPGRADE); + --fin the overall mythic dungeon combat, starting with the current combat ---@type combat local overallMythicDungeonCombat = Details:GetCurrentCombat() diff --git a/functions/mythicdungeon/mythicdungeon.lua b/functions/mythicdungeon/mythicdungeon.lua index 0c93462ae..f5149e8cb 100644 --- a/functions/mythicdungeon/mythicdungeon.lua +++ b/functions/mythicdungeon/mythicdungeon.lua @@ -205,6 +205,7 @@ DetailsMythicPlusFrame.EventListener:RegisterEvent("COMBAT_PLAYER_ENTER") DetailsMythicPlusFrame.EventListener:RegisterEvent("COMBAT_PLAYER_LEAVE") DetailsMythicPlusFrame.EventListener:RegisterEvent("COMBAT_MYTHICDUNGEON_START") DetailsMythicPlusFrame.EventListener:RegisterEvent("COMBAT_MYTHICDUNGEON_END") +DetailsMythicPlusFrame.EventListener:RegisterEvent("COMBAT_MYTHICPLUS_OVERALL_READY") function DetailsMythicPlusFrame.EventListener.OnDetailsEvent(contextObject, event, ...) --these events triggers within Details control functions, they run exactly after details! creates or close a segment @@ -328,6 +329,9 @@ function DetailsMythicPlusFrame.EventListener.OnDetailsEvent(contextObject, even --delay to wait the encounter_end trigger first --assuming here the party cleaned the mobs kill objective before going to kill the last boss C_Timer.After(2, DetailsMythicPlusFrame.MythicDungeonFinished) + + elseif (event == "COMBAT_MYTHICPLUS_OVERALL_READY") then + DetailsMythicPlusFrame.SaveMythicPlusStats(...) end end @@ -368,3 +372,78 @@ DetailsMythicPlusFrame:SetScript("OnEvent", function(_, event, ...) end end end) + +---@param combatObject combat +function DetailsMythicPlusFrame.SaveMythicPlusStats(combatObject) + local mapChallengeModeID, mythicLevel, time, onTime, keystoneUpgradeLevels, practiceRun, oldOverallDungeonScore, newOverallDungeonScore, IsMapRecord, IsAffixRecord, PrimaryAffix, isEligibleForScore, members = C_ChallengeMode.GetCompletionInfo() + if (mapChallengeModeID) then + local statName = "mythicdungeoncompletedDF2" + + ---@type table + local mythicDungeonRuns = Details222.PlayerStats:GetStat(statName) + if (not mythicDungeonRuns) then + mythicDungeonRuns = mythicDungeonRuns or {} + end + + --mythicDungeonRuns [mapChallengeModeID] [mythicLevel] + + ---@class mythicplusrunstats + ---@field onTime boolean + ---@field deaths number + ---@field date number + ---@field affix number + ---@field runTime milliseconds + ---@field combatTime number + + ---@class mythicplusstats + ---@field completed number + ---@field totalTime number + ---@field minTime number + ---@field history mythicplusrunstats[] + + ---@type table + local statsForDungeon = mythicDungeonRuns[mapChallengeModeID] + if (not statsForDungeon) then + statsForDungeon = {} + mythicDungeonRuns[mapChallengeModeID] = statsForDungeon + end + + ---@type mythicplusstats + local statsForLevel = statsForDungeon[mythicLevel] + if (not statsForLevel) then + ---@type mythicplusstats + statsForLevel = { + completed = 0, + totalTime = 0, + minTime = 0, + history = {}, + } + statsForDungeon[mythicLevel] = statsForLevel + end + + statsForLevel.completed = (statsForLevel.completed or 0) + 1 + statsForLevel.totalTime = (statsForLevel.totalTime or 0) + time + if (not statsForLevel.minTime or time < statsForLevel.minTime) then + statsForLevel.minTime = time + end + + statsForLevel.history = statsForLevel.history or {} + + local amountDeaths = C_ChallengeMode.GetDeathCount() or 0 + + ---@type mythicplusrunstats + local runStats = { + date = time(), + runTime = math.floor(time/1000), + onTime = onTime, + deaths = amountDeaths, + affix = PrimaryAffix, + combatTime = combatObject:GetCombatTime(), + } + + table.insert(statsForLevel.history, runStats) + + Details222.PlayerStats:SetStat("mythicdungeoncompletedDF2", mythicDungeonRuns) + end +end + diff --git a/functions/mythicdungeon/segments.lua b/functions/mythicdungeon/segments.lua index f33c51b4d..ec3bdf093 100644 --- a/functions/mythicdungeon/segments.lua +++ b/functions/mythicdungeon/segments.lua @@ -364,7 +364,8 @@ function DetailsMythicPlusFrame.MergeSegmentsOnEnd() --~merge end end - Details:SendEvent("COMBAT_MYTHICPLUS_OVERALL_READY") + local bHasObject = false + Details:SendEvent("COMBAT_MYTHICPLUS_OVERALL_READY", bHasObject, newCombat) end --this function merges trash segments after all bosses of the mythic dungeon are defeated diff --git a/images/bar_textures/bar_rounded.png b/images/bar_textures/bar_rounded.png new file mode 100644 index 000000000..1da234410 Binary files /dev/null and b/images/bar_textures/bar_rounded.png differ diff --git a/sounds/Details Horn.ogg b/sounds/Details Horn.ogg index 264934139..9fb92a115 100644 Binary files a/sounds/Details Horn.ogg and b/sounds/Details Horn.ogg differ diff --git a/sounds/Details Truck.ogg b/sounds/Details Truck.ogg new file mode 100644 index 000000000..3477b1b97 Binary files /dev/null and b/sounds/Details Truck.ogg differ diff --git a/sounds/Details Warning 25.ogg b/sounds/Details Warning 25.ogg deleted file mode 100644 index 2b33aab24..000000000 Binary files a/sounds/Details Warning 25.ogg and /dev/null differ diff --git a/sounds/Details Warning 50.ogg b/sounds/Details Warning 50.ogg deleted file mode 100644 index f77befdc3..000000000 Binary files a/sounds/Details Warning 50.ogg and /dev/null differ diff --git a/sounds/Details Warning 75.ogg b/sounds/Details Warning 75.ogg deleted file mode 100644 index 04b2e0ac8..000000000 Binary files a/sounds/Details Warning 75.ogg and /dev/null differ diff --git a/sounds/details_bassdrop.ogg b/sounds/details_bassdrop.ogg new file mode 100644 index 000000000..84f6e7ae9 Binary files /dev/null and b/sounds/details_bassdrop.ogg differ diff --git a/startup.lua b/startup.lua index e80438ef7..b7a21134e 100644 --- a/startup.lua +++ b/startup.lua @@ -553,6 +553,11 @@ function Details:StartMeUp() --no no, enforece 8, 8 is much better, 8 is more lines, we like 8 Details.tooltip.tooltip_max_abilities = 8 + local tooltipBarColor = Details.tooltip.bar_color + tooltipBarColor[1] = 0.149 + tooltipBarColor[2] = 0.149 + tooltipBarColor[3] = 0.149 + Details.InstallRaidInfo() --Plater integration diff --git a/textures.lua b/textures.lua index 6bd30f424..6771b1cc2 100644 --- a/textures.lua +++ b/textures.lua @@ -273,7 +273,21 @@ Details.TextureAtlas = { width = 12, height = 12, colorName = "silver", - } + }, + + ["right-mouse-click"] = { + file = [[Interface\TUTORIALFRAME\UI-TUTORIAL-FRAME]], + width = 52, + height = 76, + leftTexCoord = 13/512, + rightTexCoord = 64/512, + topTexCoord = 332/512, + bottomTexCoord = 408/512, + tilesHorizontally = false, + tilesVertically = false, + nativeWidth = 512, + nativeHeight = 512, + }, } C_Timer.After(1, function()