Merge branch 'dev' into bugfix/2958

This commit is contained in:
Jack 2022-03-15 20:34:08 +08:00 committed by GitHub
commit 41974b042c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 188 additions and 167 deletions

34
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

@ -335,7 +335,7 @@ Then to kill this script the same arguments would have to be used::
$ kill foo.script 50e3 sigma-cosmetics
If you are killing the script using its PID, then the PID argument must be numeric.
If you are killing the script using its PID, then the PID argument must be numeric.
killall
^^^^^^^
@ -542,28 +542,6 @@ Then in order to check its logs with 'tail' the same arguments must be used::
$ tail foo.script 10 50000
theme
^^^^^
$ theme [preset] | [#background #text #highlight]
Change the color of the game's user interface
This command can be called with a preset theme. Currently, the supported presets are:
* default
* muted
* solarized
However, you can also specify your own color scheme using hex values.
To do so, you must specify three hex color values for the background
color, the text color, and the highlight color. These hex values must
be preceded by a pound sign (#) and must be either 3 or 6 digits. Example::
$ theme #ffffff #385 #235012
A color picker such as Google's can be used to get your desired hex color values
top
^^^

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -0,0 +1,43 @@
import React, { useState } from "react";
import { BBCabinetRoot } from "./BBCabinet";
import Button from "@mui/material/Button";
import { use } from "../../ui/Context";
import { AlertEvents } from "../../ui/React/AlertManager";
enum Page {
None,
Megabyteburner2000,
}
export function ArcadeRoot(): React.ReactElement {
const player = use.Player();
const [page, setPage] = useState(Page.None);
function mbBurner2000(): void {
if (player.sourceFileLvl(1) === 0) {
AlertEvents.emit("This machine is broken.");
} else {
setPage(Page.Megabyteburner2000);
}
}
if (page === Page.None) {
return (
<>
<Button onClick={mbBurner2000}>Megabyte burner 2000</Button>
</>
);
}
let currentGame = <></>;
switch (page) {
case Page.Megabyteburner2000:
currentGame = <BBCabinetRoot />;
}
return (
<>
<Button onClick={() => setPage(Page.None)}>Back</Button>
{currentGame}
</>
);
}

@ -0,0 +1,52 @@
import React from "react";
import Typography from "@mui/material/Typography";
const metaBB = "https://bitburner-official.github.io/bitburner-legacy/";
const style = {
width: "1060px",
height: "800px",
border: "0px",
} as any;
export function BBCabinetRoot(): React.ReactElement {
// prettier-ignore
const joystick =
<>
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}> </Typography>
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}> ,'" "', .-. </Typography>
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}> / \ ( ) </Typography>
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}> | | .-. '-' .-. </Typography>
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}> \ / ( ) ( )</Typography>
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}> '.___.' '-' .-. '-'</Typography>
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}> ||| ( ) </Typography>
<Typography sx={{lineHeight: '1em',whiteSpace: 'pre'}}> ||| '-' </Typography>
</>;
return (
<>
<div
style={{
width: "1060px",
height: "800px",
padding: "0",
overflow: "hidden",
borderColor: "white",
borderStyle: "solid",
borderWidth: "5px",
}}
>
<iframe src={metaBB} style={style} />
</div>
<div
style={{
width: "1060px",
borderColor: "white",
borderStyle: "solid",
borderWidth: "5px",
}}
>
{joystick}
</div>
</>
);
}

@ -1703,7 +1703,7 @@ function initAugmentations(): void {
"The left arm of a legendary BitRunner who ascended beyond this world. " +
"It projects a light blue energy shield that protects the exposed inner parts. " +
"Even though it contains no weapons, the advanced tungsten titanium " +
"alloy increases the users strength to unbelievable levels. The augmentation " +
"alloy increases the user's strength to unbelievable levels. The augmentation " +
"gets more powerful over time for seemingly no reason.",
strength_mult: 2.7,
});

