works (somehow). Ts almost done, just missing types here and there

This commit is contained in:
Ulysia 2024-12-27 21:40:09 +01:00 committed by Heli-o
parent 97ac5bf9f1
commit 14759592b8
3 changed files with 10 additions and 8 deletions

View file

@ -1,6 +1,6 @@
{
"data": {
"threadsToUse/speed": 48,
"thread_count/speed": 48,
"minSnipeProfit": 900000,
"minAvgProfit": 500000,

View file

@ -8,7 +8,7 @@ import { loadConfig } from './src/configLoader';
const config = loadConfig();
let threadsToUse = config.data['threadsToUse/speed'] ?? 1;
let thread_count = config.data['thread_count/speed'] ?? 1;
let lastUpdated = 0;
let doneWorkers = 0;
let startingTime;
@ -32,8 +32,8 @@ async function initialize() {
await getMoulberry();
await getLBINs();
for (let j = 0; j < threadsToUse; j++) {
workers[j] = new Worker('./AuctionHandler.worker.ts', {
for (let j = 0; j < thread_count; j++) {
workers[j] = new Worker('/app/dist/AuctionHandler.worker.js', {
workerData: {
itemDatas: itemDatas,
bazaarData: bazaarPrice,
@ -80,7 +80,7 @@ async function initialize() {
}
} else if (result === 'finished') {
doneWorkers++;
if (doneWorkers === threadsToUse) {
if (doneWorkers === thread_count) {
doneWorkers = 0;
console.log(
`Completed in ${(Date.now() - startingTime) / 1000} seconds`
@ -141,7 +141,7 @@ async function initialize() {
);
}
async function getLBINs() {
async function getLBINs(): Promise<void> {
const lbins = await axios.get('https://moulberry.codes/lowestbin.json');
const lbinData = lbins.data;
for (const item of Object.keys(lbinData)) {
@ -150,7 +150,7 @@ async function getLBINs() {
}
}
async function getMoulberry() {
async function getMoulberry(): Promise<void> {
const moulberryAvgs = await axios.get(
'https://moulberry.codes/auction_averages/3day.json'
);
@ -175,7 +175,7 @@ async function getMoulberry() {
}
}
async function getBzData() {
async function getBzData(): Promise<void> {
const bzData = await axios.get('https://api.hypixel.net/skyblock/bazaar');
bazaarPrice['RECOMBOBULATOR_3000'] =
bzData.data.products.RECOMBOBULATOR_3000.quick_status.buyPrice;

View file

@ -11,11 +11,13 @@
"dev": "ts-node index.ts"
},
"dependencies": {
"@types/node": "^22.10.2",
"@types/toastify-js": "^1.12.3",
"axios": "^0.24.0",
"copy-paste": "^1.5.3",
"discord.js": "^14.16.3",
"express": "^4.21.2",
"node": "^23.5.0",
"node-notifier": "^10.0.1",
"open": "^8.4.2",
"prismarine-nbt": "^2.7.0",