diff --git a/config.json b/config.json index 5b83ee8..c9973b6 100644 --- a/config.json +++ b/config.json @@ -1,6 +1,6 @@ { "data": { - "threadsToUse/speed": 48, + "thread_count/speed": 48, "minSnipeProfit": 900000, "minAvgProfit": 500000, diff --git a/index.ts b/index.ts index fb9faee..95b8cba 100644 --- a/index.ts +++ b/index.ts @@ -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 { 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 { 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 { const bzData = await axios.get('https://api.hypixel.net/skyblock/bazaar'); bazaarPrice['RECOMBOBULATOR_3000'] = bzData.data.products.RECOMBOBULATOR_3000.quick_status.buyPrice; diff --git a/package.json b/package.json index 7266540..33e90aa 100644 --- a/package.json +++ b/package.json @@ -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",