sorting herb bags are added , upgrade quest item detection

This commit is contained in:
Salikh Gurgenidze
2025-12-19 02:06:49 +04:00
parent 159a0a6e15
commit 4758fe06d8
3 changed files with 56 additions and 47 deletions
+7 -7
View File
@@ -110,13 +110,13 @@ function BagScanner:Initialize()
-- Register bag update events -- Register bag update events
eventFrame:RegisterEvent("BAG_UPDATE") eventFrame:RegisterEvent("BAG_UPDATE")
eventFrame:RegisterEvent("BAG_UPDATE_DELAYED") eventFrame:RegisterEvent("BAG_UPDATE_DELAYED")
--
eventFrame:SetScript("OnEvent", function() --eventFrame:SetScript("OnEvent", function()
if event == "BAG_UPDATE" or event == "BAG_UPDATE_DELAYED" then -- if event == "BAG_UPDATE" or event == "BAG_UPDATE_DELAYED" then
addon:Debug("Bag update detected, saving data...") -- addon:Debug("Bag update detected, saving data...")
self:SaveToDatabase() -- self:SaveToDatabase()
end -- end
end) --end)
addon:Debug("Bag scanner initialized with auto-save") addon:Debug("Bag scanner initialized with auto-save")
end end
+5
View File
@@ -91,6 +91,11 @@ function BankScanner:Initialize()
-- Bank closed -- Bank closed
addon.Modules.Events:OnBankClose(function() addon.Modules.Events:OnBankClose(function()
-- Do a final save on close before marking bank as closed
-- so that any last changes are captured.
addon:Debug("Bank closing - performing final save")
BankScanner:SaveToDatabase()
bankOpen = false bankOpen = false
addon:Debug("Bank closed") addon:Debug("Bank closed")
end, "BankScanner") end, "BankScanner")
+44 -40
View File
@@ -42,24 +42,28 @@ local function IsQuestItem(bagID, slotID)
end end
end end
-- Also check if the item type is "Quest" -- Also check item category/type via GetItemInfo for "Quest"
if not isQuestItem then -- Turtle WoW GetItemInfo returns: name, link, rarity, level, itemCategory, itemType, stack, subType, texture, equipLoc, sellPrice
local link = GetContainerItemLink(bagID, slotID) if not isQuestItem then
if link then local link = GetContainerItemLink(bagID, slotID)
local itemName, itemLink, itemRarity, itemLevel, itemMinLevel, itemType = GetItemInfo(link) if link and addon and addon.Modules and addon.Modules.Utils and addon.Modules.Utils.ExtractItemID and addon.Modules.Utils.GetItemInfoSafe then
if itemType == "Quest" then local itemID = addon.Modules.Utils:ExtractItemID(link)
isQuestItem = true if itemID then
-- For quest type items, check if they're starters by name/description local itemName, _, _, _, itemCategory, itemType = addon.Modules.Utils:GetItemInfoSafe(itemID)
if itemName and (string.find(itemName, "Note") or if itemCategory == "Quest" or itemType == "Quest" then
string.find(itemName, "Letter") or isQuestItem = true
string.find(itemName, "Orders") or -- For quest items, try a light heuristic to flag starters by name
string.find(itemName, "Rune") or if itemName and (string.find(itemName, "Note") or
string.find(itemName, "Tablet")) then string.find(itemName, "Letter") or
isQuestStarter = true string.find(itemName, "Orders") or
end string.find(itemName, "Rune") or
end string.find(itemName, "Tablet")) then
end isQuestStarter = true
end end
end
end
end
end
return isQuestItem, isQuestStarter return isQuestItem, isQuestStarter
end end
@@ -879,28 +883,28 @@ function Guda_ItemButton_OnEnter(self)
-- Debug: print hovered item's texture path to chat -- Debug: print hovered item's texture path to chat
-- Uses GetItemInfo on the hovered item's ID -- Uses GetItemInfo on the hovered item's ID
--if self.hasItem then if self.hasItem then
-- local link = nil local link = nil
-- if self.itemData and self.itemData.link then if self.itemData and self.itemData.link then
-- link = self.itemData.link link = self.itemData.link
-- else else
-- -- Fallback to live bag query -- Fallback to live bag query
-- link = GetContainerItemLink(self.bagID, self.slotID) link = GetContainerItemLink(self.bagID, self.slotID)
-- end end
-- if link and addon and addon.Modules and addon.Modules.Utils and addon.Modules.Utils.ExtractItemID then if link and addon and addon.Modules and addon.Modules.Utils and addon.Modules.Utils.ExtractItemID then
-- local itemID = addon.Modules.Utils:ExtractItemID(link) local itemID = addon.Modules.Utils:ExtractItemID(link)
-- if itemID and addon.Modules.Utils.GetItemInfoSafe then if itemID and addon.Modules.Utils.GetItemInfoSafe then
-- local name, itemLink, itemRarity, itemLevel, itemCategory, itemType, itemStackCount, local name, itemLink, itemRarity, itemLevel, itemCategory, itemType, itemStackCount,
-- itemSubType, itemTexture, itemEquipLoc, itemSellPrice = addon.Modules.Utils:GetItemInfoSafe(itemID) itemSubType, itemTexture, itemEquipLoc, itemSellPrice = addon.Modules.Utils:GetItemInfoSafe(itemID)
-- if addon and addon.Print then if addon and addon.Print then
-- addon:Print("itemTexture: %s", tostring(itemTexture)) addon:Print("itemTexture: %s", tostring(itemTexture))
-- addon:Print("itemCategory: %s", tostring(itemCategory)) addon:Print("itemCategory: %s", tostring(itemCategory))
-- addon:Print("itemType: %s", tostring(itemType)) addon:Print("itemType: %s", tostring(itemType))
-- addon:Print("itemType: %s", tostring(itemType)) addon:Print("itemType: %s", tostring(itemType))
-- end end
-- end end
-- end end
--end end
-- Handle merchant sell cursor (same approach as BagShui) -- Handle merchant sell cursor (same approach as BagShui)
if MerchantFrame:IsShown() and not self.isBank and not self.otherChar and self.hasItem then if MerchantFrame:IsShown() and not self.isBank and not self.otherChar and self.hasItem then
ShowContainerSellCursor(self.bagID, self.slotID) ShowContainerSellCursor(self.bagID, self.slotID)