diff --git a/src/Electron.tsx b/src/Electron.tsx index e08caab07..72ddabb63 100644 --- a/src/Electron.tsx +++ b/src/Electron.tsx @@ -233,7 +233,8 @@ const achievements: Achievement[] = [ { ID: "BLADEBURNER_OVERCLOCK", Condition: () => - Player.bladeburner !== null && Player.bladeburner.skills[SkillNames.Overclock] === Skills[SkillNames.Overclock], + Player.bladeburner !== null && + Player.bladeburner.skills[SkillNames.Overclock] === Skills[SkillNames.Overclock].maxLvl, }, { ID: "BLADEBURNER_UNSPENT_100000", @@ -250,12 +251,14 @@ const achievements: Achievement[] = [ Condition: () => { if (!hasHacknetServers(Player)) return false; for (const h of Player.hacknetNodes) { - if (!(h instanceof HacknetServer)) return false; + if (typeof h !== "string") return false; + const hs = GetServer(h); + if (!(hs instanceof HacknetServer)) return false; if ( - h.maxRam === HacknetServerConstants.MaxRam && - h.cores === HacknetServerConstants.MaxCores && - h.level === HacknetServerConstants.MaxLevel && - h.cache === HacknetServerConstants.MaxCache + hs.maxRam === HacknetServerConstants.MaxRam && + hs.cores === HacknetServerConstants.MaxCores && + hs.level === HacknetServerConstants.MaxLevel && + hs.cache === HacknetServerConstants.MaxCache ) return true; } diff --git a/src/Gang/Gang.ts b/src/Gang/Gang.ts index 7a5249502..5a39d7a34 100644 --- a/src/Gang/Gang.ts +++ b/src/Gang/Gang.ts @@ -353,7 +353,7 @@ export class Gang { const res = member.ascend(); this.respect = Math.max(1, this.respect - res.respect); if (workerScript) { - workerScript.log("ascend", () => `Ascended Gang member ${member.name}`); + workerScript.log("gang.ascend", () => `Ascended Gang member ${member.name}`); } return res; } catch (e: any) { diff --git a/src/NetscriptFunctions.ts b/src/NetscriptFunctions.ts index 89aef6a1a..13437224c 100644 --- a/src/NetscriptFunctions.ts +++ b/src/NetscriptFunctions.ts @@ -1594,7 +1594,9 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS { return cost; }, - purchaseServer: function (name: any, ram: any): any { + purchaseServer: function (aname: any, aram: any): any { + const name = helper.string("purchaseServer", "name", aname); + const ram = helper.number("purchaseServer", "ram", aram); updateDynamicRam("purchaseServer", getRamCost("purchaseServer")); let hostnameStr = String(name); hostnameStr = hostnameStr.replace(/\s+/g, ""); diff --git a/src/ScriptEditor/NetscriptDefinitions.d.ts b/src/ScriptEditor/NetscriptDefinitions.d.ts index e825e73cf..f12672fa0 100644 --- a/src/ScriptEditor/NetscriptDefinitions.d.ts +++ b/src/ScriptEditor/NetscriptDefinitions.d.ts @@ -289,6 +289,8 @@ export interface ProcessInfo { threads: number; /** Script's arguments */ args: string[]; + /** Process ID */ + pid: number; } /** @@ -4098,9 +4100,6 @@ export interface NS extends Singularity { * This only stops a function from logging when the function is successful. * If the function fails, it will still log the reason for failure. * - * Notable functions that cannot have their logs disabled: run, - * exec, exit. - * * @param fn - Name of function for which to disable logging. */ disableLog(fn: string): void; diff --git a/src/Terminal/HelpText.ts b/src/Terminal/HelpText.ts index 0a1fb8081..18de1a121 100644 --- a/src/Terminal/HelpText.ts +++ b/src/Terminal/HelpText.ts @@ -14,7 +14,7 @@ export const TerminalHelpText: string[] = [ "clear Clear all text on the terminal ", "cls See 'clear' command ", "connect [hostname] Connects to a remote server", - "cp [src] [dst]: Copy a file", + "cp [src] [dst] Copy a file", "download [script/text file] Downloads scripts or text files to your computer", "expr [math expression] Evaluate a mathematical expression", "free Check the machine's memory (RAM) usage", diff --git a/src/Terminal/commands/connect.ts b/src/Terminal/commands/connect.ts index 6d075dac0..bca07c951 100644 --- a/src/Terminal/commands/connect.ts +++ b/src/Terminal/commands/connect.ts @@ -3,6 +3,7 @@ import { IRouter } from "../../ui/Router"; import { IPlayer } from "../../PersonObjects/IPlayer"; import { BaseServer } from "../../Server/BaseServer"; import { getServerOnNetwork } from "../../Server/ServerHelpers"; +import { GetServer } from "../../Server/AllServers"; export function connect( terminal: ITerminal, @@ -13,7 +14,7 @@ export function connect( ): void { // Disconnect from current server in terminal and connect to new one if (args.length !== 1) { - terminal.error("Incorrect usage of connect command. Usage: connect [ip/hostname]"); + terminal.error("Incorrect usage of connect command. Usage: connect [hostname]"); return; } @@ -28,5 +29,9 @@ export function connect( } } - terminal.error("Host not found"); + if (GetServer(hostname) !== null) { + terminal.error(`Cannot directly connect to ${hostname}`); + } else { + terminal.error("Host not found"); + } } diff --git a/src/ui/React/AlertManager.tsx b/src/ui/React/AlertManager.tsx index 2b98ae1ad..05c5903f7 100644 --- a/src/ui/React/AlertManager.tsx +++ b/src/ui/React/AlertManager.tsx @@ -32,6 +32,16 @@ export function AlertManager(): React.ReactElement { [], ); + useEffect(() => { + function handle(this: Document, event: KeyboardEvent): void { + if (event.code === "Escape") { + setAlerts([]); + } + } + document.addEventListener("keydown", handle); + return () => document.removeEventListener("keydown", handle); + }, []); + function close(): void { setAlerts((old) => { return old.slice(1, 1e99);