diff --git a/README.md b/README.md index 9802678..64f8f59 100644 --- a/README.md +++ b/README.md @@ -110,6 +110,13 @@ Request a list of current live tournament games. This is the list you see in the client under Watch -> Live. Listen for the `matchList` event to get your response. +### openContainer(containerid[, keyid]) + +- `containerid` - The asset ID of the container. +- `keyid` - The asset ID of the key, defaults to 0 if not provided as to unlock a keyless container. + +Opens a container. Listen for the `itemAcquired` event to get the item unboxed (if open was successful) + ### requestRecentGames(steamid) Request a list of recent games (max. 8). This is the list you see in the client under Watch -> Your Matches. diff --git a/index.js b/index.js index 871e8de..4e93211 100644 --- a/index.js +++ b/index.js @@ -132,6 +132,13 @@ GlobalOffensive.prototype._connect = function() { this._helloTimer = setTimeout(sendHello, 500); }; +GlobalOffensive.prototype.openContainer = function(containerID, keyID) { + var buf = new ByteBuffer(16, ByteBuffer.LITTLE_ENDIAN); + buf.writeUint64(keyID || 0); + buf.writeUint64(containerID); + this._send(Language.UnlockCrate, null, buf); +}; + GlobalOffensive.prototype._send = function(type, protobuf, body) { if (!this._steam.steamID) { return false;