Quantcast
How to hook C_AuctionHouse.PostItem? - WoWInterface
Thread Tools Display Modes
01-25-20, 08:49 AM   #1
Xruptor
A Flamescale Wyrmkin
 
Xruptor's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2005
Posts: 121
How to hook C_AuctionHouse.PostItem?

I have tried several methods to hook into C_AuctionHouse.PostItem. I want to fire off an event and function when this function is used. However, I don't want to indirectly taint the above function.

Code:
oldFunction = C_AuctionHouse.PostItem
C_AuctionHouse.PostItem = function newFunction() end
I don't want to use code above. That is just insecure and will cause taint issues.

I've used the following code but it does not track whether an item is posted or failed from being posted. It just triggers C_AuctionHouse.PostItem.
Code:
AuctionHouseFrame.CommoditiesSellFrame.PostButton:HookScript("OnClick", function () print('test') end)
I've tried the following.

Code:
hooksecurefunc(C_AuctionHouse, "PostItem", function() print('test') end)
Although it does not cause an error and does hook the function, the hook never properly fires off and I never see the test print. Mind you this is just an example.

Code:
hooksecurefunc(AuctionHouseFrame.CommoditiesSellFrame, "PostItem", function(self)
  print("CommoditiesSellFrame",self:CanPostItem())
end)
I've tried the above code and although it DOES hook properly and fire off when an item is posted. It never registers the item properly in the hook return and thus CanPostItem() is always false.

Here is the global Blizzard code dump I use.
(https://github.com/Gethe/wow-ui-sour...mSellFrame.lua)

There seems to be several mixins that use C_AuctionHouse.PostItem. That is why I just want to hook the parent C_AuctionHouse.PostItem function.

NOTE: I want to point out that the event "OWNED_AUCTIONS_UPDATED" does not fire when using the Sell Frame or Sell Tab on the Auction House. When an item is posted that event is never triggered for some reason. The only other event that seems to fire is "COMMODITY_SEARCH_RESULTS_UPDATED" but it's very unreliable.

So what would be the appropriate way to hook into C_AuctionHouse.PostItem so I can track when items are posted? Is there a better way with the new Auction House code?
__________________
Click HERE for the ultimate idiot test.

if (sizeof(sadness) > sizeof(happiness)) { initDepression(); }

Last edited by Xruptor : 01-25-20 at 08:53 AM.
  Reply With Quote
01-26-20, 09:23 AM   #2
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 1,931
I don't know the difference yet, but some items use C_AuctionHouse.PostItem() and others use C_AuctionHouse.PostCommodity(). The frame template changes when you select an item to post.
__________________
ESOUI AddOns | WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote
01-26-20, 10:39 AM   #3
Xruptor
A Flamescale Wyrmkin
 
Xruptor's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2005
Posts: 121
Originally Posted by SDPhantom View Post
I don't know the difference yet, but some items use C_AuctionHouse.PostItem() and others use C_AuctionHouse.PostCommodity(). The frame template changes when you select an item to post.
Another issue is that C_AuctionHouse.GetNumOwnedAuctions() and C_AuctionHouse.GetOwnedAuctionInfo() does not get updated when the user is on the sell screen. That means you have to forcefully request the update from the server. Otherwise, if you do a scan of the auctions using C_AuctionHouse.GetOwnedAuctionInfo() after a user sells an item, it will be inaccurate and not represent the newly updated number. The only way to update this is the user switches to the Auction tab or you force a query update using C_AuctionHouse.QueryOwnedAuctions(). This is rubbish and the C_AuctionHouse.GetNumOwnedAuctions() should be updated when a user sells something. Huge oversight by Blizzard here.

Oh I would like to point out that requesting a query update using C_AuctionHouse.QueryOwnedAuctions() while a user is on the Sell screen causes a bug. This bug prevents the user from properly selling Stacked items. It's one big mess with this new Auction House.
__________________
Click HERE for the ultimate idiot test.

if (sizeof(sadness) > sizeof(happiness)) { initDepression(); }
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » How to hook C_AuctionHouse.PostItem?

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