Skip to content

Commit

Permalink
IconPicker: If a spell id is entered, show the icon for that spell id
Browse files Browse the repository at this point in the history
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: WeakAuras#4667
  • Loading branch information
InfusOnWoW committed Oct 26, 2023
1 parent 5347557 commit 1f66daa
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions WeakAurasOptions/OptionsFrames/IconPicker.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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
Expand Down

0 comments on commit 1f66daa

Please sign in to comment.