-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
114 lines (88 loc) · 3.61 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/**
* Written by Danny
* Code freely usable without credit
*
* https://foob.cc/
*/
const {print, sleep} = require('./lib/globals');
const {options} = require("./lib/config");
const database = require('./lib/database');
const workers = require('./threads/controller');
const roblox = require('./lib/roblox');
const backend = require('./lib/backend');
const items = require('./lib/items');
const queues = require('./lib/queues');
const discord = require("./lib/discord");
const rolimons = require('./lib/rolimons');
const main = async () => {
await database.connect();
print('authenticating with roblox...', 'debug')
await roblox.validateCookie();
const userInfo = roblox.info();
print(`welcome to quaid traid, ${userInfo.username} (${userInfo.id}) !! :D`, 'success');
await items.refresh();
(async () => {
for (;;) {
await sleep(options().items['value update interval in seconds'] * 1000);
await items.refresh();
}
})().then();
await roblox.updateMyInventory();
(async () => {
let cachedInventory = [];
for (;;) {
print('local inventory updated', 'debug')
const previousItems = cachedInventory.map(i => `${i.id}:${i.uaid}`);
const newItems = roblox.info().fullInventory.map(i => `${i.id}:${i.uaid}`);
const sentItems = previousItems.filter(i => !newItems.includes(i));
const receivedItems = newItems.filter(i => !previousItems.includes(i));
// const sentItems = ['22920501:213474650'];
// const receivedItems = ['22920501:214263146'];
if (sentItems.length >= 1 && receivedItems.length >= 1) {
const formattedSentItems = [];
const formattedReceivedItems = [];
for (const rawItem of sentItems) {
const split = rawItem.split(':');
const itemId = Number(split[0]);
const uaid = Number(split[1]);
const item = items.get(itemId);
if (!item) continue;
item.uaid = uaid;
formattedSentItems.push(item);
}
for (const rawItem of receivedItems) {
const split = rawItem.split(':');
const itemId = Number(split[0]);
const uaid = Number(split[1]);
const item = items.get(itemId);
if (!item) continue;
item.uaid = uaid;
formattedReceivedItems.push(item);
}
queues.clearTradeQueueWhenOffering(formattedSentItems.map(i => i.uaid));
discord.sendCompleted(formattedSentItems, formattedReceivedItems);
}
cachedInventory = roblox.info().fullInventory;
await sleep(5 * 1000);
await roblox.updateMyInventory();
}
})().then()
print(`indexing players...`, 'debug')
backend.getPlayers();
setInterval(backend.getPlayers, 60 * 60 * 1000)
await backend.getRbxFlipPlayers();
setInterval(backend.getRbxFlipPlayers, 5 * 60 * 1000)
await rolimons.scrapeTradeAds();
setInterval(rolimons.scrapeTradeAds, 2 * 60 * 1000)
setInterval(() => {
if (queues.getPlayerQueue().length < 100)
backend.getPlayers();
}, 25 * 1000)
// await roblox.generateNewCookie();
// setInterval(roblox.generateNewCookie, 20 * 60 * 1000)
roblox.solve2fa();
setInterval(roblox.solve2fa, 23 * 60 * 60 * 1000)
print(`starting scanner...`, 'debug')
workers.startWorkers();
}
main().then();