Thread Tools Display Modes
05-06-20, 10:18 PM   #1
lungdesire
A Deviate Faerie Dragon
Join Date: May 2020
Posts: 13
My LUA code dont work in new API 8.3.0 [ auction ] ]

Hello.
My LUA code work in old API.

Code:
local frame = CreateFrame("Frame");
frame:RegisterEvent("AUCTION_HOUSE_SHOW");
frame:RegisterEvent("AUCTION_ITEM_LIST_UPDATE");
frame:Hide();

frame:SetScript("OnEvent", function(self, event, ...)

  if (event == "AUCTION_HOUSE_SHOW") then
  local val
  auk = {
        "GUMM-E",
        "Sunreaver Micro-Sentry"
      }

    for key, val in pairs(auk) do
      QueryAuctionItems(val, minLevel, maxLevel, invTypeIndex, classIndex, subclassIndex, page, isUsable, qualityIndex);
      print(val);
    end;
  end;

  if (event == "AUCTION_ITEM_LIST_UPDATE") then
    local name, texture, count, quality, canUse, level, levelColHeader, minBid, minIncrement,
    buyoutPrice, bidAmount, highBidder, highBidderFullName, owner, ownerFullName,
    saleStatus, itemId, hasAllInfo = GetAuctionItemInfo("list", 1);
    print(name, buyoutPrice)
  end

end)
How it work in the new API 8.3.0?

Dont know, how work "C_AuctionHouse.GetReplicateItemInfo".

Thanks all.
  Reply With Quote
05-07-20, 07:54 AM   #2
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,237
I don't see AUCTION_ITEM_LIST_UPDATE on the 8.3 auction house event list.

Here are the APIs too, if you are interested.
  Reply With Quote
05-07-20, 09:33 AM   #3
lungdesire
A Deviate Faerie Dragon
Join Date: May 2020
Posts: 13
Ok. Why this code dont work?

Code:
local frame = CreateFrame("Frame");
frame:RegisterEvent("AUCTION_HOUSE_SHOW");
frame:Hide();

frame:SetScript("OnEvent", function(self, event, ...)

  if (event == "AUCTION_HOUSE_SHOW") then
  local name, texture, count, quality, canUse, level, levelColHeader, minBid, minIncrement,
  buyoutPrice, bidAmount, highBidder, highBidderFullName, owner, ownerFullName,
  saleStatus, itemId, hasAllInfo = C_AuctionHouse.ReplicateItems("Anchor Weed", nil, nil, 0, 0 , 0, 0, 0, 0, false, false);
  print(name)
  end
end)
  Reply With Quote
05-07-20, 09:48 AM   #4
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,877
Originally Posted by lungdesire View Post
Ok. Why this code dont work?

Code:
local frame = CreateFrame("Frame");
frame:RegisterEvent("AUCTION_HOUSE_SHOW");
frame:Hide();

frame:SetScript("OnEvent", function(self, event, ...)

  if (event == "AUCTION_HOUSE_SHOW") then
  local name, texture, count, quality, canUse, level, levelColHeader, minBid, minIncrement,
  buyoutPrice, bidAmount, highBidder, highBidderFullName, owner, ownerFullName,
  saleStatus, itemId, hasAllInfo = C_AuctionHouse.ReplicateItems("Anchor Weed", nil, nil, 0, 0 , 0, 0, 0, 0, false, false);
  print(name)
  end
end)
You will want to do something similar to the following .. it is not complete and not tested. It is based on my work with spell info request on one of my addons. In theory it should work in a similar way.

Lua Code:
  1. -- Register Auction Events
  2.     frame:RegisterEvent("REPLICATE_ITEM_LIST_UPDATE")  -- Triggers after a call to ReplicateItems()
  3.     frame:RegisterEvent("AUCTION_HOUSE_SHOW") -- Triggers when you first show the auction house
  4.  
  5.  
  6. -- After event AUCTION_HOUSE_SHOW is triggered use this when you are ready to request items from the auction house
  7.    C_AuctionHouse.ReplcateItems()
  8.  
  9.  
  10.  
  11. -- After event REPLICATE_ITEM_LIST_UPDATE is triggered do the following and other similar functions to access the available item details.
  12.  
  13. -- Find the total number of items found after the call to ReplicateItems()
  14.    numReplicateItems = C_AuctionHouse.GetNumReplicateItems()
  15.  
  16.  
  17.    for index = 1,numReplicateItems do
  18.  
  19.         -- Retrieve info for item on this line
  20.         local name, texture, count, qualityID, usable, level, levelType, minBid,
  21.         minIncrement, buyoutPrice, bidAmount, highBidder, bidderFullName, owner,
  22.         ownerFullName,  saleStatus, itemID, hasAllInfo
  23.         = C_AuctionHouse.GetReplicateItemInfo(index)
  24.         -- Assuming name has a value at this point you should have useful info.
  25.    end


