This commit is contained in:
Olivier Gagnon 2021-12-20 15:48:26 -05:00
parent ddd0eaaf5c
commit 41a7109baa
7 changed files with 33 additions and 14 deletions

@ -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;
}

@ -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) {

@ -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, "");

@ -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;

@ -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",

@ -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(
}
}
if (GetServer(hostname) !== null) {
terminal.error(`Cannot directly connect to ${hostname}`);
} else {
terminal.error("Host not found");
}
}

@ -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);