From 1f66daabc9fad222c8e5d6ea350cc28e581c3175 Mon Sep 17 00:00:00 2001 From: Infus Date: Thu, 26 Oct 2023 00:29:01 +0200 Subject: [PATCH] IconPicker: If a spell id is entered, show the icon for that spell id Instead of the current behaviour of searching for the name of the spell and then showing all icons that match the name. I don't think anyone will miss that behaviour. Fixes: #4667 --- WeakAurasOptions/OptionsFrames/IconPicker.lua | 30 +++++++++++-------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/WeakAurasOptions/OptionsFrames/IconPicker.lua b/WeakAurasOptions/OptionsFrames/IconPicker.lua index e1ea0707a9..7336e97c3d 100644 --- a/WeakAurasOptions/OptionsFrames/IconPicker.lua +++ b/WeakAurasOptions/OptionsFrames/IconPicker.lua @@ -32,18 +32,6 @@ local function ConstructIconPicker(frame) local function iconPickerFill(subname, doSort) scroll:ReleaseChildren(); - -- Work around special numbers such as inf and nan - if (tonumber(subname)) then - local spellId = tonumber(subname); - if (abs(spellId) < math.huge and tostring(spellId) ~= "nan") then - subname = GetSpellInfo(spellId) - end - end - - if subname then - subname = subname:lower(); - end - local usedIcons = {}; local AddButton = function(name, icon) local button = AceGUI:Create("WeakAurasIconButton"); @@ -57,6 +45,24 @@ local function ConstructIconPicker(frame) usedIcons[icon] = true; end + -- Work around special numbers such as inf and nan + if (tonumber(subname)) then + local spellId = tonumber(subname); + if (abs(spellId) < math.huge and tostring(spellId) ~= "nan") then + local name, _, icon = GetSpellInfo(spellId) + if name then + AddButton(name, icon) + end + return; + end + end + + if subname then + subname = subname:lower(); + end + + + local num = 0; if(subname and subname ~= "") then for name, icons in pairs(spellCache.Get()) do