mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-30 19:43:49 +01:00
commit
1762277540
26
dist/vendor.bundle.js
vendored
26
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
@ -4,6 +4,7 @@
|
|||||||
* Displays general information about Hacknet Nodes
|
* Displays general information about Hacknet Nodes
|
||||||
*/
|
*/
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
import Typography from "@mui/material/Typography";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
hasHacknetServers: boolean;
|
hasHacknetServers: boolean;
|
||||||
@ -11,40 +12,40 @@ interface IProps {
|
|||||||
|
|
||||||
export function GeneralInfo(props: IProps): React.ReactElement {
|
export function GeneralInfo(props: IProps): React.ReactElement {
|
||||||
return (
|
return (
|
||||||
<div>
|
<>
|
||||||
<p className={"hacknet-general-info"}>
|
<Typography>
|
||||||
The Hacknet is a global, decentralized network of machines. It is used by hackers all around the world to
|
The Hacknet is a global, decentralized network of machines. It is used by hackers all around the world to
|
||||||
anonymously share computing power and perform distributed cyberattacks without the fear of being traced.
|
anonymously share computing power and perform distributed cyberattacks without the fear of being traced.
|
||||||
</p>
|
</Typography>
|
||||||
{!props.hasHacknetServers ? (
|
{!props.hasHacknetServers ? (
|
||||||
<>
|
<>
|
||||||
<p className={"hacknet-general-info"}>
|
<Typography>
|
||||||
{`Here, you can purchase a Hacknet Node, a specialized machine that can connect ` +
|
{`Here, you can purchase a Hacknet Node, a specialized machine that can connect ` +
|
||||||
`and contribute its resources to the Hacknet network. This allows you to take ` +
|
`and contribute its resources to the Hacknet network. This allows you to take ` +
|
||||||
`a small percentage of profits from hacks performed on the network. Essentially, ` +
|
`a small percentage of profits from hacks performed on the network. Essentially, ` +
|
||||||
`you are renting out your Node's computing power.`}
|
`you are renting out your Node's computing power.`}
|
||||||
</p>
|
</Typography>
|
||||||
<p className={"hacknet-general-info"}>
|
<Typography>
|
||||||
{`Each Hacknet Node you purchase will passively earn you money. Each Hacknet Node ` +
|
{`Each Hacknet Node you purchase will passively earn you money. Each Hacknet Node ` +
|
||||||
`can be upgraded in order to increase its computing power and thereby increase ` +
|
`can be upgraded in order to increase its computing power and thereby increase ` +
|
||||||
`the profit you earn from it.`}
|
`the profit you earn from it.`}
|
||||||
</p>
|
</Typography>
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<p className={"hacknet-general-info"}>
|
<Typography>
|
||||||
{`Here, you can purchase a Hacknet Server, an upgraded version of the Hacknet Node. ` +
|
{`Here, you can purchase a Hacknet Server, an upgraded version of the Hacknet Node. ` +
|
||||||
`Hacknet Servers will perform computations and operations on the network, earning ` +
|
`Hacknet Servers will perform computations and operations on the network, earning ` +
|
||||||
`you hashes. Hashes can be spent on a variety of different upgrades.`}
|
`you hashes. Hashes can be spent on a variety of different upgrades.`}
|
||||||
</p>
|
</Typography>
|
||||||
<p className={"hacknet-general-info"}>
|
<Typography>
|
||||||
{`Hacknet Servers can also be used as servers to run scripts. However, running scripts ` +
|
{`Hacknet Servers can also be used as servers to run scripts. However, running scripts ` +
|
||||||
`on a server will reduce its hash rate (hashes generated per second). A Hacknet Server's hash ` +
|
`on a server will reduce its hash rate (hashes generated per second). A Hacknet Server's hash ` +
|
||||||
`rate will be reduced by the percentage of RAM that is being used by that Server to run ` +
|
`rate will be reduced by the percentage of RAM that is being used by that Server to run ` +
|
||||||
`scripts.`}
|
`scripts.`}
|
||||||
</p>
|
</Typography>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</div>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,10 @@ import { Server } from "../../Server/Server";
|
|||||||
|
|
||||||
import { createPopup } from "../../ui/React/createPopup";
|
import { createPopup } from "../../ui/React/createPopup";
|
||||||
|
|
||||||
|
import Typography from "@mui/material/Typography";
|
||||||
|
import Grid from "@mui/material/Grid";
|
||||||
|
import Button from "@mui/material/Button";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
player: IPlayer;
|
player: IPlayer;
|
||||||
}
|
}
|
||||||
@ -122,24 +126,25 @@ export function HacknetRoot(props: IProps): React.ReactElement {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<h1>Hacknet {hasHacknetServers(props.player) ? "Servers" : "Nodes"}</h1>
|
<Typography variant="h4">Hacknet {hasHacknetServers(props.player) ? "Servers" : "Nodes"}</Typography>
|
||||||
<GeneralInfo hasHacknetServers={hasHacknetServers(props.player)} />
|
<GeneralInfo hasHacknetServers={hasHacknetServers(props.player)} />
|
||||||
|
|
||||||
<PurchaseButton cost={purchaseCost} multiplier={purchaseMultiplier} onClick={handlePurchaseButtonClick} />
|
<PurchaseButton cost={purchaseCost} multiplier={purchaseMultiplier} onClick={handlePurchaseButtonClick} />
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
<div id={"hacknet-nodes-money-multipliers-div"}>
|
|
||||||
<PlayerInfo totalProduction={totalProduction} player={props.player} />
|
|
||||||
<MultiplierButtons onClicks={purchaseMultiplierOnClicks} purchaseMultiplier={purchaseMultiplier} />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{hasHacknetServers(props.player) && (
|
<Grid container spacing={2}>
|
||||||
<button className={"std-button"} onClick={createHashUpgradesPopup} style={{ display: "block" }}>
|
<Grid item xs={6}>
|
||||||
{"Spend Hashes on Upgrades"}
|
<PlayerInfo totalProduction={totalProduction} player={props.player} />
|
||||||
</button>
|
</Grid>
|
||||||
)}
|
<Grid item xs={6}>
|
||||||
|
<MultiplierButtons onClicks={purchaseMultiplierOnClicks} purchaseMultiplier={purchaseMultiplier} />
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
<ul id={"hacknet-nodes-list"}>{nodes}</ul>
|
{hasHacknetServers(props.player) && <Button onClick={createHashUpgradesPopup}>Spend Hashes on Upgrades</Button>}
|
||||||
|
|
||||||
|
<Grid container>{nodes}</Grid>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,14 @@ import { HacknetServer } from "../HacknetServer";
|
|||||||
import { Money } from "../../ui/React/Money";
|
import { Money } from "../../ui/React/Money";
|
||||||
import { Hashes } from "../../ui/React/Hashes";
|
import { Hashes } from "../../ui/React/Hashes";
|
||||||
import { HashRate } from "../../ui/React/HashRate";
|
import { HashRate } from "../../ui/React/HashRate";
|
||||||
|
import Typography from "@mui/material/Typography";
|
||||||
|
import Grid from "@mui/material/Grid";
|
||||||
|
import Paper from "@mui/material/Paper";
|
||||||
|
import Button from "@mui/material/Button";
|
||||||
|
import { TableCell } from "../../ui/React/Table";
|
||||||
|
import TableBody from "@mui/material/TableBody";
|
||||||
|
import Table from "@mui/material/Table";
|
||||||
|
import TableRow from "@mui/material/TableRow";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
node: HacknetServer;
|
node: HacknetServer;
|
||||||
@ -37,10 +45,9 @@ export function HacknetServerElem(props: IProps): React.ReactElement {
|
|||||||
const rerender = props.rerender;
|
const rerender = props.rerender;
|
||||||
|
|
||||||
// Upgrade Level Button
|
// Upgrade Level Button
|
||||||
let upgradeLevelContent, upgradeLevelClass;
|
let upgradeLevelContent;
|
||||||
if (node.level >= HacknetServerConstants.MaxLevel) {
|
if (node.level >= HacknetServerConstants.MaxLevel) {
|
||||||
upgradeLevelContent = <>MAX LEVEL</>;
|
upgradeLevelContent = <>MAX LEVEL</>;
|
||||||
upgradeLevelClass = "std-button-disabled";
|
|
||||||
} else {
|
} else {
|
||||||
let multiplier = 0;
|
let multiplier = 0;
|
||||||
if (purchaseMult === "MAX") {
|
if (purchaseMult === "MAX") {
|
||||||
@ -53,14 +60,10 @@ export function HacknetServerElem(props: IProps): React.ReactElement {
|
|||||||
const upgradeLevelCost = node.calculateLevelUpgradeCost(multiplier, props.player.hacknet_node_level_cost_mult);
|
const upgradeLevelCost = node.calculateLevelUpgradeCost(multiplier, props.player.hacknet_node_level_cost_mult);
|
||||||
upgradeLevelContent = (
|
upgradeLevelContent = (
|
||||||
<>
|
<>
|
||||||
Upgrade x{multiplier} - <Money money={upgradeLevelCost} player={props.player} />
|
+{multiplier} -
|
||||||
|
<Money money={upgradeLevelCost} player={props.player} />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
if (props.player.money.lt(upgradeLevelCost)) {
|
|
||||||
upgradeLevelClass = "std-button-disabled";
|
|
||||||
} else {
|
|
||||||
upgradeLevelClass = "std-button";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
function upgradeLevelOnClick(): void {
|
function upgradeLevelOnClick(): void {
|
||||||
let numUpgrades = purchaseMult;
|
let numUpgrades = purchaseMult;
|
||||||
@ -72,10 +75,9 @@ export function HacknetServerElem(props: IProps): React.ReactElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Upgrade RAM Button
|
// Upgrade RAM Button
|
||||||
let upgradeRamContent, upgradeRamClass;
|
let upgradeRamContent;
|
||||||
if (node.maxRam >= HacknetServerConstants.MaxRam) {
|
if (node.maxRam >= HacknetServerConstants.MaxRam) {
|
||||||
upgradeRamContent = <>MAX RAM</>;
|
upgradeRamContent = <>MAX RAM</>;
|
||||||
upgradeRamClass = "std-button-disabled";
|
|
||||||
} else {
|
} else {
|
||||||
let multiplier = 0;
|
let multiplier = 0;
|
||||||
if (purchaseMult === "MAX") {
|
if (purchaseMult === "MAX") {
|
||||||
@ -88,14 +90,10 @@ export function HacknetServerElem(props: IProps): React.ReactElement {
|
|||||||
const upgradeRamCost = node.calculateRamUpgradeCost(multiplier, props.player.hacknet_node_ram_cost_mult);
|
const upgradeRamCost = node.calculateRamUpgradeCost(multiplier, props.player.hacknet_node_ram_cost_mult);
|
||||||
upgradeRamContent = (
|
upgradeRamContent = (
|
||||||
<>
|
<>
|
||||||
Upgrade x{multiplier} - <Money money={upgradeRamCost} player={props.player} />
|
+{multiplier} -
|
||||||
|
<Money money={upgradeRamCost} player={props.player} />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
if (props.player.money.lt(upgradeRamCost)) {
|
|
||||||
upgradeRamClass = "std-button-disabled";
|
|
||||||
} else {
|
|
||||||
upgradeRamClass = "std-button";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
function upgradeRamOnClick(): void {
|
function upgradeRamOnClick(): void {
|
||||||
let numUpgrades = purchaseMult;
|
let numUpgrades = purchaseMult;
|
||||||
@ -107,10 +105,9 @@ export function HacknetServerElem(props: IProps): React.ReactElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Upgrade Cores Button
|
// Upgrade Cores Button
|
||||||
let upgradeCoresContent, upgradeCoresClass;
|
let upgradeCoresContent;
|
||||||
if (node.cores >= HacknetServerConstants.MaxCores) {
|
if (node.cores >= HacknetServerConstants.MaxCores) {
|
||||||
upgradeCoresContent = <>MAX CORES</>;
|
upgradeCoresContent = <>MAX CORES</>;
|
||||||
upgradeCoresClass = "std-button-disabled";
|
|
||||||
} else {
|
} else {
|
||||||
let multiplier = 0;
|
let multiplier = 0;
|
||||||
if (purchaseMult === "MAX") {
|
if (purchaseMult === "MAX") {
|
||||||
@ -123,14 +120,10 @@ export function HacknetServerElem(props: IProps): React.ReactElement {
|
|||||||
const upgradeCoreCost = node.calculateCoreUpgradeCost(multiplier, props.player.hacknet_node_core_cost_mult);
|
const upgradeCoreCost = node.calculateCoreUpgradeCost(multiplier, props.player.hacknet_node_core_cost_mult);
|
||||||
upgradeCoresContent = (
|
upgradeCoresContent = (
|
||||||
<>
|
<>
|
||||||
Upgrade x{multiplier} - <Money money={upgradeCoreCost} player={props.player} />
|
+{multiplier} -
|
||||||
|
<Money money={upgradeCoreCost} player={props.player} />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
if (props.player.money.lt(upgradeCoreCost)) {
|
|
||||||
upgradeCoresClass = "std-button-disabled";
|
|
||||||
} else {
|
|
||||||
upgradeCoresClass = "std-button";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
function upgradeCoresOnClick(): void {
|
function upgradeCoresOnClick(): void {
|
||||||
let numUpgrades = purchaseMult;
|
let numUpgrades = purchaseMult;
|
||||||
@ -142,10 +135,9 @@ export function HacknetServerElem(props: IProps): React.ReactElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Upgrade Cache button
|
// Upgrade Cache button
|
||||||
let upgradeCacheContent, upgradeCacheClass;
|
let upgradeCacheContent;
|
||||||
if (node.cache >= HacknetServerConstants.MaxCache) {
|
if (node.cache >= HacknetServerConstants.MaxCache) {
|
||||||
upgradeCacheContent = <>MAX CACHE</>;
|
upgradeCacheContent = <>MAX CACHE</>;
|
||||||
upgradeCacheClass = "std-button-disabled";
|
|
||||||
} else {
|
} else {
|
||||||
let multiplier = 0;
|
let multiplier = 0;
|
||||||
if (purchaseMult === "MAX") {
|
if (purchaseMult === "MAX") {
|
||||||
@ -158,13 +150,12 @@ export function HacknetServerElem(props: IProps): React.ReactElement {
|
|||||||
const upgradeCacheCost = node.calculateCacheUpgradeCost(multiplier);
|
const upgradeCacheCost = node.calculateCacheUpgradeCost(multiplier);
|
||||||
upgradeCacheContent = (
|
upgradeCacheContent = (
|
||||||
<>
|
<>
|
||||||
Upgrade x{multiplier} - <Money money={upgradeCacheCost} player={props.player} />
|
+{multiplier} -
|
||||||
|
<Money money={upgradeCacheCost} player={props.player} />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
if (props.player.money.lt(upgradeCacheCost)) {
|
if (props.player.money.lt(upgradeCacheCost)) {
|
||||||
upgradeCacheClass = "std-button-disabled";
|
|
||||||
} else {
|
} else {
|
||||||
upgradeCacheClass = "std-button";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function upgradeCacheOnClick(): void {
|
function upgradeCacheOnClick(): void {
|
||||||
@ -178,50 +169,78 @@ export function HacknetServerElem(props: IProps): React.ReactElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<li className={"hacknet-node"}>
|
<Grid item component={Paper} p={1}>
|
||||||
<div className={"hacknet-node-container"}>
|
<Table size="small">
|
||||||
<div className={"row"}>
|
<TableBody>
|
||||||
<h1 style={{ fontSize: "1em" }}>{node.hostname}</h1>
|
<TableRow>
|
||||||
</div>
|
<TableCell>
|
||||||
<div className={"row"}>
|
<Typography>{node.hostname}</Typography>
|
||||||
<p>Production:</p>
|
</TableCell>
|
||||||
<span className={"text money-gold"}>
|
</TableRow>
|
||||||
{Hashes(node.totalHashesGenerated)} ({HashRate(node.hashRate)})
|
<TableRow>
|
||||||
</span>
|
<TableCell>
|
||||||
</div>
|
<Typography>Production:</Typography>
|
||||||
<div className={"row"}>
|
</TableCell>
|
||||||
<p>Hash Capacity:</p>
|
<TableCell colSpan={2}>
|
||||||
<span className={"text"}>{Hashes(node.hashCapacity)}</span>
|
<Typography>
|
||||||
</div>
|
{Hashes(node.totalHashesGenerated)} ({HashRate(node.hashRate)})
|
||||||
<div className={"row"}>
|
</Typography>
|
||||||
<p>Level:</p>
|
</TableCell>
|
||||||
<span className={"text upgradable-info"}>{node.level}</span>
|
</TableRow>
|
||||||
<button className={upgradeLevelClass} onClick={upgradeLevelOnClick}>
|
<TableRow>
|
||||||
{upgradeLevelContent}
|
<TableCell>
|
||||||
</button>
|
<Typography>Hash Capacity:</Typography>
|
||||||
</div>
|
</TableCell>
|
||||||
<div className={"row"}>
|
<TableCell colSpan={2}>
|
||||||
<p>RAM:</p>
|
<Typography>{Hashes(node.hashCapacity)}</Typography>
|
||||||
<span className={"text upgradable-info"}>{node.maxRam}GB</span>
|
</TableCell>
|
||||||
<button className={upgradeRamClass} onClick={upgradeRamOnClick}>
|
</TableRow>
|
||||||
{upgradeRamContent}
|
<TableRow>
|
||||||
</button>
|
<TableCell>
|
||||||
</div>
|
<Typography>Level:</Typography>
|
||||||
<div className={"row"}>
|
</TableCell>
|
||||||
<p>Cores:</p>
|
<TableCell>
|
||||||
<span className={"text upgradable-info"}>{node.cores}</span>
|
<Typography>{node.level}</Typography>
|
||||||
<button className={upgradeCoresClass} onClick={upgradeCoresOnClick}>
|
</TableCell>
|
||||||
{upgradeCoresContent}
|
<TableCell>
|
||||||
</button>
|
<Button onClick={upgradeLevelOnClick}>{upgradeLevelContent}</Button>
|
||||||
</div>
|
</TableCell>
|
||||||
<div className={"row"}>
|
</TableRow>
|
||||||
<p>Cache Level:</p>
|
<TableRow>
|
||||||
<span className={"text upgradable-info"}>{node.cache}</span>
|
<TableCell>
|
||||||
<button className={upgradeCacheClass} onClick={upgradeCacheOnClick}>
|
<Typography>RAM:</Typography>
|
||||||
{upgradeCacheContent}
|
</TableCell>
|
||||||
</button>
|
<TableCell>
|
||||||
</div>
|
<Typography>{node.maxRam}GB</Typography>
|
||||||
</div>
|
</TableCell>
|
||||||
</li>
|
<TableCell>
|
||||||
|
<Button onClick={upgradeRamOnClick}>{upgradeRamContent}</Button>
|
||||||
|
</TableCell>
|
||||||
|
</TableRow>
|
||||||
|
<TableRow>
|
||||||
|
<TableCell>
|
||||||
|
<Typography>Cores:</Typography>
|
||||||
|
</TableCell>
|
||||||
|
<TableCell>
|
||||||
|
<Typography>{node.cores}</Typography>
|
||||||
|
</TableCell>
|
||||||
|
<TableCell>
|
||||||
|
<Button onClick={upgradeCoresOnClick}>{upgradeCoresContent}</Button>
|
||||||
|
</TableCell>
|
||||||
|
</TableRow>
|
||||||
|
<TableRow>
|
||||||
|
<TableCell>
|
||||||
|
<Typography>Cache Level:</Typography>
|
||||||
|
</TableCell>
|
||||||
|
<TableCell>
|
||||||
|
<Typography>{node.cache}</Typography>
|
||||||
|
</TableCell>
|
||||||
|
<TableCell>
|
||||||
|
<Button onClick={upgradeCacheOnClick}>{upgradeCacheContent}</Button>
|
||||||
|
</TableCell>
|
||||||
|
</TableRow>
|
||||||
|
</TableBody>
|
||||||
|
</Table>
|
||||||
|
</Grid>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
|
|
||||||
import { PurchaseMultipliers } from "../data/Constants";
|
import { PurchaseMultipliers } from "../data/Constants";
|
||||||
|
import Button from "@mui/material/Button";
|
||||||
|
|
||||||
interface IMultiplierProps {
|
interface IMultiplierProps {
|
||||||
className: string;
|
className: string;
|
||||||
@ -15,11 +16,7 @@ interface IMultiplierProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function MultiplierButton(props: IMultiplierProps): React.ReactElement {
|
function MultiplierButton(props: IMultiplierProps): React.ReactElement {
|
||||||
return (
|
return <Button onClick={props.onClick}>{props.text}</Button>;
|
||||||
<button className={props.className} onClick={props.onClick}>
|
|
||||||
{props.text}
|
|
||||||
</button>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
@ -47,5 +44,5 @@ export function MultiplierButtons(props: IProps): React.ReactElement {
|
|||||||
buttons.push(<MultiplierButton {...btnProps} />);
|
buttons.push(<MultiplierButton {...btnProps} />);
|
||||||
}
|
}
|
||||||
|
|
||||||
return <span id={"hacknet-nodes-multipliers"}>{buttons}</span>;
|
return <>{buttons}</>;
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ import { Money } from "../../ui/React/Money";
|
|||||||
import { MoneyRate } from "../../ui/React/MoneyRate";
|
import { MoneyRate } from "../../ui/React/MoneyRate";
|
||||||
import { HashRate } from "../../ui/React/HashRate";
|
import { HashRate } from "../../ui/React/HashRate";
|
||||||
import { Hashes } from "../../ui/React/Hashes";
|
import { Hashes } from "../../ui/React/Hashes";
|
||||||
|
import Typography from "@mui/material/Typography";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
totalProduction: number;
|
totalProduction: number;
|
||||||
@ -29,22 +30,23 @@ export function PlayerInfo(props: IProps): React.ReactElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<p id={"hacknet-nodes-money"}>
|
<>
|
||||||
<span>Money: </span>
|
<Typography>
|
||||||
<Money money={props.player.money.toNumber()} />
|
Money:
|
||||||
<br />
|
<Money money={props.player.money.toNumber()} />
|
||||||
|
</Typography>
|
||||||
|
|
||||||
{hasServers && (
|
{hasServers && (
|
||||||
<>
|
<>
|
||||||
<span>
|
<Typography>
|
||||||
Hashes: {Hashes(props.player.hashManager.hashes)} / {Hashes(props.player.hashManager.capacity)}
|
Hashes: {Hashes(props.player.hashManager.hashes)} / {Hashes(props.player.hashManager.capacity)}
|
||||||
</span>
|
</Typography>
|
||||||
<br />
|
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<span>Total Hacknet {hasServers ? "Server" : "Node"} Production: </span>
|
<Typography>
|
||||||
{prod}
|
Total Hacknet {hasServers ? "Server" : "Node"} Production: {prod}
|
||||||
</p>
|
</Typography>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,9 @@ import { hasHacknetServers, hasMaxNumberHacknetServers } from "../HacknetHelpers
|
|||||||
import { Player } from "../../Player";
|
import { Player } from "../../Player";
|
||||||
import { Money } from "../../ui/React/Money";
|
import { Money } from "../../ui/React/Money";
|
||||||
|
|
||||||
|
import Typography from "@mui/material/Typography";
|
||||||
|
import Button from "@mui/material/Button";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
multiplier: number | string;
|
multiplier: number | string;
|
||||||
onClick: () => void;
|
onClick: () => void;
|
||||||
@ -39,8 +42,8 @@ export function PurchaseButton(props: IProps): React.ReactElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<button className={className} onClick={props.onClick} style={style}>
|
<Button onClick={props.onClick}>
|
||||||
{text}
|
<Typography>{text}</Typography>
|
||||||
</button>
|
</Button>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ interface IProps {
|
|||||||
export function KeyHandler(props: IProps): React.ReactElement {
|
export function KeyHandler(props: IProps): React.ReactElement {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
function press(this: Document, event: KeyboardEvent): void {
|
function press(this: Document, event: KeyboardEvent): void {
|
||||||
|
if (!event.isTrusted) return;
|
||||||
const f = props.onKeyDown.bind(this);
|
const f = props.onKeyDown.bind(this);
|
||||||
f(event);
|
f(event);
|
||||||
}
|
}
|
||||||
|
@ -375,7 +375,7 @@ function NetscriptFunctions(workerScript: WorkerScript): NS {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Utility function to get Hacknet Node object
|
// Utility function to get Hacknet Node object
|
||||||
const getHacknetNode = function (i: any, callingFn: any = ""): HacknetNode | HacknetServer {
|
const getHacknetNode = function (i: any, callingFn: string = ""): HacknetNode | HacknetServer {
|
||||||
if (isNaN(i)) {
|
if (isNaN(i)) {
|
||||||
throw makeRuntimeErrorMsg(callingFn, "Invalid index specified for Hacknet Node: " + i);
|
throw makeRuntimeErrorMsg(callingFn, "Invalid index specified for Hacknet Node: " + i);
|
||||||
}
|
}
|
||||||
@ -385,7 +385,7 @@ function NetscriptFunctions(workerScript: WorkerScript): NS {
|
|||||||
|
|
||||||
if (hasHacknetServers(Player)) {
|
if (hasHacknetServers(Player)) {
|
||||||
const hi = Player.hacknetNodes[i];
|
const hi = Player.hacknetNodes[i];
|
||||||
if (typeof hi !== "number") throw new Error("hacknet node was not number");
|
if (typeof hi !== "string") throw new Error("hacknet node was not a string");
|
||||||
const hserver = AllServers[hi];
|
const hserver = AllServers[hi];
|
||||||
if (!(hserver instanceof HacknetServer)) throw new Error("hacknet server was not actually hacknet server");
|
if (!(hserver instanceof HacknetServer)) throw new Error("hacknet server was not actually hacknet server");
|
||||||
if (hserver == null) {
|
if (hserver == null) {
|
||||||
|
3
src/PersonObjects/PlayerEvents.ts
Normal file
3
src/PersonObjects/PlayerEvents.ts
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
import { EventEmitter } from "../utils/EventEmitter";
|
||||||
|
|
||||||
|
export const PlayerEvents = new EventEmitter<[]>();
|
Loading…
Reference in New Issue
Block a user