Jump to content


Most Liked Content


#889 Identifying Steam Items

Posted by Dr. McKay on 20 May 2016 - 12:40 AM

Sometimes it can be a little confusing to identify a specific item in the Steam economy. There are several different types of IDs present in one particular item, and a lot of vague terminology. This guide aims to clear all that up for you.

For starters, the "official" term for a Steam item is an asset. When I say a "Steam item", I mean a particular copy of an item. I'm not referring to the item's definition, name, image, or anything. I'm referring to a specific, unique copy of the item.

In a general sense, every item on Steam must be owned by an app. An "app" is a game, software, or whatever on Steam. Every app has its own unique AppID. You can find a particular game's AppID by going to its store page or community hub and looking at the URL. For example, TF2's AppID is 440 so TF2's store page can be found at http://store.steampowered.com/app/440. CS:GO's is 730, Dota 2's is 570, and so on. Note that Steam Community items, Steam gifts, and other "Steam" items are owned by the "Steam" app, which has AppID 753. To identify an item, you'll need the AppID of the game which owns it.

Of course, the AppID alone isn't enough. You also need two other IDs. Have you ever noticed how some games have multiple inventories, which appear in a drop-down list? An example is the Steam inventory, which has sub-inventories for "Community", "Gifts", "Coupons", etc. These "sub-inventories" are called contexts, and each context has its own context ID. If a game doesn't have a drop-down menu to select a context, that doesn't mean that it's without contexts. That only means that it has one single visible context. That single context still has an ID. For all current Valve games, the context ID for the publicly-visible context is 2.

Context IDs can be a bit tricky. It's entirely up to the game's developer to determine how they work. For example, Valve games take the "single shared inventory" model in which there's one context ID which is shared by everyone. Under this model, an item belongs to one particular context and never leaves that context. Consequently, the item's context ID never changes. It is, however, possible for game developers to create contexts in any way they choose. For example, Spiral Knights uses the "per-character inventory" model in which everyone who plays the game has their own context IDs for their characters. Creating a new character creates a new context ID. This means that when an item is traded between users, its context ID will change as it moved out of a particular character's inventory.

Those are the two different types of "containers" in the Steam economy. Apps own contexts, and contexts own assets. Every asset on Steam has, in addition to its AppID and context ID, an asset ID which is guaranteed to be unique inside of a given AppID+ContextID combination. Notice that this means that asset IDs are not unique across all of Steam. They aren't even unique across a particular app. They are only unique inside of a given context. For example, there could be two items with asset ID 1 in the same game, as long as they have different context IDs. An item's asset ID may be referred to as "assetid" or just plain "id".

Context IDs and asset IDs are assigned by the game developer and can follow any pattern. They can change when traded or not. They may both be up to 64 bits in size. Consequently, Steam returns them (like all other 64-bit values) in JSON as strings.

Still following? All of what we've learned so far leads us to this conclusion: in order to uniquely identify an item, you need its AppID, its context ID, and its asset ID. Once you have these three things, only then can you uniquely identify it. In fact, this is how you link to a particular item in a user's inventory: steamcommunity.com/profiles/steamid/inventory#appid_contextid_assetid. Here's an example: https://steamcommuni...440_2_134161610

What on Earth are these "classid" and "instanceid" values though??
The observant reader may have noticed that there are two more IDs attached to a particular item which I haven't mentioned. These are the "classid" and "instanceid". These IDs are used to map an asset to its description.

What's a description? A description is what you need in order to actually display an item. An item's description contains its name, image, color, market_name, whether it's tradable or not, whether it's marketable or not, and more. There are many endpoints on Steam which return JSON objects representing assets that only contain the asset's AppID, context ID, asset ID, classid, instanceid, and amount. An item's amount is how big of a stack it is. Unstackable items always have an amount of 1. Stackable items (such as Steam gems) may have a larger amount. Stacked items always have the same asset ID.

What's the difference between a classid and an instanceid? Well in a nutshell, a classid "owns" an instanceid. The classid is all you need to get a general overview of an item. For example, items with the same classid will pretty much always have the same name and image. The instanceid allows you to get finer-tuned details such as how many kills are on a strange/StatTrak weapon, or custom names/descriptions.

You can turn a classid/instanceid pair into a description using the GetAssetClassInfo WebAPI method. Notice that the instanceid is actually optional: if you only have a classid that's fine, you just won't get finer details for the item.

Do note that it's possible for a game developer to flush Steam's asset cache entirely, which would change the classid/instanceid of every item. As of the time of this posting, I'm unaware of this ever having been done.

Name? Market Name? Market Hash Name? Halp?
Every asset on Steam has a name. Period. Without a name, there's nothing to show in your inventory. The item's name is the... (wait for it...) name property of its description (shocking, I know). The item's name may be localized if the game's developer has set it up to be.

