Skip to content

Commit

Permalink
Improve search in Loot Edit window
Browse files Browse the repository at this point in the history
  • Loading branch information
Anonomit committed Apr 10, 2024
1 parent c9b358f commit 7d39dc2
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Windows/ServerLootEditWindow.lua
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,16 @@ function LootReserve.Server.LootEdit:UpdateLootList()
end
end
elseif self.SelectedCategory and self.SelectedCategory.SearchResults and filter then
local alreadyFoundIDs = { };
for itemID, conditions in pairs(LootReserve.Server:GetNewSessionItemConditions()) do
if tonumber(itemID) then
if itemID ~= 0 and conditions.Custom then
if itemID ~= 0 and conditions.Custom and not alreadyFoundIDs[itemID] then
local match = false;
local item = LootReserve.ItemCache:Item(itemID);
if item:IsCached() then
if matchesFilter(item, filter) then
createFrame(item, "Custom Item");
alreadyFoundIDs[itemID] = true;
match = true;
end
elseif item:Exists() then
Expand All @@ -161,6 +163,7 @@ function LootReserve.Server.LootEdit:UpdateLootList()
if reward:IsCached() then
if item:IsCached() and matchesFilter(reward, filter) then
createFrame(item, "Custom Item");
alreadyFoundIDs[itemID] = true;
break;
end
elseif reward:Exists() then
Expand All @@ -180,12 +183,13 @@ function LootReserve.Server.LootEdit:UpdateLootList()
end
if child.Loot then
for _, itemID in ipairs(child.Loot) do
if itemID ~= 0 then
if itemID ~= 0 and not alreadyFoundIDs[itemID] then
local match = false;
local item = LootReserve.ItemCache:Item(itemID);
if item:IsCached() then
if matchesFilter(item, filter, category.Name, child.Name) then
createFrame(item, child.IndentType == 1 and format("%s > %s > %s", category.NameShort, parentCategoryName, child.Name) or format("%s > %s", category.NameShort, child.Name));
alreadyFoundIDs[itemID] = true;
match = true;
end
elseif item:Exists() then
Expand All @@ -197,6 +201,7 @@ function LootReserve.Server.LootEdit:UpdateLootList()
if reward:IsCached() then
if item:IsCached() and matchesFilter(reward, filter, category.Name, child.Name) then
createFrame(item, child.IndentType == 1 and format("%s > %s > %s", category.NameShort, parentCategoryName, child.Name) or format("%s > %s", category.NameShort, child.Name));
alreadyFoundIDs[itemID] = true;
break;
end
elseif reward:Exists() then
Expand Down

0 comments on commit 7d39dc2

Please sign in to comment.