Merge pull request #1602 from danielyxie/raw

netscript def is raw loaded
This commit is contained in:
hydroflame 2021-10-27 23:19:31 -04:00 committed by GitHub
commit 4fbcb1c4e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 4818 additions and 5600 deletions

1709
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -35,6 +35,7 @@
"monaco-editor": "^0.27.0", "monaco-editor": "^0.27.0",
"notistack": "^2.0.2", "notistack": "^2.0.2",
"numeral": "2.0.6", "numeral": "2.0.6",
"raw-loader": "^4.0.2",
"react": "^17.0.2", "react": "^17.0.2",
"react-dom": "^17.0.2", "react-dom": "^17.0.2",
"react-draggable": "^4.4.4", "react-draggable": "^4.4.4",

@ -3,17 +3,18 @@ import { IMap } from "../types";
import { Programs } from "../Programs/Programs"; import { Programs } from "../Programs/Programs";
export const DarkWebItems: IMap<DarkWebItem> = { export const DarkWebItems: IMap<DarkWebItem> = {
BruteSSHProgram: new DarkWebItem(Programs.BruteSSHProgram.name, 500e3, "Opens up SSH Ports"), BruteSSHProgram: new DarkWebItem(Programs.BruteSSHProgram.name, 500e3, "Opens up SSH Ports."),
FTPCrackProgram: new DarkWebItem(Programs.FTPCrackProgram.name, 1500e3, "Opens up FTP Ports"), FTPCrackProgram: new DarkWebItem(Programs.FTPCrackProgram.name, 1500e3, "Opens up FTP Ports."),
RelaySMTPProgram: new DarkWebItem(Programs.RelaySMTPProgram.name, 5e6, "Opens up SMTP Ports"), RelaySMTPProgram: new DarkWebItem(Programs.RelaySMTPProgram.name, 5e6, "Opens up SMTP Ports."),
HTTPWormProgram: new DarkWebItem(Programs.HTTPWormProgram.name, 30e6, "Opens up HTTP Ports"), HTTPWormProgram: new DarkWebItem(Programs.HTTPWormProgram.name, 30e6, "Opens up HTTP Ports."),
SQLInjectProgram: new DarkWebItem(Programs.SQLInjectProgram.name, 250e6, "Opens up SQL Ports"), SQLInjectProgram: new DarkWebItem(Programs.SQLInjectProgram.name, 250e6, "Opens up SQL Ports."),
DeepscanV1: new DarkWebItem(Programs.DeepscanV1.name, 500000, "Enables 'scan-analyze' with a depth up to 5"), DeepscanV1: new DarkWebItem(Programs.DeepscanV1.name, 500000, "Enables 'scan-analyze' with a depth up to 5."),
DeepscanV2: new DarkWebItem(Programs.DeepscanV2.name, 25e6, "Enables 'scan-analyze' with a depth up to 10"), DeepscanV2: new DarkWebItem(Programs.DeepscanV2.name, 25e6, "Enables 'scan-analyze' with a depth up to 10."),
AutolinkProgram: new DarkWebItem(Programs.AutoLink.name, 1e6, "Enables direct connect via 'scan-analyze'"), AutolinkProgram: new DarkWebItem(Programs.AutoLink.name, 1e6, "Enables direct connect via 'scan-analyze.'"),
ServerProfilerProgram: new DarkWebItem( ServerProfilerProgram: new DarkWebItem(
Programs.ServerProfiler.name, Programs.ServerProfiler.name,
1e6, 1e6,
"Displays hacking and Netscript-related information about a server", "Displays hacking and Netscript-related information about a server.",
), ),
FormulasProgram: new DarkWebItem(Programs.Formulas.name, 1e9, "Unlock access to the formulas API."),
}; };

@ -30,7 +30,7 @@ export function Augmentations(props: IProps): React.ReactElement {
} }
function queueAllAugs(): void { function queueAllAugs(): void {
for (const augName of Object.keys(AugmentationNames)) { for (const augName of Object.values(AugmentationNames)) {
props.player.queueAugmentation(augName); props.player.queueAugmentation(augName);
} }
} }

