diff --git a/src/Hacknet/data/Constants.ts b/src/Hacknet/data/Constants.ts index 555ce4cf8..46a86dc4a 100644 --- a/src/Hacknet/data/Constants.ts +++ b/src/Hacknet/data/Constants.ts @@ -36,11 +36,11 @@ export const HacknetNodeConstants: { }; export const PurchaseMultipliers: { - [key: string]: number | string | undefined; + [key: string]: number | "MAX" | undefined; x1: number; x5: number; x10: number; - MAX: string; + MAX: "MAX"; } = { x1: 1, x5: 5, diff --git a/src/Hacknet/ui/HacknetNodeElem.tsx b/src/Hacknet/ui/HacknetNodeElem.tsx index 4cd6ede38..e2dd832de 100644 --- a/src/Hacknet/ui/HacknetNodeElem.tsx +++ b/src/Hacknet/ui/HacknetNodeElem.tsx @@ -20,9 +20,18 @@ import { HacknetNode } from "../HacknetNode"; import { Money } from "../../ui/React/Money"; import { MoneyRate } from "../../ui/React/MoneyRate"; +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 { node: HacknetNode; - purchaseMultiplier: number | string; + purchaseMultiplier: number | "MAX"; rerender: () => void; player: IPlayer; } @@ -33,10 +42,9 @@ export function HacknetNodeElem(props: IProps): React.ReactElement { const rerender = props.rerender; // Upgrade Level Button - let upgradeLevelContent, upgradeLevelClass; + let upgradeLevelContent; if (node.level >= HacknetNodeConstants.MaxLevel) { upgradeLevelContent = <>MAX LEVEL; - upgradeLevelClass = "std-button-disabled"; } else { let multiplier = 0; if (purchaseMult === "MAX") { @@ -49,28 +57,23 @@ export function HacknetNodeElem(props: IProps): React.ReactElement { const upgradeLevelCost = node.calculateLevelUpgradeCost(multiplier, props.player.hacknet_node_level_cost_mult); upgradeLevelContent = ( <> - Upgrade x{multiplier} - + +{multiplier} -  + ); - if (props.player.money.lt(upgradeLevelCost)) { - upgradeLevelClass = "std-button-disabled"; - } else { - upgradeLevelClass = "std-button"; - } } function upgradeLevelOnClick(): void { - let numUpgrades = purchaseMult; - if (purchaseMult === "MAX") { - numUpgrades = getMaxNumberLevelUpgrades(props.player, node, HacknetNodeConstants.MaxLevel); - } - purchaseLevelUpgrade(props.player, node, numUpgrades as number); + const numUpgrades = + purchaseMult === "MAX" + ? getMaxNumberLevelUpgrades(props.player, node, HacknetNodeConstants.MaxLevel) + : purchaseMult; + purchaseLevelUpgrade(props.player, node, numUpgrades); rerender(); } - let upgradeRamContent, upgradeRamClass; + let upgradeRamContent; if (node.ram >= HacknetNodeConstants.MaxRam) { upgradeRamContent = <>MAX RAM; - upgradeRamClass = "std-button-disabled"; } else { let multiplier = 0; if (purchaseMult === "MAX") { @@ -83,28 +86,21 @@ export function HacknetNodeElem(props: IProps): React.ReactElement { const upgradeRamCost = node.calculateRamUpgradeCost(multiplier, props.player.hacknet_node_ram_cost_mult); upgradeRamContent = ( <> - Upgrade x{multiplier} - + +{multiplier} -  + ); - if (props.player.money.lt(upgradeRamCost)) { - upgradeRamClass = "std-button-disabled"; - } else { - upgradeRamClass = "std-button"; - } } function upgradeRamOnClick(): void { - let numUpgrades = purchaseMult; - if (purchaseMult === "MAX") { - numUpgrades = getMaxNumberRamUpgrades(props.player, node, HacknetNodeConstants.MaxRam); - } - purchaseRamUpgrade(props.player, node, numUpgrades as number); + const numUpgrades = + purchaseMult === "MAX" ? getMaxNumberRamUpgrades(props.player, node, HacknetNodeConstants.MaxRam) : purchaseMult; + purchaseRamUpgrade(props.player, node, numUpgrades); rerender(); } - let upgradeCoresContent, upgradeCoresClass; + let upgradeCoresContent; if (node.cores >= HacknetNodeConstants.MaxCores) { upgradeCoresContent = <>MAX CORES; - upgradeCoresClass = "std-button-disabled"; } else { let multiplier = 0; if (purchaseMult === "MAX") { @@ -117,59 +113,75 @@ export function HacknetNodeElem(props: IProps): React.ReactElement { const upgradeCoreCost = node.calculateCoreUpgradeCost(multiplier, props.player.hacknet_node_core_cost_mult); upgradeCoresContent = ( <> - Upgrade x{multiplier} - + +{multiplier} -  + ); - if (props.player.money.lt(upgradeCoreCost)) { - upgradeCoresClass = "std-button-disabled"; - } else { - upgradeCoresClass = "std-button"; - } } function upgradeCoresOnClick(): void { - let numUpgrades = purchaseMult; - if (purchaseMult === "MAX") { - numUpgrades = getMaxNumberCoreUpgrades(props.player, node, HacknetNodeConstants.MaxCores); - } - purchaseCoreUpgrade(props.player, node, numUpgrades as number); + const numUpgrades = + purchaseMult === "MAX" + ? getMaxNumberCoreUpgrades(props.player, node, HacknetNodeConstants.MaxCores) + : purchaseMult; + purchaseCoreUpgrade(props.player, node, numUpgrades); rerender(); } return ( -
  • -
    -
    -

    {node.name}

    -
    -
    -

    Production:

    - - ( - ) - -
    -
    -

    Level:

    - {node.level} - -
    -
    -

    RAM:

    - {node.ram}GB - -
    -
    -

    Cores:

    - {node.cores} - -
    -
    -
  • + + + + + + {node.name} + + + + + Production: + + + + ( + ) + + + + + + Level: + + + {node.level} + + + + + + + + RAM: + + + {node.ram}GB + + + + + + + + Cores: + + + {node.cores} + + + + + + +
    +
    ); } diff --git a/src/Hacknet/ui/HacknetRoot.tsx b/src/Hacknet/ui/HacknetRoot.tsx index 8ac3d65ab..88e17e781 100644 --- a/src/Hacknet/ui/HacknetRoot.tsx +++ b/src/Hacknet/ui/HacknetRoot.tsx @@ -38,7 +38,7 @@ export function HacknetRoot(props: IProps): React.ReactElement { function rerender(): void { setRerender((old) => !old); } - const [purchaseMultiplier, setPurchaseMultiplier] = useState(PurchaseMultipliers.x1); + const [purchaseMultiplier, setPurchaseMultiplier] = useState(PurchaseMultipliers.x1); useEffect(() => { const id = setInterval(rerender, 200); diff --git a/src/Hacknet/ui/PurchaseButton.tsx b/src/Hacknet/ui/PurchaseButton.tsx index 1c34c6bbc..9f8634361 100644 --- a/src/Hacknet/ui/PurchaseButton.tsx +++ b/src/Hacknet/ui/PurchaseButton.tsx @@ -29,14 +29,16 @@ export function PurchaseButton(props: IProps): React.ReactElement { } else { text = ( <> - Purchase Hacknet Server - + Purchase Hacknet Server -  + ); } } else { text = ( <> - Purchase Hacknet Node - + Purchase Hacknet Node -  + ); } diff --git a/src/ui/React/GameOptionsRoot.tsx b/src/ui/React/GameOptionsRoot.tsx index 53def414d..9f7f2fb48 100644 --- a/src/ui/React/GameOptionsRoot.tsx +++ b/src/ui/React/GameOptionsRoot.tsx @@ -211,6 +211,7 @@ export function GameOptionsRoot(props: IProps): React.ReactElement { The minimum number of milliseconds it takes to execute an operation in Netscript. Setting this too @@ -231,6 +232,7 @@ export function GameOptionsRoot(props: IProps): React.ReactElement { The maximum number of lines a script's logs can hold. Setting this too high can cause the game to @@ -251,6 +253,7 @@ export function GameOptionsRoot(props: IProps): React.ReactElement { The maximum number of entries that can be written to a port using Netscript's write() function. @@ -271,6 +274,7 @@ export function GameOptionsRoot(props: IProps): React.ReactElement { The maximum number of entries that can be written to a the terminal. Setting this too high can cause @@ -292,6 +296,7 @@ export function GameOptionsRoot(props: IProps): React.ReactElement { The time (in seconds) between each autosave. Set to 0 to disable autosave. } @@ -313,6 +318,7 @@ export function GameOptionsRoot(props: IProps): React.ReactElement { control={} label={ If this is set, then any messages you receive will not appear as popups on the screen. They will @@ -331,6 +337,7 @@ export function GameOptionsRoot(props: IProps): React.ReactElement { control={} label={ If this is set, then any faction invites you receive will not appear as popups on the screen. @@ -350,6 +357,7 @@ export function GameOptionsRoot(props: IProps): React.ReactElement { } label={ If this is set, the confirmation message before traveling will not show up. You will @@ -372,6 +380,7 @@ export function GameOptionsRoot(props: IProps): React.ReactElement { } label={ If this is set, the confirmation message before buying augmentation will not show up. @@ -390,6 +399,7 @@ export function GameOptionsRoot(props: IProps): React.ReactElement { } label={ If this is set, a popup message will no longer be shown when you are hospitalized after taking @@ -410,6 +420,7 @@ export function GameOptionsRoot(props: IProps): React.ReactElement { } label={ If this is set, then having your Bladeburner actions interrupted by being busy with something @@ -428,6 +439,7 @@ export function GameOptionsRoot(props: IProps): React.ReactElement { control={} label={ If this is set, then most hotkeys (keyboard shortcuts) in the game are disabled. This includes @@ -445,7 +457,10 @@ export function GameOptionsRoot(props: IProps): React.ReactElement { } label={ - If this is set all ASCII art will be disabled.}> + If this is set all ASCII art will be disabled.} + > Disable ascii art } @@ -456,6 +471,7 @@ export function GameOptionsRoot(props: IProps): React.ReactElement { control={} label={ If this is set, text effects will not be displayed. This can help if text is difficult to read @@ -474,6 +490,7 @@ export function GameOptionsRoot(props: IProps): React.ReactElement { control={} label={ Improved Bash emulation mode. Setting this to 1 enables several new Terminal shortcuts and @@ -492,6 +509,7 @@ export function GameOptionsRoot(props: IProps): React.ReactElement { control={} label={ Terminal commands and log entries will be timestamped. The timestamp will have the format: M/D @@ -506,7 +524,7 @@ export function GameOptionsRoot(props: IProps): React.ReactElement { - Sets the locale for displaying numbers.}> + Sets the locale for displaying numbers.}> Locale