@ -273,7 +273,7 @@ export function EquipmentsSubpage(): React.ReactElement {
sx={{ m: 1, width: '15%' }}
/>
<Box display="grid" sx={{ gridTemplateColumns: '1fr 1fr', width: 'fit-content' }}>
<Box display="grid" sx={{ gridTemplateColumns: '1fr 1fr', width: '100%' }}>
{members.map((member: GangMember) => (
<GangMemberUpgradePanel key={member.name} member={member} />
))}

@ -127,10 +127,10 @@ Cities[CityName.NewTokyo].asciiArt = `
o
\\
\\ [defcomm]
[arcade] E [defcomm]
\\
o--x---A--x--o [travel agency]
7 8 10 G
7 8 10 H
[vitalife] o 12 [global pharmaceuticals]
|
o--D-x----x-------x-C-+--------x--x-B-x---x-o
@ -141,14 +141,14 @@ Cities[CityName.NewTokyo].asciiArt = `
\\
[hospital] o 15 [world stock exchange]
|
o--x--E--x-----x-----x---+---x----x--H--x-o
o--x--F--x-----x-----x---+---x----x--I--x-o
|
|
o 17
F [the slums]
G [the slums]
`;
Cities[CityName.Sector12].asciiArt = `
78 o 97

@ -54,6 +54,7 @@ export enum LocationName {
NewTokyoGlobalPharmaceuticals = "Global Pharmaceuticals",
NewTokyoNoodleBar = "Noodle Bar",
NewTokyoVitaLife = "VitaLife",
NewTokyoArcade = "Arcade",
// Ishima
IshimaNovaMedical = "Nova Medical",

@ -215,6 +215,11 @@ export const LocationsMetadata: IConstructorParams[] = [
name: LocationName.NewTokyoVitaLife,
types: [LocationType.Company, LocationType.Special],
},
{
city: CityName.NewTokyo,
name: LocationName.NewTokyoArcade,
types: [LocationType.Special],
},
{
city: CityName.Sector12,
infiltrationData: {

@ -34,10 +34,9 @@ const useStyles = makeStyles((theme: Theme) =>
padding: "0px",
cursor: "pointer",
},
})
}),
);
function toLocation(router: IRouter, location: Location): void {
if (location.name === LocationName.TravelAgency) {
router.toTravel();
@ -132,12 +131,14 @@ function ASCIICity(props: IProps): React.ReactElement {
const elems: JSX.Element[] = [];
const lines = props.city.asciiArt.split("\n");
let i = 0;
for (const line of lines) {
elems.push(
<Typography key={line} sx={{ lineHeight: "1em", whiteSpace: "pre" }}>
<Typography key={i} sx={{ lineHeight: "1em", whiteSpace: "pre" }}>
{lineElems(line)}
</Typography>,
);
i++;
}
return <>{elems}</>;

@ -32,6 +32,7 @@ import { CorruptableText } from "../../ui/React/CorruptableText";
import { HacknetNode } from "../../Hacknet/HacknetNode";
import { HacknetServer } from "../../Hacknet/HacknetServer";
import { GetServer } from "../../Server/AllServers";
import { ArcadeRoot } from "../../Arcade/ui/ArcadeRoot";
type IProps = {
loc: Location;
@ -81,7 +82,12 @@ export function SpecialLocation(props: IProps): React.ReactElement {
return <></>;
}
const text = inBladeburner ? "Enter Bladeburner Headquarters" : "Apply to Bladeburner Division";
return <><br/><Button onClick={handleBladeburner}>{text}</Button></>;
return (
<>
<br />
<Button onClick={handleBladeburner}>{text}</Button>
</>
);
}
function renderNoodleBar(): React.ReactElement {
@ -311,6 +317,9 @@ export function SpecialLocation(props: IProps): React.ReactElement {
case LocationName.IshimaGlitch: {
return renderGlitch();
}
case LocationName.NewTokyoArcade: {
return <ArcadeRoot />;
}
default:
console.error(`Location ${props.loc.name} doesn't have any special properties`);
return <></>;

@ -232,7 +232,7 @@ export function Root(props: IProps): React.ReactElement {
MonacoVim.VimMode.Vim.mapCommand("gT", "action", "prevTabs", {}, { context: "normal" });
editor.focus();
});
} catch {}
} catch { }
} else if (!options.vim) {
// Whem vim mode is disabled
vimEditor?.dispose();
@ -478,7 +478,7 @@ export function Root(props: IProps): React.ReactElement {
}
try {
infLoop(newCode);
} catch (err) {}
} catch (err) { }
}
function saveScript(scriptToSave: OpenScript): void {
@ -877,6 +877,7 @@ export function Root(props: IProps): React.ReactElement {
}}
style={{
maxWidth: `${tabTextWidth}px`,
minHeight: '38.5px',
overflow: "hidden",
...colorProps,
}}

