node-steam-tradeoffer-manager icon indicating copy to clipboard operation
node-steam-tradeoffer-manager copied to clipboard

Detect items already in offers (inOffer property)

Open demipixel opened this issue 7 years ago • 7 comments

I'd like to know which items are already in offers when loading my inventory. It's possible to do manually (either by loading all offers when attempting to load your inventory or loading once at the beginning and keeping track via events which items are in offers and which are no longer in any offers).

So the suggestion is:

  1. Load all offers on startup, save each item from the user in a dictionary
  2. Offer changed events detects if an offer was changed (remove items from dictionary whether accepted or declined—not in an offer anymore)
  3. When loading the user's inventory, modify the EconItem to include an inOffer boolean

Yes, it's possible to do yourself by watching newOffer, sentOfferChanged, and receivedOfferChanged, but I would imagine almost any bot (except receive-only bots) want to ensure users get different instances of the same item so trade offers for the same type of item don't clash.

demipixel avatar Nov 28 '16 09:11 demipixel

Good idea, but might be very inefficient to load all offers on startup. This should probably be an optional feature.

andrewda avatar Nov 28 '16 15:11 andrewda

How does steam handle this? Like when you open your inventory you have the in trade flag. How does steam flag this to the user ?

vankxr avatar Nov 28 '16 23:11 vankxr

@Vankxr Is there an in-trade flag? Is that new? I think (thought) Steam doesn't support this, it's just especially useful for bots.

demipixel avatar Nov 28 '16 23:11 demipixel

Nope, no official Steam in-trade flag AFAIK, though I think 3rd party extensions such as Steam Inventory Helper provide one.

andrewda avatar Nov 29 '16 00:11 andrewda

Steam doesn't do anything special to prevent you from putting the same item in multiple trades.

DoctorMcKay avatar Nov 29 '16 02:11 DoctorMcKay

Oh, stupid me. I forgot i was using steam inventory helper :(

Anyways I still agree majority of users of this module will need it.

vankxr avatar Nov 29 '16 07:11 vankxr

Just make yourself an array, and push the assetid whenever you put an item up for trade. If you get an error while the trade is being sent, just remove the assetid from the array. That's how I did it. Works pretty well.

ciwox avatar Jun 20 '17 07:06 ciwox