mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-20 13:15:48 +01:00
fix manualHack
This commit is contained in:
parent
0dff3e22bc
commit
6a2e5b06ad
@ -95,7 +95,7 @@ function wrapFunction(
|
||||
boolean: helpers.boolean,
|
||||
getServer: (hostname: string) => helpers.getServer(hostname, ctx),
|
||||
checkSingularityAccess: () => helpers.checkSingularityAccess(functionName),
|
||||
hack: helpers.hack,
|
||||
hack: (hostname: any, manual: any, extra?: any) => helpers.hack(ctx, hostname, manual, extra),
|
||||
getValidPort: (port: any) => helpers.getValidPort(functionPath, port),
|
||||
},
|
||||
};
|
||||
|
@ -598,38 +598,37 @@ export function NetscriptSingularity(player: IPlayer, workerScript: WorkerScript
|
||||
const server = player.getCurrentServer();
|
||||
return _ctx.helper.hack(server.hostname, true);
|
||||
},
|
||||
installBackdoor: (_ctx: NetscriptContext) =>
|
||||
function (): Promise<void> {
|
||||
_ctx.helper.checkSingularityAccess();
|
||||
const baseserver = player.getCurrentServer();
|
||||
if (!(baseserver instanceof Server)) {
|
||||
_ctx.log(() => "cannot backdoor this kind of server");
|
||||
return Promise.resolve();
|
||||
installBackdoor: (_ctx: NetscriptContext) => async (): Promise<void> => {
|
||||
_ctx.helper.checkSingularityAccess();
|
||||
const baseserver = player.getCurrentServer();
|
||||
if (!(baseserver instanceof Server)) {
|
||||
_ctx.log(() => "cannot backdoor this kind of server");
|
||||
return Promise.resolve();
|
||||
}
|
||||
const server = baseserver;
|
||||
const installTime = (calculateHackingTime(server, player) / 4) * 1000;
|
||||
|
||||
// No root access or skill level too low
|
||||
const canHack = netscriptCanHack(server, player);
|
||||
if (!canHack.res) {
|
||||
throw _ctx.helper.makeRuntimeErrorMsg(canHack.msg || "");
|
||||
}
|
||||
|
||||
_ctx.log(
|
||||
() => `Installing backdoor on '${server.hostname}' in ${convertTimeMsToTimeElapsedString(installTime, true)}`,
|
||||
);
|
||||
|
||||
return netscriptDelay(installTime, workerScript).then(function () {
|
||||
_ctx.log(() => `Successfully installed backdoor on '${server.hostname}'`);
|
||||
|
||||
server.backdoorInstalled = true;
|
||||
|
||||
if (SpecialServers.WorldDaemon === server.hostname) {
|
||||
Router.toBitVerse(false, false);
|
||||
}
|
||||
const server = baseserver ;
|
||||
const installTime = (calculateHackingTime(server, player) / 4) * 1000;
|
||||
|
||||
// No root access or skill level too low
|
||||
const canHack = netscriptCanHack(server, player);
|
||||
if (!canHack.res) {
|
||||
throw _ctx.helper.makeRuntimeErrorMsg(canHack.msg || "");
|
||||
}
|
||||
|
||||
_ctx.log(
|
||||
() => `Installing backdoor on '${server.hostname}' in ${convertTimeMsToTimeElapsedString(installTime, true)}`,
|
||||
);
|
||||
|
||||
return netscriptDelay(installTime, workerScript).then(function () {
|
||||
_ctx.log(() => `Successfully installed backdoor on '${server.hostname}'`);
|
||||
|
||||
server.backdoorInstalled = true;
|
||||
|
||||
if (SpecialServers.WorldDaemon === server.hostname) {
|
||||
Router.toBitVerse(false, false);
|
||||
}
|
||||
return Promise.resolve();
|
||||
});
|
||||
},
|
||||
return Promise.resolve();
|
||||
});
|
||||
},
|
||||
isFocused: (_ctx: NetscriptContext) =>
|
||||
function (): boolean {
|
||||
_ctx.helper.checkSingularityAccess();
|
||||
|
Loading…
Reference in New Issue
Block a user