Thread Tools Display Modes
12-24-20, 07:51 PM   #1
jpiv
A Defias Bandit
Join Date: Dec 2020
Posts: 3
Sort order not correct C_AuctionHouse.SendSearchA

I've been trying to debug this all day

I'm trying to send a search for specific items on the AH and I'm listening to the
ITEM_SEARCH_RESULTS_UPDATED
event.

The issue I'm having is that no matter what I pass in for the sort parameter I always get the items in the same sort order(bid sorted). Here is how I'm search and getting the item info:

This is confusing me to no end so if someone has experience with this help would be amazing

Code:
	local numResults = C_AuctionHouse.GetNumItemSearchResults(itemKey)
	if numResults > 0 then
		local results = {} 
		for i = 1, numResults do
			local info = C_AuctionHouse.GetItemSearchResultInfo(itemKey, i)
			table.insert(results, info)
		end

           .

           .

           .
Code:
	for _, auction in pairs(AH.ownedAuctions) do
		if AH.scannedAuctions[auction.itemKey.itemID] == nil then
			local sort = {
				sortOrder = Enum.AuctionHouseSortOrder.Buyout,
				reverseOrder = false
			}
			C_AuctionHouse.SendSearchQuery(auction.itemKey, sort, true)
		end
	end
Thanks!
  Reply With Quote
12-25-20, 01:40 PM   #2
Ketho
A Pyroguard Emberseer
 
Ketho's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,026
C_AuctionHouse.SendSearchQuery() requires a table of AuctionHouseSortType

Code:
local sorts = {
	{
		sortOrder = Enum.AuctionHouseSortOrder.Buyout,
		reverseSort = false
	}
}

C_AuctionHouse.SendSearchQuery(itemKey, sorts, false)
  Reply With Quote
12-26-20, 03:44 PM   #3
jpiv
A Defias Bandit
Join Date: Dec 2020
Posts: 3
Thanks for the reply!
I thought that might have to do with it but, when I change

Code:
local sort = {
	sortOrder = Enum.AuctionHouseSortOrder.Buyout,
	reverseOrder = false
}
C_AuctionHouse.SendSearchQuery(auction.itemKey, sort, true)
To

Code:
C_AuctionHouse.SendSearchQuery(auction.itemKey, {sort}, true)
I get this usage error seeming to indicate that I am not using the API correctly? is there maybe something else I'm doing incorrectly or a way to supress this error? Or another addon interfering? Because I did look at other examples which also call that function in the way you suggested:

Code:
Message: Usage: C_AuctionHouse.SendSearchQuery(itemKey, sorts, separateOwnerItems)
Time: Sat Dec 26 16:42:37 2020
Count: 1
Stack: Usage: C_AuctionHouse.SendSearchQuery(itemKey, sorts, separateOwnerItems)
[string "@Interface\AddOns\TradeSkillMaster\LibTSM\Service\ErrorHandler.lua"]:758: in function <...Ons\TradeSkillMaster\LibTSM\Service\ErrorHandler.lua:717>
[string "=[C]"]: ?
[string "=[C]"]: ?
[string "=[C]"]: ?
[string "=[C]"]: in function `SendSearchQuery'
[string "@Interface\AddOns\UndercutMaster\AH.lua"]:181: in function `getFilteredAuctions'
[string "@Interface\AddOns\UndercutMaster\UndercutManager.lua"]:21: in function `undercut'
[string "@Interface\AddOns\UndercutMaster\UI.lua"]:12: in function <Interface\AddOns\UndercutMaster\UI.lua:11>

Locals: errMsg = "Usage: C_AuctionHouse.SendSearchQuery(itemKey, sorts, separateOwnerItems)"
isBugGrabber = nil
tsmErrMsg = nil
oldModule = nil
private = <table> {
 globalNameTranslation = <table> {
 }
 FormatErrorMessageSection = <function> defined @Interface\AddOns\TradeSkillMaster\LibTSM\Service\ErrorHandler.lua:517
 ErrorHandler = <function> defined @Interface\AddOns\TradeSkillMaster\LibTSM\Service\ErrorHandler.lua:134
 origErrorHandler = <function> defined @Interface\SharedXML\SharedBasicControls.lua:355
 hitInternalError = false
 CreateErrorFrame = <function> defined @Interface\AddOns\TradeSkillMaster\LibTSM\Service\ErrorHandler.lua:536
 num = 0
 SanitizeString = <function> defined @Interface\AddOns\TradeSkillMaster\LibTSM\Service\ErrorHandler.lua:510
  Reply With Quote
12-26-20, 07:22 PM   #4
jpiv
A Defias Bandit
Join Date: Dec 2020
Posts: 3
OMG!

You are correct I needed to pass it as a list but, I had used "reverseSort" as a key instead of "reverseOrder"
-_-
Which is why I was getting the Usage error

Everything is working great now, thanks for pointing me in the right direction!
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Sort order not correct C_AuctionHouse.SendSearchA

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off