mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-09 17:23:53 +01:00
lint
This commit is contained in:
parent
4a3201cba3
commit
fb37f6b94d
@ -30,4 +30,5 @@ export interface IEngine {
|
||||
loadMissionContent: () => void;
|
||||
loadResleevingContent: () => void;
|
||||
loadGameOptionsContent: () => void;
|
||||
load: (save: string) => void;
|
||||
}
|
||||
|
@ -3,7 +3,6 @@ import React, { useState } from "react";
|
||||
import { Intro } from "./Intro";
|
||||
import { Game } from "./Game";
|
||||
import { Location } from "../../Locations/Location";
|
||||
import { Locations } from "../../Locations/Locations";
|
||||
import { use } from "../../ui/Context";
|
||||
|
||||
interface IProps {
|
||||
|
5
src/InteractiveTutorial.d.ts
vendored
5
src/InteractiveTutorial.d.ts
vendored
@ -1,5 +0,0 @@
|
||||
export declare function iTutorialNextStep(): void;
|
||||
export declare function iTutorialPrevStep(): void;
|
||||
export declare function iTutorialEnd(): void;
|
||||
export declare const ITutorial: { isRunning: boolean; currStep: number };
|
||||
export declare const iTutorialSteps: { [key: string]: number | undefined };
|
@ -1,122 +0,0 @@
|
||||
import { Engine } from "./engine";
|
||||
import { Player } from "./Player";
|
||||
import { Settings } from "./Settings/Settings";
|
||||
|
||||
import { LiteratureNames } from "./Literature/data/LiteratureNames";
|
||||
|
||||
import { ITutorialEvents } from "./ui/InteractiveTutorial/ITutorialEvents";
|
||||
|
||||
import { clearEventListeners } from "../utils/uiHelpers/clearEventListeners";
|
||||
import { createElement } from "../utils/uiHelpers/createElement";
|
||||
import { createPopup } from "../utils/uiHelpers/createPopup";
|
||||
import { removeElementById } from "../utils/uiHelpers/removeElementById";
|
||||
|
||||
// Ordered array of keys to Interactive Tutorial Steps
|
||||
const orderedITutorialSteps = [
|
||||
"Start",
|
||||
"GoToCharacterPage", // Click on 'Stats' page
|
||||
"CharacterPage", // Introduction to 'Stats' page
|
||||
"CharacterGoToTerminalPage", // Go back to Terminal
|
||||
"TerminalIntro", // Introduction to Terminal
|
||||
"TerminalHelp", // Using 'help' Terminal command
|
||||
"TerminalLs", // Using 'ls' Terminal command
|
||||
"TerminalScan", // Using 'scan' Terminal command
|
||||
"TerminalScanAnalyze1", // Using 'scan-analyze' Terminal command
|
||||
"TerminalScanAnalyze2", // Using 'scan-analyze 3' Terminal command
|
||||
"TerminalConnect", // Connecting to n00dles
|
||||
"TerminalAnalyze", // Analyzing n00dles
|
||||
"TerminalNuke", // NUKE n00dles
|
||||
"TerminalManualHack", // Hack n00dles
|
||||
"TerminalHackingMechanics", // Explanation of hacking mechanics
|
||||
"TerminalGoHome", // Go home before creating a script.
|
||||
"TerminalCreateScript", // Create a script using 'nano'
|
||||
"TerminalTypeScript", // Script Editor page - Type script and then save & close
|
||||
"TerminalFree", // Using 'Free' Terminal command
|
||||
"TerminalRunScript", // Running script using 'run' Terminal command
|
||||
"TerminalGoToActiveScriptsPage",
|
||||
"ActiveScriptsPage",
|
||||
"ActiveScriptsToTerminal",
|
||||
"TerminalTailScript",
|
||||
"GoToHacknetNodesPage",
|
||||
"HacknetNodesIntroduction",
|
||||
"HacknetNodesGoToWorldPage",
|
||||
"WorldDescription",
|
||||
"TutorialPageInfo",
|
||||
"End",
|
||||
];
|
||||
|
||||
// Create an 'enum' for the Steps
|
||||
const iTutorialSteps = {};
|
||||
for (let i = 0; i < orderedITutorialSteps.length; ++i) {
|
||||
iTutorialSteps[orderedITutorialSteps[i]] = i;
|
||||
}
|
||||
|
||||
const ITutorial = {
|
||||
currStep: 0, // iTutorialSteps.Start
|
||||
isRunning: false,
|
||||
|
||||
// Keeps track of whether each step has been done
|
||||
stepIsDone: {},
|
||||
};
|
||||
|
||||
function iTutorialStart() {
|
||||
// Initialize Interactive Tutorial state by settings 'done' for each state to false
|
||||
ITutorial.stepIsDone = {};
|
||||
for (let i = 0; i < orderedITutorialSteps.length; ++i) {
|
||||
ITutorial.stepIsDone[i] = false;
|
||||
}
|
||||
|
||||
// Don't autosave during this interactive tutorial
|
||||
Engine.Counters.autoSaveCounter = Infinity;
|
||||
ITutorial.currStep = 0;
|
||||
ITutorial.isRunning = true;
|
||||
}
|
||||
|
||||
// Go to the next step and evaluate it
|
||||
function iTutorialNextStep() {
|
||||
ITutorial.stepIsDone[ITutorial.currStep] = true;
|
||||
if (ITutorial.currStep < iTutorialSteps.End) {
|
||||
ITutorial.currStep += 1;
|
||||
}
|
||||
if (ITutorial.currStep === iTutorialSteps.End) iTutorialEnd();
|
||||
ITutorialEvents.emit();
|
||||
}
|
||||
|
||||
// Go to previous step and evaluate
|
||||
function iTutorialPrevStep() {
|
||||
if (ITutorial.currStep > iTutorialSteps.Start) {
|
||||
ITutorial.currStep -= 1;
|
||||
}
|
||||
ITutorialEvents.emit();
|
||||
}
|
||||
|
||||
function iTutorialEnd() {
|
||||
ITutorial.isRunning = false;
|
||||
|
||||
// Create a popup with final introductory stuff
|
||||
const popupId = "interactive-tutorial-ending-popup";
|
||||
const txt = createElement("p", {
|
||||
innerHTML:
|
||||
"If you are new to the game, the following links may be useful for you!<br><br>" +
|
||||
"<a class='a-link-button' href='https://bitburner.readthedocs.io/en/latest/guidesandtips/gettingstartedguideforbeginnerprogrammers.html' target='_blank'>Getting Started Guide</a>" +
|
||||
"<a class='a-link-button' href='https://bitburner.readthedocs.io/en/latest/' target='_blank'>Documentation</a><br><br>" +
|
||||
"The Beginner's Guide to Hacking was added to your home computer! It contains some tips/pointers for starting out with the game. " +
|
||||
"To read it, go to Terminal and enter<br><br>cat " +
|
||||
LiteratureNames.HackersStartingHandbook,
|
||||
});
|
||||
const gotitBtn = createElement("a", {
|
||||
class: "a-link-button",
|
||||
float: "right",
|
||||
padding: "6px",
|
||||
innerText: "Got it!",
|
||||
clickListener: () => {
|
||||
removeElementById(popupId);
|
||||
},
|
||||
});
|
||||
createPopup(popupId, [txt, gotitBtn]);
|
||||
|
||||
Player.getHomeComputer().messages.push(LiteratureNames.HackersStartingHandbook);
|
||||
ITutorialEvents.emit();
|
||||
}
|
||||
|
||||
export { iTutorialSteps, iTutorialEnd, iTutorialStart, iTutorialNextStep, ITutorial, iTutorialPrevStep };
|
170
src/InteractiveTutorial.ts
Normal file
170
src/InteractiveTutorial.ts
Normal file
@ -0,0 +1,170 @@
|
||||
import { Player } from "./Player";
|
||||
|
||||
import { LiteratureNames } from "./Literature/data/LiteratureNames";
|
||||
|
||||
import { ITutorialEvents } from "./ui/InteractiveTutorial/ITutorialEvents";
|
||||
|
||||
import { createElement } from "../utils/uiHelpers/createElement";
|
||||
import { createPopup } from "../utils/uiHelpers/createPopup";
|
||||
import { removeElementById } from "../utils/uiHelpers/removeElementById";
|
||||
|
||||
// Ordered array of keys to Interactive Tutorial Steps
|
||||
enum iTutorialSteps {
|
||||
Start,
|
||||
GoToCharacterPage, // Click on 'Stats' page
|
||||
CharacterPage, // Introduction to 'Stats' page
|
||||
CharacterGoToTerminalPage, // Go back to Terminal
|
||||
TerminalIntro, // Introduction to Terminal
|
||||
TerminalHelp, // Using 'help' Terminal command
|
||||
TerminalLs, // Using 'ls' Terminal command
|
||||
TerminalScan, // Using 'scan' Terminal command
|
||||
TerminalScanAnalyze1, // Using 'scan-analyze' Terminal command
|
||||
TerminalScanAnalyze2, // Using 'scan-analyze 3' Terminal command
|
||||
TerminalConnect, // Connecting to n00dles
|
||||
TerminalAnalyze, // Analyzing n00dles
|
||||
TerminalNuke, // NUKE n00dles
|
||||
TerminalManualHack, // Hack n00dles
|
||||
TerminalHackingMechanics, // Explanation of hacking mechanics
|
||||
TerminalGoHome, // Go home before creating a script.
|
||||
TerminalCreateScript, // Create a script using 'nano'
|
||||
TerminalTypeScript, // Script Editor page - Type script and then save & close
|
||||
TerminalFree, // Using 'Free' Terminal command
|
||||
TerminalRunScript, // Running script using 'run' Terminal command
|
||||
TerminalGoToActiveScriptsPage,
|
||||
ActiveScriptsPage,
|
||||
ActiveScriptsToTerminal,
|
||||
TerminalTailScript,
|
||||
GoToHacknetNodesPage,
|
||||
HacknetNodesIntroduction,
|
||||
HacknetNodesGoToWorldPage,
|
||||
WorldDescription,
|
||||
TutorialPageInfo,
|
||||
End,
|
||||
}
|
||||
|
||||
const ITutorial: {
|
||||
currStep: iTutorialSteps;
|
||||
isRunning: boolean;
|
||||
stepIsDone: {
|
||||
[iTutorialSteps.Start]: boolean;
|
||||
[iTutorialSteps.GoToCharacterPage]: boolean;
|
||||
[iTutorialSteps.CharacterPage]: boolean;
|
||||
[iTutorialSteps.CharacterGoToTerminalPage]: boolean;
|
||||
[iTutorialSteps.TerminalIntro]: boolean;
|
||||
[iTutorialSteps.TerminalHelp]: boolean;
|
||||
[iTutorialSteps.TerminalLs]: boolean;
|
||||
[iTutorialSteps.TerminalScan]: boolean;
|
||||
[iTutorialSteps.TerminalScanAnalyze1]: boolean;
|
||||
[iTutorialSteps.TerminalScanAnalyze2]: boolean;
|
||||
[iTutorialSteps.TerminalConnect]: boolean;
|
||||
[iTutorialSteps.TerminalAnalyze]: boolean;
|
||||
[iTutorialSteps.TerminalNuke]: boolean;
|
||||
[iTutorialSteps.TerminalManualHack]: boolean;
|
||||
[iTutorialSteps.TerminalHackingMechanics]: boolean;
|
||||
[iTutorialSteps.TerminalGoHome]: boolean;
|
||||
[iTutorialSteps.TerminalCreateScript]: boolean;
|
||||
[iTutorialSteps.TerminalTypeScript]: boolean;
|
||||
[iTutorialSteps.TerminalFree]: boolean;
|
||||
[iTutorialSteps.TerminalRunScript]: boolean;
|
||||
[iTutorialSteps.TerminalGoToActiveScriptsPage]: boolean;
|
||||
[iTutorialSteps.ActiveScriptsPage]: boolean;
|
||||
[iTutorialSteps.ActiveScriptsToTerminal]: boolean;
|
||||
[iTutorialSteps.TerminalTailScript]: boolean;
|
||||
[iTutorialSteps.GoToHacknetNodesPage]: boolean;
|
||||
[iTutorialSteps.HacknetNodesIntroduction]: boolean;
|
||||
[iTutorialSteps.HacknetNodesGoToWorldPage]: boolean;
|
||||
[iTutorialSteps.WorldDescription]: boolean;
|
||||
[iTutorialSteps.TutorialPageInfo]: boolean;
|
||||
[iTutorialSteps.End]: boolean;
|
||||
};
|
||||
} = {
|
||||
currStep: iTutorialSteps.Start,
|
||||
isRunning: false,
|
||||
|
||||
// Keeps track of whether each step has been done
|
||||
stepIsDone: {
|
||||
[iTutorialSteps.Start]: false,
|
||||
[iTutorialSteps.GoToCharacterPage]: false,
|
||||
[iTutorialSteps.CharacterPage]: false,
|
||||
[iTutorialSteps.CharacterGoToTerminalPage]: false,
|
||||
[iTutorialSteps.TerminalIntro]: false,
|
||||
[iTutorialSteps.TerminalHelp]: false,
|
||||
[iTutorialSteps.TerminalLs]: false,
|
||||
[iTutorialSteps.TerminalScan]: false,
|
||||
[iTutorialSteps.TerminalScanAnalyze1]: false,
|
||||
[iTutorialSteps.TerminalScanAnalyze2]: false,
|
||||
[iTutorialSteps.TerminalConnect]: false,
|
||||
[iTutorialSteps.TerminalAnalyze]: false,
|
||||
[iTutorialSteps.TerminalNuke]: false,
|
||||
[iTutorialSteps.TerminalManualHack]: false,
|
||||
[iTutorialSteps.TerminalHackingMechanics]: false,
|
||||
[iTutorialSteps.TerminalGoHome]: false,
|
||||
[iTutorialSteps.TerminalCreateScript]: false,
|
||||
[iTutorialSteps.TerminalTypeScript]: false,
|
||||
[iTutorialSteps.TerminalFree]: false,
|
||||
[iTutorialSteps.TerminalRunScript]: false,
|
||||
[iTutorialSteps.TerminalGoToActiveScriptsPage]: false,
|
||||
[iTutorialSteps.ActiveScriptsPage]: false,
|
||||
[iTutorialSteps.ActiveScriptsToTerminal]: false,
|
||||
[iTutorialSteps.TerminalTailScript]: false,
|
||||
[iTutorialSteps.GoToHacknetNodesPage]: false,
|
||||
[iTutorialSteps.HacknetNodesIntroduction]: false,
|
||||
[iTutorialSteps.HacknetNodesGoToWorldPage]: false,
|
||||
[iTutorialSteps.WorldDescription]: false,
|
||||
[iTutorialSteps.TutorialPageInfo]: false,
|
||||
[iTutorialSteps.End]: false,
|
||||
},
|
||||
};
|
||||
|
||||
function iTutorialStart(): void {
|
||||
ITutorial.isRunning = true;
|
||||
}
|
||||
|
||||
// Go to the next step and evaluate it
|
||||
function iTutorialNextStep(): void {
|
||||
ITutorial.stepIsDone[ITutorial.currStep] = true;
|
||||
if (ITutorial.currStep < iTutorialSteps.End) {
|
||||
ITutorial.currStep += 1;
|
||||
}
|
||||
if (ITutorial.currStep === iTutorialSteps.End) iTutorialEnd();
|
||||
ITutorialEvents.emit();
|
||||
}
|
||||
|
||||
// Go to previous step and evaluate
|
||||
function iTutorialPrevStep(): void {
|
||||
if (ITutorial.currStep > iTutorialSteps.Start) {
|
||||
ITutorial.currStep -= 1;
|
||||
}
|
||||
ITutorialEvents.emit();
|
||||
}
|
||||
|
||||
function iTutorialEnd(): void {
|
||||
ITutorial.isRunning = false;
|
||||
|
||||
// Create a popup with final introductory stuff
|
||||
const popupId = "interactive-tutorial-ending-popup";
|
||||
const txt = createElement("p", {
|
||||
innerHTML:
|
||||
"If you are new to the game, the following links may be useful for you!<br><br>" +
|
||||
"<a class='a-link-button' href='https://bitburner.readthedocs.io/en/latest/guidesandtips/gettingstartedguideforbeginnerprogrammers.html' target='_blank'>Getting Started Guide</a>" +
|
||||
"<a class='a-link-button' href='https://bitburner.readthedocs.io/en/latest/' target='_blank'>Documentation</a><br><br>" +
|
||||
"The Beginner's Guide to Hacking was added to your home computer! It contains some tips/pointers for starting out with the game. " +
|
||||
"To read it, go to Terminal and enter<br><br>cat " +
|
||||
LiteratureNames.HackersStartingHandbook,
|
||||
});
|
||||
const gotitBtn = createElement("a", {
|
||||
class: "a-link-button",
|
||||
float: "right",
|
||||
padding: "6px",
|
||||
innerText: "Got it!",
|
||||
clickListener: () => {
|
||||
removeElementById(popupId);
|
||||
},
|
||||
});
|
||||
createPopup(popupId, [txt, gotitBtn]);
|
||||
|
||||
Player.getHomeComputer().messages.push(LiteratureNames.HackersStartingHandbook);
|
||||
ITutorialEvents.emit();
|
||||
}
|
||||
|
||||
export { iTutorialSteps, iTutorialEnd, iTutorialStart, iTutorialNextStep, ITutorial, iTutorialPrevStep };
|
@ -18,9 +18,7 @@ import { CasinoLocation } from "./CasinoLocation";
|
||||
|
||||
import { Location } from "../Location";
|
||||
import { LocationType } from "../LocationTypeEnum";
|
||||
import { CityName } from "../data/CityNames";
|
||||
|
||||
import { IRouter } from "../../ui/Router";
|
||||
import { Settings } from "../../Settings/Settings";
|
||||
|
||||
import { SpecialServerIps } from "../../Server/SpecialServerIps";
|
||||
|
@ -17,7 +17,6 @@ import { CreateCorporationPopup } from "../../Corporation/ui/CreateCorporationPo
|
||||
import { createPopup } from "../../ui/React/createPopup";
|
||||
import { LocationName } from "../data/LocationNames";
|
||||
|
||||
import { IPlayer } from "../../PersonObjects/IPlayer";
|
||||
import { use } from "../../ui/Context";
|
||||
|
||||
import { AutoupdatingStdButton } from "../../ui/React/AutoupdatingStdButton";
|
||||
@ -29,14 +28,10 @@ type IProps = {
|
||||
loc: Location;
|
||||
};
|
||||
|
||||
type IState = {
|
||||
inBladeburner: boolean;
|
||||
};
|
||||
|
||||
export function SpecialLocation(props: IProps): React.ReactElement {
|
||||
const player = use.Player();
|
||||
const router = use.Router();
|
||||
const [rerender, setRerender] = useState(false);
|
||||
const setRerender = useState(false)[1];
|
||||
const inBladeburner = player.inBladeburner();
|
||||
/**
|
||||
* Click handler for "Create Corporation" button at Sector-12 City Hall
|
||||
|
@ -9,7 +9,6 @@ import { WorkerScriptStartStopEventEmitter } from "./Netscript/WorkerScriptStart
|
||||
import { generateNextPid } from "./Netscript/Pid";
|
||||
|
||||
import { CONSTANTS } from "./Constants";
|
||||
import { Engine } from "./engine";
|
||||
import { Interpreter } from "./JSInterpreter";
|
||||
import { isScriptErrorMessage, makeRuntimeRejectMsg } from "./NetscriptEvaluator";
|
||||
import { NetscriptFunctions } from "./NetscriptFunctions";
|
||||
|
@ -15,10 +15,7 @@ import { AllServers } from "../Server/AllServers";
|
||||
|
||||
import { removeLeadingSlash, isInRootDirectory, evaluateFilePath } from "./DirectoryHelpers";
|
||||
import { checkIfConnectedToDarkweb } from "../DarkWeb/DarkWeb";
|
||||
import { logBoxCreate } from "../../utils/LogBox";
|
||||
import { iTutorialNextStep, iTutorialSteps, ITutorial } from "../InteractiveTutorial";
|
||||
import { findRunningScript } from "../Script/ScriptHelpers";
|
||||
import { TerminalHelpText } from "./HelpText";
|
||||
import { GetServerByHostname, getServer, getServerOnNetwork } from "../Server/ServerHelpers";
|
||||
import { ParseCommand, ParseCommands } from "./Parser";
|
||||
import { SpecialServerIps, SpecialServerNames } from "../Server/SpecialServerIps";
|
||||
|
3
src/engine.d.ts
vendored
3
src/engine.d.ts
vendored
@ -1,2 +1,3 @@
|
||||
export declare function load(cb: () => void): void;
|
||||
export declare const Engine: any;
|
||||
|
||||
export declare const Engine: IEngine;
|
||||
|
@ -13,8 +13,8 @@ import { Corporation } from "./Corporation/Corporation";
|
||||
import { CONSTANTS } from "./Constants";
|
||||
import { Factions, initFactions } from "./Faction/Factions";
|
||||
import { processPassiveFactionRepGain, inviteToFaction } from "./Faction/FactionHelpers";
|
||||
import { GameRoot, Router } from "./ui/GameRoot";
|
||||
import { TTheme as Theme } from "./ui/React/Theme";
|
||||
import { Router } from "./ui/GameRoot";
|
||||
|
||||
import {
|
||||
getHackingWorkRepGain,
|
||||
getFactionSecurityWorkRepGain,
|
||||
@ -36,7 +36,6 @@ import { Terminal } from "./Terminal";
|
||||
import { Sleeve } from "./PersonObjects/Sleeve/Sleeve";
|
||||
import { Locations } from "./Locations/Locations";
|
||||
import { LocationName } from "./Locations/data/LocationNames";
|
||||
import { LoadingScreen } from "./ui/LoadingScreen";
|
||||
|
||||
import { Money } from "./ui/React/Money";
|
||||
import { Hashes } from "./ui/React/Hashes";
|
||||
@ -49,7 +48,6 @@ import "./Exploits/tampering";
|
||||
import "./Exploits/unclickable";
|
||||
|
||||
import React from "react";
|
||||
import ReactDOM from "react-dom";
|
||||
|
||||
const Engine = {
|
||||
indexedDb: undefined,
|
||||
@ -466,11 +464,4 @@ function load(cb) {
|
||||
|
||||
var indexedDbRequest;
|
||||
|
||||
ReactDOM.render(
|
||||
<Theme>
|
||||
<LoadingScreen />
|
||||
</Theme>,
|
||||
document.getElementById("mainmenu-container"),
|
||||
);
|
||||
|
||||
export { Engine, load };
|
||||
|
13
src/index.tsx
Normal file
13
src/index.tsx
Normal file
@ -0,0 +1,13 @@
|
||||
import React from "react";
|
||||
import ReactDOM from "react-dom";
|
||||
|
||||
import { TTheme as Theme } from "./ui/React/Theme";
|
||||
import { LoadingScreen } from "./ui/LoadingScreen";
|
||||
import "./engineStyle";
|
||||
|
||||
ReactDOM.render(
|
||||
<Theme>
|
||||
<LoadingScreen />
|
||||
</Theme>,
|
||||
document.getElementById("mainmenu-container"),
|
||||
);
|
@ -10,7 +10,6 @@ import { ServerAccordions } from "./ServerAccordions";
|
||||
import { WorkerScript } from "../../Netscript/WorkerScript";
|
||||
|
||||
import Typography from "@mui/material/Typography";
|
||||
import TextField from "@mui/material/TextField";
|
||||
|
||||
type IProps = {
|
||||
workerScripts: Map<number, WorkerScript>;
|
||||
@ -35,7 +34,7 @@ export function ActiveScriptsRoot(props: IProps): React.ReactElement {
|
||||
on which they are running.
|
||||
</Typography>
|
||||
|
||||
<ScriptProduction {...props} />
|
||||
<ScriptProduction />
|
||||
<ServerAccordions {...props} />
|
||||
</>
|
||||
);
|
||||
|
@ -4,13 +4,10 @@
|
||||
*/
|
||||
import * as React from "react";
|
||||
|
||||
import { WorkerScript } from "../../Netscript/WorkerScript";
|
||||
import { Money } from "../React/Money";
|
||||
import { MoneyRate } from "../React/MoneyRate";
|
||||
import { use } from "../Context";
|
||||
|
||||
import Typography from "@mui/material/Typography";
|
||||
import Box from "@mui/material/Box";
|
||||
|
||||
import { Theme } from "@mui/material/styles";
|
||||
import makeStyles from "@mui/styles/makeStyles";
|
||||
@ -18,14 +15,8 @@ import createStyles from "@mui/styles/createStyles";
|
||||
import Table from "@mui/material/Table";
|
||||
import TableBody from "@mui/material/TableBody";
|
||||
import TableCell from "@mui/material/TableCell";
|
||||
import TableContainer from "@mui/material/TableContainer";
|
||||
import TableHead from "@mui/material/TableHead";
|
||||
import TableRow from "@mui/material/TableRow";
|
||||
|
||||
type IProps = {
|
||||
workerScripts: Map<number, WorkerScript>;
|
||||
};
|
||||
|
||||
const useStyles = makeStyles((theme: Theme) =>
|
||||
createStyles({
|
||||
cell: {
|
||||
@ -39,16 +30,11 @@ const useStyles = makeStyles((theme: Theme) =>
|
||||
},
|
||||
}),
|
||||
);
|
||||
export function ScriptProduction(props: IProps): React.ReactElement {
|
||||
export function ScriptProduction(): React.ReactElement {
|
||||
const player = use.Player();
|
||||
const classes = useStyles();
|
||||
const prodRateSinceLastAug = player.scriptProdSinceLastAug / (player.playtimeSinceLastAug / 1000);
|
||||
|
||||
let onlineProduction = 0;
|
||||
for (const ws of props.workerScripts.values()) {
|
||||
onlineProduction += ws.scriptRef.onlineMoneyMade / ws.scriptRef.onlineRunningTime;
|
||||
}
|
||||
|
||||
return (
|
||||
<Table size="small" classes={{ root: classes.size }}>
|
||||
<TableBody>
|
||||
@ -58,7 +44,7 @@ export function ScriptProduction(props: IProps): React.ReactElement {
|
||||
</TableCell>
|
||||
<TableCell align="left" classes={{ root: classes.cell }}>
|
||||
<Typography variant="body2">
|
||||
<Money money={player.scriptProdSinceLastAug} />
|
||||
<MoneyRate money={player.scriptProdSinceLastAug} />
|
||||
</Typography>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
|
@ -1,14 +1,10 @@
|
||||
import React, { useState } from "react";
|
||||
import { WorkerScript } from "../../Netscript/WorkerScript";
|
||||
import { WorkerScriptAccordion } from "./WorkerScriptAccordion";
|
||||
import { AccordionButton } from "../React/AccordionButton";
|
||||
import Paper from "@mui/material/Paper";
|
||||
import List from "@mui/material/List";
|
||||
import TablePagination from "@mui/material/TablePagination";
|
||||
import { TablePaginationActionsAll } from "../React/TablePaginationActionsAll";
|
||||
|
||||
const pageSize = 20;
|
||||
|
||||
interface IProps {
|
||||
workerScripts: WorkerScript[];
|
||||
}
|
||||
@ -16,11 +12,11 @@ interface IProps {
|
||||
export function ServerAccordionContent(props: IProps): React.ReactElement {
|
||||
const [page, setPage] = useState(0);
|
||||
const [rowsPerPage, setRowsPerPage] = useState(10);
|
||||
const handleChangePage = (event: unknown, newPage: number) => {
|
||||
const handleChangePage = (event: unknown, newPage: number): void => {
|
||||
setPage(newPage);
|
||||
};
|
||||
|
||||
const handleChangeRowsPerPage = (event: React.ChangeEvent<HTMLInputElement>) => {
|
||||
const handleChangeRowsPerPage = (event: React.ChangeEvent<HTMLInputElement>): void => {
|
||||
setRowsPerPage(parseInt(event.target.value, 10));
|
||||
setPage(0);
|
||||
};
|
||||
|
@ -7,9 +7,6 @@ import React, { useState, useEffect } from "react";
|
||||
import { ServerAccordion } from "./ServerAccordion";
|
||||
|
||||
import TextField from "@mui/material/TextField";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import Paper from "@mui/material/Paper";
|
||||
import Box from "@mui/material/Box";
|
||||
import List from "@mui/material/List";
|
||||
import TablePagination from "@mui/material/TablePagination";
|
||||
import { WorkerScript } from "../../Netscript/WorkerScript";
|
||||
@ -33,12 +30,6 @@ type IProps = {
|
||||
workerScripts: Map<number, WorkerScript>;
|
||||
};
|
||||
|
||||
type IState = {
|
||||
rerenderFlag: boolean;
|
||||
};
|
||||
|
||||
const subscriberId = "ActiveScriptsUI";
|
||||
|
||||
export function ServerAccordions(props: IProps): React.ReactElement {
|
||||
const [filter, setFilter] = useState("");
|
||||
const [page, setPage] = useState(0);
|
||||
@ -52,11 +43,11 @@ export function ServerAccordions(props: IProps): React.ReactElement {
|
||||
return WorkerScriptStartStopEventEmitter.subscribe(rerender);
|
||||
}, []);
|
||||
|
||||
const handleChangePage = (event: unknown, newPage: number) => {
|
||||
const handleChangePage = (event: unknown, newPage: number): void => {
|
||||
setPage(newPage);
|
||||
};
|
||||
|
||||
const handleChangeRowsPerPage = (event: React.ChangeEvent<HTMLInputElement>) => {
|
||||
const handleChangeRowsPerPage = (event: React.ChangeEvent<HTMLInputElement>): void => {
|
||||
setRowsPerPage(parseInt(event.target.value, 10));
|
||||
setPage(0);
|
||||
};
|
||||
|
@ -14,21 +14,15 @@ import Button from "@mui/material/Button";
|
||||
import Box from "@mui/material/Box";
|
||||
import Paper from "@mui/material/Paper";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import Accordion from "@mui/material/Accordion";
|
||||
import AccordionSummary from "@mui/material/AccordionSummary";
|
||||
import AccordionDetails from "@mui/material/AccordionDetails";
|
||||
import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
|
||||
import { AccordionButton } from "../React/AccordionButton";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import DeleteIcon from "@mui/icons-material/Delete";
|
||||
import ListItemButton from "@mui/material/ListItemButton";
|
||||
import ListItemText from "@mui/material/ListItemText";
|
||||
import makeStyles from "@mui/styles/makeStyles";
|
||||
import createStyles from "@mui/styles/createStyles";
|
||||
|
||||
import Collapse from "@mui/material/Collapse";
|
||||
import ExpandMore from "@mui/icons-material/ExpandMore";
|
||||
import ExpandLess from "@mui/icons-material/ExpandLess";
|
||||
import ExpandMore from "@mui/icons-material/ExpandMore";
|
||||
|
||||
import { killWorkerScript } from "../../Netscript/killWorkerScript";
|
||||
import { WorkerScript } from "../../Netscript/WorkerScript";
|
||||
@ -67,8 +61,6 @@ export function WorkerScriptAccordion(props: IProps): React.ReactElement {
|
||||
// Calculations for script stats
|
||||
const onlineMps = scriptRef.onlineMoneyMade / scriptRef.onlineRunningTime;
|
||||
const onlineEps = scriptRef.onlineExpGained / scriptRef.onlineRunningTime;
|
||||
const offlineMps = scriptRef.offlineMoneyMade / scriptRef.offlineRunningTime;
|
||||
const offlineEps = scriptRef.offlineExpGained / scriptRef.offlineRunningTime;
|
||||
|
||||
return (
|
||||
<>
|
||||
|
@ -1,10 +1,6 @@
|
||||
import React, { useState, useEffect } from "react";
|
||||
|
||||
import { numeralWrapper } from "../ui/numeralFormat";
|
||||
import { BitNodes } from "../BitNode/BitNode";
|
||||
import { IPlayer } from "../PersonObjects/IPlayer";
|
||||
import { MoneySourceTracker } from "../utils/MoneySourceTracker";
|
||||
import { dialogBoxCreate } from "../../utils/DialogBox";
|
||||
import { convertTimeMsToTimeElapsedString } from "../../utils/StringHelperFunctions";
|
||||
import { BitNodeMultipliers } from "../BitNode/BitNodeMultipliers";
|
||||
import { SourceFileFlags } from "../SourceFile/SourceFileFlags";
|
||||
@ -13,6 +9,8 @@ import { HacknetServerConstants } from "../Hacknet/data/Constants";
|
||||
import { StatsTable } from "./React/StatsTable";
|
||||
import { Money } from "./React/Money";
|
||||
import { use } from "./Context";
|
||||
import { MoneySourceTracker } from "../utils/MoneySourceTracker";
|
||||
import { BitNodes } from "../BitNode/BitNode";
|
||||
|
||||
import Typography from "@mui/material/Typography";
|
||||
import Box from "@mui/material/Box";
|
||||
|
@ -1,4 +1,4 @@
|
||||
import React, { useState, useEffect, useRef } from "react";
|
||||
import React, { useState, useEffect } from "react";
|
||||
|
||||
import { IPlayer } from "../PersonObjects/IPlayer";
|
||||
import { IEngine } from "../IEngine";
|
||||
|
@ -7,11 +7,9 @@ import Button from "@mui/material/Button";
|
||||
import ArrowForwardIos from "@mui/icons-material/ArrowForwardIos";
|
||||
import ArrowBackIos from "@mui/icons-material/ArrowBackIos";
|
||||
import { ITutorialEvents } from "./ITutorialEvents";
|
||||
import { use } from "../Context";
|
||||
import { CopyableText } from "../React/CopyableText";
|
||||
|
||||
import ListItem from "@mui/material/ListItem";
|
||||
import TextField from "@mui/material/TextField";
|
||||
import EqualizerIcon from "@mui/icons-material/Equalizer";
|
||||
import LastPageIcon from "@mui/icons-material/LastPage";
|
||||
import HelpIcon from "@mui/icons-material/Help";
|
||||
|
@ -2,10 +2,6 @@ import React, { useState, useEffect } from "react";
|
||||
import CircularProgress from "@mui/material/CircularProgress";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import Grid from "@mui/material/Grid";
|
||||
import Paper from "@mui/material/Paper";
|
||||
import { Theme } from "@mui/material";
|
||||
import makeStyles from "@mui/styles/makeStyles";
|
||||
import createStyles from "@mui/styles/createStyles";
|
||||
|
||||
import { Terminal } from "../Terminal";
|
||||
import { Engine } from "../engine";
|
||||
@ -14,24 +10,47 @@ import { GameRoot } from "./GameRoot";
|
||||
|
||||
import { CONSTANTS } from "../Constants";
|
||||
|
||||
import { load } from "../engine";
|
||||
function load(cb: () => void): void {
|
||||
if (!window.indexedDB) {
|
||||
return Engine.load(""); // Will try to load from localstorage
|
||||
}
|
||||
|
||||
const useStyles = makeStyles((theme: Theme) =>
|
||||
createStyles({
|
||||
center: {
|
||||
position: "fixed",
|
||||
top: "50%",
|
||||
left: "50%",
|
||||
},
|
||||
}),
|
||||
);
|
||||
/**
|
||||
* DB is called bitburnerSave
|
||||
* Object store is called savestring
|
||||
* key for the Object store is called save
|
||||
*/
|
||||
const indexedDbRequest: IDBOpenDBRequest = window.indexedDB.open("bitburnerSave", 1);
|
||||
|
||||
indexedDbRequest.onerror = function (this: IDBRequest<IDBDatabase>, ev: Event) {
|
||||
console.error("Error opening indexedDB: ");
|
||||
console.error(ev);
|
||||
Engine.load(""); // Try to load from localstorage
|
||||
cb();
|
||||
};
|
||||
|
||||
indexedDbRequest.onsuccess = function (this: IDBRequest<IDBDatabase>) {
|
||||
Engine.indexedDb = this.result;
|
||||
const transaction = Engine.indexedDb.transaction(["savestring"]);
|
||||
const objectStore = transaction.objectStore("savestring");
|
||||
const request: IDBRequest<string> = objectStore.get("save");
|
||||
request.onerror = function (this: IDBRequest<string>, ev: Event) {
|
||||
console.error("Error in Database request to get savestring: " + ev);
|
||||
Engine.load(""); // Try to load from localstorage
|
||||
cb();
|
||||
};
|
||||
|
||||
request.onsuccess = function (this: IDBRequest<string>) {
|
||||
Engine.load(this.result);
|
||||
cb();
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
export function LoadingScreen(): React.ReactElement {
|
||||
const classes = useStyles();
|
||||
const [show, setShow] = useState(false);
|
||||
const [loaded, setLoaded] = useState(false);
|
||||
|
||||
console.log("renredering");
|
||||
useEffect(() => {
|
||||
const id = setTimeout(() => {
|
||||
if (!loaded) setShow(true);
|
||||
|
@ -14,16 +14,11 @@ import Box from "@mui/material/Box";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import Button from "@mui/material/Button";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import Collapse from "@mui/material/Collapse";
|
||||
import Fab from "@mui/material/Fab";
|
||||
import VisibilityOffIcon from "@mui/icons-material/VisibilityOff";
|
||||
import SaveIcon from "@mui/icons-material/Save";
|
||||
|
||||
import { colors } from "./Theme";
|
||||
import { Settings } from "../../Settings/Settings";
|
||||
import { use } from "../Context";
|
||||
import { Page } from "../Router";
|
||||
import { Overview } from "./Overview";
|
||||
|
||||
interface IProps {
|
||||
save: () => void;
|
||||
@ -115,7 +110,6 @@ const useStyles = makeStyles({
|
||||
|
||||
export function CharacterOverview({ save }: IProps): React.ReactElement {
|
||||
const player = use.Player();
|
||||
const router = use.Router();
|
||||
|
||||
const setRerender = useState(false)[1];
|
||||
|
||||
|
@ -1,14 +1,6 @@
|
||||
import * as React from "react";
|
||||
import { useTheme } from "@mui/material/styles";
|
||||
import Box from "@mui/material/Box";
|
||||
import Table from "@mui/material/Table";
|
||||
import TableBody from "@mui/material/TableBody";
|
||||
import TableCell from "@mui/material/TableCell";
|
||||
import TableContainer from "@mui/material/TableContainer";
|
||||
import TableFooter from "@mui/material/TableFooter";
|
||||
import TablePagination from "@mui/material/TablePagination";
|
||||
import TableRow from "@mui/material/TableRow";
|
||||
import Paper from "@mui/material/Paper";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import FirstPageIcon from "@mui/icons-material/FirstPage";
|
||||
import KeyboardArrowLeft from "@mui/icons-material/KeyboardArrowLeft";
|
||||
@ -22,23 +14,23 @@ interface TablePaginationActionsProps {
|
||||
onPageChange: (event: React.MouseEvent<HTMLButtonElement>, newPage: number) => void;
|
||||
}
|
||||
|
||||
export function TablePaginationActionsAll(props: TablePaginationActionsProps) {
|
||||
export function TablePaginationActionsAll(props: TablePaginationActionsProps): React.ReactElement {
|
||||
const theme = useTheme();
|
||||
const { count, page, rowsPerPage, onPageChange } = props;
|
||||
|
||||
const handleFirstPageButtonClick = (event: React.MouseEvent<HTMLButtonElement>) => {
|
||||
const handleFirstPageButtonClick = (event: React.MouseEvent<HTMLButtonElement>): void => {
|
||||
onPageChange(event, 0);
|
||||
};
|
||||
|
||||
const handleBackButtonClick = (event: React.MouseEvent<HTMLButtonElement>) => {
|
||||
const handleBackButtonClick = (event: React.MouseEvent<HTMLButtonElement>): void => {
|
||||
onPageChange(event, page - 1);
|
||||
};
|
||||
|
||||
const handleNextButtonClick = (event: React.MouseEvent<HTMLButtonElement>) => {
|
||||
const handleNextButtonClick = (event: React.MouseEvent<HTMLButtonElement>): void => {
|
||||
onPageChange(event, page + 1);
|
||||
};
|
||||
|
||||
const handleLastPageButtonClick = (event: React.MouseEvent<HTMLButtonElement>) => {
|
||||
const handleLastPageButtonClick = (event: React.MouseEvent<HTMLButtonElement>): void => {
|
||||
onPageChange(event, Math.max(0, Math.ceil(count / rowsPerPage) - 1));
|
||||
};
|
||||
|
||||
|
@ -12,9 +12,7 @@ module.exports = (env, argv) => {
|
||||
const runInContainer = (env || {}).runInContainer === true;
|
||||
const isDevelopment = argv.mode === "development";
|
||||
const outputDirectory = isDevServer ? "dist-dev" : "dist";
|
||||
const entries = {};
|
||||
entries[`${outputDirectory}/engine`] = "./src/engine.jsx";
|
||||
entries[`${outputDirectory}/engineStyle`] = "./src/engineStyle.js";
|
||||
const entry = "./src/index.tsx";
|
||||
|
||||
const statsConfig = {
|
||||
builtAt: true,
|
||||
@ -134,7 +132,7 @@ module.exports = (env, argv) => {
|
||||
isDevelopment && new ReactRefreshWebpackPlugin(),
|
||||
].filter(Boolean),
|
||||
target: "web",
|
||||
entry: entries,
|
||||
entry: entry,
|
||||
output: {
|
||||
path: path.resolve(__dirname, "./"),
|
||||
filename: "[name].bundle.js",
|
||||
|
Loading…
Reference in New Issue
Block a user