From 0bd0343034a65aaa3f96debe50733704d1a9ed22 Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Tue, 19 Dec 2023 10:30:25 -0300 Subject: [PATCH] Framework Update --- Libs/DF/auras.lua | 200 -------------------------------------- Libs/DF/fw.lua | 2 +- Libs/DF/rounded_panel.lua | 6 +- boot.lua | 4 +- core/parser.lua | 4 +- 5 files changed, 11 insertions(+), 205 deletions(-) diff --git a/Libs/DF/auras.lua b/Libs/DF/auras.lua index 2f0b8059..494a281a 100644 --- a/Libs/DF/auras.lua +++ b/Libs/DF/auras.lua @@ -205,11 +205,7 @@ local aura_panel_defaultoptions = { } function DF:CreateAuraConfigPanel(parent, name, db, changeCallback, options, texts) - local options_text_template = DF:GetTemplate("font", "OPTIONS_FONT_TEMPLATE") local options_dropdown_template = DF:GetTemplate("dropdown", "OPTIONS_DROPDOWN_TEMPLATE") - local options_switch_template = DF:GetTemplate("switch", "OPTIONS_CHECKBOX_TEMPLATE") - local options_slider_template = DF:GetTemplate("slider", "OPTIONS_SLIDER_TEMPLATE") - local options_button_template = DF:GetTemplate("button", "OPTIONS_BUTTON_TEMPLATE") local newAuraPanel = CreateFrame("frame", name, parent, "BackdropTemplate") newAuraPanel.db = db @@ -629,202 +625,6 @@ function DF:CreateAuraConfigPanel(parent, name, db, changeCallback, options, tex local scrollWidth = 208 -do --deprecated, using a scrollbox tempate from scrollbox.lua - local scrollHeight = 343 - local lineAmount = 18 - local lineHeight = 18 - local backdropColor = {.8, .8, .8, 0.2} - local backdropColor_OnEnter = {.8, .8, .8, 0.4} - - --aura scroll box default settings - local auraScrollDefaultSettings = { - show_spell_tooltip = false, - line_height = 18, - line_amount = 18, - } - - local autoTrackList_LineOnEnter = function(self, capsule, value) - local flag = self.Flag - value = value or self.SpellID - - if not flag then - GameCooltip2:Preset(2) - GameCooltip2:SetOwner(self, "left", "right", 2, 0) - GameCooltip2:SetOption("TextSize", 10) - - local spellName, _, spellIcon = GetSpellInfo(value) - if (spellName) then - GameCooltip2:AddLine(spellName .. "(" .. value .. ")") - GameCooltip2:AddIcon(spellIcon, 1, 1, 14, 14, .1, .9, .1, .9) - end - GameCooltip2:Show() - - else - local spellName, _, spellIcon = GetSpellInfo(value) - if (spellName and spellsWithSameName) then - local spellNameLower = spellName:lower() - local sameNameSpells = spellsWithSameName[spellNameLower] - - if (sameNameSpells) then - GameCooltip2:Preset(2) - GameCooltip2:SetOwner(self, "left", "right", 2, 0) - GameCooltip2:SetOption("TextSize", 10) - - for i, spellId in ipairs(sameNameSpells) do - GameCooltip2:AddLine(spellName .. " (" .. spellId .. ")") - GameCooltip2:AddIcon(spellIcon, 1, 1, 14, 14, .1, .9, .1, .9) - end - - GameCooltip2:Show() - end - end - end - end - - local autoTrackList_LineOnLeave = function() - GameCooltip2:Hide() - end - - - local createAuraScrollBox = function(scrollBoxParent, scrollBoxName, scrollBoxParentKey, scrollBoxTitle, databaseTable, removeAuraFunc, options) - local scrollOptions = {} - detailsFramework.OptionsFunctions.BuildOptionsTable(scrollOptions, auraScrollDefaultSettings, options) - - local updateFunc = function(self, data, offset, totalLines) - for i = 1, totalLines do - local index = i + offset - local auraTable = data[index] - if (auraTable) then - local line = self:GetLine(i) - local spellId, spellName, spellIcon, lowerSpellName, flag = unpack(auraTable) - - line.SpellID = spellId - line.SpellName = spellName - line.SpellNameLower = lowerSpellName - line.SpellIcon = spellIcon - line.Flag = flag - - if (flag) then - line.name:SetText(spellName) - else - line.name:SetText(spellName .. "(" .. spellId .. ")") - end - - line.icon:SetTexture(spellIcon) - line.icon:SetTexCoord(.1, .9, .1, .9) - end - end - end - - local auraLineOnEnter = function(line) - if (scrollOptions.options.show_spell_tooltip and line.SpellID and GetSpellInfo(line.SpellID)) then - GameTooltip:SetOwner(line, "ANCHOR_CURSOR") - GameTooltip:SetSpellByID(line.SpellID) - GameTooltip:AddLine(" ") - GameTooltip:Show() - end - - line:SetBackdropColor(unpack(backdropColor_OnEnter)) - end - - local auraLineOnLeave = function(self) - self:SetBackdropColor(unpack(backdropColor)) - GameTooltip:Hide() - end - - local onAuraRemoveButtonClick = function(self) - local spellId = self:GetParent().SpellID - databaseTable[spellId] = nil - databaseTable["" .. (spellId or "")] = nil -- cleanup... - scrollBoxParent[scrollBoxParentKey]:Refresh() - if (removeAuraFunc) then --upvalue - detailsFramework:QuickDispatch(removeAuraFunc) - end - end - - local createLineFunc = function(self, index) - local line = CreateFrame("button", "$parentLine" .. index, self, "BackdropTemplate") - local lineHeight = scrollOptions.options.line_height - - line:SetPoint("topleft", self, "topleft", 1, -((index - 1) * (lineHeight + 1)) - 1) - line:SetSize(scrollWidth - 2, lineHeight) - line:SetScript("OnEnter", autoTrackList_LineOnEnter) - line:HookScript("OnEnter", auraLineOnEnter) - line:SetScript("OnLeave", autoTrackList_LineOnLeave) - line:HookScript("OnLeave", auraLineOnLeave) - - line:SetBackdrop({bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true}) - line:SetBackdropColor(unpack(backdropColor)) - - local icon = line:CreateTexture("$parentIcon", "overlay") - icon:SetSize(lineHeight - 2, lineHeight - 2) - - local name = line:CreateFontString("$parentName", "overlay", "GameFontNormal") - DF:SetFontSize(name, 10) - - local removeButton = CreateFrame("button", "$parentRemoveButton", line, "UIPanelCloseButton") - removeButton:SetSize(16, 16) - removeButton:SetScript("OnClick", onAuraRemoveButtonClick) - removeButton:SetPoint("topright", line, "topright") - removeButton:GetNormalTexture():SetDesaturated(true) - - icon:SetPoint("left", line, "left", 2, 0) - name:SetPoint("left", icon, "right", 3, 0) - - line.icon = icon - line.name = name - line.removebutton = removeButton - - return line - end - - local auraScrollBox = DF:CreateScrollBox(scrollBoxParent, scrollBoxName, updateFunc, databaseTable, scrollWidth, scrollHeight, scrollOptions.options.line_amount, scrollOptions.options.line_height) - DF:ReskinSlider(auraScrollBox) - scrollBoxParent[scrollBoxParentKey] = auraScrollBox - auraScrollBox.OriginalData = databaseTable - - function auraScrollBox:Refresh() - local t = {} - local added = {} - for spellID, flag in pairs(auraScrollBox.OriginalData) do - local spellName, _, spellIcon = GetSpellInfo(spellID) - if (spellName and not added[tonumber(spellID) or 0]) then - local lowerSpellName = spellName:lower() - tinsert(t, {spellID, spellName, spellIcon, lowerSpellName, flag}) - added[tonumber(spellID) or 0] = true - end - end - - table.sort(t, function(t1, t2) return t1[4] < t2[4] end) - - self:SetData(t) - self:Refresh() - end - - function auraScrollBox:DoSetData(newDB) - self:SetData(newDB) - self.OriginalData = newDB - if (self.Refresh) then - self:Refresh() - else - self:Refresh() - end - end - - local titleLabel = DF:CreateLabel(scrollBoxParent, scrollBoxTitle) - titleLabel.textcolor = "silver" - titleLabel.textsize = 10 - titleLabel:SetPoint("bottomleft", auraScrollBox, "topleft", 0, 2) - - for i = 1, lineAmount do - auraScrollBox:CreateLine(createLineFunc) - end - - auraScrollBox:Refresh() - return auraScrollBox - end -end - local onAuraRemoveCallback = function() if (changeCallback) then DF:QuickDispatch(changeCallback) diff --git a/Libs/DF/fw.lua b/Libs/DF/fw.lua index bf68ad87..408cf221 100644 --- a/Libs/DF/fw.lua +++ b/Libs/DF/fw.lua @@ -1,6 +1,6 @@ -local dversion = 492 +local dversion = 493 local major, minor = "DetailsFramework-1.0", dversion local DF, oldminor = LibStub:NewLibrary(major, minor) diff --git a/Libs/DF/rounded_panel.lua b/Libs/DF/rounded_panel.lua index 86908c91..f782630f 100644 --- a/Libs/DF/rounded_panel.lua +++ b/Libs/DF/rounded_panel.lua @@ -543,7 +543,10 @@ function detailsFramework:CreateRoundedPanel(parent, name, optionsTable) if (newRoundedPanel.options.use_titlebar) then ---@type df_roundedpanel - local titleBar = detailsFramework:CreateRoundedPanel(newRoundedPanel, "$parentTitleBar", {height = newRoundedPanel.options.titlebar_height}) + local titleBar = newRoundedPanel:CreateTitleBar(newRoundedPanel.options) + + --[=[ + local titleBar = detailsFramework:CreateRoundedPanel(newRoundedPanel, "$parentTitleBar", {height = newRoundedPanel.options.titlebar_height, title = newRoundedPanel.options.title}) titleBar:SetColor(unpack(titleBarColor)) titleBar:SetPoint("top", newRoundedPanel, "top", 0, -7) @@ -552,6 +555,7 @@ function detailsFramework:CreateRoundedPanel(parent, name, optionsTable) newRoundedPanel.TitleBar = titleBar titleBar:SetRoundness(5) newRoundedPanel.bHasTitleBar = true + --]=] end if (newRoundedPanel.options.use_scalebar) then diff --git a/boot.lua b/boot.lua index 82466141..26c7b57f 100644 --- a/boot.lua +++ b/boot.lua @@ -13,8 +13,8 @@ local addonName, Details222 = ... local version, build, date, tocversion = GetBuildInfo() - Details.build_counter = 12109 - Details.alpha_build_counter = 12109 --if this is higher than the regular counter, use it instead + Details.build_counter = 12111 + Details.alpha_build_counter = 12111 --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/core/parser.lua b/core/parser.lua index 3617d075..da21c753 100755 --- a/core/parser.lua +++ b/core/parser.lua @@ -1340,7 +1340,7 @@ local tierPieceMultiplier = 1 --bHasFourPieces and 1.08 or 1 local evokerItemLevel = gearCache[evokerSourceSerial] and gearCache[evokerSourceSerial].ilevel or 400 evokerItemLevel = max(evokerItemLevel, 400) - local itemLevelMultiplier = 1 + ((evokerItemLevel - 400) * 0.01) + local itemLevelMultiplier = 1 + ((evokerItemLevel - 400) * 0.006) local predictedAmount = 0 if (Details.zone_type == "raid") then --0x410b @@ -7284,3 +7284,5 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1 end end end + +