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 = {
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
//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
InfiltrationBribeBaseAmount: 100000, //Amount per clearance level
HospitalCostPerHp: 25000,
MillisecondsPer20Hours: 72000000,
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>" +
"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>" +
"<i>scan()</i><br>Returns an array containing the hostnames of all servers that are one node away from the current server. The " +
"current server is the server on which the script that calls this function is running. The hostnames are strings.<br><br>" +
"<i>scan(hostname/ip)</i><br>Returns an array containing the hostnames of all servers that are one node away from the specified server. " +
"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>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>" +
@ -857,6 +860,8 @@ CONSTANTS = {
"-You can now see what an Augmentation does and its price even while its locked<br><br>",
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>" +
"-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 " +

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