Skip to content

Commit

Permalink
Updated the Inf Loop to Compare with Updated Repo
Browse files Browse the repository at this point in the history
  • Loading branch information
AstarothRekt committed Jan 4, 2017
1 parent 2494ea7 commit e7552ef
Showing 1 changed file with 62 additions and 39 deletions.
101 changes: 62 additions & 39 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
"use strict";

/*
* IMPORTS: Libraries that steam-yellow uses.
*/
const SteamUser = require('steam-user');
const inquirer = require('inquirer');
const client = new SteamUser();
const argv = require('minimist')(process.argv.slice(2));

// Verbosing info to user
console.log("Welcome to yellow-steam!");
console.log("Join our discord and steam group!");
console.log("WEBSITE: https://drakewitt.github.io/steam-yellow/");

let flag;
let flags;
let flagsArr = [
1,
Expand All @@ -24,7 +28,6 @@ let flagsArr = [
4 + 256 + 512 + 1024 + 2048
]; // etc
let currentFlag = 0;

// Overwrite the SteamUser library's persona flags to make it yellow
SteamUser.prototype.setPersona = function (state, name) {
if (flags > 0) {
Expand All @@ -50,51 +53,71 @@ SteamUser.prototype.setPersona = function (state, name) {
}
}.bind(this);

setInterval(update, 1000);
setInterval(update, 750);
}
};

client.on('loggedOn', () => {
client.setPersona(SteamUser.Steam.EPersonaState.Online);
console.log("Logged In! Press CTRL and C to stop.");
});

// Prompt for stuff
inquirer.prompt([
{
name: 'accountName',
message: 'Steam username:',
type: 'input'
},
{
name: 'password',
message: 'Steam password:',
type: 'password'
},
{
name: 'flags',
message: 'Note: If "Inf Loop" Is Checked, It Will Default to just "Inf Loop"\nPlease select which flags to enable:',
type: 'checkbox',
choices: [
{name: "Yellow name",
value: 4,
checked: true},
{name: "VR online indicator",
value: 2048},
{name: "Mobile online indicator",
value: 512},
{name: "Web online indicator",
value: 256},
{name: "Inf Loop",
value: -10000}
]

/** (<Function callback>) => <Promise ({flags: <Number>, ...})> */
function getLogin(callback) {
if (argv.user && argv.pass) { // command line
return Promise.resolve({
flags: argv.flags || 2820,
accountName: argv.user,
password: argv.pass
});
} else if (argv._.length) { // JSON file
let data = require(argv._[0]);
data.flags = data.flags || 2820;
return Promise.resolve({
flags: data.flags,
accountName: data.username,
password: data.password
});
} else { // prompt
return inquirer.prompt([
{
name: 'accountName',
message: 'Steam username:',
type: 'input'
},
{
name: 'password',
message: 'Steam password:',
type: 'password'
},
{
name: 'flags',
message: 'Please select which flags to enable:',
type: 'checkbox',
choices: [
{name: "Yellow name",
value: 4,
checked: true},
{name: "VR online indicator",
value: 2048},
{name: "Mobile online indicator",
value: 512},
{name: "Web online indicator",
value: 256},
{name: "Inf Loop",
value: -10000}
]
}
]).then(data => {
data.flags = data.flags.reduce((v,p)=>v+p, 0);
return data;
})
}
// then log in
]).then(data => {
flags = data.flags.reduce((v,p)=>v+p, 0);
console.log(flags);
client.logOn(data);
});
}

// Get our login data, then login
getLogin().then(data => {
flags = data.flags;
delete data.flags;

client.logOn(data)
});

0 comments on commit e7552ef

Please sign in to comment.