Quantcast
WoWInterface - View Single Post - GetAuctionItemInfo removing items from auction house page
View Single Post
08-22-19, 08:43 PM   #8
Odjur
A Murloc Raider
Join Date: Feb 2014
Posts: 6
I really appreciate all of the replies. I wrote a small test script to hopefully demonstrate my issue, and put it in an addon called "Test". The following is what you need to do, and after doing it the number of auctions should be different.
  • /test getall
  • Wait for the getall search to complete
  • /test count
  • Wait ~30 seconds (my guess is that in this time auctions expire / sell)
  • /test scan
  • Wait for the scan to finish
  • /test count

Code:
 -- Search the entire auction house at once
local function GetAll()
	if select(2, CanSendAuctionQuery()) then
		AuctionFrameBrowse:UnregisterEvent("AUCTION_ITEM_LIST_UPDATE")
		
		-- QueryAuctionItems(name, minLevel, maxLevel, page, isUsable, qualityIndex, getAll, exactMatch, filterData)
		QueryAuctionItems("", nil, nil, 0, false, 0, true, false, nil)
	end
end

 -- Display the number of items on the current auction house page
local function Count()
	print(GetNumAuctionItems("list") .. " items remaining")
end

local start
local finish

 -- Call GetAuctionItemInfo, GetAuctionItemTimeLeft and GetAuctionItemLink on each auction
local function Scan()
	finish = math.min(GetNumAuctionItems("list"), start + 1000)
	
	for index = start, finish do
		local info = GetAuctionItemInfo("list", index)
		local timeLeft = GetAuctionItemTimeLeft("list", index)
		local link = GetAuctionItemLink("list", index)
	end
	
	if finish < GetNumAuctionItems("list") then
		start = finish
		C_Timer.After(0, Scan)
	else
		print("Finished")
	end
end

local eventFrame = CreateFrame("FRAME")
eventFrame:RegisterEvent("ADDON_LOADED")
eventFrame:SetScript("OnEvent", function(_, event, addon)
	if event == "ADDON_LOADED" and addon == "Test" then
		SlashCmdList["Test"] = function(message)
			if string.lower(message) == "getall" then
				GetAll()
			elseif string.lower(message) == "count" then
				Count()
			elseif string.lower(message) == "scan" then
				start = 1
				Scan()
			end
		end
		
		SLASH_Test1 = "/Test"
	end
end)
  Reply With Quote