Browse Source

bag scan and bank scan seperate

dev
Jørgen Lien Sellæg 4 months ago
parent
commit
e9177f4a98
  1. 10
      TradeSkillMaster_AuctionDB/Locale/enUS.lua
  2. 85
      TradeSkillMaster_AuctionDB/Modules/GUI.lua

10
TradeSkillMaster_AuctionDB/Locale/enUS.lua

@ -75,7 +75,8 @@ L["Run Full Scan"] = true
L["Run GetAll Scan"] = true L["Run GetAll Scan"] = true
L["Running query..."] = true L["Running query..."] = true
L["Running query... Server not responding due to throttling? Try again later..."] = 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["Scan Selected Groups"] = true
L["Scanning %d / %d (Page 1 / ?)"] = true L["Scanning %d / %d (Page 1 / ?)"] = true
L["Scanning %d / %d (Page %d / %d)"] = 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["Shift-Right-Click to clear all data for this item from AuctionDB."] = true
L["Show AuctionDB AH Tab (Requires Reload)"] = true L["Show AuctionDB AH Tab (Requires Reload)"] = true
L["Sort items by"] = 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 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["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 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 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 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["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

85
TradeSkillMaster_AuctionDB/Modules/GUI.lua

@ -98,14 +98,16 @@ function private:CreateStartScanContent(parent)
if self.startGetAllButton then self.startGetAllButton:Enable() end if self.startGetAllButton then self.startGetAllButton:Enable() end
self.startFullScanButton:Enable() self.startFullScanButton:Enable()
self.startGroupScanButton:Enable() self.startGroupScanButton:Enable()
self.startInventoryScanButton:Enable() self.startBagScanButton:Enable()
self.startBankScanButton:Enable()
end end
frame.Disable = function(self) frame.Disable = function(self)
if self.startGetAllButton then self.startGetAllButton:Disable() end if self.startGetAllButton then self.startGetAllButton:Disable() end
self.startFullScanButton:Disable() self.startFullScanButton:Disable()
self.startGroupScanButton:Disable() self.startGroupScanButton:Disable()
self.startInventoryScanButton:Disable() self.startBagScanButton:Disable()
self.startBankScanButton:Disable()
end end
-- Top row: Auto updater. -- Top row: Auto updater.
@ -203,15 +205,27 @@ function private:CreateStartScanContent(parent)
yOffset = yOffset - 20 yOffset = yOffset - 20
-- Row: Inventory Scan. -- Row: Bag Scan.
local btn = TSMAPI.GUI:CreateButton(buttonFrame, 18) local btn = TSMAPI.GUI:CreateButton(buttonFrame, 18)
btn:SetPoint("TOPLEFT", 6, yOffset) btn:SetPoint("TOPLEFT", 6, yOffset)
btn:SetPoint("TOPRIGHT", -6, yOffset) btn:SetPoint("TOPRIGHT", -6, yOffset)
btn:SetHeight(22) btn:SetHeight(22)
btn:SetScript("OnClick", GUI.StartInventoryScan) btn:SetScript("OnClick", GUI.StartBagScan)
btn:SetText(L["Scan Inventory & Bank"]) btn:SetText(L["Scan Bags"])
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."] btn.tooltip = L["Scan bag items."]
frame.startInventoryScanButton = btn 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 return frame
end end
@ -227,21 +241,62 @@ function GUI:StartGroupScan()
TSM.Scan:StartGroupScan(items) TSM.Scan:StartGroupScan(items)
end end
function GUI:StartInventoryScan() function private:GetItemTrackerItems(key)
local itemSet = {} local data = TSMAPI:ModuleAPI("ItemTracker", key)
for _, _, itemString in TSMAPI:GetBagIterator(true) do if not data then
itemSet[itemString] = true 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 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 end
local items = {} local items = {}
for itemString in pairs(itemSet) do for itemString in pairs(specificItems) do
tinsert(items, itemString) tinsert(items, itemString)
end 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 if #items == 0 then
TSM:Print(L["No inventory items found."]) TSM:Print(L["No bank items found."])
return return
end end

Loading…
Cancel
Save