From 423aee1e97839edd17db92d7eb34440c02b6ec8d Mon Sep 17 00:00:00 2001 From: Anch Date: Thu, 3 Nov 2022 01:33:31 +1300 Subject: [PATCH] tweaked filter --- AtlasLoot/Core/AtlasLoot.lua | 4 ++-- AtlasLoot/Core/Filter.lua | 26 +++++++++++++++++++------- AtlasLoot/Core/Options.lua | 2 ++ AtlasLoot/Locales/constants.en.lua | 3 +++ 4 files changed, 26 insertions(+), 9 deletions(-) diff --git a/AtlasLoot/Core/AtlasLoot.lua b/AtlasLoot/Core/AtlasLoot.lua index 0b19cae..eec86a5 100644 --- a/AtlasLoot/Core/AtlasLoot.lua +++ b/AtlasLoot/Core/AtlasLoot.lua @@ -135,7 +135,7 @@ function AtlasLoot:OnEnable() if not AtlasLootCharDB["QuickLooks"] then AtlasLootCharDB["QuickLooks"] = {} end if not AtlasLootCharDB.SelectedFilter then AtlasLootCharDB.SelectedFilter = 1 end if not AtlasLootCharDB["SearchResult"] then AtlasLootCharDB["SearchResult"] = {Name = "Search Result" , Type = "Search", Back = true}; end - if not AtlasLootFilterDB then AtlasLootFilterDB = {["FilterLists"] = {}} end; + if not AtlasLootFilterDB then AtlasLootFilterDB = {["FilterLists"] = {{Name = "Default" }}} end; if AtlasLootFilterDB and not AtlasLootFilterDB["FilterLists"] then AtlasLootFilterDB = {["FilterLists"] = {{Name = "Default" }}} end; if AtlasLoot_Data then AtlasLoot_Data["EmptyTable"] = { @@ -824,7 +824,7 @@ function AtlasLoot:ShowItemsFrame(dataID, dataSource_backup, tablenum) if dataSource[dataID].Back or ATLASLOOT_BACKENABLED then _G["AtlasLootItemsFrame_BACK"]:Show(); - else + elseif dataID ~= "FilterList" then AtlasLootItemsFrame.refreshBack = {dataID, dataSource_backup, tablenum}; end end diff --git a/AtlasLoot/Core/Filter.lua b/AtlasLoot/Core/Filter.lua index fd33266..b13540d 100644 --- a/AtlasLoot/Core/Filter.lua +++ b/AtlasLoot/Core/Filter.lua @@ -52,8 +52,6 @@ local FilterTable = { { Name = AL["Secondary Stats"], Type = "Stat", - {"Attack Power", "ITEM_MOD_ATTACK_POWER_SHORT"}, - {"Spell Power", "ITEM_MOD_SPELL_POWER_SHORT"}, {"Crit", "ITEM_MOD_CRIT_RATING_SHORT"}, {"Hit", "ITEM_MOD_HIT_RATING_SHORT"}, {"Haste", "ITEM_MOD_HASTE_RATING_SHORT"}, @@ -67,7 +65,9 @@ local FilterTable = { {"Strength", "ITEM_MOD_STRENGTH_SHORT"}, {"Agility", "ITEM_MOD_AGILITY_SHORT"}, {"Intellect", "ITEM_MOD_INTELLECT_SHORT"}, - {"Spirit", "ITEM_MOD_SPIRIT_SHORT"} + {"Spirit", "ITEM_MOD_SPIRIT_SHORT"}, + {"Attack Power", "ITEM_MOD_ATTACK_POWER_SHORT"}, + {"Spell Power", "ITEM_MOD_SPELL_POWER_SHORT"} }, { Name = AL["Defensive Stats"], @@ -92,7 +92,7 @@ AtlasLootFilter["FilterList"] = {}; function AtlasLoot:HideFilteredItems() local dataID, dataSource, tablenum = AtlasLootItemsFrame.refreshFilter[1], _G[AtlasLootItemsFrame.refreshFilter[2]], AtlasLootItemsFrame.refreshFilter[3]; local tablebase = dataSource[dataID][tablenum] - if not tablebase or dataID == "WishList" or dataID == "SearchResult" then return end + if not tablebase or dataID == "WishList" or dataID == "SearchResult" or AtlasLootCharDB.SelectedFilter == nil then return end AtlasLootFilter["FilterList"] = {}; AtlasLootFilter["FilterList"].Type = dataSource[dataID].Type; AtlasLootFilter["FilterList"].Name = dataSource[dataID].Name; @@ -114,13 +114,25 @@ function AtlasLoot:HideFilteredItems() end end + local function checkNofilter(itemID, filter) + if getStats(itemID,filter) then return true end; + for i,v in pairs(AtlasLootFilterDB["FilterLists"][AtlasLootCharDB.SelectedFilter]) do + for n,t in ipairs(FilterTable) do + if t.Type == filter and v[1] then + return true; + end + end + end + end + local count = 0 local function getFilterType(itemID) local filterSelect3, filterSelect2,_ , filterSelect1 = select(6,GetItemInfo(itemID)); local filter1 = AtlasLootFilterDB["FilterLists"][AtlasLootCharDB.SelectedFilter][filterSelect1]; local filter2 = AtlasLootFilterDB["FilterLists"][AtlasLootCharDB.SelectedFilter][filterSelect2]; - if (filter1 and filter1[1] and filter1[3] == "InvType" and getStats(itemID,"Stat")) or - (filter2 and filter2[1] and filter2[3] == "ArmorType" and getStats(itemID,"Stat")) + + if (filter1 and filter1[1] and filter1[3] == "InvType" and getStats(itemID,"PrimaryStat") and checkNofilter(itemID, "Stat")) or + (filter2 and filter2[1] and filter2[3] == "ArmorType" and getStats(itemID,"PrimaryStat") and checkNofilter(itemID, "Stat")) then return true; else @@ -269,7 +281,7 @@ function AtlasLoot:OpenFilterCreate() filterCatLable:SetPoint("TOP", "AtlasLootItemsFrame", "TOP",-150,-90); elseif count == 16 then filterCatLable:SetPoint("TOP", "AtlasLootItemsFrame", "TOP",0,-90); - elseif count == 30 then + elseif count == 28 then filterCatLable:SetPoint("TOP", "AtlasLootItemsFrame", "TOP",150,-90); else filterCatLable:SetPoint("LEFT", "AtlasLootFilterButton_"..(count - 1), "LEFT",0,-25); diff --git a/AtlasLoot/Core/Options.lua b/AtlasLoot/Core/Options.lua index 8f4a39b..78c1998 100644 --- a/AtlasLoot/Core/Options.lua +++ b/AtlasLoot/Core/Options.lua @@ -181,6 +181,8 @@ function AtlasLoot_DisplayHelp() WHITE..AL["While on the wishlist screen, just Alt+Left Click on an item to delete it."].."\n\n".. ORANGE..AL["What else does the wishlist do?"].."\n".. WHITE..AL["If you Left Click any item on the wishlist, you can jump to the loot page the item comes from. Also, on a loot page any item already in your wishlist is marked with a yellow star."].."\n\n".. + ORANGE..AL["How to set of change a page filter:"].."\n".. + WHITE..AL["If you Right Click on the filter check box you will get a drop downmenu with a list of filters. Click the filter you want to use or click add filter set to add new custom filters."].."\n\n".. ORANGE..AL["HELP!! I have broken the mod somehow!"].."\n".. WHITE..AL["Use the reset buttons available in the options menu, or type '/al reset' in your chat window."].."\n\n".. GREY..AL["For further help, see our website and forums: "]..GREEN.."https://discord.gg/uYCE2X2FgA" diff --git a/AtlasLoot/Locales/constants.en.lua b/AtlasLoot/Locales/constants.en.lua index 3ef4502..0b13585 100644 --- a/AtlasLoot/Locales/constants.en.lua +++ b/AtlasLoot/Locales/constants.en.lua @@ -284,6 +284,9 @@ if AL then AL["Ranged weapons:"] = true; AL["Relics:"] = true; AL["Other:"] = true; + AL["How to set of change a page filter:"] = true; + AL["If you Right Click on the filter check box you will get a drop downmenu with a list of filters. Click the filter you want to use or click add filter set to add new custom filters."] = true; + -- Wishlist AL["Close"] = true;