roughnecks Posted January 20, 2019 Report Posted January 20, 2019 Hi again What is the best approach to determine if an Item belonging to Steam Inventory 753 - contextid 6 (steam community) - is a Card, Booster, etc...I was looking at the "offer" object for an incoming offer and found out that Booster Packs and Gems are actually called like that under "type" but for cards, bgs and emotes it's a little different - some examples: 1) type: '"Glow Ball" - The billiard puzzle game Trading Card',2) type: 'DISTRAINT: Deluxe Edition Uncommon Emoticon',3) type: 'Unexpected Day Profile Background', So, should I use the type value and match for e.g. "Emoticon" or is there a better way to identify those items' type? Thanks Quote
Dr. McKay Posted January 21, 2019 Report Posted January 21, 2019 You should check the item's tags. Quote
roughnecks Posted January 21, 2019 Author Report Posted January 21, 2019 (edited) OK, so I got this from tags array for Emoticon: [ { internal_name: 'droprate_1', name: 'Uncommon', category: 'droprate', category_name: 'Rarity', localized_tag_name: 'Uncommon', color: '', localized_category_name: 'Rarity' }, { internal_name: 'app_319180', name: 'Platypus II', category: 'Game', category_name: 'Game', localized_tag_name: 'Platypus II', color: '', localized_category_name: 'Game' }, { internal_name: 'item_class_4', name: 'Emoticon', category: 'item_class', category_name: 'Item Type', localized_tag_name: 'Emoticon', color: '', localized_category_name: 'Item Type' } ] Can you make an example on what should I extract from it? EDIT: Can this be acceptable? offer.itemsToReceive[0].tags.forEach(element => { //console.log(element); if (element.internal_name.includes('item_class_2')) { console.log('It\'s a Card!'); Edited January 21, 2019 by roughnecks Quote
Dr. McKay Posted January 21, 2019 Report Posted January 21, 2019 That looks correct enough, though you should probably also check the tag's category. roughnecks 1 Quote
Recommended Posts
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.