diff --git a/Libs/DF/auras.lua b/Libs/DF/auras.lua index 33942382d..0745833f9 100644 --- a/Libs/DF/auras.lua +++ b/Libs/DF/auras.lua @@ -12,7 +12,7 @@ local tinsert = table.insert local GetSpellInfo = GetSpellInfo or function(spellID) if not spellID then return nil end local si = C_Spell.GetSpellInfo(spellID) if si then return si.name, nil, si.iconID, si.castTime, si.minRange, si.maxRange, si.spellID, si.originalIconID end end local lower = string.lower local SpellBookItemTypeMap = Enum.SpellBookItemType and {[Enum.SpellBookItemType.Spell] = "SPELL", [Enum.SpellBookItemType.None] = "NONE", [Enum.SpellBookItemType.Flyout] = "FLYOUT", [Enum.SpellBookItemType.FutureSpell] = "FUTURESPELL", [Enum.SpellBookItemType.PetAction] = "PETACTION" } or {} -local GetSpellBookItemInfo = GetSpellBookItemInfo or function(...) local si = C_SpellBook.GetSpellBookItemInfo(...) if si then return SpellBookItemTypeMap[si.itemType] or "NONE", si.spellID end end +local GetSpellBookItemInfo = GetSpellBookItemInfo or function(...) local si = C_SpellBook.GetSpellBookItemInfo(...) if si then return SpellBookItemTypeMap[si.itemType] or "NONE", (si.itemType == Enum.SpellBookItemType.Flyout or si.itemType == Enum.SpellBookItemType.PetAction) and si.actionID or si.spellID or si.actionID, si end end local SPELLBOOK_BANK_PLAYER = Enum.SpellBookSpellBank and Enum.SpellBookSpellBank.Player or "player" local GetNumSpellTabs = GetNumSpellTabs or C_SpellBook.GetNumSpellBookSkillLines local GetSpellTabInfo = GetSpellTabInfo or function(tabLine) local skillLine = C_SpellBook.GetSpellBookSkillLineInfo(tabLine) if skillLine then return skillLine.name, skillLine.iconID, skillLine.itemIndexOffset, skillLine.numSpellBookItems, skillLine.isGuild, skillLine.offSpecID end end diff --git a/Libs/DF/button.lua b/Libs/DF/button.lua index bd56b5bc6..47fcfa498 100644 --- a/Libs/DF/button.lua +++ b/Libs/DF/button.lua @@ -892,7 +892,7 @@ end ---@field IsEnabled fun(self: df_button) : boolean returns true if the button is enabled ---@field SetIcon fun(self: df_button,texture: string|number, width: number|nil, height: number|nil, layout: string|nil, texcoord: table|nil, overlay: table|nil, textDistance: number|nil, leftPadding: number|nil, textHeight: number|nil, shortMethod: any|nil) ---@field GetIconTexture fun(self: df_button) : string returns the texture path of the button icon - ---@field SetTexture fun(self: df_button, normalTexture: string, highlightTexture: string, pressedTexture: string, disabledTexture: string) set the regular button textures + ---@field SetTexture fun(self: df_button, normalTexture: any, highlightTexture: any, pressedTexture: any, disabledTexture: any) set the regular button textures ---@field SetFontFace fun(self: df_button, font: string) set the button font ---@field SetFontSize fun(self: df_button, size: number) set the button font size ---@field SetTextColor fun(self: df_button, color: any) set the button text color diff --git a/Libs/DF/definitions.lua b/Libs/DF/definitions.lua index 07128d275..915c514d0 100644 --- a/Libs/DF/definitions.lua +++ b/Libs/DF/definitions.lua @@ -332,7 +332,8 @@ ---@field CreateHeader fun(self:table, parent:frame, headerTable:df_headercolumndata[], options:table?, frameName:string?) : df_headerframe ---@field CreateGraphicMultiLineFrame fun(self:table, parent:frame, name:string) : df_chartmulti ---@field CreateGraphicLineFrame fun(self:table, parent:frame, name:string) : df_chart ----@field +---@field CreateFlashAnimation fun(self:table, frame:uiobject, onFinishFunc:function?, onLoopFunc:function?) : animationgroup +---@field CreateTimeBar fun(self:table, parent:frame, texture:texturepath|textureid, width:number?, height:number?, value:number?, member:string?, name:string?) : df_timebar --[=[ Wrapped objects: when using the following functions, the object will be wrapped in a table, e.g. detailsFramework:CreateButton() will return a table with the button, the button will be accessible through the "button" key. diff --git a/Libs/DF/fw.lua b/Libs/DF/fw.lua index 2c6547161..f890d58fd 100644 --- a/Libs/DF/fw.lua +++ b/Libs/DF/fw.lua @@ -1,6 +1,6 @@ -local dversion = 557 +local dversion = 559 local major, minor = "DetailsFramework-1.0", dversion local DF, oldminor = LibStub:NewLibrary(major, minor) @@ -34,7 +34,7 @@ local GetSpellBookItemName = GetSpellBookItemName or C_SpellBook.GetSpellBookIte local GetNumSpellTabs = GetNumSpellTabs or C_SpellBook.GetNumSpellBookSkillLines local GetSpellTabInfo = GetSpellTabInfo or function(tabLine) local skillLine = C_SpellBook.GetSpellBookSkillLineInfo(tabLine) if skillLine then return skillLine.name, skillLine.iconID, skillLine.itemIndexOffset, skillLine.numSpellBookItems, skillLine.isGuild, skillLine.offSpecID end end local SpellBookItemTypeMap = Enum.SpellBookItemType and {[Enum.SpellBookItemType.Spell] = "SPELL", [Enum.SpellBookItemType.None] = "NONE", [Enum.SpellBookItemType.Flyout] = "FLYOUT", [Enum.SpellBookItemType.FutureSpell] = "FUTURESPELL", [Enum.SpellBookItemType.PetAction] = "PETACTION" } or {} -local GetSpellBookItemInfo = GetSpellBookItemInfo or function(...) local si = C_SpellBook.GetSpellBookItemInfo(...) if si then return SpellBookItemTypeMap[si.itemType] or "NONE", si.spellID end end +local GetSpellBookItemInfo = GetSpellBookItemInfo or function(...) local si = C_SpellBook.GetSpellBookItemInfo(...) if si then return SpellBookItemTypeMap[si.itemType] or "NONE", (si.itemType == Enum.SpellBookItemType.Flyout or si.itemType == Enum.SpellBookItemType.PetAction) and si.actionID or si.spellID or si.actionID, si end end local SPELLBOOK_BANK_PLAYER = Enum.SpellBookSpellBank and Enum.SpellBookSpellBank.Player or "player" local SPELLBOOK_BANK_PET = Enum.SpellBookSpellBank and Enum.SpellBookSpellBank.Pet or "pet" local IsPassiveSpell = IsPassiveSpell or C_Spell.IsSpellPassive @@ -2017,6 +2017,10 @@ local startFlash_Method = function(self, fadeInTime, fadeOutTime, flashDuration, flashAnimation:Play() end +---create a flash animation for a frame +---@param frame table +---@param onFinishFunc function? +---@param onLoopFunc function? function DF:CreateFlashAnimation(frame, onFinishFunc, onLoopFunc) local flashAnimation = frame:CreateAnimationGroup() @@ -2915,7 +2919,7 @@ end --DF.font_templates ["ORANGE_FONT_TEMPLATE"] = {color = "orange", size = 11, font = "Accidental Presidency"} --DF.font_templates ["OPTIONS_FONT_TEMPLATE"] = {color = "yellow", size = 12, font = "Accidental Presidency"} --DF.font_templates["ORANGE_FONT_TEMPLATE"] = {color = "orange", size = 10, font = DF:GetBestFontForLanguage()} -DF.font_templates["ORANGE_FONT_TEMPLATE"] = {color = {1, 0.8235, 0, 1}, size = 12, font = DF:GetBestFontForLanguage()} +DF.font_templates["ORANGE_FONT_TEMPLATE"] = {color = {1, 0.8235, 0, 1}, size = 11, font = DF:GetBestFontForLanguage()} --DF.font_templates["OPTIONS_FONT_TEMPLATE"] = {color = "yellow", size = 9.6, font = DF:GetBestFontForLanguage()} DF.font_templates["OPTIONS_FONT_TEMPLATE"] = {color = {1, 1, 1, 0.9}, size = 9.6, font = DF:GetBestFontForLanguage()} DF.font_templates["SMALL_SILVER"] = {color = "silver", size = 9, font = DF:GetBestFontForLanguage()} diff --git a/Libs/DF/panel.lua b/Libs/DF/panel.lua index 47f829a37..566942efe 100644 --- a/Libs/DF/panel.lua +++ b/Libs/DF/panel.lua @@ -19,8 +19,11 @@ local CreateFrame = CreateFrame local GetSpellInfo = GetSpellInfo or function(spellID) if not spellID then return nil end local si = C_Spell.GetSpellInfo(spellID) if si then return si.name, nil, si.iconID, si.castTime, si.minRange, si.maxRange, si.spellID, si.originalIconID end end local GetNumSpellTabs = GetNumSpellTabs or C_SpellBook.GetNumSpellBookSkillLines local GetSpellTabInfo = GetSpellTabInfo or function(tabLine) local skillLine = C_SpellBook.GetSpellBookSkillLineInfo(tabLine) if skillLine then return skillLine.name, skillLine.iconID, skillLine.itemIndexOffset, skillLine.numSpellBookItems, skillLine.isGuild, skillLine.offSpecID end end +local SPELLBOOK_BANK_PLAYER = Enum.SpellBookSpellBank and Enum.SpellBookSpellBank.Player or "player" local SpellBookItemTypeMap = Enum.SpellBookItemType and {[Enum.SpellBookItemType.Spell] = "SPELL", [Enum.SpellBookItemType.None] = "NONE", [Enum.SpellBookItemType.Flyout] = "FLYOUT", [Enum.SpellBookItemType.FutureSpell] = "FUTURESPELL", [Enum.SpellBookItemType.PetAction] = "PETACTION" } or {} -local GetSpellBookItemInfo = GetSpellBookItemInfo or function(...) local si = C_SpellBook.GetSpellBookItemInfo(...) if si then return SpellBookItemTypeMap[si.itemType] or "NONE", si.spellID end end +local GetSpellBookItemInfo = GetSpellBookItemInfo or function(...) local si = C_SpellBook.GetSpellBookItemInfo(...) if si then return SpellBookItemTypeMap[si.itemType] or "NONE", (si.itemType == Enum.SpellBookItemType.Flyout or si.itemType == Enum.SpellBookItemType.PetAction) and si.actionID or si.spellID or si.actionID, si end end +local GetSpellBookItemTexture = GetSpellBookItemTexture or function(...) return C_SpellBook.GetSpellBookItemTexture(...) end +local GetSpellTexture = GetSpellTexture or function(...) return C_Spell.GetSpellTexture(...) end local IS_WOW_PROJECT_MAINLINE = WOW_PROJECT_ID == WOW_PROJECT_MAINLINE local IS_WOW_PROJECT_NOT_MAINLINE = WOW_PROJECT_ID ~= WOW_PROJECT_MAINLINE @@ -1710,9 +1713,12 @@ function detailsFramework:IconPick (callback, close_when_select, param1, param2) --fill with icons local MACRO_ICON_FILENAMES = {} local SPELLNAMES_CACHE = {} + local SPELLIDS_CACHE = {} detailsFramework.IconPickFrame:SetScript("OnShow", function() MACRO_ICON_FILENAMES[1] = "INV_MISC_QUESTIONMARK" + SPELLNAMES_CACHE[1] = "INV_MISC_QUESTIONMARK" + SPELLIDS_CACHE[1] = IS_WOW_PROJECT_MAINLINE and 74008 or 25675 local index = 2 for i = 1, GetNumSpellTabs() do @@ -1722,10 +1728,11 @@ function detailsFramework:IconPick (callback, close_when_select, param1, param2) for j = offset, tabEnd - 1 do --to get spell info by slot, you have to pass in a pet argument - local spellType, ID = GetSpellBookItemInfo(j, "player") + local spellType, ID, si = GetSpellBookItemInfo(j, SPELLBOOK_BANK_PLAYER) if (spellType ~= "FLYOUT") then - MACRO_ICON_FILENAMES [index] = GetSpellBookItemTexture(j, "player") or 0 - SPELLNAMES_CACHE [index] = GetSpellInfo(ID) + MACRO_ICON_FILENAMES [index] = si and si.iconID or GetSpellBookItemTexture(j, SPELLBOOK_BANK_PLAYER) or 0 + SPELLNAMES_CACHE [index] = si and si.name or GetSpellInfo(ID) + SPELLIDS_CACHE [index] = si and (si.spellID or si.actionID) or ID index = index + 1 elseif (spellType == "FLYOUT") then @@ -1736,6 +1743,7 @@ function detailsFramework:IconPick (callback, close_when_select, param1, param2) if (isKnown) then MACRO_ICON_FILENAMES [index] = GetSpellTexture(spellID) or 0 SPELLNAMES_CACHE [index] = GetSpellInfo(spellID) + SPELLIDS_CACHE [index] = spellID index = index + 1 end end @@ -1808,10 +1816,20 @@ function detailsFramework:IconPick (callback, close_when_select, param1, param2) line.buttons[o].icon:SetTexture(texture) line.buttons[o].texture = texture else - line.buttons[o].icon:SetTexture(iconsInThisLine[o]) - line.buttons[o].texture = iconsInThisLine[o] + local lineIcon = iconsInThisLine[o] + if type(lineIcon) == "string" and not string.find(lineIcon, "^[Ii]nterface") then + lineIcon = "Interface/ICONS/" .. lineIcon + end + DevTool:AddData(lineIcon, "lineIcon") + line.buttons[o].icon:SetTexture(lineIcon) + line.buttons[o].texture = lineIcon end end + + for o = #iconsInThisLine+1, 10 do -- cleanup unused + line.buttons[o].icon:SetTexture(nil) + line.buttons[o].texture = nil + end end end end @@ -1844,7 +1862,26 @@ function detailsFramework:IconPick (callback, close_when_select, param1, param2) currentTable = t end - currentTable[index] = SPELLNAMES_CACHE[i] + currentTable[index] = SPELLIDS_CACHE[i] --SPELLNAMES_CACHE[i] --spellName won't work in 11.0, use IDs instead. + + index = index + 1 + if (index == 11) then + index = nil + end + end + + end + + for i = 1, #MACRO_ICON_FILENAMES do + if (MACRO_ICON_FILENAMES[i] and type(MACRO_ICON_FILENAMES[i]) == "string" and MACRO_ICON_FILENAMES[i]:lower():find(filter)) then + if (not index) then + index = 1 + local t = {} + iconList[#iconList+1] = t + currentTable = t + end + + currentTable[index] = MACRO_ICON_FILENAMES[i] index = index + 1 if (index == 11) then @@ -1859,7 +1896,7 @@ function detailsFramework:IconPick (callback, close_when_select, param1, param2) iconList[#iconList+1] = t for o = i, i+9 do if (SPELLNAMES_CACHE[o]) then - t[#t+1] = SPELLNAMES_CACHE[o] + t[#t+1] = SPELLIDS_CACHE[o] --SPELLNAMES_CACHE[o] --spellName won't work in 11.0, use IDs instead. end end end diff --git a/Libs/DF/timebar.lua b/Libs/DF/timebar.lua index bfc4a8d15..4782816b2 100644 --- a/Libs/DF/timebar.lua +++ b/Libs/DF/timebar.lua @@ -1,6 +1,7 @@ -local DF = _G["DetailsFramework"] -if (not DF or not DetailsFrameworkCanLoad) then +---@type detailsframework +local detailsFramework = _G["DetailsFramework"] +if (not detailsFramework or not DetailsFrameworkCanLoad) then return end @@ -9,20 +10,69 @@ local type = type local floor = math.floor local GetTime = GetTime +---@class df_timebar : statusbar, df_scripthookmixin, df_widgets +---@field type string +---@field dframework boolean +---@field statusBar df_timebar_statusbar +---@field widget statusbar +---@field direction string +---@field HookList table +---@field tooltip string +---@field locked boolean +---@field HasTimer fun(self:df_timebar):boolean return if the timer bar is active showing a timer +---@field SetTimer fun(self:df_timebar, currentTime:number, startTime:number|boolean|nil, endTime:number|nil) +---@field StartTimer fun(self:df_timebar, currentTime:number, startTime:number, endTime:number) +---@field StopTimer fun(self:df_timebar) +---@field ShowSpark fun(self:df_timebar, state:boolean, alpha:number|nil, color:string|nil) +---@field ShowTimer fun(self:df_timebar, bShowTimer:boolean) +---@field SetIcon fun(self:df_timebar, texture:string, L:number|nil, R:number|nil, T:number|nil, B:number|nil) +---@field SetIconSize fun(self:df_timebar, width:number, height:number) +---@field SetTexture fun(self:df_timebar, texture:texturepath|textureid) +---@field SetColor fun(self:df_timebar, color:any, green:number|nil, blue:number|nil, alpha:number|nil) +---@field SetLeftText fun(self:df_timebar, text:string) +---@field SetRightText fun(self:df_timebar, text:string) +---@field SetFont fun(self:df_timebar, font:string|nil, size:number|nil, color:any, shadow:boolean|nil) +---@field SetThrottle fun(self:df_timebar, seconds:number) +---@field SetDirection fun(self:df_timebar, direction:string) + +---@class df_timebar_statusbar : statusbar +---@field MyObject df_timebar +---@field hasTimer boolean +---@field startTime number +---@field endTime number +---@field timeLeft1 number +---@field timeLeft2 number +---@field throttle number +---@field isUsingThrottle boolean +---@field showTimer boolean +---@field amountThrottle number +---@field sparkAlpha number +---@field sparkColorR number +---@field sparkColorG number +---@field sparkColorB number +---@field dontShowSpark boolean +---@field direction string +---@field spark texture +---@field icon texture +---@field leftText fontstring +---@field rightText fontstring +---@field backgroundTexture texture +---@field barTexture texture + local APITimeBarFunctions do local metaPrototype = { WidgetType = "timebar", - dversion = DF.dversion, + dversion = detailsFramework.dversion, } --check if there's a metaPrototype already existing - if (_G[DF.GlobalWidgetControlNames["timebar"]]) then + if (_G[detailsFramework.GlobalWidgetControlNames["timebar"]]) then --get the already existing metaPrototype - local oldMetaPrototype = _G[DF.GlobalWidgetControlNames["timebar"]] + local oldMetaPrototype = _G[detailsFramework.GlobalWidgetControlNames["timebar"]] --check if is older - if ( (not oldMetaPrototype.dversion) or (oldMetaPrototype.dversion < DF.dversion) ) then + if ( (not oldMetaPrototype.dversion) or (oldMetaPrototype.dversion < detailsFramework.dversion) ) then --the version is older them the currently loading one --copy the new values into the old metatable for funcName, _ in pairs(metaPrototype) do @@ -31,12 +81,12 @@ do end else --first time loading the framework - _G[DF.GlobalWidgetControlNames["timebar"]] = metaPrototype + _G[detailsFramework.GlobalWidgetControlNames["timebar"]] = metaPrototype end end -local TimeBarMetaFunctions = _G[DF.GlobalWidgetControlNames["timebar"]] -DF:Mixin(TimeBarMetaFunctions, DF.ScriptHookMixin) +local TimeBarMetaFunctions = _G[detailsFramework.GlobalWidgetControlNames["timebar"]] +detailsFramework:Mixin(TimeBarMetaFunctions, detailsFramework.ScriptHookMixin) --methods TimeBarMetaFunctions.SetMembers = TimeBarMetaFunctions.SetMembers or {} @@ -159,7 +209,7 @@ function TimeBarMetaFunctions:SetTexture(texture) end function TimeBarMetaFunctions:SetColor(color, green, blue, alpha) - local r, g, b, a = DF:ParseColors(color, green, blue, alpha) + local r, g, b, a = detailsFramework:ParseColors(color, green, blue, alpha) self.statusBar.barTexture:SetVertexColor(r, g, b, a) end @@ -172,22 +222,25 @@ end function TimeBarMetaFunctions:SetFont(font, size, color, shadow) if (font) then - DF:SetFontFace(self.statusBar.leftText, font) + detailsFramework:SetFontFace(self.statusBar.leftText, font) end if (size) then - DF:SetFontSize(self.statusBar.leftText, size) + detailsFramework:SetFontSize(self.statusBar.leftText, size) end if (color) then - DF:SetFontColor(self.statusBar.leftText, color) + detailsFramework:SetFontColor(self.statusBar.leftText, color) end if (shadow) then - DF:SetFontOutline(self.statusBar.leftText, shadow) + detailsFramework:SetFontOutline(self.statusBar.leftText, shadow) end end +---set a throttle for the timer bar, the timer will only update every X seconds +---calling without parameters will disable the throttle +---@param seconds number|nil the amount of seconds to throttle the timer function TimeBarMetaFunctions:SetThrottle(seconds) if (seconds and seconds > 0) then self.statusBar.isUsingThrottle = true @@ -197,6 +250,8 @@ function TimeBarMetaFunctions:SetThrottle(seconds) end end +---accept 'left' 'right' or nil, if ommited will default to right +---@param direction "left"|"right"|nil the direction of the timer bar function TimeBarMetaFunctions:SetDirection(direction) direction = direction or "right" self.direction = direction @@ -225,6 +280,14 @@ function TimeBarMetaFunctions:StopTimer() statusBar.spark:Hide() end +function TimeBarMetaFunctions:ShowTimer(bShowTimer) + if (bShowTimer) then + self.statusBar.showTimer = true + else + self.statusBar.showTimer = nil + end +end + function TimeBarMetaFunctions:ShowSpark(state, alpha, color) if (type(state) == "boolean" and state == false) then self.statusBar.dontShowSpark = true @@ -239,7 +302,7 @@ function TimeBarMetaFunctions:ShowSpark(state, alpha, color) end if (color) then - local r, g, b = DF:ParseColors(color) + local r, g, b = detailsFramework:ParseColors(color) if (r and g and b) then self.statusBar.sparkColorR = r self.statusBar.sparkColorG = g @@ -252,6 +315,8 @@ function TimeBarMetaFunctions:ShowSpark(state, alpha, color) end end +---@param self df_timebar_statusbar +---@param deltaTime number local OnUpdateFunc = function(self, deltaTime) if (self.isUsingThrottle) then self.throttle = self.throttle + deltaTime @@ -283,9 +348,11 @@ local OnUpdateFunc = function(self, deltaTime) end end - local timeLeft = floor(endTime - timeNow) - local formatedTimeLeft = DF:IntegerToTimer(timeLeft) - self.rightText:SetText(formatedTimeLeft) + if (self.showTimer) then + local timeLeft = floor(endTime - timeNow) + local formatedTimeLeft = detailsFramework:IntegerToTimer(timeLeft) + self.rightText:SetText(formatedTimeLeft) + end --check if finished if (timeNow >= self.endTime) then @@ -293,6 +360,12 @@ local OnUpdateFunc = function(self, deltaTime) end end +---start a timer on the timebar +---calling without parameters will stop the timer +---@param self df_timebar +---@param currentTime number the time in seconds if startTime is a boolean true. GetTime() when start and end time are passed +---@param startTime number|boolean|nil GetTime() when the timer started. if passed true: startTime and endTime are GetTime() and GetTime() + currentTime, currenTime is the time in seconds +---@param endTime number|nil GetTime() when the timer will end. ignored if startTime is a boolean true function TimeBarMetaFunctions:SetTimer(currentTime, startTime, endTime) self.statusBar:Show() @@ -306,7 +379,7 @@ function TimeBarMetaFunctions:SetTimer(currentTime, startTime, endTime) --it is the same timer called again return end - self.statusBar.startTime = startTime + self.statusBar.startTime = tonumber(startTime) or 0 --fit the number type self.statusBar.endTime = endTime else local bForceNewTimer = type(startTime) == "boolean" and startTime @@ -358,18 +431,26 @@ function TimeBarMetaFunctions:SetTimer(currentTime, startTime, endTime) end end - -function DF:CreateTimeBar(parent, texture, width, height, value, member, name) +---create a time bar widget, a timebar is a statubar that can have a timer and a spark +---@param parent frame the parent frame +---@param texture texturepath|textureid the texture of the bar +---@param width number? the width of the bar, default is 150 +---@param height number? the height of the bar, default is 20 +---@param value number? the initial value of the bar, default is 0 +---@param member string? the name of the member in the parent frame +---@param name string? the name of the widget +---@return df_timebar +function detailsFramework:CreateTimeBar(parent, texture, width, height, value, member, name) if (not name) then - name = "DetailsFrameworkBarNumber" .. DF.BarNameCounter - DF.BarNameCounter = DF.BarNameCounter + 1 + name = "DetailsFrameworkBarNumber" .. detailsFramework.BarNameCounter + detailsFramework.BarNameCounter = detailsFramework.BarNameCounter + 1 elseif (not parent) then - return error("Details! FrameWork: parent not found.", 2) + error("Details! FrameWork: parent not found.", 2) end if (name:find("$parent")) then - local parentName = DF:GetParentName(parent) + local parentName = detailsFramework:GetParentName(parent) name = name:gsub("$parent", parentName) end @@ -381,18 +462,21 @@ function DF:CreateTimeBar(parent, texture, width, height, value, member, name) if (member) then parent[member] = timeBar end + + ---@diagnostic disable-next-line: undefined-field if (parent.dframework) then + ---@diagnostic disable-next-line: undefined-field parent = parent.widget end value = value or 0 width = width or 150 - height = height or 14 + height = height or 20 timeBar.locked = false timeBar.statusBar = CreateFrame("statusbar", name, parent, "BackdropTemplate") timeBar.widget = timeBar.statusBar - DF:Mixin(timeBar.statusBar, DF.WidgetFunctions) + detailsFramework:Mixin(timeBar.statusBar, detailsFramework.WidgetFunctions) timeBar.statusBar.MyObject = timeBar timeBar.direction = "right" @@ -403,7 +487,9 @@ function DF:CreateTimeBar(parent, texture, width, height, value, member, name) if (not TimeBarMetaFunctions[funcName]) then TimeBarMetaFunctions[funcName] = function(object, ...) local x = loadstring("return _G['"..object.statusBar:GetName().."']:"..funcName.."(...)") - return x(...) + if (x) then + return x(...) + end end end end @@ -439,7 +525,7 @@ function DF:CreateTimeBar(parent, texture, width, height, value, member, name) timeBar.statusBar.rightText = timeBar.statusBar:CreateFontString(nil, "overlay", "GameFontNormal", 4) timeBar.statusBar.rightText:SetPoint("right", timeBar.statusBar, "right", -2, 0) timeBar.statusBar.rightText:SetJustifyH("left") - + --hooks timeBar.HookList = { OnEnter = {}, diff --git a/Libs/LibOpenRaid/LibOpenRaid.lua b/Libs/LibOpenRaid/LibOpenRaid.lua index b66fc381a..c90ddb4cf 100644 --- a/Libs/LibOpenRaid/LibOpenRaid.lua +++ b/Libs/LibOpenRaid/LibOpenRaid.lua @@ -44,7 +44,7 @@ end local major = "LibOpenRaid-1.0" -local CONST_LIB_VERSION = 135 +local CONST_LIB_VERSION = 136 if (LIB_OPEN_RAID_MAX_VERSION) then if (CONST_LIB_VERSION <= LIB_OPEN_RAID_MAX_VERSION) then diff --git a/Libs/LibOpenRaid/ThingsToMantain_WarWithin.lua b/Libs/LibOpenRaid/ThingsToMantain_WarWithin.lua index 5691e047a..38c60616f 100644 --- a/Libs/LibOpenRaid/ThingsToMantain_WarWithin.lua +++ b/Libs/LibOpenRaid/ThingsToMantain_WarWithin.lua @@ -441,6 +441,8 @@ do [236776] = {cooldown = 40, duration = 0, specs = {253, 254, 255}, talent = false, charges = 1, class = "HUNTER", type = 8}, --High Explosive Trap [272682] = {cooldown = 45, duration = 4, specs = {253, 254, 255}, talent = false, charges = 1, class = "HUNTER", type = 7}, --Master's Call [359844] = {cooldown = 120, duration = 20, specs = {253}, talent = true, charges = 1, class = "HUNTER", type = 1}, -- Call of the Wild + [462031] = {cooldown = 60, duration = 0, specs = {}, talent = false, charges = 1, class = "HUNTER", type = 8}, --Implosive Trap + --Boar nil 62305 Master's Call --Boar Tiranaa 54216 Master's Call --Tiranaa Tiranaa 272682 Master's Call diff --git a/boot.lua b/boot.lua index bfcd56fdf..afa0c42fa 100644 --- a/boot.lua +++ b/boot.lua @@ -19,8 +19,8 @@ local addonName, Details222 = ... local version, build, date, tvs = GetBuildInfo() - Details.build_counter = 12829 - Details.alpha_build_counter = 12829 --if this is higher than the regular counter, use it instead + Details.build_counter = 12830 + Details.alpha_build_counter = 12830 --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 @@ -1218,6 +1218,7 @@ do _detalhes.empty_table = {} --register textures and fonts for shared media + ---@type table local SharedMedia = LibStub:GetLibrary ("LibSharedMedia-3.0") --default bars SharedMedia:Register("statusbar", "Details Hyanda", [[Interface\AddOns\Details\images\bar_hyanda]]) diff --git a/core/parser.lua b/core/parser.lua index 42c912bc7..d49d3ea58 100755 --- a/core/parser.lua +++ b/core/parser.lua @@ -5907,10 +5907,12 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 end local keystoneLevels = {} + local playerRatings = {} Details.KeystoneLevels = keystoneLevels - --save the keystone level for each of the 5 party members + Details.PlayerRatings = playerRatings + --save the keystone and rating level for each of the 5 party members - local saveGroupMembersKeystoneLevel = function() + local saveGroupMembersKeystoneAndRatingLevel = function() wipe(keystoneLevels) local libOpenRaid = LibStub("LibOpenRaid-1.0", true) @@ -5922,6 +5924,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 if (unitKeystoneInfo) then local unitName = Details:GetFullName(unitId) keystoneLevels[unitName] = unitKeystoneInfo.level + playerRatings[unitName] = unitKeystoneInfo.rating end end end @@ -5932,6 +5935,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 if (unitKeystoneInfo) then local unitName = Details:GetFullName(unitId) keystoneLevels[unitName] = unitKeystoneInfo.level + playerRatings[unitName] = unitKeystoneInfo.rating end end end @@ -5940,7 +5944,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 function Details222.CacheKeystoneForAllGroupMembers() local _, instanceType, difficultyID = GetInstanceInfo() if (instanceType == "party") then - saveGroupMembersKeystoneLevel() + saveGroupMembersKeystoneAndRatingLevel() end end @@ -5948,7 +5952,7 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 Details222.MythicPlus.WorldStateTimerEndAt = time() --wait until the keystone is updated and send it to the party - saveGroupMembersKeystoneLevel() + saveGroupMembersKeystoneAndRatingLevel() ---@type number mapID ---@type number level @@ -6605,8 +6609,14 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 end end + --open world out of combat spell damage + local outofcombat_spell_damage = function(unused, token, time, whoGUID, whoName, whoFlags, targetGUID, targetName, targetFlags) + --identify if the attacker is a group member + end + local out_of_combat_interresting_events = { ["SPELL_SUMMON"] = parser.summon, + ["SPELL_DAMAGE"] = outofcombat_spell_damage, } function Details222.Parser.OnParserEventOutOfCombat() diff --git a/frames/window_mythicplus/window_end_of_run.lua b/frames/window_mythicplus/window_end_of_run.lua index 8a6d636d0..3e5bff46a 100644 --- a/frames/window_mythicplus/window_end_of_run.lua +++ b/frames/window_mythicplus/window_end_of_run.lua @@ -17,6 +17,8 @@ local PixelUtil = PixelUtil local C_Timer = C_Timer local GameTooltip = GameTooltip local SOUNDKIT = SOUNDKIT +local C_EventUtils = C_EventUtils +local C_AddOns = C_AddOns local GetItemInfo = GetItemInfo or C_Item.GetItemInfo local GetItemIcon = GetItemIcon or C_Item.GetItemIcon @@ -27,9 +29,26 @@ 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 +local CONST_DEBUG_MODE = true local LOOT_DEBUG_MODE = false +--fallback if the class color isn't found +local defaultColor = {r = 0.9, g = 0.9, b = 0.9} + +local playerBannerSettings = { + background_width = 286, + background_height = 64, + playername_background_width = 68, + playername_background_height = 12, + playername_fontsize = 12, + playername_fontcolor = {1, 1, 1}, + dungeon_texture_width = 32, + dungeon_texture_height = 32, + loot_square_amount = 2, + trans_anim_duration = 0.5, --time that the translation animation takes to move the banner from right to left +} + + function Details222.Debug.SetMythicPlusDebugState(bState) if (bState == nil) then bState = not CONST_DEBUG_MODE @@ -60,16 +79,23 @@ _G.MythicDungeonFrames = mythicDungeonFrames ---@field BounceFrameShake df_frameshake ---@class playerbanner : frame +---@field index number +---@field BackgroundBannerMaskTexture texture +---@field BackgroundBannerGradient texture ---@field FadeInAnimation animationgroup ----@field BackgroundBannerTextureScaleAnimation animationgroup +---@field BackgroundShowAnim animationgroup +---@field DungeonBackdropShowAnim animationgroup +---@field BackgroundGradientAnim animationgroup ---@field BackgroundBannerFlashTextureColorAnimation animationgroup ---@field BounceFrameShake df_frameshake ---@field NextLootSquare number ---@field LootSquares details_lootsquare[] ---@field LevelUpFrame frame ---@field LevelUpTextFrame frame +---@field WaitingForLootLabel df_label +---@field RantingLabel df_label ---@field LevelFontString fontstring ----@field DungeonTexture texture +---@field KeyStoneDungeonTexture texture ---@field DungeonBorderTexture texture ---@field FlashTexture texture ---@field LootSquare frame @@ -79,6 +105,8 @@ _G.MythicDungeonFrames = mythicDungeonFrames ---@field unitId string ---@field unitName string ---@field PlayerNameFontString fontstring +---@field PlayerNameBackgroundTexture texture +---@field DungeonBackdropTexture texture ---@field BackgroundBannerTexture animatedtexture ---@field BackgroundBannerFlashTexture animatedtexture ---@field RoleIcon texture @@ -87,6 +115,8 @@ _G.MythicDungeonFrames = mythicDungeonFrames ---@field Name fontstring ---@field AnimIn animationgroup ---@field AnimOut animationgroup +---@field StartTextDotAnimation fun(self:playerbanner) +---@field StopTextDotAnimation fun(self:playerbanner) ---@field ClearLootSquares fun(self:playerbanner) ---@field GetLootSquare fun(self:playerbanner):details_lootsquare @@ -94,7 +124,9 @@ _G.MythicDungeonFrames = mythicDungeonFrames ---@field LootIcon texture ---@field LootIconBorder texture ---@field LootItemLevel fontstring +---@field LootItemLevelBackgroundTexture texture ---@field itemLink string +---@field ShadowTexture texture ---@class details_loot_cache : table ---@field playerName string @@ -107,6 +139,38 @@ _G.MythicDungeonFrames = mythicDungeonFrames ---@class lootframe : frame ---@field LootCache details_loot_cache[] +---@class details_mplus_endframe : frame +---@field unitCacheByName playerbanner[] +---@field entryAnimationDuration number +---@field AutoCloseTimeBar df_timebar +---@field OpeningAnimation animationgroup +---@field HeaderFadeInAnimation animationgroup +---@field HeaderTexture texture +---@field TopFrame frame +---@field ContentFrame frame +---@field ContentFrameFadeInAnimation animationgroup +---@field YellowSpikeCircle texture +---@field YellowFlash texture +---@field Level fontstring +---@field leftFiligree texture +---@field rightFiligree texture +---@field bottomFiligree texture +---@field CloseButton df_closebutton +---@field ConfigButton df_button +---@field ShowBreakdownButton df_button +---@field ShowChartButton df_button +---@field PlayerBanners playerbanner[] +---@field YouBeatTheTimerLabel fontstring +---@field RantingLabel df_label +---@field ElapsedTimeIcon texture +---@field ElapsedTimeText fontstring +---@field OutOfCombatIcon texture +---@field OutOfCombatText fontstring +---@field SandTimeIcon texture +---@field KeylevelText fontstring +---@field StrongArmIcon texture + + --frame to handle loot events local lootFrame = CreateFrame("frame", "DetailsEndOfMythicLootFrame", UIParent) lootFrame:RegisterEvent("BOSS_KILL") @@ -119,9 +183,10 @@ end lootFrame.LootCache = {} --currently being called after a updatPlayerBanner() -function lootFrame.UpdateUnitLoot(unitBanner) - local unitId = unitBanner.unitId - local unitName = unitBanner.unitName +function lootFrame.UpdateUnitLoot(playerBanner) + ---@cast playerBanner playerbanner + local unitId = playerBanner.unitId + local unitName = playerBanner.unitName local timeNow = GetTime() local lootCache = lootFrame.LootCache[unitName] @@ -135,6 +200,10 @@ function lootFrame.UpdateUnitLoot(unitBanner) end end + if (#lootCache > 0) then + playerBanner:StopTextDotAnimation() + end + if (lootCache) then local lootCacheSize = #lootCache if (lootCacheSize > 0) then @@ -164,17 +233,17 @@ function lootFrame.UpdateUnitLoot(unitBanner) local itemQuality = lootInfo.itemQuality local itemID = lootInfo.itemID - local lootSquare = unitBanner:GetLootSquare() --internally controls the loot square index + local lootSquare = playerBanner:GetLootSquare() --internally controls the loot square index lootSquare.itemLink = itemLink --will error if this the thrid lootSquare (creates only 2 per banner) - local rarityColor = --[[GLOBAL]]ITEM_QUALITY_COLORS[itemQuality] - lootSquare.LootIconBorder:SetVertexColor(rarityColor.r, rarityColor.g, rarityColor.b, 1) - + local rarityColor = --[[GLOBAL]] ITEM_QUALITY_COLORS[itemQuality] lootSquare.LootIcon:SetTexture(C_Item.GetItemIconByID(itemID)) - --lootSquare.LootIcon:SetTexture(GetItemIcon(itemID)) --deprecated on wow11 + lootSquare.LootIconBorder:SetVertexColor(rarityColor.r, rarityColor.g, rarityColor.b, 1) lootSquare.LootItemLevel:SetText(effectiveILvl or "0") - mythicDungeonFrames.ReadyFrame.StopTextDotAnimation() + --update size + lootSquare.LootIcon:SetSize(playerBannerSettings.dungeon_texture_width, playerBannerSettings.dungeon_texture_height) + lootSquare.LootIconBorder:SetSize(playerBannerSettings.dungeon_texture_width, playerBannerSettings.dungeon_texture_height) lootSquare:Show() @@ -206,6 +275,13 @@ lootFrame:SetScript("OnEvent", function(self, event, ...) itemStackCount, itemEquipLoc, itemTexture, sellPrice, classID, subclassID, bindType, expacID, setID, isCraftingReagent = GetItemInfo(itemLink) + if (mythicDungeonFrames.ReadyFrame and mythicDungeonFrames.ReadyFrame:IsVisible()) then + local unitBanner = mythicDungeonFrames.ReadyFrame.unitCacheByName[unitName] + if (unitBanner) then + unitBanner:StopTextDotAnimation() + end + end + if (Details.debug) then Details222.DebugMsg("Loot Received:", unitName, itemLink, effectiveILvl, itemQuality, baseItemLevel, "itemType:", itemType, "itemSubType:", itemSubType, "itemEquipLoc:", itemEquipLoc) end @@ -245,11 +321,15 @@ lootFrame:SetScript("OnEvent", function(self, event, ...) end end) +---@param playerBanner playerbanner +---@param name string +---@param parent frame +---@param lootIndex number local createLootSquare = function(playerBanner, name, parent, lootIndex) ---@type details_lootsquare local lootSquare = CreateFrame("frame", playerBanner:GetName() .. "LootSquare" .. lootIndex, parent) lootSquare:SetSize(46, 46) - lootSquare:SetFrameLevel(parent:GetFrameLevel()+1) + lootSquare:SetFrameLevel(parent:GetFrameLevel()+10) lootSquare:Hide() lootSquare:SetScript("OnEnter", function(self) @@ -264,6 +344,14 @@ local createLootSquare = function(playerBanner, name, parent, lootIndex) GameTooltip:Hide() end) + local shadowTexture = playerBanner:CreateTexture("$parentShadowTexture", "artwork") + shadowTexture:SetTexture([[Interface\AddOns\Details\images\end_of_mplus_banner_mask.png]]) + shadowTexture:SetTexCoord(441/512, 511/512, 81/512, 151/512) + shadowTexture:SetSize(32, 32) + shadowTexture:SetVertexColor(0.05, 0.05, 0.05, 0.6) + shadowTexture:SetPoint("center", lootSquare, "center", 0, 0) + lootSquare.ShadowTexture = shadowTexture + local lootIcon = lootSquare:CreateTexture("$parentLootIcon", "artwork") lootIcon:SetSize(46, 46) lootIcon:SetPoint("center", lootSquare, "center", 0, 0) @@ -278,15 +366,22 @@ local createLootSquare = function(playerBanner, name, parent, lootIndex) lootSquare.LootIconBorder = lootIconBorder local lootItemLevel = lootSquare:CreateFontString("$parentLootItemLevel", "overlay", "GameFontNormal") - lootItemLevel:SetPoint("top", lootSquare, "bottom", 0, -2) + lootItemLevel:SetPoint("bottom", lootSquare, "bottom", 0, -4) lootItemLevel:SetTextColor(1, 1, 1) - detailsFramework:SetFontSize(lootItemLevel, 12) + detailsFramework:SetFontSize(lootItemLevel, 11) lootSquare.LootItemLevel = lootItemLevel + local lootItemLevelBackgroundTexture = lootSquare:CreateTexture("$parentItemLevelBackgroundTexture", "artwork", nil, 6) + lootItemLevelBackgroundTexture:SetTexture([[Interface\Cooldown\LoC-ShadowBG]]) + lootItemLevelBackgroundTexture:SetPoint("bottomleft", lootSquare, "bottomleft", -7, -3) + lootItemLevelBackgroundTexture:SetPoint("bottomright", lootSquare, "bottomright", 7, -15) + lootItemLevelBackgroundTexture:SetHeight(10) + lootSquare.LootItemLevelBackgroundTexture = lootItemLevelBackgroundTexture + return lootSquare end -local createPlayerBanner = function(parent, name) +local createPlayerBanner = function(parent, name, index) if (not C_AddOns.IsAddOnLoaded("Blizzard_ChallengesUI")) then C_AddOns.LoadAddOn("Blizzard_ChallengesUI") end @@ -296,49 +391,95 @@ local createPlayerBanner = function(parent, name) ---@type playerbanner local playerBanner = CreateFrame("frame", name, parent, template) + playerBanner.index = index playerBanner:SetAlpha(1) playerBanner:EnableMouse(true) playerBanner:SetFrameLevel(parent:GetFrameLevel()+2) + --size is set on the template --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) + detailsFramework:CreateAnimation(fadeInAnimation, "Alpha", 1, 0.2, 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", playerBanner, "bottom", -1, -7) - detailsFramework:SetFontSize(playerNameFontString, 12) + playerNameFontString:SetTextColor(unpack(playerBannerSettings.playername_fontcolor)) + playerNameFontString:SetPoint("bottom", playerBanner, "bottom", 0, 0) + detailsFramework:SetFontSize(playerNameFontString, playerBannerSettings.playername_fontsize) playerBanner.PlayerNameFontString = playerNameFontString local playerNameBackgroundTexture = playerBanner:CreateTexture("$parentPlayerNameBackgroundTexture", "overlay", nil, 6) playerNameBackgroundTexture:SetTexture([[Interface\Cooldown\LoC-ShadowBG]]) - playerNameBackgroundTexture:SetSize(68, 12) + playerNameBackgroundTexture:SetSize(playerBannerSettings.playername_background_width, playerBannerSettings.playername_background_height) playerNameBackgroundTexture:SetPoint("center", playerNameFontString, "center", 0, 0) + playerBanner.PlayerNameBackgroundTexture = playerNameBackgroundTexture - local createPlayerBannerBackgroundTexture = function(playerBanner, color, drawLevel) - local backgroundBannerTexture = playerBanner:CreateTexture("$parentBannerTexture", "background", nil, 0) + local createPlayerBannerBackgroundTexture = function(playerBanner) + ---@cast playerBanner playerbanner + local backgroundBannerTexture = playerBanner:CreateTexture("$parentBannerTexture", "background", nil, -1) ---@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:SetTexture([[Interface\AddOns\Details\images\end_of_mplus_banner_mask.png]]) + backgroundBannerTexture:SetSize(playerBannerSettings.background_width, playerBannerSettings.background_height) + backgroundBannerTexture:SetPoint("topright", playerBanner, "topleft", playerBanner:GetHeight()/2, 0) + backgroundBannerTexture:SetPoint("bottomright", playerBanner, "bottomleft", playerBanner:GetHeight()/2, 0) + local r, g, b = detailsFramework:ParseColors("dark1") backgroundBannerTexture:SetVertexColor(r, g, b) + backgroundBannerTexture:SetAlpha(0.95) + + --backdrop gradient from bottom to top + local maskTexture = playerBanner:CreateMaskTexture("$parentBackgroundBannerMaskTexture", "artwork") + maskTexture:SetTexture([[Interface\AddOns\Details\images\end_of_mplus_banner_mask.png]]) + maskTexture:SetPoint("topright", backgroundBannerTexture, "topright", 0, 0) + maskTexture:SetSize(backgroundBannerTexture:GetSize()) + playerBanner.BackgroundBannerMaskTexture = maskTexture + + ---@type df_gradienttable + local gradientTable = {gradient = "vertical", fromColor = {0.01, 0.01, 0.01, 0.5}, toColor = "transparent"} + local gradientBelowTheLine = detailsFramework:CreateTexture(playerBanner, gradientTable, 1, 64, "background", {0, 1, 0, 1}, "BackgroundGradient", "$parentBackgroundGradient") + gradientBelowTheLine:SetDrawLayer("background", 1) + gradientBelowTheLine:SetPoint("bottomleft", backgroundBannerTexture, "bottomleft", 0, 0) + gradientBelowTheLine:SetPoint("bottomright", backgroundBannerTexture, "bottomright", 0, 0) + gradientBelowTheLine:AddMaskTexture(maskTexture) + playerBanner.BackgroundBannerGradient = gradientBelowTheLine + + local dungeonBackdropTexture = playerBanner:CreateTexture("$parentDungeonBackdropTexture", "background", nil, 0) + dungeonBackdropTexture:SetVertexColor(0.2, 0.2, 0.2, 0.8) + dungeonBackdropTexture:SetDesaturation(0.5) + dungeonBackdropTexture:SetAlpha(0.5) + dungeonBackdropTexture:SetHeight(61) + dungeonBackdropTexture:SetPoint("bottomleft", backgroundBannerTexture, "bottomleft", 0, 0) + dungeonBackdropTexture:SetPoint("bottomright", backgroundBannerTexture, "bottomright", 0, 0) + --image height = 244 = 48 pixels + local topStart = 49 --pixel start for the lorebg image + local pixelsPerImage = 48 + local topCoord = (topStart + ((playerBanner.index - 1) * pixelsPerImage)) / 512 + local bottomCoord = (topStart + (playerBanner.index * pixelsPerImage)) / 512 + dungeonBackdropTexture:SetTexCoord(35/512, 291/512, topCoord, bottomCoord) + dungeonBackdropTexture:AddMaskTexture(maskTexture) + playerBanner.DungeonBackdropTexture = dungeonBackdropTexture + return backgroundBannerTexture end do - playerBanner.BackgroundBannerFlashTexture = createPlayerBannerBackgroundTexture(playerBanner, "white", -1) + ---@type animatedtexture + local bannerFlash = playerBanner:CreateTexture("$parentBannerTexture", "background", nil, 0) + bannerFlash:SetAlpha(0) + bannerFlash:SetTexture([[Interface\AddOns\Details\images\end_of_mplus_banner_mask.png]]) + bannerFlash:SetSize(playerBannerSettings.background_width, playerBannerSettings.background_height) + bannerFlash:SetPoint("topright", playerBanner, "topleft", playerBanner:GetHeight()/2, 0) + bannerFlash:SetPoint("bottomright", playerBanner, "bottomleft", playerBanner:GetHeight()/2, 0) + playerBanner.BackgroundBannerFlashTexture = bannerFlash + --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) + local backgroundBannerFlashTextureColorAnimation = detailsFramework:CreateAnimationHub(playerBanner.BackgroundBannerFlashTexture, function() end, function() playerBanner.BackgroundBannerFlashTexture:SetVertexColor(0.1, 0.1, 0.1, 0) end) + local alpha1 = detailsFramework:CreateAnimation(backgroundBannerFlashTextureColorAnimation, "Alpha", 1, 0.1, 0, 0.3) + local alpha2 = detailsFramework:CreateAnimation(backgroundBannerFlashTextureColorAnimation, "Alpha", 2, 0.1, 0.6, 0) + local scale1 = detailsFramework:CreateAnimation(backgroundBannerFlashTextureColorAnimation, "Scale", 1, 0.1, 1, 0, 1, 1, "TOP") + alpha2:SetStartDelay(0.075) playerBanner.BackgroundBannerFlashTextureColorAnimation = backgroundBannerFlashTextureColorAnimation end @@ -346,13 +487,13 @@ local createPlayerBanner = function(parent, name) playerBanner.BackgroundBannerTexture = createPlayerBannerBackgroundTexture(playerBanner) function playerBanner.BackgroundBannerTexture:CreateRandomBounceSettings() - local duration = RandomFloatInRange(0.78, 0.82) + local duration = RandomFloatInRange(0.78 + (playerBanner.index/10), 0.82 + (playerBanner.index/10)) 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 absoluteSineY = false + local scaleX = RandomFloatInRange(0.90, 1.1) + local scaleY = 0 local fadeInTime = 0 local fadeOutTime = RandomFloatInRange(0.7, 0.8) @@ -367,37 +508,55 @@ local createPlayerBanner = function(parent, name) local absoluteSineY = true local scaleX = 0 local scaleY = 1 - local fadeInTime = 0 + local fadeInTime = 0.5 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 onPlayAnim = function(self) + if (Details.mythic_plus.finished_run_frame_options.grow_direction == "left") then + self.ScaleAnim:SetOrigin("RIGHT", 0, 0) + + elseif (Details.mythic_plus.finished_run_frame_options.grow_direction == "right") then + self.ScaleAnim:SetOrigin("LEFT", 0, 0) + end + end - local backgroundBannerBorderTexture = playerBanner:CreateTexture("$parentBannerBorderTexture", "highlight", nil, -1) - backgroundBannerBorderTexture:SetAtlas("UI-Achievement-Guild-Flag-Outline") - backgroundBannerBorderTexture:SetSize(63, 129) - backgroundBannerBorderTexture:SetPoint("topleft", playerBanner, "bottomleft", -5, playerBanner:GetHeight()/2) - backgroundBannerBorderTexture:SetPoint("topright", playerBanner, "bottomright", 4, playerBanner:GetHeight()/2) + playerBannerSettings.trans_anim_duration = 0.5 - local dungeonTexture = playerBanner:CreateTexture("$parentDungeonTexture", "artwork") - dungeonTexture:SetTexCoord(25/512, 360/512, 50/512, 290/512) - dungeonTexture:SetSize(50, 39) - dungeonTexture:SetPoint("top", playerBanner,"bottom", 0, -16) - dungeonTexture:SetAlpha(0.9934) - playerBanner.DungeonTexture = dungeonTexture + local backgroundShowAnim = detailsFramework:CreateAnimationHub(playerBanner.BackgroundBannerTexture, onPlayAnim, function() playerBanner.BackgroundBannerTexture:SetSize(playerBannerSettings.background_width, playerBannerSettings.background_height) end) + backgroundShowAnim.ScaleAnim = detailsFramework:CreateAnimation(backgroundShowAnim, "Scale", 1, playerBannerSettings.trans_anim_duration, 0, 1, 1, 1, "RIGHT") + playerBanner.BackgroundShowAnim = backgroundShowAnim + + local dungeonBackdropTextureAnim = detailsFramework:CreateAnimationHub(playerBanner.DungeonBackdropTexture, onPlayAnim, function() playerBanner.DungeonBackdropTexture:SetSize(playerBannerSettings.background_width, 61) end) + dungeonBackdropTextureAnim.ScaleAnim = detailsFramework:CreateAnimation(dungeonBackdropTextureAnim, "Scale", 1, playerBannerSettings.trans_anim_duration, 0, 1, 1, 1, "RIGHT") + dungeonBackdropTextureAnim.AlphaAnim = detailsFramework:CreateAnimation(dungeonBackdropTextureAnim, "Alpha", 1, playerBannerSettings.trans_anim_duration+0.1, 0, playerBanner.DungeonBackdropTexture:GetAlpha()) + playerBanner.DungeonBackdropShowAnim = dungeonBackdropTextureAnim + + --create the same animations for the texture playerBanner.BackgroundGradient + local backgroundGradientAnim = detailsFramework:CreateAnimationHub(playerBanner.BackgroundBannerGradient, onPlayAnim, function() playerBanner.BackgroundBannerGradient:SetSize(playerBannerSettings.background_width, playerBannerSettings.background_height) end) + backgroundGradientAnim.ScaleAnim = detailsFramework:CreateAnimation(backgroundGradientAnim, "Scale", 1, playerBannerSettings.trans_anim_duration, 0, 1, 1, 1, "RIGHT") + backgroundGradientAnim.ScaleAnim:SetStartDelay(0.05) + playerBanner.BackgroundGradientAnim = backgroundGradientAnim + end + + local keyStoneDungeonTexture = playerBanner:CreateTexture("$parentDungeonTexture", "artwork") + keyStoneDungeonTexture:SetTexCoord(36/512, 375/512, 50/512, 290/512) + keyStoneDungeonTexture:SetSize(playerBannerSettings.dungeon_texture_width, playerBannerSettings.dungeon_texture_height) + keyStoneDungeonTexture:SetPoint("right", playerBanner,"left", -16, 0) + keyStoneDungeonTexture:SetAlpha(0.9934) + detailsFramework:SetMask(keyStoneDungeonTexture, [[Interface\FrameGeneral\UIFrameIconMask]]) + playerBanner.KeyStoneDungeonTexture = keyStoneDungeonTexture local dungeonBorderTexture = playerBanner:CreateTexture("$parentDungeonBorder", "border") - dungeonBorderTexture:SetTexture([[Interface\BUTTONS\UI-EmptySlot]]) + dungeonBorderTexture:SetTexture([[Interface\AddOns\Details\images\end_of_mplus.png]], nil, nil, "TRILINEAR") + dungeonBorderTexture:SetTexCoord(441/512, 511/512, 81/512, 151/512) dungeonBorderTexture:SetDrawLayer("border", 0) dungeonBorderTexture:ClearAllPoints() - dungeonBorderTexture:SetPoint("topleft", dungeonTexture,"topleft", -17, 15) - dungeonBorderTexture:SetPoint("bottomright", dungeonTexture,"bottomright", 18, -15) + dungeonBorderTexture:SetSize(playerBannerSettings.dungeon_texture_width+2, playerBannerSettings.dungeon_texture_height+2) + dungeonBorderTexture:SetPoint("center", keyStoneDungeonTexture, "center", 0, 0) dungeonBorderTexture:SetAlpha(1) + dungeonBorderTexture:SetVertexColor(0, 0, 0) playerBanner.DungeonBorderTexture = dungeonBorderTexture --load this addon, required to have access to the garrison templates @@ -411,14 +570,14 @@ local createPlayerBanner = function(parent, name) --animation for the key leveling up local levelUpFrame = CreateFrame("frame", "$LevelUpFrame", playerBanner, "GarrisonFollowerLevelUpTemplate") - levelUpFrame:SetPoint("top", dungeonTexture, "bottom", 0, 44) + levelUpFrame:SetPoint("top", keyStoneDungeonTexture, "bottom", 0, 44) levelUpFrame:SetScale(0.9) levelUpFrame.Text:SetText("") playerBanner.LevelUpFrame = levelUpFrame levelUpFrame:SetFrameLevel(playerBanner:GetFrameLevel()+1) local levelUpTextFrame = CreateFrame("frame", "$LevelUpTextFrame", playerBanner) - levelUpTextFrame:SetPoint("top", dungeonTexture, "bottom", -1, -14) + levelUpTextFrame:SetPoint("top", keyStoneDungeonTexture, "bottom", -1, 0) levelUpTextFrame:SetFrameLevel(playerBanner:GetFrameLevel()+2) levelUpTextFrame:SetSize(1, 1) playerBanner.LevelUpTextFrame = levelUpTextFrame @@ -427,12 +586,19 @@ local createPlayerBanner = function(parent, name) local shakeAnimation2 = detailsFramework:CreateFrameShake(levelUpTextFrame, 0.5, 1, 200, false, false, 0, 1, 0, 0) local levelFontString = levelUpTextFrame:CreateFontString("$parentLVLText", "artwork", "GameFontNormal") + levelFontString:SetPoint("bottom", keyStoneDungeonTexture, "bottom", 0, -4) levelFontString:SetTextColor(1, 1, 1) - levelFontString:SetPoint("center", levelUpTextFrame, "center", 0, 0) - detailsFramework:SetFontSize(levelFontString, 20) + detailsFramework:SetFontSize(levelFontString, 11) levelFontString:SetText("") playerBanner.LevelFontString = levelFontString + local levelFontStringBackgroundTexture = levelUpTextFrame:CreateTexture("$parentItemLevelBackgroundTexture", "artwork", nil, 6) + levelFontStringBackgroundTexture:SetTexture([[Interface\Cooldown\LoC-ShadowBG]]) + levelFontStringBackgroundTexture:SetPoint("bottomleft", keyStoneDungeonTexture, "bottomleft", -7, -3) + levelFontStringBackgroundTexture:SetPoint("bottomright", keyStoneDungeonTexture, "bottomright", 7, -15) + levelFontStringBackgroundTexture:SetHeight(10) + levelUpTextFrame.LevelFontStringBackgroundTexture = levelFontStringBackgroundTexture + --> animations for levelFontString local animationGroup = levelFontString:CreateAnimationGroup("DetailsMythicLevelTextAnimationGroup") animationGroup:SetLooping("NONE") @@ -509,16 +675,61 @@ local createPlayerBanner = function(parent, name) detailsFramework:CreateFlashAnimation(flashTexture) --flashTexture:Flash(0.1, 0.5, 0.01) - playerBanner.LootSquares = {} + local rantingLabel = detailsFramework:CreateLabel(playerBanner, "", 16, "green") + rantingLabel:SetPoint("right", playerBanner, "left", -154, 0) + playerBanner.RantingLabel = rantingLabel - local lootSquareAmount = 2 + local waitingForLootDotsAnimationLabel = detailsFramework:CreateLabel(playerBanner, "...", 20, "silver") --~dots + waitingForLootDotsAnimationLabel:SetDrawLayer("overlay", 6) + waitingForLootDotsAnimationLabel:SetAlpha(0.5) + waitingForLootDotsAnimationLabel:SetPoint("right", keyStoneDungeonTexture, "left", -12, 0) + waitingForLootDotsAnimationLabel:Hide() + playerBanner.WaitingForLootLabel = waitingForLootDotsAnimationLabel + + --make a text dot animation, which will show no dots at start and then "." then ".." then "..." and back to "" and so on + function playerBanner:StartTextDotAnimation() + --update the Waiting for Loot labels + local dotsString = self.WaitingForLootLabel + dotsString:Show() + + local dotsCount = 0 + local maxDots = 3 + local maxLoops = 200 + + local dotsTimer = C_Timer.NewTicker(0.5+RandomFloatInRange(-0.003, 0.003), function() + dotsCount = dotsCount + 1 + + if (dotsCount > maxDots) then + dotsCount = 0 + end + + local dotsText = "" + for i = 1, dotsCount do + dotsText = dotsText .. "." + end + + dotsString:SetText(dotsText) + end, maxLoops) + + dotsString.dotsTimer = dotsTimer + end + + function playerBanner:StopTextDotAnimation() + local dotsString = self.WaitingForLootLabel + dotsString:Hide() + if (dotsString.dotsTimer) then + dotsString.dotsTimer:Cancel() + end + end + + playerBanner.LootSquares = {} - for i = 1, lootSquareAmount do + for i = 1, playerBannerSettings.loot_square_amount do local lootSquare = createLootSquare(playerBanner, name, parent, i) if (i == 1) then - lootSquare:SetPoint("top", playerBanner, "bottom", 0, -90) + lootSquare:SetPoint("right", playerBanner, "left", -90, 0) else - lootSquare:SetPoint("top", playerBanner.LootSquares[i-1], "bottom", 0, -2) + lootSquare:SetPoint("right", playerBanner.LootSquares[i-1], "left", -2, 0) end playerBanner.LootSquares[i] = lootSquare playerBanner["lootSquare" .. i] = lootSquare @@ -546,6 +757,161 @@ local createPlayerBanner = function(parent, name) return playerBanner end +--changes the orientation of the player banners to horizontal or vertical, following the current settings +---@param readyFrame details_mplus_endframe +local setOrientation = function(readyFrame, mythicDungeonInfo, overallMythicDungeonCombat) + local settingsTable = Details.mythic_plus.finished_run_frame_options + local orientation = settingsTable.orientation + local growDirection = settingsTable.grow_direction + + readyFrame:SetFrameStrata("FULLSCREEN") + + ---@type details_instanceinfo + local instanceInfo = Details:GetInstanceInfo(mythicDungeonInfo.MapID) or Details:GetInstanceInfo(Details:GetCurrentCombat().mapId) + + if (orientation == "horizontal") then + readyFrame:SetSize(256, 430) + + if (growDirection == "left") then + --when the grow direction if to the left, the readyFrame is anchored to the right side of the ui parent + --header texture + readyFrame.HeaderTexture:ClearAllPoints() + readyFrame.HeaderTexture:SetPoint("topright", readyFrame, "topright", -7, -36) + readyFrame.HeaderTexture:SetTexCoord(257/512, 1, 234/512, 298/512) + readyFrame.HeaderTexture:SetSize(296, 64) + + readyFrame.AutoCloseTimeBar:SetSize(readyFrame.HeaderTexture:GetWidth(), 25) + readyFrame.AutoCloseTimeBar:ClearAllPoints() + readyFrame.AutoCloseTimeBar:SetPoint("topright", readyFrame.HeaderTexture, "topright", 0, -22) + readyFrame.AutoCloseTimeBar:SetTimer(40, true) + readyFrame.AutoCloseTimeBar:SetColor(1, 0.7, 0.0, 0.9) + readyFrame.AutoCloseTimeBar:SetDirection("left") + readyFrame.AutoCloseTimeBar:SetFrameLevel(readyFrame:GetFrameLevel()+1) + readyFrame.AutoCloseTimeBar:ShowSpark(false) + readyFrame.AutoCloseTimeBar:SetAlpha(0.7) + readyFrame.AutoCloseTimeBar:ShowTimer(false) + + local buttonSize = 14 + + readyFrame.ElapsedTimeIcon:ClearAllPoints() + readyFrame.OutOfCombatIcon:ClearAllPoints() + readyFrame.ElapsedTimeIcon:SetSize(buttonSize, buttonSize) + readyFrame.OutOfCombatIcon:SetSize(buttonSize, buttonSize) + readyFrame.ElapsedTimeIcon:SetPoint("topleft", readyFrame.HeaderTexture, "topleft", 51, -5) + readyFrame.OutOfCombatIcon:SetPoint("left", readyFrame.ElapsedTimeIcon, "right", 45, 0) + + readyFrame.ShowChartButton:ClearAllPoints() + PixelUtil.SetPoint(readyFrame.ShowChartButton, "right", readyFrame.ElapsedTimeIcon, "left", -3, 0) + PixelUtil.SetSize(readyFrame.ShowChartButton, 50, 32) + + readyFrame.SandTimeIcon:ClearAllPoints() + readyFrame.SandTimeIcon:SetSize(buttonSize, buttonSize) --original size is 32x60, need to adjust to the correct size + readyFrame.SandTimeIcon:SetPoint("left", readyFrame.OutOfCombatIcon, "right", 45, 0) + + readyFrame.StrongArmIcon:ClearAllPoints() + readyFrame.StrongArmIcon:SetSize(buttonSize, buttonSize) + readyFrame.StrongArmIcon:SetPoint("left", readyFrame.SandTimeIcon, "right", 18, 0) + + readyFrame.CloseButton:ClearAllPoints() + readyFrame.CloseButton:SetPoint("topright", readyFrame.HeaderTexture, "topright", -5, -5) + + readyFrame.ConfigButton:ClearAllPoints() + readyFrame.ConfigButton:SetPoint("right", readyFrame.CloseButton, "left", -3, 0) + readyFrame.ConfigButton.widget:GetNormalTexture():Show() + + local okay = pcall(function() + local objTracker = _G["ObjectiveTrackerFrame"] + if (objTracker) then + objTracker.Header.MinimizeButton:Click() + end + end) + if (not okay) then + Details:Msg("failed 0x8660") + end + + --widgets are anchored to the left side of the player banner and the player banner has its right side anchored to the right side of the readyFrame + for i = 1, #readyFrame.PlayerBanners do + --player banner + local playerBanner = readyFrame.PlayerBanners[i] + playerBanner:StartTextDotAnimation() + + playerBanner:ClearAllPoints() + if (i == 1) then + playerBanner:SetPoint("topright", readyFrame, "topright", -5, -i*playerBanner:GetHeight()) + else + playerBanner:SetPoint("topright", readyFrame.PlayerBanners[i-1], "bottomright", 0, -10) + end + + if (instanceInfo) then + playerBanner.DungeonBackdropTexture:SetTexture(instanceInfo.iconLore) + else + playerBanner.DungeonBackdropTexture:SetTexture(overallMythicDungeonCombat.is_mythic_dungeon.DungeonTexture) + end + + playerBanner.RantingLabel:ClearAllPoints() + playerBanner.RantingLabel:SetPoint("right", playerBanner, "left", -154, 0) + + --background texture + --playerBanner.BackgroundBannerTexture:ClearAllPoints() + --playerBanner.BackgroundBannerTexture:SetPoint("topright", playerBanner, "topleft", playerBanner:GetHeight()/2, 0) + --playerBanner.BackgroundBannerTexture:SetPoint("bottomright", playerBanner, "bottomleft", playerBanner:GetHeight()/2, 0) + --playerBanner.BackgroundBannerTexture:SetSize(playerBannerSettings.background_width, playerBannerSettings.background_height) + --playerBanner.BackgroundBannerTexture:SetTexCoord(256/512, 1, 0, 68/512) + + --dungeon texture is the small square icon showing a picture to identify the dungeon + playerBanner.KeyStoneDungeonTexture:ClearAllPoints() + playerBanner.KeyStoneDungeonTexture:SetPoint("right", playerBanner, "left", -8, 0) --right side attach to the left side of the player banner, growing to the left + playerBanner.KeyStoneDungeonTexture:SetSize(playerBannerSettings.dungeon_texture_width, playerBannerSettings.dungeon_texture_height) + + --loot squares + for j = 1, playerBannerSettings.loot_square_amount do + local lootSquare = playerBanner.LootSquares[j] + lootSquare:SetSize(playerBannerSettings.dungeon_texture_width, playerBannerSettings.dungeon_texture_height) + lootSquare:ClearAllPoints() + if (j == 1) then + lootSquare:SetPoint("right", playerBanner.KeyStoneDungeonTexture, "left", -2, 0) + else + lootSquare:SetPoint("right", playerBanner.LootSquares[j-1], "left", -2, 0) + end + end + + --role icon + playerBanner.RoleIcon:ClearAllPoints() + playerBanner.RoleIcon:SetPoint("center", playerBanner, "left", 4, 0) + playerBanner.RoleIcon:SetSize(18, 18) + playerBanner.RoleIcon:SetAlpha(0.834) + end + + elseif (growDirection == "right") then + --when the grow direction if to the right, the readyFrame is anchored to the left side of the ui parent + --widgets are anchored to the right side of the player banner and the player banner has its left side anchored to the left side of the readyFrame + for i = 1, #readyFrame.PlayerBanners do + + end + end + end +end + +local updateRatingLevel = function(playerBanner, unitId) + local ratingSummary = C_PlayerInfo.GetPlayerMythicPlusRatingSummary(unitId) + if (ratingSummary) then + local rating = ratingSummary.currentSeasonScore or 0 + local color = C_ChallengeMode.GetDungeonScoreRarityColor(rating) + if (not color) then + color = _G["HIGHLIGHT_FONT_COLOR"] + end + + local oldRatingLevel = Details.PlayerRatings[Details:GetFullName(unitId)] + local diff = 0 + if (oldRatingLevel) then + diff = rating - oldRatingLevel + end + + local s = "%s" + playerBanner.RantingLabel:SetText(s:format(color:WrapTextInColorCode(_G["CHALLENGE_COMPLETE_DUNGEON_SCORE_FORMAT_TEXT"]:format(rating, diff)))) + end +end + local updatPlayerBanner = function(unitId, bannerIndex) if (CONST_DEBUG_MODE) then --print("updating player banner for unit:", unitId, "bannerIndex:", bannerIndex) @@ -566,8 +932,15 @@ local updatPlayerBanner = function(unitId, bannerIndex) playerBanner.unitName = unitName playerBanner:Show() - playerBanner.FadeInAnimation:Play() - playerBanner.BackgroundBannerTextureScaleAnimation:Play() + --update the border to match the class color + local classColor = RAID_CLASS_COLORS[select(2, UnitClass(unitId))] or defaultColor + playerBanner.Border:SetVertexColor(classColor.r, classColor.g, classColor.b) + + playerBanner.BackgroundShowAnim:Play() + playerBanner.DungeonBackdropShowAnim:Play() + playerBanner.BackgroundGradientAnim:Play() + + playerBanner.FadeInAnimation:Play() --fade in the whole player banner playerBanner.BackgroundBannerFlashTextureColorAnimation:Play() playerBanner.BackgroundBannerTexture:SetFrameShakeSettings(playerBanner.BackgroundBannerTexture.BounceFrameShake, playerBanner.BackgroundBannerTexture:CreateRandomBounceSettings()) @@ -595,15 +968,21 @@ local updatPlayerBanner = function(unitId, bannerIndex) playerBanner.LevelFontString:SetText(playerKeystoneInfo.level or "") if (instanceInfo) then - playerBanner.DungeonTexture:SetTexture(instanceInfo.iconLore) + playerBanner.KeyStoneDungeonTexture:SetTexture(instanceInfo.iconLore) else - playerBanner.DungeonTexture:SetTexture([[Interface\ICONS\INV_Misc_QuestionMark]]) + playerBanner.KeyStoneDungeonTexture:SetTexture([[Interface\ICONS\INV_Misc_QuestionMark]]) end else - playerBanner.DungeonTexture:SetTexture([[Interface\ICONS\INV_Misc_QuestionMark]]) + playerBanner.KeyStoneDungeonTexture:SetTexture([[Interface\ICONS\INV_Misc_QuestionMark]]) playerBanner.LevelFontString:SetText("") end + updateRatingLevel(playerBanner, unitId) + + C_Timer.After(3, function() + updateRatingLevel(playerBanner, unitId) + end) + lootFrame.UpdateUnitLoot(playerBanner) return true end @@ -612,6 +991,7 @@ end local updateKeysStoneLevel = function() --update the player banners local libOpenRaid = LibStub("LibOpenRaid-1.0", true) + ---@type details_mplus_endframe local readyFrame = DetailsMythicDungeonReadyFrame for bannerIndex = 1, #readyFrame.PlayerBanners do @@ -625,7 +1005,7 @@ local updateKeysStoneLevel = function() --if (instanceInfo) then -- ---@type details_instanceinfo -- local thisInstanceInfo = Details:GetInstanceInfo(unitKeystoneInfo.mapID) - -- unitBanner.DungeonTexture:SetTexture(thisInstanceInfo.iconLore) + -- unitBanner.KeyStoneDungeonTexture:SetTexture(thisInstanceInfo.iconLore) --end --unitBanner.LevelFontString:SetText(unitKeystoneInfo.level) @@ -643,9 +1023,9 @@ local updateKeysStoneLevel = function() local instanceInfo = Details:GetInstanceInfo(unitKeystoneInfo.mapID) if (instanceInfo) then - unitBanner.DungeonTexture:SetTexture(instanceInfo.iconLore) + unitBanner.KeyStoneDungeonTexture:SetTexture(instanceInfo.iconLore) else - unitBanner.DungeonTexture:SetTexture([[Interface\ICONS\INV_Misc_QuestionMark]]) + unitBanner.KeyStoneDungeonTexture:SetTexture([[Interface\ICONS\INV_Misc_QuestionMark]]) end --this character had its keystone upgraded @@ -657,7 +1037,7 @@ local updateKeysStoneLevel = function() --print("keystone level updated for", Details:GetFullName(unitId), unitKeystoneInfo.level) else - unitBanner.DungeonTexture:SetTexture([[Interface\ICONS\INV_Misc_QuestionMark]]) + unitBanner.KeyStoneDungeonTexture:SetTexture([[Interface\ICONS\INV_Misc_QuestionMark]]) unitBanner.LevelFontString:SetText("") end end @@ -670,10 +1050,10 @@ end -- /run _G.DetailsMythicDungeonChartHandler.ShowEndOfMythicPlusPanel() if (CONST_DEBUG_MODE) then - C_Timer.After(3, function() + C_Timer.After(2, function() C_AddOns.LoadAddOn("Blizzard_ChallengesUI"); - _G.DetailsEndOfMythicLootFrame:GetScript("OnEvent")(_G.DetailsEndOfMythicLootFrame, "ENCOUNTER_LOOT_RECEIVED", 1, 207788, "|cffa335ee|Hitem:207788::::::::60:264::16:5:7208:6652:1501:5858:6646:1:28:1279:::|h[Shadowgrasp Totem]|h|r", 1, UnitName("player"), select(2, UnitClass("player"))) - _G.DetailsEndOfMythicLootFrame:GetScript("OnEvent")(_G.DetailsEndOfMythicLootFrame, "ENCOUNTER_LOOT_RECEIVED", 1, 207788, "|cffa335ee|Hitem:207788::::::::60:264::16:5:7208:6652:1501:5858:6646:1:28:1279:::|h[Shadowgrasp Totem]|h|r", 1, UnitName("player"), select(2, UnitClass("player"))) + _G["DetailsEndOfMythicLootFrame"]:GetScript("OnEvent")(_G["DetailsEndOfMythicLootFrame"], "ENCOUNTER_LOOT_RECEIVED", 1, 207788, "|cffa335ee|Hitem:207788::::::::60:264::16:5:7208:6652:1501:5858:6646:1:28:1279:::|h[Shadowgrasp Totem]|h|r", 1, UnitName("player"), select(2, UnitClass("player"))) + _G["DetailsEndOfMythicLootFrame"]:GetScript("OnEvent")(_G["DetailsEndOfMythicLootFrame"], "ENCOUNTER_LOOT_RECEIVED", 1, 207788, "|cffa335ee|Hitem:207788::::::::60:264::16:5:7208:6652:1501:5858:6646:1:28:1279:::|h[Shadowgrasp Totem]|h|r", 1, UnitName("player"), select(2, UnitClass("player"))) _G.MythicDungeonFrames.ShowEndOfMythicPlusPanel() end) @@ -695,6 +1075,7 @@ function mythicDungeonFrames.ShowEndOfMythicPlusPanel() local textColor = {1, 0.8196, 0, 1} local textSize = 11 + ---@type details_mplus_endframe mythicDungeonFrames.ReadyFrame = CreateFrame("frame", "DetailsMythicDungeonReadyFrame", UIParent, "BackdropTemplate") local readyFrame = mythicDungeonFrames.ReadyFrame readyFrame:SetSize(355, 390) @@ -721,11 +1102,75 @@ function mythicDungeonFrames.ShowEndOfMythicPlusPanel() color = {.1, .1, .1, 0.5}, --border_color = {.05, .05, .05, 0.834}, } - detailsFramework:AddRoundedCornersToFrame(readyFrame, roundedCornerTemplate) + --detailsFramework:AddRoundedCornersToFrame(readyFrame, roundedCornerTemplate) end readyFrame.entryAnimationDuration = 0.1 + local headerTexture = readyFrame:CreateTexture("$parentHeaderTexture", "artwork", nil, 1) + headerTexture:SetTexture([[Interface\AddOns\Details\images\end_of_mplus.png]], nil, nil, "TRILINEAR") + headerTexture:SetTexCoord(320/512, 498/512, 161/512, 192/512) + headerTexture:SetSize(178, 31) + headerTexture:SetVertexColor(0.251, 0.251, 0.251, 0.823) + readyFrame.HeaderTexture = headerTexture + + local headerFadeInAnimation = detailsFramework:CreateAnimationHub(headerTexture, function()headerTexture:SetAlpha(0)end, function()headerTexture:SetAlpha(0.823)end) + local headerAnimFadeIn = detailsFramework:CreateAnimation(headerFadeInAnimation, "Alpha", 1, 0.3, 0, 1) + headerAnimFadeIn:SetStartDelay(0.8) + + readyFrame.HeaderFadeInAnimation = headerFadeInAnimation + + --clock texture and icon to show the total time elapsed + local elapsedTimeIcon = readyFrame:CreateTexture("$parentClockIcon", "artwork", nil, 2) + elapsedTimeIcon:SetTexture([[Interface\AddOns\Details\images\end_of_mplus.png]], nil, nil, "TRILINEAR") + elapsedTimeIcon:SetTexCoord(172/512, 235/512, 84/512, 147/512) + readyFrame.ElapsedTimeIcon = elapsedTimeIcon + + local elapsedTimeText = readyFrame:CreateFontString("$parentClockText", "artwork", "GameFontNormal") + elapsedTimeText:SetTextColor(1, 1, 1) + detailsFramework:SetFontSize(elapsedTimeText, 11) + elapsedTimeText:SetText("00:00") + elapsedTimeText:SetPoint("left", elapsedTimeIcon, "right", 3, 0) + readyFrame.ElapsedTimeText = elapsedTimeText + + --another clock texture and icon to show the wasted time (time out of combat) + local outOfCombatIcon = readyFrame:CreateTexture("$parentClockIcon2", "artwork", nil, 2) + outOfCombatIcon:SetTexture([[Interface\AddOns\Details\images\end_of_mplus.png]], nil, nil, "TRILINEAR") + outOfCombatIcon:SetTexCoord(172/512, 235/512, 84/512, 147/512) + outOfCombatIcon:SetVertexColor(detailsFramework:ParseColors("orangered")) + readyFrame.OutOfCombatIcon = outOfCombatIcon + + local outOfCombatText = readyFrame:CreateFontString("$parentClockText2", "artwork", "GameFontNormal") + outOfCombatText:SetTextColor(1, 1, 1) + detailsFramework:SetFontSize(outOfCombatText, 11) + detailsFramework:SetFontColor(outOfCombatText, "orangered") + outOfCombatText:SetText("00:00") + outOfCombatText:SetPoint("left", outOfCombatIcon, "right", 3, 0) + readyFrame.OutOfCombatText = outOfCombatText + + --create the sandtime icon and a text to show the keystone level + local sandTimeIcon = readyFrame:CreateTexture("$parentSandTimeIcon", "artwork", nil, 2) + sandTimeIcon:SetTexture([[Interface\AddOns\Details\images\end_of_mplus.png]], nil, nil, "TRILINEAR") + sandTimeIcon:SetTexCoord(81/512, 137/512, 83/512, 143/512) + readyFrame.SandTimeIcon = sandTimeIcon + + local sandTimeText = readyFrame:CreateFontString("$parentSandTimeText", "artwork", "GameFontNormal") + sandTimeText:SetTextColor(1, 1, 1) + detailsFramework:SetFontSize(sandTimeText, 11) + sandTimeText:SetText("0") + sandTimeText:SetPoint("left", sandTimeIcon, "right", 1, 0) + readyFrame.KeylevelText = sandTimeText + + --create a strong arm texture and a text to show the ranting of the player + local strongArmIcon = readyFrame:CreateTexture("$parentStrongArmIcon", "artwork", nil, 2) + strongArmIcon:SetTexture([[Interface\AddOns\Details\images\end_of_mplus.png]], nil, nil, "TRILINEAR") + strongArmIcon:SetTexCoord(84/512, 145/512, 151/512, 215/512) + readyFrame.StrongArmIcon = strongArmIcon + + local rantingLabel = detailsFramework:CreateLabel(readyFrame, "", textSize, textColor) + rantingLabel:SetPoint("left", strongArmIcon, "right", 3, 0) + readyFrame.RantingLabel = rantingLabel + --this frame is required due to the animation, the readyFrame and the contentFrame has their own animations mythicDungeonFrames.ReadyFrameTop = CreateFrame("frame", "DetailsMythicDungeonReadyTopFrame", UIParent, "BackdropTemplate") mythicDungeonFrames.ReadyFrameTop:SetPoint("bottomleft", readyFrame, "topleft", 0, 0) @@ -734,44 +1179,10 @@ function mythicDungeonFrames.ShowEndOfMythicPlusPanel() readyFrame.TopFrame = mythicDungeonFrames.ReadyFrameTop 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 + detailsFramework:CreateAnimation(openingAnimationHub, "Scale", 1, readyFrame.entryAnimationDuration, 0, 1, 1, 1, "center", 0, 0) - do --backdrop textures - local maskTexture = readyFrame:CreateMaskTexture("$parentDungeonBackdropTextureMaskTexture", "artwork") - maskTexture:SetTexture([[Interface\AddOns\Details\images\masks\white_rounded_512x512.png]]) - maskTexture:SetPoint("topleft", readyFrame, "topleft", 0, 0) - maskTexture:SetPoint("bottomright", readyFrame, "bottomright", 0, 0) - - --backdrop gradient from bottom to top - ---@type df_gradienttable - local gradientTable = {gradient = "vertical", fromColor = {0, 0, 0, 0.8}, toColor = "transparent"} - local gradientBelowTheLine = detailsFramework:CreateTexture(readyFrame, gradientTable, 1, readyFrame:GetHeight()/3, "artwork", {0, 1, 0, 1}, "backgroundGradient") - gradientBelowTheLine:SetPoint("bottoms", 0, 0) - gradientBelowTheLine:AddMaskTexture(maskTexture) - - 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.834) - dungeonBackdropTexture:SetAllPoints() - dungeonBackdropTexture:AddMaskTexture(maskTexture) - readyFrame.DungeonBackdropTexture = dungeonBackdropTexture - - local anotherBackdropTexture = readyFrame:CreateTexture("$parentAnotherBackdropTexture", "artwork", nil, -3) - anotherBackdropTexture:SetTexture([[Interface\GLUES\Models\UI_HighmountainTauren\7HM_RapidSimpleMask]]) - anotherBackdropTexture:AddMaskTexture(maskTexture) - anotherBackdropTexture:SetAllPoints() - anotherBackdropTexture:SetVertexColor(0.467, 0.416, 0.639, 1) - readyFrame.AnotherBackdropTexture = anotherBackdropTexture - 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) @@ -790,19 +1201,20 @@ function mythicDungeonFrames.ShowEndOfMythicPlusPanel() spikes:SetAlpha(1) spikes:SetIgnoreParentAlpha(true) readyFrame.YellowSpikeCircle = spikes + spikes:Hide() local yellowFlash = mythicDungeonFrames.ReadyFrameTop:CreateTexture("$parentYellowFlash", "artwork") yellowFlash:SetSize(120, 120) yellowFlash:SetPoint("center", readyFrame, "top", 0, 30) - yellowFlash:SetAtlas("BossBanner-RedFlash") + --yellowFlash:SetAtlas("BossBanner-RedFlash") yellowFlash:SetAlpha(0) yellowFlash:SetBlendMode("ADD") yellowFlash:SetIgnoreParentAlpha(true) readyFrame.YellowFlash = yellowFlash readyFrame.Level = mythicDungeonFrames.ReadyFrameTop:CreateFontString("$parentLevelText", "overlay", "GameFontNormalWTF2Outline") - readyFrame.Level:SetPoint("center", readyFrame.YellowSpikeCircle, "center", 0, 0) - readyFrame.Level:SetText("") + --readyFrame.Level:SetPoint("center", readyFrame.YellowSpikeCircle, "center", 0, 0) + --readyFrame.Level:SetText("") --create the animation for the yellow flash local flashAnimHub = detailsFramework:CreateAnimationHub(yellowFlash, function() yellowFlash:SetAlpha(0) end, function() yellowFlash:SetAlpha(0) end) @@ -813,122 +1225,86 @@ function mythicDungeonFrames.ShowEndOfMythicPlusPanel() local spikeCircleAnimHub = detailsFramework:CreateAnimationHub(spikes, function() spikes:SetAlpha(0); spikes:SetScale(1) end, function() flashAnimHub:Play(); spikes:SetSize(100, 100); spikes:SetScale(1); spikes:SetAlpha(1) end) local alphaAnim1 = detailsFramework:CreateAnimation(spikeCircleAnimHub, "Alpha", 1, 0.2960000038147, 0, 1) local scaleAnim1 = detailsFramework:CreateAnimation(spikeCircleAnimHub, "Scale", 1, 0.21599999070168, 5, 5, 1, 1, "center", 0, 0) - - readyFrame.YellowSpikeCircle.OnShowAnimation = spikeCircleAnimHub + --readyFrame.YellowSpikeCircle.OnShowAnimation = spikeCircleAnimHub end - 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) + do + 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.leftFiligree:Hide() + + readyFrame.rightFiligree = contentFrame:CreateTexture("$parentRightFiligree", "artwork") + readyFrame.rightFiligree:SetAtlas("BossBanner-RightFillagree") + readyFrame.rightFiligree:SetSize(72, 43) + readyFrame.rightFiligree:SetPoint("bottom", readyFrame, "top", 50, 2) + readyFrame.rightFiligree:Hide() + + --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) + readyFrame.bottomFiligree:Hide() + end local titleLabel = detailsFramework:CreateLabel(contentFrame, "Details! Mythic Run Completed!", 12, "yellow") titleLabel:SetPoint("top", readyFrame, "top", 0, -7) + titleLabel:Hide() titleLabel.textcolor = textColor ---@type df_closebutton local closeButton = detailsFramework:CreateCloseButton(contentFrame, "$parentCloseButton") closeButton:SetPoint("topright", readyFrame, "topright", -2, -2) - closeButton:SetScale(1.4) + closeButton:SetScale(1.0) closeButton:SetAlpha(0.823) closeButton:SetScript("OnClick", function(self) readyFrame:Hide() end) + readyFrame.CloseButton = closeButton + + local configButtonOnClick = function() + Details:OpenOptionsWindow(Details:GetInstance(1), false, 18) + end + readyFrame.ConfigButton = detailsFramework:CreateButton(contentFrame, configButtonOnClick, 32, 32, "") + readyFrame.ConfigButton:SetAlpha(0.823) + readyFrame.ConfigButton:SetSize(closeButton:GetSize()) - --warning footer - local warningFooter = detailsFramework:CreateLabel(contentFrame, "Under development", 9, "orange") - warningFooter:SetPoint("bottomright", readyFrame, "bottomright", -5, 5) - warningFooter:SetAlpha(0.5) + local normalTexture = readyFrame.ConfigButton:CreateTexture(nil, "overlay") + normalTexture:SetTexture([[Interface\AddOns\Details\images\end_of_mplus.png]], nil, nil, "TRILINEAR") + normalTexture:SetTexCoord(79/512, 113/512, 0/512, 36/512) + normalTexture:SetDesaturated(true) + + local pushedTexture = readyFrame.ConfigButton:CreateTexture(nil, "overlay") + pushedTexture:SetTexture([[Interface\AddOns\Details\images\end_of_mplus.png]], nil, nil, "TRILINEAR") + pushedTexture:SetTexCoord(114/512, 148/512, 0/512, 36/512) + pushedTexture:SetDesaturated(true) + + local highlightTexture = readyFrame.ConfigButton:CreateTexture(nil, "highlight") + highlightTexture:SetTexture([[Interface\BUTTONS\redbutton2x]], nil, nil, "TRILINEAR") + highlightTexture:SetTexCoord(116/256, 150/256, 0, 39/128) + highlightTexture:SetDesaturated(true) + + readyFrame.ConfigButton:SetTexture(normalTexture, highlightTexture, pushedTexture, normalTexture) --waiting for loot label local waitingForLootLabel = detailsFramework:CreateLabel(contentFrame, "Waiting for loot", 12, "silver") waitingForLootLabel:SetPoint("bottom", readyFrame, "bottom", 0, 54) waitingForLootLabel:Hide() - local waitingForLootDotsAnimationLabel = detailsFramework:CreateLabel(contentFrame, "...", 12, "silver") - waitingForLootDotsAnimationLabel:SetPoint("left", waitingForLootLabel, "right", 0, 0) - waitingForLootDotsAnimationLabel:Hide() - - ---@type texture - local topRedLineTexture = backgroundFrame:CreateTexture("$parentBannerTop", "border") - topRedLineTexture:SetAtlas("BossBanner-BgBanner-Top") - topRedLineTexture:SetPoint("top", backgroundFrame, "top", 0, 34) - local topTextureAnimGroup = detailsFramework:CreateAnimationHub(topRedLineTexture, function()end, function() topRedLineTexture:SetSize(388, 112) 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, -25) - local bottomTextureAnimGroup = detailsFramework:CreateAnimationHub(bottomRedLineTexture, function()end, function() bottomRedLineTexture:SetSize(388, 112) end) - bottomRedLineTexture.Animation = bottomTextureAnimGroup - detailsFramework:CreateAnimation(bottomTextureAnimGroup, "Scale", 1, animDuration, 0, 1, 0.5, 1, "center", 0, 0) - readyFrame.BottomRedLineTexture = bottomRedLineTexture - - --local leftRedLineTexture = backgroundFrame:CreateTexture("$parentBannerLeft", "border") - --leftRedLineTexture:SetAtlas("BossBanner-BgBanner-Top") - --leftRedLineTexture:SetPoint("topleft", backgroundFrame, "topleft", 0, 0) - --leftRedLineTexture:SetPoint("bottomleft", backgroundFrame, "bottomleft", 0, 0) - --leftRedLineTexture:SetWidth(388) - --leftRedLineTexture:SetRotation(-1.5708) - - --local centerGradient = backgroundFrame:CreateTexture("$parentCenterGradient", "artwork") - --centerGradient:SetAtlas("BossBanner-BgBanner-Mid") - --centerGradient:SetPoint("center", backgroundFrame, "center", 0, 0) - --centerGradient:SetSize(355, 390) - - - --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 - waitingForLootLabel:Show() - waitingForLootDotsAnimationLabel:Show() - - local dots = waitingForLootDotsAnimationLabel - local dotsCount = 0 - local maxDots = 3 - local maxLoops = 24 - - local dotsTimer = C_Timer.NewTicker(0.5, function() - dotsCount = dotsCount + 1 - - if (dotsCount > maxDots) then - dotsCount = 0 - end - - local dotsText = "" - for i = 1, dotsCount do - dotsText = dotsText .. "." - end - - dots:SetText(dotsText) - end, maxLoops) - waitingForLootDotsAnimationLabel.dotsTimer = dotsTimer - end - - function readyFrame.StopTextDotAnimation() - waitingForLootLabel:Hide() - waitingForLootDotsAnimationLabel:Hide() - if (waitingForLootDotsAnimationLabel.dotsTimer) then - waitingForLootDotsAnimationLabel.dotsTimer:Cancel() - end - end + --auto close time bar + local autoCloseTimeBar = detailsFramework:CreateTimeBar(contentFrame, [[Interface\AddOns\Details\images\bar_serenity]]) + autoCloseTimeBar:SetHook("OnTimerEnd", function() + readyFrame:Hide() + end) + readyFrame.AutoCloseTimeBar = autoCloseTimeBar readyFrame:SetScript("OnHide", function(self) - readyFrame.StopTextDotAnimation() + --hide the dotString on all player banners + for i = 1, #readyFrame.PlayerBanners do + readyFrame.PlayerBanners[i]:StopTextDotAnimation() + end mythicDungeonFrames.ReadyFrameTop:Hide() end) @@ -944,105 +1320,53 @@ function mythicDungeonFrames.ShowEndOfMythicPlusPanel() local showBreakdownFunc = function() mPlus.ShowSummary() end + ---@type df_button readyFrame.ShowBreakdownButton = detailsFramework:CreateButton(contentFrame, showBreakdownFunc, 145, 30, "Show Breakdown") PixelUtil.SetPoint(readyFrame.ShowBreakdownButton, "topleft", readyFrame, "topleft", 31, -30) PixelUtil.SetSize(readyFrame.ShowBreakdownButton, 145, 32) - readyFrame.ShowBreakdownButton:SetBackdrop(nil) + --readyFrame.ShowBreakdownButton:SetBackdrop(nil) readyFrame.ShowBreakdownButton:SetIcon([[Interface\AddOns\Details\images\icons2.png]], 16, 16, "overlay", {84/512, 120/512, 153/512, 187/512}, {.7, .7, .7, 1}, nil, 0, 0) readyFrame.ShowBreakdownButton.textcolor = textColor detailsFramework:AddRoundedCornersToFrame(readyFrame.ShowBreakdownButton.widget, roundedCornerPreset) leftAnchor = readyFrame.ShowBreakdownButton readyFrame.ShowBreakdownButton:Disable() + readyFrame.ShowBreakdownButton:Hide() --show graphic button local showChartFunc = function(self) mythicDungeonCharts.ShowChart() readyFrame:Hide() end + ---@type df_button - readyFrame.ShowChartButton = detailsFramework:CreateButton(contentFrame, showChartFunc, 145, 30, "Show Damage Graphic") - PixelUtil.SetPoint(readyFrame.ShowChartButton, "left", readyFrame.ShowBreakdownButton, "right", 6, 0) - PixelUtil.SetSize(readyFrame.ShowChartButton, 145, 32) - readyFrame.ShowChartButton:SetBackdrop(nil) - readyFrame.ShowChartButton:SetIcon([[Interface\AddOns\Details\images\icons2.png]], 16, 16, "overlay", {42/512, 75/512, 153/512, 187/512}, {.7, .7, .7, 1}, nil, 0, 0) + readyFrame.ShowChartButton = detailsFramework:CreateButton(contentFrame, showChartFunc, 50, 30, "Chart") + --set the template + --readyFrame.ShowChartButton:SetTemplate(detailsFramework:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE")) + --readyFrame.ShowChartButton:SetBackdrop(nil) + readyFrame.ShowChartButton:SetIcon([[Interface\AddOns\Details\images\end_of_mplus.png]], 16, 16, "overlay", {153/512, 185/512, 0, 32/512}, {1, 1, 1, 1}, nil, 0, 0) 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 + --detailsFramework:AddRoundedCornersToFrame(readyFrame.ShowChartButton.widget, roundedCornerPreset) local elapsedTimeLabel = detailsFramework:CreateLabel(contentFrame, "Run Time:", textSize, textColor) - --elapsedTimeLabel:SetPoint("topleft", leftAnchor, "bottomleft", 0, -8) elapsedTimeLabel:SetPoint("topleft", readyFrame, "topleft", 5, -70) local elapsedTimeAmount = detailsFramework:CreateLabel(contentFrame, "00:00", textSize, textColor) elapsedTimeAmount:SetPoint("left", elapsedTimeLabel, "left", 130, 0) + elapsedTimeLabel:Hide() + elapsedTimeAmount:Hide() local timeNotInCombatLabel = detailsFramework:CreateLabel(contentFrame, "Time not in combat:", textSize, "orangered") timeNotInCombatLabel:SetPoint("topleft", elapsedTimeLabel, "bottomleft", 0, -5) local timeNotInCombatAmount = detailsFramework:CreateLabel(contentFrame, "00:00", textSize, "orangered") timeNotInCombatAmount:SetPoint("left", timeNotInCombatLabel, "left", 130, 0) - - 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(contentFrame, "", textSize, textColor) - --rantingLabel:SetPoint("topleft", keystoneUpgradeLabel, "bottomleft", 0, -5) - rantingLabel:SetPoint("topleft", youBeatTheTimerLabel, "bottomleft", 0, -5) + timeNotInCombatLabel:Hide() + timeNotInCombatAmount:Hide() readyFrame.PlayerBanners = {} for i = 1, 5 do - local playerBanner = createPlayerBanner(readyFrame, "$parentPlayerBanner" .. i) + local playerBanner = createPlayerBanner(readyFrame, "$parentPlayerBanner" .. i, i) readyFrame.PlayerBanners[#readyFrame.PlayerBanners+1] = playerBanner - if (i == 1) then - playerBanner:SetPoint("topleft", rantingLabel.widget, "bottomleft", 0, -22) - else - playerBanner:SetPoint("topleft", readyFrame.PlayerBanners[i-1], "topright", 10, 0) - end end - - --here was the loot frame events ~loot - - --[=[ - Details222.MythicPlus.MapID = mapID - Details222.MythicPlus.Level = level --level of the key just finished - Details222.MythicPlus.OnTime = onTime - Details222.MythicPlus.KeystoneUpgradeLevels = keystoneUpgradeLevels - Details222.MythicPlus.PracticeRun = practiceRun - Details222.MythicPlus.OldDungeonScore = oldDungeonScore - Details222.MythicPlus.NewDungeonScore = newDungeonScore - Details222.MythicPlus.IsAffixRecord = isAffixRecord - Details222.MythicPlus.IsMapRecord = isMapRecord - Details222.MythicPlus.PrimaryAffix = primaryAffix - Details222.MythicPlus.IsEligibleForScore = isEligibleForScore - Details222.MythicPlus.UpgradeMembers = upgradeMembers - Details222.MythicPlus.DungeonName = dungeonName - Details222.MythicPlus.DungeonID = id - Details222.MythicPlus.TimeLimit = timeLimit - Details222.MythicPlus.Texture = texture - Details222.MythicPlus.BackgroundTexture = backgroundTexture - --]=] - - 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") - notAgainLabel.textcolor = "orange" - notAgainSwitch:ClearAllPoints() - notAgainLabel:SetPoint("left", notAgainSwitch, "right", 2, 0) - notAgainSwitch:SetPoint("bottomleft", readyFrame, "bottomleft", 5, 5) - notAgainSwitch:SetAsCheckBox() - notAgainSwitch:SetSize(12, 12) - notAgainSwitch:SetAlpha(0.5) - notAgainLabel.textsize = 9 - - readyFrame.TimeNotInCombatAmountLabel = timeNotInCombatAmount - readyFrame.ElapsedTimeAmountLabel = elapsedTimeAmount - readyFrame.YouBeatTheTimerLabel = youBeatTheTimerLabel - readyFrame.KeystoneUpgradeLabel = keystoneUpgradeLabel - readyFrame.RantingLabel = rantingLabel end --end of creating of the readyFrame --< end of mythic+ end of run frame creation >-- @@ -1052,13 +1376,12 @@ function mythicDungeonFrames.ShowEndOfMythicPlusPanel() readyFrame:Show() readyFrame.TopFrame:Show() - readyFrame.YellowSpikeCircle.OnShowAnimation:Play() + --readyFrame.YellowSpikeCircle.OnShowAnimation:Play() - readyFrame.TopRedLineTexture:Hide() - readyFrame.BottomRedLineTexture:Hide() readyFrame.ContentFrame:SetAlpha(0) - readyFrame.Level:SetText(Details222.MythicPlus.Level or "") + --readyFrame.Level:SetText(Details222.MythicPlus.Level or "") + readyFrame.KeylevelText:SetText(Details222.MythicPlus.Level or "") --hide the lootSquare for i = 1, #readyFrame.PlayerBanners do @@ -1074,20 +1397,14 @@ function mythicDungeonFrames.ShowEndOfMythicPlusPanel() end) 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() - - --/run PlaySound(SOUNDKIT.UI_70_CHALLENGE_MODE_KEYSTONE_UPGRADE); - --PlaySound(SOUNDKIT.UI_70_CHALLENGE_MODE_COMPLETE_NO_UPGRADE); + --readyFrame.HeaderFadeInAnimation + readyFrame.HeaderTexture:SetAlpha(0) + readyFrame.HeaderFadeInAnimation:Play() --fin the overall mythic dungeon combat, starting with the current combat ---@type combat @@ -1108,14 +1425,14 @@ function mythicDungeonFrames.ShowEndOfMythicPlusPanel() --update the run time and time not in combat local elapsedTime = Details222.MythicPlus.time or 1507 - readyFrame.ElapsedTimeAmountLabel.text = detailsFramework:IntegerToTimer(elapsedTime) + readyFrame.ElapsedTimeText:SetText(detailsFramework:IntegerToTimer(elapsedTime)) if (overallMythicDungeonCombat:GetCombatType() == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_OVERALL) then local combatTime = overallMythicDungeonCombat:GetCombatTime() local notInCombat = elapsedTime - combatTime - readyFrame.TimeNotInCombatAmountLabel.text = detailsFramework:IntegerToTimer(notInCombat) .. " (" .. math.floor(notInCombat / elapsedTime * 100) .. "%)" + readyFrame.OutOfCombatText:SetText(detailsFramework:IntegerToTimer(notInCombat)) else - readyFrame.TimeNotInCombatAmountLabel.text = "Unknown for this run" + readyFrame.OutOfCombatText:SetText("00:00") end local mythicDungeonInfo = overallMythicDungeonCombat:GetMythicDungeonInfo() @@ -1124,29 +1441,18 @@ function mythicDungeonFrames.ShowEndOfMythicPlusPanel() return end - ---@type details_instanceinfo - local instanceInfo = Details:GetInstanceInfo(mythicDungeonInfo.MapID) or Details:GetInstanceInfo(Details:GetCurrentCombat().mapId) - - if (instanceInfo) then - readyFrame.DungeonBackdropTexture:SetTexture(instanceInfo.iconLore) - else - readyFrame.DungeonBackdropTexture:SetTexture(overallMythicDungeonCombat.is_mythic_dungeon.DungeonTexture) - end + setOrientation(readyFrame, mythicDungeonInfo, overallMythicDungeonCombat) wipe(readyFrame.unitCacheByName) if (Details222.MythicPlus.OnTime) then - readyFrame.YouBeatTheTimerLabel:SetFormattedText(CHALLENGE_MODE_COMPLETE_BEAT_TIMER .. " | " .. CHALLENGE_MODE_COMPLETE_KEYSTONE_UPGRADED, Details222.MythicPlus.KeystoneUpgradeLevels) --"You beat the timer!" - readyFrame.YouBeatTheTimerLabel.textcolor = "limegreen" - --readyFrame.KeystoneUpgradeLabel:SetFormattedText(CHALLENGE_MODE_COMPLETE_KEYSTONE_UPGRADED, Details222.MythicPlus.KeystoneUpgradeLevels) + --beat the timer PlaySound(SOUNDKIT.UI_70_CHALLENGE_MODE_KEYSTONE_UPGRADE) C_Timer.After(0.020, function() --PlaySoundFile([[Interface\AddOns\Details\sounds\bassdrop2.mp3]]) end) else - readyFrame.YouBeatTheTimerLabel.textcolor = "white" - readyFrame.YouBeatTheTimerLabel.text = CHALLENGE_MODE_COMPLETE_TIME_EXPIRED --"Time expired!" - --readyFrame.KeystoneUpgradeLabel.text = CHALLENGE_MODE_COMPLETE_TRY_AGAIN --"Try again! Beat the timer to upgrade your keystone!" + --did not beat the timer PlaySound(SOUNDKIT.UI_70_CHALLENGE_MODE_COMPLETE_NO_UPGRADE) end @@ -1154,19 +1460,19 @@ function mythicDungeonFrames.ShowEndOfMythicPlusPanel() local gainedScore = Details222.MythicPlus.NewDungeonScore - Details222.MythicPlus.OldDungeonScore local color = C_ChallengeMode.GetDungeonScoreRarityColor(Details222.MythicPlus.NewDungeonScore) if (not color) then - color = HIGHLIGHT_FONT_COLOR + color = _G["HIGHLIGHT_FONT_COLOR"] end - readyFrame.RantingLabel.text = CHALLENGE_COMPLETE_DUNGEON_SCORE:format(color:WrapTextInColorCode(CHALLENGE_COMPLETE_DUNGEON_SCORE_FORMAT_TEXT:format(Details222.MythicPlus.NewDungeonScore, gainedScore))) + readyFrame.RantingLabel.text = _G["CHALLENGE_COMPLETE_DUNGEON_SCORE"]:format(color:WrapTextInColorCode(_G["CHALLENGE_COMPLETE_DUNGEON_SCORE_FORMAT_TEXT"]:format(Details222.MythicPlus.NewDungeonScore, gainedScore))) readyFrame.RantingLabel.textcolor = "limegreen" else - readyFrame.RantingLabel.text = "" + readyFrame.RantingLabel.text = "0000" end 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() + C_Timer.After(0.1, function() if (updatPlayerBanner("player", playerBannerIndex)) then playersFound = playersFound + 1 end @@ -1174,13 +1480,15 @@ function mythicDungeonFrames.ShowEndOfMythicPlusPanel() end local unitCount = 1 + local delay = 0.3 for bannerIndex = 2, #readyFrame.PlayerBanners do - C_Timer.After(RandomFloatInRange(bannerIndex/5-0.075, bannerIndex/5+0.075), function() + C_Timer.After(delay, function() --RandomFloatInRange(bannerIndex/5-0.075, bannerIndex/5+0.075) if (updatPlayerBanner("party"..unitCount, bannerIndex)) then playersFound = playersFound + 1 end unitCount = unitCount + 1 end) + delay = delay + 0.3 end end) @@ -1190,3 +1498,24 @@ end Details222.MythicPlus.IsMythicPlus = function() return C_ChallengeMode and C_ChallengeMode.GetActiveKeystoneInfo() and true or false end + + + --[=[ + Details222.MythicPlus.MapID = mapID + Details222.MythicPlus.Level = level --level of the key just finished + Details222.MythicPlus.OnTime = onTime + Details222.MythicPlus.KeystoneUpgradeLevels = keystoneUpgradeLevels + Details222.MythicPlus.PracticeRun = practiceRun + Details222.MythicPlus.OldDungeonScore = oldDungeonScore + Details222.MythicPlus.NewDungeonScore = newDungeonScore + Details222.MythicPlus.IsAffixRecord = isAffixRecord + Details222.MythicPlus.IsMapRecord = isMapRecord + Details222.MythicPlus.PrimaryAffix = primaryAffix + Details222.MythicPlus.IsEligibleForScore = isEligibleForScore + Details222.MythicPlus.UpgradeMembers = upgradeMembers + Details222.MythicPlus.DungeonName = dungeonName + Details222.MythicPlus.DungeonID = id + Details222.MythicPlus.TimeLimit = timeLimit + Details222.MythicPlus.Texture = texture + Details222.MythicPlus.BackgroundTexture = backgroundTexture + --]=] \ No newline at end of file diff --git a/functions/profiles.lua b/functions/profiles.lua index 141af58a7..eae06b0b6 100644 --- a/functions/profiles.lua +++ b/functions/profiles.lua @@ -1643,7 +1643,11 @@ local default_global_data = { last_mythicrun_chart = {}, mythicrun_chart_frame = {}, mythicrun_chart_frame_minimized = {}, - finished_run_frame = {}, --end of mythic+ panel + finished_run_frame = {}, + finished_run_frame_options = { + orientation = "horizontal", + grow_direction = "left", + }, mythicrun_time_type = 1, --1: combat time (the amount of time the player is in combat) 2: run time (the amount of time it took to finish the mythic+ run) }, --implementar esse time_type quando estiver dando refresh na janela diff --git a/images/end_of_mplus.png b/images/end_of_mplus.png new file mode 100644 index 000000000..a71554d04 Binary files /dev/null and b/images/end_of_mplus.png differ diff --git a/images/end_of_mplus_banner_mask.png b/images/end_of_mplus_banner_mask.png new file mode 100644 index 000000000..a7f49504e Binary files /dev/null and b/images/end_of_mplus_banner_mask.png differ