GithubHelp home page GithubHelp logo

csgo-float's Introduction

csgo-float

Retrieve CS:GO float values in JavaScript

npm i -S csgo-float

Usage

Only one request can be done at a time by each client. You'll have to wait for the first request to be processed before sending another one.

Client
new FloatClient(clientAuth, debug)

clientAuth {Object} SteamUser credentials to login / SteamClient

debug {Boolean} Print some useful informations

// Init a client using a credentials object
const client = new FloatClient({
  account_name: 'yeah',
  password: 'this-is',
  auth_code: 'definitely',
  sha_sentryfile: 'right'
}, true)

// Or by passing an existing SteamClient instance
// that should be connected and logged.
const steamClient = new SteamClient()
const client = new FloatClient(steamClient)
Methods
client.requestFloat(url)

Returns a Promise.

Where url is a string formatted like S76561198190349706A4757476613D16467978012840927110.

client.requestFloat('S76561198190349706A4757476613D16467978012840927110')
  .then(floatValue => console.log(floatValue))
  .catch(err => console.log(err))
Events

ready Emitted once the client is ready to receive float requests

sentry The user is authenticated and the account sentry is sent, should be saved somewhere

error Once an error is triggered

Thanks

This would not exists without the help of @Twewki.

csgo-float's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

csgo-float's Issues

Sentry not working

Using the following to log in and then save the sentry

var auth_config = {};
try {
    auth_config.sha_sentryfile = fs.readFileSync('sentry');
    console.log(auth_config.sha_sentryfile);
} catch (e) {
  auth_config.account_name = 'username';
  auth_config.password = 'password';
  auth_config.auth_code = '';
}

var client = new FloatClient(auth_config, true);

client.on('sentry', function(data) {
  console.log("Recieved sentry.")
  console.log(data);
  fs.writeFileSync('sentry', data)
});

If no sentry file is present, then the login proceeds and a sentry file is written. On subsequent executions of this code, login fails.

Possible error in code

At line 79 of src/index.js there is

(!this._gcLoaded) { return this.emit('error', new Error('GC not loaded.')) }

Since _gcLoaded is a function and checking if the function is not empty make no sense, i guess that this is supposed to be

if(!this._gcReady) { return this.emit('error', new Error('GC not loaded.')) }

example?

Can you show an example?

This is my code (but it does not work):
var Steam = require('steam');
var SteamTotp = require('steam-totp');

var steamClient = new Steam.SteamClient();
var steamUser = new Steam.SteamUser(steamClient);

steamClient.connect();
steamClient.on('connected', function() {
    steamUser.logOn({
    account_name: 'login',
    password: 'pass',
    two_factor_code: SteamTotp.generateAuthCode('shared_secret')
});
});

steamClient.on('logOnResponse', function() {
    var steamGameCoordinator = new Steam.SteamGameCoordinator(steamClient, 730);
    steamGameCoordinator.send({ msg: 9156, proto: {} }, ???);
});

steamClient.on('error', function(data) { 
    console.log(data);
}); 

Error in protobuf loading

I am loading csgo-float with a logged instance of node-steam-user and the script crash to this:

Error: Parse error at line 1: unexpected '404'
at Parser.ProtoBuf.DotProto.ParserPrototype.parse (/home/x/node_modules/protobufjs/dist/ProtoBuf.js:777:35)
at Function.ProtoBuf.DotProto.Parser.parse (/home/x/node_modules/protobufjs/dist/ProtoBuf.js:795:39)
at Object.ProtoBuf.loadProto (/home/x/node_modules/protobufjs/dist/ProtoBuf.js:5038:59)
at Object.ProtoBuf.loadProtoFile (/home/x/node_modules/protobufjs/dist/ProtoBuf.js:5084:52)
at Object. (/home/x/node_modules/csgo-float/protos/index.js:7:10)

Can't use NPM version of csgo-float

When I'm trying to import csgo-float, it complains: Cannot find module csgo-float
Most probably because it has no dist folder, I checked.
It happens only with version 0.0.8, 0.0.7 works fine.

requestFloat hangs

So I have an inspect link that I am trying to request the float for and the request hangs.

var auth_config = { /* auth values in here */ };
var client = new FloatClient(auth_config, true);

client.on('error', function(err) {
  console.log(err);
});

client.requestFloat('M639885643885286087A6070339447D7379339339370761238').then(function(floatValue) {
  // do something with floatValue
}).catch(function(e) {
  // do something with error
});

With this code I am successfully logged in and I think that _gc.send is being called because I added a log statement right before that line of code and I see it being executed. However, the returned promise doesn't seem to be resolved and subsequent request reject with a 'Request already in progress.'

A little information about the account I am using. Doesn't actually own a copy of CS GO, but is being family shared a copy of GO. Does the account need a distinct copy of the game?

An extra delay seems to be required between requests

The README tells us that "Only one request can be done at a time by each client. You'll have to wait for the first request to be processed before sending another one."

I've implemented a queue that processes the next request only after the previous one has returned its promise. However, requests seem to hang unless an additional 700ms delay is added after the GC returns and the promise is satisfied.

Is there a programmatic way to identify when the GC is ready for a new request? Or is this a bug with this implementation?

Many thanks for any assistance.

Unable to get the float value

Hey, I dunno if you still work on this;

I've tried to make your package work, but I cannot retrieve the float value.

On debug mode, I can see i'm connected and logged, but after that, I'm just getting messages (which I don't know what types numbers a related to...).

And nothing happend after. Do you know what's wrong?

[connected]
[message] 1305
[message] 5501
[message] 5501
[message] 5501
[logged]
[message] 751
[message] 768
[message] 5456
[message] 782
[message] 767
[message] 5553
[message] 5587
[message] 780
[message] 798
[message] 5528
[message] 779
[message] 850
[message] 5430
[message] 783
[message] 880
[message] 5480
[message] 880
[message] 1
[message] 5463
[message] 1
[message] 9600
[message] 1
[message] 5501
[message] 1
[message] 5510
[message] 1
[message] 831
[message] 1

Thanks!

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.