diff --git a/Core/CategoryManager.lua b/Core/CategoryManager.lua
index 57ee310..ee32f59 100644
--- a/Core/CategoryManager.lua
+++ b/Core/CategoryManager.lua
@@ -1346,6 +1346,15 @@ function CategoryManager:SyncEquipmentSetCategories()
insertPos = table.getn(cats.order) + 1
end
end
+ if not insertPos then
+ -- Insert before Junk category if it exists, otherwise at end of Main group
+ for i, orderId in ipairs(cats.order) do
+ if orderId == "Junk" then
+ insertPos = i
+ break
+ end
+ end
+ end
if not insertPos then
for i = table.getn(cats.order), 1, -1 do
local existDef = cats.definitions[cats.order[i]]
diff --git a/Core/Database.lua b/Core/Database.lua
index 19414fe..d7ca182 100644
--- a/Core/Database.lua
+++ b/Core/Database.lua
@@ -130,6 +130,12 @@ function DB:Initialize()
if Guda_CharDB.settings.markEquipmentSets == nil then
Guda_CharDB.settings.markEquipmentSets = true
end
+ if Guda_CharDB.settings.autoVendorJunk == nil then
+ Guda_CharDB.settings.autoVendorJunk = true
+ end
+ if Guda_CharDB.settings.whiteItemsJunk == nil then
+ Guda_CharDB.settings.whiteItemsJunk = false
+ end
-- Initialize CategoryManager for custom categories
if addon.Modules.CategoryManager then
diff --git a/Core/ItemDetection.lua b/Core/ItemDetection.lua
index ef94a8b..e37f453 100644
--- a/Core/ItemDetection.lua
+++ b/Core/ItemDetection.lua
@@ -241,8 +241,12 @@ local function DetectJunk(lines, itemData)
end
end
- -- White equippable items might be junk
- if quality == 1 and (itemClass == "Weapon" or itemClass == "Armor") then
+ -- White equippable items might be junk (only if whiteItemsJunk setting is enabled)
+ local whiteItemsJunk = false
+ if addon and addon.Modules and addon.Modules.DB then
+ whiteItemsJunk = addon.Modules.DB:GetSetting("whiteItemsJunk")
+ end
+ if quality == 1 and whiteItemsJunk and (itemClass == "Weapon" or itemClass == "Armor") then
-- Exclusions: trinkets, rings, necklaces, tabards, shirts
local subLower = string.lower(itemSubclass)
if string.find(subLower, "trinket") or
diff --git a/UI/BagFrame.lua b/UI/BagFrame.lua
index d27a029..0c715b9 100644
--- a/UI/BagFrame.lua
+++ b/UI/BagFrame.lua
@@ -3269,6 +3269,50 @@ function BagFrame:Initialize()
if frameRef and not frameRef:IsShown() then
frameRef:Show()
end
+
+ -- Auto-sell junk items (spread across frames to avoid item locking)
+ local autoVendor = addon.Modules.DB:GetSetting("autoVendorJunk")
+ if autoVendor == nil then autoVendor = true end
+ if autoVendor then
+ local junkItems = {}
+ for bag = 0, 4 do
+ local numSlots = GetContainerNumSlots(bag)
+ for slot = 1, numSlots do
+ local link = GetContainerItemLink(bag, slot)
+ if link and string.find(link, "|cff9d9d9d") then
+ table.insert(junkItems, { bag = bag, slot = slot })
+ end
+ end
+ end
+ if table.getn(junkItems) > 0 then
+ local idx = 0
+ local soldCount = 0
+ local sellFrame = CreateFrame("Frame")
+ sellFrame:SetScript("OnUpdate", function()
+ if not isMerchantOpen then
+ this:SetScript("OnUpdate", nil)
+ if soldCount > 0 then
+ addon:Print("Sold " .. soldCount .. " junk item(s).")
+ end
+ return
+ end
+ idx = idx + 1
+ local item = junkItems[idx]
+ if item then
+ local link = GetContainerItemLink(item.bag, item.slot)
+ if link and string.find(link, "|cff9d9d9d") then
+ UseContainerItem(item.bag, item.slot)
+ soldCount = soldCount + 1
+ end
+ else
+ this:SetScript("OnUpdate", nil)
+ if soldCount > 0 then
+ addon:Print("Sold " .. soldCount .. " junk item(s).")
+ end
+ end
+ end)
+ end
+ end
end, "BagFrame")
addon.Modules.Events:Register("MERCHANT_CLOSED", function()
diff --git a/UI/SettingsPopup.lua b/UI/SettingsPopup.lua
index a92e205..d14b196 100644
--- a/UI/SettingsPopup.lua
+++ b/UI/SettingsPopup.lua
@@ -62,6 +62,7 @@ function Guda_SettingsPopup_OnLoad(self)
if generalTab then
CreateSectionHeader(generalTab, "Appearance", -12)
CreateSectionHeader(generalTab, "Options", -120)
+ CreateSectionHeader(generalTab, "Automation", -230)
end
local layoutTab = getglobal("Guda_SettingsPopup_LayoutTab")
@@ -282,6 +283,22 @@ function Guda_SettingsPopup_OnShow(self)
markEquipmentSetsCheckbox:SetChecked(markEquipmentSets and 1 or 0)
end
+ -- Automation checkboxes
+ local autoVendorJunkCheckbox = getglobal("Guda_SettingsPopup_AutoVendorJunkCheckbox")
+ local autoVendorJunk = Guda.Modules.DB:GetSetting("autoVendorJunk")
+ if autoVendorJunk == nil then autoVendorJunk = true end
+ if autoVendorJunkCheckbox then
+ autoVendorJunkCheckbox:SetChecked(autoVendorJunk and 1 or 0)
+ end
+
+ -- White Items as Junk checkbox
+ local whiteItemsJunkCheckbox = getglobal("Guda_SettingsPopup_WhiteItemsJunkCheckbox")
+ local whiteItemsJunk = Guda.Modules.DB:GetSetting("whiteItemsJunk")
+ if whiteItemsJunk == nil then whiteItemsJunk = false end
+ if whiteItemsJunkCheckbox then
+ whiteItemsJunkCheckbox:SetChecked(whiteItemsJunk and 1 or 0)
+ end
+
if bagViewButton then
if bagViewType == "single" then
bagViewButton:SetText("Bag View: Single")
@@ -1293,6 +1310,86 @@ function Guda_SettingsPopup_MarkEquipmentSetsCheckbox_OnClick(self)
end
end
+-- Auto Vendor Junk Checkbox OnLoad
+function Guda_SettingsPopup_AutoVendorJunkCheckbox_OnLoad(self)
+ local text = getglobal(self:GetName().."Text")
+ if text then
+ text:SetText("Auto Sell Junk")
+
+ local font, _, flags = text:GetFont()
+ if font then
+ text:SetFont(font, 13, flags)
+ end
+ end
+
+ self.tooltipText = "Automatically sell gray (junk) items when you visit a vendor."
+
+ local enabled = true
+ if Guda and Guda.Modules and Guda.Modules.DB then
+ enabled = Guda.Modules.DB:GetSetting("autoVendorJunk")
+ if enabled == nil then enabled = true end
+ end
+
+ self:SetChecked(enabled and 1 or 0)
+end
+
+-- Auto Vendor Junk Checkbox OnClick
+function Guda_SettingsPopup_AutoVendorJunkCheckbox_OnClick(self)
+ local isChecked = self:GetChecked() == 1
+
+ if Guda and Guda.Modules and Guda.Modules.DB then
+ Guda.Modules.DB:SetSetting("autoVendorJunk", isChecked)
+ end
+end
+
+-- White Items as Junk Checkbox OnLoad
+function Guda_SettingsPopup_WhiteItemsJunkCheckbox_OnLoad(self)
+ local text = getglobal(self:GetName().."Text")
+ if text then
+ text:SetText("White Items as Junk")
+
+ local font, _, flags = text:GetFont()
+ if font then
+ text:SetFont(font, 13, flags)
+ end
+ end
+
+ self.tooltipText = "Treat white (common) equippable items as junk. They will be dimmed and auto-sold if auto-sell is enabled."
+
+ local enabled = false
+ if Guda and Guda.Modules and Guda.Modules.DB then
+ enabled = Guda.Modules.DB:GetSetting("whiteItemsJunk")
+ if enabled == nil then enabled = false end
+ end
+
+ self:SetChecked(enabled and 1 or 0)
+end
+
+-- White Items as Junk Checkbox OnClick
+function Guda_SettingsPopup_WhiteItemsJunkCheckbox_OnClick(self)
+ local isChecked = self:GetChecked() == 1
+
+ if Guda and Guda.Modules and Guda.Modules.DB then
+ Guda.Modules.DB:SetSetting("whiteItemsJunk", isChecked)
+ end
+
+ -- Clear item detection cache so junk status is re-evaluated
+ if Guda.Modules.ItemDetection and Guda.Modules.ItemDetection.ClearCache then
+ Guda.Modules.ItemDetection:ClearCache()
+ end
+
+ -- Update bag and bank frames
+ local bagFrame = getglobal("Guda_BagFrame")
+ if bagFrame and bagFrame:IsShown() then
+ Guda.Modules.BagFrame:Update()
+ end
+
+ local bankFrame = getglobal("Guda_BankFrame")
+ if bankFrame and bankFrame:IsShown() then
+ Guda.Modules.BankFrame:Update()
+ end
+end
+
-- Theme Dropdown OnClick
function Guda_SettingsPopup_ThemeDropdown_OnClick(button)
local themes = {
diff --git a/UI/SettingsPopup.xml b/UI/SettingsPopup.xml
index 927f401..bed4f0e 100644
--- a/UI/SettingsPopup.xml
+++ b/UI/SettingsPopup.xml
@@ -317,6 +317,20 @@
Guda_SettingsPopup_ReverseStackSortCheckbox_OnClick(this)
+
+
+
+
+
+
+
+
+
+
+ Guda_SettingsPopup_AutoVendorJunkCheckbox_OnLoad(this)
+ Guda_SettingsPopup_AutoVendorJunkCheckbox_OnClick(this)
+
+
@@ -555,11 +569,24 @@
+
+
+
+
+
+
+
+
+ Guda_SettingsPopup_WhiteItemsJunkCheckbox_OnLoad(this)
+ Guda_SettingsPopup_WhiteItemsJunkCheckbox_OnClick(this)
+
+
+
-
+