mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-09-22 22:00:57 +02:00
36 lines
887 B
TypeScript
36 lines
887 B
TypeScript
|
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;
|
||
|
setTimeout(minute, 1000);
|
||
|
}
|
||
|
setTimeout(minute, 1000);
|
||
|
}
|
||
|
|
||
|
export function startExploits(): void {
|
||
|
tampering();
|
||
|
timeCompression();
|
||
|
}
|