feat(command:buy): show owned items in buy list

Just a little output change when you `buy -l`, to show you which items
you already own.
I couldn't access the theme when importing it here for use, it kept
crashing the app so the [OWNED} shows up always as green.. Which isn't
the end of the world considering the money always shows up in Yellow.
I think this area of code/output could do with a little bit of love at
some point.

Resolves danielyxie/bitburner#2069
This commit is contained in:
Dan
2021-12-20 16:51:08 +00:00
parent 00b3cb61f4
commit 388a3f56c3

View File

@ -6,6 +6,7 @@ import { Terminal } from "../Terminal";
import { SpecialServers } from "../Server/data/SpecialServers";
import { Money } from "../ui/React/Money";
import { DarkWebItem } from "./DarkWebItem";
import Typography from "@mui/material/Typography";
//Posts a "help" message if connected to DarkWeb
export function checkIfConnectedToDarkweb(): void {
@ -22,10 +23,17 @@ export function checkIfConnectedToDarkweb(): void {
export function listAllDarkwebItems(): void {
for (const key in DarkWebItems) {
const item = DarkWebItems[key];
const cost = Player.getHomeComputer().programs.includes(item.program) ? (
<span style={{ color: `green` }}>[OWNED]</span>
) : (
<Money money={item.price} />
);
Terminal.printRaw(
<>
{item.program} - <Money money={item.price} /> - {item.description}
</>,
<Typography>
<span>{item.program}</span> - <span>{cost}</span> - <span>{item.description}</span>
</Typography>,
);
}
}