mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-22 17:23:00 +02:00
more convertion from ip to hostname
This commit is contained in:
@@ -55,7 +55,6 @@ export class PlayerObject implements IPlayer {
|
||||
hashManager: HashManager;
|
||||
hasTixApiAccess: boolean;
|
||||
hasWseAccount: boolean;
|
||||
homeComputer: string;
|
||||
hp: number;
|
||||
jobs: IMap<string>;
|
||||
init: () => void;
|
||||
@@ -336,9 +335,6 @@ export class PlayerObject implements IPlayer {
|
||||
//Money
|
||||
this.money = new Decimal(1000);
|
||||
|
||||
//IP Address of Starting (home) computer
|
||||
this.homeComputer = "";
|
||||
|
||||
//Location information
|
||||
this.city = CityName.Sector12;
|
||||
this.location = LocationName.TravelAgency;
|
||||
|
||||
@@ -32,9 +32,9 @@ import {
|
||||
getFactionSecurityWorkRepGain,
|
||||
getFactionFieldWorkRepGain,
|
||||
} from "../formulas/reputation";
|
||||
import { AddToAllServers, createUniqueRandomIp } from "../../Server/AllServers";
|
||||
import { GetServer, AddToAllServers, createUniqueRandomIp } from "../../Server/AllServers";
|
||||
import { Server } from "../../Server/Server";
|
||||
import { safetlyCreateUniqueServer, getServer } from "../../Server/ServerHelpers";
|
||||
import { safetlyCreateUniqueServer } from "../../Server/ServerHelpers";
|
||||
import { Settings } from "../../Settings/Settings";
|
||||
import { SpecialServerIps, SpecialServerNames } from "../../Server/SpecialServerIps";
|
||||
import { applySourceFile } from "../../SourceFile/applySourceFile";
|
||||
@@ -70,7 +70,6 @@ export function init(this: IPlayer): void {
|
||||
organizationName: "Home PC",
|
||||
purchasedByPlayer: true,
|
||||
});
|
||||
this.homeComputer = t_homeComp.ip;
|
||||
this.currentServer = t_homeComp.ip;
|
||||
AddToAllServers(t_homeComp);
|
||||
|
||||
@@ -80,7 +79,6 @@ export function init(this: IPlayer): void {
|
||||
export function prestigeAugmentation(this: IPlayer): void {
|
||||
const homeComp = this.getHomeComputer();
|
||||
this.currentServer = homeComp.ip;
|
||||
this.homeComputer = homeComp.ip;
|
||||
|
||||
this.numPeopleKilled = 0;
|
||||
this.karma = 0;
|
||||
@@ -579,7 +577,7 @@ export function startWork(this: IPlayer, router: IRouter, companyName: string):
|
||||
export function cancelationPenalty(this: IPlayer): number {
|
||||
const specialIp = SpecialServerIps[this.companyName];
|
||||
if (typeof specialIp === "string" && specialIp !== "") {
|
||||
const server = getServer(specialIp);
|
||||
const server = GetServer(specialIp);
|
||||
if (server instanceof Server) {
|
||||
if (server && server.backdoorInstalled) return 0.75;
|
||||
}
|
||||
@@ -2194,7 +2192,7 @@ export function checkForFactionInvitations(this: IPlayer): Faction[] {
|
||||
const fulcrumsecrettechonologiesFac = Factions["Fulcrum Secret Technologies"];
|
||||
const fulcrumIP = SpecialServerIps[SpecialServerNames.BitRunnersServer];
|
||||
if (typeof fulcrumIP !== "string") throw new Error("Fulcrum Secret Technologies should be string");
|
||||
const fulcrumSecretServer = getServer(fulcrumIP);
|
||||
const fulcrumSecretServer = GetServer(fulcrumIP);
|
||||
if (!(fulcrumSecretServer instanceof Server)) throw new Error("Fulcrum Secret Technologies should be normal server");
|
||||
if (fulcrumSecretServer == null) {
|
||||
console.error("Could not find Fulcrum Secret Technologies Server");
|
||||
@@ -2214,7 +2212,7 @@ export function checkForFactionInvitations(this: IPlayer): Faction[] {
|
||||
const bitrunnersFac = Factions["BitRunners"];
|
||||
const bitrunnerIP = SpecialServerIps[SpecialServerNames.BitRunnersServer];
|
||||
if (typeof bitrunnerIP !== "string") throw new Error("BitRunners should be string");
|
||||
const bitrunnersServer = getServer(bitrunnerIP);
|
||||
const bitrunnersServer = GetServer(bitrunnerIP);
|
||||
if (!(bitrunnersServer instanceof Server)) throw new Error("BitRunners should be normal server");
|
||||
if (bitrunnersServer == null) {
|
||||
console.error("Could not find BitRunners Server");
|
||||
@@ -2232,7 +2230,7 @@ export function checkForFactionInvitations(this: IPlayer): Faction[] {
|
||||
const theblackhandFac = Factions["The Black Hand"];
|
||||
const tbhIP = SpecialServerIps[SpecialServerNames.TheBlackHandServer];
|
||||
if (typeof tbhIP !== "string") throw new Error("TheBlackHand should be string");
|
||||
const blackhandServer = getServer(tbhIP);
|
||||
const blackhandServer = GetServer(tbhIP);
|
||||
if (!(blackhandServer instanceof Server)) throw new Error("TheBlackHand should be normal server");
|
||||
if (blackhandServer == null) {
|
||||
console.error("Could not find The Black Hand Server");
|
||||
@@ -2249,7 +2247,7 @@ export function checkForFactionInvitations(this: IPlayer): Faction[] {
|
||||
const nitesecFac = Factions["NiteSec"];
|
||||
const nitesecIP = SpecialServerIps[SpecialServerNames.NiteSecServer];
|
||||
if (typeof nitesecIP !== "string") throw new Error("NiteSec should be string");
|
||||
const nitesecServer = getServer(nitesecIP);
|
||||
const nitesecServer = GetServer(nitesecIP);
|
||||
if (!(nitesecServer instanceof Server)) throw new Error("NiteSec should be normal server");
|
||||
if (nitesecServer == null) {
|
||||
console.error("Could not find NiteSec Server");
|
||||
@@ -2448,7 +2446,7 @@ export function checkForFactionInvitations(this: IPlayer): Faction[] {
|
||||
for (let i = 0; i < this.hacknetNodes.length; ++i) {
|
||||
const v = this.hacknetNodes[i];
|
||||
if (typeof v === "string") {
|
||||
const hserver = getServer(v);
|
||||
const hserver = GetServer(v);
|
||||
if (hserver === null || !(hserver instanceof HacknetServer))
|
||||
throw new Error("player hacknet server was not HacknetServer");
|
||||
totalHacknetLevels += hserver.level;
|
||||
@@ -2489,7 +2487,7 @@ export function checkForFactionInvitations(this: IPlayer): Faction[] {
|
||||
const cybersecFac = Factions["CyberSec"];
|
||||
const cyberSecIP = SpecialServerIps[SpecialServerNames.CyberSecServer];
|
||||
if (typeof cyberSecIP !== "string") throw new Error("cybersec should be string");
|
||||
const cybersecServer = getServer(cyberSecIP);
|
||||
const cybersecServer = GetServer(cyberSecIP);
|
||||
if (!(cybersecServer instanceof Server)) throw new Error("cybersec should be normal server");
|
||||
if (cybersecServer == null) {
|
||||
console.error("Could not find CyberSec Server");
|
||||
|
||||
@@ -9,8 +9,7 @@ import { BitNodeMultipliers } from "../../BitNode/BitNodeMultipliers";
|
||||
import { Server } from "../../Server/Server";
|
||||
import { BaseServer } from "../../Server/BaseServer";
|
||||
import { HacknetServer } from "../../Hacknet/HacknetServer";
|
||||
import { AddToAllServers, createUniqueRandomIp } from "../../Server/AllServers";
|
||||
import { getServer } from "../../Server/ServerHelpers";
|
||||
import { GetServer, AddToAllServers, createUniqueRandomIp } from "../../Server/AllServers";
|
||||
import { SpecialServerIps } from "../../Server/SpecialServerIps";
|
||||
|
||||
export function hasTorRouter(this: IPlayer): boolean {
|
||||
@@ -18,13 +17,13 @@ export function hasTorRouter(this: IPlayer): boolean {
|
||||
}
|
||||
|
||||
export function getCurrentServer(this: IPlayer): BaseServer {
|
||||
const server = getServer(this.currentServer);
|
||||
const server = GetServer(this.currentServer);
|
||||
if (server === null) throw new Error("somehow connected to a server that does not exist.");
|
||||
return server;
|
||||
}
|
||||
|
||||
export function getHomeComputer(this: IPlayer): Server {
|
||||
const home = getServer(this.homeComputer);
|
||||
const home = GetServer("home");
|
||||
if (home instanceof Server) return home;
|
||||
throw new Error("home computer was not a normal server");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user