diff --git a/src/Netscript/RamCostGenerator.ts b/src/Netscript/RamCostGenerator.ts index 6213896d09..e4064dd3e2 100644 --- a/src/Netscript/RamCostGenerator.ts +++ b/src/Netscript/RamCostGenerator.ts @@ -511,6 +511,7 @@ export const RamCosts: RamCostTree = { getScriptLogs: 0, hasTorRouter: 0.05, nuke: RamCostConstants.PortProgram, + autoLink: RamCostConstants.PortProgram, brutessh: RamCostConstants.PortProgram, ftpcrack: RamCostConstants.PortProgram, relaysmtp: RamCostConstants.PortProgram, diff --git a/src/NetscriptFunctions.ts b/src/NetscriptFunctions.ts index 896618d2a0..d38c821bb6 100644 --- a/src/NetscriptFunctions.ts +++ b/src/NetscriptFunctions.ts @@ -11,6 +11,7 @@ import { } from "./Hacking"; import { netscriptCanGrow, netscriptCanWeaken } from "./Hacking/netscriptCanHack"; import { Terminal } from "./Terminal"; +import { Link } from "./Terminal/OutputTypes"; import { Player } from "@player"; import { CityName, @@ -623,6 +624,19 @@ export const ns: InternalAPI = { helpers.log(ctx, () => `Executed NUKE.exe virus on '${server.hostname}' to gain root access.`); return true; }, + autolink: (ctx) => (_hostname) => { + const hostname = helpers.string(ctx, "hostname", _hostname); + const server = helpers.getServer(ctx, hostname); + if (!(server instanceof Server)) { + helpers.log(ctx, () => "Cannot be executed on this server."); + return hostname; + } + if (!Player.hasProgram(CompletedProgramName.autoLink)) { + throw helpers.errorMessage(ctx, "You do not have the AutoLink.exe program!"); + } + + return (new Link('', hostname)); + }, brutessh: (ctx) => (_hostname) => { const hostname = helpers.string(ctx, "hostname", _hostname); const server = helpers.getServer(ctx, hostname);