mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-22 23:53:48 +01:00
Merge pull request #1576 from danielyxie/dev
Fix rep transfer on new job
This commit is contained in:
commit
c7cf9c501b
24
dist/vendor.bundle.js
vendored
24
dist/vendor.bundle.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -567,7 +567,7 @@ export function initBitNodeMultipliers(p: IPlayer): void {
|
|||||||
BitNodeMultipliers.FactionWorkRepGain = 0.5;
|
BitNodeMultipliers.FactionWorkRepGain = 0.5;
|
||||||
BitNodeMultipliers.FactionPassiveRepGain = 0;
|
BitNodeMultipliers.FactionPassiveRepGain = 0;
|
||||||
BitNodeMultipliers.GangKarmaRequirement = 0;
|
BitNodeMultipliers.GangKarmaRequirement = 0;
|
||||||
BitNodeMultipliers.PurchasedServerSoftcap = 1.4;
|
BitNodeMultipliers.PurchasedServerSoftcap = 1.3;
|
||||||
break;
|
break;
|
||||||
case 3: // Corporatocracy
|
case 3: // Corporatocracy
|
||||||
BitNodeMultipliers.HackingLevelMultiplier = 0.8;
|
BitNodeMultipliers.HackingLevelMultiplier = 0.8;
|
||||||
@ -584,7 +584,7 @@ export function initBitNodeMultipliers(p: IPlayer): void {
|
|||||||
BitNodeMultipliers.HomeComputerRamCost = 1.5;
|
BitNodeMultipliers.HomeComputerRamCost = 1.5;
|
||||||
BitNodeMultipliers.PurchasedServerCost = 2;
|
BitNodeMultipliers.PurchasedServerCost = 2;
|
||||||
BitNodeMultipliers.GangKarmaRequirement = 3;
|
BitNodeMultipliers.GangKarmaRequirement = 3;
|
||||||
BitNodeMultipliers.PurchasedServerSoftcap = 1.4;
|
BitNodeMultipliers.PurchasedServerSoftcap = 1.3;
|
||||||
break;
|
break;
|
||||||
case 4: // The Singularity
|
case 4: // The Singularity
|
||||||
BitNodeMultipliers.ServerMaxMoney = 0.15;
|
BitNodeMultipliers.ServerMaxMoney = 0.15;
|
||||||
@ -599,7 +599,7 @@ export function initBitNodeMultipliers(p: IPlayer): void {
|
|||||||
BitNodeMultipliers.HackExpGain = 0.4;
|
BitNodeMultipliers.HackExpGain = 0.4;
|
||||||
BitNodeMultipliers.CrimeExpGain = 0.5;
|
BitNodeMultipliers.CrimeExpGain = 0.5;
|
||||||
BitNodeMultipliers.FactionWorkRepGain = 0.75;
|
BitNodeMultipliers.FactionWorkRepGain = 0.75;
|
||||||
BitNodeMultipliers.PurchasedServerSoftcap = 1.3;
|
BitNodeMultipliers.PurchasedServerSoftcap = 1.2;
|
||||||
break;
|
break;
|
||||||
case 5: // Artificial intelligence
|
case 5: // Artificial intelligence
|
||||||
BitNodeMultipliers.ServerMaxMoney = 2;
|
BitNodeMultipliers.ServerMaxMoney = 2;
|
||||||
@ -613,7 +613,7 @@ export function initBitNodeMultipliers(p: IPlayer): void {
|
|||||||
BitNodeMultipliers.AugmentationMoneyCost = 2;
|
BitNodeMultipliers.AugmentationMoneyCost = 2;
|
||||||
BitNodeMultipliers.HackExpGain = 0.5;
|
BitNodeMultipliers.HackExpGain = 0.5;
|
||||||
BitNodeMultipliers.CorporationValuation = 0.5;
|
BitNodeMultipliers.CorporationValuation = 0.5;
|
||||||
BitNodeMultipliers.PurchasedServerSoftcap = 1.3;
|
BitNodeMultipliers.PurchasedServerSoftcap = 1.2;
|
||||||
break;
|
break;
|
||||||
case 6: // Bladeburner
|
case 6: // Bladeburner
|
||||||
BitNodeMultipliers.HackingLevelMultiplier = 0.35;
|
BitNodeMultipliers.HackingLevelMultiplier = 0.35;
|
||||||
@ -666,7 +666,7 @@ export function initBitNodeMultipliers(p: IPlayer): void {
|
|||||||
BitNodeMultipliers.CorporationValuation = 0;
|
BitNodeMultipliers.CorporationValuation = 0;
|
||||||
BitNodeMultipliers.CodingContractMoney = 0;
|
BitNodeMultipliers.CodingContractMoney = 0;
|
||||||
BitNodeMultipliers.GangKarmaRequirement = 10;
|
BitNodeMultipliers.GangKarmaRequirement = 10;
|
||||||
BitNodeMultipliers.PurchasedServerSoftcap = 5;
|
BitNodeMultipliers.PurchasedServerSoftcap = 4;
|
||||||
break;
|
break;
|
||||||
case 9: // Hacktocracy
|
case 9: // Hacktocracy
|
||||||
BitNodeMultipliers.HackingLevelMultiplier = 0.4;
|
BitNodeMultipliers.HackingLevelMultiplier = 0.4;
|
||||||
@ -713,7 +713,7 @@ export function initBitNodeMultipliers(p: IPlayer): void {
|
|||||||
BitNodeMultipliers.PurchasedServerMaxRam = 0.5;
|
BitNodeMultipliers.PurchasedServerMaxRam = 0.5;
|
||||||
BitNodeMultipliers.BladeburnerRank = 0.8;
|
BitNodeMultipliers.BladeburnerRank = 0.8;
|
||||||
BitNodeMultipliers.GangKarmaRequirement = 3;
|
BitNodeMultipliers.GangKarmaRequirement = 3;
|
||||||
BitNodeMultipliers.PurchasedServerSoftcap = 1.2;
|
BitNodeMultipliers.PurchasedServerSoftcap = 1.1;
|
||||||
break;
|
break;
|
||||||
case 11: //The Big Crash
|
case 11: //The Big Crash
|
||||||
BitNodeMultipliers.HackingLevelMultiplier = 0.5;
|
BitNodeMultipliers.HackingLevelMultiplier = 0.5;
|
||||||
@ -732,7 +732,7 @@ export function initBitNodeMultipliers(p: IPlayer): void {
|
|||||||
BitNodeMultipliers.CodingContractMoney = 0.25;
|
BitNodeMultipliers.CodingContractMoney = 0.25;
|
||||||
BitNodeMultipliers.FourSigmaMarketDataCost = 4;
|
BitNodeMultipliers.FourSigmaMarketDataCost = 4;
|
||||||
BitNodeMultipliers.FourSigmaMarketDataApiCost = 4;
|
BitNodeMultipliers.FourSigmaMarketDataApiCost = 4;
|
||||||
BitNodeMultipliers.PurchasedServerSoftcap = 2.2;
|
BitNodeMultipliers.PurchasedServerSoftcap = 2;
|
||||||
break;
|
break;
|
||||||
case 12: {
|
case 12: {
|
||||||
//The Recursion
|
//The Recursion
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
|
import React from "react";
|
||||||
import { DarkWebItems } from "./DarkWebItems";
|
import { DarkWebItems } from "./DarkWebItems";
|
||||||
|
|
||||||
import { Player } from "../Player";
|
import { Player } from "../Player";
|
||||||
import { Terminal } from "../Terminal";
|
import { Terminal } from "../Terminal";
|
||||||
import { SpecialServers } from "../Server/data/SpecialServers";
|
import { SpecialServers } from "../Server/data/SpecialServers";
|
||||||
import { numeralWrapper } from "../ui/numeralFormat";
|
import { Money } from "../ui/React/Money";
|
||||||
|
|
||||||
//Posts a "help" message if connected to DarkWeb
|
//Posts a "help" message if connected to DarkWeb
|
||||||
export function checkIfConnectedToDarkweb(): void {
|
export function checkIfConnectedToDarkweb(): void {
|
||||||
@ -20,7 +21,11 @@ export function checkIfConnectedToDarkweb(): void {
|
|||||||
export function listAllDarkwebItems(): void {
|
export function listAllDarkwebItems(): void {
|
||||||
for (const key in DarkWebItems) {
|
for (const key in DarkWebItems) {
|
||||||
const item = DarkWebItems[key];
|
const item = DarkWebItems[key];
|
||||||
Terminal.print(`${item.program} - ${numeralWrapper.formatMoney(item.price)} - ${item.description}`);
|
Terminal.printRaw(
|
||||||
|
<>
|
||||||
|
{item.program} - <Money money={item.price} /> - {item.description}`
|
||||||
|
</>,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,7 +43,7 @@ export function buyDarkwebItem(itemName: string): void {
|
|||||||
|
|
||||||
// return if invalid
|
// return if invalid
|
||||||
if (item === null) {
|
if (item === null) {
|
||||||
Terminal.print("Unrecognized item: " + itemName);
|
Terminal.error("Unrecognized item: " + itemName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,7 +55,7 @@ export function buyDarkwebItem(itemName: string): void {
|
|||||||
|
|
||||||
// return if the player doesn't have enough money
|
// return if the player doesn't have enough money
|
||||||
if (Player.money.lt(item.price)) {
|
if (Player.money.lt(item.price)) {
|
||||||
Terminal.print("Not enough money to purchase " + item.program);
|
Terminal.error("Not enough money to purchase " + item.program);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -630,6 +630,7 @@ export function work(this: IPlayer, numCycles: number): boolean {
|
|||||||
this.timeWorked += CONSTANTS._idleSpeed * numCycles;
|
this.timeWorked += CONSTANTS._idleSpeed * numCycles;
|
||||||
|
|
||||||
this.workRepGainRate = this.getWorkRepGain();
|
this.workRepGainRate = this.getWorkRepGain();
|
||||||
|
this.workMoneyGainRate = this.getWorkMoneyGain();
|
||||||
this.processWorkEarnings(numCycles);
|
this.processWorkEarnings(numCycles);
|
||||||
|
|
||||||
const comp = Companies[this.companyName];
|
const comp = Companies[this.companyName];
|
||||||
@ -1531,20 +1532,20 @@ export function finishCrime(this: IPlayer, cancelled: boolean): string {
|
|||||||
if (ws.disableLogs.ALL == null && ws.disableLogs.commitCrime == null) {
|
if (ws.disableLogs.ALL == null && ws.disableLogs.commitCrime == null) {
|
||||||
ws.scriptRef.log(
|
ws.scriptRef.log(
|
||||||
"Crime successful! Gained " +
|
"Crime successful! Gained " +
|
||||||
numeralWrapper.formatMoney(this.workMoneyGained) +
|
numeralWrapper.formatMoney(this.workMoneyGained) +
|
||||||
", " +
|
", " +
|
||||||
numeralWrapper.formatExp(this.workHackExpGained) +
|
numeralWrapper.formatExp(this.workHackExpGained) +
|
||||||
" hack exp, " +
|
" hack exp, " +
|
||||||
numeralWrapper.formatExp(this.workStrExpGained) +
|
numeralWrapper.formatExp(this.workStrExpGained) +
|
||||||
" str exp, " +
|
" str exp, " +
|
||||||
numeralWrapper.formatExp(this.workDefExpGained) +
|
numeralWrapper.formatExp(this.workDefExpGained) +
|
||||||
" def exp, " +
|
" def exp, " +
|
||||||
numeralWrapper.formatExp(this.workDexExpGained) +
|
numeralWrapper.formatExp(this.workDexExpGained) +
|
||||||
" dex exp, " +
|
" dex exp, " +
|
||||||
numeralWrapper.formatExp(this.workAgiExpGained) +
|
numeralWrapper.formatExp(this.workAgiExpGained) +
|
||||||
" agi exp, " +
|
" agi exp, " +
|
||||||
numeralWrapper.formatExp(this.workChaExpGained) +
|
numeralWrapper.formatExp(this.workChaExpGained) +
|
||||||
" cha exp.",
|
" cha exp.",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -1583,18 +1584,18 @@ export function finishCrime(this: IPlayer, cancelled: boolean): string {
|
|||||||
if (ws.disableLogs.ALL == null && ws.disableLogs.commitCrime == null) {
|
if (ws.disableLogs.ALL == null && ws.disableLogs.commitCrime == null) {
|
||||||
ws.scriptRef.log(
|
ws.scriptRef.log(
|
||||||
"Crime failed! Gained " +
|
"Crime failed! Gained " +
|
||||||
numeralWrapper.formatExp(this.workHackExpGained) +
|
numeralWrapper.formatExp(this.workHackExpGained) +
|
||||||
" hack exp, " +
|
" hack exp, " +
|
||||||
numeralWrapper.formatExp(this.workStrExpGained) +
|
numeralWrapper.formatExp(this.workStrExpGained) +
|
||||||
" str exp, " +
|
" str exp, " +
|
||||||
numeralWrapper.formatExp(this.workDefExpGained) +
|
numeralWrapper.formatExp(this.workDefExpGained) +
|
||||||
" def exp, " +
|
" def exp, " +
|
||||||
numeralWrapper.formatExp(this.workDexExpGained) +
|
numeralWrapper.formatExp(this.workDexExpGained) +
|
||||||
" dex exp, " +
|
" dex exp, " +
|
||||||
numeralWrapper.formatExp(this.workAgiExpGained) +
|
numeralWrapper.formatExp(this.workAgiExpGained) +
|
||||||
" agi exp, " +
|
" agi exp, " +
|
||||||
numeralWrapper.formatExp(this.workChaExpGained) +
|
numeralWrapper.formatExp(this.workChaExpGained) +
|
||||||
" cha exp.",
|
" cha exp.",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -1780,6 +1781,7 @@ export function applyForJob(this: IPlayer, entryPosType: CompanyPosition, sing =
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.jobs[company.name] = pos.name;
|
this.jobs[company.name] = pos.name;
|
||||||
|
if (!this.focus && this.isWorking && this.companyName !== this.location) this.resetWorkStatus();
|
||||||
this.companyName = this.location;
|
this.companyName = this.location;
|
||||||
|
|
||||||
if (!sing) {
|
if (!sing) {
|
||||||
|
@ -190,7 +190,7 @@ export const programsMetadata: IProgramCreationParams[] = [
|
|||||||
time: CONSTANTS.MillisecondsPerQuarterHour,
|
time: CONSTANTS.MillisecondsPerQuarterHour,
|
||||||
},
|
},
|
||||||
run: (router: IRouter, terminal: ITerminal): void => {
|
run: (router: IRouter, terminal: ITerminal): void => {
|
||||||
terminal.print("This executable cannot be run.");
|
terminal.error("This executable cannot be run.");
|
||||||
terminal.print("DeepscanV1.exe lets you run 'scan-analyze' with a depth up to 5.");
|
terminal.print("DeepscanV1.exe lets you run 'scan-analyze' with a depth up to 5.");
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -204,7 +204,7 @@ export const programsMetadata: IProgramCreationParams[] = [
|
|||||||
time: CONSTANTS.MillisecondsPer2Hours,
|
time: CONSTANTS.MillisecondsPer2Hours,
|
||||||
},
|
},
|
||||||
run: (router: IRouter, terminal: ITerminal): void => {
|
run: (router: IRouter, terminal: ITerminal): void => {
|
||||||
terminal.print("This executable cannot be run.");
|
terminal.error("This executable cannot be run.");
|
||||||
terminal.print("DeepscanV2.exe lets you run 'scan-analyze' with a depth up to 10.");
|
terminal.print("DeepscanV2.exe lets you run 'scan-analyze' with a depth up to 10.");
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -219,18 +219,18 @@ export const programsMetadata: IProgramCreationParams[] = [
|
|||||||
},
|
},
|
||||||
run: (router: IRouter, terminal: ITerminal, player: IPlayer, server: BaseServer, args: string[]): void => {
|
run: (router: IRouter, terminal: ITerminal, player: IPlayer, server: BaseServer, args: string[]): void => {
|
||||||
if (args.length !== 1) {
|
if (args.length !== 1) {
|
||||||
terminal.print("Must pass a server hostname or IP as an argument for ServerProfiler.exe");
|
terminal.error("Must pass a server hostname or IP as an argument for ServerProfiler.exe");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const targetServer = GetServer(args[0]);
|
const targetServer = GetServer(args[0]);
|
||||||
if (targetServer == null) {
|
if (targetServer == null) {
|
||||||
terminal.print("Invalid server IP/hostname");
|
terminal.error("Invalid server IP/hostname");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(targetServer instanceof Server)) {
|
if (!(targetServer instanceof Server)) {
|
||||||
terminal.print(`ServerProfiler.exe can only be run on normal servers.`);
|
terminal.error(`ServerProfiler.exe can only be run on normal servers.`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -268,7 +268,7 @@ export const programsMetadata: IProgramCreationParams[] = [
|
|||||||
time: CONSTANTS.MillisecondsPerQuarterHour,
|
time: CONSTANTS.MillisecondsPerQuarterHour,
|
||||||
},
|
},
|
||||||
run: (router: IRouter, terminal: ITerminal): void => {
|
run: (router: IRouter, terminal: ITerminal): void => {
|
||||||
terminal.print("This executable cannot be run.");
|
terminal.error("This executable cannot be run.");
|
||||||
terminal.print("AutoLink.exe lets you automatically connect to other servers when using 'scan-analyze'.");
|
terminal.print("AutoLink.exe lets you automatically connect to other servers when using 'scan-analyze'.");
|
||||||
terminal.print("When using scan-analyze, click on a server's hostname to connect to it.");
|
terminal.print("When using scan-analyze, click on a server's hostname to connect to it.");
|
||||||
},
|
},
|
||||||
|
@ -28,7 +28,7 @@ export function getPurchaseServerCost(ram: number): number {
|
|||||||
return Infinity;
|
return Infinity;
|
||||||
}
|
}
|
||||||
|
|
||||||
const upg = Math.max(0, Math.log(sanitizedRam) / Math.log(2) - 9);
|
const upg = Math.max(0, Math.log(sanitizedRam) / Math.log(2) - 6);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
sanitizedRam *
|
sanitizedRam *
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import React from "react";
|
||||||
import { TextFile } from "../TextFile";
|
import { TextFile } from "../TextFile";
|
||||||
import { Script } from "../Script/Script";
|
import { Script } from "../Script/Script";
|
||||||
import { IPlayer } from "../PersonObjects/IPlayer";
|
import { IPlayer } from "../PersonObjects/IPlayer";
|
||||||
@ -18,6 +19,13 @@ export class Output {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class RawOutput {
|
||||||
|
raw: React.ReactNode;
|
||||||
|
constructor(node: React.ReactNode) {
|
||||||
|
this.raw = node;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export class Link {
|
export class Link {
|
||||||
hostname: string;
|
hostname: string;
|
||||||
dashes: string;
|
dashes: string;
|
||||||
@ -46,7 +54,7 @@ export interface ITerminal {
|
|||||||
commandHistory: string[];
|
commandHistory: string[];
|
||||||
commandHistoryIndex: number;
|
commandHistoryIndex: number;
|
||||||
|
|
||||||
outputHistory: (Output | Link)[];
|
outputHistory: (Output | Link | RawOutput)[];
|
||||||
|
|
||||||
// True if a Coding Contract prompt is opened
|
// True if a Coding Contract prompt is opened
|
||||||
contractOpen: boolean;
|
contractOpen: boolean;
|
||||||
@ -56,6 +64,7 @@ export interface ITerminal {
|
|||||||
currDir: string;
|
currDir: string;
|
||||||
|
|
||||||
print(s: string): void;
|
print(s: string): void;
|
||||||
|
printRaw(node: React.ReactNode): void;
|
||||||
error(s: string): void;
|
error(s: string): void;
|
||||||
|
|
||||||
clear(): void;
|
clear(): void;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { ITerminal, Output, Link, TTimer } from "./ITerminal";
|
import { ITerminal, Output, Link, RawOutput, TTimer } from "./ITerminal";
|
||||||
import { IRouter } from "../ui/Router";
|
import { IRouter } from "../ui/Router";
|
||||||
import { IPlayer } from "../PersonObjects/IPlayer";
|
import { IPlayer } from "../PersonObjects/IPlayer";
|
||||||
import { HacknetServer } from "../Hacknet/HacknetServer";
|
import { HacknetServer } from "../Hacknet/HacknetServer";
|
||||||
@ -77,7 +77,7 @@ export class Terminal implements ITerminal {
|
|||||||
commandHistory: string[] = [];
|
commandHistory: string[] = [];
|
||||||
commandHistoryIndex = 0;
|
commandHistoryIndex = 0;
|
||||||
|
|
||||||
outputHistory: (Output | Link)[] = [new Output(`Bitburner v${CONSTANTS.Version}`, "primary")];
|
outputHistory: (Output | Link | RawOutput)[] = [new Output(`Bitburner v${CONSTANTS.Version}`, "primary")];
|
||||||
|
|
||||||
// True if a Coding Contract prompt is opened
|
// True if a Coding Contract prompt is opened
|
||||||
contractOpen = false;
|
contractOpen = false;
|
||||||
@ -93,7 +93,7 @@ export class Terminal implements ITerminal {
|
|||||||
TerminalEvents.emit();
|
TerminalEvents.emit();
|
||||||
}
|
}
|
||||||
|
|
||||||
append(item: Output | Link): void {
|
append(item: Output | Link | RawOutput): void {
|
||||||
this.outputHistory.push(item);
|
this.outputHistory.push(item);
|
||||||
if (this.outputHistory.length > Settings.MaxTerminalCapacity) {
|
if (this.outputHistory.length > Settings.MaxTerminalCapacity) {
|
||||||
this.outputHistory.splice(0, this.outputHistory.length - Settings.MaxTerminalCapacity);
|
this.outputHistory.splice(0, this.outputHistory.length - Settings.MaxTerminalCapacity);
|
||||||
@ -105,6 +105,10 @@ export class Terminal implements ITerminal {
|
|||||||
this.append(new Output(s, "primary"));
|
this.append(new Output(s, "primary"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
printRaw(node: React.ReactNode): void {
|
||||||
|
this.append(new RawOutput(node));
|
||||||
|
}
|
||||||
|
|
||||||
error(s: string): void {
|
error(s: string): void {
|
||||||
this.append(new Output(s, "error"));
|
this.append(new Output(s, "error"));
|
||||||
}
|
}
|
||||||
@ -428,10 +432,10 @@ export class Terminal implements ITerminal {
|
|||||||
case CodingContractResult.Failure:
|
case CodingContractResult.Failure:
|
||||||
++contract.tries;
|
++contract.tries;
|
||||||
if (contract.tries >= contract.getMaxNumTries()) {
|
if (contract.tries >= contract.getMaxNumTries()) {
|
||||||
this.print("Contract FAILED - Contract is now self-destructing");
|
this.error("Contract FAILED - Contract is now self-destructing");
|
||||||
serv.removeContract(contract);
|
serv.removeContract(contract);
|
||||||
} else {
|
} else {
|
||||||
this.print(`Contract FAILED - ${contract.getMaxNumTries() - contract.tries} tries remaining`);
|
this.error(`Contract FAILED - ${contract.getMaxNumTries() - contract.tries} tries remaining`);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CodingContractResult.Cancelled:
|
case CodingContractResult.Cancelled:
|
||||||
@ -580,7 +584,7 @@ export class Terminal implements ITerminal {
|
|||||||
if (commandArray.length === 1 && commandArray[0] == "help") {
|
if (commandArray.length === 1 && commandArray[0] == "help") {
|
||||||
iTutorialNextStep();
|
iTutorialNextStep();
|
||||||
} else {
|
} else {
|
||||||
this.print("Bad command. Please follow the tutorial");
|
this.error("Bad command. Please follow the tutorial");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -588,7 +592,7 @@ export class Terminal implements ITerminal {
|
|||||||
if (commandArray.length === 1 && commandArray[0] == "ls") {
|
if (commandArray.length === 1 && commandArray[0] == "ls") {
|
||||||
iTutorialNextStep();
|
iTutorialNextStep();
|
||||||
} else {
|
} else {
|
||||||
this.print("Bad command. Please follow the tutorial");
|
this.error("Bad command. Please follow the tutorial");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -596,7 +600,7 @@ export class Terminal implements ITerminal {
|
|||||||
if (commandArray.length === 1 && commandArray[0] == "scan") {
|
if (commandArray.length === 1 && commandArray[0] == "scan") {
|
||||||
iTutorialNextStep();
|
iTutorialNextStep();
|
||||||
} else {
|
} else {
|
||||||
this.print("Bad command. Please follow the tutorial");
|
this.error("Bad command. Please follow the tutorial");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -604,7 +608,7 @@ export class Terminal implements ITerminal {
|
|||||||
if (commandArray.length == 1 && commandArray[0] == "scan-analyze") {
|
if (commandArray.length == 1 && commandArray[0] == "scan-analyze") {
|
||||||
iTutorialNextStep();
|
iTutorialNextStep();
|
||||||
} else {
|
} else {
|
||||||
this.print("Bad command. Please follow the tutorial");
|
this.error("Bad command. Please follow the tutorial");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -612,7 +616,7 @@ export class Terminal implements ITerminal {
|
|||||||
if (commandArray.length == 2 && commandArray[0] == "scan-analyze" && commandArray[1] === 2) {
|
if (commandArray.length == 2 && commandArray[0] == "scan-analyze" && commandArray[1] === 2) {
|
||||||
iTutorialNextStep();
|
iTutorialNextStep();
|
||||||
} else {
|
} else {
|
||||||
this.print("Bad command. Please follow the tutorial");
|
this.error("Bad command. Please follow the tutorial");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -624,11 +628,11 @@ export class Terminal implements ITerminal {
|
|||||||
) {
|
) {
|
||||||
iTutorialNextStep();
|
iTutorialNextStep();
|
||||||
} else {
|
} else {
|
||||||
this.print("Wrong command! Try again!");
|
this.error("Wrong command! Try again!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.print("Bad command. Please follow the tutorial");
|
this.error("Bad command. Please follow the tutorial");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -636,7 +640,7 @@ export class Terminal implements ITerminal {
|
|||||||
if (commandArray.length === 1 && commandArray[0] === "analyze") {
|
if (commandArray.length === 1 && commandArray[0] === "analyze") {
|
||||||
iTutorialNextStep();
|
iTutorialNextStep();
|
||||||
} else {
|
} else {
|
||||||
this.print("Bad command. Please follow the tutorial");
|
this.error("Bad command. Please follow the tutorial");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -644,7 +648,7 @@ export class Terminal implements ITerminal {
|
|||||||
if (commandArray.length == 2 && commandArray[0] == "run" && commandArray[1] == "NUKE.exe") {
|
if (commandArray.length == 2 && commandArray[0] == "run" && commandArray[1] == "NUKE.exe") {
|
||||||
iTutorialNextStep();
|
iTutorialNextStep();
|
||||||
} else {
|
} else {
|
||||||
this.print("Bad command. Please follow the tutorial");
|
this.error("Bad command. Please follow the tutorial");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -652,7 +656,7 @@ export class Terminal implements ITerminal {
|
|||||||
if (commandArray.length == 1 && commandArray[0] == "hack") {
|
if (commandArray.length == 1 && commandArray[0] == "hack") {
|
||||||
iTutorialNextStep();
|
iTutorialNextStep();
|
||||||
} else {
|
} else {
|
||||||
this.print("Bad command. Please follow the tutorial");
|
this.error("Bad command. Please follow the tutorial");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -660,7 +664,7 @@ export class Terminal implements ITerminal {
|
|||||||
if (commandArray.length == 1 && commandArray[0] == "home") {
|
if (commandArray.length == 1 && commandArray[0] == "home") {
|
||||||
iTutorialNextStep();
|
iTutorialNextStep();
|
||||||
} else {
|
} else {
|
||||||
this.print("Bad command. Please follow the tutorial");
|
this.error("Bad command. Please follow the tutorial");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -668,7 +672,7 @@ export class Terminal implements ITerminal {
|
|||||||
if (commandArray.length == 2 && commandArray[0] == "nano" && commandArray[1] == "n00dles.script") {
|
if (commandArray.length == 2 && commandArray[0] == "nano" && commandArray[1] == "n00dles.script") {
|
||||||
iTutorialNextStep();
|
iTutorialNextStep();
|
||||||
} else {
|
} else {
|
||||||
this.print("Bad command. Please follow the tutorial");
|
this.error("Bad command. Please follow the tutorial");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -676,7 +680,7 @@ export class Terminal implements ITerminal {
|
|||||||
if (commandArray.length == 1 && commandArray[0] == "free") {
|
if (commandArray.length == 1 && commandArray[0] == "free") {
|
||||||
iTutorialNextStep();
|
iTutorialNextStep();
|
||||||
} else {
|
} else {
|
||||||
this.print("Bad command. Please follow the tutorial");
|
this.error("Bad command. Please follow the tutorial");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -684,7 +688,7 @@ export class Terminal implements ITerminal {
|
|||||||
if (commandArray.length == 2 && commandArray[0] == "run" && commandArray[1] == "n00dles.script") {
|
if (commandArray.length == 2 && commandArray[0] == "run" && commandArray[1] == "n00dles.script") {
|
||||||
iTutorialNextStep();
|
iTutorialNextStep();
|
||||||
} else {
|
} else {
|
||||||
this.print("Bad command. Please follow the tutorial");
|
this.error("Bad command. Please follow the tutorial");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -692,12 +696,12 @@ export class Terminal implements ITerminal {
|
|||||||
if (commandArray.length == 2 && commandArray[0] == "tail" && commandArray[1] == "n00dles.script") {
|
if (commandArray.length == 2 && commandArray[0] == "tail" && commandArray[1] == "n00dles.script") {
|
||||||
iTutorialNextStep();
|
iTutorialNextStep();
|
||||||
} else {
|
} else {
|
||||||
this.print("Bad command. Please follow the tutorial");
|
this.error("Bad command. Please follow the tutorial");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
this.print("Please follow the tutorial, or click 'EXIT' if you'd like to skip it");
|
this.error("Please follow the tutorial, or click 'EXIT' if you'd like to skip it");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ export function analyze(
|
|||||||
args: (string | number)[],
|
args: (string | number)[],
|
||||||
): void {
|
): void {
|
||||||
if (args.length !== 0) {
|
if (args.length !== 0) {
|
||||||
terminal.print("Incorrect usage of analyze command. Usage: analyze");
|
terminal.error("Incorrect usage of analyze command. Usage: analyze");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
terminal.startAnalyze();
|
terminal.startAnalyze();
|
||||||
|
@ -13,7 +13,7 @@ export function backdoor(
|
|||||||
args: (string | number)[],
|
args: (string | number)[],
|
||||||
): void {
|
): void {
|
||||||
if (args.length !== 0) {
|
if (args.length !== 0) {
|
||||||
terminal.print("Incorrect usage of backdoor command. Usage: backdoor");
|
terminal.error("Incorrect usage of backdoor command. Usage: backdoor");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ export function kill(
|
|||||||
if (res) {
|
if (res) {
|
||||||
terminal.print(`Killing script with PID ${pid}`);
|
terminal.print(`Killing script with PID ${pid}`);
|
||||||
} else {
|
} else {
|
||||||
terminal.print(`Failed to kill script with PID ${pid}. No such script exists`);
|
terminal.error(`Failed to kill script with PID ${pid}. No such script exists`);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
|
import React from "react";
|
||||||
import { ITerminal } from "../ITerminal";
|
import { ITerminal } from "../ITerminal";
|
||||||
import { IRouter } from "../../ui/Router";
|
import { IRouter } from "../../ui/Router";
|
||||||
import { IPlayer } from "../../PersonObjects/IPlayer";
|
import { IPlayer } from "../../PersonObjects/IPlayer";
|
||||||
import { BaseServer } from "../../Server/BaseServer";
|
import { BaseServer } from "../../Server/BaseServer";
|
||||||
import { getFirstParentDirectory, isValidDirectoryPath, evaluateDirectoryPath } from "../../Terminal/DirectoryHelpers";
|
import { getFirstParentDirectory, isValidDirectoryPath, evaluateDirectoryPath } from "../../Terminal/DirectoryHelpers";
|
||||||
|
import Typography from "@mui/material/Typography";
|
||||||
|
|
||||||
export function ls(
|
export function ls(
|
||||||
terminal: ITerminal,
|
terminal: ITerminal,
|
||||||
@ -112,7 +114,7 @@ export function ls(
|
|||||||
allMessages.sort();
|
allMessages.sort();
|
||||||
folders.sort();
|
folders.sort();
|
||||||
|
|
||||||
function postSegments(segments: string[]): void {
|
function postSegments(segments: string[], style?: any): void {
|
||||||
const maxLength = Math.max(...segments.map((s) => s.length)) + 1;
|
const maxLength = Math.max(...segments.map((s) => s.length)) + 1;
|
||||||
const filesPerRow = Math.floor(80 / maxLength);
|
const filesPerRow = Math.floor(80 / maxLength);
|
||||||
for (let i = 0; i < segments.length; i++) {
|
for (let i = 0; i < segments.length; i++) {
|
||||||
@ -124,23 +126,27 @@ export function ls(
|
|||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
i--;
|
i--;
|
||||||
terminal.print(row);
|
if (!style) {
|
||||||
|
terminal.print(row);
|
||||||
|
} else {
|
||||||
|
terminal.printRaw(<span style={style}>{row}</span>);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const groups = [
|
const groups = [
|
||||||
{ segments: folders },
|
{ segments: folders, style: { color: "cyan" } },
|
||||||
{ segments: allMessages },
|
{ segments: allMessages },
|
||||||
{ segments: allTextFiles },
|
{ segments: allTextFiles },
|
||||||
{ segments: allPrograms },
|
{ segments: allPrograms },
|
||||||
{ segments: allContracts },
|
{ segments: allContracts },
|
||||||
{ segments: allScripts },
|
{ segments: allScripts, style: { color: "yellow", fontStyle: "bold" } },
|
||||||
].filter((g) => g.segments.length > 0);
|
].filter((g) => g.segments.length > 0);
|
||||||
for (let i = 0; i < groups.length; i++) {
|
for (let i = 0; i < groups.length; i++) {
|
||||||
if (i !== 0) {
|
if (i !== 0) {
|
||||||
terminal.print("");
|
terminal.print("");
|
||||||
terminal.print("");
|
terminal.print("");
|
||||||
}
|
}
|
||||||
postSegments(groups[i].segments);
|
postSegments(groups[i].segments, groups[i].style);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,5 +41,5 @@ export function runProgram(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
terminal.print("Invalid executable. Cannot be run");
|
terminal.error("Invalid executable. Cannot be run");
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ export function runScript(
|
|||||||
|
|
||||||
// Check if this script is already running
|
// Check if this script is already running
|
||||||
if (findRunningScript(scriptName, args, server) != null) {
|
if (findRunningScript(scriptName, args, server) != null) {
|
||||||
terminal.print("ERROR: This script is already running. Cannot run multiple instances");
|
terminal.error("This script is already running. Cannot run multiple instances");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,12 +56,12 @@ export function runScript(
|
|||||||
const ramAvailable = server.maxRam - server.ramUsed;
|
const ramAvailable = server.maxRam - server.ramUsed;
|
||||||
|
|
||||||
if (!server.hasAdminRights) {
|
if (!server.hasAdminRights) {
|
||||||
terminal.print("Need root access to run script");
|
terminal.error("Need root access to run script");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ramUsage > ramAvailable) {
|
if (ramUsage > ramAvailable) {
|
||||||
terminal.print(
|
terminal.error(
|
||||||
"This machine does not have enough RAM to run this script with " +
|
"This machine does not have enough RAM to run this script with " +
|
||||||
numThreads +
|
numThreads +
|
||||||
" threads. Script requires " +
|
" threads. Script requires " +
|
||||||
@ -90,5 +90,5 @@ export function runScript(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
terminal.print("ERROR: No such script");
|
terminal.error("No such script");
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ export function wget(
|
|||||||
const url = args[0] + "";
|
const url = args[0] + "";
|
||||||
const target = terminal.getFilepath(args[1] + "");
|
const target = terminal.getFilepath(args[1] + "");
|
||||||
if (!isScriptFilename(target) && !target.endsWith(".txt")) {
|
if (!isScriptFilename(target) && !target.endsWith(".txt")) {
|
||||||
return terminal.print(`wget failed: Invalid target file. Target file must be script or text file`);
|
return terminal.error(`wget failed: Invalid target file. Target file must be script or text file`);
|
||||||
}
|
}
|
||||||
$.get(
|
$.get(
|
||||||
url,
|
url,
|
||||||
@ -31,7 +31,7 @@ export function wget(
|
|||||||
res = server.writeToTextFile(target, data);
|
res = server.writeToTextFile(target, data);
|
||||||
}
|
}
|
||||||
if (!res.success) {
|
if (!res.success) {
|
||||||
return terminal.print("wget failed");
|
return terminal.error("wget failed");
|
||||||
}
|
}
|
||||||
if (res.overwritten) {
|
if (res.overwritten) {
|
||||||
return terminal.print(`wget successfully retrieved content and overwrote ${target}`);
|
return terminal.print(`wget successfully retrieved content and overwrote ${target}`);
|
||||||
|
@ -7,7 +7,7 @@ import { Theme } from "@mui/material/styles";
|
|||||||
import makeStyles from "@mui/styles/makeStyles";
|
import makeStyles from "@mui/styles/makeStyles";
|
||||||
import createStyles from "@mui/styles/createStyles";
|
import createStyles from "@mui/styles/createStyles";
|
||||||
import Box from "@mui/material/Box";
|
import Box from "@mui/material/Box";
|
||||||
import { ITerminal, Output, Link } from "../ITerminal";
|
import { ITerminal, Output, Link, RawOutput } from "../ITerminal";
|
||||||
import { IRouter } from "../../ui/Router";
|
import { IRouter } from "../../ui/Router";
|
||||||
import { IPlayer } from "../../PersonObjects/IPlayer";
|
import { IPlayer } from "../../PersonObjects/IPlayer";
|
||||||
import { TerminalInput } from "./TerminalInput";
|
import { TerminalInput } from "./TerminalInput";
|
||||||
@ -94,6 +94,14 @@ export function TerminalRoot({ terminal, router, player }: IProps): React.ReactE
|
|||||||
</Typography>
|
</Typography>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
);
|
);
|
||||||
|
if (item instanceof RawOutput)
|
||||||
|
return (
|
||||||
|
<ListItem key={i} classes={{ root: classes.nopadding }}>
|
||||||
|
<Typography classes={{ root: classes.preformatted }} paragraph={false}>
|
||||||
|
{item.raw}
|
||||||
|
</Typography>
|
||||||
|
</ListItem>
|
||||||
|
);
|
||||||
if (item instanceof Link)
|
if (item instanceof Link)
|
||||||
return (
|
return (
|
||||||
<ListItem key={i} classes={{ root: classes.nopadding }}>
|
<ListItem key={i} classes={{ root: classes.nopadding }}>
|
||||||
|
Loading…
Reference in New Issue
Block a user