GithubHelp home page GithubHelp logo

qwici / node-steam-resources Goto Github PK

View Code? Open in Web Editor NEW

This project forked from seishun/node-steam-resources

0.0 0.0 0.0 22 KB

Steam resources for Node.js

License: MIT License

JavaScript 100.00%

node-steam-resources's Introduction

node-steam-resources

This is a node wrapper around Steam resources (Protobufs and SteamLanguage). It's primarily intended for node-steam extension module authors.

Installation

  1. Run npm install seishun/node-steam-resources. It fetches the Steam resources and requires svn.
  2. If you're going to publish your module, add steam-resources to bundledDependencies in your package.json, since you want to publish with the resources bundled. Note that npm publish will bundle the dependencies of steam-resources as well.

If you ever need to update the resources, just run npm install seishun/node-steam-resources again.

Usage

var Steam = require('steam-resources');

Steam is now a namespace object containing enums and classes generated from the protobufs and SteamLanguage.

Enums

For each enum in SteamLanguage, there is an equivalently named property on Steam. The property is an object; for each of the enum's members, there is an equivalently named property on the object with an equivalent Number value.

For example, Steam.EClanPermission.OwnerOfficerModerator is equal to 11.

Protobufs

For each protobuf message or enum available in SteamKit2, there is an equivalently named class or enum generated using ProtoBuf.js version ^4.1. They lie in the same hierarchy as in SteamKit2, with objects for namespaces. (If you see a mismatch, consider that a bug.)

For example, the CMsgGCTopCustomGamesList message from dota_gcmessages_common.proto is available as SteamKit2.GC.Dota.Internal.CMsgGCTopCustomGamesList in SteamKit2 and as Steam.GC.Dota.Internal.CMsgGCTopCustomGamesList here.

Structs

For each class in SteamLanguage, there is an equivalently named class in Steam.Internal. They are intended to implement a subset of the API provided by ProtoBuf.js message classes. Namely, for a class MsgGabe:

  • An MsgGabe instance has an equivalently named property for each non-const member of MsgGabe with the type as follows (modifiers like boolmarshal are ignored):
    • byte<> members: ByteBuffer.js ^5.0 objects
    • long and ulong members: ByteBuffer.Long objects
    • Other numeric members: Number
    • Protobuf message members: message class instances
  • For each const member of MsgGabe, there is an equivalently named property on the MsgGabe class with an equivalent value.
  • MsgGabe.decode(buf) returns an MsgGabe instance deserialized from buf. buf can be either a Buffer or a ByteBuffer.js ^5.0 instance. In the latter case, it decodes starting from buf.offset and increments it by message size.
  • new MsgGabe(obj) creates an MsgGabe instance from an object. new MsgGabe() is equivalent to new MsgGabe({}). For each non-const member of MsgGabe, if there is an equivalently named property in obj, it sets the instance property to the (possibly converted) value of the property in obj, otherwise to the default value. In addition to the types listed above, obj properties can have the following types:
    • byte<> members: Buffer objects (converted using ByteBuffer.wrap)
    • Numeric members: String or Number (converted using Long.fromValue)
    • Protobuf message members: objects (converted using the message class constructor)
  • An MsgGabe instance gabe has the following methods:
    • gabe.encode() serializes the MsgGabe instance and returns a ByteBuffer.js ^5.0 object.
    • gabe.toBuffer() returns this.encode().toBuffer().

For example, MsgClientChatRoomInfo can be used as follows:

var chatRoomInfo = new Steam.Internal.MsgClientChatRoomInfo({
  steamIdChat: '103582791432594962'
});
var buf = chatRoomInfo.toBuffer();
var chatRoomInfo2 = Steam.Internal.MsgClientChatRoomInfo.decode(buf);

node-steam-resources's People

Contributors

seishun avatar qwici avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.