From ade84126f469ec523a363d39484cfb4348c96501 Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Thu, 19 Dec 2024 14:55:41 -0300 Subject: [PATCH] Framework, OpenRaid, ToC and bug fixes. --- Details.toc | 3 +- Details_Cata.toc | 1 + Details_Classic.toc | 1 + Details_Wrath.toc | 1 + Libs/DF/LibDFramework-1.0.toc | 2 +- Libs/DF/cooltip.lua | 30 ++- Libs/DF/definitions.lua | 4 +- Libs/DF/elapsedtime.lua | 3 +- Libs/DF/fw.lua | 17 +- Libs/DF/schedules.lua | 3 +- Libs/DF/textentry.lua | 4 + Libs/DF/timeline.lua | 149 ++++++++++-- Libs/LibOpenRaid/GetPlayerInformation.lua | 20 +- Libs/LibOpenRaid/LibOpenRaid.lua | 2 +- boot.lua | 4 +- frames/window_transcriptor.lua | 214 ++++++++++++++++++ functions/profiles.lua | 5 + luaserver.lua | 14 +- plugins/Details_Compare2/Details_Compare2.toc | 2 +- .../Details_DataStorage.toc | 2 +- .../Details_EncounterDetails.toc | 2 +- .../Details_RaidCheck/Details_RaidCheck.lua | 2 +- .../Details_RaidCheck/Details_RaidCheck.toc | 2 +- plugins/Details_Streamer/Details_Streamer.toc | 2 +- .../Details_TinyThreat/Details_TinyThreat.toc | 2 +- plugins/Details_Vanguard/Details_Vanguard.toc | 2 +- 26 files changed, 441 insertions(+), 52 deletions(-) create mode 100644 frames/window_transcriptor.lua diff --git a/Details.toc b/Details.toc index 106b216ac..41fc9bd4e 100644 --- a/Details.toc +++ b/Details.toc @@ -1,4 +1,4 @@ -## Interface: 110005 +## Interface: 110007 ## Interface-Cata: 40401 ## Title: Details! Damage Meter ## Notes: Essential tool to impress that chick in your raid. @@ -133,6 +133,7 @@ frames\window_debug.lua frames\window_pro_file.lua frames\window_nestspells.lua frames\window_deathrecap.lua +frames\window_transcriptor.lua classes\class_error.lua classes\class_spelltable.lua diff --git a/Details_Cata.toc b/Details_Cata.toc index 9f8adc6db..31ad5fef7 100644 --- a/Details_Cata.toc +++ b/Details_Cata.toc @@ -132,6 +132,7 @@ frames\window_debug.lua frames\window_pro_file.lua frames\window_nestspells.lua frames\window_deathrecap.lua +frames\window_transcriptor.lua classes\class_error.lua classes\class_spelltable.lua diff --git a/Details_Classic.toc b/Details_Classic.toc index c1286d792..b30794359 100644 --- a/Details_Classic.toc +++ b/Details_Classic.toc @@ -126,6 +126,7 @@ frames\window_debug.lua frames\window_pro_file.lua frames\window_nestspells.lua frames\window_deathrecap.lua +frames\window_transcriptor.lua classes\class_error.lua classes\class_spelltable.lua diff --git a/Details_Wrath.toc b/Details_Wrath.toc index 3323609f8..484ba865b 100644 --- a/Details_Wrath.toc +++ b/Details_Wrath.toc @@ -126,6 +126,7 @@ frames\window_debug.lua frames\window_pro_file.lua frames\window_nestspells.lua frames\window_deathrecap.lua +frames\window_transcriptor.lua classes\class_error.lua classes\class_spelltable.lua diff --git a/Libs/DF/LibDFramework-1.0.toc b/Libs/DF/LibDFramework-1.0.toc index c83d3f038..d59b3611f 100644 --- a/Libs/DF/LibDFramework-1.0.toc +++ b/Libs/DF/LibDFramework-1.0.toc @@ -1,4 +1,4 @@ -## Interface: 110005 +## Interface: 110007 ## Title: Lib: LibDFramework-1.0 ## Notes: Base Framework for many Addons diff --git a/Libs/DF/cooltip.lua b/Libs/DF/cooltip.lua index 046ff69f8..66a662439 100644 --- a/Libs/DF/cooltip.lua +++ b/Libs/DF/cooltip.lua @@ -28,7 +28,7 @@ end --api locals local PixelUtil = PixelUtil or DFPixelUtil -local version = 29 +local version = 30 local CONST_MENU_TYPE_MAINMENU = "main" local CONST_MENU_TYPE_SUBMENU = "sub" @@ -2448,6 +2448,11 @@ function DF:CreateCoolTip() end function gameCooltip:SetMyPoint(host, xOffset, yOffset) + if (host and xOffset == "cursor") then + frame1.attachToCursor = true + return + end + local moveX = xOffset or 0 local moveY = yOffset or 0 local anchor = gameCooltip.OptionsTable.Anchor or gameCooltip.Host @@ -2616,7 +2621,11 @@ function DF:CreateCoolTip() end gameCooltip.Host = frame - gameCooltip.frame1:SetFrameLevel(frame:GetFrameLevel() + 1) + if (not frame.GetFrameLevel) then + gameCooltip.frame1:SetFrameLevel(frame:GetParent():GetFrameLevel() + 1) + else + gameCooltip.frame1:SetFrameLevel(frame:GetFrameLevel() + 1) + end --defaults myPoint = myPoint or gameCooltip.OptionsTable.MyAnchor or "bottom" @@ -2790,6 +2799,8 @@ function DF:CreateCoolTip() gameCooltip:HideSelectedTexture(frame1) gameCooltip:HideSelectedTexture(frame2) + frame1.attachToCursor = false + gameCooltip:HideRoundedCorner() GameCooltip.frame1:SetBorderCornerColor(unpack(gameCooltip.RoundedFramePreset.border_color)) GameCooltip.frame2:SetBorderCornerColor(unpack(gameCooltip.RoundedFramePreset.border_color)) @@ -3701,10 +3712,19 @@ function DF:CreateCoolTip() end if (gameCooltip.Type == 1 or gameCooltip.Type == 2) then - return gameCooltip:BuildTooltip() + gameCooltip:BuildTooltip() elseif (gameCooltip.Type == 3) then - return gameCooltip:BuildCooltip() + gameCooltip:BuildCooltip() + end + + if (frame1.attachToCursor) then + frame1:SetScript("OnUpdate", function() + frame1:ClearAllPoints() + frame1:SetPoint("bottom", UIParent, "bottomleft", DF:GetCursorPosition()) + end) + frame1:ClearAllPoints() + frame1:SetPoint("bottom", UIParent, "bottomleft", DF:GetCursorPosition()) end end @@ -3718,6 +3738,8 @@ function DF:CreateCoolTip() DF:FadeFrame(frame1, 1) DF:FadeFrame(frame2, 1) + frame1:SetScript("OnUpdate", nil) + --release custom icon texture objects, these are TextureObject passed with AddIcon() instead of a texture path or textureId for i = 1, #frame1.Lines do local menuButton = frame1.Lines[i] diff --git a/Libs/DF/definitions.lua b/Libs/DF/definitions.lua index 0980edc8c..4f88767e0 100644 --- a/Libs/DF/definitions.lua +++ b/Libs/DF/definitions.lua @@ -290,6 +290,8 @@ GameCooltipFrame2 = {} ---@field GetClassSpecIds fun(self:table, engClass:string):number[] ---@field GetClassSpecIDs fun(self:table, engClass:string):number[] ---@field GetTextWidth fun(self:table, text:string, fontSize:number?) : number return the width of a text string +---@field GetCursorPosition fun(self:table) : number, number return the mouse position scaled by UIScale, use :SetPoint("bottomleft", UIParent, "bottomleft", DetailsFramework:GetMousePosition()) to anchor a frame to where the mouse is +---@field GetClassIdByFileName fun(self:table, fileName:string) : number return the classId of a class by its file name ---@field IsValidSpecId fun(self:table, specId:number):boolean check if the passed specId is valid for the player class, also return false for tutorial specs ---@field GetDragonlightTalentString fun(self:table):string return the talent config string ---@field GetClassList fun(self:table):{ID:number, Name:string, FileString:string, Texture:string, TexCoord:number[]}[] @@ -384,7 +386,7 @@ GameCooltipFrame2 = {} ---@field AddColorToText fun(self:table, text:string, color:any) : string wrap text with a 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 GetClassTCoordsAndTexture fun(self:table, class:string|number) : 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 ---@field MakeStringFromSpellId fun(self:table, spellId:any) : string return a string with the spell icon and name using escape codes ---@field AddClassIconToText fun(self:table, text:string, playerName:string, englishClassName:string, useSpec:boolean?, iconSize:number?) : string wrap 'text' with the class icon of 'playerName' using |T|t scape codes diff --git a/Libs/DF/elapsedtime.lua b/Libs/DF/elapsedtime.lua index 3fae30261..335f48304 100644 --- a/Libs/DF/elapsedtime.lua +++ b/Libs/DF/elapsedtime.lua @@ -122,7 +122,8 @@ detailsFramework.TimeLineElapsedTimeFunctions = { label:SetText(detailsFramework:IntegerToTimer(floor(secondsOfTime))) if (label.line:IsShown()) then - label.line:SetHeight(self.scrollChild:GetHeight()) + --label.line:SetHeight(self.scrollChild:GetHeight()) + label.line:SetHeight(self:GetParent():GetParent():GetHeight()) end label:Show() diff --git a/Libs/DF/fw.lua b/Libs/DF/fw.lua index f2859f7f4..fd02512f3 100644 --- a/Libs/DF/fw.lua +++ b/Libs/DF/fw.lua @@ -1,6 +1,6 @@ -local dversion = 585 +local dversion = 586 local major, minor = "DetailsFramework-1.0", dversion local DF, oldminor = LibStub:NewLibrary(major, minor) @@ -1431,9 +1431,12 @@ function DF:AddClassColorToText(text, className) end ---returns the class icon texture coordinates and texture file path ----@param class string +---@param class string|number ---@return number, number, number, number, string function DF:GetClassTCoordsAndTexture(class) + if (type(class) == "number") then + class = DF.ClassIndexToFileName[class] + end local l, r, t, b = unpack(CLASS_ICON_TCOORDS[class]) return l, r, t, b, [[Interface\WORLDSTATEFRAME\Icons-Classes]] end @@ -1801,6 +1804,12 @@ function DF:TruncateNumber(number, fractionDigits) return truncatedNumber end +function DF:GetCursorPosition() + local x, y = GetCursorPosition() + local scale = UIParent:GetEffectiveScale() + return x / scale, y / scale +end + ---attempt to get the ID of an npc from a GUID ---@param GUID string ---@return number @@ -4867,6 +4876,10 @@ DF.ClassFileNameToIndex = { } DF.ClassCache = {} +function DF:GetClassIdByFileName(fileName) + return DF.ClassFileNameToIndex[fileName] +end + function DF:GetClassList() if (next (DF.ClassCache)) then return DF.ClassCache diff --git a/Libs/DF/schedules.lua b/Libs/DF/schedules.lua index 67e2a8a34..325233ed6 100644 --- a/Libs/DF/schedules.lua +++ b/Libs/DF/schedules.lua @@ -31,7 +31,8 @@ detailsFramework.Schedules.AfterCombatSchedules = { ---@field CancelAllAfterCombat fun() ---@field IsAfterCombatScheduled fun(id: any): boolean ---@field LazyExecute fun(callback: function, payload: table?, maxIterations: number?, onEndCallback: function?): table ----@field AfterById fun(time: number, callback: function, id: any, ...: any): timer +---@field AfterById fun(time: number, callback: function, id: any, ...: any): timer cancel the existing timer with same id and start it again +---@field AfterByIdNoCancel fun(time: number, callback: function, id: any, ...: any): timer block all sub sequent calls with the same id until the timer is finished ---@class df_looper : table ---@field payload table diff --git a/Libs/DF/textentry.lua b/Libs/DF/textentry.lua index 812eae6b4..2842aa2d1 100644 --- a/Libs/DF/textentry.lua +++ b/Libs/DF/textentry.lua @@ -623,6 +623,7 @@ end ---@field param1 any ---@field param2 any ---@field ShouldOptimizeAutoComplete boolean? +---@field AutoComplete_StopOnEnterPress boolean? ---@field SetTemplate fun(self:df_textentry, template:table|string) ---@field Disable fun(self:df_textentry) ---@field Enable fun(self:df_textentry) @@ -949,6 +950,9 @@ local AutoComplete_OnEnterPressed = function(editboxWidget) end capsule.lastword = "" + if (capsule.AutoComplete_StopOnEnterPress) then + editboxWidget:ClearFocus() + end end local AutoComplete_OnEditFocusGained = function(editboxWidget) diff --git a/Libs/DF/timeline.lua b/Libs/DF/timeline.lua index fb414021d..0037d75ee 100644 --- a/Libs/DF/timeline.lua +++ b/Libs/DF/timeline.lua @@ -8,13 +8,17 @@ end local _ --lua locals local unpack = table.unpack or unpack --lua local -local floor = math.floor --lua local local CreateFrame = CreateFrame local PixelUtil = PixelUtil or DFPixelUtil ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---horizontal scroll frame +---@alias timelinecomponenttype +---| "line" +---| "block" +---| "length" +---| "header" +---| "timeline" +---| "body" ---@class df_timeline_options : table ---@field width number @@ -49,8 +53,14 @@ local PixelUtil = PixelUtil or DFPixelUtil ---@field block_on_click fun(self:button) ---@field block_on_create fun(self:df_timeline_line_block) ---@field block_on_set_data fun(self:button, data:table) +---@field block_on_create_auralength fun(self:df_timeline_line_block) +---@field block_on_create_blocklength fun(self:df_timeline_line_block) ---@field block_on_enter_auralength fun(self:df_timeline_line_block) ---@field block_on_leave_auralength fun(self:df_timeline_line_block) +---@field block_on_click_auralength fun(self:df_timeline_line_block, button:string) +---@field block_on_enter_blocklength fun(self:df_timeline_line_block) +---@field block_on_leave_blocklength fun(self:df_timeline_line_block) +---@field block_on_click_blocklength fun(self:df_timeline_line_block, button:string) local timeline_options = { width = 400, height = 700, @@ -110,9 +120,9 @@ local timeline_options = { ---@class df_timeline_block_data : table ---@field [1] number timeInSeconds ---@field [2] number length ----@field [3] boolean isAura ----@field [4] number auraDuration ----@field [5] number blockSpellId +---@field [3] boolean? isAura +---@field [4] number? auraDuration +---@field [5] number? blockSpellId ---@field payload any ---@field customIcon any ---@field customName any @@ -150,15 +160,18 @@ local timeline_options = { ---@field customName any ---@class df_timeline_line_block : button +---@field type timelinecomponenttype ---@field icon texture ---@field text fontstring ---@field background texture ---@field blockLength df_timeline_line_blocklength ---@field info df_timeline_line_blockinfo +---@field blockData df_timeline_block_data ---@field timeline df_timeline ---@field backgroundBorder border_frame ---@class df_timeline_line_blocklength : button +---@field type timelinecomponenttype ---@field isMoving boolean ---@field Texture texture ---@field RightIcon texture @@ -314,6 +327,8 @@ detailsFramework.TimeLine_LineMixin = { block:Show() block:SetFrameLevel(baseFrameLevel) + block.blockData = blockInfo + if (inRow) then --when tagged as row, the icon will be attached to the latest block added into the line local lastBlock = self:GetBlock(i-1) @@ -326,6 +341,8 @@ detailsFramework.TimeLine_LineMixin = { rowStartBlock = nil end + auraDuration = auraDuration or 0 + block.info.spellId = blockSpellId or spellId block.info.time = timeInSeconds block.info.duration = auraDuration @@ -439,13 +456,13 @@ detailsFramework.TimeLine_LineMixin = { block:SetMouseClickEnabled(false) self.blocks[index] = block + block.type = "block" + local background = block:CreateTexture(nil, "background") background:SetColorTexture(1, 1, 1, 1) local icon = block:CreateTexture(nil, "artwork") local text = block:CreateFontString(nil, "artwork", "GameFontNormal") - detailsFramework.TimeLine_LineMixin.CreateBlockLength(block) - local backgroundBorder = detailsFramework:CreateFullBorder("$parentBorder", block) local iconOffset = UIParent:GetEffectiveScale() * -1 PixelUtil.SetPoint(backgroundBorder, "topleft", block, "topleft", -iconOffset, iconOffset) @@ -465,8 +482,11 @@ detailsFramework.TimeLine_LineMixin = { block.background = background block.backgroundBorder = backgroundBorder + local timeline = self:GetParent():GetParent() + block.timeline = timeline + ---@type df_timeline_options - local timelineOptions = self:GetParent():GetParent().options + local timelineOptions = timeline.options block:SetScript("OnEnter", timelineOptions.block_on_enter) block:SetScript("OnLeave", timelineOptions.block_on_leave) @@ -479,6 +499,8 @@ detailsFramework.TimeLine_LineMixin = { timelineOptions.block_on_create(block) end + detailsFramework.TimeLine_LineMixin.CreateBlockLength(block) + return block end, @@ -488,11 +510,14 @@ detailsFramework.TimeLine_LineMixin = { blockLengthFrame:SetFrameLevel(block:GetFrameLevel() - 1) blockLengthFrame:SetScript("OnEnter", detailsFramework.TimeLine_LineMixin.OnEnterBlockLength) blockLengthFrame:SetScript("OnLeave", detailsFramework.TimeLine_LineMixin.OnLeaveBlockLength) + blockLengthFrame:SetScript("OnClick", detailsFramework.TimeLine_LineMixin.OnClickBlockLength) --save reference of the block blockLengthFrame.block = block --save reference of the timeline blockLengthFrame.timeline = block:GetParent():GetParent():GetParent() + blockLengthFrame.type = "length" + registerForDrag(blockLengthFrame) local auraLengthTexture = blockLengthFrame:CreateTexture(nil, "border") @@ -507,26 +532,45 @@ detailsFramework.TimeLine_LineMixin = { rightIcon:SetPoint("bottomright", blockLengthFrame, "bottomright", 0, 0) blockLengthFrame.RightIcon = rightIcon - detailsFramework:CreateHighlightTexture(blockLengthFrame) + detailsFramework:CreateHighlightTexture(blockLengthFrame, "highlightTexture") block.blockLength = blockLengthFrame + ---@type df_timeline + local timeline = block.timeline + + local callbackFunc = timeline.options.block_on_create_auralength or timeline.options.block_on_create_blocklength + if (callbackFunc) then + callbackFunc(blockLengthFrame) + end + return blockLengthFrame end, OnEnterBlockLength = function(self) ---@type df_timeline local timeline = self.timeline - if (timeline.options.block_on_enter_auralength) then - timeline.options.block_on_enter_auralength(self) + local callbackFunc = timeline.options.block_on_enter_auralength or timeline.options.block_on_enter_blocklength + if (callbackFunc) then + callbackFunc(self) end end, OnLeaveBlockLength = function(self) ---@type df_timeline local timeline = self.timeline - if (timeline.options.block_on_enter_auralength) then - timeline.options.block_on_leave_auralength(self) + local callbackFunc = timeline.options.block_on_leave_auralength or timeline.options.block_on_leave_blocklength + if (callbackFunc) then + callbackFunc(self) + end + end, + + OnClickBlockLength = function(self, button) + ---@type df_timeline + local timeline = self.timeline + local callbackFunc = timeline.options.block_on_click_auralength or timeline.options.block_on_click_blocklength + if (callbackFunc) then + callbackFunc(self, button) end end, @@ -546,16 +590,19 @@ detailsFramework.TimeLine_LineMixin = { ---@field Lines frame[] ---@class df_timeline_header : scrollframe +---@field type timelinecomponenttype ---@field body frame ---@field headerBody df_timeline_header_body ---@field verticalSlider slider ---@class df_timeline_body : frame +---@field type timelinecomponenttype ---@field Buttons button[] ---@field originalHeight number ---@field effectiveWidth number ---@class df_timeline_line : button, df_timeline_line_mixin +---@field type timelinecomponenttype ---@field index number ---@field spellId number ---@field icon df_image @@ -567,6 +614,7 @@ detailsFramework.TimeLine_LineMixin = { ---@field lineData df_timeline_linedata ---@class df_timeline : scrollframe, df_timeline_mixin, df_optionsmixin, df_framelayout, df_lineindicator +---@field type timelinecomponenttype ---@field body df_timeline_body ---@field onClickCallback fun(...) ---@field onClickCallbackFunc fun(...) @@ -594,22 +642,25 @@ detailsFramework.TimeLine_LineMixin = { ---@class df_timeline_mixin : table ---@field GetLine fun(self:df_timeline, index:number):df_timeline_line ----@field ResetAllLines fun(self:df_timeline) ---@field GetAllLines fun(self:df_timeline):df_timeline_line[] ---@field GetBlockUnderMouse fun(self:df_timeline):df_timeline_line_block? ----@field GetBlockOrLengthUnderMouse fun(self:df_timeline):df_timeline_line_block? +---@field GetBlockOrLengthUnderMouse fun(self:df_timeline):df_timeline_line_block|df_timeline_line_blocklength? +---@field GetLineUnderMouse fun(self:df_timeline):df_timeline_line? ---@field GetTimeUnderMouse fun(self:df_timeline):number ---@field GetBodyWidthUnderMouse fun(self:df_timeline):number ----@field RefreshTimeLine fun(self:df_timeline, bDelayButtonRefresh:boolean?, bFromScale:boolean?) +---@field GetBlocksAtTime fun(self:df_timeline, time:number?):df_timeline_line_block[] +---@field GetHorizontalScrolledWidth fun(self:df_timeline):number +---@field GetEffectivePixelPerSecond fun(self:df_timeline):number ---@field SetData fun(self:df_timeline, data:table) ---@field GetData fun(self:df_timeline):table +---@field RefreshTimeLine fun(self:df_timeline, bDelayButtonRefresh:boolean?, bFromScale:boolean?) ---@field RefreshResize fun(self:df_timeline) ---@field RefreshPerPixelButtons fun(self:df_timeline) +---@field ResetAllLines fun(self:df_timeline) ---@field SetCanResize fun(self:df_timeline, canResize:boolean) ---@field OnSizeChanged fun(self:df_timeline) ---@field SetOnClickCallback fun(self:df_timeline, callback:fun(), ...:any) ---@field UpdateOnClickCallback fun(self:df_timeline, button:button?) ----@field GetHorizontalScrolledWidth fun(self:df_timeline):number ---@field HideVerticalScroll fun(self:df_timeline) ---@field SetScale fun(self:df_timeline, scale:number) @@ -706,6 +757,7 @@ detailsFramework.TimeLineMixin = { detailsFramework:Mixin(line, detailsFramework.TimeLine_LineMixin) self.lines[index] = line + line.type = "line" line.index = index local yPosition @@ -732,6 +784,7 @@ detailsFramework.TimeLineMixin = { if (detachedHeaderFrame) then lineHeader = CreateFrame("frame", "$parentHeader", self.headerBody, "BackdropTemplate") + lineHeader.type = "header" lineHeader:SetSize(detachedHeaderFrame:GetWidth(), self.options.line_height) if (index == 1) then lineHeader:SetPoint("topleft", self.headerBody, "topleft", 0, yPosition) @@ -750,6 +803,7 @@ detailsFramework.TimeLineMixin = { lineHeader.Line = line else lineHeader = CreateFrame("frame", "$parentHeader", line, "BackdropTemplate") + lineHeader.type = "header" lineHeader:SetPoint("topleft", line, "topleft", 0, 0) lineHeader:SetPoint("bottomleft", line, "bottomleft", 0, 0) line:SetScript("OnEnter", self.options.on_enter) @@ -872,7 +926,7 @@ detailsFramework.TimeLineMixin = { local blockLength = thisBlock.blockLength if (blockLength and blockLength:IsShown()) then if (blockLength:IsMouseOver()) then - return thisBlock + return blockLength end end end @@ -882,6 +936,19 @@ detailsFramework.TimeLineMixin = { return nil end, + GetLineUnderMouse = function(self) + local allLines = self:GetAllLines() + + for i = 1, #allLines do + local thisLine = allLines[i] + if (thisLine:IsMouseOver()) then + return thisLine + end + end + + return nil + end, + GetBodyWidthUnderMouse = function(self) local x, y = GetCursorPosition() local scale = 1 / UIParent:GetEffectiveScale() @@ -899,11 +966,51 @@ detailsFramework.TimeLineMixin = { return time end, + GetBlocksAtTime = function(self, time) + if (not time) then + time = self:GetTimeUnderMouse() + end + + local blocks = {} + local allLines = self:GetAllLines() + + local pixelsPerSecond = self:GetEffectivePixelPerSecond() + + for i = 1, #allLines do + local thisLine = allLines[i] + local allBlocksInTheLine = thisLine:GetAllBlocks() + for j = 1, #allBlocksInTheLine do + local thisBlock = allBlocksInTheLine[j] + if (thisBlock:IsShown()) then + local blockWidth = thisBlock:GetWidth() + ---@type df_timeline_line_blockinfo + local blockInfo = thisBlock.info + local blockTime = blockInfo.time + + local startTime = blockTime + local endTime = blockTime + (blockWidth / pixelsPerSecond) + + --blockTime = math.floor(blockTime) + --time = math.floor(time) + if (time >= startTime and time <= endTime) then + table.insert(blocks, thisBlock) + end + end + end + end + + return blocks + end, + --todo --make the on enter and leave tooltips --set icons and texts --skin the sliders + GetEffectivePixelPerSecond = function(self) + return self.pixelPerSecond * self.currentScale + end, + RefreshTimeLine = function(self, bDelayButtonRefresh, bFromScale) --~refresh if (not self.data.lines) then return @@ -1093,6 +1200,8 @@ function detailsFramework:CreateTimeLineFrame(parent, name, timelineOptions, ela ---@type df_timeline local frameCanvas = CreateFrame("scrollframe", name, parent, "BackdropTemplate") + frameCanvas.type = "timeline" + detailsFramework:Mixin(frameCanvas, detailsFramework.TimeLineMixin) detailsFramework:Mixin(frameCanvas, detailsFramework.OptionsFunctions) detailsFramework:Mixin(frameCanvas, detailsFramework.LayoutFrame) @@ -1116,6 +1225,8 @@ function detailsFramework:CreateTimeLineFrame(parent, name, timelineOptions, ela frameBody:SetSize(scrollWidth, scrollHeight) frameCanvas:LineIndicatorSetTarget(frameBody) + frameBody.type = "body" + frameBody.Buttons = {} frameCanvas:SetScrollChild(frameBody) diff --git a/Libs/LibOpenRaid/GetPlayerInformation.lua b/Libs/LibOpenRaid/GetPlayerInformation.lua index 1324424b1..d9c909695 100644 --- a/Libs/LibOpenRaid/GetPlayerInformation.lua +++ b/Libs/LibOpenRaid/GetPlayerInformation.lua @@ -17,6 +17,8 @@ local CONST_TALENT_VERSION_DRAGONFLIGHT = 5 local CONST_BTALENT_VERSION_COVENANTS = 9 +local CONST_GLOBALCOOLDOWN_SPELLID = 61304 + local CONST_SPELLBOOK_CLASSSPELLS_TABID = 2 local CONST_SPELLBOOK_GENERAL_TABID = 1 local CONST_ISITEM_BY_TYPEID = { @@ -899,8 +901,13 @@ function openRaidLib.CooldownManager.GetPlayerCooldownStatus(spellId) return 0, 1, 0, 0, 0 --time left, charges, startTime else local timeLeft = start + duration - GetTime() - local startTimeOffset = start - GetTime() - return ceil(timeLeft), 0, ceil(startTimeOffset), duration, buffDuration --time left, charges, startTime, duration, buffDuration + local globalCooldownInfo = GetSpellCooldown(CONST_GLOBALCOOLDOWN_SPELLID) + if (globalCooldownInfo.startTime ~= 0 and globalCooldownInfo.duration >= timeLeft) then + return 0, 1, 0, 0, 0 --time left, charges, startTime + else + local startTimeOffset = start - GetTime() + return ceil(timeLeft), 0, ceil(startTimeOffset), duration, buffDuration --time left, charges, startTime, duration, buffDuration + end end else local start, duration = GetSpellCooldown(spellId) @@ -908,8 +915,13 @@ function openRaidLib.CooldownManager.GetPlayerCooldownStatus(spellId) return 0, 1, 0, 0, 0 --time left, charges, startTime else local timeLeft = start + duration - GetTime() - local startTimeOffset = start - GetTime() - return ceil(timeLeft), 0, ceil(startTimeOffset), duration, buffDuration --time left, charges, startTime, duration, buffDuration + local gcStart, gcDuration = GetSpellCooldown(CONST_GLOBALCOOLDOWN_SPELLID) + if (gcStart ~= 0 and gcDuration >= timeLeft) then + return 0, 1, 0, 0, 0 --time left, charges, startTime + else + local startTimeOffset = start - GetTime() + return ceil(timeLeft), 0, ceil(startTimeOffset), duration, buffDuration --time left, charges, startTime, duration, buffDuration + end end end diff --git a/Libs/LibOpenRaid/LibOpenRaid.lua b/Libs/LibOpenRaid/LibOpenRaid.lua index 738a198bb..ad8d28894 100644 --- a/Libs/LibOpenRaid/LibOpenRaid.lua +++ b/Libs/LibOpenRaid/LibOpenRaid.lua @@ -56,7 +56,7 @@ end local major = "LibOpenRaid-1.0" -local CONST_LIB_VERSION = 147 +local CONST_LIB_VERSION = 148 if (LIB_OPEN_RAID_MAX_VERSION) then if (CONST_LIB_VERSION <= LIB_OPEN_RAID_MAX_VERSION) then diff --git a/boot.lua b/boot.lua index 0cdad292d..5ee3e0e2a 100644 --- a/boot.lua +++ b/boot.lua @@ -17,8 +17,8 @@ end local addonName, Details222 = ... local version, build, date, tvs = GetBuildInfo() - Details.build_counter = 13303 - Details.alpha_build_counter = 13303 --if this is higher than the regular counter, use it instead + Details.build_counter = 13317 + Details.alpha_build_counter = 13317 --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 diff --git a/frames/window_transcriptor.lua b/frames/window_transcriptor.lua new file mode 100644 index 000000000..eeab4a35d --- /dev/null +++ b/frames/window_transcriptor.lua @@ -0,0 +1,214 @@ + +local Details = _G.Details +---@type detailsframework +local detailsFramework = _G.DetailsFramework +local _, Details222 = ... +_ = nil + +---@class transcriptor : table +---@field timeline df_timeline + +---@class simplepanel +---@field RightResizerGrip button + +---@class timeline : df_timeline +---@field OnMainFrameSizeChanged fun(self:timeline) + +local transcriptor = {} + +function Details222.CreateTranscriptorFrame() + local defaultWidth = 1220 + local defaultHeight = 620 + local headerWidth = 150 + local windowTitle = "Details! Transcriptor" + + if (not Details.transcriptor_frame.width) then + Details.transcriptor_frame.width = defaultWidth + Details.transcriptor_frame.height = defaultHeight + else + defaultWidth = Details.transcriptor_frame.width + defaultHeight = Details.transcriptor_frame.height + end + + local transcriptorFrame = detailsFramework:CreateSimplePanel(UIParent, defaultWidth, defaultHeight, windowTitle, "DetailsTranscriptorFame", {UseScaleBar = false, NoScripts = true}) + + detailsFramework:MakeDraggable(transcriptorFrame) + detailsFramework:ApplyStandardBackdrop(transcriptorFrame) + transcriptorFrame:SetPoint("center", UIParent, "center", 0, -150) + transcriptorFrame:SetFrameStrata("HIGH") + transcriptorFrame:SetToplevel(true) + + local LibWindow = LibStub("LibWindow-1.1") + LibWindow.RegisterConfig(transcriptorFrame, Details.transcriptor_frame) + LibWindow.MakeDraggable(transcriptorFrame) + LibWindow.RestorePosition(transcriptorFrame) + + local leftGrip, rightGrip = detailsFramework:CreateResizeGrips(transcriptorFrame, {width = 20, height = 20}) + leftGrip:Hide() + transcriptorFrame.RightResizerGrip = rightGrip + + transcriptorFrame:SetResizable(true) + transcriptorFrame:SetScript("OnSizeChanged", function() + local timeline = transcriptor.timeline + timeline.OnMainFrameSizeChanged(timeline) + Details.transcriptor_frame.width = transcriptorFrame:GetWidth() + Details.transcriptor_frame.height = transcriptorFrame:GetHeight() + end) + + --> timeline + ---@type df_elapsedtime_options + ---@diagnostic disable-next-line: missing-fields + local elapsedTimeOptions = { + draw_line_color = {1, 1, 1, 0.1}, + } + + local onCreateLine = function(line) + + end + + local onRefreshLine = function(line) + + end + + local onEnterLine = function(line) + + end + + local onLeaveLine = function(line) + + end + + local onCreateBlock = function(block) + + end + + local onEnterBlock = function(block) + + end + + local onLeaveBlock = function(block) + + end + + local onClickBlock = function(block, mouseButton) + + end + + local onCreateBlockLengthFrame = function(blockLengthFrame) + + end + + local onEnterBlockLengthFrame = function(blockLengthFrame) + + end + + local onLeaveBlockLengthFrame = function(blockLengthFrame) + + end + + local onClickBlockLengthFrame = function(blockLengthFrame, mouseButton) + + end + + local timelineOptions = { + width = transcriptorFrame:GetWidth() - 24 - headerWidth, + height = transcriptorFrame:GetHeight() - 124, + auto_height = false, + can_resize = false, + line_height = 20, + line_padding = 1, + zoom_out_zero = true, + show_elapsed_timeline = true, + elapsed_timeline_height = 20, + header_width = 150, + header_detached = true, + backdrop_color = {0, 0, 0, 0.2}, + backdrop_color_highlight = {1, 1, 1, .5}, + + header_on_enter = function(lineHeader) + print("mouse entered header") + end, + + header_on_leave = function(lineHeader) + print("mouse left header") + end, + + on_create_line = function(line) + onCreateLine(line) + end, + + on_refresh_line = function(line) + onRefreshLine(line) + end, + + on_enter = function(line) --on enter line + onEnterLine(line) + end, + + on_leave = function(line) --on leave line + onLeaveLine(line) + end, + + block_on_create = function(self) + onCreateBlock(self) + end, + + --on entering a spell icon + block_on_enter = function(self) + onEnterBlock(self) + end, + + block_on_leave = function(self) + onLeaveBlock(self) + end, + + block_on_click = function(blockClicked, mouseButton) + onClickBlock(blockClicked, mouseButton) + end, + + block_on_create_blocklength = function(blockLengthFrame) + onCreateBlockLengthFrame(blockLengthFrame) + end, + + block_on_enter_blocklength = function(blockLengthFrame) + onEnterBlockLengthFrame(blockLengthFrame) + end, + + block_on_leave_blocklength = function(blockLengthFrame) + onLeaveBlockLengthFrame(blockLengthFrame) + end, + + block_on_click_blocklength = function(blockLengthFrame, mouseButton) + onClickBlockLengthFrame(blockLengthFrame, mouseButton) + end, + + scale_min = 0.1, --number + + --block_on_set_data = function(blockFrame, blockData) + --end, + + --pixels_per_second number + --scale_max number + --backdrop backdrop + --backdrop_color number[] + --backdrop_color_highlight number[] + --backdrop_border_color number[] + --slider_backdrop backdrop + --slider_backdrop_color number[] + --slider_backdrop_border_color number[] + --title_template string "ORANGE_FONT_TEMPLATE" + --text_tempate string "OPTIONS_FONT_TEMPLATE" + } + + ---@type timeline + local timelineFrame, timelineHeader = detailsFramework:CreateTimeLineFrame(transcriptorFrame, "$parentTimeLineH", timelineOptions, elapsedTimeOptions) + timelineFrame:SetPoint("topleft", transcriptorFrame, "topleft", headerWidth + 2, -56) + transcriptor.timeline = timelineFrame + + function timelineFrame.OnMainFrameSizeChanged(self) + local width, height = transcriptorFrame:GetSize() + self:SetSize(width - headerWidth - 22, height - 124) + self:OnSizeChanged() + end + +end \ No newline at end of file diff --git a/functions/profiles.lua b/functions/profiles.lua index 99eba22f4..bf40956c6 100644 --- a/functions/profiles.lua +++ b/functions/profiles.lua @@ -1448,6 +1448,11 @@ local default_global_data = { font_size = 10, }, + --information about the transcriptor frame + transcriptor_frame = { + scale = 1, + }, + --keystone window keystone_frame = { scale = 1, diff --git a/luaserver.lua b/luaserver.lua index b87aea902..d8d4de85e 100644 --- a/luaserver.lua +++ b/luaserver.lua @@ -615,7 +615,7 @@ BackdropTemplateMixin = {} ---@field GetChildren fun(self: frame) : frame[] ---@field GetRegions fun(self: frame) : region[] ---@field CreateTexture fun(self: frame, name: string?, layer: drawlayer, inherits: string?, subLayer: number?) : texture ----@field CreateMaskTexture fun(self: frame, name: string?, layer: drawlayer, inherits: string?, subLayer: number?) : texture +---@field CreateMaskTexture fun(self: frame, name: string?, layer: drawlayer?, inherits: string?, subLayer: number?) : texture ---@field CreateFontString fun(self: frame, name: string?, layer: drawlayer, inherits: string?, subLayer: number?) : fontstring ---@field EnableMouse fun(self: frame, enable: boolean) enable mouse interaction ---@field SetResizable fun(self: frame, enable: boolean) enable resizing of the frame @@ -5132,13 +5132,13 @@ SetAllowLowLevelRaid = function(enabled) end ---@param index number SetRaidRosterSelection = function(index) end ----@param unit string ----@param subgroup number -SetRaidSubgroup = function(unit, subgroup) end +---@param unitNumber number +---@param subGroup number +SetRaidSubgroup = function(unitNumber, subGroup) end ----@param unit1 string ----@param unit2 string -SwapRaidSubgroup = function(unit1, unit2) end +---@param unitNumber1 number +---@param unitNumber2 number +SwapRaidSubgroup = function(unitNumber1, unitNumber2) end ---@param unit string ---@param raidTargetIndex number diff --git a/plugins/Details_Compare2/Details_Compare2.toc b/plugins/Details_Compare2/Details_Compare2.toc index 6915abbbc..4797c10ea 100644 --- a/plugins/Details_Compare2/Details_Compare2.toc +++ b/plugins/Details_Compare2/Details_Compare2.toc @@ -1,4 +1,4 @@ -## Interface: 110005 +## Interface: 110007 ## Title: Details!: Compare 2.0 ## Notes: Replace the Compare tab in the player breakdown window. ## RequiredDeps: Details diff --git a/plugins/Details_DataStorage/Details_DataStorage.toc b/plugins/Details_DataStorage/Details_DataStorage.toc index 2062ba0c3..de3bf7560 100644 --- a/plugins/Details_DataStorage/Details_DataStorage.toc +++ b/plugins/Details_DataStorage/Details_DataStorage.toc @@ -1,4 +1,4 @@ -## Interface: 110005 +## Interface: 110007 ## Title: Details!: Storage ## Notes: Stores information for Details! Damage Meter ## DefaultState: Enabled diff --git a/plugins/Details_EncounterDetails/Details_EncounterDetails.toc b/plugins/Details_EncounterDetails/Details_EncounterDetails.toc index bc4881c07..041c7ad7b 100644 --- a/plugins/Details_EncounterDetails/Details_EncounterDetails.toc +++ b/plugins/Details_EncounterDetails/Details_EncounterDetails.toc @@ -1,4 +1,4 @@ -## Interface: 110005 +## Interface: 110007 ## Title: Details!: Encounter Breakdown (plugin) ## Notes: Show detailed information about a boss encounter. Also provide damage per phase, graphic charts, easy weakauras creation. ## RequiredDeps: Details diff --git a/plugins/Details_RaidCheck/Details_RaidCheck.lua b/plugins/Details_RaidCheck/Details_RaidCheck.lua index 70c8509d6..5cf474c40 100644 --- a/plugins/Details_RaidCheck/Details_RaidCheck.lua +++ b/plugins/Details_RaidCheck/Details_RaidCheck.lua @@ -689,7 +689,7 @@ local CreatePluginFrames = function() local playersInfoData = openRaidLib.GetAllUnitsInfo() local playerTalentsInfo = playersInfoData[GetUnitName(unitID, true)] if (playerTalentsInfo) then - talentsTable = DF.table.copy({}, playerTalentsInfo.talents) + --talentsTable = DF.table.copy({}, playerTalentsInfo.talents) end end diff --git a/plugins/Details_RaidCheck/Details_RaidCheck.toc b/plugins/Details_RaidCheck/Details_RaidCheck.toc index 74a3deee7..a9bb1620f 100644 --- a/plugins/Details_RaidCheck/Details_RaidCheck.toc +++ b/plugins/Details_RaidCheck/Details_RaidCheck.toc @@ -1,4 +1,4 @@ -## Interface: 110005 +## Interface: 110007 ## Title: Details!: Raid Check (plugin) ## Notes: Show talents and item level for all members in your group, also shows food and flask state. ## RequiredDeps: Details diff --git a/plugins/Details_Streamer/Details_Streamer.toc b/plugins/Details_Streamer/Details_Streamer.toc index b2d915fbe..14e07c3c3 100644 --- a/plugins/Details_Streamer/Details_Streamer.toc +++ b/plugins/Details_Streamer/Details_Streamer.toc @@ -1,4 +1,4 @@ -## Interface: 110005 +## Interface: 110007 ## Title: Details!: Streamer (plugin) ## Notes: Show which spells you are casting, viewers can see what are you doing and follow your steps. ## RequiredDeps: Details diff --git a/plugins/Details_TinyThreat/Details_TinyThreat.toc b/plugins/Details_TinyThreat/Details_TinyThreat.toc index 89696a3c9..5eaaa8773 100644 --- a/plugins/Details_TinyThreat/Details_TinyThreat.toc +++ b/plugins/Details_TinyThreat/Details_TinyThreat.toc @@ -1,4 +1,4 @@ -## Interface: 110005 +## Interface: 110007 ## Title: Details!: Tiny Threat (plugin) ## Notes: Threat meter plugin, show threat for group members in the window. Select it from the Plugin menu in the Orange Cogwheel. ## RequiredDeps: Details diff --git a/plugins/Details_Vanguard/Details_Vanguard.toc b/plugins/Details_Vanguard/Details_Vanguard.toc index cd015d4da..adf857c3a 100644 --- a/plugins/Details_Vanguard/Details_Vanguard.toc +++ b/plugins/Details_Vanguard/Details_Vanguard.toc @@ -1,4 +1,4 @@ -## Interface: 110005 +## Interface: 110007 ## Title: Details!: Vanguard (plugin) ## Notes: Show the health and debuffs for tanks in your group. ## SavedVariablesPerCharacter: _detalhes_databaseVanguard