diff --git a/Cache.lua b/Cache.lua index 1816fed..23615f1 100644 --- a/Cache.lua +++ b/Cache.lua @@ -4,6 +4,7 @@ local Private = select(2, ...) ---@class CacheItemInfo ---@field name string ---@field link string +---@field quality string ---@field icon number ---@field type number ---@field subType number diff --git a/Core.lua b/Core.lua index 81d68cc..358c488 100644 --- a/Core.lua +++ b/Core.lua @@ -268,12 +268,17 @@ local function createFrame() for itemIndex, itemInfo in ipairs(socketTypeData) do local cachedInfo = cache:GetItemInfo(itemInfo.itemID) if not cachedInfo then return end + local txt = cachedInfo.name + if itemInfo.gemType == "Prismatic" then + txt = gemUtil:GetGemStats(cachedInfo.description) + end dataProvider:Insert({ id = itemInfo.itemID, icon = cachedInfo.icon, - text = cachedInfo.name, + text = txt or "", index = itemIndex, - info = itemInfo + info = itemInfo, + cachedInfo = cachedInfo, }) end end @@ -338,6 +343,7 @@ end local eventFrame = CreateFrame("Frame") eventFrame:RegisterEvent("PLAYER_ENTERING_WORLD") +---@diagnostic disable-next-line: param-type-mismatch eventFrame:RegisterEvent("SCRAPPING_MACHINE_ITEM_ADDED") eventFrame:SetScript("OnEvent", function(_, event) if event == "SCRAPPING_MACHINE_ITEM_ADDED" then diff --git a/GemUtil.lua b/GemUtil.lua index a0e1258..9e34f15 100644 --- a/GemUtil.lua +++ b/GemUtil.lua @@ -233,3 +233,11 @@ function gemUtil:GetFilteredGems(socketTypeFilter, nameFilter) end return validGems end + +function gemUtil:GetGemStats(description) + local stat = "" + if description and type(description) == "string" then + stat = description:match("%++[^\n]+") + end + return stat +end \ No newline at end of file diff --git a/Misc.lua b/Misc.lua index fc65356..8e056a5 100644 --- a/Misc.lua +++ b/Misc.lua @@ -46,5 +46,8 @@ end function misc.ItemSorting(a, b) local cachedA = cache:GetItemInfo(a.itemID) local cachedB = cache:GetItemInfo(b.itemID) + if cachedA.quality ~= cachedB.quality then + return cachedA.quality > cachedB.quality + end return cachedA.name < cachedB.name end diff --git a/UIElements.lua b/UIElements.lua index 0f5dcb3..80a4d5a 100644 --- a/UIElements.lua +++ b/UIElements.lua @@ -80,6 +80,7 @@ end function uiElements:CreateCheckButton(parent, data) local checkButton = CreateFrame("CheckButton", nil, parent, "ChatConfigCheckButtonTemplate") +---@diagnostic disable-next-line: deprecated checkButton:SetPoint(unpack(data.point)) checkButton.Text:SetText(data.text) checkButton.tooltip = data.tooltip @@ -121,6 +122,7 @@ function uiElements:CreateDropdown(parent, data) dropDown.selectionCallback = data.selectionCallback dropDown.selection = nil for _, point in ipairs(data.points) do +---@diagnostic disable-next-line: deprecated dropDown:SetPoint(unpack(point)) end @@ -135,6 +137,9 @@ function uiElements:CreateDropdown(parent, data) end end dropDown.SetValue = function (selectionValue, selectionIndex) + ---@class dropdownRow + ---@field value number + ---@cast selectionValue dropdownRow dropDown:UpdateSelection(selectionIndex, selectionValue.value) end