From 2ca4c011c0953fe7035712415087d203cf9dd463 Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Sun, 18 Feb 2024 19:52:02 -0300 Subject: [PATCH] Improvements for the Ask to Erase Data and more development on End of M+ panel --- Definitions.lua | 31 ++ Libs/DF/definitions.lua | 7 +- Libs/DF/fw.lua | 91 +++- Libs/DF/picture.lua | 114 ++-- Libs/LibLuaServer/LibLuaServer.lua | 74 ++- boot.lua | 12 +- core/control.lua | 18 +- .../window_mythicplus/window_end_of_run.lua | 508 ++++++++++++++---- functions/mythicdungeon/segments.lua | 1 + functions/profiles.lua | 6 + 10 files changed, 683 insertions(+), 179 deletions(-) diff --git a/Definitions.lua b/Definitions.lua index 145c7bbc..88467caa 100644 --- a/Definitions.lua +++ b/Definitions.lua @@ -50,6 +50,36 @@ ---| "PLAYER_TARGET" ---| "DETAILS_PROFILE_APPLYED" +---@class mythicdungeoninfo +---@field StartedAt number +---@field EndedAt number +---@field WorldStateTimerStart number +---@field WorldStateTimerEnd number +---@field RunTime number +---@field TimeInCombat number +---@field SegmentID string +---@field RunID number +---@field OverallSegment boolean +---@field ZoneName string +---@field EJID number +---@field MapID number +---@field Level number +---@field OnTime boolean +---@field KeystoneUpgradeLevels number +---@field PracticeRun boolean +---@field OldDungeonScore number +---@field NewDungeonScore number +---@field IsAffixRecord boolean +---@field IsMapRecord boolean +---@field PrimaryAffix number +---@field IsEligibleForScore boolean +---@field UpgradeMembers table +---@field TimeLimit number +---@field DungeonName string +---@field DungeonID number +---@field DungeonTexture string +---@field DungeonBackgroundTexture string|number + ---@alias containertype number this container type is the number used to identify the actorcontainer type when using combat:GetContainer(containertype), can be 1, 2, 3, or 4. ---@alias actorclass string this is the class of the actor, can be "WARRIOR", "PALADIN", "HUNTER", "ROGUE", "PRIEST", "DEATHKNIGHT", "SHAMAN", "MAGE", "WARLOCK", "MONK", "DRUID", "DEMONHUNTER" @@ -86,6 +116,7 @@ ---@field CreateEventListener fun(self: details) : table ---@field GetFullName fun(self: details, unitId: any, ambiguateString: any) : string create a CLEU compatible name of the unit passed, return string is in the format "playerName-realmName", the string will also be ambiguated using the ambiguateString passed ---@field GetTextColor fun(self:actor, instanceObject: instance, textSide: string) : number, number, number, number +---@field GetCombatSegments fun(self: details) : combat[] return a table with all the combat segments ---@class detailseventlistener : table ---@field RegisterEvent fun(self: detailseventlistener, event: detailsevent, callback: function) diff --git a/Libs/DF/definitions.lua b/Libs/DF/definitions.lua index 934fddae..6591eb7f 100644 --- a/Libs/DF/definitions.lua +++ b/Libs/DF/definitions.lua @@ -144,7 +144,7 @@ ---@field GetColorHue fun(self:table, r:number, g:number, b:number) : number return the hue of a color from red to blue to green to yellow and back to red ---@field IsHtmlColor fun(self:table, colorName:any) : unknown return true if DF.alias_text_colors has the colorName as a key ---@field CreateColorTable fun(self:table, r:number, g:number, b:number, a:number) : table return a table with {r, g, b, a} ----@field FormatColor fun(self:table, newFormat:string, r:number|string, g:number?, b:number?, a:number?, decimalsAmount:number?) : string|table|number|nil, number|nil, number|nil, number|nil takes in a color in one format and converts it to another specified format. +---@field FormatColor fun(self:table, newFormat:string, r:number|string|table, g:number?, b:number?, a:number?, decimalsAmount:number?) : string|table|number|nil, number|nil, number|nil, number|nil takes in a color in one format and converts it to another specified format. ---@field CreateEditor fun(self:table, parent:frame, name:string?, options:df_editor_defaultoptions?) : df_editor ---@field RandomBool fun(self:table, odds: number?) : boolean return a random boolean ---@field CreateHighlightTexture fun(self:table, parent:frame, parentKey:string?, alpha:number?, name:string?) : texture @@ -152,7 +152,10 @@ ---@field CreateColorPickButton fun(self:table, parent:frame, name:string?, member:string?, callback:function, alpha:number?, buttonTemplate:table?) : df_button ---@field CreateSlider fun(self:table, parent:frame, width:number?, height:number?, minValue:number?, maxValue:number?, step:number?, defaultv:number?, isDecemal:boolean?, member:string?, name:string?, label:string?, sliderTemplate:string|table?, labelTemplate:string|table?) : df_slider, df_label? ---@field CreateFrameContainer fun(self:table, parent:frame, options:table?, frameName:string?) : df_framecontainer create a frame container, which is a frame that envelops another frame, and can be moved, resized, etc. ----@field +---@field CreateAnimation fun(self:table, animationGroup:animationgroup, animationType:animationtype, order:number, duration:number, arg1:any, arg2:any, arg3:any, arg4:any, arg5:any, arg6:any, arg7:any, arg8:any) : animation +---@field CreateTexture fun(self:table, parent:frame, texture:atlasname|texturepath|textureid|nil, width:number?, height:number?, layer:drawlayer?, coords:table?, member:string?, name:string?) : df_image +---@field CreateFrameShake fun(self:table, parent:uiobject, duration:number?, amplitude:number?, frequency:number?, absoluteSineX:boolean?, absoluteSineY:boolean?, scaleX:number?, scaleY:number?, fadeInTime:number?, fadeOutTime:number?, anchorPoints:table?) : df_frameshake +---@field SetTexCoordFromAtlasInfo fun(self:table, texture:texture, atlasInfo:atlasinfo) : nil ---@field diff --git a/Libs/DF/fw.lua b/Libs/DF/fw.lua index 9b1e830b..d6f18373 100644 --- a/Libs/DF/fw.lua +++ b/Libs/DF/fw.lua @@ -1,6 +1,6 @@ -local dversion = 512 +local dversion = 513 local major, minor = "DetailsFramework-1.0", dversion local DF, oldminor = LibStub:NewLibrary(major, minor) @@ -522,6 +522,10 @@ function DF:RandomBool(odds) end end +function DF:SetTexCoordFromAtlasInfo(texture, atlasInfo) + texture:SetTexCoord(atlasInfo.leftTexCoord, atlasInfo.rightTexCoord, atlasInfo.topTexCoord, atlasInfo.bottomTexCoord) +end + ------------------------------------------------------------------------------------------------------------ --table @@ -2061,16 +2065,16 @@ end IsColorTable = true, } - --takes in a color in one format and converts it to another specified format. - --here are the parameters it accepts: - --newFormat (string): The format to convert the color to. It can be one of the following: "commastring", "tablestring", "table", "tablemembers", "numbers", "hex". - --r (number|string): The red component of the color or a string representing the color. - --g (number|nil): The green component of the color. This is optional if r is a string. - --b (number|nil): The blue component of the color. This is optional if r is a string. - --a (number|nil): The alpha component of the color. This is optional and defaults to 1 if not provided. - --decimalsAmount (number|nil): The number of decimal places to round the color components to. This is optional and defaults to 4 if not provided. - --The function returns the color in the new format. The return type depends on the newFormat parameter. It can be a string, a table, or four separate number values (for the "numbers" format). - --For the "hex" format, it returns a string representing the color in hexadecimal format. + ---* takes in a color in one format and converts it to another specified format. + ---* here are the parameters it accepts: + ---* newFormat (string): The format to convert the color to. It can be one of the following: "commastring", "tablestring", "table", "tablemembers", "numbers", "hex". + ---* r (number|string): The red component of the color or a string representing the color. + ---* g (number|nil): The green component of the color. This is optional if r is a string. + ---* b (number|nil): The blue component of the color. This is optional if r is a string. + ---* a (number|nil): The alpha component of the color. This is optional and defaults to 1 if not provided. + ---* decimalsAmount (number|nil): The number of decimal places to round the color components to. This is optional and defaults to 4 if not provided. + ---* The function returns the color in the new format. The return type depends on the newFormat parameter. It can be a string, a table, or four separate number values (for the "numbers" format). + ---* For the "hex" format, it returns a string representing the color in hexadecimal format. ---@param newFormat string ---@param r number|string ---@param g number|nil @@ -2844,9 +2848,30 @@ function DF:CreateAnimationHub(parent, onPlay, onFinished) return newAnimation end -function DF:CreateAnimation(animation, animationType, order, duration, arg1, arg2, arg3, arg4, arg5, arg6, arg7) - local anim = animation:CreateAnimation(animationType) - anim:SetOrder(order or animation.NextAnimation) +---* Create a new animation for an animation hub or group. +---* Alpha: CreateAnimation(animGroup, "Alpha", order, duration, fromAlpha, toAlpha). +---* Scale: CreateAnimation(animGroup, "Scale", order, duration, fromScaleX, fromScaleY, toScaleX, toScaleY, originPoint, x, y). +---* Translation: CreateAnimation(animGroup, "Translation", order, duration, xOffset, yOffset). +---* Rotation: CreateAnimation(animGroup, "Rotation", order, duration, degrees, originPoint, x, y). +---* Path: CreateAnimation(animGroup, "Path", order, duration, xOffset, yOffset, curveType). +---* VertexColor: CreateAnimation(animGroup, "VertexColor", order, duration, r1, g1, b1, a1, r2, g2, b2, a2). +---@param animationGroup animationgroup +---@param animationType animationtype +---@param order number +---@param duration number +---@param arg1 any +---@param arg2 any +---@param arg3 any +---@param arg4 any +---@param arg5 any +---@param arg6 any +---@param arg7 any +---@param arg8 any +---@return animation +function DF:CreateAnimation(animationGroup, animationType, order, duration, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) + ---@type animation + local anim = animationGroup:CreateAnimation(animationType) + anim:SetOrder(order or animationGroup.NextAnimation) anim:SetDuration(duration) animationType = string.upper(animationType) @@ -2871,9 +2896,33 @@ function DF:CreateAnimation(animation, animationType, order, duration, arg1, arg elseif (animationType == "TRANSLATION") then anim:SetOffset(arg1, arg2) + + elseif (animationType == "PATH") then + local newControlPoint = anim:CreateControlPoint() + anim:SetCurveType(arg4 or "SMOOTH") + newControlPoint:SetOffset(arg2, arg3) + newControlPoint:SetOrder(#anim:GetControlPoints()) + + elseif (animationType == "VERTEXCOLOR" or animationType == "COLOR") then + local r1, g1, b1, a1 = arg1, arg2, arg3, arg4 + local r2, g2, b2, a2 = arg5, arg6, arg7, arg8 + + if ((type(r1) == "table" or type(r1) == "string") and (type(g1) == "table" or type(g1) == "string")) then + r2, g2, b2, a2 = DF:ParseColors(g1) + r1, g1, b1, a1 = DF:ParseColors(r1) + + elseif ((type(r1) == "table" or type(r1) == "string")) then + r1, g1, b1, a1 = DF:ParseColors(r1) + + elseif ((type(r2) == "table" or type(r2) == "string")) then + r2, g2, b2, a2 = DF:ParseColors(r2) + end + + anim:SetStartColor(CreateColor(r1, g1, b1, a1)) + anim:SetEndColor(CreateColor(r2, g2, b2, a2)) end - animation.NextAnimation = animation.NextAnimation + 1 + animationGroup.NextAnimation = animationGroup.NextAnimation + 1 return anim end @@ -3117,7 +3166,7 @@ local frameshake_play = function(parent, shakeObject, scaleDirection, scaleAmpli --update the amount of shake running on this frame parent.__frameshakes.enabled = parent.__frameshakes.enabled + 1 - if (not parent:GetScript("OnUpdate")) then + if (parent:HasScript("OnUpdate")) then parent:SetScript("OnUpdate", function()end) end end @@ -3151,7 +3200,7 @@ local frameshake_SetConfig = function(parent, shakeObject, duration, amplitude, shakeObject.OriginalDuration = shakeObject.Duration end ----@class frameshake : table +---@class df_frameshake : table ---@field Amplitude number ---@field Frequency number ---@field Duration number @@ -3168,9 +3217,9 @@ end ---@field OriginalFrequency number ---@field OriginalAmplitude number ---@field OriginalDuration number ----@field PlayFrameShake fun(parent:uiobject, shakeObject:frameshake, scaleDirection:number?, scaleAmplitude:number?, scaleFrequency:number?, scaleDuration:number?) ----@field StopFrameShake fun(parent:uiobject, shakeObject:frameshake) ----@field SetFrameShakeSettings fun(parent:uiobject, shakeObject:frameshake, duration:number?, amplitude:number?, frequency:number?, absoluteSineX:boolean?, absoluteSineY:boolean?, scaleX:number?, scaleY:number?, fadeInTime:number?, fadeOutTime:number?) +---@field PlayFrameShake fun(parent:uiobject, shakeObject:df_frameshake, scaleDirection:number?, scaleAmplitude:number?, scaleFrequency:number?, scaleDuration:number?) +---@field StopFrameShake fun(parent:uiobject, shakeObject:df_frameshake) +---@field SetFrameShakeSettings fun(parent:uiobject, shakeObject:df_frameshake, duration:number?, amplitude:number?, frequency:number?, absoluteSineX:boolean?, absoluteSineY:boolean?, scaleX:number?, scaleY:number?, fadeInTime:number?, fadeOutTime:number?) ---create a frame shake object ---@param parent uiobject @@ -3184,7 +3233,7 @@ end ---@param fadeInTime number? ---@param fadeOutTime number? ---@param anchorPoints table? ----@return frameshake +---@return df_frameshake function DF:CreateFrameShake(parent, duration, amplitude, frequency, absoluteSineX, absoluteSineY, scaleX, scaleY, fadeInTime, fadeOutTime, anchorPoints) --create the shake table local frameShake = { diff --git a/Libs/DF/picture.lua b/Libs/DF/picture.lua index 24915a3a..c1860c6f 100644 --- a/Libs/DF/picture.lua +++ b/Libs/DF/picture.lua @@ -226,9 +226,16 @@ detailsFramework:Mixin(ImageMetaFunctions, detailsFramework.ScriptHookMixin) end end - function ImageMetaFunctions:SetGradient(gradientType, fromColor, toColor) + function ImageMetaFunctions:SetGradient(gradientType, fromColor, toColor, bInvert) fromColor = detailsFramework:FormatColor("tablemembers", fromColor) toColor = detailsFramework:FormatColor("tablemembers", toColor) + + if (bInvert) then + local temp = fromColor + fromColor = toColor + toColor = temp + end + self.image:SetGradient(gradientType, fromColor, toColor) end @@ -238,34 +245,50 @@ detailsFramework:Mixin(ImageMetaFunctions, detailsFramework.ScriptHookMixin) ---@class df_image : texture ---@field SetGradient fun(gradientType: "vertical"|"horizontal", fromColor: table, toColor: table) + ---@class df_gradienttable : table + ---@field gradient "vertical"|"horizontal" + ---@field fromColor table|string + ---@field toColor table|string + ---@field invert boolean? + ---create an object that encapsulates a texture and add additional methods to it ---@param parent frame - ---@param texture texturepath|textureid - ---@param width number - ---@param height number - ---@param layer drawlayer - ---@param coords {key1: number, key2: number, key3: number, key4: number} - ---@param member string - ---@param name string - ---@return table|nil + ---@param texture texturepath|textureid|df_gradienttable|nil + ---@param width number? + ---@param height number? + ---@param layer drawlayer? + ---@param coords {key1: number, key2: number, key3: number, key4: number}? + ---@param member string? + ---@param name string? + ---@return df_image function detailsFramework:CreateTexture(parent, texture, width, height, layer, coords, member, name) return detailsFramework:NewImage(parent, texture, width, height, layer, coords, member, name) end ---create an object that encapsulates a texture and add additional methods to it ---@param parent frame - ---@param texture texturepath|textureid - ---@param width number - ---@param height number - ---@param layer drawlayer - ---@param coords {key1: number, key2: number, key3: number, key4: number} - ---@param member string - ---@param name string - ---@return table|nil + ---@param texture texturepath|textureid|df_gradienttable|nil + ---@param width number? + ---@param height number? + ---@param layer drawlayer? + ---@param coords {key1: number, key2: number, key3: number, key4: number}? + ---@param member string? + ---@param name string? + ---@return df_image function detailsFramework:CreateImage(parent, texture, width, height, layer, coords, member, name) return detailsFramework:NewImage(parent, texture, width, height, layer, coords, member, name) end + ---create an object that encapsulates a texture and add additional methods to it + ---@param parent frame + ---@param texture texturepath|textureid|df_gradienttable|nil + ---@param width number? + ---@param height number? + ---@param layer drawlayer? + ---@param texCoord {key1: number, key2: number, key3: number, key4: number}? + ---@param member string? + ---@param name string? + ---@return df_image function detailsFramework:NewImage(parent, texture, width, height, layer, texCoord, member, name) if (not parent) then return error("DetailsFrameWork: NewImage() parent not found.", 2) @@ -313,26 +336,45 @@ detailsFramework:Mixin(ImageMetaFunctions, detailsFramework.ScriptHookMixin) ImageObject.image.MyObject = ImageObject - if (width) then - ImageObject.image:SetWidth(width) - end - if (height) then - ImageObject.image:SetHeight(height) - end - if (texture) then if (type(texture) == "table") then if (texture.gradient) then + ---@type df_gradienttable + local gradientTable = texture + if (detailsFramework.IsDragonflight() or detailsFramework.IsNonRetailWowWithRetailAPI()) then ImageObject.image:SetColorTexture(1, 1, 1, 1) - local fromColor = detailsFramework:FormatColor("tablemembers", texture.fromColor) - local toColor = detailsFramework:FormatColor("tablemembers", texture.toColor) - ImageObject.image:SetGradient(texture.gradient, fromColor, toColor) + local fromColor = detailsFramework:FormatColor("tablemembers", gradientTable.fromColor) + local toColor = detailsFramework:FormatColor("tablemembers", gradientTable.toColor) + + if (gradientTable.invert) then + local temp = fromColor + fromColor = toColor + toColor = temp + end + + ImageObject.image:SetGradient(gradientTable.gradient, fromColor, toColor) else - local fromR, fromG, fromB, fromA = detailsFramework:ParseColors(texture.fromColor) - local toR, toG, toB, toA = detailsFramework:ParseColors(texture.toColor) + local fromR, fromG, fromB, fromA = detailsFramework:ParseColors(gradientTable.fromColor) + local toR, toG, toB, toA = detailsFramework:ParseColors(gradientTable.toColor) + + if (gradientTable.invert) then + local temp = fromR + fromR = toR + toR = temp + temp = fromG + fromG = toG + toG = temp + temp = fromB + fromB = toB + toB = temp + temp = fromA + fromA = toA + toA = temp + end + ImageObject.image:SetColorTexture(1, 1, 1, 1) - ImageObject.image:SetGradientAlpha(texture.gradient, fromR, fromG, fromB, fromA, toR, toG, toB, toA) + ImageObject.image:SetGradientAlpha(gradientTable.gradient, fromR, fromG, fromB, fromA, toR, toG, toB, toA) end else local r, g, b, a = detailsFramework:ParseColors(texture) @@ -352,7 +394,10 @@ detailsFramework:Mixin(ImageMetaFunctions, detailsFramework.ScriptHookMixin) end end else - ImageObject.image:SetTexture(texture) + local textureType = type(texture) + if (textureType == "string" or textureType == "number") then + ImageObject.image:SetTexture(texture) + end end end @@ -360,6 +405,13 @@ detailsFramework:Mixin(ImageMetaFunctions, detailsFramework.ScriptHookMixin) ImageObject.image:SetTexCoord(unpack(texCoord)) end + if (width) then + ImageObject.image:SetWidth(width) + end + if (height) then + ImageObject.image:SetHeight(height) + end + ImageObject.HookList = { } diff --git a/Libs/LibLuaServer/LibLuaServer.lua b/Libs/LibLuaServer/LibLuaServer.lua index d822999b..30d6252f 100644 --- a/Libs/LibLuaServer/LibLuaServer.lua +++ b/Libs/LibLuaServer/LibLuaServer.lua @@ -11,6 +11,15 @@ --guadians: represents a npc, the server has the possess of the controller, don't accept commands like pets, helps attacking the enemies of the npc or player. --role: is a string that represents the role of a unit, such as tank, healer, or damage dealer. only players can have a role. +---@alias animationtype +---| "Alpha" +---| "Rotation" +---| "Scale" +---| "Translation" +---| "Path" +---| "VertexColor" + + ---@alias auratype ---| "BUFF" ---| "DEBUFF" @@ -196,6 +205,17 @@ ---| "Ambience" ---| "Dialog" +---@alias animloopmode +---| "NONE" +---| "REPEAT" +---| "BOUNCE" + +---@alias animsmoothing +---| "IN" +---| "OUT" +---| "IN_OUT" +---| "NONE" + ---@class aurainfo : table ---@field applications number ---@field auraInstanceID number @@ -219,6 +239,18 @@ ---@field name string aura name ---@field sourceUnit string unitid +---@class atlasinfo : table +---@field file string|number +---@field leftTexCoord number +---@field rightTexCoord number +---@field topTexCoord number +---@field bottomTexCoord number +---@field width number +---@field height number +---@field tilesHorizontally boolean +---@field tilesVertically boolean + + ---@alias width number property that represents the horizontal size of a UI element, such as a frame or a texture. Gotten from the first result of GetWidth() or from the first result of GetSize(). It is expected a GetWidth() or GetSize() when the type 'height' is used. ---@alias height number property that represents the vertical size of a UI element, such as a frame or a texture. Gotten from the first result of GetHeight() or from the second result of GetSize(). It is expected a GetHeight() or GetSize() when the type 'height' is used. ---@alias framelevel number represent how high a frame is placed within its strata. The higher the frame level, the more likely it is to appear in front of other frames. The frame level is a number between 0 and 65535. The default frame level is 0. The frame level is set with the SetFrameLevel() function. @@ -323,7 +355,7 @@ ---@field SetIgnoreParentAlpha fun(self: region, ignore: boolean) ---@class animationgroup : uiobject ----@field CreateAnimation fun(self: animationgroup, animationType: string, name: string|nil, inheritsFrom: string|nil) : animation +---@field CreateAnimation fun(self: animationgroup, animationType: animationtype, name: string|nil, inheritsFrom: string|nil) : animation ---@field GetAnimation fun(self: animationgroup, name: string) : animation ---@field GetAnimations fun(self: animationgroup) : table ---@field GetDuration fun(self: animationgroup) : number @@ -339,9 +371,9 @@ ---@field Resume fun(self: animationgroup) ---@field SetDuration fun(self: animationgroup, duration: number) ---@field SetEndDelay fun(self: animationgroup, delay: number) ----@field SetLooping fun(self: animationgroup, loop: boolean) +---@field SetLooping fun(self: animationgroup, loop: animloopmode) ---@field SetScript fun(self: animationgroup, event: string, handler: function|nil) "OnEvent"|"OnShow" ----@field SetSmoothProgress fun(self: animationgroup, smooth: boolean) +---@field SetSmoothProgress fun(self: animationgroup, smooth: animsmoothing) ---@field Stop fun(self: animationgroup) ---@class animation : uiobject @@ -357,11 +389,40 @@ ---@field Play fun(self: animation) ---@field Resume fun(self: animation) ---@field SetDuration fun(self: animation, duration: number) +---@field SetStartDelay fun(self: animation, delay: number) ---@field SetEndDelay fun(self: animation, delay: number) ---@field SetOrder fun(self: animation, order: number) ---@field SetScript fun(self: animation, event: string, handler: function?) ---@field SetSmoothing fun(self: animation, smoothing: string) ---@field Stop fun(self: animation) +---@field CreateControlPoint fun(self: animation) : pathcontrolpoint +---@field SetCurveType fun(self: animation, curveType:pathanimationtype) +---@field GetCurveType fun(self: animation) : pathanimationtype +---@field GetControlPoints fun(self: animation) : pathcontrolpoint[] +---@field GetMaxControlPointOrder fun(self: animation) : number +---@field SetFromAlpha fun(self: animation, alpha: number) +---@field SetToAlpha fun(self: animation, alpha: number) +---@field SetScaleFrom fun(self: animation, x: number, y: number) +---@field SetScaleTo fun(self: animation, x: number, y: number) +---@field SetFromScale fun(self: animation, x: number, y: number) +---@field SetToScale fun(self: animation, x: number, y: number) +---@field SetOrigin fun(self: animation, point: anchorpoint, x: number, y: number) +---@field SetDegrees fun(self: animation, degrees: number) +---@field SetOffset fun(self: animation, x: number, y: number) +---@field SetStartColor fun(self: animation, r: red|number, g: green|number, b: blue|number, a: alpha|number|nil) +---@field SetEndColor fun(self: animation, r: red|number, g: green|number, b: blue|number, a: alpha|number|nil) + +---@alias pathanimationtype +---| "LINEAR" +---| "SMOOTH" + +---@class pathcontrolpoint : animation +---@field SetOffset fun(self: pathcontrolpoint, offsetX: number, offsetY: number) +---@field GetOffset fun(self: pathcontrolpoint) : number, number +---@field SetOrder fun(self: pathcontrolpoint, order: number) +---@field GetOrder fun(self: pathcontrolpoint) : number +---@field SetParent fun(self: pathcontrolpoint, parent: uiobject, order: number?) + ---@class line : uiobject ---@field GetEndPoint fun(self: line) : relativePoint: anchorpoint, relativeTo: anchorpoint, offsetX: number, offsetY: number @@ -682,6 +743,13 @@ function ClampDegrees(value) return 0 end ---@return number value The negated value if the condition is true, otherwise the original value. function NegateIf(value, condition) return 0 end + +---Generates a random floating-point number within a specified range. +---@param minValue number - The minimum value of the range. +---@param maxValue number - The maximum value of the range. +---@return number float - A random floating-point number within the specified range. +function RandomFloatInRange(minValue, maxValue) return 0 end + ---Returns a formatted version of its variable number of arguments following the description given in its first argument. ---@param s string|number ---@param ... any diff --git a/boot.lua b/boot.lua index 5aaac68c..3ab9a623 100644 --- a/boot.lua +++ b/boot.lua @@ -18,8 +18,8 @@ local addonName, Details222 = ... local version, build, date, tocversion = GetBuildInfo() - Details.build_counter = 12325 - Details.alpha_build_counter = 12325 --if this is higher than the regular counter, use it instead + Details.build_counter = 12329 + Details.alpha_build_counter = 12329 --if this is higher than the regular counter, use it instead Details.dont_open_news = true Details.game_version = version Details.userversion = version .. " " .. Details.build_counter @@ -158,10 +158,16 @@ do --change logs --[=[ - + 12329 + "Frame for 'Ask to Erase Data' can now be moved.", + "Small bug fixes and continued development on End of Mythic+ Panel.", --]=] local news = { + {"v10.2.5.12329.155", "February 18th, 2024"}, + "Frame for 'Ask to Erase Data' can now be moved.", + "Small bug fixes and continued development on End of Mythic+ Panel.", + {"v10.2.5.12307.155", "February 13th, 2024"}, "Fixed the deaths display, where the windows wasn't usig custom text scripts.", "Fixed an issue with custom displays, where it was unable to use class colors in their texts.", diff --git a/core/control.lua b/core/control.lua index a61ccb54..7c60f284 100644 --- a/core/control.lua +++ b/core/control.lua @@ -1817,12 +1817,18 @@ if (not panel) then panel = CreateFrame("frame", "DetailsEraseDataConfirmation", UIParent, "BackdropTemplate") panel:SetSize(400, 85) - panel:SetBackdrop({bgFile = [[Interface\AddOns\Details\images\background]], tile = true, tileSize = 16, - edgeFile = [[Interface\AddOns\Details\images\border_2]], edgeSize = 12}) + --panel:SetBackdrop({bgFile = [[Interface\AddOns\Details\images\background]], tile = true, tileSize = 16, + --edgeFile = [[Interface\AddOns\Details\images\border_2]], edgeSize = 12}) + --panel:SetBackdropColor(0, 0, 0, 0.4) panel:SetPoint("center", UIParent) - panel:SetBackdropColor(0, 0, 0, 0.4) - DetailsFramework:ApplyStandardBackdrop(panel) + --DetailsFramework:ApplyStandardBackdrop(panel) + DetailsFramework:AddRoundedCornersToFrame(panel, Details.PlayerBreakdown.RoundedCornerPreset) + + local LibWindow = LibStub("LibWindow-1.1") + LibWindow.RegisterConfig(panel, Details.ask_to_erase_frame) + LibWindow.MakeDraggable(panel) + LibWindow.RestorePosition(panel) panel:SetScript("OnMouseDown", function(self, button) if (button == "RightButton") then @@ -1862,7 +1868,9 @@ elseif (Details.segments_auto_erase == 3) then --erase - Details.tabela_historico:ResetAllCombatData() + C_Timer.After(2, function() + Details.tabela_historico:ResetAllCombatData() + end) end else if (_tempo > Details.last_instance_time + 21600) then --6 hours diff --git a/frames/window_mythicplus/window_end_of_run.lua b/frames/window_mythicplus/window_end_of_run.lua index 8da4d6a0..f84e2b36 100644 --- a/frames/window_mythicplus/window_end_of_run.lua +++ b/frames/window_mythicplus/window_end_of_run.lua @@ -19,59 +19,151 @@ local Loc = _G.LibStub("AceLocale-3.0"):GetLocale("Details") local mythicDungeonCharts = Details222.MythicPlus.Charts.Listener local mythicDungeonFrames = Details222.MythicPlus.Frames +local CONST_DEBUG_MODE = false + --debug _G.MythicDungeonFrames = mythicDungeonFrames --/run _G.MythicDungeonFrames.ShowEndOfMythicPlusPanel(true) +---@class animatedtexture : texture, df_frameshake +---@field CreateRandomBounceSettings function +---@field BounceFrameShake df_frameshake + +---@class playerbanner : frame +---@field FadeInAnimation animationgroup +---@field BackgroundBannerTextureScaleAnimation animationgroup +---@field BackgroundBannerFlashTextureColorAnimation animationgroup +---@field BounceFrameShake df_frameshake +---@field LevelUpFrame frame +---@field LevelUpTextFrame frame +---@field LevelFontString fontstring +---@field DungeonTexture texture +---@field DungeonBorderTexture texture +---@field FlashTexture texture +---@field LootSquare frame +---@field LootIcon texture +---@field LootIconBorder texture +---@field LootItemLevel fontstring +---@field unitId string +---@field unitName string +---@field PlayerNameFontString fontstring +---@field BackgroundBannerTexture animatedtexture +---@field BackgroundBannerFlashTexture animatedtexture +---@field RoleIcon texture +---@field Portrait texture +---@field Border texture +---@field Name fontstring +---@field AnimIn animationgroup +---@field AnimOut animationgroup + local createPlayerBanner = function(parent, name) local template = "ChallengeModeBannerPartyMemberTemplate" - local playerFrame = CreateFrame("frame", name, parent, template) - playerFrame:SetAlpha(1) - playerFrame:EnableMouse(true) - playerFrame:SetFrameLevel(parent:GetFrameLevel()+2) - local playerNameFontString = playerFrame:CreateFontString("$parentPlayerNameText", "overlay", "GameFontNormal") + ---@type playerbanner + local playerBanner = CreateFrame("frame", name, parent, template) + playerBanner:SetAlpha(1) + playerBanner:EnableMouse(true) + playerBanner:SetFrameLevel(parent:GetFrameLevel()+2) + + --make an fade in animation + local fadeInAnimation = detailsFramework:CreateAnimationHub(playerBanner, function() playerBanner:Show() end, function() playerBanner:SetAlpha(1) end) + detailsFramework:CreateAnimation(fadeInAnimation, "Alpha", 1, 0.1, 0, 1) + playerBanner.FadeInAnimation = fadeInAnimation + + --there's already a role icon on .RoleIcon, created from the template + + local playerNameFontString = playerBanner:CreateFontString("$parentPlayerNameText", "overlay", "GameFontNormal") playerNameFontString:SetTextColor(1, 1, 1) - playerNameFontString:SetPoint("top", playerFrame, "bottom", -1, -7) + playerNameFontString:SetPoint("top", playerBanner, "bottom", -1, -7) DetailsFramework:SetFontSize(playerNameFontString, 12) - playerFrame.PlayerNameFontString = playerNameFontString + playerBanner.PlayerNameFontString = playerNameFontString - local playerNameBackgroundTexture = playerFrame:CreateTexture("$parentPlayerNameBackgroundTexture", "overlay", nil, 6) + local playerNameBackgroundTexture = playerBanner:CreateTexture("$parentPlayerNameBackgroundTexture", "overlay", nil, 6) playerNameBackgroundTexture:SetTexture([[Interface\Cooldown\LoC-ShadowBG]]) playerNameBackgroundTexture:SetSize(68, 12) playerNameBackgroundTexture:SetPoint("center", playerNameFontString, "center", 0, 0) - local backgroundBannerTexture = playerFrame:CreateTexture("$parentBannerTexture", "background", nil, 0) - backgroundBannerTexture:SetTexture([[Interface\ACHIEVEMENTFRAME\GuildTabard]]) - backgroundBannerTexture:SetDrawLayer("background", 0) - backgroundBannerTexture:SetSize(63, 129) - backgroundBannerTexture:SetTexCoord(5/128, 68/128, 123/256, 252/256) - backgroundBannerTexture:SetPoint("topleft", playerFrame, "bottomleft", -5, playerFrame:GetHeight()/2) - backgroundBannerTexture:SetPoint("topright", playerFrame, "bottomright", 4, playerFrame:GetHeight()/2) - backgroundBannerTexture:SetVertexColor(.1, .1, .1) - playerFrame.BackgroundBannerTexture = backgroundBannerTexture + local createPlayerBannerBackgroundTexture = function(playerBanner, color, drawLevel) + local backgroundBannerTexture = playerBanner:CreateTexture("$parentBannerTexture", "background", nil, 0) + ---@cast backgroundBannerTexture animatedtexture + backgroundBannerTexture:SetTexture([[Interface\ACHIEVEMENTFRAME\GuildTabard]]) + backgroundBannerTexture:SetDrawLayer("background", drawLevel or 0) + backgroundBannerTexture:SetSize(63, 129) + backgroundBannerTexture:SetTexCoord(5/128, 68/128, 123/256, 252/256) + backgroundBannerTexture:SetPoint("topleft", playerBanner, "bottomleft", -5, playerBanner:GetHeight()/2) + backgroundBannerTexture:SetPoint("topright", playerBanner, "bottomright", 4, playerBanner:GetHeight()/2) + local r, g, b = detailsFramework:ParseColors(color or "dark1") + backgroundBannerTexture:SetVertexColor(r, g, b) + return backgroundBannerTexture + end - local backgroundBannerBorderTexture = playerFrame:CreateTexture("$parentBannerBorderTexture", "highlight", nil, -1) + do + playerBanner.BackgroundBannerFlashTexture = createPlayerBannerBackgroundTexture(playerBanner, "white", -1) + --create a color animation for playerBanner.BackgroundBannerFlashTexture, the color start as white and goes to dark1 + --the start delay for this animation is 0.2 + local backgroundBannerFlashTextureColorAnimation = detailsFramework:CreateAnimationHub(playerBanner.BackgroundBannerFlashTexture, function() end, function() playerBanner.BackgroundBannerFlashTexture:SetVertexColor(0.1, 0.1, 0.1) end) + local colorAnim = detailsFramework:CreateAnimation(backgroundBannerFlashTextureColorAnimation, "VertexColor", 1, 0.2, "white", "dark1") + colorAnim:SetStartDelay(0.175) + playerBanner.BackgroundBannerFlashTextureColorAnimation = backgroundBannerFlashTextureColorAnimation + end + + do + playerBanner.BackgroundBannerTexture = createPlayerBannerBackgroundTexture(playerBanner) + + function playerBanner.BackgroundBannerTexture:CreateRandomBounceSettings() + local duration = RandomFloatInRange(0.78, 0.82) + local amplitude = RandomFloatInRange(4.50, 5.5) + local frequency = RandomFloatInRange(19.8, 20.8) + local absoluteSineX = false + local absoluteSineY = true + local scaleX = 0 + local scaleY = RandomFloatInRange(0.90, 1.1) + local fadeInTime = 0 + local fadeOutTime = RandomFloatInRange(0.7, 0.8) + + return duration, amplitude, frequency, absoluteSineX, absoluteSineY, scaleX, scaleY, fadeInTime, fadeOutTime + end + + local lossOfMomentum = 0.75 + local duration = 0.8 + local amplitude = 5 + local frequency = 20 + local absoluteSineX = false + local absoluteSineY = true + local scaleX = 0 + local scaleY = 1 + local fadeInTime = 0 + local fadeOutTime = lossOfMomentum + local backgroundBannerTextureFS2 = detailsFramework:CreateFrameShake(playerBanner.BackgroundBannerTexture, duration, amplitude, frequency, absoluteSineX, absoluteSineY, scaleX, scaleY, fadeInTime, fadeOutTime) + playerBanner.BackgroundBannerTexture.BounceFrameShake = backgroundBannerTextureFS2 + + --scale animation for backgroundBannerTexture, which starts at 1 x 0 y and goes to 1 x 1 y, anchor top + local backgroundBannerTextureScaleAnimation = detailsFramework:CreateAnimationHub(playerBanner.BackgroundBannerTexture, function() end, function() playerBanner.BackgroundBannerTexture:SetSize(63, 129) end) + detailsFramework:CreateAnimation(backgroundBannerTextureScaleAnimation, "Scale", 1, 0.25, 1, 0, 1, 1, "top", 0, 0) + playerBanner.BackgroundBannerTextureScaleAnimation = backgroundBannerTextureScaleAnimation + end + + local backgroundBannerBorderTexture = playerBanner:CreateTexture("$parentBannerBorderTexture", "highlight", nil, -1) backgroundBannerBorderTexture:SetAtlas("UI-Achievement-Guild-Flag-Outline") backgroundBannerBorderTexture:SetSize(63, 129) - backgroundBannerBorderTexture:SetPoint("topleft", playerFrame, "bottomleft", -5, playerFrame:GetHeight()/2) - backgroundBannerBorderTexture:SetPoint("topright", playerFrame, "bottomright", 4, playerFrame:GetHeight()/2) + backgroundBannerBorderTexture:SetPoint("topleft", playerBanner, "bottomleft", -5, playerBanner:GetHeight()/2) + backgroundBannerBorderTexture:SetPoint("topright", playerBanner, "bottomright", 4, playerBanner:GetHeight()/2) - local dungeonTexture = playerFrame:CreateTexture("$parentDungeonTexture", "artwork") + local dungeonTexture = playerBanner:CreateTexture("$parentDungeonTexture", "artwork") dungeonTexture:SetTexCoord(25/512, 360/512, 50/512, 290/512) dungeonTexture:SetSize(50, 39) - dungeonTexture:SetPoint("top", playerFrame,"bottom", 0, -16) + dungeonTexture:SetPoint("top", playerBanner,"bottom", 0, -16) dungeonTexture:SetAlpha(0.9934) - playerFrame.DungeonTexture = dungeonTexture + playerBanner.DungeonTexture = dungeonTexture - local dungeonBorderTexture = playerFrame:CreateTexture("$parentDungeonBorder", "border") + local dungeonBorderTexture = playerBanner:CreateTexture("$parentDungeonBorder", "border") dungeonBorderTexture:SetTexture([[Interface\BUTTONS\UI-EmptySlot]]) dungeonBorderTexture:SetDrawLayer("border", 0) dungeonBorderTexture:ClearAllPoints() dungeonBorderTexture:SetPoint("topleft", dungeonTexture,"topleft", -17, 15) dungeonBorderTexture:SetPoint("bottomright", dungeonTexture,"bottomright", 18, -15) dungeonBorderTexture:SetAlpha(1) - playerFrame.DungeonBorderTexture = dungeonBorderTexture + playerBanner.DungeonBorderTexture = dungeonBorderTexture --load this addon, required to have access to the garrison templates if (not C_AddOns.IsAddOnLoaded("Blizzard_GarrisonTemplates")) then @@ -79,18 +171,18 @@ local createPlayerBanner = function(parent, name) end --animation for the key leveling up - local levelUpFrame = CreateFrame("frame", "$LevelUpFrame", playerFrame, "GarrisonFollowerLevelUpTemplate") + local levelUpFrame = CreateFrame("frame", "$LevelUpFrame", playerBanner, "GarrisonFollowerLevelUpTemplate") levelUpFrame:SetPoint("top", dungeonTexture, "bottom", 0, 44) levelUpFrame:SetScale(0.9) levelUpFrame.Text:SetText("") - playerFrame.LevelUpFrame = levelUpFrame - levelUpFrame:SetFrameLevel(playerFrame:GetFrameLevel()+1) + playerBanner.LevelUpFrame = levelUpFrame + levelUpFrame:SetFrameLevel(playerBanner:GetFrameLevel()+1) - local levelUpTextFrame = CreateFrame("frame", "$LevelUpTextFrame", playerFrame) + local levelUpTextFrame = CreateFrame("frame", "$LevelUpTextFrame", playerBanner) levelUpTextFrame:SetPoint("top", dungeonTexture, "bottom", -1, -14) - levelUpTextFrame:SetFrameLevel(playerFrame:GetFrameLevel()+2) + levelUpTextFrame:SetFrameLevel(playerBanner:GetFrameLevel()+2) levelUpTextFrame:SetSize(1, 1) - playerFrame.LevelUpTextFrame = levelUpTextFrame + playerBanner.LevelUpTextFrame = levelUpTextFrame --scaleX, scaleY, fadeInTime, fadeOutTime local shakeAnimation = detailsFramework:CreateFrameShake(levelUpTextFrame, 0.8, 2, 200, false, false, 0, 1, 0.5, 0.15) local shakeAnimation2 = detailsFramework:CreateFrameShake(levelUpTextFrame, 0.5, 1, 200, false, false, 0, 1, 0, 0) @@ -100,7 +192,7 @@ local createPlayerBanner = function(parent, name) levelFontString:SetPoint("center", levelUpTextFrame, "center", 0, 0) DetailsFramework:SetFontSize(levelFontString, 20) levelFontString:SetText("") - playerFrame.LevelFontString = levelFontString + playerBanner.LevelFontString = levelFontString --> animations for levelFontString local animationGroup = levelFontString:CreateAnimationGroup("DetailsMythicLevelTextAnimationGroup") @@ -152,9 +244,9 @@ local createPlayerBanner = function(parent, name) levelUpTextFrame:PlayFrameShake(shakeAnimation) C_Timer.After(0.7, function() - playerFrame.LevelUpFrame:Show() - playerFrame.LevelUpFrame:SetAlpha(1) - playerFrame.LevelUpFrame.Anim:Play() + playerBanner.LevelUpFrame:Show() + playerBanner.LevelUpFrame:SetAlpha(1) + playerBanner.LevelUpFrame.Anim:Play() animationGroup:Play() end) @@ -167,22 +259,22 @@ local createPlayerBanner = function(parent, name) end) end - local flashTexture = playerFrame:CreateTexture("$parentFlashTexture", "overlay", nil, 6) + local flashTexture = playerBanner:CreateTexture("$parentFlashTexture", "overlay", nil, 6) flashTexture:SetAtlas("UI-Achievement-Guild-Flag-Outline") flashTexture:SetSize(63, 129) - flashTexture:SetPoint("topleft", playerFrame, "bottomleft", -5, playerFrame:GetHeight()/2) - flashTexture:SetPoint("topright", playerFrame, "bottomright", 4, playerFrame:GetHeight()/2) + flashTexture:SetPoint("topleft", playerBanner, "bottomleft", -5, playerBanner:GetHeight()/2) + flashTexture:SetPoint("topright", playerBanner, "bottomright", 4, playerBanner:GetHeight()/2) flashTexture:Hide() - playerFrame.flashTexture = flashTexture + playerBanner.FlashTexture = flashTexture detailsFramework:CreateFlashAnimation(flashTexture) --flashTexture:Flash(0.1, 0.5, 0.01) local lootSquare = CreateFrame("frame", name, parent) lootSquare:SetSize(46, 46) - lootSquare:SetPoint("top", playerFrame, "bottom", 0, -90) + lootSquare:SetPoint("top", playerBanner, "bottom", 0, -90) lootSquare:SetFrameLevel(parent:GetFrameLevel()+1) - playerFrame.LootSquare = lootSquare + playerBanner.LootSquare = lootSquare lootSquare:Hide() lootSquare:SetScript("OnEnter", function(self) @@ -216,21 +308,36 @@ local createPlayerBanner = function(parent, name) DetailsFramework:SetFontSize(lootItemLevel, 12) lootSquare.LootItemLevel = lootItemLevel - return playerFrame + return playerBanner end local updatPlayerBanner = function(unitId, bannerIndex) + if (CONST_DEBUG_MODE) then + --print("updating player banner for unit:", unitId, "bannerIndex:", bannerIndex) + if (not UnitExists(unitId)) then + unitId = "player" + end + end + if (UnitExists(unitId)) then local readyFrame = DetailsMythicDungeonReadyFrame local unitName = Details:GetFullName(unitId) local libOpenRaid = LibStub("LibOpenRaid-1.0", true) + ---@type playerbanner local playerBanner = readyFrame.PlayerBanners[bannerIndex] readyFrame.playerCacheByName[unitName] = playerBanner playerBanner.unitId = unitId playerBanner.unitName = unitName playerBanner:Show() + playerBanner.FadeInAnimation:Play() + playerBanner.BackgroundBannerTextureScaleAnimation:Play() + playerBanner.BackgroundBannerFlashTextureColorAnimation:Play() + + playerBanner.BackgroundBannerTexture:SetFrameShakeSettings(playerBanner.BackgroundBannerTexture.BounceFrameShake, playerBanner.BackgroundBannerTexture:CreateRandomBounceSettings()) + playerBanner.BackgroundBannerTexture:PlayFrameShake(playerBanner.BackgroundBannerTexture.BounceFrameShake) + SetPortraitTexture(playerBanner.Portrait, unitId) unitName = detailsFramework:RemoveRealmName(unitName) @@ -305,9 +412,9 @@ local updateKeysStoneLevel = function() end --this character had its keystone upgraded - --unitBanner.flashTexture:Flash() + --unitBanner.FlashTexture:Flash() --print("keystone upgraded for", Details:GetFullName(unitId), unitKeystoneInfo.level, "old was:", oldKeystoneLevel) - --C_Timer.After(0.1, function() unitBanner.flashTexture:Stop() end) + --C_Timer.After(0.1, function() unitBanner.FlashTexture:Stop() end) end end @@ -325,43 +432,31 @@ end -- /run _G.DetailsMythicDungeonChartHandler.ShowChart(); DetailsMythicDungeonChartFrame.ShowChartFrame() -- /run _G.DetailsMythicDungeonChartHandler.ShowEndOfMythicPlusPanel() +if (CONST_DEBUG_MODE) then + C_Timer.After(3, function() + C_AddOns.LoadAddOn("Blizzard_ChallengesUI"); + _G.MythicDungeonFrames.ShowEndOfMythicPlusPanel() + end) +end + --show a small panel telling the chart is ready to show -function mythicDungeonFrames.ShowEndOfMythicPlusPanel(bIsDebug) +function mythicDungeonFrames.ShowEndOfMythicPlusPanel() --check if is enabled if (not Details.mythic_plus.show_damage_graphic) then return end - if (bIsDebug) then + if (CONST_DEBUG_MODE) then Details222.MythicPlus.Level = Details222.MythicPlus.Level or 2 end - --create the panel + --create the panel if it doesn't exist if (not mythicDungeonFrames.ReadyFrame) then - mythicDungeonFrames.ReadyFrame = CreateFrame("frame", "DetailsMythicDungeonReadyFrame", UIParent, "BackdropTemplate") - local readyFrame = mythicDungeonFrames.ReadyFrame - readyFrame.playerCacheByName = {} - local textColor = {1, 0.8196, 0, 1} local textSize = 11 - local roundedCornerTemplate = { - roundness = 6, - color = {.1, .1, .1, 0.98}, - border_color = {.05, .05, .05, 0.834}, - } - - detailsFramework:AddRoundedCornersToFrame(readyFrame, roundedCornerTemplate) - - local titleLabel = DetailsFramework:CreateLabel(readyFrame, "Details! Mythic Run Completed!", 12, "yellow") - titleLabel:SetPoint("top", readyFrame, "top", 0, -7) - titleLabel.textcolor = textColor - - local closeButton = detailsFramework:CreateCloseButton(readyFrame, "$parentCloseButton") - closeButton:SetPoint("topright", readyFrame, "topright", -2, -2) - closeButton:SetScale(1.4) - closeButton:SetAlpha(0.823) - + mythicDungeonFrames.ReadyFrame = CreateFrame("frame", "DetailsMythicDungeonReadyFrame", UIParent, "BackdropTemplate") + local readyFrame = mythicDungeonFrames.ReadyFrame readyFrame:SetSize(355, 390) readyFrame:SetPoint("center", UIParent, "center", 350, 0) readyFrame:SetFrameStrata("LOW") @@ -369,21 +464,164 @@ function mythicDungeonFrames.ShowEndOfMythicPlusPanel(bIsDebug) readyFrame:SetMovable(true) readyFrame:Hide() - --register to libwindow - local LibWindow = LibStub("LibWindow-1.1") - LibWindow.RegisterConfig(readyFrame, Details.mythic_plus.finished_run_frame) - LibWindow.RestorePosition(readyFrame) - LibWindow.MakeDraggable(readyFrame) - LibWindow.SavePosition(readyFrame) + ---@type playerbanner[] + readyFrame.playerCacheByName = {} + + do + --register to libwindow + local LibWindow = LibStub("LibWindow-1.1") + LibWindow.RegisterConfig(readyFrame, Details.mythic_plus.finished_run_frame) + LibWindow.RestorePosition(readyFrame) + LibWindow.MakeDraggable(readyFrame) + LibWindow.SavePosition(readyFrame) + + --set to use rounded corner + local roundedCornerTemplate = { + roundness = 6, + color = {.1, .1, .1, 0.98}, + border_color = {.05, .05, .05, 0.834}, + } + detailsFramework:AddRoundedCornersToFrame(readyFrame, roundedCornerTemplate) + end + + readyFrame.entryAnimationDuration = 0.1 + + local openingAnimationHub = detailsFramework:CreateAnimationHub(readyFrame, function() end, function() readyFrame:SetWidth(355); end) + detailsFramework:CreateAnimation(openingAnimationHub, "Scale", 1, readyFrame.entryAnimationDuration, 0, 1, 1, 1, "center", 0, 0) + readyFrame.OpeningAnimation = openingAnimationHub + + do --backdrop textures + --backdrop gradient from bottom to top + ---@type df_gradienttable + local gradientTable = {gradient = "vertical", fromColor = {0, 0, 0, 0.15}, toColor = "transparent"} + local gradientBelowTheLine = detailsFramework:CreateTexture(readyFrame, gradientTable, 1, readyFrame:GetHeight(), "artwork", {0, 1, 0, 1}, "backgroundGradient") + gradientBelowTheLine:SetPoint("bottoms") + + local dungeonBackdropTexture = readyFrame:CreateTexture("$parentDungeonBackdropTexture", "artwork", nil, -2) + dungeonBackdropTexture:SetTexCoord(0.05, 0.70, 0.1, 0.82) + dungeonBackdropTexture:SetVertexColor(0.2, 0.2, 0.2, 0.8) + dungeonBackdropTexture:SetDesaturation(0.65) + dungeonBackdropTexture:SetAlpha(0.6) + dungeonBackdropTexture:SetPoint("topleft", readyFrame, "topleft", 0, 0) + dungeonBackdropTexture:SetPoint("topright", readyFrame, "topright", 0, 0) + dungeonBackdropTexture:SetPoint("bottomleft", readyFrame, "bottomleft", 0, 0) + dungeonBackdropTexture:SetPoint("bottomright", readyFrame, "bottomright", 0, 0) + readyFrame.DungeonBackdropTexture = dungeonBackdropTexture + + local maskTexture = readyFrame:CreateMaskTexture("$parentDungeonBackdropTextureMaskTexture", "artwork") + maskTexture:SetAtlas("UI-Frame-IconMask") + local offset = 26 + maskTexture:SetPoint("topleft", readyFrame, "topleft", -offset, offset) + maskTexture:SetPoint("bottomright", readyFrame, "bottomright", offset, -offset) + dungeonBackdropTexture:AddMaskTexture(maskTexture) + end + + --frame to place all texture that goes behind the readyFrame + local backgroundFrame = CreateFrame("frame", "DetailsMythicDungeonBackgroundFrame", readyFrame) + backgroundFrame:SetAllPoints() + backgroundFrame:SetFrameLevel(readyFrame:GetFrameLevel()-1) + readyFrame.BackgroundFrame = backgroundFrame + + --frame to place all texture that goes in front of the readyFrame, doing this, we call fade in this frame making all texts gently show up + local contentFrame = CreateFrame("frame", "$parentContentFrame", readyFrame) + readyFrame.ContentFrame = contentFrame + --animation to fade in the content frame + local contentFrameFadeInAnimation = detailsFramework:CreateAnimationHub(contentFrame, function() contentFrame:Show() end, function() contentFrame:SetAlpha(1) end) + detailsFramework:CreateAnimation(contentFrameFadeInAnimation, "Alpha", 1, 0.3, 0, 1) + readyFrame.ContentFrameFadeInAnimation = contentFrameFadeInAnimation + + do + --use the same textures from the original end of dungeon panel + readyFrame.YellowSpikeCircle = contentFrame:CreateTexture("$parentSkullCircle", "overlay") + readyFrame.YellowSpikeCircle:SetSize(100, 100) + readyFrame.YellowSpikeCircle:SetPoint("center", readyFrame, "top", 0, 30) + readyFrame.YellowSpikeCircle:SetAtlas("ChallengeMode-SpikeyStar") + readyFrame.YellowSpikeCircle:SetAlpha(1) + readyFrame.YellowSpikeCircle:SetIgnoreParentAlpha(true) + + --create the animation for the yellow spike circle + local MainAnimationGroup = readyFrame.YellowSpikeCircle:CreateAnimationGroup() + readyFrame.YellowSpikeCircle.scale1 = MainAnimationGroup:CreateAnimation("SCALE") + readyFrame.YellowSpikeCircle.scale1:SetOrder(1) + readyFrame.YellowSpikeCircle.scale1:SetDuration(0.3) + readyFrame.YellowSpikeCircle.scale1:SetScaleFrom(2, 2) + readyFrame.YellowSpikeCircle.scale1:SetScaleTo(1, 1) + readyFrame.YellowSpikeCircle.scale1:SetOrigin("center", 0, 0) + + --bugged + readyFrame.YellowSpikeCircle.OnShowAnimation = MainAnimationGroup + + --spinning animation for the yellow spike circle + --local yellowSpikeCircleSpinAnimationGroup = detailsFramework:CreateAnimationHub(readyFrame.YellowSpikeCircle, function()end, function()end) + --yellowSpikeCircleSpinAnimationGroup:SetLooping("REPEAT") + --local spikeRotationAnim = detailsFramework:CreateAnimation(yellowSpikeCircleSpinAnimationGroup, "Rotation", 1, 5, 1) + --spikeRotationAnim:SetSmoothing("IN_OUT") --"IN_OUT" "IN" "OUT" "NONE" + --spikeRotationAnim:SetSmoothProgress(50) + --readyFrame.YellowSpikeCircleSpinAnimation = yellowSpikeCircleSpinAnimationGroup + end + + readyFrame.Level = contentFrame:CreateFontString("$parentLevelText", "overlay", "GameFontNormalWTF2Outline") + readyFrame.Level:SetPoint("center", readyFrame.YellowSpikeCircle, "center", 0, 0) + readyFrame.Level:SetText("") + + readyFrame.leftFiligree = contentFrame:CreateTexture("$parentLeftFiligree", "artwork") + readyFrame.leftFiligree:SetAtlas("BossBanner-LeftFillagree") + readyFrame.leftFiligree:SetSize(72, 43) + readyFrame.leftFiligree:SetPoint("bottom", readyFrame, "top", -50, 2) + + readyFrame.rightFiligree = contentFrame:CreateTexture("$parentRightFiligree", "artwork") + readyFrame.rightFiligree:SetAtlas("BossBanner-RightFillagree") + readyFrame.rightFiligree:SetSize(72, 43) + readyFrame.rightFiligree:SetPoint("bottom", readyFrame, "top", 50, 2) + + --create the bottom filligree using BossBanner-BottomFillagree atlas + readyFrame.bottomFiligree = contentFrame:CreateTexture("$parentBottomFiligree", "artwork") + readyFrame.bottomFiligree:SetAtlas("BossBanner-BottomFillagree") + readyFrame.bottomFiligree:SetSize(66, 28) + readyFrame.bottomFiligree:SetPoint("bottom", readyFrame, "bottom", 0, -19) + + local titleLabel = DetailsFramework:CreateLabel(contentFrame, "Details! Mythic Run Completed!", 12, "yellow") + titleLabel:SetPoint("top", readyFrame, "top", 0, -7) + titleLabel.textcolor = textColor + + ---@type df_closebutton + local closeButton = DetailsFramework:CreateCloseButton(contentFrame, "$parentCloseButton") + closeButton:SetPoint("topright", readyFrame, "topright", -2, -2) + closeButton:SetScale(1.4) + closeButton:SetAlpha(0.823) + closeButton:SetScript("OnClick", function(self) + readyFrame:Hide() + end) + + --warning footer + local warningFooter = DetailsFramework:CreateLabel(contentFrame, "Under development.", 9, "yellow") + warningFooter:SetPoint("bottom", readyFrame, "bottom", 0, 20) --waiting for loot label - local waitingForLootLabel = DetailsFramework:CreateLabel(readyFrame, "Waiting for loot", 12, "silver") + local waitingForLootLabel = DetailsFramework:CreateLabel(contentFrame, "Waiting for loot", 12, "silver") waitingForLootLabel:SetPoint("bottom", readyFrame, "bottom", 0, 54) waitingForLootLabel:Hide() - local waitingForLootDotsAnimationLabel = DetailsFramework:CreateLabel(readyFrame, "...", 12, "silver") + local waitingForLootDotsAnimationLabel = DetailsFramework:CreateLabel(contentFrame, "...", 12, "silver") waitingForLootDotsAnimationLabel:SetPoint("left", waitingForLootLabel, "right", 0, 0) waitingForLootDotsAnimationLabel:Hide() + local topRedLineTexture = backgroundFrame:CreateTexture("$parentBannerTop", "border") + topRedLineTexture:SetAtlas("BossBanner-BgBanner-Top") + topRedLineTexture:SetPoint("top", backgroundFrame, "top", 0, 155) + local topTextureAnimGroup = detailsFramework:CreateAnimationHub(topRedLineTexture, function()end, function() topRedLineTexture:SetWidth(480) end) + topRedLineTexture.Animation = topTextureAnimGroup + local animDuration = 0.3 + detailsFramework:CreateAnimation(topTextureAnimGroup, "Scale", 1, animDuration, 0, 1, 1, 1, "center", 0, 0) + readyFrame.TopRedLineTexture = topRedLineTexture + + local bottomRedLineTexture = backgroundFrame:CreateTexture("$parentBannerBottom", "border") + bottomRedLineTexture:SetAtlas("BossBanner-BgBanner-Bottom") + bottomRedLineTexture:SetPoint("bottom", backgroundFrame, "bottom", 0, -115) + local bottomTextureAnimGroup = detailsFramework:CreateAnimationHub(bottomRedLineTexture, function()end, function() bottomRedLineTexture:SetWidth(480) end) + bottomRedLineTexture.Animation = bottomTextureAnimGroup + detailsFramework:CreateAnimation(bottomTextureAnimGroup, "Scale", 1, animDuration, 0, 1, 0.5, 1, "center", 0, 0) + readyFrame.BottomRedLineTexture = bottomRedLineTexture + --make a text dot animation, which will show no dots at start and then "." then ".." then "..." and back to "" and so on function readyFrame.StartTextDotAnimation() --update the Waiting for Loot labels @@ -425,10 +663,6 @@ function mythicDungeonFrames.ShowEndOfMythicPlusPanel(bIsDebug) readyFrame.StopTextDotAnimation() end) - --warning footer - local warningFooter = DetailsFramework:CreateLabel(readyFrame, "Under development.", 9, "yellow") - warningFooter:SetPoint("bottom", readyFrame, "bottom", 0, 20) - local roundedCornerPreset = { color = {.075, .075, .075, 1}, border_color = {.2, .2, .2, 1}, @@ -442,7 +676,7 @@ function mythicDungeonFrames.ShowEndOfMythicPlusPanel(bIsDebug) mPlus.ShowSummary() end ---@type df_button - readyFrame.ShowBreakdownButton = DetailsFramework:CreateButton(readyFrame, showBreakdownFunc, 145, 30, "Show Breakdown") + readyFrame.ShowBreakdownButton = DetailsFramework:CreateButton(contentFrame, showBreakdownFunc, 145, 30, "Show Breakdown") PixelUtil.SetPoint(readyFrame.ShowBreakdownButton, "topleft", readyFrame, "topleft", 5, -30) PixelUtil.SetSize(readyFrame.ShowBreakdownButton, 145, 32) readyFrame.ShowBreakdownButton:SetBackdrop(nil) @@ -458,7 +692,7 @@ function mythicDungeonFrames.ShowEndOfMythicPlusPanel(bIsDebug) readyFrame:Hide() end ---@type df_button - readyFrame.ShowChartButton = DetailsFramework:CreateButton(readyFrame, showChartFunc, 145, 30, "Show Damage Graphic") + readyFrame.ShowChartButton = DetailsFramework:CreateButton(contentFrame, showChartFunc, 145, 30, "Show Damage Graphic") PixelUtil.SetPoint(readyFrame.ShowChartButton, "left", readyFrame.ShowBreakdownButton, "right", 5, 0) PixelUtil.SetSize(readyFrame.ShowChartButton, 145, 32) readyFrame.ShowChartButton:SetBackdrop(nil) @@ -466,29 +700,28 @@ function mythicDungeonFrames.ShowEndOfMythicPlusPanel(bIsDebug) readyFrame.ShowChartButton.textcolor = textColor detailsFramework:AddRoundedCornersToFrame(readyFrame.ShowChartButton.widget, roundedCornerPreset) - --disable feature check box (dont show this again) local on_switch_enable = function(self, _, value) Details.mythic_plus.show_damage_graphic = not value end - local elapsedTimeLabel = DetailsFramework:CreateLabel(readyFrame, "Run Time:", textSize, textColor) + local elapsedTimeLabel = DetailsFramework:CreateLabel(contentFrame, "Run Time:", textSize, textColor) elapsedTimeLabel:SetPoint("topleft", leftAnchor, "bottomleft", 0, -8) - local elapsedTimeAmount = DetailsFramework:CreateLabel(readyFrame, "00:00", textSize, textColor) + local elapsedTimeAmount = DetailsFramework:CreateLabel(contentFrame, "00:00", textSize, textColor) elapsedTimeAmount:SetPoint("left", elapsedTimeLabel, "left", 130, 0) - local timeNotInCombatLabel = DetailsFramework:CreateLabel(readyFrame, "Time not in combat:", textSize, "orangered") + local timeNotInCombatLabel = DetailsFramework:CreateLabel(contentFrame, "Time not in combat:", textSize, "orangered") timeNotInCombatLabel:SetPoint("topleft", elapsedTimeLabel, "bottomleft", 0, -5) - local timeNotInCombatAmount = DetailsFramework:CreateLabel(readyFrame, "00:00", textSize, "orangered") + local timeNotInCombatAmount = DetailsFramework:CreateLabel(contentFrame, "00:00", textSize, "orangered") timeNotInCombatAmount:SetPoint("left", timeNotInCombatLabel, "left", 130, 0) - local youBeatTheTimerLabel = DetailsFramework:CreateLabel(readyFrame, "", textSize, "white") + local youBeatTheTimerLabel = DetailsFramework:CreateLabel(contentFrame, "", textSize, "white") youBeatTheTimerLabel:SetPoint("topleft", timeNotInCombatLabel, "bottomleft", 0, -5) --local keystoneUpgradeLabel = DetailsFramework:CreateLabel(readyFrame, "Keystone Upgrade:", textSize, "white") --keystoneUpgradeLabel:SetPoint("topleft", youBeatTheTimerLabel, "bottomleft", 0, -5) - local rantingLabel = DetailsFramework:CreateLabel(readyFrame, "", textSize, textColor) + local rantingLabel = DetailsFramework:CreateLabel(contentFrame, "", textSize, textColor) --rantingLabel:SetPoint("topleft", keystoneUpgradeLabel, "bottomleft", 0, -5) rantingLabel:SetPoint("topleft", youBeatTheTimerLabel, "bottomleft", 0, -5) @@ -580,7 +813,7 @@ function mythicDungeonFrames.ShowEndOfMythicPlusPanel(bIsDebug) Details222.MythicPlus.BackgroundTexture = backgroundTexture --]=] - local notAgainSwitch, notAgainLabel = DetailsFramework:CreateSwitch(readyFrame, on_switch_enable, not Details.mythic_plus.show_damage_graphic, _, _, _, _, _, _, _, _, _, Loc ["STRING_MINITUTORIAL_BOOKMARK4"], DetailsFramework:GetTemplate("switch", "OPTIONS_CHECKBOX_BRIGHT_TEMPLATE"), "GameFontHighlightLeft") + local notAgainSwitch, notAgainLabel = DetailsFramework:CreateSwitch(contentFrame, on_switch_enable, not Details.mythic_plus.show_damage_graphic, _, _, _, _, _, _, _, _, _, Loc ["STRING_MINITUTORIAL_BOOKMARK4"], DetailsFramework:GetTemplate("switch", "OPTIONS_CHECKBOX_BRIGHT_TEMPLATE"), "GameFontHighlightLeft") notAgainSwitch:ClearAllPoints() notAgainLabel:SetPoint("left", notAgainSwitch, "right", 2, 0) notAgainSwitch:SetPoint("bottomleft", readyFrame, "bottomleft", 5, 5) @@ -596,17 +829,67 @@ function mythicDungeonFrames.ShowEndOfMythicPlusPanel(bIsDebug) end --end of creating of the readyFrame --mythic+ finished, showing the readyFrame for the user - local readyFrame = mythicDungeonFrames.ReadyFrame readyFrame:Show() - readyFrame.StartTextDotAnimation() + readyFrame.TopRedLineTexture:Hide() + readyFrame.BottomRedLineTexture:Hide() + readyFrame.ContentFrame:SetAlpha(0) + readyFrame.Level:SetText(Details222.MythicPlus.Level or "") + + --hide the lootSquare for i = 1, #readyFrame.PlayerBanners do - --hide the lootSquare readyFrame.PlayerBanners[i].LootSquare:Hide() end + for i = 1, #readyFrame.PlayerBanners do + readyFrame.PlayerBanners[i]:Hide() + end + + C_Timer.After(0, function() + readyFrame.OpeningAnimation:Play() + end) + + --readyFrame.YellowSpikeCircle:SetAlpha(1) + --readyFrame.YellowSpikeCircle.OnShowAnimation:Play() + + C_Timer.After(readyFrame.entryAnimationDuration+0.05, function() + readyFrame.TopRedLineTexture:Show() + readyFrame.BottomRedLineTexture:Show() + readyFrame.TopRedLineTexture.Animation:Play() + readyFrame.BottomRedLineTexture.Animation:Play() + + C_Timer.After(0.3, function() + readyFrame.ContentFrameFadeInAnimation:Play() + end) + end) + + readyFrame.StartTextDotAnimation() + + --local mapID = select(8, GetInstanceInfo()) + + local overallMythicDungeonCombat = Details:GetCurrentCombat() + + --if the latest segment isn't the overall mythic dungeon segment, then find it + if (overallMythicDungeonCombat:GetCombatType() ~= DETAILS_SEGMENTTYPE_MYTHICDUNGEON_OVERALL) then + --get a table with all segments + local segments = Details:GetCombatSegments() + for i = 1, #segments do + local segment = segments[i] + if (segment:GetCombatType() == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_OVERALL) then + overallMythicDungeonCombat = segment + break + end + end + end + + if (not overallMythicDungeonCombat.is_mythic_dungeon) then + return + end + + readyFrame.DungeonBackdropTexture:SetTexture(overallMythicDungeonCombat.is_mythic_dungeon.DungeonTexture) + wipe(readyFrame.playerCacheByName) --update the run time and time not in combat @@ -614,7 +897,6 @@ function mythicDungeonFrames.ShowEndOfMythicPlusPanel(bIsDebug) readyFrame.ElapsedTimeAmountLabel.text = DetailsFramework:IntegerToTimer(elapsedTime) C_Timer.After(1.5, function() - local overallMythicDungeonCombat = Details:GetCurrentCombat() --print("overall combat type:", overallMythicDungeonCombat:GetCombatType(), overallMythicDungeonCombat:GetCombatType() == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_OVERALL) if (overallMythicDungeonCombat:GetCombatType() == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_OVERALL) then local combatTime = overallMythicDungeonCombat:GetCombatTime() @@ -647,29 +929,27 @@ function mythicDungeonFrames.ShowEndOfMythicPlusPanel(bIsDebug) readyFrame.RantingLabel.text = "" end - for i = 1, #readyFrame.PlayerBanners do - readyFrame.PlayerBanners[i]:Hide() - end - - local playersFound = 0 - local playerBannerIndex = 1 - do --update the player banner - if (updatPlayerBanner("player", playerBannerIndex)) then - playersFound = playersFound + 1 + C_Timer.After(0.6, function() + local playersFound = 0 + local playerBannerIndex = 1 + do --update the player banner + C_Timer.After(RandomFloatInRange(0.1, 0.15), function() + if (updatPlayerBanner("player", playerBannerIndex)) then + playersFound = playersFound + 1 + end + end) end - end - local unitCount = 1 - for bannerIndex = 2, #readyFrame.PlayerBanners do - if (updatPlayerBanner("party"..unitCount, bannerIndex)) then - playersFound = playersFound + 1 + local unitCount = 1 + for bannerIndex = 2, #readyFrame.PlayerBanners do + C_Timer.After(RandomFloatInRange(bannerIndex/5-0.075, bannerIndex/5+0.075), function() + if (updatPlayerBanner("party"..unitCount, bannerIndex)) then + playersFound = playersFound + 1 + end + unitCount = unitCount + 1 + end) end - unitCount = unitCount + 1 - end - - for i = playersFound+1, #readyFrame.PlayerBanners do - readyFrame.PlayerBanners[i]:Hide() - end + end) C_Timer.After(2.5, updateKeysStoneLevel) end diff --git a/functions/mythicdungeon/segments.lua b/functions/mythicdungeon/segments.lua index e2445121..9505d792 100644 --- a/functions/mythicdungeon/segments.lua +++ b/functions/mythicdungeon/segments.lua @@ -212,6 +212,7 @@ function DetailsMythicPlusFrame.MergeSegmentsOnEnd() --~merge local zoneName, instanceType, difficultyID, difficultyName, maxPlayers, dynamicDifficulty, isDynamic, instanceMapID, instanceGroupSize = GetInstanceInfo() --tag the segment as mythic overall segment + ---@type mythicdungeoninfo newCombat.is_mythic_dungeon = { StartedAt = Details.MythicPlus.StartedAt, --the start of the run EndedAt = Details.MythicPlus.EndedAt, --the end of the run diff --git a/functions/profiles.lua b/functions/profiles.lua index bbe2a6c9..690132b0 100644 --- a/functions/profiles.lua +++ b/functions/profiles.lua @@ -1429,6 +1429,12 @@ local default_global_data = { position = {}, }, + --ask to erase data frame + ask_to_erase_frame = { + scale = 1, + position = {}, + }, + --aura tracker panel aura_tracker_frame = { position = {}, --for libwindow