C_AuctionHouse.GetReplicateItemInfo

From Warcraft Wiki
Jump to navigation Jump to search

Returns information about the specified auction.

name, texture, count, qualityID, usable, level, levelType, minBid, minIncrement, buyoutPrice, bidAmount, highBidder, bidderFullName, owner, ownerFullName, saleStatus, itemID, hasAllInfo = C_AuctionHouse.GetReplicateItemInfo(index)

Arguments

index
number - index, ranging from 0 up to C_AuctionHouse.GetNumReplicateItems()-1

Returns

1. name
string?
2. texture
number?
3. count
number
4. qualityID
number
5. usable
boolean?
6. level
number
7. levelType
string?
8. minBid
number
9. minIncrement
number
10. buyoutPrice
number
11. bidAmount
number
12. highBidder
string?
13. bidderFullName
string?
14. owner
string? - Always returns nil, except for your own auctions.
15. ownerFullName
string? - Always returns nil
16. saleStatus
number
17. itemID
number
18. hasAllInfo
boolean?

Example

Before and after all info is available for an auction item. Only count, minBid, buyoutPrice and itemID are available immediately. (Pre-hotfix dump with owner and ownerFullName)

/dump C_AuctionHouse.GetReplicateItemInfo(1)
"", nil, 4, -1, false, 2766221440, nil, 0, 0, 40000, 0, nil, nil, nil, nil, 0, 36901, false
"Goldclover", 134211, 4, 1, true, 1, "REQ_LEVEL_ABBR", 0, 0, 40000, 0, nil, nil, "Rialini", "Rialini-Ahn'Qiraj", 0, 36901, true

Attempts to query the auction house when opened and loads any uncached items from the server.

local initialQuery
local auctions = {}
 
local function ScanAuctions()
	local beginTime = debugprofilestop()
	local continuables = {}
	wipe(auctions)
	for i = 0, C_AuctionHouse.GetNumReplicateItems()-1 do
		auctions[i] = {C_AuctionHouse.GetReplicateItemInfo(i)}
		if not auctions[i][18] then -- hasAllInfo
			local item = Item:CreateFromItemID(auctions[i][17]) -- itemID
			continuables[item] = true

			item:ContinueOnItemLoad(function()
				auctions[i] = {C_AuctionHouse.GetReplicateItemInfo(i)}
				continuables[item] = nil
				if not next(continuables) then
					print(format("Scanned %d auctions in %d milliseconds", #auctions+1, debugprofilestop()-beginTime))
					-- do something with `auctions` or fire some callback
				end
			end)
		end
	end
end

local function OnEvent(self, event)
	if event == "AUCTION_HOUSE_SHOW" then
		C_AuctionHouse.ReplicateItems()
		initialQuery = true
	elseif event == "REPLICATE_ITEM_LIST_UPDATE" then
		if initialQuery then
			ScanAuctions()
			initialQuery = false
		end
	end
end

local f = CreateFrame("Frame")
f:RegisterEvent("AUCTION_HOUSE_SHOW")
f:RegisterEvent("REPLICATE_ITEM_LIST_UPDATE")
f:SetScript("OnEvent", OnEvent)
> Scanned 81338 auctions in 2644 milliseconds

Patch changes

Shadowlands Patch 9.0.2 (2020-11-17): Hotfixed owner and ownerFullName to always return nil (except for your own auctions) as that seemed to be the cause of disconnects.
Battle for Azeroth Patch 8.3.0 (2020-01-14): Added. Replaces GetAuctionItemInfo()[1]

See also