To go with the link already provided ..

Auction House specific events
https://wow.gamepedia.com/Events#C_AuctionHouse

Auction House specific functions
https://wow.gamepedia.com/World_of_W...#Auction_House


Some haven't been fully tracked down/identified yet so you may have to trial and error things to find out how they all work and when to use them.
__________________

Last edited by Xrystal : 05-07-20 at 10:21 AM.
  Reply With Quote
05-09-20, 07:34 AM   #5
lungdesire
A Deviate Faerie Dragon
Join Date: May 2020
Posts: 13
Thank you i will try
  Reply With Quote
05-10-20, 04:51 PM   #6
lungdesire
A Deviate Faerie Dragon
Join Date: May 2020
Posts: 13
please talk to me how work tis code?

local auctions = {}

local function OnEvent(self, event)
if event == "AUCTION_HOUSE_SHOW" then
C_AuctionHouse.ReplicateItems()
elseif event == "REPLICATE_ITEM_LIST_UPDATE" then
wipe(auctions)
for i = 1, C_AuctionHouse.GetNumReplicateItems() do
auctions[i] = {C_AuctionHouse.GetReplicateItemInfo(i)}
end
print(format("Queried %d items", #auctions))
end
end

local f = CreateFrame("Frame")
f:RegisterEvent("AUCTION_HOUSE_SHOW")
f:RegisterEvent("REPLICATE_ITEM_LIST_UPDATE")
f:SetScript("OnEvent", OnEvent)
  Reply With Quote
05-10-20, 05:39 PM   #7
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,877
Originally Posted by lungdesire View Post
local auctions = {}

local function OnEvent(self, event)
if event == "AUCTION_HOUSE_SHOW" then
C_AuctionHouse.ReplicateItems()
elseif event == "REPLICATE_ITEM_LIST_UPDATE" then
wipe(auctions)
for i = 1, C_AuctionHouse.GetNumReplicateItems() do
auctions[i] = {C_AuctionHouse.GetReplicateItemInfo(i)}
end
print(format("Queried %d items", #auctions))
end
end

local f = CreateFrame("Frame")
f:RegisterEvent("AUCTION_HOUSE_SHOW")
f:RegisterEvent("REPLICATE_ITEM_LIST_UPDATE")
f:SetScript("OnEvent", OnEvent)
What happens when you open the auction house window ?

Also, have you looked at the code for the auction addons that are likely doing similar access requests ?

Ah .. I see .. Replicate_Item_List_Update hangs the game and causes you to crash out .. Trying another angle.
__________________

Last edited by Xrystal : 05-10-20 at 06:00 PM.
  Reply With Quote
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,877
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
05-10-20, 10:20 PM   #9
Ketho
A Pyroguard Emberseer
 
Ketho's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,026
Originally Posted by Xrystal View Post
Ah .. I see .. Replicate_Item_List_Update hangs the game and causes you to crash out .. Trying another angle.

I only tested it on the PTR which had around 40 different items on the whole auction house, I knew it would spam but didn't really expect the game to crash; will have to resub and update the snippet to somehow throttle itself as well

Last edited by Ketho : 05-10-20 at 10:32 PM.
  Reply With Quote
05-11-20, 12:06 AM   #10
lungdesire
A Deviate Faerie Dragon
Join Date: May 2020
Posts: 13
But how print in chat minPrice and name seller? Need an example "Sealed Tome of the Lost Legion". Thanks
  Reply With Quote
05-11-20, 06:37 AM   #11
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,877
Originally Posted by lungdesire View Post
But how print in chat minPrice and name seller? Need an example "Sealed Tome of the Lost Legion". Thanks
There are probably a number of functions that you can use... like me you may have to play with a few to see what they do if wowpedia doesn't have clear documentation or the blizzard files don't use them in their own code.

I just noticed that "ITEM_SEARCH_RESULTS_UPDATED" event has the following event parameters
local itemKey, auctionID = ...;

But I haven't figured out which of the different functions/events will utilise that auctionID to get access to the individual owner of that auction.

However,

result = C_AuctionHouse.GetItemSearchResultInfo(itemKey, itemSearchResultIndex)

returns multiple details for that particular item, including a list of owners selling that particular item. Remember, the change made to the auction house is that rather than seeing an individual auction item you are seeing an item being auctioned by many people and you are just buying x amount of them without knowing who you are buying from.

https://wow.gamepedia.com/API_C_Auct...archResultInfo

The above think will work after a call to this function ( 100 per minute allowed )
C_AuctionHouse.SendSearchQuery(itemKey, sorts, separateOwnerItems)
https://wow.gamepedia.com/API_C_Auct...endSearchQuery

This call then has the events
"COMMODITY_SEARCH_RESULTS_UPDATED"
"ITEM_SEARCH_RESULTS_UPDATED"
that will trigger when the results are ready and you can use the above GetItemSearchResult functions to get the Item details and there are functions that work similarly for commodities.


There may be more fancier ways of getting at the data though if the Blizzard Auction House code is to go by.
https://www.townlong-yak.com/framexm...eFrame.lua#628


This link details the changes made to the AuctionHouse as a whole. It might be that your addon will have to change to work within the new system.

https://www.wowhead.com/news=295491/...sions-of-nzoth
__________________

Last edited by Xrystal : 05-11-20 at 07:58 AM.
  Reply With Quote
05-11-20, 11:50 AM   #12
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,877
Okay .. after playing with my little project addon for a little while I came up with the following results.

Events:
AUCTION_HOUSE_BROWSE_RESULTS_UPDATED - Triggered when you click Search
AUCTION_HOUSE_NEW_RESULTS_RECEIVED - Triggered when you click on a specific item on the list


Functions:
local results = C_AuctionHouse.GetBrowseResults()
Used after AUCTION_HOUSE_BROWSE_RESULTS_UPDATED returns a table with the following as example entries
Lua Code:
  1. {
  2.             ["itemKey"] = {
  3.                 ["itemLevel"] = 0,
  4.                 ["itemSuffix"] = 0,
  5.                 ["itemID"] = 159827,
  6.                 ["battlePetSpeciesID"] = 0,
  7.             },
  8.             ["totalQuantity"] = 20,
  9.             ["minPrice"] = 100,
  10.             ["containsOwnerItem"] = false,
  11.         }, -- [4]
  12.         {
  13.             ["itemKey"] = {
  14.                 ["itemLevel"] = 1,
  15.                 ["itemSuffix"] = 0,
  16.                 ["itemID"] = 54456,
  17.                 ["battlePetSpeciesID"] = 0,
  18.             },
  19.             ["totalQuantity"] = 1,
  20.             ["minPrice"] = 100,
  21.             ["containsOwnerItem"] = false,
  22.         }, -- [16]


local itemKeyInfo = C_AuctionHouse.GetItemKeyInfo(itemKey)
Used after AUCTION_HOUSE_NEW_RESULTS_RECEIVED returns the following table
The following are two tables, one commodity, one item
Lua Code:
  1. {
  2.                     ["isPet"] = false,
  3.                     ["itemName"] = "Bomb-samdi Mojo Bombs",
  4.                     ["isCommodity"] = true,
  5.                     ["isEquipment"] = false,
  6.                     ["iconFileID"] = 463515,
  7.                     ["quality"] = 2,
  8.                 }, -- [2]
  9.  
  10.                 {
  11.                     ["isPet"] = false,
  12.                     ["itemName"] = "Mournful Essence",
  13.                     ["isCommodity"] = false,
  14.                     ["isEquipment"] = false,
  15.                     ["iconFileID"] = 132871,
  16.                     ["quality"] = 1,
  17.                 }, -- [2]


You can then use the following function to find out what auctions there are relating to that item

Lua Code:
  1. local sorts = { sortOrder = Enum.AuctionHouseSortOrder.Price, reverseSort = false }
  2.             local separateOwnerItems = true
  3.             C_AuctionHouse.SendSearchQuery(itemKey, sorts, separateOwnerItems)

This then results in either an ITEM_SEARCH_RESULTS_UPDATED event call or COMMODITY_SEARCH_RESULTS_UPDATED event call.

For Items ..
Lua Code:
  1. local itemKey, auctionID = ...
  2.             local numResults = C_AuctionHouse.GetNumItemSearchResults(itemKey)
  3.             for index = 1, numResults do        
  4.                 local result = C_AuctionHouse.GetItemSearchResultInfo(itemKey, index)
  5.                 ....
  6.             end

Resulting in the following table contents
Lua Code:
  1. {
  2.                     ["itemKey"] = {
  3.                         ["itemLevel"] = 1,
  4.                         ["itemSuffix"] = 0,
  5.                         ["itemID"] = 54456,
  6.                         ["battlePetSpeciesID"] = 0,
  7.                     },
  8.                     ["containsOwnerItem"] = false,
  9.                     ["buyoutAmount"] = 100,
  10.                     ["itemLink"] = "|cffffffff|Hitem:54456::::::::110:264::::::|h[Mournful Essence]|h|r",
  11.                     ["quantity"] = 1,
  12.                     ["containsSocketedItem"] = false,
  13.                     ["owners"] = {
  14.                         "Riannia", -- [1]
  15.                     },
  16.                     ["containsAccountItem"] = false,
  17.                     ["timeLeft"] = 2,
  18.                     ["auctionID"] = 2092193565,
  19.                 }, -- [1]


For Commodities ..
Lua Code:
  1. local itemID = ...
  2.             local numResults = C_AuctionHouse.GetNumCommoditySearchResults(itemID)
  3.             for index = 1,numResults do
  4.                 local result = C_AuctionHouse.GetCommoditySearchResultInfo(itemID, index)
  5.                 ....
  6.             end

Which results in the following table of data
Lua Code:
  1. {
  2.                     ["containsOwnerItem"] = false,
  3.                     ["timeLeftSeconds"] = 27423,
  4.                     ["quantity"] = 20,
  5.                     ["itemID"] = 159827,
  6.                     ["owners"] = {
  7.                         "Galdrena", -- [1]
  8.                         "Rhys", -- [2]
  9.                     },
  10.                     ["unitPrice"] = 100,
  11.                     ["containsAccountItem"] = false,
  12.                     ["numOwnerItems"] = 0,
  13.                     ["auctionID"] = 2092122023,
  14.                 }, -- [1]

It is then the case of accessing the table contents as per normal for display purposes.

This of course still relies on you making that initial search and clicking the button and isn't automated at all. I suspect there is a way of doing this periodically using other functions. But whichever way you use auction house api ( if there is more than one way ) you will ultimately end up with repeating event calls for commodity and item updates after you have requested an auction search query.

I then added the following to automate searching for a specific set of items and then one of the items in the list generated.. it didn't work quite right but will give an idea of what is possible but it does mean you don't have to click and select to get information out. You just have to have opened the auction house window to start it off.

Lua Code:
  1. if event == "AUCTION_HOUSE_SHOW" then  
  2.  
  3.         local searchString = "Netherweave"
  4.         local minLevel = nil
  5.         local maxLevel = nil
  6.         local filtersArray = nil
  7.         local filterData = { classID = LE_ITEM_CLASS_CONTAINER, subClassID = nil, inventoryType = nil }
  8.         local sorts = { sortOrder = Enum.AuctionHouseSortOrder.Price, reverseSort = false }
  9.        
  10.         local query = {};
  11.         query.searchString = searchString;
  12.         query.minLevel = minLevel;
  13.         query.maxLevel = maxLevel;
  14.         query.filters = filtersArray;
  15.         query.itemClassFilters = filterData;
  16.         query.sorts = sorts
  17.        
  18.         XrystalUI_Auctioneer_Info = {}
  19.         print("Sending Browse Query Automatically")
  20.         C_AuctionHouse.SendBrowseQuery(query);        
  21.        
  22.     elseif event == "AUCTION_HOUSE_BROWSE_RESULTS_UPDATED" then
  23.        
  24.         -- Get the first 500 items
  25.         local results = C_AuctionHouse.GetBrowseResults()
  26.        
  27.          local itemKey = results[1].itemKey
  28.          local sorts = { sortOrder = Enum.AuctionHouseSortOrder.Price, reverseSort = false }
  29.          local separateOwnerItems = true
  30.          print("Automatically searching for item ", itemKey)
  31.          C_AuctionHouse.SendSearchQuery(itemKey, sorts, separateOwnerItems)
  32.                
  33.         -- Store for later retrieval
  34.         XrystalUI_Auctioneer_Info["BrowseResults"] = results



So my final version of my addon file is as follows:
Lua Code:
  1. XrystalUI_Auctioneer_Info = XrystalUI_Auctioneer_Info or {}
  2.  
  3. local function OnEvent(self, event, ...)
  4.    
  5.     if event == "AUCTION_HOUSE_SHOW" then  
  6.  
  7.         local searchString = "Netherweave"
  8.         local minLevel = nil
  9.         local maxLevel = nil
  10.         local filtersArray = nil
  11.         local filterData = { classID = LE_ITEM_CLASS_CONTAINER, subClassID = nil, inventoryType = nil }
  12.         local sorts = { sortOrder = Enum.AuctionHouseSortOrder.Price, reverseSort = false }
  13.        
  14.         local query = {};
  15.         query.searchString = searchString;
  16.         query.minLevel = minLevel;
  17.         query.maxLevel = maxLevel;
  18.         query.filters = filtersArray;
  19.         query.itemClassFilters = filterData;
  20.         query.sorts = sorts
  21.        
  22.         XrystalUI_Auctioneer_Info = {}
  23.         print("Sending Browse Query Automatically")
  24.         C_AuctionHouse.SendBrowseQuery(query);        
  25.        
  26.     elseif event == "AUCTION_HOUSE_BROWSE_RESULTS_UPDATED" then
  27.        
  28.         -- Get the first 500 items
  29.         local results = C_AuctionHouse.GetBrowseResults()
  30.        
  31.          local itemKey = results[1].itemKey
  32.          local sorts = { sortOrder = Enum.AuctionHouseSortOrder.Price, reverseSort = false }
  33.          local separateOwnerItems = true
  34.          print("Automatically searching for item ", itemKey)
  35.          C_AuctionHouse.SendSearchQuery(itemKey, sorts, separateOwnerItems)
  36.        
  37.        
  38.         -- Store for later retrieval
  39.         XrystalUI_Auctioneer_Info["BrowseResults"] = results
  40.        
  41.     elseif event == "AUCTION_HOUSE_NEW_RESULTS_RECEIVED" then
  42.         local itemKey = ...
  43.         if ( itemKey ) then
  44.            
  45.             -- Retrieve Info about this item
  46.             local itemKeyInfo = C_AuctionHouse.GetItemKeyInfo(itemKey)
  47.            
  48.             -- Store for later retrieval
  49.             XrystalUI_Auctioneer_Info["NewResults"] = XrystalUI_Auctioneer_Info["NewResults"] or {}
  50.             XrystalUI_Auctioneer_Info["NewResults"]["itemKey"] = {}
  51.             XrystalUI_Auctioneer_Info["NewResults"]["itemKey"].Key = itemKey
  52.             XrystalUI_Auctioneer_Info["NewResults"]["itemKey"].Info = itemKeyInfo
  53.            
  54.             -- Request more details about this item's auctions
  55.             local sorts = { sortOrder = Enum.AuctionHouseSortOrder.Price, reverseSort = false }
  56.             local separateOwnerItems = true
  57.             C_AuctionHouse.SendSearchQuery(itemKey, sorts, separateOwnerItems)
  58.            
  59.         end
  60.        
  61.     elseif event == "ITEM_SEARCH_RESULTS_UPDATED" then
  62.         local itemKey, auctionID = ...
  63.         local itemID = itemKey.itemID
  64.         if itemKey then
  65.            
  66.             -- Get the number of auctions for this itemKey
  67.             local numResults = C_AuctionHouse.GetNumItemSearchResults(itemKey)
  68.  
  69.             -- Store for later retrieval
  70.             XrystalUI_Auctioneer_Info["ItemSearchResults"] = XrystalUI_Auctioneer_Info["ItemSearchResults"] or {}
  71.             XrystalUI_Auctioneer_Info["ItemSearchResults"][itemID] = {}
  72.             XrystalUI_Auctioneer_Info["ItemSearchResults"][itemID].itemKey = itemKey
  73.             XrystalUI_Auctioneer_Info["ItemSearchResults"][itemID].auctionID = auctionID
  74.             XrystalUI_Auctioneer_Info["ItemSearchResults"][itemID].Auctions = {}
  75.  
  76.             -- Get the auction entries for this item
  77.             for index = 1, numResults do        
  78.                 local result = C_AuctionHouse.GetItemSearchResultInfo(itemKey, index)
  79.                
  80.                 -- Add this entry to our list of auctions
  81.                 table.insert(XrystalUI_Auctioneer_Info["ItemSearchResults"][itemID].Auctions,result)
  82.             end
  83.  
  84.            
  85.         end
  86.                
  87.     elseif event == "COMMODITY_SEARCH_RESULTS_UPDATED" then
  88.         local itemID = ...
  89.         if itemID then
  90.            
  91.             -- Get the number of auctions for this commodity item
  92.             local numResults = C_AuctionHouse.GetNumCommoditySearchResults(itemID)
  93.            
  94.             -- Store for later retrieval
  95.             XrystalUI_Auctioneer_Info["CommoditiesSearchResults"] = XrystalUI_Auctioneer_Info["CommoditiesSearchResults"] or {}
  96.             XrystalUI_Auctioneer_Info["CommoditiesSearchResults"][itemID] = {}
  97.             XrystalUI_Auctioneer_Info["CommoditiesSearchResults"][itemID].Auctions = {}
  98.            
  99.             -- Get the auction entries for this commodity
  100.             for index = 1,numResults do
  101.                 local result = C_AuctionHouse.GetCommoditySearchResultInfo(itemID, index)
  102.                 table.insert(XrystalUI_Auctioneer_Info["CommoditiesSearchResults"][itemID].Auctions,result)
  103.             end
  104.         end
  105.     end
  106. end
  107.  
  108. local f = CreateFrame("Frame")
  109. f:RegisterEvent("AUCTION_HOUSE_SHOW")
  110. f:RegisterEvent("AUCTION_HOUSE_BROWSE_RESULTS_UPDATED")
  111. f:RegisterEvent("AUCTION_HOUSE_NEW_RESULTS_RECEIVED") -- [itemKey]
  112. f:RegisterEvent("ITEM_SEARCH_RESULTS_UPDATED")
  113. f:RegisterEvent("COMMODITY_SEARCH_RESULTS_UPDATED")
  114. f:SetScript("OnEvent", OnEvent)

Hopefully this will help lead you to identifying what you need to do to make your addon work as close to its original design as possible. Printing out the results are as simple as accessing the relevant part of the table returned.
__________________
  Reply With Quote
05-15-20, 06:29 AM   #13
lungdesire
A Deviate Faerie Dragon
Join Date: May 2020
Posts: 13
Thanks, I will work with your code.
  Reply With Quote
05-21-20, 07:21 AM   #14
Ketho
A Pyroguard Emberseer
 
Ketho's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,026
Originally Posted by Xrystal View Post
Ah .. I see .. Replicate_Item_List_Update hangs the game and causes you to crash out .. Trying another angle.

I updated the wiki with an approach that caches items with ItemMixin:ContinueOnItemLoad()



https://wow.gamepedia.com/API_C_Auct...ReplicateItems
Lua Code:
  1. local initialQuery
  2. local auctions = {}
  3.  
  4. local function ScanAuctions()
  5.     local beginTime = debugprofilestop()
  6.     local continuables = {}
  7.     wipe(auctions)
  8.     for i = 0, C_AuctionHouse.GetNumReplicateItems()-1 do
  9.         auctions[i] = {C_AuctionHouse.GetReplicateItemInfo(i)}
  10.         if not auctions[i][18] then -- hasAllInfo
  11.             local item = Item:CreateFromItemID(auctions[i][17]) -- itemID
  12.             continuables[item] = true
  13.  
  14.             item:ContinueOnItemLoad(function()
  15.                 auctions[i] = {C_AuctionHouse.GetReplicateItemInfo(i)}
  16.                 continuables[item] = nil
  17.                 if not next(continuables) then
  18.                     print(format("Scanned %d items in %d milliseconds", #auctions+1, debugprofilestop()-beginTime))
  19.                 end
  20.             end)
  21.         end
  22.     end
  23. end
  24.  
  25. local function OnEvent(self, event)
  26.     if event == "AUCTION_HOUSE_SHOW" then
  27.         C_AuctionHouse.ReplicateItems()
  28.         initialQuery = true
  29.     elseif event == "REPLICATE_ITEM_LIST_UPDATE" then
  30.         if initialQuery then
  31.             ScanAuctions()
  32.             initialQuery = false
  33.         end
  34.     end
  35. end
  36.  
  37. local f = CreateFrame("Frame")
  38. f:RegisterEvent("AUCTION_HOUSE_SHOW")
  39. f:RegisterEvent("REPLICATE_ITEM_LIST_UPDATE")
  40. f:SetScript("OnEvent", OnEvent)
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » My LUA code dont work in new API 8.3.0 [ auction ] ]

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