From e9177f4a9810ce43eb549366c386af86ccfcdd99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen?= Date: Sun, 28 Dec 2025 17:33:33 +0100 Subject: [PATCH] bag scan and bank scan seperate --- TradeSkillMaster_AuctionDB/Locale/enUS.lua | 10 ++- TradeSkillMaster_AuctionDB/Modules/GUI.lua | 85 ++++++++++++++++++---- 2 files changed, 77 insertions(+), 18 deletions(-) diff --git a/TradeSkillMaster_AuctionDB/Locale/enUS.lua b/TradeSkillMaster_AuctionDB/Locale/enUS.lua index d5c8bb8..a534d32 100644 --- a/TradeSkillMaster_AuctionDB/Locale/enUS.lua +++ b/TradeSkillMaster_AuctionDB/Locale/enUS.lua @@ -75,7 +75,8 @@ L["Run Full Scan"] = true L["Run GetAll Scan"] = true L["Running query..."] = true L["Running query... Server not responding due to throttling? Try again later..."] = true -L["Scan Inventory & Bank"] = true +L["Scan Bags"] = true +L["Scan Bank"] = true L["Scan Selected Groups"] = true L["Scanning %d / %d (Page 1 / ?)"] = true L["Scanning %d / %d (Page %d / %d)"] = true @@ -88,7 +89,8 @@ L["Select whether to sort search results in ascending or descending order."] = t L["Shift-Right-Click to clear all data for this item from AuctionDB."] = true L["Show AuctionDB AH Tab (Requires Reload)"] = true L["Sort items by"] = true -L["This will scan items in your bags and bank (bank must be open) and update their AuctionDB prices. Soulbound items are skipped."] = true +L["Scan bag items."] = true +L["Scan bank items."] = true L["This determines how many items are shown per page in results area of the \"Search\" tab of the AuctionDB page in the main TSM window. You may enter a number between 5 and 500 inclusive. If the page lags, you may want to decrease this number."] = true L["This will do a slow auction house scan of every item in the selected groups and update their AuctionDB prices. This may take several minutes."] = true L["Use the search box and category filters above to search the AuctionDB data."] = true @@ -96,4 +98,6 @@ L["You can filter the results by item subtype by using this dropdown. For exampl L["You can filter the results by item type by using this dropdown. For example, if you want to search for all herbs, you would select \"Trade Goods\" in this dropdown and \"Herbs\" as the subtype filter."] = true L["You can use this page to lookup an item or group of items in the AuctionDB database. Note that this does not perform a live search of the AH."] = true L["You have disabled GetAll scans via AuctionDB's options."] = true -L["No inventory items found."] = true +L["No bag items found."] = true +L["No bank items found."] = true +L["ItemTracker data unavailable."] = true diff --git a/TradeSkillMaster_AuctionDB/Modules/GUI.lua b/TradeSkillMaster_AuctionDB/Modules/GUI.lua index c8430a4..971e306 100644 --- a/TradeSkillMaster_AuctionDB/Modules/GUI.lua +++ b/TradeSkillMaster_AuctionDB/Modules/GUI.lua @@ -98,14 +98,16 @@ function private:CreateStartScanContent(parent) if self.startGetAllButton then self.startGetAllButton:Enable() end self.startFullScanButton:Enable() self.startGroupScanButton:Enable() - self.startInventoryScanButton:Enable() + self.startBagScanButton:Enable() + self.startBankScanButton:Enable() end frame.Disable = function(self) if self.startGetAllButton then self.startGetAllButton:Disable() end self.startFullScanButton:Disable() self.startGroupScanButton:Disable() - self.startInventoryScanButton:Disable() + self.startBagScanButton:Disable() + self.startBankScanButton:Disable() end -- Top row: Auto updater. @@ -203,15 +205,27 @@ function private:CreateStartScanContent(parent) yOffset = yOffset - 20 - -- Row: Inventory Scan. + -- Row: Bag Scan. local btn = TSMAPI.GUI:CreateButton(buttonFrame, 18) btn:SetPoint("TOPLEFT", 6, yOffset) btn:SetPoint("TOPRIGHT", -6, yOffset) btn:SetHeight(22) - btn:SetScript("OnClick", GUI.StartInventoryScan) - btn:SetText(L["Scan Inventory & Bank"]) - btn.tooltip = L["This will scan items in your bags and bank (bank must be open) and update their AuctionDB prices. Soulbound items are skipped."] - frame.startInventoryScanButton = btn + btn:SetScript("OnClick", GUI.StartBagScan) + btn:SetText(L["Scan Bags"]) + btn.tooltip = L["Scan bag items."] + frame.startBagScanButton = btn + + yOffset = yOffset - 30 + + -- Row: Bank Scan. + local btn = TSMAPI.GUI:CreateButton(buttonFrame, 18) + btn:SetPoint("TOPLEFT", 6, yOffset) + btn:SetPoint("TOPRIGHT", -6, yOffset) + btn:SetHeight(22) + btn:SetScript("OnClick", GUI.StartBankScan) + btn:SetText(L["Scan Bank"]) + btn.tooltip = L["Scan bank items."] + frame.startBankScanButton = btn return frame end @@ -227,21 +241,62 @@ function GUI:StartGroupScan() TSM.Scan:StartGroupScan(items) end -function GUI:StartInventoryScan() - local itemSet = {} - for _, _, itemString in TSMAPI:GetBagIterator(true) do - itemSet[itemString] = true +function private:GetItemTrackerItems(key) + local data = TSMAPI:ModuleAPI("ItemTracker", key) + if not data then + TSM:Print(L["ItemTracker data unavailable."]) + return + end + + local specificItems = {} + local baseCandidates = {} + local hasSpecific = {} + + for itemString in pairs(data) do + if type(itemString) == "string" then + local baseItemString = TSMAPI:GetBaseItemString(itemString) or itemString + if itemString ~= baseItemString then + specificItems[itemString] = true + hasSpecific[baseItemString] = true + else + baseCandidates[baseItemString] = true + end + end end - for _, _, itemString in TSMAPI:GetBankIterator(true) do - itemSet[itemString] = true + + for baseItemString in pairs(baseCandidates) do + if not hasSpecific[baseItemString] then + specificItems[baseItemString] = true + end end local items = {} - for itemString in pairs(itemSet) do + for itemString in pairs(specificItems) do tinsert(items, itemString) end + return items +end + +function GUI:StartBagScan() + local items = private:GetItemTrackerItems("playerbags") + if not items then + return + end + if #items == 0 then + TSM:Print(L["No bag items found."]) + return + end + + TSM.Scan:StartGroupScan(items) +end + +function GUI:StartBankScan() + local items = private:GetItemTrackerItems("playerbank") + if not items then + return + end if #items == 0 then - TSM:Print(L["No inventory items found."]) + TSM:Print(L["No bank items found."]) return end