0.27.3 Changes

This commit is contained in:
danielyxie 2017-08-19 20:36:19 -05:00
parent cf99c4f10b
commit faf19addee
9 changed files with 194 additions and 88 deletions

@ -7,7 +7,6 @@
top: 0;
width: 100%;
height: 100%;
overflow: auto; /* Enable scroll if needed */
background-color: rbga(var(--my-background-color), 0.4);
}
@ -17,10 +16,12 @@
padding: 12px;
border: 5px solid var(--my-highlight-color);
width: 70%;
overflow: auto; /* Enable scroll if needed */
color: var(--my-font-color);
}
.popup-box-button {
.popup-box-button,
.popup-box-button-inactive {
color: #aaa;
float: right;
font-size: 16px;
@ -37,6 +38,11 @@
cursor: pointer;
}
.popupbox-button-inactive {
pointer-events: none;
cursor: default;
}
.dialog-box-container,
#log-box-container {
display: block;

@ -1,15 +1,15 @@
/** This removes all padding and margins as well as
/** This removes all padding and margins as well as
setting a default font size and family for the page **/
:root{
--my-font-color: #66ff33;
--my-background-color: #000000;
--my-highlight-color: #ffffff;
}
* {
* {
margin: 0;
padding: 0;
font-size: 16px;
@ -59,7 +59,7 @@ tr:focus {
position: fixed;
height: 100%;
overflow: auto;
border: 0;
border-bottom: 1px solid #000000;
border-radius: 0;
@ -134,7 +134,6 @@ a:link, a:visited {
padding: 5px;
margin: 5px;
border: 1px solid #333333;
/*width: 30%;*/
}
.a-link-button:hover {
@ -148,13 +147,9 @@ a:link, a:visited {
color: #FFFFFF;
padding: 5px;
margin: 5px;
border-top: 1px solid #333333;
border-right: 1px solid #333333;
border-bottom: 1px solid #333333;
border-left: 1px solid #333333;
border: 1px solid #333333;
pointer-events: none;
cursor: default;
/*width: 50%;*/
}
@ -164,7 +159,7 @@ a:link, a:visited {
}
#create-program-notification {
font-size: 10px;
position: absolute; /* Position the badge within the relatively positioned button */
top: 0;
right: 0;
@ -199,7 +194,7 @@ a:link, a:visited {
text-align: center;
padding: 4px;
left: 101%;
position: absolute;
z-index: 3;
}

@ -25,8 +25,8 @@ BitNodes = {
"will earn the player money and reputation with the corresponding Faction<br>" +
"Every Augmentation in the game will be available through the Factions listed above<br>" +
"For every Faction NOT listed above, reputation gains are halved<br>" +
"You will no longer gain passive reputation with Factions<br>" +
"Destroying the BitNode will give you Source-File 2, or if you already have this Source-File it will " +
"You will no longer gain passive reputation with Factions<br><br>" +
"Destroying this BitNode will give you Source-File 2, or if you already have this Source-File it will " +
"upgrade its level up to a maximum of 3. This Source-File increases the player's crime success rate, " +
"crime money, and charisma multipliers by:<br><br>" +
"Level 1: 20%<br>" +
@ -41,6 +41,27 @@ BitNodes = {
BitNode9: new BitNode(9, "MegaCorp", "COMING SOON"), //Single corp/server with increasing difficulty
BitNode10: new BitNode(10, "Wasteland", "COMING SOON"), //Postapocalyptic
BitNode11: new BitNode(11, "The Big Crash", "COMING SOON"), //Crashing economy
/* Okay. Sell it all.
"The 2050s was defined by the massive amounts of violent civil unrest and anarchic rebellion that rose all around the world. It was this period " +
"of disorder that eventually lead to the governmental reformation of many global superpowers, most notably " +
"the USA and China. But just as the world was slowly beginning to recover from these dark times, financial catastrophe hit.<br><br>" +
"In many countries, the high cost of trying to deal with the civil disorder bankrupted the governments. In all of this chaos and confusion hackers " +
"were able to steal billions of dollars from the world's largest electronic banks, prompting an international banking crisis as " +
"governments were unable to bail out insolvent banks. Now, the world is slowly crumbling in the middle of the biggest economic crisis of all time.<br><br>" +
"In this BitNode:<br><br>" +
"The starting and maximum amount of money available on servers is significantly decreased<br>" +
"The growth rate of servers is halved<br>" +
"Weakening a server is twice as effective<br>" +
"Company wages are decreased by 25%<br>" +
"Hacknet Node production is significantly decreased<br>" +
"Augmentations are twice as expensive<br><br>" +
"Destroying this BitNode will give you Source-File 11, or if you already have this Source-File it will " +
"upgrade its level up to a maximum of 3. This Source-File increases the player's company salary multiplier by:<br><br>" +
"Level 1: 60%<br>" +
"Level 2: 90%<br>" +
"Level 3: 105%";
*/
BitNode12: new BitNode(12, "Eye of the World", "COMING SOON"), //Become AI
}

@ -76,6 +76,7 @@ CONSTANTS = {
ScriptReadWriteRamCost: 1.0,
ScriptArbScriptRamCost: 1.0, //Functions that apply to all scripts regardless of args
ScriptGetScriptCost: 0.1,
ScriptGetHackTimeCost: 0.05,
MultithreadingRAMCost: 1,
@ -519,6 +520,12 @@ CONSTANTS = {
"<i>getScriptRam(scriptname, hostname/ip)</i><br>Returns the amount of RAM required to run the specified script on the " +
"target server. The first argument must be a string with the name of the script. The script name is case sensitive. " +
"The second argument is a string with the hostname or IP of the server where that script is. Both arguments are required.<br><br>" +
"<i>getHackTime(hostname/ip)</i><br>Returns the amount of time in seconds it takes to execute the hack() Netscript function " +
"on the server specified by the hostname/ip. The argument must be a string with the hostname/ip of the target server.<br><br>" +
"<i>getGrowTime(hostname/ip)</i><br>Returns the amount of time in seconds it takes to execute the grow() Netscript function " +
"on the server specified by the hostname/ip. The argument must be a string with the hostname/ip of the target server.<br><br>" +
"<i>getWeakenTime(hostname/ip)</i><br>Returns the amount of time in seconds it takes to execute the weaken() Netscript function " +
"on the server specified by the hostname/ip. The argument must be a string with the hostname/ip of the target server.<br><br>" +
"<u><h1>Hacknet Nodes API</h1></u><br>" +
"Netscript provides the following API for accessing and upgrading your Hacknet Nodes through scripts. This API does NOT work offline.<br><br>" +
"<i>hacknetnodes</i><br> A special variable. This is an array that maps to the Player's Hacknet Nodes. The Hacknet Nodes are accessed through " +
@ -710,6 +717,11 @@ CONSTANTS = {
"World Stock Exchange account and TIX API Access<br>",
LatestUpdate:
"v0.27.3<br>" +
"-You can now purchase upgrades for Gang Members (BitNode 2 only)<br>" +
"-Decreased Gang respect gains and slightly increased wanted gains (BitNode 2 only)<br>" +
"-Other gangs will increase in power faster (BitNode 2 only)<br>" +
"-Added getHackTime(), getGrowTime(), and getWeakenTime() Netscript functions<br><br>" +
"v0.27.2<br>" +
"-Added getServerGrowth() Netscript function<br>" +
"-Added getNextHacknetNodeCost() Netscript function<br>" +

@ -1,4 +1,5 @@
/* Gang.js */
//Switch between territory and management screen with 1 and 2
$(document).keydown(function(event) {
if (Engine.currentPage == Engine.Page.Gang && !yesNoBoxOpen) {
if (event.keyCode === 49) {
@ -13,6 +14,21 @@ $(document).keydown(function(event) {
}
});
//Delete upgrade box when clicking outside
$(document).mousedown(function(event) {
if (gangMemberUpgradeBoxOpened) {
if ( $(event.target).closest("#gang-purchase-upgrade-container").get(0) == null ) {
//Delete the box
var container = document.getElementById("gang-purchase-upgrade-container");
while(container.firstChild) {
container.removeChild(container.firstChild);
}
container.parentNode.removeChild(container);
gangMemberUpgradeBoxOpened = false;
}
}
});
GangNames = ["Slum Snakes", "Tetrads", "The Syndicate", "The Dark Army", "Speakers for the Dead",
"NiteSec", "The Black Hand"];
GangLocations = [Locations.Aevum, Locations.Chongqing, Locations.Sector12, Locations.NewTokyo,
@ -60,7 +76,7 @@ function processAllGangPowerGains(numCycles=1) {
if (name == playerGangName) {
AllGangs[name].power += Player.gang.calculatePower();
} else {
var gain = Math.random() * 0.005; //TODO Adjust as necessary
var gain = Math.random() * 0.01; //TODO Adjust as necessary
AllGangs[name].power += (gain);
}
}
@ -311,7 +327,7 @@ GangMember.prototype.calculateWantedLevelGain = function() {
if (task.baseWanted < 0) {
return task.baseWanted * statWeight * territoryMult;
} else {
return 5 * task.baseWanted / (3 * statWeight * territoryMult);
return 6 * task.baseWanted / (3 * statWeight * territoryMult);
}
}
@ -424,13 +440,13 @@ GangMemberTasks = {
"Fraud & Counterfeiting",
"Assign this gang member to commit financial fraud and digital counterfeiting<br><br>" +
"Earns money - Slightly increases respect - Slightly increases wanted level",
{baseRespect: 0.0008, baseWanted: 0.1, baseMoney: 15,
{baseRespect: 0.0005, baseWanted: 0.1, baseMoney: 15,
hackWeight: 80, chaWeight: 20, difficulty: 17}),
"Money Laundering" : new GangMemberTask(
"Money Laundering",
"Assign this gang member to launder money<br><br>" +
"Earns money - Increases respect - Increases wanted level",
{baseRespect: 0.0009, baseWanted:0.2, baseMoney: 40,
{baseRespect: 0.0006, baseWanted:0.2, baseMoney: 40,
hackWeight: 75, chaWeight: 25, difficulty: 20}),
"Cyberterrorism" : new GangMemberTask(
"Cyberterrorism",
@ -460,27 +476,27 @@ GangMemberTasks = {
"Run a Con",
"Assign this gang member to run cons<br><br>" +
"Earns money - Increases respect - Increases wanted level",
{baseRespect: 0.0002, baseWanted: 0.01, baseMoney: 10,
{baseRespect: 0.00015, baseWanted: 0.01, baseMoney: 10,
strWeight: 5, defWeight: 5, agiWeight: 25, dexWeight: 25, chaWeight: 40, difficulty: 10}),
"Armed Robbery" : new GangMemberTask(
"Armed Robbery",
"Assign this gang member to commit armed robbery on stores, banks and armored cars<br><br>" +
"Earns money - Increases respect - Increases wanted level",
{baseRespect: 0.0002, baseWanted: 0.05, baseMoney: 25,
{baseRespect: 0.00015, baseWanted: 0.05, baseMoney: 25,
hackWeight: 20, strWeight: 15, defWeight: 15, agiWeight: 10, dexWeight: 20, chaWeight: 20,
difficulty: 17}),
"Traffick Illegal Arms" : new GangMemberTask(
"Traffick Illegal Arms",
"Assign this gang member to traffick illegal arms<br><br>" +
"Earns money - Increases respect - Increases wanted level",
{baseRespect: 0.0005, baseWanted: 0.1, baseMoney: 40,
{baseRespect: 0.0003, baseWanted: 0.1, baseMoney: 40,
hackWeight: 15, strWeight: 20, defWeight: 20, dexWeight: 20, chaWeight: 75,
difficulty: 25}),
"Threaten & Blackmail" : new GangMemberTask(
"Threaten & Blackmail",
"Assign this gang member to threaten and black mail high-profile targets<br><br>" +
"Earns money - Slightly increases respect - Slightly increases wanted level",
{baseRespect: 0.0001, baseWanted: 0.05, baseMoney: 15,
{baseRespect: 0.0002, baseWanted: 0.05, baseMoney: 15,
hackWeight: 25, strWeight: 25, dexWeight: 25, chaWeight: 25, difficulty: 28}),
"Terrorism" : new GangMemberTask(
"Terrorism",
@ -525,79 +541,79 @@ function GangMemberUpgrade(name="", desc="", cost=0, type="-") {
GangMemberUpgrade.prototype.apply = function(member, unapply=false) {
switch(this.name) {
case "Baseball Bat":
unapply ? member.str /= 1.1 : member.str *= 1.1;
unapply ? member.def /= 1.1 : member.def *= 1.1;
unapply ? member.str_mult /= 1.1 : member.str_mult *= 1.1;
unapply ? member.def_mult /= 1.1 : member.def_mult *= 1.1;
break;
case "Katana":
unapply ? member.str /= 1.15 : member.str *= 1.15;
unapply ? member.def /= 1.15 : member.def *= 1.15;
unapply ? member.dex /= 1.15 : member.dex *= 1.15;
unapply ? member.str_mult /= 1.15 : member.str_mult *= 1.15;
unapply ? member.def_mult /= 1.15 : member.def_mult *= 1.15;
unapply ? member.dex_mult /= 1.15 : member.dex_mult *= 1.15;
break;
case "Glock 18C":
unapply ? member.str /= 1.2 : member.str *= 1.2;
unapply ? member.def /= 1.2 : member.def *= 1.2;
unapply ? member.dex /= 1.2 : member.dex *= 1.2;
unapply ? member.agi /= 1.2 : member.agi *= 1.2;
unapply ? member.str_mult /= 1.2 : member.str_mult *= 1.2;
unapply ? member.def_mult /= 1.2 : member.def_mult *= 1.2;
unapply ? member.dex_mult /= 1.2 : member.dex_mult *= 1.2;
unapply ? member.agi_mult /= 1.2 : member.agi_mult *= 1.2;
break;
case "P90":
unapply ? member.str /= 1.4 : member.str *= 1.4;
unapply ? member.def /= 1.4 : member.def *= 1.4;
unapply ? member.agi /= 1.2 : member.agi *= 1.2;
unapply ? member.str_mult /= 1.4 : member.str_mult *= 1.4;
unapply ? member.def_mult /= 1.4 : member.def_mult *= 1.4;
unapply ? member.agi_mult /= 1.2 : member.agi_mult *= 1.2;
break;
case "Steyr AUG":
unapply ? member.str /= 1.6 : member.str *= 1.6;
unapply ? member.def /= 1.6 : member.def *= 1.6;
unapply ? member.str_mult /= 1.6 : member.str_mult *= 1.6;
unapply ? member.def_mult /= 1.6 : member.def_mult *= 1.6;
break;
case "AK-47":
unapply ? member.str /= 1.8 : member.str *= 1.8;
unapply ? member.def /= 1.8 : member.def *= 1.8;
unapply ? member.str_mult /= 1.8 : member.str_mult *= 1.8;
unapply ? member.def_mult /= 1.8 : member.def_mult *= 1.8;
break;
case "M15A10 Assault Rifle":
unapply ? member.str /= 1.9 : member.str *= 1.9;
unapply ? member.def /= 1.9 : member.def *= 1.9;
unapply ? member.str_mult /= 1.9 : member.str_mult *= 1.9;
unapply ? member.def_mult /= 1.9 : member.def_mult *= 1.9;
break;
case "AWM Sniper Rifle":
unapply ? member.str /= 1.8 : member.str *= 1.8;
unapply ? member.dex /= 1.8 : member.dex *= 1.8;
unapply ? member.agi /= 1.8 : member.agi *= 1.8;
unapply ? member.str_mult /= 1.8 : member.str_mult *= 1.8;
unapply ? member.dex_mult /= 1.8 : member.dex_mult *= 1.8;
unapply ? member.agi_mult /= 1.8 : member.agi_mult *= 1.8;
break;
case "Bulletproof Vest":
unapply ? member.def /= 1.15 : member.def *= 1.15;
unapply ? member.def_mult /= 1.15 : member.def_mult *= 1.15;
break;
case "Full Body Armor":
unapply ? member.def /= 1.3 : member.def *= 1.3;
unapply ? member.def_mult /= 1.3 : member.def_mult *= 1.3;
break;
case "Liquid Body Armor":
unapply ? member.def /= 1.5 : member.def *= 1.5;
unapply ? member.agi /= 1.5 : member.agi *= 1.5;
unapply ? member.def_mult /= 1.5 : member.def_mult *= 1.5;
unapply ? member.agi_mult /= 1.5 : member.agi_mult *= 1.5;
break;
case "Graphene Plating Armor":
unapply ? member.def /= 2 : member.def *= 2;
unapply ? member.def_mult /= 2 : member.def_mult *= 2;
break;
case "Ford Flex V20":
unapply ? member.agi /= 1.2 : member.agi *= 1.2;
unapply ? member.cha /= 1.2 : member.cha *= 1.2;
unapply ? member.agi_mult /= 1.2 : member.agi_mult *= 1.2;
unapply ? member.cha_mult /= 1.2 : member.cha_mult *= 1.2;
break;
case "ATX1070 Superbike":
unapply ? member.agi /= 1.4 : member.agi *= 1.4;
unapply ? member.cha /= 1.4 : member.cha *= 1.4;
unapply ? member.agi_mult /= 1.4 : member.agi_mult *= 1.4;
unapply ? member.cha_mult /= 1.4 : member.cha_mult *= 1.4;
break;
case "Mercedes-Benz S9001":
unapply ? member.agi /= 1.6 : member.agi *= 1.6;
unapply ? member.cha /= 1.6 : member.cha *= 1.6;
unapply ? member.agi_mult /= 1.6 : member.agi_mult *= 1.6;
unapply ? member.cha_mult /= 1.6 : member.cha_mult *= 1.6;
break;
case "White Ferrari":
unapply ? member.agi /= 1.8 : member.agi *= 1.8;
unapply ? member.cha /= 1.8 : member.cha *= 1.8;
unapply ? member.agi_mult /= 1.8 : member.agi_mult *= 1.8;
unapply ? member.cha_mult /= 1.8 : member.cha_mult *= 1.8;
break;
case "NUKE Rootkit":
unapply ? member.hack /= 1.2 : member.hack *= 1.2;
unapply ? member.hack_mult /= 1.2 : member.hack_mult *= 1.2;
break;
case "Soulstealer Rootkit":
unapply ? member.hack /= 1.3 : member.hack *= 1.3;
unapply ? member.hack_mult /= 1.3 : member.hack_mult *= 1.3;
break;
case "Demon Rootkit":
unapply ? member.hack /= 1.5 : member.hack *= 1.5;
unapply ? member.hack_mult /= 1.5 : member.hack_mult *= 1.5;
break;
default:
console.log("ERROR: Could not find this upgrade: " + this.name);
@ -700,7 +716,9 @@ GangMemberUpgrades = {
}
//Create a pop-up box that lets player purchase upgrades
var gangMemberUpgradeBoxOpened = false;
function createGangMemberUpgradeBox(memberObj) {
console.log("Creating gang member upgrade box for " + memberObj.name);
var container = document.getElementById("gang-purchase-upgrade-container");
if (container) {
while (container.firstChild) {
@ -710,11 +728,13 @@ function createGangMemberUpgradeBox(memberObj) {
var container = document.createElement("div");
container.setAttribute("id", "gang-purchase-upgrade-container");
document.getElementById("entire-game-container").appendChild(container);
container.setAttribute("class", "popup-box-container");
container.setAttribute("class", "dialog-box-container");
container.style.display = "block";
}
var content = document.createElement("div");
content.setAttribute("class", "popup-box-content");
content.setAttribute("class", "dialog-box-content");
content.setAttribute("id", "gang-purchase-upgrade-content");
container.appendChild(content);
var intro = document.createElement("p");
@ -725,10 +745,11 @@ function createGangMemberUpgradeBox(memberObj) {
"For each of these pieces of equipment, a gang member can only have one at a time (i.e " +
"a member cannot have two weapons or two vehicles). Purchasing an upgrade will automatically " +
"replace the member's existing upgrade, if he/she is equipped with one. The existing upgrade " +
"will be lost and will have to be re-purchased if you want to switch back.";
"will be lost and will have to be re-purchased if you want to switch back.<br><br>";
//Weapons
var weaponTxt = document.createElement("p");
weaponTxt.style.display = "block";
content.appendChild(weaponTxt);
if (memberObj.weaponUpgrade instanceof GangMemberUpgrade) {
weaponTxt.innerHTML = "Weapons (Current Equip: " + memberObj.weaponUpgrade.name + ")";
@ -738,8 +759,10 @@ function createGangMemberUpgradeBox(memberObj) {
var weaponNames = ["Baseball Bat", "Katana", "Glock 18C", "P90", "Steyr AUG",
"AK-47", "M15A10 Assault Rifle", "AWM Sniper Rifle"];
createGangMemberUpgradeButtons(memberObj, weaponNames, memberObj.weaponUpgrade, content);
content.appendChild(document.createElement("br"));
var armorTxt = document.createElement("p");
armorTxt.style.display = "block";
content.appendChild(armorTxt);
if (memberObj.armorUpgrade instanceof GangMemberUpgrade) {
armorTxt.innerHTML = "Armor (Current Equip: " + memberObj.armorUpgrade.name + ")";
@ -751,6 +774,7 @@ function createGangMemberUpgradeBox(memberObj) {
createGangMemberUpgradeButtons(memberObj, armorNames, memberObj.armorUpgrade, content);
var vehicleTxt = document.createElement("p");
vehicleTxt.style.display = "block";
content.appendChild(vehicleTxt);
if (memberObj.vehicleUpgrade instanceof GangMemberUpgrade) {
vehicleTxt.innerHTML = "Vehicles (Current Equip: " + memberObj.vehicleUpgrade.name + ")";
@ -762,6 +786,7 @@ function createGangMemberUpgradeBox(memberObj) {
createGangMemberUpgradeButtons(memberObj, vehicleNames, memberObj.vehicleUpgrade, content);
var rootkitTxt = document.createElement("p");
rootkitTxt.style.display = "block";
content.appendChild(rootkitTxt);
if (memberObj.hackingUpgrade instanceof GangMemberUpgrade) {
rootkitTxt.innerHTML = "Rootkits (Current Equip: " + memberObj.hackingUpgrade.name + ")";
@ -770,6 +795,8 @@ function createGangMemberUpgradeBox(memberObj) {
}
var rootkitNames = ["NUKE Rootkit", "Soulstealer Rootkit", "Demon Rootkit"];
createGangMemberUpgradeButtons(memberObj, rootkitNames, memberObj.hackingUpgrade, content);
gangMemberUpgradeBoxOpened = true;
}
function createGangMemberUpgradeButtons(memberObj, upgNames, memberUpgrade, content) {
@ -778,19 +805,31 @@ function createGangMemberUpgradeButtons(memberObj, upgNames, memberUpgrade, cont
var upgrade = GangMemberUpgrades[upgNames[i]];
if (upgrade == null) {
console.log("ERROR: Could not find GangMemberUpgrade object for" + upgNames[i]);
continue;
return; //Return inside closure
}
//Skip the currently owned upgrade
if (memberUpgrade instanceof GangMemberUpgrade &&
memberUpgrade.name == upgrade.name) {continue;}
memberUpgrade.name == upgrade.name) {return;}
//Create button
var btn = document.createElement("a");
btn.innerHTML = upgrade.name + " - $" + numeral(upgrade.cost).format('(0.00a)');
if (Player.money.gte(upgrade.cost)) {
btn.setAttribute("class", "a-link-button");
btn.setAttribute("class", "popup-box-button tooltip")
} else {
btn.setAttribute("class", "a-link-button-inactive");
btn.setAttribute("class", "popup-box-button-inactive tooltip");
}
btn.style.cssFloat = "none";
btn.style.display = "block";
btn.style.margin = "8px";
btn.style.width = "40%";
//Tooltip for upgrade
var tooltip = document.createElement("span");
tooltip.setAttribute("class", "tooltiptext");
tooltip.innerHTML = upgrade.desc;
btn.appendChild(tooltip);
content.appendChild(btn);
btn.addEventListener("click", function() {
upgrade.purchase(memberObj);
@ -1083,7 +1122,16 @@ function createGangMemberDisplayElement(memberObj) {
var statsP = document.createElement("p");
statsP.setAttribute("id", name + "gang-member-stats-text");
statsP.style.display = "inline";
var upgradeButton = document.createElement("a");
upgradeButton.setAttribute("id", name + "gang-member-upgrade-btn");
upgradeButton.setAttribute("class", "popup-box-button");
upgradeButton.style.cssFloat = "left";
upgradeButton.innerHTML = "Purchase Upgrades";
upgradeButton.addEventListener("click", function() {
createGangMemberUpgradeBox(memberObj);
});
statsDiv.appendChild(statsP);
statsDiv.appendChild(upgradeButton);
//Panel for Selecting task and show respect/wanted gain
var taskDiv = document.createElement("div");

@ -841,6 +841,30 @@ function NetscriptFunctions(workerScript) {
}
return 0;
},
getHackTime : function(ip) {
var server = getServer(ip);
if (server == null) {
workerScript.scriptRef.log("getHackTime() failed. Invalid IP or hostname passed in: " + ip);
throw makeRuntimeRejectMsg(workerScript, "getHackTime() failed. Invalid IP or hostname passed in: " + ip);
}
return scriptCalculateHackingTime(server); //Returns seconds
},
getGrowTime : function(ip) {
var server = getServer(ip);
if (server == null) {
workerScript.scriptRef.log("getGrowTime() failed. Invalid IP or hostname passed in: " + ip);
throw makeRuntimeRejectMsg(workerScript, "getGrowTime() failed. Invalid IP or hostname passed in: " + ip);
}
return scriptCalculateGrowTime(server) / 1000; //Returns seconds
},
getWeakenTime : function(ip) {
var server = getServer(ip);
if (server == null) {
workerScript.scriptRef.log("getWeakenTime() failed. Invalid IP or hostname passed in: " + ip);
throw makeRuntimeRejectMsg(workerScript, "getWeakenTime() failed. Invalid IP or hostname passed in: " + ip);
}
return scriptCalculateWeakenTime(server) / 1000; //Returns seconds
}
}
}

@ -379,7 +379,7 @@ function prestigeSourceFile() {
delete Augmentations[name];
}
}
//Re-initialize things - This will update any changes
initFactions(); //Factions must be initialized before augmentations
initAugmentations(); //Calls reapplyAllAugmentations() and resets Player multipliers
@ -398,6 +398,7 @@ function prestigeSourceFile() {
//Reset Stock market
Player.hasWseAccount = false;
Player.hasTixApiAccess = false;
Player.playtimeSinceLastAug = 0;

@ -90,8 +90,8 @@ function giveSourceFile(bitNodeNumber) {
//Check if player already has this source file
var alreadyOwned = false;
var ownedSourceFile = null;
for (var i = 0; i < Player.sourceFiles; ++i) {
if (Player.sourceFiles[i].n == bitNodeNumber) {
for (var i = 0; i < Player.sourceFiles.length; ++i) {
if (Player.sourceFiles[i].n === bitNodeNumber) {
alreadyOwned = true;
ownedSourceFile = Player.sourceFiles[i];
break;

@ -169,13 +169,14 @@ function calculateRamUsage(codeCopy) {
var hasRootAccessCount = numOccurrences(codeCopy, "hasRootAccess(");
var getHostnameCount = numOccurrences(codeCopy, "getHostname(");
var getHackingLevelCount = numOccurrences(codeCopy, "getHackingLevel(");
var getServerMoneyAvailableCount = numOccurrences(codeCopy, "getServerMoneyAvailable(");
var getServerMaxMoneyCount = numOccurrences(codeCopy, "getServerMaxMoney(");
var getServerSecurityCount = numOccurrences(codeCopy, "getServerSecurityLevel(");
var getServerBaseSecurityCount = numOccurrences(codeCopy, "getServerBaseSecurityLevel(");
var getServerReqdHackingCount = numOccurrences(codeCopy, "getServerRequiredHackingLevel(");
var getServerNumPortsReqdCount = numOccurrences(codeCopy, "getServerNumPortsRequired(");
var getServerRamCount = numOccurrences(codeCopy, "getServerRam(");
var getServerCount = numOccurrences(codeCopy, "getServerMoneyAvailable(") +
numOccurrences(codeCopy, "getServerMaxMoney(") +
numOccurrences(codeCopy, "getServerSecurityLevel(") +
numOccurrences(codeCopy, "getServerBaseSecurityLevel(") +
numOccurrences(codeCopy, "getServerGrowth(") +
numOccurrences(codeCopy, "getServerRequiredHackingLevel(") +
numOccurrences(codeCopy, "getServerNumPortsRequired(") +
numOccurrences(codeCopy, "getServerRam(");
var fileExistsCount = numOccurrences(codeCopy, "fileExists(");
var isRunningCount = numOccurrences(codeCopy, "isRunning(");
var numOperators = numNetscriptOperators(codeCopy);
@ -196,6 +197,9 @@ function calculateRamUsage(codeCopy) {
var arbScriptCount = numOccurrences(codeCopy, "scriptRunning(") +
numOccurrences(codeCopy, "scriptKill(");
var getScriptCount = numOccurrences(codeCopy, "getScriptRam(");
var getHackTimeCount = numOccurrences(codeCopy, "getHackTime(") +
numOccurrences(codeCopy, "getGrowTime(") +
numOccurrences(codeCopy, "getWeakenTime(");
return baseRam +
((whileCount * CONSTANTS.ScriptWhileRamCost) +
@ -218,13 +222,7 @@ function calculateRamUsage(codeCopy) {
(hasRootAccessCount * CONSTANTS.ScriptHasRootAccessRamCost) +
(getHostnameCount * CONSTANTS.ScriptGetHostnameRamCost) +
(getHackingLevelCount * CONSTANTS.ScriptGetHackingLevelRamCost) +
(getServerMoneyAvailableCount * CONSTANTS.ScriptGetServerCost) +
(getServerMaxMoneyCount * CONSTANTS.ScriptGetServerCost) +
(getServerSecurityCount * CONSTANTS.ScriptGetServerCost) +
(getServerBaseSecurityCount * CONSTANTS.ScriptGetServerCost) +
(getServerReqdHackingCount * CONSTANTS.ScriptGetServerCost) +
(getServerNumPortsReqdCount * CONSTANTS.ScriptGetServerCost) +
(getServerRamCount * CONSTANTS.ScriptGetServerCost) +
(getServerCount * CONSTANTS.ScriptGetServerCost) +
(fileExistsCount * CONSTANTS.ScriptFileExistsRamCost) +
(isRunningCount * CONSTANTS.ScriptIsRunningRamCost) +
(numOperators * CONSTANTS.ScriptOperatorRamCost) +
@ -240,7 +238,8 @@ function calculateRamUsage(codeCopy) {
(scriptWriteCount * CONSTANTS.ScriptReadWriteRamCost) +
(scriptReadCount * CONSTANTS.ScriptReadWriteRamCost) +
(arbScriptCount * CONSTANTS.ScriptArbScriptRamCost) +
(getScriptCount * CONSTANTS.ScriptGetScriptCost));
(getScriptCount * CONSTANTS.ScriptGetScriptCost) +
(getHackTimeCount * CONSTANTS.ScriptGetHackTimeCost));
}
Script.prototype.toJSON = function() {