mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-05-01 13:27:08 +02:00
finish convert to hostname
This commit is contained in:
@@ -22,7 +22,6 @@ export const TerminalHelpText: string[] = [
|
||||
"help [command] Display this help text, or the help text for a command",
|
||||
"home Connect to home computer",
|
||||
"hostname Displays the hostname of the machine",
|
||||
"ifconfig Displays the IP address of the machine",
|
||||
"kill [script/pid] [args...] Stops the specified script on the current server ",
|
||||
"killall Stops all running scripts on the current machine",
|
||||
"ls [dir] [| grep pattern] Displays all files on the machine",
|
||||
@@ -219,7 +218,6 @@ export const HelpTexts: IMap<string[]> = {
|
||||
"home" + "Connect to your home computer. This will work no matter what server you are currently connected to.",
|
||||
],
|
||||
hostname: ["hostname", " ", "Prints the hostname of the current server"],
|
||||
ifconfig: ["ipconfig", " ", "Prints the IP address of the current server"],
|
||||
kill: [
|
||||
"kill [script name] [args...]",
|
||||
" ",
|
||||
|
||||
@@ -19,7 +19,7 @@ import { checkIfConnectedToDarkweb } from "../DarkWeb/DarkWeb";
|
||||
import { iTutorialNextStep, iTutorialSteps, ITutorial } from "../InteractiveTutorial";
|
||||
import { getServerOnNetwork, processSingleServerGrowth } from "../Server/ServerHelpers";
|
||||
import { ParseCommand, ParseCommands } from "./Parser";
|
||||
import { SpecialServerIps, SpecialServerNames } from "../Server/SpecialServerIps";
|
||||
import { SpecialServers } from "../Server/data/SpecialServers";
|
||||
import { Settings } from "../Settings/Settings";
|
||||
import { createProgressBarText } from "../utils/helpers/createProgressBarText";
|
||||
import {
|
||||
@@ -49,7 +49,6 @@ import { hack } from "./commands/hack";
|
||||
import { help } from "./commands/help";
|
||||
import { home } from "./commands/home";
|
||||
import { hostname } from "./commands/hostname";
|
||||
import { ifconfig } from "./commands/ifconfig";
|
||||
import { kill } from "./commands/kill";
|
||||
import { killall } from "./commands/killall";
|
||||
import { ls } from "./commands/ls";
|
||||
@@ -176,10 +175,7 @@ export class Terminal implements ITerminal {
|
||||
const expGainedOnFailure = expGainedOnSuccess / 4;
|
||||
if (rand < hackChance) {
|
||||
// Success!
|
||||
if (
|
||||
SpecialServerIps[SpecialServerNames.WorldDaemon] &&
|
||||
SpecialServerIps[SpecialServerNames.WorldDaemon] == server.ip
|
||||
) {
|
||||
if (SpecialServers.WorldDaemon === server.hostname) {
|
||||
if (player.bitNodeN == null) {
|
||||
player.bitNodeN = 1;
|
||||
}
|
||||
@@ -259,10 +255,7 @@ export class Terminal implements ITerminal {
|
||||
return;
|
||||
}
|
||||
if (!(server instanceof Server)) throw new Error("server should be normal server");
|
||||
if (
|
||||
SpecialServerIps[SpecialServerNames.WorldDaemon] &&
|
||||
SpecialServerIps[SpecialServerNames.WorldDaemon] == server.ip
|
||||
) {
|
||||
if (SpecialServers.WorldDaemon === server.hostname) {
|
||||
if (player.bitNodeN == null) {
|
||||
player.bitNodeN = 1;
|
||||
}
|
||||
@@ -519,7 +512,7 @@ export class Terminal implements ITerminal {
|
||||
return;
|
||||
}
|
||||
player.getCurrentServer().isConnectedTo = false;
|
||||
player.currentServer = serv.ip;
|
||||
player.currentServer = serv.hostname;
|
||||
player.getCurrentServer().isConnectedTo = true;
|
||||
this.print("Connected to " + serv.hostname);
|
||||
this.setcwd("/");
|
||||
@@ -625,7 +618,10 @@ export class Terminal implements ITerminal {
|
||||
break;
|
||||
case iTutorialSteps.TerminalConnect:
|
||||
if (commandArray.length == 2) {
|
||||
if (commandArray[0] == "connect" && (commandArray[1] == "n00dles" || commandArray[1] == n00dlesServ.ip)) {
|
||||
if (
|
||||
commandArray[0] == "connect" &&
|
||||
(commandArray[1] == "n00dles" || commandArray[1] == n00dlesServ.hostname)
|
||||
) {
|
||||
iTutorialNextStep();
|
||||
} else {
|
||||
this.print("Wrong command! Try again!");
|
||||
@@ -741,7 +737,6 @@ export class Terminal implements ITerminal {
|
||||
help: help,
|
||||
home: home,
|
||||
hostname: hostname,
|
||||
ifconfig: ifconfig,
|
||||
kill: kill,
|
||||
killall: killall,
|
||||
ls: ls,
|
||||
|
||||
@@ -3,7 +3,8 @@ import { IRouter } from "../../ui/Router";
|
||||
import { IPlayer } from "../../PersonObjects/IPlayer";
|
||||
import { BaseServer } from "../../Server/BaseServer";
|
||||
import { listAllDarkwebItems, buyDarkwebItem } from "../../DarkWeb/DarkWeb";
|
||||
import { SpecialServerIps } from "../../Server/SpecialServerIps";
|
||||
import { SpecialServers } from "../../Server/data/SpecialServers";
|
||||
import { GetServer } from "../../Server/AllServers";
|
||||
|
||||
export function buy(
|
||||
terminal: ITerminal,
|
||||
@@ -12,7 +13,7 @@ export function buy(
|
||||
server: BaseServer,
|
||||
args: (string | number)[],
|
||||
): void {
|
||||
if (!SpecialServerIps.hasOwnProperty("Darkweb Server")) {
|
||||
if (!GetServer(SpecialServers.DarkWeb)) {
|
||||
terminal.error(
|
||||
"You need to be able to connect to the Dark Web to use the buy command. (Maybe there's a TOR router you can buy somewhere)",
|
||||
);
|
||||
|
||||
@@ -17,13 +17,13 @@ export function connect(
|
||||
return;
|
||||
}
|
||||
|
||||
const ip = args[0] + "";
|
||||
const hostname = args[0] + "";
|
||||
|
||||
for (let i = 0; i < server.serversOnNetwork.length; i++) {
|
||||
const other = getServerOnNetwork(server, i);
|
||||
if (other === null) throw new Error(`Server on network should not be null`);
|
||||
if (other.ip == ip || other.hostname == ip) {
|
||||
terminal.connectToServer(player, ip);
|
||||
if (other.hostname == hostname) {
|
||||
terminal.connectToServer(player, hostname);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ export function home(
|
||||
return;
|
||||
}
|
||||
player.getCurrentServer().isConnectedTo = false;
|
||||
player.currentServer = player.getHomeComputer().ip;
|
||||
player.currentServer = player.getHomeComputer().hostname;
|
||||
player.getCurrentServer().isConnectedTo = true;
|
||||
terminal.print("Connected to home");
|
||||
terminal.setcwd("/");
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
import { ITerminal } from "../ITerminal";
|
||||
import { IRouter } from "../../ui/Router";
|
||||
import { IPlayer } from "../../PersonObjects/IPlayer";
|
||||
import { BaseServer } from "../../Server/BaseServer";
|
||||
|
||||
export function ifconfig(
|
||||
terminal: ITerminal,
|
||||
router: IRouter,
|
||||
player: IPlayer,
|
||||
server: BaseServer,
|
||||
args: (string | number)[],
|
||||
): void {
|
||||
if (args.length !== 0) {
|
||||
terminal.error("Incorrect usage of ifconfig command. Usage: ifconfig");
|
||||
return;
|
||||
}
|
||||
terminal.print(player.getCurrentServer().ip);
|
||||
}
|
||||
@@ -36,7 +36,7 @@ export function kill(
|
||||
terminal.error("No such script is running. Nothing to kill");
|
||||
return;
|
||||
}
|
||||
killWorkerScript(runningScript, server.ip, false);
|
||||
killWorkerScript(runningScript, server.hostname, false);
|
||||
terminal.print(`Killing ${scriptName}`);
|
||||
} catch (e) {
|
||||
terminal.error(e + "");
|
||||
|
||||
@@ -7,7 +7,7 @@ import { WorkerScriptStartStopEventEmitter } from "../../Netscript/WorkerScriptS
|
||||
|
||||
export function killall(terminal: ITerminal, router: IRouter, player: IPlayer, server: BaseServer): void {
|
||||
for (let i = server.runningScripts.length - 1; i >= 0; --i) {
|
||||
killWorkerScript(server.runningScripts[i], server.ip, false);
|
||||
killWorkerScript(server.runningScripts[i], server.hostname, false);
|
||||
}
|
||||
WorkerScriptStartStopEventEmitter.emit();
|
||||
terminal.print("Killing all running scripts");
|
||||
|
||||
@@ -224,7 +224,6 @@ export function determineAllPossibilitiesForTabCompletion(
|
||||
|
||||
if (isCommand("scp") && index === 1) {
|
||||
for (const server of GetAllServers()) {
|
||||
allPos.push(server.ip);
|
||||
allPos.push(server.hostname);
|
||||
}
|
||||
|
||||
@@ -247,7 +246,6 @@ export function determineAllPossibilitiesForTabCompletion(
|
||||
if (serv == null) {
|
||||
continue;
|
||||
}
|
||||
allPos.push(serv.ip);
|
||||
allPos.push(serv.hostname);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user