After reading this post by Gello I think I have a slightly better understanding what's happening, but not why
https://us.forums.blizzard.com/en/wo...-button/704071
- C_AuctionHouse.PostItem() works fine when called from a macro, script or addon.
- But /clicking the "Create Auction" button with a script/macro bricks the AH. (However it still works fine if you create an auction once manually and afterwards use the macro/script)
- The workaround is to use a proxy button from an addon or a SecureActionButtonTemplate button in a macro script.
Lua Code:
local btn = CreateFrame("Button", "ProxyAHButton")
btn:SetScript("OnClick", function(self, button)
AuctionHouseFrame.ItemSellFrame:PostItem()
AuctionHouseFrame.CommoditiesSellFrame:PostItem()
end)
-- /click ProxyAHButton
The macro script version of this for some reason still bricks the AH
Code:
/run if not ProxyAHButton then local btn = CreateFrame("Button", "ProxyAHButton") btn:SetScript("OnClick", function(self, button) AuctionHouseFrame.ItemSellFrame:PostItem() AuctionHouseFrame.CommoditiesSellFrame:PostItem() end) end
/click ProxyAHButton
While the SecureActionButtonTemplate one by Gello works fine (but is difficult to support both normal and commodity items in the same macro)
Code:
/run if not ProxyAHItem then local f = CreateFrame("Button", "ProxyAHItem", nil, "SecureActionButtonTemplate") f:SetAttribute("type", "click") f:SetAttribute("clickbutton", AuctionHouseFrame.ItemSellFrame.PostButton) end
/click ProxyAHItem
Code:
/run if not ProxyAHCom then local f = CreateFrame("Button", "ProxyAHCom", nil, "SecureActionButtonTemplate") f:SetAttribute("type", "click") f:SetAttribute("clickbutton", AuctionHouseFrame.CommoditiesSellFrame.PostButton) end
/click ProxyAHCom
There coincidentally also is
https://www.curseforge.com/wow/addons/magic-button/ from the Auctionator author which is really neat
-- Update: 2020.11.29
By request, the buy version. The commodity one split into 2 macros because it's protected and doesn't fit within <255 chars
- Non-commodity
Code:
/run AuctionHouseFrame.ItemBuyFrame.BuyoutFrame.BuyoutButton:Click()
/click StaticPopup1Button1
- Commodity
Code:
/run if not ProxyAHBuy then local f = CreateFrame("Button", "ProxyAHBuy", nil, "SecureActionButtonTemplate") f:SetAttribute("type", "click") f:SetAttribute("clickbutton", AuctionHouseFrame.CommoditiesBuyFrame.BuyDisplay.BuyButton) end
/click ProxyAHBuy
Code:
/run AuctionHouseFrame.BuyDialog.BuyNowButton:Click()