C_AuctionHouse.SendSearchQuery
Queries an item in the auction house.
C_AuctionHouse.SendSearchQuery(itemKey, sorts, separateOwnerItems)
Arguments
- itemKey
- ItemKey
Key | Type | Description |
---|---|---|
itemID | number | |
itemLevel | number? | Default = 0 |
itemSuffix | number? | Default = 0 |
battlePetSpeciesID | number? | Default = 0 |
- sorts
- AuctionHouseSortType[]
Key | Type | Description |
---|---|---|
sortOrder | Enum.AuctionHouseSortOrder? | |
reverseSort | boolean? |
Value | Key | Description |
---|---|---|
0 | Price | |
1 | Name | |
2 | Level | |
3 | Bid | |
4 | Buyout | |
5 | TimeRemaining |
- separateOwnerItems
- boolean
Details
- Does not work through a (macro) script, or it will brick the AH.
- Triggers the respective event for an item/commodity:
- Search queries are restricted to 100 calls per minute. These should not be used to query the entire auction house. See C_AuctionHouse.ReplicateItems()
Example
Sends a search query for [Storm Silver Ore] when the button is pressed. Also prints results when manually browsing the AH.
local test_item = 5956 -- Blacksmith Hammer
local test_commodity = 152579 -- Storm Silver Ore
local f = CreateFrame("Frame")
local btn = CreateFrame("Button", nil, UIParent, "UIPanelButtonTemplate")
btn:SetPoint("CENTER")
btn:SetSize(120, 40)
btn:SetText("Example")
btn:SetScript("OnClick", function(self, button)
local itemKey = C_AuctionHouse.MakeItemKey(test_commodity)
C_AuctionHouse.SendSearchQuery(itemKey, {}, false)
end)
function f:ITEM_SEARCH_RESULTS_UPDATED(event, itemKey)
for i = 1, C_AuctionHouse.GetNumItemSearchResults(itemKey) do
local result = C_AuctionHouse.GetItemSearchResultInfo(itemKey, i)
print(event, itemKey.itemID, i, result.auctionID, result.buyoutAmount)
end
end
function f:COMMODITY_SEARCH_RESULTS_UPDATED(event, itemID)
for i = 1, C_AuctionHouse.GetNumCommoditySearchResults(itemID) do
local result = C_AuctionHouse.GetCommoditySearchResultInfo(itemID, i)
print(event, itemID, i, result.quantity, result.auctionID, result.unitPrice)
end
end
function f:OnEvent(event, ...)
self[event](self, event, ...)
end
f:RegisterEvent("ITEM_SEARCH_RESULTS_UPDATED")
f:RegisterEvent("COMMODITY_SEARCH_RESULTS_UPDATED")
f:SetScript("OnEvent", f.OnEvent)
Addendum: for sorting it requires a table of AuctionHouseSortType. Sorts by price (ascending), and then level (descending).
local sorts = {
{sortOrder = Enum.AuctionHouseSortOrder.Price, reverseSort = false},
{sortOrder = Enum.AuctionHouseSortOrder.Level, reverseSort = true},
}
C_AuctionHouse.SendSearchQuery(itemKey, sorts, false)
Patch changes
Patch 8.3.0 (2020-01-14): Added.[1]
External links
GitHub FrameXML, Gethe
Globe "wut?" Tool, Townlong-Yak
Blizzard API Docs, Townlong-Yak
Offline /api addon, MrBuds
References
- ^ 2020-01-14, Blizzard_AuctionHouseFrame.lua, version 8.3.0.33062, near line 628, archived at Townlong-Yak