WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Sort order not correct C_AuctionHouse.SendSearchA (https://www.wowinterface.com/forums/showthread.php?t=58484)

jpiv 12-24-20 07:51 PM

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!

Ketho 12-25-20 01:40 PM

C_AuctionHouse.SendSearchQuery() requires a table of AuctionHouseSortType

Code:

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

C_AuctionHouse.SendSearchQuery(itemKey, sorts, false)


jpiv 12-26-20 03:44 PM

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


jpiv 12-26-20 07:22 PM

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!


All times are GMT -6. The time now is 11:51 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI