Quantcast
WoWInterface - View Single Post - My LUA code dont work in new API 8.3.0 [ auction ] ]
View Single Post
05-10-20, 07:18 PM   #8
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,641
Not sure if it is a bug or not, or we are using it wrong but "REPLICATE_ITEM_LIST_UPDATE" event triggers no sooner than every 15 minutes when the request is sent .. but ... the moment it triggers it hangs the game, even though I am testing for 0 results and not going any further.

So .. instead I registered for every AuctionHouse event to see what did what ..

"AUCTION_HOUSE_BROWSE_RESULTS_UPDATED" appears to trigger when you click the search button. It will return 500 items off the bat

This is an example of one of the table entries that you can retrieve after that event using C_AuctionHouse.GetBrowseResults() which returns a table.

Lua Code:
  1. {
  2.             ["itemKey"] = {
  3.                 ["itemLevel"] = 0,
  4.                 ["itemSuffix"] = 0,
  5.                 ["itemID"] = 129100,
  6.                 ["battlePetSpeciesID"] = 0,
  7.             },
  8.             ["totalQuantity"] = 428,
  9.             ["minPrice"] = 23300,
  10.             ["containsOwnerItem"] = false,
  11.         }, -- [498]

When you select an item in the list the event "AUCTION_HOUSE_NEW_RESULTS_RECEIVED" is triggered along with the relevant itemKey info. An example of which is as follows:

Lua Code:
  1. ["Info"] = {
  2.                     ["isPet"] = false,
  3.                     ["itemName"] = "\"Merry Munchkin\" Costume",
  4.                     ["isCommodity"] = true,
  5.                     ["isEquipment"] = false,
  6.                     ["iconFileID"] = 133169,
  7.                     ["quality"] = 1,
  8.                 },

AUCTION_HOUSE_NEW_RESULTS_RECEIVED also triggers when you click search but the argument is nil so testing for a nil value before trying to process it will stop those errors.

The only other thing you might want to look into is the following:
https://wow.gamepedia.com/API_C_Auct...endBrowseQuery

However, I haven't played with this as it involved building a search query to send, similar to selecting an item type then clicking search.

Here is my addon file that I used to get the above results.

Lua Code:
  1. -- Create or Load Addon WTF Table
  2. XrystalUI_Auctioneer_Info = XrystalUI_Auctioneer_Info or {}
  3.  
  4. local function OnEvent(self, event, ...)
  5.     print(event,...)
  6.     if event == "AUCTION_HOUSE_SHOW" then        
  7.     elseif event == "AUCTION_HOUSE_BROWSE_RESULTS_UPDATED" then
  8.         XrystalUI_Auctioneer_Info["BrowseResults"] = XrystalUI_Auctioneer_Info["BrowseResults"] or {}
  9.         XrystalUI_Auctioneer_Info["BrowseResults"] = C_AuctionHouse.GetBrowseResults()
  10.     elseif event == "AUCTION_HOUSE_NEW_RESULTS_RECEIVED" then
  11.         local itemKey = ...
  12.         if ( itemKey ) then
  13.             XrystalUI_Auctioneer_Info["NewResults"] = XrystalUI_Auctioneer_Info["NewResults"] or {}
  14.             XrystalUI_Auctioneer_Info["NewResults"]["itemKey"] = XrystalUI_Auctioneer_Info["NewResults"]["itemKey"] or {}
  15.             local itemKeyInfo = C_AuctionHouse.GetItemKeyInfo(itemKey)
  16.             local itemKeyInfoResults = { itemKey, itemKeyInfo }
  17.             table.insert(XrystalUI_Auctioneer_Info["NewResults"]["itemKey"],itemKeyInfoResults)
  18.         end
  19.     end
  20. end
  21.  
  22. local f = CreateFrame("Frame")
  23. f:RegisterEvent("AUCTION_HOUSE_SHOW")
  24. f:RegisterEvent("AUCTION_HOUSE_BROWSE_RESULTS_UPDATED")
  25. f:RegisterEvent("AUCTION_HOUSE_NEW_RESULTS_RECEIVED") -- [itemKey]
  26. f:SetScript("OnEvent", OnEvent)
__________________
  Reply With Quote