Added scp command to netscript. Nerfed Hacknet Node augmentations

This commit is contained in:
Daniel Xie 2017-05-29 20:25:52 -05:00
parent 54bf26689f
commit 3ff1e8e87d
6 changed files with 63 additions and 10 deletions

@ -789,7 +789,7 @@ initAugmentations = function() {
HacknetNodeKernelDNI.setInfo("Installs a Direct-Neural Interface jack into the arm that is capable of connecting to a " +
"Hacknet Node. This lets the user access and manipulate the Node's kernel using the mind's " +
"electrochemical signals.<br><br>" +
"This augmentation increases the amount of money produced by Hacknet Nodes by 30%.");
"This augmentation increases the amount of money produced by Hacknet Nodes by 25%.");
HacknetNodeKernelDNI.addToFactions(["Netburners"]);
if (augmentationExists(AugmentationNames.HacknetNodeKernelDNI)) {
HacknetNodeKernelDNI.owned = Augmentations[AugmentationNames.HacknetNodeKernelDNI].owned;
@ -802,7 +802,7 @@ initAugmentations = function() {
HacknetNodeCoreDNI.setInfo("Installs a Direct-Neural Interface jack into the arm that is capable of connecting " +
"to a Hacknet Node. This lets the user access and manipulate the Node's processing logic using " +
"the mind's electrochemical signals.<br><br>" +
"This augmentation increases the amount of money produced by Hacknet Nodes by 50%.");
"This augmentation increases the amount of money produced by Hacknet Nodes by 45%.");
HacknetNodeCoreDNI.addToFactions(["Netburners"]);
if (augmentationExists(AugmentationNames.HacknetNodeCoreDNI)) {
HacknetNodeCoreDNI.owned = Augmentations[AugmentationNames.HacknetNodeCoreDNI].owned;
@ -1528,10 +1528,10 @@ applyAugmentation = function(aug, reapply=false) {
Player.hacknet_node_purchase_cost_mult *= 0.9;
break;
case AugmentationNames.HacknetNodeKernelDNI:
Player.hacknet_node_money_mult *= 1.30;
Player.hacknet_node_money_mult *= 1.25;
break;
case AugmentationNames.HacknetNodeCoreDNI:
Player.hacknet_node_money_mult *= 1.50;
Player.hacknet_node_money_mult *= 1.45;
break;
//Misc augmentations

@ -147,15 +147,16 @@ CONSTANTS = {
"home Connect to home computer<br>" +
"hostname Displays the hostname of the machine<br>" +
"ifconfig Displays the IP address of the machine<br>" +
"kill [script name] Stops a script that is running on the current machine<br>" +
"kill [script] Stops a script that is running on the current machine<br>" +
"ls Displays all programs and scripts on the machine<br>" +
"mem [script name] Displays the amount of RAM the script requires to run<br>" +
"nano [script name] Text editor - Open up and edit a script<br>" +
"mem [script] Displays the amount of RAM the script requires to run<br>" +
"nano [script] Text editor - Open up and edit a script<br>" +
"ps Display all scripts that are currently running<br>" +
"rm Delete a script/program from the machine. (WARNING: Permanent)<br>" +
"run [script/program] Execute a program or a script<br>" +
"scan Displays all available network connections<br>" +
"scan-analyze [depth] Displays hacking-related information for all servers up to <i>depth</i> nodes away<br>" +
"scp [script] [server] Copies a script to a destination server (specified by ip or hostname)<br>" +
"sudov Shows whether or not you have root access on this computer<br>" +
"tail [script] Display script logs (logs contain details about active scripts)<br>" +
"top Display all running scripts and their RAM usage<br>",

@ -861,7 +861,7 @@ displayLocationContent = function() {
case Locations.AevumSlums:
case Locations.ChongqingSlums:
case Locations.Sector12Slums:
case Locations.NewTokyokSlums:
case Locations.NewTokyoSlums:
case Locations.IshimaSlums:
case Locations.VolhavenSlums:
var shopliftChance = determineCrimeChanceShoplift();

@ -707,6 +707,58 @@ function evaluate(exp, workerScript) {
}, function(e) {
reject(e);
});
} else if (exp.func.value == "scp") {
if (exp.args.length != 1) {
reject(makeRuntimeRejectMsg(workerScript, "scp() call has incorrect number of arguments. Takes 2 arguments"));
return;
}
var scriptNamePromise = evaluate(exp.args[0], workerScript);
scriptNamePromise.then(function(scriptname) {
var ipPromise = evaluate(exp.args[1], workerScript);
ipPromise.then(function(ip) {
var destServer = getServer(ip);
if (destServer == null) {
reject(makeRuntimeRejectMsg(workerScript, "Invalid hostname/ip passed into scp() command: " + ip));
return;
}
//Check that a script with this filename does not already exist
for (var i = 0; i < destServer.scripts.length; ++i) {
if (scriptname == destServer.scripts[i].filename) {
workerScript.scriptRef.log(destServ.hostname + " already contains a script named " + scriptname);
resolve(false);
return;
}
}
var currServ = getServer(workerScript.serverIp);
if (currServ == null) {
reject(makeRuntimeRejectMsg(workerScript, "Could not find server ip for this script. This is a bug please contact game developer"));
return;
}
for (var i = 0; i < currServ.scripts.length; ++i) {
if (scriptname == currServ.scripts[i].filename) {
var newScript = new Script();
newScript.filename = scriptname;
newScript.code = currServ.scripts[i].code;
newScript.ramUsage = currServ.scripts[i].ramUsage;
newScript.server = ip;
server.scripts.push(newScript);
workerScript.scriptRef.log(scriptname + " copied over to " + server.hostname);
resolve(true);
return;
}
}
workerScript.scriptRef.log(scriptname + " does not exist. scp() failed");
resolve(false);
}, function(e) {
reject(e);
});
}, function(e) {
reject(e);
});
} else if (exp.func.value == "getHostname") {
if (exp.args.length != 0) {
reject(makeRuntimeRejectMsg(workerScript, "getHostname() call has incorrect number of arguments. Takes 0 arguments"));

@ -789,8 +789,7 @@ var Terminal = {
var currServ = Player.getCurrentServer();
for (var i = 0; i < currServ.scripts.length; ++i) {
if (scriptname == currServ.scripts[i].filename){
if (scriptname == currServ.scripts[i].filename) {
var newScript = new Script();
newScript.filename = scriptname;
newScript.code = currServ.scripts[i].code;

@ -1092,6 +1092,7 @@ var Engine = {
document.getElementById("debug-delete-scripts-link").addEventListener("click", function() {
console.log("Deleting running scripts on home computer");
Player.getHomeComputer().runningScripts = [];
dialogBoxCreate("Forcefully deleted scripts. Please refresh page");
return false;
});
},