mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-29 19:13:49 +01:00
change GB to TBPBEB
This commit is contained in:
parent
06775b20fa
commit
8e07cc999d
@ -28,6 +28,7 @@ import { TableCell } from "../../ui/React/Table";
|
|||||||
import TableBody from "@mui/material/TableBody";
|
import TableBody from "@mui/material/TableBody";
|
||||||
import Table from "@mui/material/Table";
|
import Table from "@mui/material/Table";
|
||||||
import TableRow from "@mui/material/TableRow";
|
import TableRow from "@mui/material/TableRow";
|
||||||
|
import { numeralWrapper } from "../../ui/numeralFormat";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
node: HacknetNode;
|
node: HacknetNode;
|
||||||
@ -163,7 +164,7 @@ export function HacknetNodeElem(props: IProps): React.ReactElement {
|
|||||||
<Typography>RAM:</Typography>
|
<Typography>RAM:</Typography>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell>
|
<TableCell>
|
||||||
<Typography>{node.ram}GB</Typography>
|
<Typography>{numeralWrapper.formatRAM(node.ram)}</Typography>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell>
|
<TableCell>
|
||||||
<Button onClick={upgradeRamOnClick}>{upgradeRamContent}</Button>
|
<Button onClick={upgradeRamOnClick}>{upgradeRamContent}</Button>
|
||||||
|
@ -31,6 +31,7 @@ import { TableCell } from "../../ui/React/Table";
|
|||||||
import TableBody from "@mui/material/TableBody";
|
import TableBody from "@mui/material/TableBody";
|
||||||
import Table from "@mui/material/Table";
|
import Table from "@mui/material/Table";
|
||||||
import TableRow from "@mui/material/TableRow";
|
import TableRow from "@mui/material/TableRow";
|
||||||
|
import { numeralWrapper } from "../../ui/numeralFormat";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
node: HacknetServer;
|
node: HacknetServer;
|
||||||
@ -213,7 +214,7 @@ export function HacknetServerElem(props: IProps): React.ReactElement {
|
|||||||
<Typography>RAM:</Typography>
|
<Typography>RAM:</Typography>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell>
|
<TableCell>
|
||||||
<Typography>{node.maxRam}GB</Typography>
|
<Typography>{numeralWrapper.formatRAM(node.maxRam)}</Typography>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell>
|
<TableCell>
|
||||||
<Button onClick={upgradeRamOnClick}>{upgradeRamContent}</Button>
|
<Button onClick={upgradeRamOnClick}>{upgradeRamContent}</Button>
|
||||||
|
@ -8,6 +8,7 @@ import { purchaseRamForHomeComputer } from "../../Server/ServerPurchases";
|
|||||||
|
|
||||||
import { Money } from "../../ui/React/Money";
|
import { Money } from "../../ui/React/Money";
|
||||||
import { MathComponent } from "mathjax-react";
|
import { MathComponent } from "mathjax-react";
|
||||||
|
import { numeralWrapper } from "../../ui/numeralFormat";
|
||||||
|
|
||||||
type IProps = {
|
type IProps = {
|
||||||
p: IPlayer;
|
p: IPlayer;
|
||||||
@ -31,7 +32,8 @@ export function RamButton(props: IProps): React.ReactElement {
|
|||||||
<Tooltip title={<MathComponent tex={String.raw`\large{cost = 3.2 \times 10^3 \times 1.58^{log_2{(ram)}}}`} />}>
|
<Tooltip title={<MathComponent tex={String.raw`\large{cost = 3.2 \times 10^3 \times 1.58^{log_2{(ram)}}}`} />}>
|
||||||
<span>
|
<span>
|
||||||
<Button disabled={!props.p.canAfford(cost)} onClick={buy}>
|
<Button disabled={!props.p.canAfford(cost)} onClick={buy}>
|
||||||
Upgrade 'home' RAM ({homeComputer.maxRam}GB -> {homeComputer.maxRam * 2}GB) -
|
Upgrade 'home' RAM ({numeralWrapper.formatRAM(homeComputer.maxRam)} ->
|
||||||
|
{numeralWrapper.formatRAM(homeComputer.maxRam * 2)}) -
|
||||||
<Money money={cost} player={props.p} />
|
<Money money={cost} player={props.p} />
|
||||||
</Button>
|
</Button>
|
||||||
</span>
|
</span>
|
||||||
|
@ -17,6 +17,7 @@ import { getPurchaseServerCost } from "../../Server/ServerPurchases";
|
|||||||
import { Money } from "../../ui/React/Money";
|
import { Money } from "../../ui/React/Money";
|
||||||
import { use } from "../../ui/Context";
|
import { use } from "../../ui/Context";
|
||||||
import { PurchaseServerModal } from "./PurchaseServerModal";
|
import { PurchaseServerModal } from "./PurchaseServerModal";
|
||||||
|
import { numeralWrapper } from "../../ui/numeralFormat";
|
||||||
|
|
||||||
interface IServerProps {
|
interface IServerProps {
|
||||||
ram: number;
|
ram: number;
|
||||||
@ -30,7 +31,7 @@ function ServerButton(props: IServerProps): React.ReactElement {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Button onClick={() => setOpen(true)} disabled={!player.canAfford(cost)}>
|
<Button onClick={() => setOpen(true)} disabled={!player.canAfford(cost)}>
|
||||||
Purchase {props.ram}GB Server -
|
Purchase {numeralWrapper.formatRAM(props.ram)} Server -
|
||||||
<Money money={cost} player={player} />
|
<Money money={cost} player={player} />
|
||||||
</Button>
|
</Button>
|
||||||
<PurchaseServerModal
|
<PurchaseServerModal
|
||||||
|
@ -3280,7 +3280,9 @@ function NetscriptFunctions(workerScript: WorkerScript): NS {
|
|||||||
Player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain);
|
Player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain);
|
||||||
workerScript.log(
|
workerScript.log(
|
||||||
"upgradeHomeRam",
|
"upgradeHomeRam",
|
||||||
`Purchased additional RAM for home computer! It now has ${homeComputer.maxRam}GB of RAM.`,
|
`Purchased additional RAM for home computer! It now has ${numeralWrapper.formatRAM(
|
||||||
|
homeComputer.maxRam,
|
||||||
|
)} of RAM.`,
|
||||||
);
|
);
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
@ -7,6 +7,7 @@ import { startWorkerScript } from "../../NetscriptWorker";
|
|||||||
import { RunningScript } from "../../Script/RunningScript";
|
import { RunningScript } from "../../Script/RunningScript";
|
||||||
import { findRunningScript } from "../../Script/ScriptHelpers";
|
import { findRunningScript } from "../../Script/ScriptHelpers";
|
||||||
import * as libarg from "arg";
|
import * as libarg from "arg";
|
||||||
|
import { numeralWrapper } from "../../ui/numeralFormat";
|
||||||
|
|
||||||
export function runScript(
|
export function runScript(
|
||||||
terminal: ITerminal,
|
terminal: ITerminal,
|
||||||
@ -64,8 +65,8 @@ export function runScript(
|
|||||||
"This machine does not have enough RAM to run this script with " +
|
"This machine does not have enough RAM to run this script with " +
|
||||||
numThreads +
|
numThreads +
|
||||||
" threads. Script requires " +
|
" threads. Script requires " +
|
||||||
ramUsage +
|
numeralWrapper.formatRAM(ramUsage) +
|
||||||
"GB of RAM",
|
" of RAM",
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -106,6 +106,10 @@ class NumeralFormatter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
formatRAM(n: number): string {
|
formatRAM(n: number): string {
|
||||||
|
if (n < 1e3) return this.format(n, "0.00") + "GB";
|
||||||
|
if (n < 1e6) return this.format(n / 1e3, "0.00") + "TB";
|
||||||
|
if (n < 1e9) return this.format(n / 1e6, "0.00") + "PB";
|
||||||
|
if (n < 1e12) return this.format(n / 1e9, "0.00") + "EB";
|
||||||
return this.format(n, "0.00") + "GB";
|
return this.format(n, "0.00") + "GB";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user