-
-
Save henrykvdb/21b45a45e3a0cad251e0d441fedfea5a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var SteamTotp = require('steam-totp'); | |
var totp = SteamTotp; | |
var SteamUser = require("steam-user"); | |
var GlobalOffensive = require('globaloffensive'); | |
function User(userName, pass, sharedSecret){ | |
this.userName = userName; | |
this.pass = pass; | |
this.sharedSecret = sharedSecret; | |
this.gcReady = false; | |
this.returnFloat = ""; | |
var floatCallback; | |
var userOject = this; | |
var steamUser = new SteamUser; | |
var csgo = new GlobalOffensive(steamUser); | |
this.log = function (text) { | |
console.log(userName + ": " + text) | |
}; | |
this.login = function () | |
{ | |
//Logs in | |
totp.getTimeOffset(function(err, offset) | |
{ | |
var code = totp.getAuthCode(sharedSecret, offset); | |
steamUser.logOn( | |
{ | |
"accountName": userName, | |
"password": pass, | |
"twoFactorCode": code | |
} | |
); | |
}); | |
//What happens after you log in | |
steamUser.on('loggedOn', function(details) | |
{ | |
userOject.log("Logged in"); | |
steamUser.setPersona(SteamUser.EPersonaState.Online); | |
steamUser.gamesPlayed([730]); | |
}); | |
//What happens after GC is ready | |
csgo.on('connectedToGC',function() | |
{ | |
userOject.log("GC is ready"); | |
userOject.gcReady = true; | |
}); | |
}; | |
this.getFloat = function (m,a,d) | |
{ | |
csgo.inspectItem(m,a,d); | |
//Waits till the code got the float | |
while (!floatCallback) | |
{ | |
require('deasync').sleep(50) | |
} | |
//Resets vars | |
var callback = floatCallback; | |
floatCallback = ""; | |
//returns the float | |
return callback; | |
}; | |
//What happens when an item is inspected | |
csgo.on('inspectItemInfo',function(skin) | |
{ | |
setTimeout(function () { | |
userOject.gcReady = true; | |
},900); | |
floatCallback = skin.paintwear; | |
}); | |
} | |
function getFloat(inspect) | |
{ | |
var m = inspect.match("M[0-9]+")[0].match("[0-9]+")[0]; | |
var a = inspect.match("A[0-9]+")[0].match("[0-9]+")[0]; | |
var d = inspect.match("D[0-9]+")[0].match("[0-9]+")[0]; | |
return float(m,a,d); | |
function float(m,a,d) | |
{ | |
//If there's a bot available | |
if (bot.gcReady || bot1.gcReady || bot2.gcReady) | |
{ | |
if (bot.gcReady) | |
{ | |
bot.gcReady = false; | |
bot.log("Getting float"); | |
return bot.getFloat(m,a,d); | |
} | |
if (bot1.gcReady) | |
{ | |
bot1.gcReady = false; | |
bot1.log("Getting float"); | |
return bot1.getFloat(m,a,d); | |
} | |
if (bot2.gcReady) | |
{ | |
bot2.gcReady = false; | |
bot2.log("Getting float"); | |
return bot2.getFloat(m,a,d); | |
} | |
} | |
//If there's no bot available | |
else | |
{ | |
//Checks if a bot is ready after another 100ms | |
require('deasync').sleep(100); | |
return float(m,a,d) | |
} | |
} | |
} | |
var bot = new User("Newosko", "password", "shared_secret"); | |
var bot1 = new User("Newosko1", "password", "shared_secret"); | |
var bot2 = new User("Newosko2", "password", "shared_secret"); | |
bot.login(); | |
bot1.login(); | |
bot2.login(); | |
//console.log(getFloat("M191783457426224171A6800347302D5334065854413183724")); | |
console.log(getFloat("M1467397635166412633A2943920796D7253158134192955045")); | |
console.log(getFloat("M564456326598298594A6712764497D12000024200694116964")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment