bitburner/scripts/update.js

26 lines
779 B
JavaScript
Raw Normal View History

2022-02-04 17:17:13 -05:00
/**
* Automatically download all the scripts in the repository.
*/
2022-02-04 11:49:05 -05:00
export async function main(ns) {
2022-02-04 17:17:13 -05:00
const SRC = 'https://gitlab.zakscode.com/ztimson/BitBurner/-/raw/develop/scripts/';
const DIST = '/scripts/';
2022-02-04 11:49:05 -05:00
const FILE_LIST = [
2022-02-04 17:17:13 -05:00
'auto-pwn.js',
'bruteforce.js',
'crawler.js',
'miner.js',
'node-manager.js',
'update.js'
2022-02-04 11:49:05 -05:00
];
2022-02-04 17:17:13 -05:00
// Download each file
2022-02-04 19:13:35 -05:00
ns.tprint("Downloading scripts:");
2022-02-04 11:49:05 -05:00
for(const FILE of FILE_LIST) {
2022-02-04 18:48:08 -05:00
await ns.sleep(500);
2022-02-04 19:13:35 -05:00
await ns.wget(`${SRC}${FILE}`, `${DIST}${FILE}`);
const SPEED = ~~((Math.random() * 200) + 100) / 10;
ns.tprint(`${FILE} ${FILE.length <= 10 ? '\t' : ''}\t [==================>] 100% \t (${SPEED} MB/s)`);
2022-02-04 11:49:05 -05:00
}
2022-02-04 17:17:13 -05:00
ns.tprint('Done!');
2022-02-04 11:49:05 -05:00
}