bitburner/scripts/update.js

31 lines
880 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-10 12:10:26 -05:00
// Setup
2022-02-09 22:25:22 -05:00
const src = 'https://gitlab.zakscode.com/ztimson/BitBurner/-/raw/develop/scripts/';
const dist = '/scripts/';
const fileList = [
2022-02-10 12:28:51 -05:00
'lib/arg-parser.js',
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-10 13:55:16 -05:00
ns.tprint('');
2022-02-09 22:25:22 -05:00
for(const file of fileList) {
2022-02-04 18:48:08 -05:00
await ns.sleep(500);
2022-02-09 22:25:22 -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-10 13:55:16 -05:00
ns.tprint('');
2022-02-10 12:28:51 -05:00
ns.tprint('✅ Done!');
2022-02-10 13:55:16 -05:00
ns.tprint('');
2022-02-04 11:49:05 -05:00
}