Merge pull request #79 from danielyxie/dev

Dev v0.23.1
This commit is contained in:
danielyxie 2017-06-29 09:22:30 -05:00 committed by GitHub
commit 5869cf28c4
2 changed files with 28 additions and 16 deletions

@ -1,5 +1,5 @@
CONSTANTS = { CONSTANTS = {
Version: "0.23.0", Version: "0.23.1",
//Max level for any skill, assuming no multipliers. Determined by max numerical value in javascript for experience //Max level for any skill, assuming no multipliers. Determined by max numerical value in javascript for experience
//and the skill level formula in Player.js. Note that all this means it that when experience hits MAX_INT, then //and the skill level formula in Player.js. Note that all this means it that when experience hits MAX_INT, then
@ -94,6 +94,9 @@ CONSTANTS = {
//Infiltration constants //Infiltration constants
InfiltrationBribeBaseAmount: 100000, //Amount per clearance level InfiltrationBribeBaseAmount: 100000, //Amount per clearance level
HospitalCostPerHp: 25000,
MillisecondsPer20Hours: 72000000, MillisecondsPer20Hours: 72000000,
GameCyclesPer20Hours: 72000000 / 200, GameCyclesPer20Hours: 72000000 / 200,
@ -421,8 +424,8 @@ CONSTANTS = {
"<i>print(x)</i> <br>Prints a value or a variable to the scripts logs (which can be viewed with the 'tail [script]' terminal command ). <br>" + "<i>print(x)</i> <br>Prints a value or a variable to the scripts logs (which can be viewed with the 'tail [script]' terminal command ). <br>" +
"WARNING: Do NOT call print() on an array. The script will crash. You can, however, call print on single elements of an array. For example, if " + "WARNING: Do NOT call print() on an array. The script will crash. You can, however, call print on single elements of an array. For example, if " +
"the variable 'a' is an array, then do NOT call print(a), but it is okay to call print(a[0]).<br><br>" + "the variable 'a' is an array, then do NOT call print(a), but it is okay to call print(a[0]).<br><br>" +
"<i>scan()</i><br>Returns an array containing the hostnames of all servers that are one node away from the current server. The " + "<i>scan(hostname/ip)</i><br>Returns an array containing the hostnames of all servers that are one node away from the specified server. " +
"current server is the server on which the script that calls this function is running. The hostnames are strings.<br><br>" + "The argument must be a string containing the IP or hostname of the target server. The hostnames in the returned array are strings.<br><br>" +
"<i>nuke(hostname/ip)</i><br>Run NUKE.exe on the target server. NUKE.exe must exist on your home computer. Does NOT work while offline <br> Example: nuke('foodnstuff'); <br><br>" + "<i>nuke(hostname/ip)</i><br>Run NUKE.exe on the target server. NUKE.exe must exist on your home computer. Does NOT work while offline <br> Example: nuke('foodnstuff'); <br><br>" +
"<i>brutessh(hostname/ip)</i><br>Run BruteSSH.exe on the target server. BruteSSH.exe must exist on your home computer. Does NOT work while offline <br> Example: brutessh('foodnstuff');<br><br>" + "<i>brutessh(hostname/ip)</i><br>Run BruteSSH.exe on the target server. BruteSSH.exe must exist on your home computer. Does NOT work while offline <br> Example: brutessh('foodnstuff');<br><br>" +
"<i>ftpcrack(hostname/ip)</i><br>Run FTPCrack.exe on the target server. FTPCrack.exe must exist on your home computer. Does NOT work while offline <br> Example: ftpcrack('foodnstuff');<br><br>" + "<i>ftpcrack(hostname/ip)</i><br>Run FTPCrack.exe on the target server. FTPCrack.exe must exist on your home computer. Does NOT work while offline <br> Example: ftpcrack('foodnstuff');<br><br>" +
@ -857,6 +860,8 @@ CONSTANTS = {
"-You can now see what an Augmentation does and its price even while its locked<br><br>", "-You can now see what an Augmentation does and its price even while its locked<br><br>",
LatestUpdate: LatestUpdate:
"v0.23.1<br>" +
"-scan() Netscript function now takes a single argument representing the server from which to scan. <br><br>" +
"v0.23.0<br>" + "v0.23.0<br>" +
"-You can now purchase multiple Augmentations in a run. When you purchase an Augmentation you will lose money equal to the price " + "-You can now purchase multiple Augmentations in a run. When you purchase an Augmentation you will lose money equal to the price " +
"and then the cost of purchasing another Augmentation during this run will be increased by 75%. You do not gain the benefits " + "and then the cost of purchasing another Augmentation during this run will be increased by 75%. You do not gain the benefits " +

@ -204,20 +204,27 @@ function evaluate(exp, workerScript) {
}); });
} else if (exp.func.value == "scan") { } else if (exp.func.value == "scan") {
if (exp.args.length != 0) { if (exp.args.length != 1) {
return reject(makeRuntimeRejectMsg(workerScript, "scan() call has incorrect number of arguments. Takes 0 arguments")); return reject(makeRuntimeRejectMsg(workerScript, "scan() call has incorrect number of arguments. Takes 1 argument"));
} }
var currServ = getServer(workerScript.serverIp);
if (currServ == null) { var ipPromise = evaluate(exp.args[0], workerScript);
return reject(makeRuntimeRejectMsg(workerScript, "Could not find server ip for this script. This is a bug please contact game developer")); ipPromise.then(function(ip) {
var server = getServer(ip);
if (server == null) {
workerScript.scriptRef.log("scan() failed. Invalid IP or hostname passed in: " + ip);
return reject(makeRuntimeRejectMsg(workerScript, "Invalid IP or hostname passed into scan() command"));;
} }
var res = []; var res = [];
for (var i = 0; i < currServ.serversOnNetwork.length; ++i) { for (var i = 0; i < server.serversOnNetwork.length; ++i) {
var thisServ = getServer(currServ.serversOnNetwork[i]); var thisServ = getServer(server.serversOnNetwork[i]);
if (thisServ == null) {continue;} if (thisServ == null) {continue;}
res.push({type:"str", value: thisServ.hostname}); res.push({type:"str", value: thisServ.hostname});
} }
resolve(res); resolve(res);
}, function(e) {
reject(e);
});
} else if (exp.func.value == "nuke") { } else if (exp.func.value == "nuke") {
var p = netscriptRunProgram(exp, workerScript, Programs.NukeProgram); var p = netscriptRunProgram(exp, workerScript, Programs.NukeProgram);
p.then(function(res) { p.then(function(res) {