Every marketable item also has a "market name". This name may be the same as, or different from the item's regular name. The item's market name is the market_name property of its description. This is the name that's displayed in the Steam Community Market when the item is up for sale. Why the distinction? There are some items which have value-affecting data that isn't in their name. For example, CS:GO skins have 5 different tiers of "wear", which isn't in their names. The wear tier is appended to each skin's market name however, so that the different tiers of wear are separated in the market. The market name may be localized or not, and may not exist at all if the item isn't marketable. It's up to the game's developer.

Finally, every marketable item also has a "market hash name", available under the market_hash_name property. This name is supposed to be the English version of the item's market name, but in practice it may vary. For example, Steam Community items prepend the AppID of the originating app to each item's market hash name, but not to the market name. The market hash name is never localized, and may not exist if the item isn't marketable. Again, it's up to the game's developer. You can view the Community Market listings for any marketable item using this URL formula: steamcommunity.com/market/listings/appid/market_hash_name. Here's an example: https://steamcommuni...upply Crate Key

Note that the Community Market has no concept of contexts. Consequently, market [hash] names are unique for a particular "class" of items per-app (and by extension per-context). This means that for marketable items, two items with identical market hash names will be worth roughly the same (with some exceptions, like unusual TF2 items).

Questions?
Ask below. I'm happy to help!


  • Mole, Andrew, trzyrazyzero and 1 other like this


#210 SteamBot Help compile and configure

Posted by Marcio Moura on 13 March 2016 - 03:54 PM

Good afternoon

I wanted to make a gambling site to csgo
Ja researched by google but not found anything to help me , it speaks to compile the code , and it does not know much

 I needed the help of someone who knew this subject , and who is willing to help me .

I hope someone help me
Have a nice day
Marcio Moura

Sorry for my bad English , but I 'm Portuguese

 

btw,
This is the site
 

MeOlDy9.jpg


  • danyaVak, Borisdip, Vasyaon and 1 other like this


#1537 Minimal code to stay logged in forever...

Posted by Dr. McKay on 06 August 2016 - 11:03 PM

That all looks fine to me. sessionExpired is only emitted when a request you make fails because you aren't logged in. It doesn't check automatically, it only checks whenever the library makes a request somewhere.

 

Starting a new confirmation checker without stopping the old one is just fine. It'll stop an old one if you call it while one is running.

 

I recommend updating to v3.23.1 if you're going to use webchat.


  • yellowish and klonaway like this


#143 TradeOfferManager v2

Posted by Dr. McKay on 03 March 2016 - 02:10 PM

Here's an idea. Three options for createOffer():

  1. manager.createOffer(steamID); // create an offer without a token. you can set it later
  2. manager.createOffer(steamID, token); // create an offer with a token
  3. manager.createOffer(tradeURL); // automatically extract the SteamID and token from the trade URL

  • Mole and PEPZ like this


#936 Identifying Steam Items

Posted by Dr. McKay on 31 May 2016 - 12:26 AM

-snip-

 

I purposefully didn't mention the WebAPIs because they aren't really "Steam items". They're "Valve items", and third-party games don't need to follow any of the same standards. However, for Valve games, the "id" in the WebAPI is the item's asset ID, and "original_id" is the item's asset ID when it was originally created. If it's identical to the item's "id", that means that the item was never traded or modified. Quality (generally) determines the color of the item's name, and (sometimes) a prefix to the item's name (for example, StatTrak, ★, etc). Quality has nothing to do with wear.

 

For CS:GO, you can't really get much useful information out of the WebAPI except an item's raw wear value (frequently, incorrectly, and ignorantly referred to as its "float value") and perhaps original ID.


  • Mole likes this


#735 Accepting trades with mobile authenticator

Posted by Dr. McKay on 27 April 2016 - 03:20 PM

I've made a new pinned post detailing this: https://dev.doctormc...-confirmations/


  • timgfx likes this


#718 Is steam api calls count as ratelimit?

Posted by Dr. McKay on 25 April 2016 - 02:02 PM

Officially there's a 100,000 request-per-day limit, but besides that there's no IP/key rate-limit or throttling.


  • trzyrazyzero likes this


#599 Combine steam-user with steamcommunity

Posted by Dr. McKay on 09 April 2016 - 03:38 PM

Round peg, round hole.


  • Mole likes this


#584 Help with configuration

Posted by Dr. McKay on 08 April 2016 - 11:49 PM

eH1hQp6.jpg


  • Lucas likes this


#476 Detect when Steam kills my sessions

Posted by Dr. McKay on 03 April 2016 - 11:21 PM

