diff --git a/Core/Database.lua b/Core/Database.lua
index f77621e..be0ef7d 100644
--- a/Core/Database.lua
+++ b/Core/Database.lua
@@ -47,6 +47,7 @@ function DB:Initialize()
bgTransparency = 0.15,
showTrackedItems = true,
showTooltipCounts = true,
+ markUnusableItems = true,
bagViewType = "single", -- single, category
bankViewType = "single", -- single, category
trackedItems = {},
@@ -117,6 +118,9 @@ function DB:Initialize()
if Guda_CharDB.settings.questBarPinnedItems == nil then
Guda_CharDB.settings.questBarPinnedItems = {}
end
+ if Guda_CharDB.settings.markUnusableItems == nil then
+ Guda_CharDB.settings.markUnusableItems = true
+ end
-- Initialize this character's data
if not Guda_DB.characters[fullName] then
diff --git a/Guda.toc b/Guda.toc
index 37bcb37..808a082 100644
--- a/Guda.toc
+++ b/Guda.toc
@@ -2,7 +2,7 @@
## Title: Guda
## Notes: All-in-one bag and bank addon for World of Warcraft 1.12.1 (Turtle WoW)
## Author: Vati
-## Version: 1.5.6
+## Version: 1.5.7
## SavedVariables: Guda_DB
## SavedVariablesPerCharacter: Guda_CharDB
diff --git a/Sorting/SortEngine.lua b/Sorting/SortEngine.lua
index ac58621..03609e2 100644
--- a/Sorting/SortEngine.lua
+++ b/Sorting/SortEngine.lua
@@ -6,6 +6,9 @@ local addon = Guda
local SortEngine = {}
addon.Modules.SortEngine = SortEngine
+-- Flag to track if sorting is currently in progress
+SortEngine.sortingInProgress = false
+
--===========================================================================
-- CONSTANTS
--===========================================================================
@@ -1386,6 +1389,12 @@ end
--===========================================================================
function SortEngine:ExecuteSort(sortFunction, analyzeFunction, updateFrame, sortType)
+ -- Check if sorting is already in progress
+ if self.sortingInProgress then
+ addon:Print("Sorting already in progress, please wait...")
+ return false, "sorting in progress"
+ end
+
-- Clear property cache at the start of a sort operation
self:ClearCache()
@@ -1397,6 +1406,9 @@ function SortEngine:ExecuteSort(sortFunction, analyzeFunction, updateFrame, sort
return false, "already sorted"
end
+ -- Set sorting flag
+ self.sortingInProgress = true
+
-- Print analysis results
addon:Print("Sorting %s... (%d/%d items need sorting, estimated %d passes)",
sortType, analysis.itemsOutOfPlace, analysis.totalItems, analysis.passes)
@@ -1429,6 +1441,7 @@ function SortEngine:ExecuteSort(sortFunction, analyzeFunction, updateFrame, sort
frame:SetScript("OnUpdate", function()
if GetTime() - startTime >= 0.7 then
frame:SetScript("OnUpdate", nil)
+ SortEngine.sortingInProgress = false
updateFrame()
end
end)
@@ -1443,6 +1456,7 @@ function SortEngine:ExecuteSort(sortFunction, analyzeFunction, updateFrame, sort
frame:SetScript("OnUpdate", function()
if GetTime() - startTime >= 0.7 then
frame:SetScript("OnUpdate", nil)
+ SortEngine.sortingInProgress = false
updateFrame()
end
end)
@@ -1463,6 +1477,7 @@ function SortEngine:ExecuteSort(sortFunction, analyzeFunction, updateFrame, sort
frame:SetScript("OnUpdate", function()
if GetTime() - startTime >= 0.7 then
frame:SetScript("OnUpdate", nil)
+ SortEngine.sortingInProgress = false
updateFrame()
end
end)
diff --git a/UI/BagFrame.lua b/UI/BagFrame.lua
index fdc8e17..374898c 100644
--- a/UI/BagFrame.lua
+++ b/UI/BagFrame.lua
@@ -1358,6 +1358,12 @@ function Guda_BagFrame_MergeStacks()
return
end
+ -- Check if sorting is already in progress
+ if addon.Modules.SortEngine.sortingInProgress then
+ addon:Print("Sorting already in progress, please wait...")
+ return
+ end
+
local bagIDs = addon.Constants.BAGS
local moveQueue = {}
@@ -1450,6 +1456,9 @@ function Guda_BagFrame_MergeStacks()
return
end
+ -- Set sorting flag
+ addon.Modules.SortEngine.sortingInProgress = true
+
-- Process queue with delays
local queueIndex = 1
local retryCount = 0
@@ -1458,6 +1467,7 @@ function Guda_BagFrame_MergeStacks()
local function ProcessNextMove()
if queueIndex > table.getn(moveQueue) then
addon:Print("Merged " .. totalMoves .. " stack(s)")
+ addon.Modules.SortEngine.sortingInProgress = false
BagFrame:Update()
return
end
diff --git a/UI/BankFrame.lua b/UI/BankFrame.lua
index c3f087b..38790df 100644
--- a/UI/BankFrame.lua
+++ b/UI/BankFrame.lua
@@ -998,6 +998,12 @@ function Guda_BankFrame_MergeStacks()
return
end
+ -- Check if sorting is already in progress
+ if addon.Modules.SortEngine.sortingInProgress then
+ addon:Print("Sorting already in progress, please wait...")
+ return
+ end
+
local bagIDs = addon.Constants.BANK_BAGS
local moveQueue = {}
@@ -1090,14 +1096,18 @@ function Guda_BankFrame_MergeStacks()
return
end
+ -- Set sorting flag
+ addon.Modules.SortEngine.sortingInProgress = true
+
-- Process queue with delays
local queueIndex = 1
local retryCount = 0
local totalMoves = table.getn(moveQueue)
-
+
local function ProcessNextMove()
if queueIndex > table.getn(moveQueue) then
addon:Print("Merged " .. totalMoves .. " stack(s)")
+ addon.Modules.SortEngine.sortingInProgress = false
BankFrame:Update()
return
end
diff --git a/UI/ItemButton.lua b/UI/ItemButton.lua
index d75ac3b..db50440 100644
--- a/UI/ItemButton.lua
+++ b/UI/ItemButton.lua
@@ -193,6 +193,20 @@ local function Guda_ItemButton_UpdateUsableTint(self)
SetItemButtonTextureVertexColor(self, 1.0, 1.0, 1.0)
end
+ -- Check if feature is enabled
+ local markUnusable = true
+ if Guda and Guda.Modules and Guda.Modules.DB then
+ markUnusable = Guda.Modules.DB:GetSetting("markUnusableItems")
+ if markUnusable == nil then
+ markUnusable = true
+ end
+ end
+
+ -- If feature is disabled, just return after clearing
+ if not markUnusable then
+ return
+ end
+
-- Only evaluate for live (player) items; DB cached items from other chars cannot be scanned
if not self or not self.hasItem or not self.bagID or not self.slotID or self.isReadOnly or self.otherChar then
return
@@ -1097,10 +1111,14 @@ function Guda_ItemButton_OnEnter(self)
-- For live mode: use SetBagItem for all bags
GameTooltip:SetBagItem(self.bagID, self.slotID)
end
-
+
GameTooltip:Show()
- -- Handle merchant sell cursor (same approach as BagShui)
+ -- TESTING: Print item info to console for debugging
+ --local name, link, itemQuality, iLevel, itemCategory, itemType, itemStackCount, itemSubType, itemTexture, itemEquipLoc, itemSellPrice = addon.Modules.Utils:GetItemInfo(self.itemData.link)
+ --addon:Print("name:" .. tostring(name) .. " link:" .. tostring(link) .. " quality:" .. tostring(itemQuality) .. " iLevel:" .. tostring(iLevel) .. " category:" .. tostring(itemCategory) .. " type:" .. tostring(itemType) .. " subType:" .. tostring(itemSubType) .. " stackCount:" .. tostring(itemStackCount) .. " equipLoc:" .. tostring(itemEquipLoc) .. " sellPrice:" .. tostring(itemSellPrice))
+
+ -- Handle merchant sell cursor (same approach as BagShui)
if MerchantFrame:IsShown() and not self.isBank and not self.otherChar and self.hasItem then
ShowContainerSellCursor(self.bagID, self.slotID)
else
diff --git a/UI/SettingsPopup.lua b/UI/SettingsPopup.lua
index a57b499..5cf18f8 100644
--- a/UI/SettingsPopup.lua
+++ b/UI/SettingsPopup.lua
@@ -28,9 +28,10 @@ function Guda_SettingsPopup_OnLoad(self)
end
-- Set tab names
- PanelTemplates_SetNumTabs(self, 2)
+ PanelTemplates_SetNumTabs(self, 3)
getglobal(self:GetName().."Tab1"):SetText("General")
- getglobal(self:GetName().."Tab2"):SetText("Quick Guide")
+ getglobal(self:GetName().."Tab2"):SetText("Icons")
+ getglobal(self:GetName().."Tab3"):SetText("Quick Guide")
PanelTemplates_SetTab(self, 1)
-- Set How to Use text
@@ -57,12 +58,18 @@ end
function Guda_SettingsPopup_Tab_OnClick(id)
local frame = Guda_SettingsPopup
PanelTemplates_SetTab(frame, id)
-
+
+ -- Hide all tabs
+ getglobal(frame:GetName().."_GeneralTab"):Hide()
+ getglobal(frame:GetName().."_IconsTab"):Hide()
+ getglobal(frame:GetName().."_HowToUseTab"):Hide()
+
+ -- Show selected tab
if id == 1 then
getglobal(frame:GetName().."_GeneralTab"):Show()
- getglobal(frame:GetName().."_HowToUseTab"):Hide()
+ elseif id == 2 then
+ getglobal(frame:GetName().."_IconsTab"):Show()
else
- getglobal(frame:GetName().."_GeneralTab"):Hide()
getglobal(frame:GetName().."_HowToUseTab"):Show()
end
end
@@ -948,6 +955,54 @@ function Guda_SettingsPopup_ShowTooltipCountsCheckbox_OnClick(self)
end
end
+-- Mark Unusable Items Checkbox OnLoad
+function Guda_SettingsPopup_MarkUnusableCheckbox_OnLoad(self)
+ local text = getglobal(self:GetName().."Text")
+ if text then
+ text:SetText("Mark Unusable Items")
+
+ -- Increase font size
+ local font, _, flags = text:GetFont()
+ if font then
+ text:SetFont(font, 13, flags)
+ end
+ end
+
+ -- Tooltip
+ self.tooltipText = "Show a red tint on items that your character cannot use (wrong class, level, etc.)."
+
+ local markUnusable = true
+ if Guda and Guda.Modules and Guda.Modules.DB then
+ markUnusable = Guda.Modules.DB:GetSetting("markUnusableItems")
+ if markUnusable == nil then
+ markUnusable = true
+ end
+ end
+
+ self:SetChecked(markUnusable and 1 or 0)
+end
+
+-- Mark Unusable Items Checkbox OnClick
+function Guda_SettingsPopup_MarkUnusableCheckbox_OnClick(self)
+ local isChecked = self:GetChecked() == 1
+
+ -- Save setting
+ if Guda and Guda.Modules and Guda.Modules.DB then
+ Guda.Modules.DB:SetSetting("markUnusableItems", isChecked)
+ end
+
+ -- Update bag and bank frames to apply/remove the red tint
+ 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
+
-- Bag View Type Button OnClick
function Guda_SettingsPopup_BagViewTypeButton_OnClick()
local current = Guda.Modules.DB:GetSetting("bagViewType") or "single"
diff --git a/UI/SettingsPopup.xml b/UI/SettingsPopup.xml
index 8763f71..eed870f 100644
--- a/UI/SettingsPopup.xml
+++ b/UI/SettingsPopup.xml
@@ -3,7 +3,7 @@
-
+
@@ -72,6 +72,20 @@
+