mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-26 01:23: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 Table from "@mui/material/Table";
|
||||
import TableRow from "@mui/material/TableRow";
|
||||
import { numeralWrapper } from "../../ui/numeralFormat";
|
||||
|
||||
interface IProps {
|
||||
node: HacknetNode;
|
||||
@ -163,7 +164,7 @@ export function HacknetNodeElem(props: IProps): React.ReactElement {
|
||||
<Typography>RAM:</Typography>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Typography>{node.ram}GB</Typography>
|
||||
<Typography>{numeralWrapper.formatRAM(node.ram)}</Typography>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Button onClick={upgradeRamOnClick}>{upgradeRamContent}</Button>
|
||||
|
@ -31,6 +31,7 @@ import { TableCell } from "../../ui/React/Table";
|
||||
import TableBody from "@mui/material/TableBody";
|
||||
import Table from "@mui/material/Table";
|
||||
import TableRow from "@mui/material/TableRow";
|
||||
import { numeralWrapper } from "../../ui/numeralFormat";
|
||||
|
||||
interface IProps {
|
||||
node: HacknetServer;
|
||||
@ -213,7 +214,7 @@ export function HacknetServerElem(props: IProps): React.ReactElement {
|
||||
<Typography>RAM:</Typography>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Typography>{node.maxRam}GB</Typography>
|
||||
<Typography>{numeralWrapper.formatRAM(node.maxRam)}</Typography>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Button onClick={upgradeRamOnClick}>{upgradeRamContent}</Button>
|
||||
|
@ -8,6 +8,7 @@ import { purchaseRamForHomeComputer } from "../../Server/ServerPurchases";
|
||||
|
||||
import { Money } from "../../ui/React/Money";
|
||||
import { MathComponent } from "mathjax-react";
|
||||
import { numeralWrapper } from "../../ui/numeralFormat";
|
||||
|
||||
type IProps = {
|
||||
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)}}}`} />}>
|
||||
<span>
|
||||
<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} />
|
||||
</Button>
|
||||
</span>
|
||||
|
@ -17,6 +17,7 @@ import { getPurchaseServerCost } from "../../Server/ServerPurchases";
|
||||
import { Money } from "../../ui/React/Money";
|
||||
import { use } from "../../ui/Context";
|
||||
import { PurchaseServerModal } from "./PurchaseServerModal";
|
||||
import { numeralWrapper } from "../../ui/numeralFormat";
|
||||
|
||||
interface IServerProps {
|
||||
ram: number;
|
||||
@ -30,7 +31,7 @@ function ServerButton(props: IServerProps): React.ReactElement {
|
||||
return (
|
||||
<>
|
||||
<Button onClick={() => setOpen(true)} disabled={!player.canAfford(cost)}>
|
||||
Purchase {props.ram}GB Server -
|
||||
Purchase {numeralWrapper.formatRAM(props.ram)} Server -
|
||||
<Money money={cost} player={player} />
|
||||
</Button>
|
||||
<PurchaseServerModal
|
||||
|
@ -3280,7 +3280,9 @@ function NetscriptFunctions(workerScript: WorkerScript): NS {
|
||||
Player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain);
|
||||
workerScript.log(
|
||||
"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;
|
||||
},
|
||||
|
@ -7,6 +7,7 @@ import { startWorkerScript } from "../../NetscriptWorker";
|
||||
import { RunningScript } from "../../Script/RunningScript";
|
||||
import { findRunningScript } from "../../Script/ScriptHelpers";
|
||||
import * as libarg from "arg";
|
||||
import { numeralWrapper } from "../../ui/numeralFormat";
|
||||
|
||||
export function runScript(
|
||||
terminal: ITerminal,
|
||||
@ -64,8 +65,8 @@ export function runScript(
|
||||
"This machine does not have enough RAM to run this script with " +
|
||||
numThreads +
|
||||
" threads. Script requires " +
|
||||
ramUsage +
|
||||
"GB of RAM",
|
||||
numeralWrapper.formatRAM(ramUsage) +
|
||||
" of RAM",
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
@ -106,6 +106,10 @@ class NumeralFormatter {
|
||||
}
|
||||
|
||||
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";
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user