44 lines
1.4 KiB
JavaScript
44 lines
1.4 KiB
JavaScript
import fs from 'fs';
|
|
import request from 'request';
|
|
|
|
const config = JSON.parse(fs.readFileSync('config.json'));
|
|
const players = JSON.parse(fs.readFileSync('accounts.json')).accounts;
|
|
|
|
let totalcash = 0.00;
|
|
let pendingcash = 0.00;
|
|
|
|
|
|
const lookup = player => {
|
|
const postbody = {"_method":"GET","_ApplicationId":"TINAGTG_PARSE","_ClientVersion":"js1.11.1","_InstallationId":"","_SessionToken":""};
|
|
postbody._InstallationId = player._InstallationId;
|
|
postbody._SessionToken = player.sessionToken;
|
|
request({
|
|
method: 'POST',
|
|
uri: `${config.PROD_SERVER_URL}/parse/classes/_User/${player.objectId}`,
|
|
body: postbody,
|
|
json: true // Automatically stringifies the body to JSON
|
|
},(err, response, body)=>{
|
|
totalcash = totalcash + body.points;
|
|
pendingcash = pendingcash + body.payablePoints;
|
|
const cash_display = body.points.toFixed(2).toString();
|
|
console.log(`${player.username} has $${cash_display}`);
|
|
});
|
|
};
|
|
|
|
|
|
let time = 700;
|
|
let interval = 0;
|
|
|
|
players.forEach(player=>{
|
|
setTimeout(()=>{
|
|
lookup(player);
|
|
if(player.objectId === players[players.length-1].objectId){
|
|
setTimeout(()=>{
|
|
console.log(`You have $${totalcash.toFixed(2).toString()}`);
|
|
console.log(`Pending cashout: $${pendingcash.toFixed(2).toString()}`);
|
|
},2000);
|
|
}
|
|
},time*interval);
|
|
interval++;
|
|
});
|