diff --git a/WorldQuestTracker.lua b/WorldQuestTracker.lua index 5210db7e..1c8c1863 100644 --- a/WorldQuestTracker.lua +++ b/WorldQuestTracker.lua @@ -34,6 +34,7 @@ local HaveQuestData = HaveQuestData local isWorldQuest = QuestUtils_IsQuestWorldQuest local GetQuestInfoByQuestID = C_TaskQuest.GetQuestInfoByQuestID local GetQuestTimeLeftMinutes = C_TaskQuest.GetQuestTimeLeftMinutes +local GetQuestsForPlayerByMapID = C_TaskQuest.GetQuestsForPlayerByMapID or C_TaskQuest.GetQuestsOnMap local _ @@ -1098,12 +1099,12 @@ function SlashCmdList.WQTRACKER (msg, editbox) WorldQuestTracker:Msg("Character level too low for shadowlands, minimum is 51 for alts.") end - local bastionQuests = C_TaskQuest.GetQuestsForPlayerByMapID(1533, 1533) + local bastionQuests = GetQuestsForPlayerByMapID(1533, 1533) WorldQuestTracker:Msg("Finding quests on Bastion Map") if (bastionQuests and type(bastionQuests) == "table") then WorldQuestTracker:Msg("Found quests, amount:", #bastionQuests) else - WorldQuestTracker:Msg("Blizzard's GetQuestsForPlayerByMapID() returned invalid data.") + WorldQuestTracker:Msg("Blizzard's GetQuestsOnMap() returned invalid data.") end elseif (msg == "debug") then diff --git a/WorldQuestTracker.toc b/WorldQuestTracker.toc index 21e309d1..e695871d 100644 --- a/WorldQuestTracker.toc +++ b/WorldQuestTracker.toc @@ -1,5 +1,5 @@ -## Interface: 110002 -## Interface-Mainline: 110002 +## Interface: 110005 +## Interface-Mainline: 110005 ## Interface-Wrath: 30402 ## Title: World Quest Tracker diff --git a/WorldQuestTracker_GroupFinder.lua b/WorldQuestTracker_GroupFinder.lua index 718c1e84..7ed04df1 100644 --- a/WorldQuestTracker_GroupFinder.lua +++ b/WorldQuestTracker_GroupFinder.lua @@ -20,7 +20,7 @@ local L = DF.Language.GetLanguageTable(addonId) local ff = WorldQuestTrackerFinderFrame local rf = WorldQuestTrackerRareFrame - +local GetQuestsForPlayerByMapID = C_TaskQuest.GetQuestsForPlayerByMapID or C_TaskQuest.GetQuestsOnMap ff.cannot_group_quest = {} @@ -1415,7 +1415,7 @@ ff:SetScript("OnEvent", function (self, event, questID, arg2, arg3) end) function ff.CheckForQuestsInTheArea() - local allQuestsInTheMap = C_TaskQuest.GetQuestsForPlayerByMapID(WorldQuestTracker.GetCurrentStandingMapAreaID()) + local allQuestsInTheMap = GetQuestsForPlayerByMapID(WorldQuestTracker.GetCurrentStandingMapAreaID()) if (allQuestsInTheMap) then for index, questInfo in ipairs(allQuestsInTheMap) do local questId = questInfo.questId diff --git a/WorldQuestTracker_MapAPI.lua b/WorldQuestTracker_MapAPI.lua index 082ec4b0..186fcf85 100644 --- a/WorldQuestTracker_MapAPI.lua +++ b/WorldQuestTracker_MapAPI.lua @@ -20,7 +20,7 @@ local GetItemInfo = C_Item and C_Item.GetItemInfo or GetItemInfo local L = DF.Language.GetLanguageTable(addonId) local _ -local GetQuestsForPlayerByMapID = C_TaskQuest.GetQuestsForPlayerByMapID +local GetQuestsForPlayerByMapID = C_TaskQuest.GetQuestsForPlayerByMapID or C_TaskQuest.GetQuestsOnMap local isWorldQuest = QuestUtils_IsQuestWorldQuest local GetNumQuestLogRewardCurrencies = WorldQuestTrackerAddon.GetNumQuestLogRewardCurrencies local GetQuestLogRewardInfo = GetQuestLogRewardInfo @@ -241,7 +241,7 @@ function WorldQuestTracker.GetAllWorldQuests_Ids() local taskInfo = GetQuestsForPlayerByMapID (mapId) if (taskInfo and #taskInfo > 0) then for i, info in ipairs (taskInfo) do - local questID = info.questId + local questID = info.questID if (HaveQuestData (questID)) then local isWorldQuest = isWorldQuest(questID) if (isWorldQuest) then @@ -399,7 +399,7 @@ function WorldQuestTracker.PreloadWorldQuestsForMap(mapID) local taskInfo = GetQuestsForPlayerByMapID(mapID) if (taskInfo and #taskInfo > 0) then for i, info in ipairs(taskInfo) do - local questID = info.questId + local questID = info.questID local bIsWorldQuest = isWorldQuest(questID) if (bIsWorldQuest) then if (not HaveQuestData(questID) or not HaveQuestRewardData(questID)) then diff --git a/WorldQuestTracker_MapChange.lua b/WorldQuestTracker_MapChange.lua index fdaade6f..c6a0de9a 100644 --- a/WorldQuestTracker_MapChange.lua +++ b/WorldQuestTracker_MapChange.lua @@ -8,6 +8,8 @@ if (not WorldQuestTracker) then return end +local GetQuestsForPlayerByMapID = C_TaskQuest.GetQuestsForPlayerByMapID or C_TaskQuest.GetQuestsOnMap + --framework ---@type detailsframework local DF = _G ["DetailsFramework"] @@ -23,7 +25,7 @@ local check_for_quests_on_unknown_map = function() local mapID = WorldMapFrame.mapID if (not WorldQuestTracker.MapData.WorldQuestZones[mapID] and not WorldQuestTracker.IsWorldQuestHub(mapID)) then - local taskInfo = C_TaskQuest.GetQuestsForPlayerByMapID(mapID, mapID) + local taskInfo = GetQuestsForPlayerByMapID(mapID, mapID) if (taskInfo and #taskInfo > 0) then --> there's quests on this map WorldQuestTracker.MapData.WorldQuestZones[mapID] = true diff --git a/WorldQuestTracker_WorldMap.lua b/WorldQuestTracker_WorldMap.lua index 159eb165..82bd7aa3 100644 --- a/WorldQuestTracker_WorldMap.lua +++ b/WorldQuestTracker_WorldMap.lua @@ -22,7 +22,7 @@ local HereBeDragons = LibStub("HereBeDragons-2.0") local CONST_QUEST_LOADINGTIME = 1.333 local _ local isWorldQuest = QuestUtils_IsQuestWorldQuest -local GetQuestsForPlayerByMapID = C_TaskQuest.GetQuestsForPlayerByMapID +local GetQuestsForPlayerByMapID = C_TaskQuest.GetQuestsForPlayerByMapID or C_TaskQuest.GetQuestsOnMap local IsQuestCriteriaForBounty = C_QuestLog.IsQuestCriteriaForBounty local faction_frames = {} @@ -98,7 +98,7 @@ local loadQuestData = function() if (taskInfo and #taskInfo > 0) then for i, info in ipairs(taskInfo) do - local questID = info.questId + local questID = info.questID if (not WorldQuestTracker.HaveDataForQuest(questID) or not HaveQuestRewardData(questID)) then C_TaskQuest.RequestPreloadRewardData(questID) end @@ -1421,7 +1421,7 @@ function WorldQuestTracker.UpdateWorldQuestsOnWorldMap(noCache, showFade, isQues if (taskInfo and #taskInfo > 0) then for i, info in ipairs(taskInfo) do - local questID = info.questId + local questID = info.questID local canUpdateQuest = false if (not questList) then @@ -1807,7 +1807,7 @@ function WorldQuestTracker.GetQuestDataFromCache(questID, bCreateQuestData) local taskInfo = GetQuestsForPlayerByMapID(mapId, mapId) if (taskInfo and #taskInfo > 0) then for i, info in ipairs(taskInfo) do - local thisTaskQuestId = info.questId + local thisTaskQuestId = info.questID if (thisTaskQuestId == questID) then local title, factionID, tagID, tagName, worldQuestType, rarity, isElite, tradeskillLineIndex, allowDisplayPastCritical, gold, goldFormated, rewardName, rewardTexture, numRewardItems, itemName, itemTexture, itemLevel, quantity, quality, isUsable, itemID, isArtifact, artifactPower, isStackable, stackAmount = WorldQuestTracker.GetOrLoadQuestData(questID, true) local timeLeft = WorldQuestTracker.GetQuest_TimeLeft(questID) diff --git a/WorldQuestTracker_ZoneMap.lua b/WorldQuestTracker_ZoneMap.lua index cb8539dd..7ab11972 100644 --- a/WorldQuestTracker_ZoneMap.lua +++ b/WorldQuestTracker_ZoneMap.lua @@ -18,7 +18,7 @@ end local L = DF.Language.GetLanguageTable(addonId) local _ -local GetQuestsForPlayerByMapID = C_TaskQuest.GetQuestsForPlayerByMapID +local GetQuestsForPlayerByMapID = C_TaskQuest.GetQuestsForPlayerByMapID or C_TaskQuest.GetQuestsOnMap local isWorldQuest = QuestUtils_IsQuestWorldQuest local GetNumQuestLogRewardCurrencies = WorldQuestTrackerAddon.GetNumQuestLogRewardCurrencies local GetQuestLogRewardInfo = GetQuestLogRewardInfo @@ -906,8 +906,7 @@ function WorldQuestTracker.UpdateZoneWidgets(forceUpdate) local needAnotherUpdate = false for i, info in ipairs(taskInfo) do - local questID = info.questId - + local questID = info.questID local isWorldQuest = isWorldQuest(questID) if (isWorldQuest) then if (HaveQuestData(questID)) then diff --git a/libs/DF/definitions.lua b/libs/DF/definitions.lua index 8f358256..9121fac1 100644 --- a/libs/DF/definitions.lua +++ b/libs/DF/definitions.lua @@ -137,7 +137,9 @@ ---@field ScriptHookMixin df_scripthookmixin ---@field EditorMixin df_editormixin ---@field PoolMixin df_pool +---@field LineIndicatorMixin df_lineindicator ---@field ScrollBoxFunctions df_scrollboxmixin +---@field LayoutFrame df_framelayout ---@field ClassCache {ID:number, Name:string, FileString:string, Texture:string, TexCoord:number[]}[] only available after calling GetClassList() ---@field Math df_math ---@field FontOutlineFlags table @@ -357,6 +359,7 @@ ---@field CreateTimeLineFrame fun(self:table, parent:frame, name:string, timelineOptions:df_timeline_options, elapsedtimeOptions:df_elapsedtime_options) : df_timeline ---@field CreateElapsedTimeFrame fun(self:table, parent:frame, name:string?, options:df_elapsedtime_options?) : df_elapsedtime ---@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 ---@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 ---@field RemoveRealNameFromName fun(self:table, name:string) : string remove the realm name from a name string diff --git a/libs/DF/elapsedtime.lua b/libs/DF/elapsedtime.lua index 2066d8b5..3fae3026 100644 --- a/libs/DF/elapsedtime.lua +++ b/libs/DF/elapsedtime.lua @@ -86,6 +86,10 @@ detailsFramework.TimeLineElapsedTimeFunctions = { end end, + SetScrollChild = function(self, scrollChild) + self.scrollChild = scrollChild + end, + Refresh = function(self, elapsedTime, scale) if (not elapsedTime) then --invalid data passed @@ -118,7 +122,7 @@ detailsFramework.TimeLineElapsedTimeFunctions = { label:SetText(detailsFramework:IntegerToTimer(floor(secondsOfTime))) if (label.line:IsShown()) then - label.line:SetHeight(parent:GetParent():GetHeight()) + label.line:SetHeight(self.scrollChild:GetHeight()) end label:Show() @@ -128,6 +132,7 @@ detailsFramework.TimeLineElapsedTimeFunctions = { ---@class df_elapsedtime : frame, df_elapsedtime_mixin, df_optionsmixin ---@field labels table +---@field scrollChild frame ---creates a frame to show the elapsed time in a row ---@param parent frame @@ -135,6 +140,7 @@ detailsFramework.TimeLineElapsedTimeFunctions = { ---@param options df_elapsedtime_options? ---@return df_elapsedtime function detailsFramework:CreateElapsedTimeFrame(parent, name, options) + ---@type df_elapsedtime local elapsedTimeFrame = CreateFrame("frame", name, parent, "BackdropTemplate") detailsFramework:Mixin(elapsedTimeFrame, detailsFramework.OptionsFunctions) @@ -146,6 +152,8 @@ function detailsFramework:CreateElapsedTimeFrame(parent, name, options) elapsedTimeFrame:SetBackdrop(elapsedTimeFrame.options.backdrop) elapsedTimeFrame:SetBackdropColor(unpack(elapsedTimeFrame.options.backdrop_color)) + elapsedTimeFrame.scrollChild = parent + elapsedTimeFrame.labels = {} return elapsedTimeFrame diff --git a/libs/DF/fw.lua b/libs/DF/fw.lua index 45fd0d40..d4cb77a3 100644 --- a/libs/DF/fw.lua +++ b/libs/DF/fw.lua @@ -1,6 +1,6 @@ -local dversion = 574 +local dversion = 575 local major, minor = "DetailsFramework-1.0", dversion local DF, oldminor = LibStub:NewLibrary(major, minor) @@ -1365,6 +1365,19 @@ function DF:AddColorToText(text, color) --wrap text with a color return text end +function DF:GetClassColorByClassId(classId) + local classInfo = C_CreatureInfo.GetClassInfo(classId) + if (classInfo) then + local color = RAID_CLASS_COLORS[classInfo.classFile] + if (color) then + return color.r, color.g, color.b + else + return 1, 1, 1 + end + end + return 1, 1, 1 +end + ---receives a string 'text' and a class name and return the string wrapped with the class color using |c and |r scape codes ---@param self table ---@param text string @@ -4739,6 +4752,7 @@ DF.ClassIndexToFileName = { [13] = "EVOKER", } +--GetNumClasses() DF.ClassFileNameToIndex = { ["WARRIOR"] = 1, @@ -5708,14 +5722,14 @@ local sendTimeBarNotification = function(token, barType, id, msg, timer, icon, s end local createBossModsCallback = function() - if (_G.DBM) then + if (false and _G.DBM) then local DBM = _G.DBM --phase change local phaseChangeCallback = function(event, mod, modId, phase, encounterId, stageTotal) sendPhaseNotification(phase) end - DBM:RegisterCallback("DBM_SetStage", phaseChangeCallback) + --DBM:RegisterCallback("DBM_SetStage", phaseChangeCallback) --time bars local timerChangeCallback = function(bar_type, id, msg, timer, icon, bartype, spellId, colorId, modid) @@ -5733,12 +5747,12 @@ local createBossModsCallback = function() end end - DBM:RegisterCallback("DBM_TimerStart", timerChangeCallback) + --DBM:RegisterCallback("DBM_TimerStart", timerChangeCallback) end local BigWigsLoader = BigWigsLoader - if (BigWigsLoader and not _G.DBM) then + if (BigWigsLoader) then -- and not _G.DBM --Bigwigs change the phase of an encounter if (BigWigsLoader.RegisterMessage) then local t = {} diff --git a/libs/DF/line_indicator.lua b/libs/DF/line_indicator.lua index 1bdba441..3c6aafef 100644 --- a/libs/DF/line_indicator.lua +++ b/libs/DF/line_indicator.lua @@ -73,6 +73,7 @@ end ---@field lineIndicatorLineHeight number ---@field lineIndicatorLineWidth number ---@field lineIndicatorPixelPerSecond number +---@field lineIndicatorMouseEnabled boolean ---@field lineIndicatorColor any ---@field lineIndicatorValueFontString fontstring ---@field LineIndicatorConstructor fun(self:df_lineindicator) diff --git a/libs/DF/slider.lua b/libs/DF/slider.lua index 755ad0d5..fd3d36db 100644 --- a/libs/DF/slider.lua +++ b/libs/DF/slider.lua @@ -969,6 +969,7 @@ end ---@field SetSwitchFunction fun(self:df_button, newOnSwitchFunction: function) ---@field GetCapsule fun(self:df_button):df_button capsule only exists in the actual frame of the encapsulated widget ---@field SetCheckedTexture fun(self:df_button, texture:string) +---@field SetChecked fun(self:df_button, value:boolean) function DF:CreateSwitch(parent, onSwitch, defaultValue, width, height, leftText, rightText, member, name, colorInverted, switchFunc, returnFunc, withLabel, switch_template, label_template) diff --git a/libs/DF/timeline.lua b/libs/DF/timeline.lua index 28d070df..4884902d 100644 --- a/libs/DF/timeline.lua +++ b/libs/DF/timeline.lua @@ -1,4 +1,5 @@ +---@type detailsframework local detailsFramework = _G ["DetailsFramework"] if (not detailsFramework or not DetailsFrameworkCanLoad) then return @@ -75,6 +76,8 @@ local APIFrameFunctions ---@field block_on_leave fun(self:button) ---@field block_on_click fun(self:button) ---@field block_on_set_data fun(self:button, data:table) +---@field block_on_enter_auralength fun(self:df_timeline_line_block) +---@field block_on_leave_auralength fun(self:df_timeline_line_block) local timeline_options = { width = 400, height = 700, @@ -123,6 +126,10 @@ local timeline_options = { -- end, -- block_on_set_data = function(self, data) -- end, +-- block_on_enter_auralength = function() +-- end, +-- block_on_leave_auralength = function() +-- end, } ---@class df_timeline_block_data : table @@ -132,6 +139,9 @@ local timeline_options = { ---@field [4] number auraDuration ---@field [5] number blockSpellId ---@field payload any +---@field customIcon any +---@field customName any +---@field isIconRow boolean? ---@class df_timeline_linedata : table ---@field spellId number @@ -151,12 +161,14 @@ local timeline_options = { ---@field duration number ---@field spellId number ---@field payload any +---@field customIcon any +---@field customName any ---@class df_timeline_line_block : frame ---@field icon texture ---@field text fontstring ---@field background texture ----@field auraLength texture +---@field auraLength frame ---@field info df_timeline_line_blockinfo ---@class df_timeline_line_mixin : frame @@ -240,6 +252,7 @@ detailsFramework.TimeLine_LineMixin = { local baseFrameLevel = timeline:GetFrameLevel() + 10 local errorHandler = geterrorhandler() + local rowStartBlock for i = 1, #timelineData do local blockInfo = timelineData[i] @@ -251,6 +264,12 @@ detailsFramework.TimeLine_LineMixin = { local blockSpellId = blockInfo[5] local payload = blockInfo.payload + local customIcon = blockInfo.customIcon + local customName = blockInfo.customName + local inRow = blockInfo.isIconRow + local showRightIcon = blockInfo.showRightIcon + local auraHeight = blockInfo.auraHeight + local auraYOffset = blockInfo.auraYOffset local xOffset = pixelPerSecond * timeInSeconds local width = pixelPerSecond * length @@ -261,18 +280,32 @@ detailsFramework.TimeLine_LineMixin = { local block = self:GetBlock(i) block:Show() - block:SetFrameLevel(baseFrameLevel + i) - - PixelUtil.SetPoint(block, "left", self, "left", xOffset + headerWidth, 0) + block:SetFrameLevel(baseFrameLevel) + + 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) + PixelUtil.SetPoint(block, "left", lastBlock, "right", 2, 0) + if (not rowStartBlock) then + rowStartBlock = lastBlock + end + else + PixelUtil.SetPoint(block, "left", self, "left", xOffset + headerWidth, 0) + rowStartBlock = nil + end block.info.spellId = blockSpellId or spellId block.info.time = timeInSeconds block.info.duration = auraDuration block.info.payload = payload + block.info.customIcon = customIcon --nil set to nil if not exists + block.info.customName = customName if (useIconOnBlock) then local iconTexture = lineData.icon - if (blockSpellId) then + if (customIcon) then + iconTexture = customIcon + elseif (blockSpellId) then iconTexture = GetSpellTexture(blockSpellId) end @@ -291,14 +324,46 @@ detailsFramework.TimeLine_LineMixin = { if (isAura) then block.auraLength:Show() - block.auraLength:SetWidth(pixelPerSecond * isAura) - block:SetWidth(max(pixelPerSecond * isAura, 16)) + local thisAuraDuration = auraDuration + if (timeInSeconds + thisAuraDuration > timeline.data.length) then + thisAuraDuration = timeline.data.length - timeInSeconds + end + + if (blockInfo.auraLengthColor) then + local r, g, b = unpack(blockInfo.auraLengthColor) + block.auraLength.Texture:SetVertexColor(r, g, b, 0.5) + else + block.auraLength.Texture:SetVertexColor(1, 1, 1, 0.5) + end + + block.auraLength.Texture:Show() + + block.auraLength:SetWidth(pixelPerSecond * thisAuraDuration) + block.auraLength:SetHeight(auraHeight and auraHeight or block:GetHeight()) + + if (showRightIcon) then + block.auraLength.RightIcon:SetTexture(iconTexture) + block.auraLength.RightIcon:SetTexCoord(.1, .9, .1, .9) + block.auraLength.RightIcon:SetWidth(block.auraLength:GetHeight()) + block.auraLength.RightIcon:Show() + else + block.auraLength.RightIcon:SetTexture(nil) + block.auraLength.RightIcon:Hide() + end + + if (inRow) then + block.auraLength:SetPoint("bottomleft", rowStartBlock or block.icon, "bottomleft", 0, auraYOffset) + else + block.auraLength:SetPoint("bottomleft", block.icon, "bottomleft", 0, auraYOffset) + end + --block:SetWidth(max(pixelPerSecond * auraDuration, 16)) else block.auraLength:Hide() end block.background:SetVertexColor(0, 0, 0, 0) else + block.icon:SetTexture("") block.background:SetVertexColor(0, 0, 0, 0) PixelUtil.SetSize(block, max(width, 16), self:GetHeight()) block.auraLength:Hide() @@ -315,6 +380,49 @@ detailsFramework.TimeLine_LineMixin = { end end, + OnEnterAuraLength = function(self) + ---@type df_timeline + local timeline = self.timeline + if (timeline.options.block_on_enter_auralength) then + timeline.options.block_on_enter_auralength(self) + end + end, + + OnLeaveAuraLength = function(self) + ---@type df_timeline + local timeline = self.timeline + if (timeline.options.block_on_enter_auralength) then + timeline.options.block_on_leave_auralength(self) + end + end, + + CreateAuraLength = function(block) + local auraLengthFrame = CreateFrame("frame", nil, block) + auraLengthFrame:SetFrameLevel(block:GetFrameLevel() - 1) + auraLengthFrame:SetScript("OnEnter", detailsFramework.TimeLine_LineMixin.OnEnterAuraLength) + auraLengthFrame:SetScript("OnLeave", detailsFramework.TimeLine_LineMixin.OnLeaveAuraLength) + --save reference of the block + auraLengthFrame.block = block + --save reference of the timeline + auraLengthFrame.timeline = block:GetParent():GetParent():GetParent() + + local auraLengthTexture = auraLengthFrame:CreateTexture(nil, "border") + auraLengthTexture:SetColorTexture(1, 1, 1, 1) + auraLengthTexture:SetVertexColor(1, 1, 1, 0.1) + auraLengthTexture:SetAllPoints() + auraLengthFrame.Texture = auraLengthTexture + + --icon which will be shown at the end of the auraLength frame if the icon is enabled + local rightIcon = auraLengthFrame:CreateTexture(nil, "border") + rightIcon:SetPoint("topright", auraLengthFrame, "topright", 0, 0) + rightIcon:SetPoint("bottomright", auraLengthFrame, "bottomright", 0, 0) + auraLengthFrame.RightIcon = rightIcon + + detailsFramework:CreateHighlightTexture(auraLengthFrame) + + block.auraLength = auraLengthFrame + end, + GetBlock = function(self, index) local block = self.blocks[index] if (not block) then @@ -326,7 +434,8 @@ detailsFramework.TimeLine_LineMixin = { background:SetColorTexture(1, 1, 1, 1) local icon = block:CreateTexture(nil, "artwork") local text = block:CreateFontString(nil, "artwork") - local auraLength = block:CreateTexture(nil, "border") + + detailsFramework.TimeLine_LineMixin.CreateAuraLength(block) local backgroundBorder = detailsFramework:CreateFullBorder("$parentBorder", block) local iconOffset = -1 * UIParent:GetEffectiveScale() @@ -340,15 +449,10 @@ detailsFramework.TimeLine_LineMixin = { background:SetAllPoints() icon:SetPoint("left") text:SetPoint("left", icon, "left", 2, 0) - auraLength:SetPoint("topleft", icon, "topleft", 0, 0) - auraLength:SetPoint("bottomleft", icon, "bottomleft", 0, 0) - auraLength:SetColorTexture(1, 1, 1, 1) - auraLength:SetVertexColor(1, 1, 1, 0.1) block.icon = icon block.text = text block.background = background - block.auraLength = auraLength block.backgroundBorder = backgroundBorder block:SetScript("OnEnter", self:GetParent():GetParent().options.block_on_enter) @@ -358,6 +462,11 @@ detailsFramework.TimeLine_LineMixin = { block.info = {} end + --need to reset the block + block.auraLength:Hide() + block.auraLength.Texture:Hide() + block.auraLength.RightIcon:Hide() + return block end, @@ -389,7 +498,8 @@ detailsFramework.TimeLine_LineMixin = { ---@field onClickCallback fun() ---@field onClickCallbackFunc fun() ---@field onClickCallbackArgs any[] ----@field headerFrame frame headerFrame only exists if the options.header_detached is true +---@field headerFrame scrollframe headerFrame only exists if the options.header_detached is true +---@field headerBody frame headerBody only exists if the options.header_detached is true ---@field resizeButton button ---@field elapsedTimeFrame df_elapsedtime ---@field horizontalSlider slider @@ -526,9 +636,10 @@ detailsFramework.TimeLineMixin = { local lineHeader if (detachedHeaderFrame) then - lineHeader = CreateFrame("frame", nil, detachedHeaderFrame, "BackdropTemplate") + lineHeader = CreateFrame("frame", nil, self.headerBody, "BackdropTemplate") lineHeader:SetSize(detachedHeaderFrame:GetWidth(), self.options.line_height) - lineHeader:SetPoint("topleft", detachedHeaderFrame, "topleft", 0, xPosition) + lineHeader:SetPoint("topleft", self.headerBody, "topleft", 0, xPosition) + lineHeader.Line = line else lineHeader = CreateFrame("frame", nil, line, "BackdropTemplate") lineHeader:SetPoint("topleft", line, "topleft", 0, 0) @@ -571,6 +682,49 @@ detailsFramework.TimeLineMixin = { end end, + RefreshPerPixelButtons = function(self) + --local amountOfButtons = floor(self.body:GetWidth() / (pixelPerSecond * currentScale)) + local amountOfButtons = self.totalLength + local buttonHeight = self:GetHeight() + local widthPerSecond = self.options.pixels_per_second * self.currentScale + + --print("Updating Buttons...", amountOfButtons, "bodyHeight??", buttonHeight, "scale:", currentScale) + + for i = 1, amountOfButtons do + local button = self.body.Buttons[i] + if (not button) then + button = CreateFrame("button", "$parentButton" .. i, self.body, "BackdropTemplate") + local overlayTexture = button:CreateTexture(nil, "overlay") + local r, g, b, a = detailsFramework:GetDefaultBackdropColor() + overlayTexture:SetColorTexture(1, 1, 1) + overlayTexture:SetAlpha(i % 2 == 0 and 0.01 or 0.02) + overlayTexture:SetAllPoints() + + --create a highlight texture + local highlightTexture = button:CreateTexture(nil, "highlight") + highlightTexture:SetColorTexture(1, 1, 1, 0.05) + highlightTexture:SetAllPoints() + + self.body.Buttons[i] = button + end + + button:SetSize(widthPerSecond, buttonHeight) + + local xPosition = (i - 1) * widthPerSecond + xPosition = xPosition + self.options.header_width + button:SetPoint("topleft", self.body, "topleft", xPosition, 0) + + self:UpdateOnClickCallback(button) + + button:Show() + button.index = i + end + + for i = amountOfButtons+1, #self.body.Buttons do + self.body.Buttons[i]:Hide() + end + end, + --todo --make the on enter and leave tooltips --set icons and texts @@ -631,50 +785,6 @@ detailsFramework.TimeLineMixin = { self.body.effectiveWidth = bodyWidth - --buttons are the vertical clickable areas inside the timeline, each second on the time line has one - if (not bDoNotRefreshButtons and self.options.use_perpixel_buttons) then - --local amountOfButtons = floor(self.body:GetWidth() / (pixelPerSecond * currentScale)) - local amountOfButtons = totalLength - local buttonHeight = self:GetHeight() - local widthPerSecond = pixelPerSecond * currentScale - - --print("Updating Buttons...", amountOfButtons, "bodyHeight??", buttonHeight, "scale:", currentScale) - - for i = 1, amountOfButtons do - local button = self.body.Buttons[i] - if (not button) then - button = CreateFrame("button", "$parentButton" .. i, self.body, "BackdropTemplate") - local overlayTexture = button:CreateTexture(nil, "overlay") - local r, g, b, a = detailsFramework:GetDefaultBackdropColor() - overlayTexture:SetColorTexture(1, 1, 1) - overlayTexture:SetAlpha(i % 2 == 0 and 0.01 or 0.02) - overlayTexture:SetAllPoints() - - --create a highlight texture - local highlightTexture = button:CreateTexture(nil, "highlight") - highlightTexture:SetColorTexture(1, 1, 1, 0.05) - highlightTexture:SetAllPoints() - - self.body.Buttons[i] = button - end - - button:SetSize(widthPerSecond, buttonHeight) - - local xPosition = (i - 1) * widthPerSecond - xPosition = xPosition + self.options.header_width - button:SetPoint("topleft", self.body, "topleft", xPosition, 0) - - self:UpdateOnClickCallback(button) - - button:Show() - button.index = i - end - - for i = amountOfButtons+1, #self.body.Buttons do - self.body.Buttons[i]:Hide() - end - end - --adjust the scale slider range local oldMin, oldMax = self.horizontalSlider:GetMinMaxValues() self.horizontalSlider:SetMinMaxValues(0, newMaxValue) @@ -688,6 +798,11 @@ detailsFramework.TimeLineMixin = { self.defaultColor = defaultColor self.headerWidth = effectiveHeaderWidth + --buttons are the vertical clickable areas inside the timeline, each second on the time line has one + if (not bDoNotRefreshButtons and self.options.use_perpixel_buttons) then + self:RefreshPerPixelButtons() + end + --calculate the total height local lineHeight = self.options.line_height local linePadding = self.options.line_padding @@ -697,16 +812,22 @@ detailsFramework.TimeLineMixin = { self.verticalSlider:SetMinMaxValues(0, max(bodyHeight - self:GetHeight(), 0)) self.verticalSlider:SetValue(0) + if (bHeaderDetached) then + self.headerBody:SetHeight(bodyHeight) + self.headerFrame.verticalSlider:SetMinMaxValues(0, max(bodyHeight - self:GetHeight(), 0)) + self.headerFrame.verticalSlider:SetValue(0) + end + self:ResetAllLines() if (self.options.auto_height) then self:SetHeight(bodyHeight) end - local howManyLinesTheTimelineCanShow = floor(self:GetHeight() / (lineHeight + linePadding)) - 1 - --refresh lines - for i = 1, math.min(#self.data.lines, howManyLinesTheTimelineCanShow) do + local howManyLinesTheTimelineCanShow = floor(self:GetHeight() / (lineHeight + linePadding)) - 1 + --for i = 1, math.min(#self.data.lines, howManyLinesTheTimelineCanShow) do + for i = 1, #self.data.lines do local line = self:GetLine(i) line.dataIndex = i --this index is used inside the line update function to know which data to get line.lineHeader:SetWidth(self.options.header_width) @@ -748,10 +869,28 @@ detailsFramework.TimeLineMixin = { local timelineHeader = { ---@param self df_timeline CreateDetachedHeader = function(self) - local headerFrame = CreateFrame("frame", nil, self, "BackdropTemplate") + local headerFrame = CreateFrame("scrollframe", nil, self, "BackdropTemplate") headerFrame:SetWidth(self.options.header_width) self.headerFrame = headerFrame - return headerFrame + + local headerBody = CreateFrame("frame", nil, headerFrame, "BackdropTemplate") + headerBody:SetSize(headerFrame:GetSize()) + headerBody.Lines = {} + headerFrame.body = headerBody + self.headerBody = headerBody + + headerFrame:SetScrollChild(headerBody) + headerBody.originalHeight = headerBody:GetHeight() + + local verticalSlider = CreateFrame("slider", nil, headerFrame) + headerFrame.verticalSlider = verticalSlider + verticalSlider:SetOrientation("vertical") + verticalSlider:SetValue(0) + verticalSlider:SetScript("OnValueChanged", function(self) + headerFrame:SetVerticalScroll(self:GetValue()) + end) + + return headerFrame, headerBody end, } @@ -809,6 +948,7 @@ function detailsFramework:CreateTimeLineFrame(parent, name, timelineOptions, ela --create elapsed time frame frameCanvas.elapsedTimeFrame = detailsFramework:CreateElapsedTimeFrame(frameBody, frameCanvas:GetName() and (frameCanvas:GetName() .. "ElapsedTimeFrame"), elapsedtimeOptions) + frameCanvas.elapsedTimeFrame:SetScrollChild(frameBody) local thumbColor = 0.95 local scrollBackgroudColor = {0.05, 0.05, 0.05, 0.7} @@ -902,6 +1042,9 @@ function detailsFramework:CreateTimeLineFrame(parent, name, timelineOptions, ela verticalSlider:SetValue(0) verticalSlider:SetScript("OnValueChanged", function(self) frameCanvas:SetVerticalScroll(self:GetValue()) + if (frameCanvas.options.header_detached) then + frameCanvas.headerFrame.verticalSlider:SetValue(self:GetValue()) + end end) --mouse scroll @@ -910,6 +1053,21 @@ function detailsFramework:CreateTimeLineFrame(parent, name, timelineOptions, ela local minValue, maxValue = horizontalSlider:GetMinMaxValues() local currentHorizontal = horizontalSlider:GetValue() + if (delta < 0) then + if (verticalSlider:IsShown()) then + local amountToScroll = frameBody:GetHeight() / 20 + verticalSlider:SetValue(verticalSlider:GetValue() + amountToScroll) + return + end + + elseif (delta > 0) then + if (verticalSlider:IsShown()) then + local amountToScroll = frameBody:GetHeight() / 20 + verticalSlider:SetValue(verticalSlider:GetValue() - amountToScroll) + return + end + end + if (IsShiftKeyDown() and delta < 0) then if (verticalSlider:IsShown()) then local amountToScroll = frameBody:GetHeight() / 20 @@ -941,7 +1099,6 @@ function detailsFramework:CreateTimeLineFrame(parent, name, timelineOptions, ela local scrolledWidth = horizontalSlider:GetValue() - currentHorizontal frameCanvas.scrolledWidth = scrolledWidth frameBody.scrolledWidth = scrolledWidth - end end) @@ -965,10 +1122,10 @@ function detailsFramework:CreateTimeLineFrame(parent, name, timelineOptions, ela frameBody:SetScript("OnUpdate", nil) end) - local headerFrame + local headerFrame, headerBody --if the header detached? if (timelineOptions.header_detached) then - headerFrame = timelineHeader.CreateDetachedHeader(frameCanvas) + headerFrame, headerBody = timelineHeader.CreateDetachedHeader(frameCanvas) end --create a resize button @@ -992,5 +1149,5 @@ function detailsFramework:CreateTimeLineFrame(parent, name, timelineOptions, ela frameCanvas:RefreshResize() frameCanvas:OnSizeChanged() - return frameCanvas, headerFrame + return frameCanvas, headerFrame, headerBody end \ No newline at end of file diff --git a/luaserver.lua b/luaserver.lua index c3108b49..e91d2ff1 100644 --- a/luaserver.lua +++ b/luaserver.lua @@ -831,6 +831,16 @@ LE_PARTY_CATEGORY_INSTANCE = true --functions C_ChatInfo = true +---@class classinfo : table +---@field classID number +---@field className string +---@field classFile string + +C_CreatureInfo = {} +---@param classId number +---@return classinfo +function C_CreatureInfo.GetClassInfo(classId) return {} end + C_Item = {} function C_Item.PickupItem() end function C_Item.IsBoundToAccountUntilEquip() end