@ -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.error("This executable cannot be run."); terminal.print("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.error("This executable cannot be run."); terminal.print("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.");
}, },
}, },
@ -268,11 +268,25 @@ export const programsMetadata: IProgramCreationParams[] = [
time: CONSTANTS.MillisecondsPerQuarterHour, time: CONSTANTS.MillisecondsPerQuarterHour,
}, },
run: (router: IRouter, terminal: ITerminal): void => { run: (router: IRouter, terminal: ITerminal): void => {
terminal.error("This executable cannot be run."); terminal.print("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.");
}, },
}, },
{
key: "Formulas",
name: "Formulas.exe",
create: {
level: 1000,
tooltip: "This program allows you to use the formulas API",
req: requireHackingLevel(1000),
time: CONSTANTS.MillisecondsPer4Hours,
},
run: (router: IRouter, terminal: ITerminal): void => {
terminal.print("This executable cannot be run.");
terminal.print("Formulas.exe lets you use the formulas API.");
},
},
{ {
key: "BitFlume", key: "BitFlume",
name: "b1t_flum3.exe", name: "b1t_flum3.exe",

File diff suppressed because it is too large Load Diff

4
src/ScriptEditor/raw-loader.d.ts vendored Normal file

@ -0,0 +1,4 @@
declare module "!!raw-loader!*" {
const contents: { default: string };
export = contents;
}

@ -15,7 +15,7 @@ import { calculateRamUsage } from "../../Script/RamCalculations";
import { RamCalculationErrorCode } from "../../Script/RamCalculationErrorCodes"; import { RamCalculationErrorCode } from "../../Script/RamCalculationErrorCodes";
import { numeralWrapper } from "../../ui/numeralFormat"; import { numeralWrapper } from "../../ui/numeralFormat";
import { CursorPositions } from "../CursorPositions"; import { CursorPositions } from "../CursorPositions";
import { libSource } from "../NetscriptDefinitions";
import { NetscriptFunctions } from "../../NetscriptFunctions"; import { NetscriptFunctions } from "../../NetscriptFunctions";
import { WorkerScript } from "../../Netscript/WorkerScript"; import { WorkerScript } from "../../Netscript/WorkerScript";
import { Settings } from "../../Settings/Settings"; import { Settings } from "../../Settings/Settings";
@ -32,6 +32,8 @@ import TextField from "@mui/material/TextField";
import IconButton from "@mui/material/IconButton"; import IconButton from "@mui/material/IconButton";
import SettingsIcon from "@mui/icons-material/Settings"; import SettingsIcon from "@mui/icons-material/Settings";
import libSource from "!!raw-loader!../NetscriptDefinitions";
let symbolsLoaded = false; let symbolsLoaded = false;
let symbols: string[] = []; let symbols: string[] = [];
export function SetupTextEditor(): void { export function SetupTextEditor(): void {
@ -327,8 +329,9 @@ export function Root(props: IProps): React.ReactElement {
l.language.tokenizer.root.unshift(["this", { token: "this" }]); l.language.tokenizer.root.unshift(["this", { token: "this" }]);
})(); })();
monaco.languages.typescript.javascriptDefaults.addExtraLib(libSource, "netscript.d.ts"); const source = (libSource + "").replace(/export /g, "");
monaco.languages.typescript.typescriptDefaults.addExtraLib(libSource, "netscript.d.ts"); monaco.languages.typescript.javascriptDefaults.addExtraLib(source, "netscript.d.ts");
monaco.languages.typescript.typescriptDefaults.addExtraLib(source, "netscript.d.ts");
loadThemes(monaco); loadThemes(monaco);
} }
// 370px 71%, 725px 85.1%, 1085px 90%, 1300px 91.7% // 370px 71%, 725px 85.1%, 1085px 90%, 1300px 91.7%

@ -9,7 +9,7 @@
"target": "es6", "target": "es6",
"sourceMap": true, "sourceMap": true,
"strict": true, "strict": true,
"types": ["cypress", "@testing-library/cypress", "node"] "types": ["cypress", "@testing-library/cypress", "node", "raw-loader.d.ts"]
}, },
"exclude": ["node_modules"] "exclude": ["node_modules"]
} }