mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-20 05:05:47 +01:00
Adding messages. Changed hacking factions to rely on hacking their specific servers to get the invite. Made Augmentations more expensive
This commit is contained in:
parent
236facab97
commit
94dd4395be
@ -57,6 +57,7 @@
|
|||||||
<script src="src/DarkWeb.js"></script>
|
<script src="src/DarkWeb.js"></script>
|
||||||
<script src="src/InteractiveTutorial.js"></script>
|
<script src="src/InteractiveTutorial.js"></script>
|
||||||
<script src="src/Alias.js"></script>
|
<script src="src/Alias.js"></script>
|
||||||
|
<script src="src/Message.js"></script>
|
||||||
|
|
||||||
<script src="src/engine.js"></script>
|
<script src="src/engine.js"></script>
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ Augmentation.prototype.setInfo = function(inf) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Augmentation.prototype.setRequirements = function(rep, cost) {
|
Augmentation.prototype.setRequirements = function(rep, cost) {
|
||||||
this.baseRepRequirement = rep;
|
this.baseRepRequirement = rep * CONSTANTS.AugmentationRepMultiplier;
|
||||||
this.baseCost = cost * CONSTANTS.AugmentationCostMultiplier;
|
this.baseCost = cost * CONSTANTS.AugmentationCostMultiplier;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,7 +70,8 @@ CONSTANTS = {
|
|||||||
ServerWeakenAmount: 0.1, //Amount by which server's security decreases when weakened
|
ServerWeakenAmount: 0.1, //Amount by which server's security decreases when weakened
|
||||||
|
|
||||||
//Augmentation Constants
|
//Augmentation Constants
|
||||||
AugmentationCostMultiplier: 3, //Used for balancing costs without having to readjust every Augmentation cost
|
AugmentationCostMultiplier: 4, //Used for balancing costs without having to readjust every Augmentation cost
|
||||||
|
AugmentationRepMultiplier: 1.2, //Used for balancing rep cost without having to readjust every value
|
||||||
|
|
||||||
//Maximum number of log entries for a script
|
//Maximum number of log entries for a script
|
||||||
MaxLogCapacity: 40,
|
MaxLogCapacity: 40,
|
||||||
@ -147,6 +148,7 @@ CONSTANTS = {
|
|||||||
//Text that is displayed when the 'help' command is ran in Terminal
|
//Text that is displayed when the 'help' command is ran in Terminal
|
||||||
HelpText: 'alias [name="value"] Create aliases for Terminal commands, or list existing aliases<br>' +
|
HelpText: 'alias [name="value"] Create aliases for Terminal commands, or list existing aliases<br>' +
|
||||||
"analyze Get statistics and information about current machine <br>" +
|
"analyze Get statistics and information about current machine <br>" +
|
||||||
|
"cat [message] Display a .msg file<br>" +
|
||||||
"clear Clear all text on the terminal <br>" +
|
"clear Clear all text on the terminal <br>" +
|
||||||
"cls See 'clear' command <br>" +
|
"cls See 'clear' command <br>" +
|
||||||
"connect [ip/hostname] Connects to the machine given by its IP or hostname <br>" +
|
"connect [ip/hostname] Connects to the machine given by its IP or hostname <br>" +
|
||||||
|
@ -8,6 +8,7 @@ Programs = {
|
|||||||
SQLInjectProgram: "SQLInject.exe",
|
SQLInjectProgram: "SQLInject.exe",
|
||||||
DeepscanV1: "DeepscanV1.exe",
|
DeepscanV1: "DeepscanV1.exe",
|
||||||
DeepscanV2: "DeepscanV2.exe",
|
DeepscanV2: "DeepscanV2.exe",
|
||||||
|
Flight: "fl1ght.exe",
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO Right now the times needed to complete work are hard-coded...
|
//TODO Right now the times needed to complete work are hard-coded...
|
||||||
|
@ -290,12 +290,12 @@ PlayerObject.prototype.checkForFactionInvitations = function() {
|
|||||||
|
|
||||||
//Fulcrum Secret Technologies - If u've unlocked fulcrum secret technolgoies server and have a high rep with the company
|
//Fulcrum Secret Technologies - If u've unlocked fulcrum secret technolgoies server and have a high rep with the company
|
||||||
var fulcrumsecrettechonologiesFac = Factions["Fulcrum Secret Technologies"];
|
var fulcrumsecrettechonologiesFac = Factions["Fulcrum Secret Technologies"];
|
||||||
var fulcrumSecretServer = AllServers[SpecialServerIps["Fulcrum Secret Technologies Server"]];
|
var fulcrumSecretServer = AllServers[SpecialServerIps[SpecialServerNames.FulcrumSecretTechnologies]];
|
||||||
if (fulcrumSecretServer == null) {
|
if (fulcrumSecretServer == null) {
|
||||||
console.log("Error: Could not find Fulcrum Secret Technologies Server");
|
console.log("ERROR: Could not find Fulcrum Secret Technologies Server");
|
||||||
} else {
|
} else {
|
||||||
if (fulcrumsecrettechonologiesFac.isBanned == false && fulcrumsecrettechonologiesFac.isMember == false &&
|
if (fulcrumsecrettechonologiesFac.isBanned == false && fulcrumsecrettechonologiesFac.isMember == false &&
|
||||||
fulcrumSecretServer.hasAdminRights &&
|
fulcrumSecretServer.manuallyHacked &&
|
||||||
this.companyName == Locations.AevumFulcrumTechnologies && companyRep >= 250000) {
|
this.companyName == Locations.AevumFulcrumTechnologies && companyRep >= 250000) {
|
||||||
invitedFactions.push(fulcrumsecrettechonologiesFac);
|
invitedFactions.push(fulcrumsecrettechonologiesFac);
|
||||||
}
|
}
|
||||||
@ -303,23 +303,31 @@ PlayerObject.prototype.checkForFactionInvitations = function() {
|
|||||||
|
|
||||||
//BitRunners
|
//BitRunners
|
||||||
var bitrunnersFac = Factions["BitRunners"];
|
var bitrunnersFac = Factions["BitRunners"];
|
||||||
var homeComp = Player.getHomeComputer();
|
var homeComp = this.getHomeComputer();
|
||||||
if (bitrunnersFac.isBanned == false && bitrunnersFac.isMember == false &&
|
var bitrunnersServer = AllServers[SpecialServerIps[SpecialServerNames.BitRunnersServer]];
|
||||||
this.hacking_skill >= 500 && homeComp.maxRam >= 128) {
|
if (bitrunnersServer == null) {
|
||||||
|
console.log("ERROR: Could not find BitRunners Server");
|
||||||
|
} else if (bitrunnersFac.isBanned == false && bitrunnersFac.isMember == false && bitrunnersServer.manuallyHacked &&
|
||||||
|
this.hacking_skill >= 500 && homeComp.maxRam >= 128) {
|
||||||
invitedFactions.push(bitrunnersFac);
|
invitedFactions.push(bitrunnersFac);
|
||||||
}
|
}
|
||||||
|
|
||||||
//The Black Hand
|
//The Black Hand
|
||||||
var theblackhandFac = Factions["The Black Hand"];
|
var theblackhandFac = Factions["The Black Hand"];
|
||||||
if (theblackhandFac.isBanned == false && theblackhandFac.isMember == false &&
|
var blackhandServer = AllServers[SpecialServerIps[SpecialServerNames.TheBlackHandServer]];
|
||||||
this.hacking_skill >= 300 && this.strength >= 100 && this.defense >= 100 &&
|
if (blackhandServer == null) {
|
||||||
this.agility >= 100 && this.dexterity >= 100 && homeComp.maxRam >= 64) {
|
console.log("ERROR: Could not find The Black Hand Server");
|
||||||
|
} else if (!theblackhandFac.isBanned && !theblackhandFac.isMember && blackhandServer.manuallyHacked &&
|
||||||
|
this.hacking_skill >= 350 && homeComp.maxRam >= 64) {
|
||||||
invitedFactions.push(theblackhandFac);
|
invitedFactions.push(theblackhandFac);
|
||||||
}
|
}
|
||||||
|
|
||||||
//NiteSec
|
//NiteSec
|
||||||
var nitesecFac = Factions["NiteSec"];
|
var nitesecFac = Factions["NiteSec"];
|
||||||
if (nitesecFac.isBanned == false && nitesecFac.isMember == false &&
|
var nitesecServer = AllServers[SpecialServerIps[SpecialServerNames.NiteSecServer]];
|
||||||
|
if (nitesecServer == null) {
|
||||||
|
console.log("ERROR: Could not find NiteSec Server");
|
||||||
|
} else if (!nitesecFac.isBanned && !nitesecFac.isMember && nitesecServer.manuallyHacked &&
|
||||||
this.hacking_skill >= 200 && homeComp.maxRam >= 32) {
|
this.hacking_skill >= 200 && homeComp.maxRam >= 32) {
|
||||||
invitedFactions.push(nitesecFac);
|
invitedFactions.push(nitesecFac);
|
||||||
}
|
}
|
||||||
@ -451,7 +459,10 @@ PlayerObject.prototype.checkForFactionInvitations = function() {
|
|||||||
|
|
||||||
//CyberSec
|
//CyberSec
|
||||||
var cybersecFac = Factions["CyberSec"];
|
var cybersecFac = Factions["CyberSec"];
|
||||||
if (cybersecFac.isBanned == false && cybersecFac.isMember == false &&
|
var cybersecServer = AllServers[SpecialServerIps[SpecialServerNames.CyberSecServer]];
|
||||||
|
if (cybersecServer == null) {
|
||||||
|
console.log("ERROR: Could not find CyberSec Server");
|
||||||
|
} else if (!cybersecFac.isBanned && !cybersecFac.isMember && cybersecServer.manuallyHacked &&
|
||||||
this.hacking_skill >= 50) {
|
this.hacking_skill >= 50) {
|
||||||
invitedFactions.push(cybersecFac);
|
invitedFactions.push(cybersecFac);
|
||||||
}
|
}
|
||||||
|
153
src/Message.js
Normal file
153
src/Message.js
Normal file
@ -0,0 +1,153 @@
|
|||||||
|
/* Message.js */
|
||||||
|
function Message(filename, msg) {
|
||||||
|
this.filename = filename;
|
||||||
|
this.msg = msg;
|
||||||
|
this.recvd = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Message.prototype.toJSON = function() {
|
||||||
|
return Generic_toJSON("Message", this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Message.fromJSON = function(value) {
|
||||||
|
return Generic_fromJSON(Message, value.data);
|
||||||
|
}
|
||||||
|
|
||||||
|
Reviver.constructors.Message = Message;
|
||||||
|
|
||||||
|
//Sends message to player, including a pop up
|
||||||
|
function sendMessage(msg) {
|
||||||
|
console.log("sending message: " + msg.filename);
|
||||||
|
msg.recvd = true;
|
||||||
|
showMessage(msg);
|
||||||
|
addMessageToServer(msg, "home");
|
||||||
|
}
|
||||||
|
|
||||||
|
function showMessage(msg) {
|
||||||
|
var txt = "Message received from unknown sender: <br><br>" +
|
||||||
|
"<i>" + msg.msg + "</i><br><br>" +
|
||||||
|
"This message was saved as " + msg.filename + " onto your home computer.";
|
||||||
|
dialogBoxCreate(txt);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Adds a message to a server
|
||||||
|
function addMessageToServer(msg, serverHostname) {
|
||||||
|
var server = GetServerByHostname(serverHostname);
|
||||||
|
if (server == null) {
|
||||||
|
console.log("WARNING: Did not locate " + serverHostname);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
server.messages.push(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Checks if any of the 'timed' messages should be sent
|
||||||
|
function checkForMessagesToSend() {
|
||||||
|
console.log("checkForMessagesToSend() called");
|
||||||
|
var jumper0 = Messages[MessageFilenames.Jumper0];
|
||||||
|
var jumper1 = Messages[MessageFilenames.Jumper1];
|
||||||
|
var jumper2 = Messages[MessageFilenames.Jumper2];
|
||||||
|
var jumper3 = Messages[MessageFilenames.Jumper3];
|
||||||
|
var jumper4 = Messages[MessageFilenames.Jumper4];
|
||||||
|
var jumper5 = Messages[MessageFilenames.Jumper5];
|
||||||
|
var cybersecTest = Messages[MessageFilenames.CyberSecTest];
|
||||||
|
var nitesecTest = Messages[MessageFilenames.NiteSecTest];
|
||||||
|
var bitrunnersTest = Messages[MessageFilenames.BitRunnersTest];
|
||||||
|
|
||||||
|
if (jumper0 && !jumper0.recvd && Player.hacking_skill >= 25) {
|
||||||
|
sendMessage(jumper0);
|
||||||
|
} else if (jumper1 && !jumper1.recvd && Player.hacking_skill >= 40) {
|
||||||
|
sendMessage(jumper1);
|
||||||
|
} else if (cybersecTest && !cybersecTest.recvd && Player.hacking_skill >= 50) {
|
||||||
|
sendMessage(cybersecTest);
|
||||||
|
} else if (jumper2 && !jumper2.recvd && Player.hacking_skill >= 175) {
|
||||||
|
sendMessage(jumper2);
|
||||||
|
} else if (nitesecTest && !nitesecTest.recvd && Player.hacking_skill >= 200) {
|
||||||
|
sendMessage(nitesecTest);
|
||||||
|
} else if (jumper3 && !jumper3.recvd && Player.hacking_skill >= 350) {
|
||||||
|
sendMessage(jumper3);
|
||||||
|
} else if (jumper4 && !jumper4.recvd && Player.hacking_skill >= 490) {
|
||||||
|
sendMessage(jumper4);
|
||||||
|
} else if (bitrunnersTest && !bitrunnersTest.recvd && Player.hacking_skill >= 500) {
|
||||||
|
sendMessage(bitrunnersTest);
|
||||||
|
Player.getHomeComputer.programs.push(Programs.Flight);
|
||||||
|
} if (!jumper5 && !jumper5.recvd && Player.hacking_skill >= 900) {
|
||||||
|
sendMessage(jumper5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function AddToAllMessages(msg) {
|
||||||
|
Messages[msg.filename] = msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
Messages = {}
|
||||||
|
|
||||||
|
MessageFilenames = {
|
||||||
|
Jumper0: "j0.msg",
|
||||||
|
Jumper1: "j1.msg",
|
||||||
|
Jumper2: "j2.msg",
|
||||||
|
Jumper3: "j3.msg",
|
||||||
|
Jumper4: "j4.msg",
|
||||||
|
Jumper5: "j4.msg",
|
||||||
|
CyberSecTest: "csec-test.msg",
|
||||||
|
NiteSecTest: "nitesec-test.msg",
|
||||||
|
BitRunnersTest: "19dfj3l1nd.msg",
|
||||||
|
}
|
||||||
|
|
||||||
|
function initMessages() {
|
||||||
|
//Reset
|
||||||
|
Messages = {};
|
||||||
|
|
||||||
|
//jump3R Messages
|
||||||
|
AddToAllMessages(new Message(MessageFilenames.Jumper0,
|
||||||
|
"I know you can sense it. I know you're searching for it. " +
|
||||||
|
"It's why you spend night after " +
|
||||||
|
"night at your computer. <br><br>It's real, I've seen it. And I can " +
|
||||||
|
"help you find it. But not right now. You're not ready yet. Keep searching, " +
|
||||||
|
"but don't fly too close to the sun.<br><br>-jump3R"));
|
||||||
|
AddToAllMessages(new Message(MessageFilenames.Jumper1,
|
||||||
|
"Soon you will be contacted by a hacking group known as CyberSec. " +
|
||||||
|
"They can help you with your search. <br><br>" +
|
||||||
|
"You should join them, garner their favor, and " +
|
||||||
|
"exploit them for their Augmentations. But do not trust them. " +
|
||||||
|
"They are not what they seem. No one is.<br><br>" +
|
||||||
|
"-jump3R"));
|
||||||
|
AddToAllMessages(new Message(MessageFilenames.Jumper2,
|
||||||
|
"Do not try to save the world. There is no world to save. If " +
|
||||||
|
"you want to find the truth, worry only about yourself. Ethics and " +
|
||||||
|
"morals will get you killed. <br><br>Watch out for a hacking group known as NiteSec." +
|
||||||
|
"<br><br>-jump3R"));
|
||||||
|
AddToAllMessages(new Message(MessageFilenames.Jumper3,
|
||||||
|
"You must learn to walk before you can run. And you must " +
|
||||||
|
"run before you can fly. Look for the black hand. <br><br>" +
|
||||||
|
"I.I.I.I <br><br>-jump3R"));
|
||||||
|
AddToAllMessages(new Message(MessageFilenames.Jumper4,
|
||||||
|
"To find what you are searching for, you must understand the bits. " +
|
||||||
|
"The bits are all around us. The runners will help you.<br><br>" +
|
||||||
|
"-jump3R"));
|
||||||
|
AddToAllMessages(new Message(MessageFilenames.Jumper5,
|
||||||
|
"Build your wings and fly<br><br>-jump3R<br><br> " +
|
||||||
|
"The fl1ght.exe program was added to your home computer"));
|
||||||
|
|
||||||
|
//Messages from hacking factions
|
||||||
|
AddToAllMessages(new Message(MessageFilenames.CyberSecTest,
|
||||||
|
"We've been watching you. Your skills are very impressive. But you're wasting " +
|
||||||
|
"your talents. If you join us, you can put your skills to good use and change " +
|
||||||
|
"the world for the better. If you join us, we can unlock your full potential. <br><br>" +
|
||||||
|
"But first, you must pass our test. Find and hack our server using the Terminal. <br><br>" +
|
||||||
|
"-CyberSec"));
|
||||||
|
AddToAllMessages(new Message(MessageFilenames.NiteSecTest,
|
||||||
|
"People say that the corrupted governments and corporations rule the world. " +
|
||||||
|
"Yes, maybe they do. But do you know who everyone really fears? People " +
|
||||||
|
"like us. Because they can't hide from us. Because they can't fight shadows " +
|
||||||
|
"and ideas with bullets. <br><br>" +
|
||||||
|
"Join us, and people will fear you, too. <br><br>" +
|
||||||
|
"Find and hack our hidden server using the Terminal. Then, we will contact you again." +
|
||||||
|
"<br><br>-NiteSec"));
|
||||||
|
AddToAllMessages(new Message(MessageFilenames.BitRunnersTest,
|
||||||
|
"We know what you are doing. We know what drives you. We know " +
|
||||||
|
"what you are looking for. <br><br> " +
|
||||||
|
"We can help you find the answers.<br><br>" +
|
||||||
|
"run4theh111z"));
|
||||||
|
|
||||||
|
}
|
@ -120,7 +120,6 @@ function evaluate(exp, workerScript) {
|
|||||||
var numConds = exp.cond.length;
|
var numConds = exp.cond.length;
|
||||||
var numThens = exp.then.length;
|
var numThens = exp.then.length;
|
||||||
if (numConds == 0 || numThens == 0 || numConds != numThens) {
|
if (numConds == 0 || numThens == 0 || numConds != numThens) {
|
||||||
console.log("Number of ifs and conds dont match. Rejecting");
|
|
||||||
reject("|" + workerScript.serverIp + "|" + workerScript.name + "|Number of conds and thens in if structure don't match (or there are none)");
|
reject("|" + workerScript.serverIp + "|" + workerScript.name + "|Number of conds and thens in if structure don't match (or there are none)");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,20 +127,17 @@ function evaluate(exp, workerScript) {
|
|||||||
evalIfPromise.then(function(res) {
|
evalIfPromise.then(function(res) {
|
||||||
if (res) {
|
if (res) {
|
||||||
//One of the if/elif statements evaluated to true
|
//One of the if/elif statements evaluated to true
|
||||||
console.log("done with if");
|
|
||||||
resolve("if statement done");
|
resolve("if statement done");
|
||||||
} else {
|
} else {
|
||||||
//None of the if/elif statements were true. Evaluate else if there is one
|
//None of the if/elif statements were true. Evaluate else if there is one
|
||||||
if (exp.else) {
|
if (exp.else) {
|
||||||
var elseEval = evaluate(exp.else, workerScript);
|
var elseEval = evaluate(exp.else, workerScript);
|
||||||
elseEval.then(function(res) {
|
elseEval.then(function(res) {
|
||||||
console.log("if statement done with else");
|
|
||||||
resolve("if statement done with else");
|
resolve("if statement done with else");
|
||||||
}, function(e) {
|
}, function(e) {
|
||||||
reject(e);
|
reject(e);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
console.log("no else statement, resolving");
|
|
||||||
resolve("if statement done");
|
resolve("if statement done");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -960,12 +956,9 @@ function evaluateIf(exp, workerScript, i) {
|
|||||||
} else {
|
} else {
|
||||||
var cond = evaluate(exp.cond[i], workerScript);
|
var cond = evaluate(exp.cond[i], workerScript);
|
||||||
cond.then(function(condRes) {
|
cond.then(function(condRes) {
|
||||||
console.log("cond evaluated to: " + condRes);
|
|
||||||
if (condRes) {
|
if (condRes) {
|
||||||
console.log("Evaluating then: " + exp.then[i]);
|
|
||||||
var evalThen = evaluate(exp.then[i], workerScript);
|
var evalThen = evaluate(exp.then[i], workerScript);
|
||||||
evalThen.then(function(res) {
|
evalThen.then(function(res) {
|
||||||
console.log("If statement done");
|
|
||||||
resolve(true);
|
resolve(true);
|
||||||
}, function(e) {
|
}, function(e) {
|
||||||
reject(e);
|
reject(e);
|
||||||
|
@ -11,6 +11,7 @@ function BitburnerSaveObject() {
|
|||||||
this.SpecialServerIpsSave = "";
|
this.SpecialServerIpsSave = "";
|
||||||
this.AugmentationsSave = "";
|
this.AugmentationsSave = "";
|
||||||
this.AliasesSave = "";
|
this.AliasesSave = "";
|
||||||
|
this.MessagesSave = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
BitburnerSaveObject.prototype.saveGame = function() {
|
BitburnerSaveObject.prototype.saveGame = function() {
|
||||||
@ -21,6 +22,7 @@ BitburnerSaveObject.prototype.saveGame = function() {
|
|||||||
this.SpecialServerIpsSave = JSON.stringify(SpecialServerIps);
|
this.SpecialServerIpsSave = JSON.stringify(SpecialServerIps);
|
||||||
this.AugmentationsSave = JSON.stringify(Augmentations);
|
this.AugmentationsSave = JSON.stringify(Augmentations);
|
||||||
this.AliasesSave = JSON.stringify(Aliases);
|
this.AliasesSave = JSON.stringify(Aliases);
|
||||||
|
this.MessagesSave = JSON.stringify(Messages);
|
||||||
|
|
||||||
var saveString = btoa(unescape(encodeURIComponent(JSON.stringify(this))));
|
var saveString = btoa(unescape(encodeURIComponent(JSON.stringify(this))));
|
||||||
window.localStorage.setItem("bitburnerSave", saveString);
|
window.localStorage.setItem("bitburnerSave", saveString);
|
||||||
@ -52,7 +54,15 @@ loadGame = function(saveObj) {
|
|||||||
} else {
|
} else {
|
||||||
Aliases = {};
|
Aliases = {};
|
||||||
}
|
}
|
||||||
|
if (saveObj.hasOwnProperty("MessagesSave")) {
|
||||||
|
try {
|
||||||
|
Messages = JSON.parse(saveObj.MessagesSave, Reviver);
|
||||||
|
} catch(e) {
|
||||||
|
initMessages();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
initMessages();
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ function Server() {
|
|||||||
//Access information
|
//Access information
|
||||||
this.hasAdminRights = false; //Whether player has admin rights
|
this.hasAdminRights = false; //Whether player has admin rights
|
||||||
this.purchasedByPlayer = false;
|
this.purchasedByPlayer = false;
|
||||||
|
this.manuallyHacked = false; //Flag that tracks whether or not the server has been hacked at least once
|
||||||
|
|
||||||
//RAM, CPU speed and Scripts
|
//RAM, CPU speed and Scripts
|
||||||
this.maxRam = 1; //GB
|
this.maxRam = 1; //GB
|
||||||
@ -131,8 +132,6 @@ Server.fromJSON = function(value) {
|
|||||||
|
|
||||||
Reviver.constructors.Server = Server;
|
Reviver.constructors.Server = Server;
|
||||||
|
|
||||||
//world_daemon: new Server(), //Final server for 2nd tier prestige. Discover that the world is a simulation
|
|
||||||
|
|
||||||
initForeignServers = function() {
|
initForeignServers = function() {
|
||||||
//MegaCorporations
|
//MegaCorporations
|
||||||
var ECorpServer = new Server();
|
var ECorpServer = new Server();
|
||||||
@ -201,8 +200,7 @@ initForeignServers = function() {
|
|||||||
FulcrumSecretTechnologiesServer.setHackingParameters(999, 1000000, 99, 1);
|
FulcrumSecretTechnologiesServer.setHackingParameters(999, 1000000, 99, 1);
|
||||||
FulcrumSecretTechnologiesServer.setPortProperties(5);
|
FulcrumSecretTechnologiesServer.setPortProperties(5);
|
||||||
AddToAllServers(FulcrumSecretTechnologiesServer);
|
AddToAllServers(FulcrumSecretTechnologiesServer);
|
||||||
|
SpecialServerIps.addIp(SpecialServerNames.FulcrumSecretTechnologies, FulcrumSecretTechnologiesServer.ip);
|
||||||
SpecialServerIps.addIp("Fulcrum Secret Technologies Server", FulcrumSecretTechnologiesServer.ip);
|
|
||||||
|
|
||||||
var StormTechnologiesServer = new Server();
|
var StormTechnologiesServer = new Server();
|
||||||
StormTechnologiesServer.init(createRandomIp(), "stormtech", "Storm Technologies", true, false, false, false, 0);
|
StormTechnologiesServer.init(createRandomIp(), "stormtech", "Storm Technologies", true, false, false, false, 0);
|
||||||
@ -519,47 +517,72 @@ initForeignServers = function() {
|
|||||||
//Faction servers, cannot hack money from these
|
//Faction servers, cannot hack money from these
|
||||||
var BitRunnersServer = new Server();
|
var BitRunnersServer = new Server();
|
||||||
BitRunnersServer.init(createRandomIp(), "run4theh111z", "The Runners", true, false, false, false, 0);
|
BitRunnersServer.init(createRandomIp(), "run4theh111z", "The Runners", true, false, false, false, 0);
|
||||||
|
BitRunnersServer.setHackingParameters(getRandomInt(505, 550), 0, 0, 0);
|
||||||
BitRunnersServer.setPortProperties(4);
|
BitRunnersServer.setPortProperties(4);
|
||||||
AddToAllServers(BitRunnersServer);
|
AddToAllServers(BitRunnersServer);
|
||||||
|
SpecialServerIps.addIp(SpecialServerNames.BitRunnersServer, BitRunnersServer.ip);
|
||||||
|
|
||||||
var TheBlackHandServer = new Server();
|
var TheBlackHandServer = new Server();
|
||||||
TheBlackHandServer.init(createRandomIp(), "I.I.I.I", "I.I.I.I", true, false, false, false, false, 0);
|
TheBlackHandServer.init(createRandomIp(), "I.I.I.I", "I.I.I.I", true, false, false, false, false, 0);
|
||||||
|
TheBlackHandServer.setHackingParameters(getRandomInt(305, 350), 0, 0, 0);
|
||||||
TheBlackHandServer.setPortProperties(3);
|
TheBlackHandServer.setPortProperties(3);
|
||||||
AddToAllServers(TheBlackHandServer);
|
AddToAllServers(TheBlackHandServer);
|
||||||
|
SpecialServerIps.addIp(SpecialServerNames.TheBlackHandServer, TheBlackHandServer.ip);
|
||||||
|
|
||||||
var NiteSecServer = new Server();
|
var NiteSecServer = new Server();
|
||||||
NiteSecServer.init(createRandomIp(), "avmnite-02h", "NiteSec", true, false, false, false, 0);
|
NiteSecServer.init(createRandomIp(), "avmnite-02h", "NiteSec", true, false, false, false, 0);
|
||||||
|
NiteSecServer.setHackingParameters(getRandomInt(202, 230), 0, 0, 0);
|
||||||
NiteSecServer.setPortProperties(2);
|
NiteSecServer.setPortProperties(2);
|
||||||
AddToAllServers(NiteSecServer);
|
AddToAllServers(NiteSecServer);
|
||||||
|
SpecialServerIps.addIp(SpecialServerNames.NiteSecServer, NiteSecServer.ip);
|
||||||
|
|
||||||
var DarkArmyServer = new Server();
|
var DarkArmyServer = new Server();
|
||||||
DarkArmyServer.init(createRandomIp(), ".", ".", true, false, false, false, 0);
|
DarkArmyServer.init(createRandomIp(), ".", ".", true, false, false, false, 0);
|
||||||
DarkArmyServer.setPortProperties(5);
|
DarkArmyServer.setHackingParameters(getRandomInt(505, 550), 0, 0, 0);
|
||||||
|
DarkArmyServer.setPortProperties(4);
|
||||||
AddToAllServers(DarkArmyServer);
|
AddToAllServers(DarkArmyServer);
|
||||||
|
SpecialServerIps.addIp(SpecialServerNames.TheDarkArmyServer, DarkArmyServer.ip);
|
||||||
|
|
||||||
var CyberSecServer = new Server();
|
var CyberSecServer = new Server();
|
||||||
CyberSecServer.init(createRandomIp(), "CSEC", "CyberSec", true, false, false, false, 0);
|
CyberSecServer.init(createRandomIp(), "CSEC", "CyberSec", true, false, false, false, 0);
|
||||||
CyberSecServer.setPortProperties(2);
|
CyberSecServer.setHackingParameters(getRandomInt(51, 60), 0, 0, 0);
|
||||||
|
CyberSecServer.setPortProperties(1);
|
||||||
AddToAllServers(CyberSecServer);
|
AddToAllServers(CyberSecServer);
|
||||||
|
SpecialServerIps.addIp(SpecialServerNames.CyberSecServer, CyberSecServer.ip);
|
||||||
|
|
||||||
|
var DaedalusServer = new Server();
|
||||||
|
DaedalusServer.init(createRandomIp(), "Icarus", "Icarus", true, false, false, false, 0);
|
||||||
|
DaedalusServer.setHackingParameters(925, 0, 0, 0);
|
||||||
|
DaedalusServer.setPortProperties(5);
|
||||||
|
AddToAllServers(DaedalusServer);
|
||||||
|
SpecialServerIps.addIp(SpecialServerNames.DaedalusServer, DaedalusServer.ip);
|
||||||
|
|
||||||
|
//Super special Servers
|
||||||
|
var WorldDaemon = new Server();
|
||||||
|
WorldDaemon.init(createRandomIp(), SpecialServerNames.WorldDaemon, SpecialServerNames.WorldDaemon, true, false, false, false, 0);
|
||||||
|
WorldDaemon.setHackingParameters(950, 0, 0, 0);
|
||||||
|
WorldDaemon.setPortProperties(5);
|
||||||
|
AddToAllServers(WorldDaemon);
|
||||||
|
SpecialServerIps.addIp(SpecialServerNames.WorldDaemon, WorldDaemon.ip);
|
||||||
|
|
||||||
|
|
||||||
/* Create a randomized network for all the foreign servers */
|
/* Create a randomized network for all the foreign servers */
|
||||||
//Groupings for creating a randomized network
|
//Groupings for creating a randomized network
|
||||||
var NetworkGroup1 = [IronGymServer, FoodNStuffServer, SigmaCosmeticsServer, JoesGunsServer, HongFangTeaHouseServer, HaraKiriSushiBarServer];
|
var NetworkGroup1 = [IronGymServer, FoodNStuffServer, SigmaCosmeticsServer, JoesGunsServer, HongFangTeaHouseServer, HaraKiriSushiBarServer];
|
||||||
var NetworkGroup2 = [MaxHardwareServer, NectarNightclubServer, Zer0NightclubServer];
|
var NetworkGroup2 = [MaxHardwareServer, NectarNightclubServer, Zer0NightclubServer, CyberSecServer];
|
||||||
var NetworkGroup3 = [OmegaSoftwareServer, PhantasyServer, SilverHelixServer, NeoNightclubServer];
|
var NetworkGroup3 = [OmegaSoftwareServer, PhantasyServer, SilverHelixServer, NeoNightclubServer];
|
||||||
var NetworkGroup4 = [CrushFitnessGymServer, NetLinkTechnologiesServer, CompuTekServer, TheHubServer, JohnsonOrthopedicsServer];
|
var NetworkGroup4 = [CrushFitnessGymServer, NetLinkTechnologiesServer, CompuTekServer, TheHubServer, JohnsonOrthopedicsServer, NiteSecServer];
|
||||||
var NetworkGroup5 = [CatalystVenturesServer, SysCoreSecuritiesServer, SummitUniversityServer, ZBInstituteOfTechnologyServer, RothmanUniversityServer];
|
var NetworkGroup5 = [CatalystVenturesServer, SysCoreSecuritiesServer, SummitUniversityServer, ZBInstituteOfTechnologyServer, RothmanUniversityServer, TheBlackHandServer];
|
||||||
var NetworkGroup6 = [LexoCorpServer, RhoConstructionServer, AlphaEnterprisesServer, AevumPoliceServer, MilleniumFitnessGymServer, CyberSecServer, NiteSecServer];
|
var NetworkGroup6 = [LexoCorpServer, RhoConstructionServer, AlphaEnterprisesServer, AevumPoliceServer, MilleniumFitnessGymServer, CyberSecServer, NiteSecServer];
|
||||||
var NetworkGroup7 = [GlobalPharmaceuticalsServer, AeroCorpServer, GalacticCyberSystemsServer, SnapFitnessGymServer];
|
var NetworkGroup7 = [GlobalPharmaceuticalsServer, AeroCorpServer, GalacticCyberSystemsServer, SnapFitnessGymServer];
|
||||||
var NetworkGroup8 = [DeltaOneServer, UnitaLifeGroupServer, OmniaCybersystemsServer];
|
var NetworkGroup8 = [DeltaOneServer, UnitaLifeGroupServer, OmniaCybersystemsServer, BitRunnersServer];
|
||||||
var NetworkGroup9 = [ZeusMedicalServer, SolarisSpaceSystemsServer, UniversalEnergyServer, IcarusMicrosystemsServer, DefCommServer];
|
var NetworkGroup9 = [ZeusMedicalServer, SolarisSpaceSystemsServer, UniversalEnergyServer, IcarusMicrosystemsServer, DefCommServer];
|
||||||
var NetworkGroup10 = [NovaMedicalServer, ZBDefenseServer, TaiYangDigitalServer, InfoCommServer];
|
var NetworkGroup10 = [NovaMedicalServer, ZBDefenseServer, TaiYangDigitalServer, InfoCommServer];
|
||||||
var NetworkGroup11 = [AppliedEnergeticsServer, MicrodyneTechnologiesServer, TitanLabsServer, BitRunnersServer];
|
var NetworkGroup11 = [AppliedEnergeticsServer, MicrodyneTechnologiesServer, TitanLabsServer, BitRunnersServer];
|
||||||
var NetworkGroup12 = [VitaLifeServer, HeliosLabsServer, StormTechnologiesServer, FulcrumTechnologiesServer];
|
var NetworkGroup12 = [VitaLifeServer, HeliosLabsServer, StormTechnologiesServer, FulcrumTechnologiesServer];
|
||||||
var NetworkGroup13 = [KuaiGongInternationalServer, FourSigmaServer, OmniTekIncorporatedServer, DarkArmyServer];
|
var NetworkGroup13 = [KuaiGongInternationalServer, FourSigmaServer, OmniTekIncorporatedServer, DarkArmyServer];
|
||||||
var NetworkGroup14 = [PowerhouseGymServer, ClarkeIncorporatedServer, NWOServer, BladeIndustriesServer, BachmanAndAssociatesServer];
|
var NetworkGroup14 = [PowerhouseGymServer, ClarkeIncorporatedServer, NWOServer, BladeIndustriesServer, BachmanAndAssociatesServer];
|
||||||
var NetworkGroup15 = [FulcrumSecretTechnologiesServer, MegaCorpServer, ECorpServer];
|
var NetworkGroup15 = [FulcrumSecretTechnologiesServer, MegaCorpServer, ECorpServer, DaedalusServer];
|
||||||
|
|
||||||
for (var i = 0; i < NetworkGroup2.length; i++) {
|
for (var i = 0; i < NetworkGroup2.length; i++) {
|
||||||
var randomServerFromPrevGroup = NetworkGroup1[Math.floor(Math.random() * NetworkGroup1.length)];
|
var randomServerFromPrevGroup = NetworkGroup1[Math.floor(Math.random() * NetworkGroup1.length)];
|
||||||
|
@ -1,6 +1,15 @@
|
|||||||
/* Holds IP of Special Servers */
|
/* Holds IP of Special Servers */
|
||||||
function SpecialServerIpsMap() {
|
SpecialServerNames = {
|
||||||
|
FulcrumSecretTechnologies: "Fulcrum Secret Technologies Server",
|
||||||
|
CyberSecServer: "CyberSec Server",
|
||||||
|
NiteSecServer: "NiteSec Server",
|
||||||
|
TheBlackHandServer: "The Black Hand Server",
|
||||||
|
BitRunnersServer: "BitRunners Server",
|
||||||
|
TheDarkArmyServer: "The Dark Army Server",
|
||||||
|
DaedalusServer: "Daedalus Server",
|
||||||
|
WorldDaemon: "w0r1d_d43m0n",
|
||||||
}
|
}
|
||||||
|
function SpecialServerIpsMap() {}
|
||||||
|
|
||||||
SpecialServerIpsMap.prototype.addIp = function(name, ip) {
|
SpecialServerIpsMap.prototype.addIp = function(name, ip) {
|
||||||
this[name] = ip;
|
this[name] = ip;
|
||||||
|
@ -250,6 +250,13 @@ function determineAllPossibilitiesForTabCompletion(input, index=0) {
|
|||||||
}
|
}
|
||||||
return allPos;
|
return allPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (input.startsWith("cat ")) {
|
||||||
|
for (var i = 0; i < currServ.messages.length; ++i) {
|
||||||
|
allPos.push(currServ.messages[i].filename);
|
||||||
|
}
|
||||||
|
return allPos;
|
||||||
|
}
|
||||||
return allPos;
|
return allPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -272,7 +279,8 @@ var Terminal = {
|
|||||||
//Complete the hack/analyze command
|
//Complete the hack/analyze command
|
||||||
finishHack: function(cancelled = false) {
|
finishHack: function(cancelled = false) {
|
||||||
if (cancelled == false) {
|
if (cancelled == false) {
|
||||||
console.log("Hack done. Determining success/failure of hack. Re-enabling terminal and changing the id of the hack progress bar");
|
var server = Player.getCurrentServer();
|
||||||
|
server.manuallyHacked = true;
|
||||||
|
|
||||||
//Calculate whether hack was successful
|
//Calculate whether hack was successful
|
||||||
var hackChance = Player.calculateHackingChance();
|
var hackChance = Player.calculateHackingChance();
|
||||||
@ -282,23 +290,23 @@ var Terminal = {
|
|||||||
var expGainedOnFailure = (expGainedOnSuccess / 4);
|
var expGainedOnFailure = (expGainedOnSuccess / 4);
|
||||||
if (rand < hackChance) { //Success!
|
if (rand < hackChance) { //Success!
|
||||||
var moneyGained = Player.calculatePercentMoneyHacked();
|
var moneyGained = Player.calculatePercentMoneyHacked();
|
||||||
moneyGained = Math.floor(Player.getCurrentServer().moneyAvailable * moneyGained);
|
moneyGained = Math.floor(server.moneyAvailable * moneyGained);
|
||||||
|
|
||||||
//Safety check
|
//Safety check
|
||||||
if (moneyGained <= 0) {moneyGained = 0;}
|
if (moneyGained <= 0) {moneyGained = 0;}
|
||||||
|
|
||||||
Player.getCurrentServer().moneyAvailable -= moneyGained;
|
server.moneyAvailable -= moneyGained;
|
||||||
Player.gainMoney(moneyGained);
|
Player.gainMoney(moneyGained);
|
||||||
|
|
||||||
Player.gainHackingExp(expGainedOnSuccess)
|
Player.gainHackingExp(expGainedOnSuccess)
|
||||||
|
|
||||||
Player.getCurrentServer().fortify(CONSTANTS.ServerFortifyAmount);
|
server.fortify(CONSTANTS.ServerFortifyAmount);
|
||||||
|
|
||||||
post("Hack successful! Gained $" + formatNumber(moneyGained, 2) + " and " + formatNumber(expGainedOnSuccess, 4) + " hacking EXP");
|
post("Hack successful! Gained $" + formatNumber(moneyGained, 2) + " and " + formatNumber(expGainedOnSuccess, 4) + " hacking EXP");
|
||||||
} else { //Failure
|
} else { //Failure
|
||||||
//Player only gains 25% exp for failure? TODO Can change this later to balance
|
//Player only gains 25% exp for failure? TODO Can change this later to balance
|
||||||
Player.gainHackingExp(expGainedOnFailure)
|
Player.gainHackingExp(expGainedOnFailure)
|
||||||
post("Failed to hack " + Player.getCurrentServer().hostname + ". Gained " + formatNumber(expGainedOnFailure, 4) + " hacking EXP");
|
post("Failed to hack " + server.hostname + ". Gained " + formatNumber(expGainedOnFailure, 4) + " hacking EXP");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -550,6 +558,24 @@ var Terminal = {
|
|||||||
break;
|
break;
|
||||||
case "buy":
|
case "buy":
|
||||||
executeDarkwebTerminalCommand(commandArray);
|
executeDarkwebTerminalCommand(commandArray);
|
||||||
|
break;
|
||||||
|
case "cat":
|
||||||
|
if (commandArray.length != 2) {
|
||||||
|
post("Incorrect usage of cat command. Usage: cat [message]"); return;
|
||||||
|
}
|
||||||
|
var filename = commandArray[1];
|
||||||
|
//Can only edit script files
|
||||||
|
if (filename.endsWith(".msg") == false) {
|
||||||
|
post("Error: Only .msg files are viewable with cat (filename must end with .msg)"); return;
|
||||||
|
}
|
||||||
|
var s = Player.getCurrentServer();
|
||||||
|
for (var i = 0; i < s.messages.length; ++i) {
|
||||||
|
if (s.messages[i].filename == filename) {
|
||||||
|
showMessage(s.messages[i]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
post("Error: No such file " + filename);
|
||||||
break;
|
break;
|
||||||
case "clear":
|
case "clear":
|
||||||
case "cls":
|
case "cls":
|
||||||
@ -877,11 +903,15 @@ var Terminal = {
|
|||||||
var allFiles = [];
|
var allFiles = [];
|
||||||
|
|
||||||
//Get all of the programs and scripts on the machine into one temporary array
|
//Get all of the programs and scripts on the machine into one temporary array
|
||||||
for (var i = 0; i < Player.getCurrentServer().programs.length; i++) {
|
var s = Player.getCurrentServer();
|
||||||
allFiles.push(Player.getCurrentServer().programs[i]);
|
for (var i = 0; i < s.programs.length; i++) {
|
||||||
|
allFiles.push(s.programs[i]);
|
||||||
}
|
}
|
||||||
for (var i = 0; i < Player.getCurrentServer().scripts.length; i++) {
|
for (var i = 0; i < s.scripts.length; i++) {
|
||||||
allFiles.push(Player.getCurrentServer().scripts[i].filename);
|
allFiles.push(s.scripts[i].filename);
|
||||||
|
}
|
||||||
|
for (var i = 0; i < s.messages.length; i++) {
|
||||||
|
allFiles.push(s.messages[i].filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Sort the files alphabetically then print each
|
//Sort the files alphabetically then print each
|
||||||
|
@ -602,8 +602,9 @@ var Engine = {
|
|||||||
updateDisplays: 3, //Update displays such as Active Scripts display and character display
|
updateDisplays: 3, //Update displays such as Active Scripts display and character display
|
||||||
createProgramNotifications: 10, //Checks whether any programs can be created and notifies
|
createProgramNotifications: 10, //Checks whether any programs can be created and notifies
|
||||||
serverGrowth: 450, //Process server growth every minute and a half
|
serverGrowth: 450, //Process server growth every minute and a half
|
||||||
checkFactionInvitations: 1000, //Check whether you qualify for any faction invitations every 5 minutes
|
checkFactionInvitations: 250, //Check whether you qualify for any faction invitations every 5 minutes
|
||||||
passiveFactionGrowth: 600,
|
passiveFactionGrowth: 600,
|
||||||
|
messages: 300,
|
||||||
},
|
},
|
||||||
|
|
||||||
decrementAllCounters: function(numCycles = 1) {
|
decrementAllCounters: function(numCycles = 1) {
|
||||||
@ -667,7 +668,7 @@ var Engine = {
|
|||||||
var randFaction = invitedFactions[Math.floor(Math.random() * invitedFactions.length)];
|
var randFaction = invitedFactions[Math.floor(Math.random() * invitedFactions.length)];
|
||||||
inviteToFaction(randFaction);
|
inviteToFaction(randFaction);
|
||||||
}
|
}
|
||||||
Engine.Counters.checkFactionInvitations = 1000;
|
Engine.Counters.checkFactionInvitations = 250;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Engine.Counters.passiveFactionGrowth <= 0) {
|
if (Engine.Counters.passiveFactionGrowth <= 0) {
|
||||||
@ -675,6 +676,11 @@ var Engine = {
|
|||||||
processPassiveFactionRepGain(adjustedCycles);
|
processPassiveFactionRepGain(adjustedCycles);
|
||||||
Engine.Counters.passiveFactionGrowth = 600;
|
Engine.Counters.passiveFactionGrowth = 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Engine.Counters.messages <= 0) {
|
||||||
|
checkForMessagesToSend();
|
||||||
|
Engine.Counters.messages = 300;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/* Calculates the hack progress for a manual (non-scripted) hack and updates the progress bar/time accordingly */
|
/* Calculates the hack progress for a manual (non-scripted) hack and updates the progress bar/time accordingly */
|
||||||
|
@ -29,3 +29,7 @@ function clearEventListeners(elemId) {
|
|||||||
elem.parentNode.replaceChild(newElem, elem);
|
elem.parentNode.replaceChild(newElem, elem);
|
||||||
return newElem;
|
return newElem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getRandomInt(min, max) {
|
||||||
|
return Math.floor(Math.random() * (max - min + 1)) + min;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user