bitburner-src/src/Exploits/loops.ts

36 lines
911 B
TypeScript
Raw Normal View History

import { Player } from "../Player";
import { Exploit } from "./Exploit";
function tampering(): void {
if (Player.exploits.includes(Exploit.PrototypeTampering)) return;
// Tampering
const a = 55;
setInterval(function () {
if (a.toExponential() !== "5.5e+1") {
Player.giveExploit(Exploit.PrototypeTampering);
}
}, 15 * 60 * 1000); // 15 minutes
}
function timeCompression(): void {
if (Player.exploits.includes(Exploit.TimeCompression)) return;
// Time compression
let last = new Date().getTime();
function minute(): void {
const now = new Date().getTime();
if (now - last < 500) {
// time has been compressed.
Player.giveExploit(Exploit.TimeCompression);
return;
}
last = now;
2021-12-19 00:13:49 +01:00
window.setTimeout(minute, 1000 * 60);
}
2021-12-19 00:13:49 +01:00
window.setTimeout(minute, 1000 * 60);
}
export function startExploits(): void {
tampering();
timeCompression();
}