@ -110,107 +110,45 @@ const useStyles = makeStyles((theme: Theme) =>
}),
);
const uninitialized = (): any => {
throw new Error("Router called before initialization");
};
export let Router: IRouter = {
isInitialized: false,
page: () => {
throw new Error("Router called before initialization");
},
allowRouting: () => {
throw new Error("Router called before initialization");
},
toActiveScripts: () => {
throw new Error("Router called before initialization");
},
toAugmentations: () => {
throw new Error("Router called before initialization");
},
toBitVerse: () => {
throw new Error("Router called before initialization");
},
toBladeburner: () => {
throw new Error("Router called before initialization");
},
toStats: () => {
throw new Error("Router called before initialization");
},
toCity: () => {
throw new Error("Router called before initialization");
},
toCorporation: () => {
throw new Error("Router called before initialization");
},
toCreateProgram: () => {
throw new Error("Router called before initialization");
},
toDevMenu: () => {
throw new Error("Router called before initialization");
},
toFaction: () => {
throw new Error("Router called before initialization");
},
toFactions: () => {
throw new Error("Router called before initialization");
},
toGameOptions: () => {
throw new Error("Router called before initialization");
},
toGang: () => {
throw new Error("Router called before initialization");
},
toHacknetNodes: () => {
throw new Error("Router called before initialization");
},
toInfiltration: () => {
throw new Error("Router called before initialization");
},
toJob: () => {
throw new Error("Router called before initialization");
},
toMilestones: () => {
throw new Error("Router called before initialization");
},
toResleeves: () => {
throw new Error("Router called before initialization");
},
toScriptEditor: () => {
throw new Error("Router called before initialization");
},
toSleeves: () => {
throw new Error("Router called before initialization");
},
toStockMarket: () => {
throw new Error("Router called before initialization");
},
toTerminal: () => {
throw new Error("Router called before initialization");
},
toTravel: () => {
throw new Error("Router called before initialization");
},
toTutorial: () => {
throw new Error("Router called before initialization");
},
toWork: () => {
throw new Error("Router called before initialization");
},
toBladeburnerCinematic: () => {
throw new Error("Router called before initialization");
},
toLocation: () => {
throw new Error("Router called before initialization");
},
toStaneksGift: () => {
throw new Error("Router called before initialization");
},
toAchievements: () => {
throw new Error("Router called before initialization");
},
toThemeBrowser: () => {
throw new Error("Router called before initialization");
},
toImportSave: () => {
throw new Error("Router called before initialization");
},
page: uninitialized,
allowRouting: uninitialized,
toActiveScripts: uninitialized,
toAugmentations: uninitialized,
toBitVerse: uninitialized,
toBladeburner: uninitialized,
toStats: uninitialized,
toCity: uninitialized,
toCorporation: uninitialized,
toCreateProgram: uninitialized,
toDevMenu: uninitialized,
toFaction: uninitialized,
toFactions: uninitialized,
toGameOptions: uninitialized,
toGang: uninitialized,
toHacknetNodes: uninitialized,
toInfiltration: uninitialized,
toJob: uninitialized,
toMilestones: uninitialized,
toResleeves: uninitialized,
toScriptEditor: uninitialized,
toSleeves: uninitialized,
toStockMarket: uninitialized,
toTerminal: uninitialized,
toTravel: uninitialized,
toTutorial: uninitialized,
toWork: uninitialized,
toBladeburnerCinematic: uninitialized,
toLocation: uninitialized,
toStaneksGift: uninitialized,
toAchievements: uninitialized,
toThemeBrowser: uninitialized,
toImportSave: uninitialized,
};
function determineStartPage(player: IPlayer): Page {
@ -346,12 +284,11 @@ export function GameRoot({ player, engine, terminal }: IProps): React.ReactEleme
},
};
useEffect(() => {
// Wrap Router navigate functions to be able to disable the execution
_functions(Router).
filter((fnName) => fnName.startsWith('to')).
forEach((fnName) => {
_functions(Router)
.filter((fnName) => fnName.startsWith("to"))
.forEach((fnName) => {
// @ts-ignore - tslint does not like this, couldn't find a way to make it cooperate
Router[fnName] = _wrap(Router[fnName], (func, ...args) => {
if (!allowRoutingCalls) {
@ -360,7 +297,7 @@ export function GameRoot({ player, engine, terminal }: IProps): React.ReactEleme
return;
}
// Call the function normally
// Call the function normally
return func(...args);
});
});
@ -568,13 +505,7 @@ export function GameRoot({ player, engine, terminal }: IProps): React.ReactEleme
break;
}
case Page.ImportSave: {
mainPage = (
<ImportSaveRoot
importString={importString}
automatic={importAutomatic}
router={Router}
/>
);
mainPage = <ImportSaveRoot importString={importString} automatic={importAutomatic} router={Router} />;
withSidebar = false;
withPopups = false;
bypassGame = true;