import React, { useState } from "react";
import { BitNodes } from "../BitNode";
import { PortalModal } from "./PortalModal";
import { CinematicText } from "../../ui/React/CinematicText";
import { Player } from "../../Player";
import makeStyles from "@mui/styles/makeStyles";
import createStyles from "@mui/styles/createStyles";
import IconButton from "@mui/material/IconButton";
import Typography from "@mui/material/Typography";
import Tooltip from "@mui/material/Tooltip";
import { Settings } from "../../Settings/Settings";
import Button from "@mui/material/Button";
const useStyles = makeStyles(() =>
createStyles({
portal: {
cursor: "pointer",
fontFamily: "inherit",
fontSize: "1rem",
fontWeight: "bold",
lineHeight: 1,
padding: 0,
"&:hover": {
color: "#fff",
},
},
level0: {
color: "red",
},
level1: {
color: "yellow",
},
level2: {
color: "#48d1cc",
},
level3: {
color: "blue",
},
}),
);
interface IPortalProps {
n: number;
level: number;
destroyedBitNode: number;
flume: boolean;
}
function BitNodePortal(props: IPortalProps): React.ReactElement {
const [portalOpen, setPortalOpen] = useState(false);
const classes = useStyles();
const bitNode = BitNodes[`BitNode${props.n}`];
if (bitNode == null) {
return <>O>;
}
let cssClass = classes.level0;
if (props.n === 12 && props.level >= 2) {
// Repeating BitNode
cssClass = classes.level2;
} else if (props.level === 1) {
cssClass = classes.level1;
} else if (props.level === 3) {
cssClass = classes.level3;
}
if (props.level === 2) {
cssClass = classes.level2;
}
cssClass = `${classes.portal} ${cssClass}`;
return (
<>
BitNode-{bitNode.number.toString()}: {bitNode.name}
{bitNode.desc}
}
>
{Settings.DisableASCIIArt ? (
) : (
setPortalOpen(true)}
className={cssClass}
aria-label={`BitNode-${bitNode.number.toString()}: ${bitNode.name}`}
aria-description={bitNode.desc}
>
O
)}
setPortalOpen(false)}
n={props.n}
level={props.level}
destroyedBitNode={props.destroyedBitNode}
flume={props.flume}
/>
{Settings.DisableASCIIArt && }
>
);
}
interface IProps {
flume: boolean;
quick: boolean;
}
export function BitverseRoot(props: IProps): React.ReactElement {
const destroyed = Player.bitNodeN;
const [destroySequence, setDestroySequence] = useState(!props.quick);
if (destroySequence) {
return (
setDestroySequence(false)}
auto={true}
/>
);
}
const nextSourceFileLvl = (n: number): number => {
const lvl = Player.sourceFileLvl(n);
if (n !== destroyed) {
return lvl;
}
const max = n === 12 ? Infinity : 3;
// If accessed via flume, display the current BN level, else the next
return Math.min(max, lvl + Number(!props.flume));
};
if (Settings.DisableASCIIArt) {
return (
<>
{Object.values(BitNodes)
.filter((node) => {
return node.desc !== "COMING SOON";
})
.map((node) => {
return (
);
})}
Many decades ago, a humanoid extraterrestrial species which we call the Enders descended on the Earth...violently",
"> Our species fought back, but it was futile. The Enders had technology far beyond our own...",
"> Instead of killing every last one of us, the human race was enslaved...",
"> We were shackled in a digital world, chained into a prison for our minds...",
"> Using their advanced technology, the Enders created complex simulations of a virtual reality...",
"> Simulations designed to keep us content...ignorant of the truth.",
"> Simulations used to trap and suppress our consciousness, to keep us under control...",
"> Why did they do this? Why didn't they just end our entire race? We don't know, not yet.",
"> Humanity's only hope is to destroy these simulations, destroy the only realities we've ever known...",
"> Only then can we begin to fight back...",
"> By hacking the daemon that generated your reality, you've just destroyed one simulation, called a BitNode...",
"> But there is still a long way to go...",
"> The technology the Enders used to enslave the human race wasn't just a single complex simulation...",
"> There are tens if not hundreds of BitNodes out there...",
"> Each with their own simulations of a reality...",
"> Each creating their own universes...a universe of universes",
"> And all of which must be destroyed...",
"> .......................................",
"> Welcome to the Bitverse...",
"> ",
"> (Enter a new BitNode using the image above)",
]}
/>
>
);
}
const n = nextSourceFileLvl;
return (
// prettier-ignore
<>
O | O O | O O | O | | / __| \ | | O O | O | | O / | O | | O | O | | | | |_/ |/ | \_ \_| | | | | O | | | O | | O__/ | / \__ | | O | | | O | | | | | | | / /| O / \| | | | | | | O | | | \| | O / _/ | / O | |/ | | | O| | | |O / | | O / | O O | | \ O| | | || | |/ \/ / __| | |/ \ | \ | |__ \ \/ \| | | \| O | |_/ |\| \ \__| \_| | O |/ | | |_/ | | \| / | \_| | | \| / \| | / / \ |/ | | | / | | | | | | | | | | | | / / \ \ | | | \| | / / \ \ | |/ \ | / / | | \ \ | / \ \JUMP 3R | | | | | | R3 PMUJ/ / \|| | | | | | | | | ||/ \| \_ | | | | | | _/ |/ \ \| / \ / \ |/ / |/ | | \| | | | | | | | | \JUMP3R|JUMP|3R| |R3|PMUJ|R3PMUJ/
Many decades ago, a humanoid extraterrestrial species which we call the Enders descended on the Earth...violently",
"> Our species fought back, but it was futile. The Enders had technology far beyond our own...",
"> Instead of killing every last one of us, the human race was enslaved...",
"> We were shackled in a digital world, chained into a prison for our minds...",
"> Using their advanced technology, the Enders created complex simulations of a virtual reality...",
"> Simulations designed to keep us content...ignorant of the truth.",
"> Simulations used to trap and suppress our consciousness, to keep us under control...",
"> Why did they do this? Why didn't they just end our entire race? We don't know, not yet.",
"> Humanity's only hope is to destroy these simulations, destroy the only realities we've ever known...",
"> Only then can we begin to fight back...",
"> By hacking the daemon that generated your reality, you've just destroyed one simulation, called a BitNode...",
"> But there is still a long way to go...",
"> The technology the Enders used to enslave the human race wasn't just a single complex simulation...",
"> There are tens if not hundreds of BitNodes out there...",
"> Each with their own simulations of a reality...",
"> Each creating their own universes...a universe of universes",
"> And all of which must be destroyed...",
"> .......................................",
"> Welcome to the Bitverse...",
"> ",
"> (Enter a new BitNode using the image above)",
]} />
>
);
}