finish convert to hostname

This commit is contained in:
Olivier Gagnon
2021-10-07 17:55:49 -04:00
parent 2958034ad4
commit 7d0536a4d2
37 changed files with 211 additions and 314 deletions

View File

@@ -36,7 +36,7 @@ import { GetServer, AddToAllServers, createUniqueRandomIp } from "../../Server/A
import { Server } from "../../Server/Server";
import { safetlyCreateUniqueServer } from "../../Server/ServerHelpers";
import { Settings } from "../../Settings/Settings";
import { SpecialServerIps, SpecialServerNames } from "../../Server/SpecialServerIps";
import { SpecialServers } from "../../Server/data/SpecialServers";
import { applySourceFile } from "../../SourceFile/applySourceFile";
import { applyExploit } from "../../Exploits/applyExploits";
import { SourceFiles } from "../../SourceFile/SourceFiles";
@@ -70,7 +70,7 @@ export function init(this: IPlayer): void {
organizationName: "Home PC",
purchasedByPlayer: true,
});
this.currentServer = t_homeComp.ip;
this.currentServer = SpecialServers.Home;
AddToAllServers(t_homeComp);
this.getHomeComputer().programs.push(Programs.NukeProgram.name);
@@ -78,7 +78,7 @@ export function init(this: IPlayer): void {
export function prestigeAugmentation(this: IPlayer): void {
const homeComp = this.getHomeComputer();
this.currentServer = homeComp.ip;
this.currentServer = SpecialServers.Home;
this.numPeopleKilled = 0;
this.karma = 0;
@@ -575,13 +575,11 @@ 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);
if (server instanceof Server) {
if (server && server.backdoorInstalled) return 0.75;
}
const server = GetServer(this.companyName);
if (server instanceof Server) {
if (server && server.backdoorInstalled) return 0.75;
}
return 0.5;
}
@@ -2190,9 +2188,7 @@ export function checkForFactionInvitations(this: IPlayer): Faction[] {
//Fulcrum Secret Technologies - If u've unlocked fulcrum secret technolgoies server and have a high rep with the company
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(SpecialServers.FulcrumSecretTechnologies);
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");
@@ -2210,9 +2206,7 @@ export function checkForFactionInvitations(this: IPlayer): Faction[] {
//BitRunners
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(SpecialServers.BitRunnersServer);
if (!(bitrunnersServer instanceof Server)) throw new Error("BitRunners should be normal server");
if (bitrunnersServer == null) {
console.error("Could not find BitRunners Server");
@@ -2228,9 +2222,7 @@ export function checkForFactionInvitations(this: IPlayer): Faction[] {
//The Black Hand
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(SpecialServers.TheBlackHandServer);
if (!(blackhandServer instanceof Server)) throw new Error("TheBlackHand should be normal server");
if (blackhandServer == null) {
console.error("Could not find The Black Hand Server");
@@ -2245,9 +2237,7 @@ export function checkForFactionInvitations(this: IPlayer): Faction[] {
//NiteSec
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(SpecialServers.NiteSecServer);
if (!(nitesecServer instanceof Server)) throw new Error("NiteSec should be normal server");
if (nitesecServer == null) {
console.error("Could not find NiteSec Server");
@@ -2485,9 +2475,7 @@ export function checkForFactionInvitations(this: IPlayer): Faction[] {
//CyberSec
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(SpecialServers.CyberSecServer);
if (!(cybersecServer instanceof Server)) throw new Error("cybersec should be normal server");
if (cybersecServer == null) {
console.error("Could not find CyberSec Server");