From db15d824fa4ba80e7bcdc30d126e52b001f36dc9 Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Wed, 31 Jul 2024 22:55:52 -0300 Subject: [PATCH] Fixed two errors --- WorldQuestTracker_MapAPI.lua | 2 ++ WorldQuestTracker_ZoneMap.lua | 2 ++ libs/DF/buildmenu.lua | 31 ++++++++++++++++--- libs/DF/button.lua | 2 +- libs/DF/charts.lua | 34 +++++++++++++++++++++ libs/DF/definitions.lua | 5 ++- libs/DF/fw.lua | 57 ++++++++++++++++++++++++++--------- libs/DF/slider.lua | 1 + libs/DF/textentry.lua | 41 ++++++++++++++++++++++++- luaserver.lua | 23 ++++++++++---- 10 files changed, 168 insertions(+), 30 deletions(-) diff --git a/WorldQuestTracker_MapAPI.lua b/WorldQuestTracker_MapAPI.lua index 82a4a3aa..a67c14b2 100644 --- a/WorldQuestTracker_MapAPI.lua +++ b/WorldQuestTracker_MapAPI.lua @@ -14,6 +14,8 @@ if (not DF) then return end +local GetItemInfo = C_Item and C_Item.GetItemInfo or GetItemInfo + --localization local L = DF.Language.GetLanguageTable(addonId) diff --git a/WorldQuestTracker_ZoneMap.lua b/WorldQuestTracker_ZoneMap.lua index 8867d92c..28f0b4f5 100644 --- a/WorldQuestTracker_ZoneMap.lua +++ b/WorldQuestTracker_ZoneMap.lua @@ -1941,6 +1941,8 @@ if (bountyBoard) then local UpdateBountyBoard = function(self, mapID) + do return end + if (WorldMapFrame.mapID == 905) then --argus --the bounty board in argus is above the world quest tracker widgets C_Timer.After(0.5, function() diff --git a/libs/DF/buildmenu.lua b/libs/DF/buildmenu.lua index 7b7351ba..9bcfb86a 100644 --- a/libs/DF/buildmenu.lua +++ b/libs/DF/buildmenu.lua @@ -141,11 +141,16 @@ local onLeaveHighlight = function(self) end end +--control the highlight color, if true, use color one, if false, use color two +--color one: .2, .2, .2, 0.5 +--color two: .3, .3, .3, 0.5 +local bHighlightColorOne = true + ---create a button and a texture to highlight the button when the mouse is over it ---the button has the dimentions of the label and the widget ---@param frame frame ---@param label fontstring ----@param widgetWidth nunmber +---@param widgetWidth number ---@return unknown local createOptionHighlightFrame = function(frame, label, widgetWidth) frame = frame.widget or frame @@ -163,13 +168,22 @@ local createOptionHighlightFrame = function(frame, label, widgetWidth) local highlightTexture = highlightFrame:CreateTexture(nil, "overlay") highlightTexture:SetColorTexture(1, 1, 1, 0.1) + PixelUtil.SetPoint(highlightTexture, "topleft", highlightFrame, "topleft", 0, 0) PixelUtil.SetPoint(highlightTexture, "bottomright", highlightFrame, "bottomright", 0, 0) highlightTexture:Hide() local backgroundTexture = highlightFrame:CreateTexture(nil, "artwork") - backgroundTexture:SetColorTexture(1, 1, 1) + backgroundTexture:SetColorTexture(1, 1, 1, 0.5) backgroundTexture:SetVertexColor(.25, .25, .25, 0.5) + + if (bHighlightColorOne) then + backgroundTexture:SetVertexColor(.2, .2, .2, 0.5) + else + backgroundTexture:SetVertexColor(.25, .25, .25, 0.5) + end + bHighlightColorOne = not bHighlightColorOne + PixelUtil.SetPoint(backgroundTexture, "topleft", highlightFrame, "topleft", 0, 0) PixelUtil.SetPoint(backgroundTexture, "bottomright", highlightFrame, "bottomright", 0, 0) @@ -536,13 +550,16 @@ local setColorProperties = function(parent, widget, widgetTable, currentXOffset, label:ClearAllPoints() if (bAlignAsPairs) then - PixelUtil.SetPoint(label, "topleft", widget:GetParent(), "topleft", currentXOffset, currentYOffset) - PixelUtil.SetPoint(widget.widget, "left", label, "left", nAlignAsPairsLength, 0) - if (not widget.highlightFrame) then local highlightFrame = createOptionHighlightFrame(widget, label, (widgetWidth or 140) + nAlignAsPairsLength + 5) widget.highlightFrame = highlightFrame end + + ---- + widget._valueChangeHook = valueChangeHook + --widget.highlightFrame:SetScript("OnClick", highlightFrameOnClickToggle) --todo make this function for color picker color pick start + PixelUtil.SetPoint(label, "topleft", widget:GetParent(), "topleft", currentXOffset, currentYOffset) + PixelUtil.SetPoint(widget.widget, "right", widget.highlightFrame, "right", -3, 0) else if (widgetTable.boxfirst or bUseBoxFirstOnAllWidgets) then label:SetPoint("left", widget.widget, "right", 2, 0) @@ -1055,6 +1072,8 @@ function detailsFramework:BuildMenuVolatile(parent, menuOptions, xOffset, yOffse end detailsFramework:ClearOptionsPanel(parent) + bHighlightColorOne = true + local amountLineWidgetAdded = 0 local biggestColumnHeight = 0 --used to resize the scrollbox child when a scrollbox is passed local latestInlineWidget @@ -1323,6 +1342,8 @@ function detailsFramework:BuildMenu(parent, menuOptions, xOffset, yOffset, heigh local maxColumnWidth = 0 --biggest width of widget + text size on the current column loop pass local maxWidgetWidth = 0 --biggest widget width on the current column loop pass + bHighlightColorOne = true + --parse settings and the options table parseOptionsTypes(menuOptions) diff --git a/libs/DF/button.lua b/libs/DF/button.lua index 1eca3f7c..bd56b5bc 100644 --- a/libs/DF/button.lua +++ b/libs/DF/button.lua @@ -1332,7 +1332,7 @@ detailsFramework.TabButtonMixin = { ---@return df_tabbutton function detailsFramework:CreateTabButton(parent, frameName) ---@type df_tabbutton - local tabButton = CreateFrame("button", frameName, parent) + local tabButton = CreateFrame("button", frameName, parent, "BackdropTemplate") tabButton:SetSize(50, 20) tabButton.bIsSelected = false diff --git a/libs/DF/charts.lua b/libs/DF/charts.lua index 27d0ac76..ba3bc517 100644 --- a/libs/DF/charts.lua +++ b/libs/DF/charts.lua @@ -87,6 +87,11 @@ end ---@field lines line[] ---@field fixedLineWidth number ---@field chartName string +---@field dataPoint_OnEnterFunc fun(self: df_chart, onEnterFunc: function, ...) set the function to be called when the mouse hover over a data point in the chart +---@field dataPoint_OnEnterPayload any[] set the payload to be passed to the function set by DataPoint_OnEnterFunc +---@field dataPoint_OnLeaveFunc fun(self: df_chart, onLeaveFunc: function, ...) set the function to be called when the mouse leaves a data point in the chart +---@field dataPoint_OnLeavePayload any[] set the payload to be passed to the function set by DataPoint_OnLeaveFunc +---@field GetOnEnterLeaveFunctions fun(self: df_chart) : function, any[], function, any[] return the functions and payloads set by DataPoint_OnEnterFunc and DataPoint_OnLeaveFunc ---@field ChartFrameConstructor fun(self: df_chart) set the default values for the chart frame ---@field GetLine fun(self: df_chart) : line return a line and also internally handle next line ---@field GetLines fun(self: df_chart) : line[] return a table with all lines already created @@ -684,6 +689,31 @@ detailsFramework.ChartFrameMixin = { self:UpdateFrameSizeCache() end, + ---when the mouse hover over a data point in the chart, this function will be called + ---@param self df_chart + SetOnEnterFunction = function(self, onEnterFunc, ...) + self.dataPoint_OnEnterFunc = onEnterFunc + self.dataPoint_OnEnterPayload = {...} + end, + + ---when the mouse leaves a data point in the chart, this function will be called + ---@param self df_chart + SetOnLeaveFunction = function(self, onLeaveFunc, ...) + self.dataPoint_OnLeaveFunc = onLeaveFunc + self.dataPoint_OnLeavePayload = {...} + end, + + ---get the data point on enter and on leave function + ---@param self df_chart + ---@return function onEnterFunc + ---@return any[] onEnterPayload + ---@return function onLeaveFunc + ---@return any[] onLeavePayload + GetOnEnterLeaveFunctions = function(self) + return self.dataPoint_OnEnterFunc, self.dataPoint_OnEnterPayload, self.dataPoint_OnLeaveFunc, self.dataPoint_OnLeavePayload + end, + + ---this function will draw the chart lines ---@param self df_chart ---@param yPointScale number|nil ---@param bUpdateLabels boolean|nil @@ -709,6 +739,8 @@ detailsFramework.ChartFrameMixin = { self:ResetDataIndex() + print(maxLines) + for i = 1, maxLines do local line = self:GetLine() @@ -798,6 +830,8 @@ local createChartFrame = function(parent, name) return chartFrame end + + function detailsFramework:CreateGraphicLineFrame(parent, name) ---@type df_chart local newGraphicFrame = createChartFrame(parent, name) diff --git a/libs/DF/definitions.lua b/libs/DF/definitions.lua index 0c9ad3fe..07128d27 100644 --- a/libs/DF/definitions.lua +++ b/libs/DF/definitions.lua @@ -330,10 +330,9 @@ ---@field CreateSearchBox fun(self:table, parent:frame, callback:function) : df_searchbox ---@field ConvertAnchorPointToInside fun(self:table, anchorPoint:anchorid) : anchorid ---@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 - - --[=[ 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 85d438ce..07964f4d 100644 --- a/libs/DF/fw.lua +++ b/libs/DF/fw.lua @@ -1,6 +1,6 @@ -local dversion = 552 +local dversion = 556 local major, minor = "DetailsFramework-1.0", dversion local DF, oldminor = LibStub:NewLibrary(major, minor) @@ -113,13 +113,13 @@ end ---return if the wow version the player is playing is dragonflight or an expansion after it ---@return boolean function DF.IsDragonflightAndBeyond() - return 110000 >= 100000 + return buildInfo >= 100000 end ---return true if the wow version is Dragonflight or below ---@return boolean function DF.IsDragonflightOrBelow() - return 110000 < 110000 + return buildInfo < 110000 end ---return if the wow version the player is playing is a classic version of wow @@ -2801,6 +2801,9 @@ local templateOnLeave = function(frame) end end +DF.TemplateOnEnter = templateOnEnter +DF.TemplateOnLeave = templateOnLeave + ---set a details framework template into a regular frame ---@param self table ---@param frame uiobject @@ -2911,8 +2914,10 @@ 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["OPTIONS_FONT_TEMPLATE"] = {color = "yellow", size = 9.6, font = DF:GetBestFontForLanguage()} +--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["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()} --dropdowns @@ -2926,10 +2931,11 @@ DF.dropdown_templates["OPTIONS_DROPDOWN_TEMPLATE"] = { tile = true }, - backdropcolor = {1, 1, 1, .7}, - backdropbordercolor = {0, 0, 0, 1}, - onentercolor = {1, 1, 1, .9}, - onenterbordercolor = {1, 1, 1, 1}, + --backdropcolor = {0.1, 0.1, 0.1, .7}, + backdropcolor = {0.2, 0.2, 0.2, .7}, + onentercolor = {0.3, 0.3, 0.3, .7}, + backdropbordercolor = {0, 0, 0, .4}, + onenterbordercolor = {0.3, 0.3, 0.3, 0.8}, dropicon = "Interface\\BUTTONS\\arrow-Down-Down", dropiconsize = {16, 16}, @@ -3051,14 +3057,37 @@ DF.button_templates["STANDARD_GRAY"] = { DF.slider_templates = DF.slider_templates or {} DF.slider_templates["OPTIONS_SLIDER_TEMPLATE"] = { backdrop = {edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true}, - backdropcolor = {1, 1, 1, .5}, - backdropbordercolor = {0, 0, 0, 1}, - onentercolor = {1, 1, 1, .5}, - onenterbordercolor = {1, 1, 1, 1}, + + --original color wow10: + --backdropcolor = {1, 1, 1, .5}, + --backdropbordercolor = {0, 0, 0, 1}, + --onentercolor = {1, 1, 1, .5}, + --onenterbordercolor = {1, 1, 1, 1}, + + backdropcolor = {0.2, 0.2, 0.2, .7}, + onentercolor = {0.3, 0.3, 0.3, .7}, + backdropbordercolor = {0, 0, 0, .4}, --0.7 original alpha wow10 + onenterbordercolor = {0.3, 0.3, 0.3, 0.8}, + thumbtexture = [[Interface\Tooltips\UI-Tooltip-Background]], thumbwidth = 16, thumbheight = 14, - thumbcolor = {0, 0, 0, 0.5}, + --thumbcolor = {0, 0, 0, 0.5}, + thumbcolor = {.8, .8, .8, 0.5}, +} + +DF.slider_templates["OPTIONS_SLIDERDARK_TEMPLATE"] = { + backdrop = {edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true}, + + backdropcolor = {0.05, 0.05, 0.05, .7}, + onentercolor = {0.3, 0.3, 0.3, .7}, + backdropbordercolor = {0, 0, 0, 1}, + onenterbordercolor = {0, 0, 0, 1}, + + thumbtexture = [[Interface\Tooltips\UI-Tooltip-Background]], + thumbwidth = 24, + thumbheight = 14, + thumbcolor = {.8, .8, .8, 0.5}, } DF.slider_templates["MODERN_SLIDER_TEMPLATE"] = { diff --git a/libs/DF/slider.lua b/libs/DF/slider.lua index 3f991a90..0e21d353 100644 --- a/libs/DF/slider.lua +++ b/libs/DF/slider.lua @@ -1170,6 +1170,7 @@ end --DF:Mixin(DFSliderMetaFunctions, DF.TooltipHandlerMixin) ---@class df_slider : slider, df_scripthookmixin, df_widgets +---@field tooltip string? ---@field widget slider ---@field slider slider ---@field type string diff --git a/libs/DF/textentry.lua b/libs/DF/textentry.lua index e76ce3eb..4ae69b6d 100644 --- a/libs/DF/textentry.lua +++ b/libs/DF/textentry.lua @@ -287,7 +287,12 @@ detailsFramework.TextEntryCounter = detailsFramework.TextEntryCounter or 1 if (textentry:IsEnabled()) then textentry.current_bordercolor = textentry.current_bordercolor or {textentry:GetBackdropBorderColor()} - textentry:SetBackdropBorderColor(1, 1, 1, 1) + local onEnterBorderColor = object.onenter_backdrop_border_color + if (onEnterBorderColor) then + textentry:SetBackdropBorderColor(detailsFramework:ParseColors(onEnterBorderColor)) + else + textentry:SetBackdropBorderColor(1, 1, 1, 0.6) + end end end @@ -522,11 +527,13 @@ function TextEntryMetaFunctions:SetTemplate(template) if (template.backdrop) then self.editbox:SetBackdrop(template.backdrop) end + if (template.backdropcolor) then local r, g, b, a = detailsFramework:ParseColors(template.backdropcolor) self.editbox:SetBackdropColor(r, g, b, a) self.onleave_backdrop = {r, g, b, a} end + if (template.backdropbordercolor) then local r, g, b, a = detailsFramework:ParseColors(template.backdropbordercolor) self.editbox:SetBackdropBorderColor(r, g, b, a) @@ -536,8 +543,40 @@ function TextEntryMetaFunctions:SetTemplate(template) self.editbox.current_bordercolor[4] = a self.onleave_backdrop_border_color = {r, g, b, a} end + + if (template.onentercolor) then + local r, g, b, a = detailsFramework:ParseColors(template.onentercolor) + self.onenter_backdrop = {r, g, b, a} + self:HookScript("OnEnter", detailsFramework.TemplateOnEnter) + self.__has_onentercolor_script = true + end + + if (template.onleavecolor) then + local r, g, b, a = detailsFramework:ParseColors(template.onleavecolor) + self.onleave_backdrop = {r, g, b, a} + self:HookScript("OnLeave", detailsFramework.TemplateOnLeave) + self.__has_onleavecolor_script = true + end + + if (template.onenterbordercolor) then + local r, g, b, a = detailsFramework:ParseColors(template.onenterbordercolor) + self.onenter_backdrop_border_color = {r, g, b, a} + if (not self.__has_onentercolor_script) then + self:HookScript("OnEnter", detailsFramework.TemplateOnEnter) + end + end + + if (template.onleavebordercolor) then + local r, g, b, a = detailsFramework:ParseColors(template.onleavebordercolor) + self.onleave_backdrop_border_color = {r, g, b, a} + if (not self.__has_onleavecolor_script) then + self:HookScript("OnLeave", detailsFramework.TemplateOnLeave) + end + end end +--TextEntryMetaFunctions.SetTemplate = DetailsFramework.SetTemplate + ------------------------------------------------------------------------------------------------------------ --object constructor diff --git a/luaserver.lua b/luaserver.lua index 72cfa2a8..7122df60 100644 --- a/luaserver.lua +++ b/luaserver.lua @@ -822,7 +822,17 @@ function C_Item.IsBoundToAccountUntilEquip() end function C_Item.LockItem() end function C_Item.DoesItemMatchTargetEnchantingSpell() end function C_Item.IsItemCorruptionRelated() end -function C_Item.GetItemIconByID() end + +---return the item's icon texture +---@param itemInfo number|string +---@return number +function C_Item.GetItemIconByID(itemInfo) return 0 end + +---return the item's icon texture +---@param itemLocation table +---@return number +function C_Item.GetItemIcon(itemLocation) return 0 end + function C_Item.ConfirmOnUse() end function C_Item.GetItemIDForItemInfo() end function C_Item.IsCorruptedItem() end @@ -879,7 +889,6 @@ function C_Item.GetItemClassInfo() end function C_Item.GetItemUniquenessByID() end function C_Item.GetItemGemID() end function C_Item.IsHarmfulItem() end -function C_Item.GetItemIcon() end function C_Item.DropItemOnUnit() end ---@param itemInfo number|string @@ -3707,9 +3716,9 @@ GuildUninvite = function(unit) end ---@return boolean IsGuildLeader = function(unit) return true end ----@param unit string +---return true if the player is in a guild ---@return boolean -IsInGuild = function(unit) return true end +IsInGuild = function() return true end ---@param eventIndex number QueryGuildEventLog = function(eventIndex) end @@ -5737,9 +5746,11 @@ function FocusUnit(unit) end function ClearFocus() end ----@param unit string +---if bFullName is true, return the full name of the unit if the unit is from another realm, otherwise return the short name +---@param unit unit +---@param bFullName boolean ---@return string -function GetUnitName(unit) return "" end +function GetUnitName(unit, bFullName) return "" end ---@param unit string ---@return number