ns func to flume and destroy wd

This commit is contained in:
Olivier Gagnon
2022-04-13 17:34:02 -04:00
parent 93eb5e2d78
commit 9281cbe559
4 changed files with 70 additions and 5 deletions
+44
View File
@@ -47,6 +47,8 @@ import { Server } from "../Server/Server";
import { netscriptCanHack } from "../Hacking/netscriptCanHack";
import { FactionInfos } from "../Faction/FactionInfo";
import { InternalAPI, NetscriptContext } from "src/Netscript/APIWrapper";
import { BlackOperationNames } from "../Bladeburner/data/BlackOperationNames";
import { enterBitNode } from "../RedPill";
export function NetscriptSingularity(player: IPlayer, workerScript: WorkerScript): InternalAPI<ISingularity> {
const getAugmentation = function (_ctx: NetscriptContext, name: string): Augmentation {
@@ -1335,5 +1337,47 @@ export function NetscriptSingularity(player: IPlayer, workerScript: WorkerScript
}
return item.price;
},
b1tflum3:
(_ctx: NetscriptContext) =>
(_nextBN: unknown, _callbackScript: unknown = ""): void => {
const nextBN = _ctx.helper.number("nextBN", _nextBN);
const callbackScript = _ctx.helper.string("callbackScript", _callbackScript);
enterBitNode(Router, true, player.bitNodeN, nextBN);
if (callbackScript)
setTimeout(() => {
runAfterReset(callbackScript);
}, 0);
},
destroyW0r1dD43m0n:
(_ctx: NetscriptContext) =>
(_nextBN: unknown, _callbackScript: unknown = ""): void => {
const nextBN = _ctx.helper.number("nextBN", _nextBN);
const callbackScript = _ctx.helper.string("callbackScript", _callbackScript);
const hackingRequirements = (): boolean => {
const wd = GetServer(SpecialServers.WorldDaemon);
if (!(wd instanceof Server))
throw new Error("WorldDaemon was not a normal server. This is a bug contact dev.");
if (player.hacking < wd.requiredHackingSkill) return false;
if (!wd.hasAdminRights) return false;
return true;
};
const bladeburnerRequirements = (): boolean => {
if (!player.inBladeburner()) return false;
if (!player.bladeburner) return false;
return player.bladeburner.blackops[BlackOperationNames.OperationDaedalus];
};
if (!hackingRequirements() && !bladeburnerRequirements()) {
_ctx.log(() => "Requirements not met to destroy the world daemon");
return;
}
enterBitNode(Router, false, player.bitNodeN, nextBN);
if (callbackScript)
setTimeout(() => {
runAfterReset(callbackScript);
}, 0);
},
};
}