diff --git a/Core/CategoryManager.lua b/Core/CategoryManager.lua index 49bf35f..ead4426 100644 --- a/Core/CategoryManager.lua +++ b/Core/CategoryManager.lua @@ -329,6 +329,25 @@ function CategoryManager:MigrateCategories() boeCat.priority = 75 addon:Debug("CategoryManager: Migrated BoE priority to 75") end + + -- Migrate Junk category to ensure proper rules and priority + local junkCat = cats.definitions["Junk"] + if junkCat and junkCat.isBuiltIn then + local needsUpdate = false + -- Check if priority is too low + if not junkCat.priority or junkCat.priority < 85 then + junkCat.priority = 85 + needsUpdate = true + end + -- Check if rules are missing or wrong + if not junkCat.rules or table.getn(junkCat.rules) == 0 then + junkCat.rules = { { type = "quality", value = 0 } } + needsUpdate = true + end + if needsUpdate then + addon:Debug("CategoryManager: Migrated Junk category") + end + end end -- Get all categories @@ -497,6 +516,17 @@ function CategoryManager:EvaluateRule(rule, itemData, bagID, slotID, isOtherChar return string.find(itemName, ruleValue) ~= nil elseif ruleType == "quality" then + -- For quality 0 (gray/junk), also check tooltip as fallback + if ruleValue == 0 then + if itemData.quality == 0 then + return true + end + -- Tooltip fallback for gray detection (current character only) + if not isOtherChar and addon.Modules.Utils and addon.Modules.Utils.IsItemGrayTooltip then + return addon.Modules.Utils:IsItemGrayTooltip(bagID, slotID, itemData.link) + end + return false + end return itemData.quality == ruleValue elseif ruleType == "qualityMin" then diff --git a/UI/SettingsPopup.lua b/UI/SettingsPopup.lua index 1329e93..14831f7 100644 --- a/UI/SettingsPopup.lua +++ b/UI/SettingsPopup.lua @@ -1375,10 +1375,50 @@ function Guda_SettingsPopup_CategoriesTab_Update() end end - -- Set reset button text + -- Set button texts + local addBtn = getglobal("Guda_SettingsPopup_AddCategoryButton") + if addBtn then + addBtn:SetText("+ Add Category") + end + local resetBtn = getglobal("Guda_SettingsPopup_ResetCategoriesButton") if resetBtn then - resetBtn:SetText("Reset to Defaults") + resetBtn:SetText("Reset Defaults") + end +end + +-- Add new custom category +function Guda_SettingsPopup_AddCategory_OnClick() + if not Guda.Modules.CategoryManager then return end + + -- Generate unique ID + local baseId = "Custom" + local counter = 1 + local newId = baseId .. counter + + local cats = Guda.Modules.CategoryManager:GetCategories() + while cats.definitions[newId] do + counter = counter + 1 + newId = baseId .. counter + end + + -- Create new category definition + local newDef = { + name = "New Category " .. counter, + icon = "Interface\\Icons\\INV_Misc_QuestionMark", + rules = {}, + matchMode = "any", + priority = 50, + enabled = true, + isBuiltIn = false, + } + + -- Add to database + if Guda.Modules.CategoryManager:AddCategory(newId, newDef) then + -- Update display + Guda_SettingsPopup_CategoriesTab_Update() + -- Open editor for the new category + Guda_CategoryEditor_Open(newId) end end diff --git a/UI/SettingsPopup.xml b/UI/SettingsPopup.xml index 3dd7e30..84af32c 100644 --- a/UI/SettingsPopup.xml +++ b/UI/SettingsPopup.xml @@ -692,10 +692,10 @@ - - + + +