Add buy all option to buy terminal command

This commit is contained in:
Tony Roberts
2021-12-28 02:11:41 -05:00
parent d99b03d12e
commit e9fd5f46eb
3 changed files with 37 additions and 4 deletions
+3 -1
View File
@@ -96,13 +96,15 @@ export const HelpTexts: IMap<string[]> = {
" ",
],
buy: [
"buy [-l / program]",
"buy [-l / -a / program]",
" ",
"Purchase a program through the Dark Web. Requires a TOR router to use.",
" ",
"If this command is ran with the '-l' flag, it will display a list of all programs that can be bought through the ",
"dark web to the Terminal, as well as their costs.",
" ",
"If this command is ran with the '-a' flag, it will attempt to purchase all unowned programs.",
" ",
"Otherwise, the name of the program must be passed in as a parameter. This name is NOT case-sensitive.",
],
cat: [
+4 -1
View File
@@ -2,7 +2,7 @@ import { ITerminal } from "../ITerminal";
import { IRouter } from "../../ui/Router";
import { IPlayer } from "../../PersonObjects/IPlayer";
import { BaseServer } from "../../Server/BaseServer";
import { listAllDarkwebItems, buyDarkwebItem } from "../../DarkWeb/DarkWeb";
import { listAllDarkwebItems, buyAllDarkwebItems, buyDarkwebItem } from "../../DarkWeb/DarkWeb";
import { SpecialServers } from "../../Server/data/SpecialServers";
import { GetServer } from "../../Server/AllServers";
@@ -22,12 +22,15 @@ export function buy(
if (args.length != 1) {
terminal.print("Incorrect number of arguments. Usage: ");
terminal.print("buy -l");
terminal.print("buy -a");
terminal.print("buy [item name]");
return;
}
const arg = args[0] + "";
if (arg == "-l" || arg == "-1" || arg == "--list") {
listAllDarkwebItems();
} else if (arg == "-a" || arg == "--all") {
buyAllDarkwebItems();
} else {
buyDarkwebItem(arg);
}