API method for trading?

Currently I am using the DropItemOnUnit(“target”), is there a method that will drop item on trade window? I want to be able to auto trade my items even when people trade me and I don’t have them targeted.
I looked for both a method that returns the unit that you are currently trading or a method that drops the item on the trade window, but I had no success in finding what I needed. Am I missing something? There should be a method like that since you can right click an item to auto move it on trade window without drag and drop into the character you are trading!

Look into https://wow.gamepedia.com/API_UseContainerItem

1 Like

Awesome! Thanks for the fast reply, this is exactly what I was looking for! It’s protected but it can be used while trading( without being confirmed). Will try it as soon as I log in later and update with the results!

Just made a friend of mine reply so I can reply again on the topic :slight_smile:

After some testing I’ve came to this:

/run if not TradeFrame:IsShown() then InitiateTrade(“target”) else for b=0,4 do for s=1,GetContainerNumSlots(b)do local l=GetContainerItemLink(b,s)if l and l:find(“Healthstone”)then UseContainerItem(b, s)end end end end
/run AcceptTrade()

The original idea is to remove the hustle of searching and giving items to raid members, on this macro specifically healthstones.
This as it is works in all cases, had to check if the trade window is open otherwise the trade would auto cancel by the blizzard ui (possibly to avoid maleficent uses of the macro in one press since now it requires 3 presses if the trade isn’t open or 2 if someone already traded you instead).
I post the code here so people could use this if they find it helpful, or suggest changes and improvements that I lack the experience to notice!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.