No, the event won't fire if there isn't any HTTP traffic going on. But if you pass the SteamCommunity instance to the constructor of TradeOfferManager, then the manager will use that community for its HTTP requests and so no-session requests triggered by the manager will fire the event.


  • Nogtail likes this


#333 How to createOffer properly?

Posted by Dr. McKay on 23 March 2016 - 07:53 PM

var offer = manager.createOffer("[U:1:46143802]");
offer.addMyItem({"appid": 440, "contextid": 2, "assetid": "1234567890"});
offer.send("Hi there", "KYworVTM", function(err, status) {
    if (err) {
        console.log(err);
    } else {
        console.log("Offer #" + offer.id + " " + status);
    }
});

 

Something like that, where [U:1:46143802] is my SteamID and KYworVTM is my trade token.


  • I'm L! likes this


#2744 webSession not fire when i call webLogOn() ?

Posted by Dr. McKay on 22 February 2017 - 01:22 PM

Best I can tell, web logons became finnicky ever since the Steam maintenance last night.


  • mrxbell likes this


#2589 How convert steamID64 to steamID3

Posted by Dr. McKay on 25 January 2017 - 12:16 PM

https://www.npmjs.com/package/steamid

var SteamID = require('steamid');
var steamid3 = (new SteamID(steamid64)).steam3();

If you want the accountID and not the Steam3 rendered format as your title implies ([U:1:46143802]) then you just want to do:

var SteamID = require('steamid');
var accountID = (new SteamID(steamid64)).accountid;

  • mrxbell likes this


#2497 How to accept confirmitions in mobile app?

Posted by Rocket Scientist on 12 January 2017 - 11:46 AM

Hello, Guys!  :)

I have a few questions.

 

 

What is difference between this urls? 1. https://steamcommuni...ileconf/conf?p=    2. https://steamcommuni...conf/ajaxop?op=

How i understood to confirm some trade i need to use https://steamcommuni...conf/ajaxop?op=

Now i have this code:

 

Parameters:
 

$identity_secret = 'J**************************g=';
$time = time();
$tag = 'conf';
//  ---------> base64 confirmation key
    $buf = pack('NNa*', 0, $time, $tag);
    $hmac = hash_hmac('sha1', $buf, $identity_secret, true);
   
    $k = base64_encode($hmac);
//  ^--------- base64 confirmation key
 
$steamid = '76561198252188406';
$deviceid = 'android:' . preg_replace('/^([0-9a-f]{8})([0-9a-f]{4})([0-9a-f]{4})([0-9a-f]{4})([0-9a-f]{12}).*$/', '$1-$2-$3-$4-$5', sha1($steamid));
 
And create final url for post request:
$url = 'https://steamcommuni...ileconf/ajaxop?op=allow&p='.$deviceid.'&a='.$steamid.'&k='.$k.'&t='.$time.'&m=android&tag=conf';

But i get this: "{"success":false}"
 
That is the problem? Maybe i need some more parapeters or i generate something not right?
 
 

  • Rocket Scientist likes this


#1859 Trade Offer Bot

Posted by adma on 09 October 2016 - 04:49 AM

manager.on("newOffer", function(offer) {
	var onlyKeys = (offer.itemsToReceive.every(function(item) {
		return item.name == "Mann Co. Supply Crate Key";
	}));

	if (onlyKeys) {
		keyAmount = offer.itemsToReceive.length
		console.log("Received trade offer containing " + keyAmount + " keys, accepting");
		offer.accept(function(err) {
			if (err) console.log(err);
		});
	} else {
		console.log("Trade offer contains non key items. Declining");
		offer.decline(function(err) {
			if (err) console.log(err);
		});
	}
}

  • TextDynasty likes this


#169 getActions

Posted by dusky on 05 March 2016 - 03:51 PM

How can i use the method getActions in getReceivedItens to generate the inspect link of the new item received ?


  • Dixonpt likes this


#1345 Problem when binding ip.

Posted by Dr. McKay on 10 July 2016 - 05:58 PM

That looks fine to me.


  • MrPandeu likes this


#1277 [Question] node-globaloffensive

Posted by Dr. McKay on 03 July 2016 - 05:14 PM

node-globaloffensive is using an option where instead of underscores, you should provide protobuf fields in camelCase. Basically, just remove the underscores and capitalize the next letter.

 

However, I've added that functionality in v1.1.0.


  • Henrykvdb likes this


#1272 [Question] node-globaloffensive

Posted by Dr. McKay on 03 July 2016 - 01:56 PM

WebStorm sometimes has trouble resolving Node dependencies.

 

Do you have the Node.js plugin installed in WebStorm?


  • Henrykvdb likes this


#1185 steam-user

Posted by Dr. McKay on 26 June 2016 - 06:58 PM

Just my own experience. I've updated the readme to reflect this fact.


  • greybonez likes this