2016-10-14 23:02:06 +02:00
|
|
|
//Netburner Server class
|
2016-11-30 00:38:50 +01:00
|
|
|
//TODO Make a map of all IPS in the game so far so that we don't accidentally
|
|
|
|
// get duplicate IPs..however unlikely it is
|
2016-10-20 20:26:38 +02:00
|
|
|
function Server() {
|
2016-10-17 23:23:23 +02:00
|
|
|
/* Properties */
|
2016-10-14 23:02:06 +02:00
|
|
|
//Connection information
|
2016-10-19 23:43:49 +02:00
|
|
|
this.ip = "0.0.0.0";
|
|
|
|
this.hostname = "";
|
|
|
|
this.organizationName = "";
|
|
|
|
this.isOnline = true;
|
|
|
|
this.isConnectedTo = false; //Whether the player is connected to this server
|
2016-10-14 23:02:06 +02:00
|
|
|
|
2016-10-17 23:23:23 +02:00
|
|
|
//Access information
|
2016-10-19 23:43:49 +02:00
|
|
|
this.hasAdminRights = false; //Whether player has admin rights
|
|
|
|
this.purchasedByPlayer = false;
|
2016-10-14 23:02:06 +02:00
|
|
|
|
2016-10-18 23:37:53 +02:00
|
|
|
//RAM, CPU speed and Scripts
|
2016-11-21 07:11:14 +01:00
|
|
|
this.maxRam = 1; //GB
|
2016-10-19 23:43:49 +02:00
|
|
|
this.ramUsed = 0;
|
|
|
|
this.cpuSpeed = 1; //MHz
|
2016-10-14 23:02:06 +02:00
|
|
|
|
2016-10-19 23:43:49 +02:00
|
|
|
this.scripts = [];
|
2016-11-30 00:38:50 +01:00
|
|
|
this.runningScripts = []; //Names (and only names) of scripts being run
|
2016-10-19 23:43:49 +02:00
|
|
|
this.programs = [];
|
2017-04-27 07:01:21 +02:00
|
|
|
|
2016-10-17 23:23:23 +02:00
|
|
|
/* Hacking information (only valid for "foreign" aka non-purchased servers) */
|
|
|
|
|
|
|
|
//Skill required to attempt a hack. Whether a hack is successful will be determined
|
|
|
|
//by a separate formula
|
2016-10-19 23:43:49 +02:00
|
|
|
this.requiredHackingSkill = 1;
|
2016-10-17 23:23:23 +02:00
|
|
|
|
|
|
|
//Total money available on this server. How much of this you hack will be determined
|
|
|
|
//by a formula related to hacking skill. The money available on a server will steadily increase
|
|
|
|
//over time, and it will decrease when you hack it
|
2016-12-20 21:18:34 +01:00
|
|
|
this.moneyAvailable = 0;
|
2016-10-17 23:23:23 +02:00
|
|
|
|
2016-10-18 23:37:53 +02:00
|
|
|
//Parameters used in formulas that dictate how moneyAvailable and requiredHackingSkill change.
|
2016-10-19 23:43:49 +02:00
|
|
|
this.hackDifficulty = 1; //Affects hack success rate and how the requiredHackingSkill increases over time (1-100)
|
2016-12-20 21:18:34 +01:00
|
|
|
this.serverGrowth = 0; //Affects how the moneyAvailable increases (0-100)
|
2016-10-19 23:43:49 +02:00
|
|
|
this.timesHacked = 0;
|
2016-10-17 23:23:23 +02:00
|
|
|
|
2016-12-01 23:18:18 +01:00
|
|
|
//The IP's of all servers reachable from this one (what shows up if you run scan/netstat)
|
|
|
|
// NOTE: Only contains IP and not the Server objects themselves
|
2016-10-19 23:43:49 +02:00
|
|
|
this.serversOnNetwork = [];
|
2016-10-24 23:16:51 +02:00
|
|
|
|
|
|
|
//Port information, required for porthacking servers to get admin rights
|
|
|
|
this.numOpenPortsRequired = 5;
|
|
|
|
this.sshPortOpen = false; //Port 22
|
|
|
|
this.ftpPortOpen = false; //Port 21
|
|
|
|
this.smtpPortOpen = false; //Port 25
|
|
|
|
this.httpPortOpen = false; //Port 80
|
|
|
|
this.sqlPortOpen = false; //Port 1433
|
|
|
|
this.openPortCount = 0;
|
2016-10-17 23:23:23 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
//Initialize the properties of a server
|
2016-10-18 23:37:53 +02:00
|
|
|
Server.prototype.init = function(ip, hostname, organizationName, onlineStatus, isConnectedTo, adminRights, purchasedByPlayer, maxRam) {
|
2016-10-17 23:23:23 +02:00
|
|
|
this.ip = ip;
|
2017-05-06 21:12:45 +02:00
|
|
|
|
|
|
|
//Check if hostname is unique
|
|
|
|
var i = 0;
|
|
|
|
while (GetServerByHostname(hostname) != null) {
|
|
|
|
//Server already exists
|
|
|
|
hostname = hostname + "-" + i;
|
|
|
|
++i;
|
|
|
|
}
|
2016-10-17 23:23:23 +02:00
|
|
|
this.hostname = hostname;
|
2016-10-18 23:37:53 +02:00
|
|
|
this.organizationName = organizationName;
|
2016-10-17 23:23:23 +02:00
|
|
|
this.isOnline = onlineStatus;
|
|
|
|
this.isConnectedTo = isConnectedTo;
|
|
|
|
this.hasAdminRights = adminRights;
|
|
|
|
this.purchasedByPlayer = purchasedByPlayer;
|
|
|
|
this.maxRam = maxRam;
|
|
|
|
}
|
|
|
|
|
2016-10-18 23:37:53 +02:00
|
|
|
//Set the hacking properties of a server
|
2016-10-19 23:43:49 +02:00
|
|
|
Server.prototype.setHackingParameters = function(requiredHackingSkill, moneyAvailable, hackDifficulty, serverGrowth) {
|
2016-10-18 23:37:53 +02:00
|
|
|
this.requiredHackingSkill = requiredHackingSkill;
|
|
|
|
this.moneyAvailable = moneyAvailable;
|
|
|
|
this.hackDifficulty = hackDifficulty;
|
|
|
|
this.serverGrowth = serverGrowth;
|
|
|
|
}
|
|
|
|
|
2016-10-24 23:16:51 +02:00
|
|
|
//Set the port properties of a server
|
|
|
|
//Right now its only the number of open ports needed to PortHack the server.
|
|
|
|
Server.prototype.setPortProperties = function(numOpenPortsReq) {
|
|
|
|
this.numOpenPortsRequired = numOpenPortsReq;
|
|
|
|
}
|
|
|
|
|
2016-12-01 23:18:18 +01:00
|
|
|
//The serverOnNetwork array holds the IP of all the servers. This function
|
|
|
|
//returns the actual Server objects
|
|
|
|
Server.prototype.getServerOnNetwork = function(i) {
|
|
|
|
if (i > this.serversOnNetwork.length) {
|
|
|
|
console.log("Tried to get server on network that was out of range");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
return AllServers[this.serversOnNetwork[i]];
|
2016-10-19 23:43:49 +02:00
|
|
|
}
|
|
|
|
|
2016-12-15 18:51:23 +01:00
|
|
|
//Given the name of the script, returns the corresponding
|
|
|
|
//script object on the server (if it exists)
|
|
|
|
Server.prototype.getScript = function(scriptName) {
|
|
|
|
for (var i = 0; i < this.scripts.length; i++) {
|
|
|
|
if (this.scripts[i].filename == scriptName) {
|
|
|
|
return this.scripts[i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2016-12-01 23:18:18 +01:00
|
|
|
//Functions for loading and saving a Server
|
|
|
|
Server.prototype.toJSON = function() {
|
|
|
|
return Generic_toJSON("Server", this);
|
2016-10-18 23:37:53 +02:00
|
|
|
}
|
|
|
|
|
2016-12-01 23:18:18 +01:00
|
|
|
Server.fromJSON = function(value) {
|
|
|
|
return Generic_fromJSON(Server, value.data);
|
|
|
|
}
|
|
|
|
|
|
|
|
Reviver.constructors.Server = Server;
|
|
|
|
|
2016-12-15 18:51:23 +01:00
|
|
|
//world_daemon: new Server(), //Final server for 2nd tier prestige. Discover that the world is a simulation
|
2016-10-20 20:07:12 +02:00
|
|
|
|
2016-12-01 23:18:18 +01:00
|
|
|
initForeignServers = function() {
|
|
|
|
//MegaCorporations
|
|
|
|
var ECorpServer = new Server();
|
2017-04-23 04:32:51 +02:00
|
|
|
ECorpServer.init(createRandomIp(), "ecorp", "ECorp", true, false, false, false, 0);
|
2016-12-01 23:18:18 +01:00
|
|
|
ECorpServer.setHackingParameters(900, 100000000000, 99, 99);
|
|
|
|
ECorpServer.setPortProperties(5);
|
|
|
|
AddToAllServers(ECorpServer);
|
|
|
|
|
|
|
|
var MegaCorpServer = new Server();
|
2017-04-23 04:32:51 +02:00
|
|
|
MegaCorpServer.init(createRandomIp(), "megacorp", "MegaCorp", true, false, false, false, 0);
|
2016-12-01 23:18:18 +01:00
|
|
|
MegaCorpServer.setHackingParameters(900, 80000000000, 99, 99);
|
|
|
|
MegaCorpServer.setPortProperties(5);
|
|
|
|
AddToAllServers(MegaCorpServer);
|
|
|
|
|
|
|
|
var BachmanAndAssociatesServer = new Server();
|
2017-04-23 04:32:51 +02:00
|
|
|
BachmanAndAssociatesServer.init(createRandomIp(), "b-and-a", "Bachman & Associates", true, false, false, false, 0);
|
2016-12-01 23:18:18 +01:00
|
|
|
BachmanAndAssociatesServer.setHackingParameters(900, 32000000000, 80, 70);
|
|
|
|
BachmanAndAssociatesServer.setPortProperties(5);
|
|
|
|
AddToAllServers(BachmanAndAssociatesServer);
|
|
|
|
|
|
|
|
var BladeIndustriesServer = new Server();
|
2017-04-23 04:32:51 +02:00
|
|
|
BladeIndustriesServer.init(createRandomIp(), "blade", "Blade Industries", true, false, false, false, 0);
|
2016-12-01 23:18:18 +01:00
|
|
|
BladeIndustriesServer.setHackingParameters(900, 20000000000, 90, 65);
|
|
|
|
BladeIndustriesServer.setPortProperties(5);
|
|
|
|
AddToAllServers(BladeIndustriesServer);
|
|
|
|
|
|
|
|
var NWOServer = new Server();
|
2017-04-23 04:32:51 +02:00
|
|
|
NWOServer.init(createRandomIp(), "nwo", "New World Order", true, false, false, false, 0);
|
2016-12-01 23:18:18 +01:00
|
|
|
NWOServer.setHackingParameters(900, 40000000000, 99, 80);
|
|
|
|
NWOServer.setPortProperties(5);
|
|
|
|
AddToAllServers(NWOServer);
|
|
|
|
|
|
|
|
var ClarkeIncorporatedServer = new Server();
|
2017-04-23 04:32:51 +02:00
|
|
|
ClarkeIncorporatedServer.init(createRandomIp(), "clarkeinc", "Clarke Incorporated", true, false, false, false, 0);
|
2016-12-01 23:18:18 +01:00
|
|
|
ClarkeIncorporatedServer.setHackingParameters(900, 15000000000, 50, 60);
|
|
|
|
ClarkeIncorporatedServer.setPortProperties(5);
|
|
|
|
AddToAllServers(ClarkeIncorporatedServer);
|
|
|
|
|
|
|
|
var OmniTekIncorporatedServer = new Server();
|
2017-04-23 04:32:51 +02:00
|
|
|
OmniTekIncorporatedServer.init(createRandomIp(), "omnitek", "OmniTek Incorporated", true, false, false, false, 0);
|
2016-12-01 23:18:18 +01:00
|
|
|
OmniTekIncorporatedServer.setHackingParameters(900, 50000000000, 95, 99);
|
|
|
|
OmniTekIncorporatedServer.setPortProperties(5);
|
|
|
|
AddToAllServers(OmniTekIncorporatedServer);
|
|
|
|
|
|
|
|
var FourSigmaServer = new Server();
|
2017-04-23 04:32:51 +02:00
|
|
|
FourSigmaServer.init(createRandomIp(), "4sigma", "FourSigma", true, false, false, false, 0);
|
2016-12-01 23:18:18 +01:00
|
|
|
FourSigmaServer.setHackingParameters(900, 25000000000, 60, 80);
|
|
|
|
FourSigmaServer.setPortProperties(5);
|
|
|
|
AddToAllServers(FourSigmaServer);
|
|
|
|
|
|
|
|
var KuaiGongInternationalServer = new Server();
|
2017-04-23 04:32:51 +02:00
|
|
|
KuaiGongInternationalServer.init(createRandomIp(), "kuai-gong", "KuaiGong International", true, false, false, false, 0);
|
2016-12-01 23:18:18 +01:00
|
|
|
KuaiGongInternationalServer.setHackingParameters(925, 75000000000, 99, 99);
|
|
|
|
KuaiGongInternationalServer.setPortProperties(5);
|
|
|
|
AddToAllServers(KuaiGongInternationalServer);
|
|
|
|
|
|
|
|
//Technology and communications companies (large targets)
|
|
|
|
var FulcrumTechnologiesServer = new Server();
|
2017-04-23 04:32:51 +02:00
|
|
|
FulcrumTechnologiesServer.init(createRandomIp(), "fulcrumtech", "Fulcrum Technologies", true, false, false, false, 64);
|
2016-12-01 23:18:18 +01:00
|
|
|
FulcrumTechnologiesServer.setHackingParameters(900, 2000000000, 90, 85);
|
|
|
|
FulcrumTechnologiesServer.setPortProperties(5);
|
|
|
|
AddToAllServers(FulcrumTechnologiesServer);
|
2017-02-09 23:40:55 +01:00
|
|
|
|
2016-12-01 23:18:18 +01:00
|
|
|
var FulcrumSecretTechnologiesServer = new Server();
|
2017-04-23 04:32:51 +02:00
|
|
|
FulcrumSecretTechnologiesServer.init(createRandomIp(), "fulcrumassets", "Fulcrum Technologies Assets", true, false, false, false, 0);
|
2016-12-01 23:18:18 +01:00
|
|
|
FulcrumSecretTechnologiesServer.setHackingParameters(999, 1000000, 99, 1);
|
|
|
|
FulcrumSecretTechnologiesServer.setPortProperties(5);
|
|
|
|
AddToAllServers(FulcrumSecretTechnologiesServer);
|
2017-02-09 23:40:55 +01:00
|
|
|
|
2017-02-16 19:52:11 +01:00
|
|
|
SpecialServerIps.addIp("Fulcrum Secret Technologies Server", FulcrumSecretTechnologiesServer.ip);
|
2016-12-01 23:18:18 +01:00
|
|
|
|
|
|
|
var StormTechnologiesServer = new Server();
|
2017-04-23 04:32:51 +02:00
|
|
|
StormTechnologiesServer.init(createRandomIp(), "stormtech", "Storm Technologies", true, false, false, false, 0);
|
2016-12-01 23:18:18 +01:00
|
|
|
StormTechnologiesServer.setHackingParameters(850, 1500000000, 85, 80);
|
|
|
|
StormTechnologiesServer.setPortProperties(5);
|
|
|
|
AddToAllServers(StormTechnologiesServer);
|
|
|
|
|
|
|
|
var DefCommServer = new Server();
|
2017-04-23 04:32:51 +02:00
|
|
|
DefCommServer.init(createRandomIp(), "defcomm", "DefComm", true, false, false, false, 0);
|
2016-12-01 23:18:18 +01:00
|
|
|
DefCommServer.setHackingParameters(825, 900000000, 90, 60);
|
|
|
|
DefCommServer.setPortProperties(5);
|
|
|
|
AddToAllServers(DefCommServer);
|
|
|
|
|
|
|
|
var InfoCommServer = new Server();
|
2017-04-23 04:32:51 +02:00
|
|
|
InfoCommServer.init(createRandomIp(), "infocomm", "InfoComm", true, false, false, false, 0);
|
2016-12-01 23:18:18 +01:00
|
|
|
InfoCommServer.setHackingParameters(830, 750000000, 80, 50);
|
|
|
|
InfoCommServer.setPortProperties(5);
|
|
|
|
AddToAllServers(InfoCommServer);
|
|
|
|
|
|
|
|
var HeliosLabsServer = new Server();
|
2017-04-23 04:32:51 +02:00
|
|
|
HeliosLabsServer.init(createRandomIp(), "helios", "Helios Labs", true, false, false, false, 0);
|
2016-12-01 23:18:18 +01:00
|
|
|
HeliosLabsServer.setHackingParameters(800, 500000000, 90, 75);
|
|
|
|
HeliosLabsServer.setPortProperties(5);
|
|
|
|
AddToAllServers(HeliosLabsServer);
|
|
|
|
|
|
|
|
var VitaLifeServer = new Server();
|
2017-04-23 04:32:51 +02:00
|
|
|
VitaLifeServer.init(createRandomIp(), "vitalife", "VitaLife", true, false, false, false, 32);
|
2016-12-01 23:18:18 +01:00
|
|
|
VitaLifeServer.setHackingParameters(775, 800000000, 85, 70);
|
|
|
|
VitaLifeServer.setPortProperties(5);
|
|
|
|
AddToAllServers(VitaLifeServer);
|
|
|
|
|
|
|
|
var IcarusMicrosystemsServer = new Server();
|
2017-04-23 04:32:51 +02:00
|
|
|
IcarusMicrosystemsServer.init(createRandomIp(), "icarus", "Icarus Microsystems", true, false, false, false, 0);
|
2016-12-01 23:18:18 +01:00
|
|
|
IcarusMicrosystemsServer.setHackingParameters(810, 1100000000, 90, 90);
|
|
|
|
IcarusMicrosystemsServer.setPortProperties(5);
|
|
|
|
AddToAllServers(IcarusMicrosystemsServer);
|
|
|
|
|
|
|
|
var UniversalEnergyServer = new Server();
|
2017-04-23 04:32:51 +02:00
|
|
|
UniversalEnergyServer.init(createRandomIp(), "univ-energy", "Universal Energy", true, false, false, false, 32);
|
2016-12-01 23:18:18 +01:00
|
|
|
UniversalEnergyServer.setHackingParameters(790, 1500000000, 85, 85);
|
|
|
|
UniversalEnergyServer.setPortProperties(4);
|
|
|
|
AddToAllServers(UniversalEnergyServer);
|
|
|
|
|
|
|
|
var TitanLabsServer = new Server();
|
2017-04-23 04:32:51 +02:00
|
|
|
TitanLabsServer.init(createRandomIp(), "titan-labs", "Titan Laboratories", true, false, false, false, 32);
|
2016-12-01 23:18:18 +01:00
|
|
|
TitanLabsServer.setHackingParameters(795, 1000000000, 75, 70);
|
|
|
|
TitanLabsServer.setPortProperties(5);
|
|
|
|
AddToAllServers(TitanLabsServer);
|
|
|
|
|
|
|
|
var MicrodyneTechnologiesServer = new Server();
|
2017-04-23 04:32:51 +02:00
|
|
|
MicrodyneTechnologiesServer.init(createRandomIp(), "microdyne", "Microdyne Technologies", true, false, false, false, 16);
|
2016-12-01 23:18:18 +01:00
|
|
|
MicrodyneTechnologiesServer.setHackingParameters(800, 900000000, 70, 80);
|
|
|
|
MicrodyneTechnologiesServer.setPortProperties(5);
|
|
|
|
AddToAllServers(MicrodyneTechnologiesServer);
|
2016-10-24 08:34:04 +02:00
|
|
|
|
2016-12-01 23:18:18 +01:00
|
|
|
var TaiYangDigitalServer = new Server();
|
2017-04-23 04:32:51 +02:00
|
|
|
TaiYangDigitalServer.init(createRandomIp(), "taiyang-digital", "Taiyang Digital", true, false, false, false, 0);
|
2016-12-01 23:18:18 +01:00
|
|
|
TaiYangDigitalServer.setHackingParameters(850, 1100000000, 75, 75);
|
|
|
|
TaiYangDigitalServer.setPortProperties(5);
|
|
|
|
AddToAllServers(TaiYangDigitalServer);
|
2016-10-24 08:34:04 +02:00
|
|
|
|
2016-12-01 23:18:18 +01:00
|
|
|
var GalacticCyberSystemsServer = new Server();
|
2017-04-23 04:32:51 +02:00
|
|
|
GalacticCyberSystemsServer.init(createRandomIp(), "galactic-cyber", "Galactic Cybersystems", true, false, false, false, 0);
|
2016-12-01 23:18:18 +01:00
|
|
|
GalacticCyberSystemsServer.setHackingParameters(825, 500000000, 60, 80);
|
|
|
|
GalacticCyberSystemsServer.setPortProperties(5);
|
|
|
|
AddToAllServers(GalacticCyberSystemsServer);
|
|
|
|
|
|
|
|
//Defense Companies ("Large" Companies)
|
|
|
|
var AeroCorpServer = new Server();
|
2017-04-23 04:32:51 +02:00
|
|
|
AeroCorpServer.init(createRandomIp(), "aerocorp", "AeroCorp", true, false, false, false, 0);
|
2016-12-01 23:18:18 +01:00
|
|
|
AeroCorpServer.setHackingParameters(850, 1500000000, 85, 60);
|
|
|
|
AeroCorpServer.setPortProperties(5);
|
|
|
|
AddToAllServers(AeroCorpServer);
|
|
|
|
|
|
|
|
var OmniaCybersystemsServer = new Server();
|
2017-04-23 04:32:51 +02:00
|
|
|
OmniaCybersystemsServer.init(createRandomIp(), "omnia", "Omnia Cybersystems", true, false, false, false, 0);
|
2016-12-01 23:18:18 +01:00
|
|
|
OmniaCybersystemsServer.setHackingParameters(825, 1200000000, 90, 65);
|
|
|
|
OmniaCybersystemsServer.setPortProperties(5);
|
|
|
|
AddToAllServers(OmniaCybersystemsServer);
|
|
|
|
|
|
|
|
var ZBDefenseServer = new Server();
|
2017-04-23 04:32:51 +02:00
|
|
|
ZBDefenseServer.init(createRandomIp(), "zb-def", "ZB Defense Industries", true, false, false, false, 0);
|
2016-12-01 23:18:18 +01:00
|
|
|
ZBDefenseServer.setHackingParameters(800, 1000000000, 60, 70);
|
|
|
|
ZBDefenseServer.setPortProperties(4);
|
|
|
|
AddToAllServers(ZBDefenseServer);
|
|
|
|
|
|
|
|
var AppliedEnergeticsServer = new Server();
|
2017-04-23 04:32:51 +02:00
|
|
|
AppliedEnergeticsServer.init(createRandomIp(), "applied-energetics", "Applied Energetics", true, false, false, false, 0);
|
2016-12-01 23:18:18 +01:00
|
|
|
AppliedEnergeticsServer.setHackingParameters(775, 1200000000, 70, 72);
|
|
|
|
AppliedEnergeticsServer.setPortProperties(4);
|
|
|
|
AddToAllServers(AppliedEnergeticsServer);
|
|
|
|
|
|
|
|
var SolarisSpaceSystemsServer = new Server();
|
2017-04-23 04:32:51 +02:00
|
|
|
SolarisSpaceSystemsServer.init(createRandomIp(), "solaris", "Solaris Space Systems", true, false, false, false, 0);
|
2016-12-01 23:18:18 +01:00
|
|
|
SolarisSpaceSystemsServer.setHackingParameters(800, 900000000, 75, 75);
|
|
|
|
SolarisSpaceSystemsServer.setPortProperties(5);
|
|
|
|
AddToAllServers(SolarisSpaceSystemsServer);
|
|
|
|
|
|
|
|
var DeltaOneServer = new Server();
|
2017-04-23 04:32:51 +02:00
|
|
|
DeltaOneServer.init(createRandomIp(), "deltaone", "Delta One", true, false, false, false, 0);
|
2016-12-01 23:18:18 +01:00
|
|
|
DeltaOneServer.setHackingParameters(810, 1500000000, 80, 60);
|
|
|
|
DeltaOneServer.setPortProperties(5);
|
|
|
|
AddToAllServers(DeltaOneServer);
|
|
|
|
|
|
|
|
//Health, medicine, pharmaceutical companies ("Large" targets)
|
|
|
|
var GlobalPharmaceuticalsServer = new Server();
|
2017-04-23 04:32:51 +02:00
|
|
|
GlobalPharmaceuticalsServer.init(createRandomIp(), "global-pharm", "Global Pharmaceuticals", true, false, false, false, 16);
|
2016-12-01 23:18:18 +01:00
|
|
|
GlobalPharmaceuticalsServer.setHackingParameters(775, 2000000000, 80, 85);
|
|
|
|
GlobalPharmaceuticalsServer.setPortProperties(4);
|
|
|
|
AddToAllServers(GlobalPharmaceuticalsServer);
|
|
|
|
|
|
|
|
var NovaMedicalServer = new Server();
|
2017-04-23 04:32:51 +02:00
|
|
|
NovaMedicalServer.init(createRandomIp(), "nova-med", "Nova Medical", true, false, false, false, 0);
|
2016-12-01 23:18:18 +01:00
|
|
|
NovaMedicalServer.setHackingParameters(800, 1500000000, 70, 75);
|
|
|
|
NovaMedicalServer.setPortProperties(4);
|
|
|
|
AddToAllServers(NovaMedicalServer);
|
|
|
|
|
|
|
|
var ZeusMedicalServer = new Server();
|
2017-04-23 04:32:51 +02:00
|
|
|
ZeusMedicalServer.init(createRandomIp(), "zeud-med", "Zeus Medical", true, false, false, false, 0);
|
2016-12-01 23:18:18 +01:00
|
|
|
ZeusMedicalServer.setHackingParameters(810, 1750000000, 80, 75);
|
|
|
|
ZeusMedicalServer.setPortProperties(5);
|
|
|
|
AddToAllServers(ZeusMedicalServer);
|
|
|
|
|
|
|
|
var UnitaLifeGroupServer = new Server();
|
2017-04-23 04:32:51 +02:00
|
|
|
UnitaLifeGroupServer.init(createRandomIp(), "unitalife", "UnitaLife Group", true, false, false, false, 32);
|
2016-12-01 23:18:18 +01:00
|
|
|
UnitaLifeGroupServer.setHackingParameters(790, 1400000000, 75, 75);
|
|
|
|
UnitaLifeGroupServer.setPortProperties(4);
|
|
|
|
AddToAllServers(UnitaLifeGroupServer);
|
|
|
|
|
|
|
|
//"Medium level" targets
|
|
|
|
var LexoCorpServer = new Server();
|
2017-04-23 04:32:51 +02:00
|
|
|
LexoCorpServer.init(createRandomIp(), "lexo-corp", "Lexo Corporation", true, false, false, false, 16);
|
2016-12-01 23:18:18 +01:00
|
|
|
LexoCorpServer.setHackingParameters(700, 1000000000, 70, 60);
|
|
|
|
LexoCorpServer.setPortProperties(4);
|
|
|
|
AddToAllServers(LexoCorpServer);
|
|
|
|
|
|
|
|
var RhoConstructionServer = new Server();
|
2017-04-23 04:32:51 +02:00
|
|
|
RhoConstructionServer.init(createRandomIp(), "rho-construction", "Rho Construction", true, false, false, false, 0);
|
2016-12-01 23:18:18 +01:00
|
|
|
RhoConstructionServer.setHackingParameters(500, 750000000, 50, 50);
|
|
|
|
RhoConstructionServer.setPortProperties(3);
|
|
|
|
AddToAllServers(RhoConstructionServer);
|
|
|
|
|
|
|
|
var AlphaEnterprisesServer = new Server();
|
2017-04-25 22:18:00 +02:00
|
|
|
AlphaEnterprisesServer.init(createRandomIp(), "alpha-ent", "Alpha Enterprises", true, false, false, false, 0);
|
2016-12-01 23:18:18 +01:00
|
|
|
AlphaEnterprisesServer.setHackingParameters(550, 800000000, 60, 55);
|
|
|
|
AlphaEnterprisesServer.setPortProperties(4);
|
|
|
|
AddToAllServers(AlphaEnterprisesServer);
|
|
|
|
|
|
|
|
|
|
|
|
var AevumPoliceServer = new Server();
|
2017-04-23 04:32:51 +02:00
|
|
|
AevumPoliceServer.init(createRandomIp(), "aevum-police", "Aevum Police Network", true, false, false, false, 0);
|
2016-12-01 23:18:18 +01:00
|
|
|
AevumPoliceServer.setHackingParameters(425, 100000000, 75, 40);
|
|
|
|
AevumPoliceServer.setPortProperties(4);
|
|
|
|
AddToAllServers(AevumPoliceServer);
|
|
|
|
|
|
|
|
var RothmanUniversityServer = new Server();
|
2017-04-23 04:32:51 +02:00
|
|
|
RothmanUniversityServer.init(createRandomIp(), "rothman-uni", "Rothman University Network", true, false, false, false, 4);
|
2016-12-01 23:18:18 +01:00
|
|
|
RothmanUniversityServer.setHackingParameters(400, 250000000, 50, 40);
|
|
|
|
RothmanUniversityServer.setPortProperties(3);
|
|
|
|
AddToAllServers(RothmanUniversityServer);
|
|
|
|
|
|
|
|
var ZBInstituteOfTechnologyServer = new Server();
|
2017-04-23 04:32:51 +02:00
|
|
|
ZBInstituteOfTechnologyServer.init(createRandomIp(), "zb-institute", "ZB Institute of Technology Network", true, false, false, false, 4);
|
2016-12-01 23:18:18 +01:00
|
|
|
ZBInstituteOfTechnologyServer.setHackingParameters(750, 1000000000, 75, 80);
|
|
|
|
ZBInstituteOfTechnologyServer.setPortProperties(5);
|
|
|
|
AddToAllServers(ZBInstituteOfTechnologyServer);
|
|
|
|
|
|
|
|
var SummitUniversityServer = new Server();
|
2017-04-23 04:32:51 +02:00
|
|
|
SummitUniversityServer.init(createRandomIp(), "summit-uni", "Summit University Network", true, false, false, false, 4);
|
2016-12-01 23:18:18 +01:00
|
|
|
SummitUniversityServer.setHackingParameters(450, 200000000, 55, 50);
|
|
|
|
SummitUniversityServer.setPortProperties(3);
|
|
|
|
AddToAllServers(SummitUniversityServer);
|
|
|
|
|
|
|
|
var SysCoreSecuritiesServer = new Server();
|
2017-04-23 04:32:51 +02:00
|
|
|
SysCoreSecuritiesServer.init(createRandomIp(), "syscore", "SysCore Securities", true, false, false, false, 0);
|
2016-12-01 23:18:18 +01:00
|
|
|
SysCoreSecuritiesServer.setHackingParameters(600, 600000000, 70, 65);
|
|
|
|
SysCoreSecuritiesServer.setPortProperties(4);
|
|
|
|
AddToAllServers(SysCoreSecuritiesServer);
|
|
|
|
|
|
|
|
var CatalystVenturesServer = new Server();
|
2017-04-23 04:32:51 +02:00
|
|
|
CatalystVenturesServer.init(createRandomIp(), "catalyst", "Catalyst Ventures", true, false, false, false, 0);
|
2016-12-01 23:18:18 +01:00
|
|
|
CatalystVenturesServer.setHackingParameters(425, 900000000, 65, 40);
|
|
|
|
CatalystVenturesServer.setPortProperties(3);
|
|
|
|
AddToAllServers(CatalystVenturesServer);
|
|
|
|
|
|
|
|
var TheHubServer = new Server();
|
2017-04-23 04:32:51 +02:00
|
|
|
TheHubServer.init(createRandomIp(), "the-hub", "The Hub", true, false, false, false, 0);
|
2016-12-01 23:18:18 +01:00
|
|
|
TheHubServer.setHackingParameters(300, 250000000, 40, 50);
|
|
|
|
TheHubServer.setPortProperties(2);
|
|
|
|
AddToAllServers(TheHubServer);
|
|
|
|
|
|
|
|
var CompuTekServer = new Server();
|
2017-04-23 04:32:51 +02:00
|
|
|
CompuTekServer.init(createRandomIp(), "comptek", "CompuTek", true, false, false, false, 8);
|
2016-12-01 23:18:18 +01:00
|
|
|
CompuTekServer.setHackingParameters(350, 300000000, 60, 55);
|
|
|
|
CompuTekServer.setPortProperties(3);
|
|
|
|
AddToAllServers(CompuTekServer);
|
2016-10-20 20:07:12 +02:00
|
|
|
|
2016-12-01 23:18:18 +01:00
|
|
|
var NetLinkTechnologiesServer = new Server();
|
2017-04-25 22:18:00 +02:00
|
|
|
NetLinkTechnologiesServer.init(createRandomIp(), "netlink", "NetLink Technologies", true, false, false, false, 0);
|
2016-12-01 23:18:18 +01:00
|
|
|
NetLinkTechnologiesServer.setHackingParameters(400, 350000000, 70, 60);
|
|
|
|
NetLinkTechnologiesServer.setPortProperties(3);
|
|
|
|
AddToAllServers(NetLinkTechnologiesServer);
|
2016-10-24 08:34:04 +02:00
|
|
|
|
2016-12-01 23:18:18 +01:00
|
|
|
var JohnsonOrthopedicsServer = new Server();
|
2017-04-23 04:32:51 +02:00
|
|
|
JohnsonOrthopedicsServer.init(createRandomIp(), "johnson-ortho", "Johnson Orthopedics", true, false, false, false, 4);
|
2016-12-01 23:18:18 +01:00
|
|
|
JohnsonOrthopedicsServer.setHackingParameters(275, 100000000, 50, 50);
|
|
|
|
JohnsonOrthopedicsServer.setPortProperties(2);
|
|
|
|
AddToAllServers(JohnsonOrthopedicsServer);
|
|
|
|
|
|
|
|
//"Low level" targets
|
|
|
|
var FoodNStuffServer = new Server();
|
2017-05-10 23:10:06 +02:00
|
|
|
FoodNStuffServer.init(createRandomIp(), "foodnstuff", "Food N Stuff Supermarket", true, false, false, false, 4);
|
2017-05-30 00:37:38 +02:00
|
|
|
FoodNStuffServer.setHackingParameters(1, 1000000, 10, 5);
|
2016-12-01 23:18:18 +01:00
|
|
|
FoodNStuffServer.setPortProperties(0);
|
|
|
|
AddToAllServers(FoodNStuffServer);
|
|
|
|
|
|
|
|
var SigmaCosmeticsServer = new Server();
|
2017-05-10 23:10:06 +02:00
|
|
|
SigmaCosmeticsServer.init(createRandomIp(), "sigma-cosmetics", "Sigma Cosmetics", true, false, false, false, 4);
|
2017-05-30 00:37:38 +02:00
|
|
|
SigmaCosmeticsServer.setHackingParameters(5, 1300000, 10, 10);
|
2016-12-01 23:18:18 +01:00
|
|
|
SigmaCosmeticsServer.setPortProperties(0);
|
|
|
|
AddToAllServers(SigmaCosmeticsServer);
|
|
|
|
|
|
|
|
var JoesGunsServer = new Server();
|
2017-05-10 23:10:06 +02:00
|
|
|
JoesGunsServer.init(createRandomIp(), "joesguns", "Joe's Guns", true, false, false, false, 4);
|
2017-05-30 00:37:38 +02:00
|
|
|
JoesGunsServer.setHackingParameters(10, 1750000, 20, 20);
|
2016-12-01 23:18:18 +01:00
|
|
|
JoesGunsServer.setPortProperties(0);
|
|
|
|
AddToAllServers(JoesGunsServer);
|
|
|
|
|
|
|
|
var Zer0NightclubServer = new Server();
|
2017-04-25 22:18:00 +02:00
|
|
|
Zer0NightclubServer.init(createRandomIp(), "zer0", "ZER0 Nightclub", true, false, false, false, 2);
|
2017-05-22 17:55:39 +02:00
|
|
|
Zer0NightclubServer.setHackingParameters(75, 7500000, 25, 40);
|
2016-12-01 23:18:18 +01:00
|
|
|
Zer0NightclubServer.setPortProperties(1);
|
|
|
|
AddToAllServers(Zer0NightclubServer);
|
|
|
|
|
|
|
|
var NectarNightclubServer = new Server();
|
2017-05-10 23:10:06 +02:00
|
|
|
NectarNightclubServer.init(createRandomIp(), "nectar-net", "Nectar Nightclub Network", true, false, false, false, 4);
|
2017-05-30 00:37:38 +02:00
|
|
|
NectarNightclubServer.setHackingParameters(20, 2000000, 20, 25);
|
2016-12-01 23:18:18 +01:00
|
|
|
NectarNightclubServer.setPortProperties(0);
|
|
|
|
AddToAllServers(NectarNightclubServer);
|
|
|
|
|
|
|
|
var NeoNightclubServer = new Server();
|
2017-04-24 03:43:41 +02:00
|
|
|
NeoNightclubServer.init(createRandomIp(), "neo-net", "Neo Nightclub Network", true, false, false, false, 2);
|
2017-05-30 00:37:38 +02:00
|
|
|
NeoNightclubServer.setHackingParameters(50, 4500000, 25, 25);
|
2016-12-01 23:18:18 +01:00
|
|
|
NeoNightclubServer.setPortProperties(1);
|
|
|
|
AddToAllServers(NeoNightclubServer);
|
|
|
|
|
|
|
|
var SilverHelixServer = new Server();
|
2017-04-23 04:32:51 +02:00
|
|
|
SilverHelixServer.init(createRandomIp(), "silver-helix", "Silver Helix", true, false, false, false, 2);
|
2017-05-22 17:39:51 +02:00
|
|
|
SilverHelixServer.setHackingParameters(150, 55000000, 30, 30);
|
2016-12-01 23:18:18 +01:00
|
|
|
SilverHelixServer.setPortProperties(2);
|
|
|
|
AddToAllServers(SilverHelixServer);
|
|
|
|
|
|
|
|
var HongFangTeaHouseServer = new Server();
|
2017-05-10 23:10:06 +02:00
|
|
|
HongFangTeaHouseServer.init(createRandomIp(), "hong-fang-tea", "HongFang Teahouse", true, false, false, false, 4);
|
2017-05-30 00:37:38 +02:00
|
|
|
HongFangTeaHouseServer.setHackingParameters(30, 2500000, 15, 15);
|
2017-04-23 04:32:51 +02:00
|
|
|
HongFangTeaHouseServer.setPortProperties(0);
|
2016-12-01 23:18:18 +01:00
|
|
|
AddToAllServers(HongFangTeaHouseServer);
|
|
|
|
|
|
|
|
var HaraKiriSushiBarServer = new Server();
|
2017-05-30 00:37:38 +02:00
|
|
|
HaraKiriSushiBarServer.setHackingParameters(40, 3500000, 15, 40);
|
2017-05-10 23:10:06 +02:00
|
|
|
HaraKiriSushiBarServer.init(createRandomIp(), "harakiri-sushi", "HaraKiri Sushi Bar Network", true, false, false, false, 4);
|
2017-05-15 19:49:49 +02:00
|
|
|
HaraKiriSushiBarServer.setPortProperties(0);
|
2016-12-01 23:18:18 +01:00
|
|
|
AddToAllServers(HaraKiriSushiBarServer);
|
|
|
|
|
|
|
|
var PhantasyServer = new Server();
|
2017-05-10 23:10:06 +02:00
|
|
|
PhantasyServer.init(createRandomIp(), "phantasy", "Phantasy Club", true, false, false, false, 0);
|
2017-05-22 17:39:51 +02:00
|
|
|
PhantasyServer.setHackingParameters(100, 27500000, 20, 35);
|
2016-12-01 23:18:18 +01:00
|
|
|
PhantasyServer.setPortProperties(2);
|
|
|
|
AddToAllServers(PhantasyServer);
|
|
|
|
|
|
|
|
var MaxHardwareServer = new Server();
|
2017-05-24 17:34:22 +02:00
|
|
|
MaxHardwareServer.init(createRandomIp(), "max-hardware", "Max Hardware Store", true, false, false, false, 2);
|
2017-05-22 17:39:51 +02:00
|
|
|
MaxHardwareServer.setHackingParameters(80, 11000000, 15, 25);
|
2016-12-01 23:18:18 +01:00
|
|
|
MaxHardwareServer.setPortProperties(1);
|
|
|
|
AddToAllServers(MaxHardwareServer);
|
|
|
|
|
|
|
|
var OmegaSoftwareServer = new Server();
|
2017-04-23 04:32:51 +02:00
|
|
|
OmegaSoftwareServer.init(createRandomIp(), "omega-net", "Omega Software", true, false, false, false, 8);
|
2017-05-22 17:39:51 +02:00
|
|
|
OmegaSoftwareServer.setHackingParameters(200, 85000000, 30, 35);
|
2016-12-01 23:18:18 +01:00
|
|
|
OmegaSoftwareServer.setPortProperties(2);
|
|
|
|
AddToAllServers(OmegaSoftwareServer);
|
|
|
|
|
|
|
|
//Gyms
|
|
|
|
var CrushFitnessGymServer = new Server();
|
2017-04-23 04:32:51 +02:00
|
|
|
CrushFitnessGymServer.init(createRandomIp(), "crush-fitness", "Crush Fitness", true, false, false, false, 0);
|
2017-05-22 17:55:39 +02:00
|
|
|
CrushFitnessGymServer.setHackingParameters(250, 40000000, 40, 30);
|
2016-12-01 23:18:18 +01:00
|
|
|
CrushFitnessGymServer.setPortProperties(2);
|
|
|
|
AddToAllServers(CrushFitnessGymServer);
|
|
|
|
|
|
|
|
var IronGymServer = new Server();
|
2017-05-24 17:34:22 +02:00
|
|
|
IronGymServer.init(createRandomIp(), "iron-gym", "Iron Gym Network", true, false, false, false, 2);
|
2017-05-22 17:55:39 +02:00
|
|
|
IronGymServer.setHackingParameters(100, 20000000, 30, 20);
|
2016-12-01 23:18:18 +01:00
|
|
|
IronGymServer.setPortProperties(1);
|
|
|
|
AddToAllServers(IronGymServer);
|
|
|
|
|
|
|
|
var MilleniumFitnessGymServer = new Server();
|
2017-04-23 04:32:51 +02:00
|
|
|
MilleniumFitnessGymServer.init(createRandomIp(), "millenium-fitness", "Millenium Fitness Network", true, false, false, false, 0);
|
2017-05-22 17:55:39 +02:00
|
|
|
MilleniumFitnessGymServer.setHackingParameters(500, 100000000, 50, 35);
|
2016-12-01 23:18:18 +01:00
|
|
|
MilleniumFitnessGymServer.setPortProperties(3);
|
|
|
|
AddToAllServers(MilleniumFitnessGymServer);
|
|
|
|
|
|
|
|
var PowerhouseGymServer = new Server();
|
2017-04-23 04:32:51 +02:00
|
|
|
PowerhouseGymServer.init(createRandomIp(), "powerhouse-fitness", "Powerhouse Fitness", true, false, false, false, 0);
|
2017-05-22 17:55:39 +02:00
|
|
|
PowerhouseGymServer.setHackingParameters(1000, 300000000, 60, 55);
|
2016-12-01 23:18:18 +01:00
|
|
|
PowerhouseGymServer.setPortProperties(5);
|
|
|
|
AddToAllServers(PowerhouseGymServer);
|
|
|
|
|
|
|
|
var SnapFitnessGymServer = new Server();
|
2017-04-23 04:32:51 +02:00
|
|
|
SnapFitnessGymServer.init(createRandomIp(), "snap-fitness", "Snap Fitness", true, false, false, false, 0);
|
2017-05-22 17:55:39 +02:00
|
|
|
SnapFitnessGymServer.setHackingParameters(750, 150000000, 50, 50);
|
2016-12-01 23:18:18 +01:00
|
|
|
SnapFitnessGymServer.setPortProperties(4);
|
|
|
|
AddToAllServers(SnapFitnessGymServer);
|
2016-12-22 17:19:02 +01:00
|
|
|
|
|
|
|
//Faction servers, cannot hack money from these
|
|
|
|
var BitRunnersServer = new Server();
|
2017-04-25 22:18:00 +02:00
|
|
|
BitRunnersServer.init(createRandomIp(), "run4theh111z", "The Runners", true, false, false, false, 0);
|
2016-12-22 17:19:02 +01:00
|
|
|
BitRunnersServer.setPortProperties(4);
|
|
|
|
AddToAllServers(BitRunnersServer);
|
|
|
|
|
|
|
|
var NiteSecServer = new Server();
|
2017-04-25 22:18:00 +02:00
|
|
|
NiteSecServer.init(createRandomIp(), "avmnite-02h", "NiteSec", true, false, false, false, 0);
|
2016-12-22 17:19:02 +01:00
|
|
|
NiteSecServer.setPortProperties(2);
|
|
|
|
AddToAllServers(NiteSecServer);
|
|
|
|
|
|
|
|
var DarkArmyServer = new Server();
|
2017-04-25 22:18:00 +02:00
|
|
|
DarkArmyServer.init(createRandomIp(), ".", ".", true, false, false, false, 0);
|
2016-12-22 17:19:02 +01:00
|
|
|
DarkArmyServer.setPortProperties(5);
|
|
|
|
AddToAllServers(DarkArmyServer);
|
|
|
|
|
|
|
|
var CyberSecServer = new Server();
|
2017-04-25 22:18:00 +02:00
|
|
|
CyberSecServer.init(createRandomIp(), "CSEC", "CyberSec", true, false, false, false, 0);
|
2016-12-22 17:19:02 +01:00
|
|
|
CyberSecServer.setPortProperties(2);
|
|
|
|
AddToAllServers(CyberSecServer);
|
|
|
|
|
|
|
|
|
2016-12-01 23:18:18 +01:00
|
|
|
/* Create a randomized network for all the foreign servers */
|
|
|
|
//Groupings for creating a randomized network
|
|
|
|
var NetworkGroup1 = [IronGymServer, FoodNStuffServer, SigmaCosmeticsServer, JoesGunsServer, HongFangTeaHouseServer, HaraKiriSushiBarServer];
|
|
|
|
var NetworkGroup2 = [MaxHardwareServer, NectarNightclubServer, Zer0NightclubServer];
|
|
|
|
var NetworkGroup3 = [OmegaSoftwareServer, PhantasyServer, SilverHelixServer, NeoNightclubServer];
|
|
|
|
var NetworkGroup4 = [CrushFitnessGymServer, NetLinkTechnologiesServer, CompuTekServer, TheHubServer, JohnsonOrthopedicsServer];
|
|
|
|
var NetworkGroup5 = [CatalystVenturesServer, SysCoreSecuritiesServer, SummitUniversityServer, ZBInstituteOfTechnologyServer, RothmanUniversityServer];
|
2016-12-22 17:19:02 +01:00
|
|
|
var NetworkGroup6 = [LexoCorpServer, RhoConstructionServer, AlphaEnterprisesServer, AevumPoliceServer, MilleniumFitnessGymServer, CyberSecServer, NiteSecServer];
|
2016-12-01 23:18:18 +01:00
|
|
|
var NetworkGroup7 = [GlobalPharmaceuticalsServer, AeroCorpServer, GalacticCyberSystemsServer, SnapFitnessGymServer];
|
|
|
|
var NetworkGroup8 = [DeltaOneServer, UnitaLifeGroupServer, OmniaCybersystemsServer];
|
|
|
|
var NetworkGroup9 = [ZeusMedicalServer, SolarisSpaceSystemsServer, UniversalEnergyServer, IcarusMicrosystemsServer, DefCommServer];
|
|
|
|
var NetworkGroup10 = [NovaMedicalServer, ZBDefenseServer, TaiYangDigitalServer, InfoCommServer];
|
2016-12-22 17:19:02 +01:00
|
|
|
var NetworkGroup11 = [AppliedEnergeticsServer, MicrodyneTechnologiesServer, TitanLabsServer, BitRunnersServer];
|
2016-12-01 23:18:18 +01:00
|
|
|
var NetworkGroup12 = [VitaLifeServer, HeliosLabsServer, StormTechnologiesServer, FulcrumTechnologiesServer];
|
2016-12-22 17:19:02 +01:00
|
|
|
var NetworkGroup13 = [KuaiGongInternationalServer, FourSigmaServer, OmniTekIncorporatedServer, DarkArmyServer];
|
2016-12-01 23:18:18 +01:00
|
|
|
var NetworkGroup14 = [PowerhouseGymServer, ClarkeIncorporatedServer, NWOServer, BladeIndustriesServer, BachmanAndAssociatesServer];
|
|
|
|
var NetworkGroup15 = [FulcrumSecretTechnologiesServer, MegaCorpServer, ECorpServer];
|
|
|
|
|
|
|
|
for (var i = 0; i < NetworkGroup2.length; i++) {
|
|
|
|
var randomServerFromPrevGroup = NetworkGroup1[Math.floor(Math.random() * NetworkGroup1.length)];
|
2016-12-14 00:52:32 +01:00
|
|
|
NetworkGroup2[i].serversOnNetwork.push(randomServerFromPrevGroup.ip);
|
|
|
|
randomServerFromPrevGroup.serversOnNetwork.push(NetworkGroup2[i].ip);
|
2016-12-01 23:18:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
for (var i = 0; i < NetworkGroup3.length; i++) {
|
|
|
|
var randomServerFromPrevGroup = NetworkGroup2[Math.floor(Math.random() * NetworkGroup2.length)];
|
2016-12-14 00:52:32 +01:00
|
|
|
NetworkGroup3[i].serversOnNetwork.push(randomServerFromPrevGroup.ip);
|
|
|
|
randomServerFromPrevGroup.serversOnNetwork.push(NetworkGroup3[i].ip);
|
2016-10-24 08:34:04 +02:00
|
|
|
}
|
2016-12-01 23:18:18 +01:00
|
|
|
|
|
|
|
for (var i = 0; i < NetworkGroup4.length; i++) {
|
|
|
|
var randomServerFromPrevGroup = NetworkGroup3[Math.floor(Math.random() * NetworkGroup3.length)];
|
2016-12-14 00:52:32 +01:00
|
|
|
NetworkGroup4[i].serversOnNetwork.push(randomServerFromPrevGroup.ip);
|
|
|
|
randomServerFromPrevGroup.serversOnNetwork.push(NetworkGroup4[i].ip);
|
2016-12-01 23:18:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
for (var i = 0; i < NetworkGroup5.length; i++) {
|
|
|
|
var randomServerFromPrevGroup = NetworkGroup4[Math.floor(Math.random() * NetworkGroup4.length)];
|
2016-12-14 00:52:32 +01:00
|
|
|
NetworkGroup5[i].serversOnNetwork.push(randomServerFromPrevGroup.ip);
|
|
|
|
randomServerFromPrevGroup.serversOnNetwork.push(NetworkGroup5[i].ip);
|
2016-12-01 23:18:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
for (var i = 0; i < NetworkGroup6.length; i++) {
|
|
|
|
var randomServerFromPrevGroup = NetworkGroup5[Math.floor(Math.random() * NetworkGroup5.length)];
|
2016-12-14 00:52:32 +01:00
|
|
|
NetworkGroup6[i].serversOnNetwork.push(randomServerFromPrevGroup.ip);
|
|
|
|
randomServerFromPrevGroup.serversOnNetwork.push(NetworkGroup6[i].ip);
|
2016-12-01 23:18:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
for (var i = 0; i < NetworkGroup7.length; i++) {
|
|
|
|
var randomServerFromPrevGroup = NetworkGroup6[Math.floor(Math.random() * NetworkGroup6.length)];
|
2016-12-14 00:52:32 +01:00
|
|
|
NetworkGroup7[i].serversOnNetwork.push(randomServerFromPrevGroup.ip);
|
|
|
|
randomServerFromPrevGroup.serversOnNetwork.push(NetworkGroup7[i].ip);
|
2016-12-01 23:18:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
for (var i = 0; i < NetworkGroup8.length; i++) {
|
|
|
|
var randomServerFromPrevGroup = NetworkGroup7[Math.floor(Math.random() * NetworkGroup7.length)];
|
2016-12-14 00:52:32 +01:00
|
|
|
NetworkGroup8[i].serversOnNetwork.push(randomServerFromPrevGroup.ip);
|
|
|
|
randomServerFromPrevGroup.serversOnNetwork.push(NetworkGroup8[i].ip);
|
2016-12-01 23:18:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
for (var i = 0; i < NetworkGroup9.length; i++) {
|
|
|
|
var randomServerFromPrevGroup = NetworkGroup8[Math.floor(Math.random() * NetworkGroup8.length)];
|
2016-12-14 00:52:32 +01:00
|
|
|
NetworkGroup9[i].serversOnNetwork.push(randomServerFromPrevGroup.ip);
|
|
|
|
randomServerFromPrevGroup.serversOnNetwork.push(NetworkGroup9[i].ip);
|
2016-12-01 23:18:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
for (var i = 0; i < NetworkGroup10.length; i++) {
|
|
|
|
var randomServerFromPrevGroup = NetworkGroup9[Math.floor(Math.random() * NetworkGroup9.length)];
|
2016-12-14 00:52:32 +01:00
|
|
|
NetworkGroup10[i].serversOnNetwork.push(randomServerFromPrevGroup.ip);
|
|
|
|
randomServerFromPrevGroup.serversOnNetwork.push(NetworkGroup10[i].ip);
|
2016-12-01 23:18:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
for (var i = 0; i < NetworkGroup11.length; i++) {
|
|
|
|
var randomServerFromPrevGroup = NetworkGroup10[Math.floor(Math.random() * NetworkGroup10.length)];
|
2016-12-14 00:52:32 +01:00
|
|
|
NetworkGroup11[i].serversOnNetwork.push(randomServerFromPrevGroup.ip);
|
|
|
|
randomServerFromPrevGroup.serversOnNetwork.push(NetworkGroup11[i].ip);
|
2016-12-01 23:18:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
for (var i = 0; i < NetworkGroup12.length; i++) {
|
|
|
|
var randomServerFromPrevGroup = NetworkGroup11[Math.floor(Math.random() * NetworkGroup11.length)];
|
2016-12-14 00:52:32 +01:00
|
|
|
NetworkGroup12[i].serversOnNetwork.push(randomServerFromPrevGroup.ip);
|
|
|
|
randomServerFromPrevGroup.serversOnNetwork.push(NetworkGroup12[i].ip);
|
2016-12-01 23:18:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
for (var i = 0; i < NetworkGroup13.length; i++) {
|
|
|
|
var randomServerFromPrevGroup = NetworkGroup12[Math.floor(Math.random() * NetworkGroup12.length)];
|
2016-12-14 00:52:32 +01:00
|
|
|
NetworkGroup13[i].serversOnNetwork.push(randomServerFromPrevGroup.ip);
|
|
|
|
randomServerFromPrevGroup.serversOnNetwork.push(NetworkGroup13[i].ip);
|
2016-12-01 23:18:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
for (var i = 0; i < NetworkGroup14.length; i++) {
|
|
|
|
var randomServerFromPrevGroup = NetworkGroup13[Math.floor(Math.random() * NetworkGroup13.length)];
|
2016-12-14 00:52:32 +01:00
|
|
|
NetworkGroup14[i].serversOnNetwork.push(randomServerFromPrevGroup.ip);
|
|
|
|
randomServerFromPrevGroup.serversOnNetwork.push(NetworkGroup14[i].ip);
|
2016-12-01 23:18:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
for (var i = 0; i < NetworkGroup15.length; i++) {
|
|
|
|
var randomServerFromPrevGroup = NetworkGroup14[Math.floor(Math.random() * NetworkGroup14.length)];
|
2016-12-14 00:52:32 +01:00
|
|
|
NetworkGroup15[i].serversOnNetwork.push(randomServerFromPrevGroup.ip);
|
|
|
|
randomServerFromPrevGroup.serversOnNetwork.push(NetworkGroup15[i].ip);
|
2016-12-01 23:18:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
//Connect the first tier of servers to the player's home computer
|
|
|
|
for (var i = 0; i < NetworkGroup1.length; i++) {
|
|
|
|
Player.getHomeComputer().serversOnNetwork.push(NetworkGroup1[i].ip);
|
|
|
|
NetworkGroup1[i].serversOnNetwork.push(Player.homeComputer);
|
|
|
|
}
|
2017-05-02 18:28:54 +02:00
|
|
|
}
|
2016-12-01 23:18:18 +01:00
|
|
|
|
2016-12-20 21:18:34 +01:00
|
|
|
|
|
|
|
//Server growth
|
|
|
|
processServerGrowth = function(numCycles) {
|
2017-05-02 18:28:54 +02:00
|
|
|
//Server growth processed once every 450 game cycles
|
2016-12-20 21:18:34 +01:00
|
|
|
var numServerGrowthCycles = Math.max(Math.floor(numCycles / 450), 0);
|
|
|
|
|
|
|
|
for (var ip in AllServers) {
|
|
|
|
if (AllServers.hasOwnProperty(ip)) {
|
|
|
|
var server = AllServers[ip];
|
|
|
|
|
|
|
|
//Get the number of server growth cycles that will be applied based on the
|
|
|
|
//server's serverGrowth property
|
|
|
|
var serverGrowthPercentage = server.serverGrowth / 100;
|
|
|
|
var numServerGrowthCyclesAdjusted = numServerGrowthCycles * serverGrowthPercentage;
|
|
|
|
|
|
|
|
//Apply serverGrowth for the calculated number of growth cycles
|
2017-05-30 01:12:57 +02:00
|
|
|
var serverGrowth = Math.pow(CONSTANTS.ServerGrowthRate, numServerGrowthCyclesAdjusted) * Player.hacking_grow_mult;
|
2017-05-30 00:37:38 +02:00
|
|
|
if (serverGrowth < 1) {
|
|
|
|
console.log("WARN: serverGrowth calculated to be less than 1");
|
|
|
|
serverGrowth = 1;
|
|
|
|
}
|
2017-04-18 06:32:17 +02:00
|
|
|
//console.log("serverGrowth ratio: " + serverGrowth);
|
2016-12-20 21:18:34 +01:00
|
|
|
server.moneyAvailable *= serverGrowth;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
console.log("Server growth processed for " + numServerGrowthCycles + " cycles");
|
2017-05-02 18:28:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//Applied server growth for a single server. Returns the percentage growth
|
|
|
|
processSingleServerGrowth = function(server, numCycles) {
|
|
|
|
//Server growth processed once every 450 game cycles
|
|
|
|
var numServerGrowthCycles = Math.max(Math.floor(numCycles / 450), 0);
|
|
|
|
|
|
|
|
//Get the number of server growth cycles that will be applied based on the
|
|
|
|
//server's serverGrowth property
|
|
|
|
var serverGrowthPercentage = server.serverGrowth / 100;
|
|
|
|
var numServerGrowthCyclesAdjusted = numServerGrowthCycles * serverGrowthPercentage;
|
|
|
|
|
|
|
|
//Apply serverGrowth for the calculated number of growth cycles
|
2017-05-30 01:12:57 +02:00
|
|
|
var serverGrowth = Math.pow(CONSTANTS.ServerGrowthRate, numServerGrowthCyclesAdjusted) * Player.hacking_grow_mult;
|
2017-05-30 00:37:38 +02:00
|
|
|
if (serverGrowth < 1) {
|
|
|
|
console.log("WARN: serverGrowth calculated to be less than 1");
|
|
|
|
serverGrowth = 1;
|
|
|
|
}
|
2017-05-02 18:28:54 +02:00
|
|
|
server.moneyAvailable *= serverGrowth;
|
|
|
|
|
|
|
|
return serverGrowth;
|
|
|
|
}
|
2016-12-20 21:18:34 +01:00
|
|
|
|
2016-12-01 23:18:18 +01:00
|
|
|
//List of all servers that exist in the game, indexed by their ip
|
|
|
|
AllServers = {};
|
|
|
|
|
2016-12-15 18:51:23 +01:00
|
|
|
SizeOfAllServers = function() {
|
|
|
|
var size = 0, key;
|
|
|
|
for (key in AllServers) {
|
|
|
|
if (AllServers.hasOwnProperty(key)) size++;
|
|
|
|
}
|
|
|
|
return size;
|
|
|
|
}
|
|
|
|
|
2016-12-01 23:18:18 +01:00
|
|
|
//Add a server onto the map of all servers in the game
|
|
|
|
AddToAllServers = function(server) {
|
|
|
|
var serverIp = server.ip;
|
|
|
|
if (ipExists(serverIp)) {
|
|
|
|
console.log("IP of server that's being added: " + serverIp);
|
|
|
|
console.log("Hostname of the server thats being added: " + server.hostname);
|
|
|
|
console.log("The server that already has this IP is: " + AllServers[serverIp].hostname);
|
|
|
|
throw new Error("Error: Trying to add a server with an existing IP");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
AllServers[serverIp] = server;
|
2016-10-18 23:37:53 +02:00
|
|
|
}
|
2016-12-01 23:18:18 +01:00
|
|
|
|
2016-12-15 18:51:23 +01:00
|
|
|
//Returns server object with corresponding hostname
|
|
|
|
// Relatively slow, would rather not use this a lot
|
|
|
|
GetServerByHostname = function(hostname) {
|
|
|
|
for (var ip in AllServers) {
|
|
|
|
if (AllServers.hasOwnProperty(ip)) {
|
|
|
|
if (AllServers[ip].hostname == hostname) {
|
2016-12-20 21:18:34 +01:00
|
|
|
return AllServers[ip];
|
2016-12-15 18:51:23 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2017-05-11 06:20:17 +02:00
|
|
|
//Get server by IP or hostname. Returns null if invalid
|
|
|
|
getServer = function(s) {
|
|
|
|
if (!isValidIPAddress(s)) {
|
|
|
|
return GetServerByHostname(s);
|
|
|
|
} else {
|
|
|
|
return AllServers[s];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-12-01 23:18:18 +01:00
|
|
|
//Debugging tool
|
|
|
|
PrintAllServers = function() {
|
|
|
|
for (var ip in AllServers) {
|
|
|
|
if (AllServers.hasOwnProperty(ip)) {
|
|
|
|
console.log("Ip: " + ip + ", hostname: " + AllServers[ip].hostname);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|