diff --git a/Libs/DF/definitions.lua b/Libs/DF/definitions.lua index 6d11a6d69..de0960166 100644 --- a/Libs/DF/definitions.lua +++ b/Libs/DF/definitions.lua @@ -140,6 +140,7 @@ ---@field RoundedCornerPanelMixin df_roundedcornermixin ---@field Schedules df_schedule ---@field HeaderFunctions df_headerfunctions +---@field RoleTypes roleinfo[] ---@field Language df_language ---@field Ejc df_ejc ---@field KeybindMixin df_keybindmixin @@ -160,6 +161,7 @@ ---@field alias_text_colors table ---@field ClassFileNameToIndex table engClass -> classIndex ---@field ClientLanguage string +---@field ClassIndexToFileName table classIndex -> engClass ---@field dropdown_templates table ---@field switch_templates table ---@field button_templates table @@ -367,7 +369,7 @@ ---@field AddRoleIconToText fun(self:table, text:string, role:string, size:number?) : string add a role icon to a text using escape codes ---@field GetRoleTCoordsAndTexture fun(self:table, roleID:number) : number, number, number, number, string ---@field AddColorToText fun(self:table, text:string, color:any) : string wrap text with a color ----@field AddClassColorToText fun(self:table, text:string, className:class) : string wrap text with a class color +---@field AddClassColorToText fun(self:table, text:string, className:class|number) : string wrap text with a class color ---@field MakeDraggable fun(self:table, frame:frame) : nil ---@field GetClassTCoordsAndTexture fun(self:table, class:string) : number, number, number, number, string return the class icon texture coordinates and texture file path ---@field GetClassColorByClassId fun(self:table, classId:number) : number, number, number return the class color by classId diff --git a/Libs/DF/dropdown.lua b/Libs/DF/dropdown.lua index a91b483a9..2cb158232 100644 --- a/Libs/DF/dropdown.lua +++ b/Libs/DF/dropdown.lua @@ -702,6 +702,23 @@ function DetailsFrameworkDropDownOptionOnLeave(frame) frame:GetParent().mouseover:Hide() end +---@class dropdownoption : table +---@field value any +---@field label string text shown in the dropdown option +---@field onclick fun(dropdownObject:table, fixedValue:any, value:any)? function to call when the option is selected +---@field icon string|number? texture +---@field color any any color format +---@field font string? +---@field texcoord number[]? left, right, top, bottom +---@field iconcolor any any color format +---@field iconsize number[]? width, height +---@field languageId string? +---@field rightbutton function? function to call on right click +---@field statusbar string|number? statusbar texture +---@field statusbarcolor any any color format +---@field rightTexture string|number? texture +---@field centerTexture string|number? texture + --@button is the raw button frame, object is the button capsule --click on the main dropdown frame (not the menu options popup) function DetailsFrameworkDropDownOnMouseDown(button, buttontype) @@ -736,6 +753,8 @@ function DetailsFrameworkDropDownOnMouseDown(button, buttontype) for tindex, thisOption in ipairs(optionsTable) do local bIsOptionVisible = isOptionVisible(button, thisOption) + ---@cast thisOption dropdownoption + if (bIsOptionVisible) then local thisOptionFrame = object.menus[i] showing = showing + 1 diff --git a/Libs/DF/fw.lua b/Libs/DF/fw.lua index 081115d49..812954a79 100644 --- a/Libs/DF/fw.lua +++ b/Libs/DF/fw.lua @@ -1,6 +1,6 @@ -local dversion = 577 +local dversion = 578 local major, minor = "DetailsFramework-1.0", dversion local DF, oldminor = LibStub:NewLibrary(major, minor) @@ -1384,6 +1384,10 @@ end ---@param className class ---@return string function DF:AddClassColorToText(text, className) + if (type(className) == "number") then + className = DF.ClassIndexToFileName[className] + end + if (type(className) ~= "string") then return DF:RemoveRealName(text) @@ -4993,11 +4997,21 @@ function DF:GetGroupTypes() return DF.GroupTypes end -DF.RoleTypes = { +---@class roleinfo : table +---@field Name string +---@field ID string +---@field Texture string + +---@type roleinfo[] +local roles = { {Name = _G.DAMAGER, ID = "DAMAGER", Texture = _G.INLINE_DAMAGER_ICON}, {Name = _G.HEALER, ID = "HEALER", Texture = _G.INLINE_HEALER_ICON}, {Name = _G.TANK, ID = "TANK", Texture = _G.INLINE_TANK_ICON}, + {Name = _G.NONE, ID = "NONE", Texture = _G.INLINE_DAMAGER_ICON}, } + +DF.RoleTypes = roles + function DF:GetRoleTypes() return DF.RoleTypes end diff --git a/Libs/DF/mixins.lua b/Libs/DF/mixins.lua index 8189d72db..f66dc7efe 100644 --- a/Libs/DF/mixins.lua +++ b/Libs/DF/mixins.lua @@ -188,6 +188,11 @@ local doublePoint = { ["left-right"] = true, } +---@alias anchor_name "lefts" | "rights" | "tops" | "bottoms" | "left-left" | "right-right" | "top-top" | "bottom-bottom" | "bottom-top" | "top-bottom" | "right-left" | "left-right" | "topleft" | "topright" | "bottomleft" | "bottomright" | "left" | "right" | "top" | "bottom" | "center" + +---@class df_setpoint : table +---@field SetPoint fun(self: table, anchorName1: anchor_name, anchorObject: table?, anchorName2: string?, xOffset: number?, yOffset: number?) + detailsFramework.SetPointMixin = { SetPoint = function(object, anchorName1, anchorObject, anchorName2, xOffset, yOffset) if (doublePoint[anchorName1]) then diff --git a/Libs/DF/picture.lua b/Libs/DF/picture.lua index 41995b74c..418af7cd7 100644 --- a/Libs/DF/picture.lua +++ b/Libs/DF/picture.lua @@ -243,7 +243,7 @@ detailsFramework:Mixin(ImageMetaFunctions, detailsFramework.ScriptHookMixin) ------------------------------------------------------------------------------------------------------------ --object constructor - ---@class df_image : texture, df_widgets + ---@class df_image : texture, df_widgets, df_setpoint ---@field SetGradient fun(gradientType: "vertical"|"horizontal", fromColor: table, toColor: table) ---@field image texture diff --git a/Libs/DF/timeline.lua b/Libs/DF/timeline.lua index 1361aef35..bcdd58942 100644 --- a/Libs/DF/timeline.lua +++ b/Libs/DF/timeline.lua @@ -301,6 +301,8 @@ detailsFramework.TimeLine_LineMixin = { block.info.customIcon = customIcon --nil set to nil if not exists block.info.customName = customName + block.text:SetText(customName or "") + if (useIconOnBlock) then local iconTexture = lineData.icon if (customIcon) then @@ -434,7 +436,7 @@ detailsFramework.TimeLine_LineMixin = { local background = block:CreateTexture(nil, "background") background:SetColorTexture(1, 1, 1, 1) local icon = block:CreateTexture(nil, "artwork") - local text = block:CreateFontString(nil, "artwork") + local text = block:CreateFontString(nil, "artwork", "GameFontNormal") detailsFramework.TimeLine_LineMixin.CreateAuraLength(block) @@ -449,7 +451,8 @@ detailsFramework.TimeLine_LineMixin = { background:SetAllPoints() icon:SetPoint("left") - text:SetPoint("left", icon, "left", 2, 0) + text:SetPoint("left", icon, "right", 2, 0) + detailsFramework:SetFontOutline(text, "OUTLINE") block.icon = icon block.text = text @@ -635,11 +638,22 @@ detailsFramework.TimeLineMixin = { lineHeader = CreateFrame("frame", nil, self.headerBody, "BackdropTemplate") lineHeader:SetSize(detachedHeaderFrame:GetWidth(), self.options.line_height) lineHeader:SetPoint("topleft", self.headerBody, "topleft", 0, xPosition) + detailsFramework:CreateHighlightTexture(lineHeader, "HighlightTexture") + lineHeader.HighlightTexture:SetDrawLayer("overlay", 1) + lineHeader.HighlightTexture:Hide() + lineHeader:EnableMouse(true) + lineHeader:SetScript("OnEnter", function() self.options.on_enter(line) lineHeader.HighlightTexture:Show() end) + lineHeader:SetScript("OnLeave", function() self.options.on_leave(line) lineHeader.HighlightTexture:Hide() end) + line:SetScript("OnEnter", function() self.options.on_enter(line) lineHeader.HighlightTexture:Show() end) + line:SetScript("OnLeave", function() self.options.on_leave(line) lineHeader.HighlightTexture:Hide() end) + lineHeader.Line = line else lineHeader = CreateFrame("frame", nil, line, "BackdropTemplate") lineHeader:SetPoint("topleft", line, "topleft", 0, 0) lineHeader:SetPoint("bottomleft", line, "bottomleft", 0, 0) + line:SetScript("OnEnter", self.options.on_enter) + line:SetScript("OnLeave", self.options.on_leave) end --lineHeader:SetScript("OnEnter", self.options.header_on_enter) --lineHeader:SetScript("OnLeave", self.options.header_on_leave) @@ -649,8 +663,6 @@ detailsFramework.TimeLineMixin = { --store the individual textures that shows the timeline information line.blocks = {} - line:SetScript("OnEnter", self.options.on_enter) - line:SetScript("OnLeave", self.options.on_leave) line:SetMouseClickEnabled(false) line:SetBackdrop(self.options.backdrop) @@ -804,6 +816,7 @@ detailsFramework.TimeLineMixin = { local linePadding = self.options.line_padding local bodyHeight = (lineHeight + linePadding) * #self.data.lines + bodyHeight = bodyHeight + 40 self.body:SetHeight(bodyHeight) self.verticalSlider:SetMinMaxValues(0, max(bodyHeight - self:GetHeight(), 0)) self.verticalSlider:SetValue(0) diff --git a/functions/mythicdungeon/mythicdungeon.lua b/functions/mythicdungeon/mythicdungeon.lua index 252b551b9..934d75c94 100644 --- a/functions/mythicdungeon/mythicdungeon.lua +++ b/functions/mythicdungeon/mythicdungeon.lua @@ -398,7 +398,7 @@ end) ---@param combatObject combat function DetailsMythicPlusFrame.SaveMythicPlusStats(combatObject) - local mapChallengeModeID, mythicLevel, time, onTime, keystoneUpgradeLevels, practiceRun, oldOverallDungeonScore, newOverallDungeonScore, IsMapRecord, IsAffixRecord, PrimaryAffix, isEligibleForScore, members = C_ChallengeMode.GetCompletionInfo() + local mapChallengeModeID, mythicLevel, time, onTime, keystoneUpgradeLevels, practiceRun, oldOverallDungeonScore, newOverallDungeonScore, IsMapRecord, IsAffixRecord, PrimaryAffix, isEligibleForScore, members = C_ChallengeMode.GetChallengeCompletionInfo() if (mapChallengeModeID) then local statName = "mythicdungeoncompletedDF2" diff --git a/functions/mythicdungeon/segments.lua b/functions/mythicdungeon/segments.lua index 9f132fb2d..3f688755f 100644 --- a/functions/mythicdungeon/segments.lua +++ b/functions/mythicdungeon/segments.lua @@ -327,7 +327,7 @@ function DetailsMythicPlusFrame.MergeSegmentsOnEnd() --~merge if (type(Details222.MythicPlus.time) == "number") then newCombat.run_time = Details222.MythicPlus.time newCombat.elapsed_time = Details222.MythicPlus.ElapsedTime - Details222.MythicPlus.LogStep("GetCompletionInfo() Found, Time: " .. Details222.MythicPlus.time) + Details222.MythicPlus.LogStep("GetChallengeCompletionInfo() Found, Time: " .. Details222.MythicPlus.time) elseif (newCombat.is_mythic_dungeon.WorldStateTimerEnd and newCombat.is_mythic_dungeon.WorldStateTimerStart) then local runTime = newCombat.is_mythic_dungeon.WorldStateTimerEnd - newCombat.is_mythic_dungeon.WorldStateTimerStart @@ -335,7 +335,7 @@ function DetailsMythicPlusFrame.MergeSegmentsOnEnd() --~merge Details222.MythicPlus.LogStep("World State Timers is Available, Run Time: " .. runTime .. "| start:" .. newCombat.is_mythic_dungeon.WorldStateTimerStart .. "| end:" .. newCombat.is_mythic_dungeon.WorldStateTimerEnd) else newCombat.run_time = timeInCombat - Details222.MythicPlus.LogStep("GetCompletionInfo() and World State Timers not Found, Activity Time: " .. timeInCombat) + Details222.MythicPlus.LogStep("GetChallengeCompletionInfo() and World State Timers not Found, Activity Time: " .. timeInCombat) end newCombat:SetStartTime(GetTime() - timeInCombat) diff --git a/functions/pack.lua b/functions/pack.lua index 5afbaa5bc..8200697b1 100644 --- a/functions/pack.lua +++ b/functions/pack.lua @@ -11,7 +11,6 @@ local tonumber = _G.tonumber local select = _G.select local strsplit = _G.strsplit local floor = _G.floor -local tremove = _G["table.remove"] local UnitName = _G.UnitName local tinsert = tinsert local IsInRaid = _G.IsInRaid diff --git a/functions/storage.lua b/functions/storage.lua index 5dc355629..5b3ab9486 100644 --- a/functions/storage.lua +++ b/functions/storage.lua @@ -1030,7 +1030,7 @@ function Details.Database.StoreEncounter(combat) if (diffName == "mythicdungeon") then local mythicLevel = C_ChallengeMode.GetActiveKeystoneInfo() - local mapChallengeModeID = C_ChallengeMode.GetCompletionInfo() + local mapChallengeModeID = C_ChallengeMode.GetChallengeCompletionInfo() if (not mythicLevel and not mapChallengeModeID) then return end diff --git a/luaserver.lua b/luaserver.lua index baaff6f41..d0d612245 100644 --- a/luaserver.lua +++ b/luaserver.lua @@ -382,6 +382,7 @@ CLASS_ICON_TCOORDS = {} ---@alias petname string refers to a pet's name ---@alias ownername string refers to the pet's owner name ---@alias spellname string name of a spell +---@alias classid number the ID of a class ---@alias spellschool number each spell in the game has a school, such as fire, frost, shadow and many others. This value can be used to identify the school of a spell. ---@alias actorid string unique id of a unit (GUID) ---@alias serial string unique id of a unit (GUID) @@ -802,6 +803,7 @@ BackdropTemplateMixin = {} ---@field SetFont fun(self: editbox, font: string, size: number, flags: string) ---@field SetFontObject fun(self: editbox, fontString: fontstring) ---@field GetFont fun(self: editbox) : string, number, string +---@field ClearFocus fun(self:editbox) clear the editing focus ---@field SetTextColor fun(self: editbox, r: red|number, g: green|number, b: blue|number, a: alpha|number?) ---@field SetJustifyH fun(self:editbox, alignment:string) ---@field SetTextInsets fun(self:editbox, left:number, right:number, top:number, bottom:number) @@ -1439,7 +1441,7 @@ function C_ChallengeMode.GetActiveKeystoneInfo() return 0, {}, true end ---@return number primaryAffix The primary affix id. ---@return boolean isEligibleForScore Whether the completion is eligible for a score. ---@return ChallengeModeCompletionMemberInfo[] members The members of the group. -function C_ChallengeMode.GetCompletionInfo() return 0, 0, 0, true, 0, true, 0, 0, true, true, 0, true, {} end +function C_ChallengeMode.GetChallengeCompletionInfo() return 0, 0, 0, true, 0, true, 0, 0, true, true, 0, true, {} end ---return the death count for the current challenge mode. ---@return number numDeaths The number of deaths.