Jump to content
McKay Development

Recommended Posts

Posted

How can I find out what item the user wants to receive?

 

1. I want to continue if item name = "Abc name Trading Card"
2. If not, decline
 
assetid/classid change very often and the code stops working.
 
manager.on("newOffer", (OFFER) => {
console.log(OFFER);
if (OFFER.itemsToGive.length == 1 && (OFFER.itemsToGive[0].id == "10964018350" || OFFER.itemsToGive[0].id == "11724177271" )) {
// accept
TradeOffer {
  partner:
   SteamID { universe: 1, type: 1, instance: 1, accountid: 23587203 },
  id: '3695907410',
  message: '',
  state: 2,
  itemsToGive:
   [ EconItem {
       appid: 753,
       contextid: '6',
       assetid: '11497188550',
       classid: '2238354881',
       instanceid: '0',
       amount: 1,
       missing: false,
       est_usd: '7',
       id: '11497188550',
       fraudwarnings: [],
       descriptions: [],
       owner_descriptions: [],
       actions: [],
       owner_actions: [],
       market_actions: [],
       tags: [],
       tradable: false,
       marketable: false,
       commodity: false,
       market_tradable_restriction: 0,
       market_marketable_restriction: 0 } ],
  itemsToReceive: [],
  isOurOffer: false,
  created: 2019-09-04T11:04:43.000Z,
  updated: 2019-09-04T11:04:43.000Z,
  expires: 2019-09-18T11:04:43.000Z,
  tradeID: null,
  fromRealTimeTrade: false,
  confirmationMethod: 0,
  escrowEnds: null,
  rawJson:
   '{\n\t"tradeofferid": "3695907410",\n\t"accountid_other": 23587203,\n\t"message": "",\n\t"expiration_time": 1568804683,\n\t"trade_offer_state": 2,\n\t"items_to_give": [\n\t\t{\n\t\t\t"appid": 753,\n\t\t\t"contextid": "6",\n\t\t\t"assetid": "11497188550",\n\t\t\t"classid": "2238354881",\n\t\t\t"instanceid": "0",\n\t\t\t"amount": "1",\n\t\t\t"missing": false,\n\t\t\t"est_usd": "7"\n\t\t}\n\t],\n\t"is_our_offer": false,\n\t"time_created": 1567595083,\n\t"time_updated": 1567595083,\n\t"from_real_time_trade": false,\n\t"escrow_end_date": 0,\n\t"confirmation_method": 0\n}' }

However, I see no way to get the name (without loading all inventory).

Is there any way to get the name of the items like getReceivedItems, but for itemsToGive?

 

(And I also wanted to know why tradable = false)

Posted

If you pass a language to the constructor, then item descriptions (including name) will be set. tradable is false if you don't have a language set because an item's tradability is part of its description, which isn't loaded if there's no language set. It would probably be a good idea if I deleted those properties for items that don't have descriptions available, I guess.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...