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; top: 0;
width: 100%; width: 100%;
height: 100%; height: 100%;
overflow: auto; /* Enable scroll if needed */
background-color: rbga(var(--my-background-color), 0.4); background-color: rbga(var(--my-background-color), 0.4);
} }
@ -17,10 +16,12 @@
padding: 12px; padding: 12px;
border: 5px solid var(--my-highlight-color); border: 5px solid var(--my-highlight-color);
width: 70%; width: 70%;
overflow: auto; /* Enable scroll if needed */
color: var(--my-font-color); color: var(--my-font-color);
} }
.popup-box-button { .popup-box-button,
.popup-box-button-inactive {
color: #aaa; color: #aaa;
float: right; float: right;
font-size: 16px; font-size: 16px;
@ -37,6 +38,11 @@
cursor: pointer; cursor: pointer;
} }
.popupbox-button-inactive {
pointer-events: none;
cursor: default;
}
.dialog-box-container, .dialog-box-container,
#log-box-container { #log-box-container {
display: block; 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 **/ setting a default font size and family for the page **/
:root{ :root{
--my-font-color: #66ff33; --my-font-color: #66ff33;
--my-background-color: #000000; --my-background-color: #000000;
--my-highlight-color: #ffffff; --my-highlight-color: #ffffff;
} }
* { * {
margin: 0; margin: 0;
padding: 0; padding: 0;
font-size: 16px; font-size: 16px;
@ -59,7 +59,7 @@ tr:focus {
position: fixed; position: fixed;
height: 100%; height: 100%;
overflow: auto; overflow: auto;
border: 0; border: 0;
border-bottom: 1px solid #000000; border-bottom: 1px solid #000000;
border-radius: 0; border-radius: 0;
@ -134,7 +134,6 @@ a:link, a:visited {
padding: 5px; padding: 5px;
margin: 5px; margin: 5px;
border: 1px solid #333333; border: 1px solid #333333;
/*width: 30%;*/
} }
.a-link-button:hover { .a-link-button:hover {
@ -148,13 +147,9 @@ a:link, a:visited {
color: #FFFFFF; color: #FFFFFF;
padding: 5px; padding: 5px;
margin: 5px; margin: 5px;
border-top: 1px solid #333333; border: 1px solid #333333;
border-right: 1px solid #333333;
border-bottom: 1px solid #333333;
border-left: 1px solid #333333;
pointer-events: none; pointer-events: none;
cursor: default; cursor: default;
/*width: 50%;*/
} }
@ -164,7 +159,7 @@ a:link, a:visited {
} }
#create-program-notification { #create-program-notification {
font-size: 10px; font-size: 10px;
position: absolute; /* Position the badge within the relatively positioned button */ position: absolute; /* Position the badge within the relatively positioned button */
top: 0; top: 0;
right: 0; right: 0;
@ -199,7 +194,7 @@ a:link, a:visited {
text-align: center; text-align: center;
padding: 4px; padding: 4px;
left: 101%; left: 101%;
position: absolute; position: absolute;
z-index: 3; z-index: 3;
} }

@ -25,8 +25,8 @@ BitNodes = {
"will earn the player money and reputation with the corresponding Faction<br>" + "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>" + "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>" + "For every Faction NOT listed above, reputation gains are halved<br>" +
"You will no longer gain passive reputation with Factions<br>" + "You will no longer gain passive reputation with Factions<br><br>" +
"Destroying the BitNode will give you Source-File 2, or if you already have this Source-File it will " + "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, " + "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>" + "crime money, and charisma multipliers by:<br><br>" +
"Level 1: 20%<br>" + "Level 1: 20%<br>" +
@ -41,6 +41,27 @@ BitNodes = {
BitNode9: new BitNode(9, "MegaCorp", "COMING SOON"), //Single corp/server with increasing difficulty BitNode9: new BitNode(9, "MegaCorp", "COMING SOON"), //Single corp/server with increasing difficulty
BitNode10: new BitNode(10, "Wasteland", "COMING SOON"), //Postapocalyptic BitNode10: new BitNode(10, "Wasteland", "COMING SOON"), //Postapocalyptic
BitNode11: new BitNode(11, "The Big Crash", "COMING SOON"), //Crashing economy 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 BitNode12: new BitNode(12, "Eye of the World", "COMING SOON"), //Become AI
} }

@ -76,6 +76,7 @@ CONSTANTS = {
ScriptReadWriteRamCost: 1.0, ScriptReadWriteRamCost: 1.0,
ScriptArbScriptRamCost: 1.0, //Functions that apply to all scripts regardless of args ScriptArbScriptRamCost: 1.0, //Functions that apply to all scripts regardless of args
ScriptGetScriptCost: 0.1, ScriptGetScriptCost: 0.1,
ScriptGetHackTimeCost: 0.05,
MultithreadingRAMCost: 1, 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 " + "<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. " + "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>" + "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>" + "<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>" + "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 " + "<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>", "World Stock Exchange account and TIX API Access<br>",
LatestUpdate: 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>" + "v0.27.2<br>" +
"-Added getServerGrowth() Netscript function<br>" + "-Added getServerGrowth() Netscript function<br>" +
"-Added getNextHacknetNodeCost() Netscript function<br>" + "-Added getNextHacknetNodeCost() Netscript function<br>" +

@ -1,4 +1,5 @@
/* Gang.js */ /* Gang.js */
//Switch between territory and management screen with 1 and 2
$(document).keydown(function(event) { $(document).keydown(function(event) {
if (Engine.currentPage == Engine.Page.Gang && !yesNoBoxOpen) { if (Engine.currentPage == Engine.Page.Gang && !yesNoBoxOpen) {
if (event.keyCode === 49) { 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", GangNames = ["Slum Snakes", "Tetrads", "The Syndicate", "The Dark Army", "Speakers for the Dead",
"NiteSec", "The Black Hand"]; "NiteSec", "The Black Hand"];
GangLocations = [Locations.Aevum, Locations.Chongqing, Locations.Sector12, Locations.NewTokyo, GangLocations = [Locations.Aevum, Locations.Chongqing, Locations.Sector12, Locations.NewTokyo,
@ -60,7 +76,7 @@ function processAllGangPowerGains(numCycles=1) {
if (name == playerGangName) { if (name == playerGangName) {
AllGangs[name].power += Player.gang.calculatePower(); AllGangs[name].power += Player.gang.calculatePower();
} else { } 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); AllGangs[name].power += (gain);
} }
} }
@ -311,7 +327,7 @@ GangMember.prototype.calculateWantedLevelGain = function() {
if (task.baseWanted < 0) { if (task.baseWanted < 0) {
return task.baseWanted * statWeight * territoryMult; return task.baseWanted * statWeight * territoryMult;
} else { } else {
return 5 * task.baseWanted / (3 * statWeight * territoryMult); return 6 * task.baseWanted / (3 * statWeight * territoryMult);
} }
} }
@ -424,13 +440,13 @@ GangMemberTasks = {
"Fraud & Counterfeiting", "Fraud & Counterfeiting",
"Assign this gang member to commit financial fraud and digital counterfeiting<br><br>" + "Assign this gang member to commit financial fraud and digital counterfeiting<br><br>" +
"Earns money - Slightly increases respect - Slightly increases wanted level", "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}), hackWeight: 80, chaWeight: 20, difficulty: 17}),
"Money Laundering" : new GangMemberTask( "Money Laundering" : new GangMemberTask(
"Money Laundering", "Money Laundering",
"Assign this gang member to launder money<br><br>" + "Assign this gang member to launder money<br><br>" +
"Earns money - Increases respect - Increases wanted level", "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}), hackWeight: 75, chaWeight: 25, difficulty: 20}),
"Cyberterrorism" : new GangMemberTask( "Cyberterrorism" : new GangMemberTask(
"Cyberterrorism", "Cyberterrorism",
@ -460,27 +476,27 @@ GangMemberTasks = {
"Run a Con", "Run a Con",
"Assign this gang member to run cons<br><br>" + "Assign this gang member to run cons<br><br>" +
"Earns money - Increases respect - Increases wanted level", "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}), strWeight: 5, defWeight: 5, agiWeight: 25, dexWeight: 25, chaWeight: 40, difficulty: 10}),
"Armed Robbery" : new GangMemberTask( "Armed Robbery" : new GangMemberTask(
"Armed Robbery", "Armed Robbery",
"Assign this gang member to commit armed robbery on stores, banks and armored cars<br><br>" + "Assign this gang member to commit armed robbery on stores, banks and armored cars<br><br>" +
"Earns money - Increases respect - Increases wanted level", "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, hackWeight: 20, strWeight: 15, defWeight: 15, agiWeight: 10, dexWeight: 20, chaWeight: 20,
difficulty: 17}), difficulty: 17}),
"Traffick Illegal Arms" : new GangMemberTask( "Traffick Illegal Arms" : new GangMemberTask(
"Traffick Illegal Arms", "Traffick Illegal Arms",
"Assign this gang member to traffick illegal arms<br><br>" + "Assign this gang member to traffick illegal arms<br><br>" +
"Earns money - Increases respect - Increases wanted level", "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, hackWeight: 15, strWeight: 20, defWeight: 20, dexWeight: 20, chaWeight: 75,
difficulty: 25}), difficulty: 25}),
"Threaten & Blackmail" : new GangMemberTask( "Threaten & Blackmail" : new GangMemberTask(
"Threaten & Blackmail", "Threaten & Blackmail",
"Assign this gang member to threaten and black mail high-profile targets<br><br>" + "Assign this gang member to threaten and black mail high-profile targets<br><br>" +
"Earns money - Slightly increases respect - Slightly increases wanted level", "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}), hackWeight: 25, strWeight: 25, dexWeight: 25, chaWeight: 25, difficulty: 28}),
"Terrorism" : new GangMemberTask( "Terrorism" : new GangMemberTask(
"Terrorism", "Terrorism",
@ -525,79 +541,79 @@ function GangMemberUpgrade(name="", desc="", cost=0, type="-") {
GangMemberUpgrade.prototype.apply = function(member, unapply=false) { GangMemberUpgrade.prototype.apply = function(member, unapply=false) {
switch(this.name) { switch(this.name) {
case "Baseball Bat": case "Baseball Bat":
unapply ? member.str /= 1.1 : member.str *= 1.1; unapply ? member.str_mult /= 1.1 : member.str_mult *= 1.1;
unapply ? member.def /= 1.1 : member.def *= 1.1; unapply ? member.def_mult /= 1.1 : member.def_mult *= 1.1;
break; break;
case "Katana": case "Katana":
unapply ? member.str /= 1.15 : member.str *= 1.15; unapply ? member.str_mult /= 1.15 : member.str_mult *= 1.15;
unapply ? member.def /= 1.15 : member.def *= 1.15; unapply ? member.def_mult /= 1.15 : member.def_mult *= 1.15;
unapply ? member.dex /= 1.15 : member.dex *= 1.15; unapply ? member.dex_mult /= 1.15 : member.dex_mult *= 1.15;
break; break;
case "Glock 18C": case "Glock 18C":
unapply ? member.str /= 1.2 : member.str *= 1.2; unapply ? member.str_mult /= 1.2 : member.str_mult *= 1.2;
unapply ? member.def /= 1.2 : member.def *= 1.2; unapply ? member.def_mult /= 1.2 : member.def_mult *= 1.2;
unapply ? member.dex /= 1.2 : member.dex *= 1.2; unapply ? member.dex_mult /= 1.2 : member.dex_mult *= 1.2;
unapply ? member.agi /= 1.2 : member.agi *= 1.2; unapply ? member.agi_mult /= 1.2 : member.agi_mult *= 1.2;
break; break;
case "P90": case "P90":
unapply ? member.str /= 1.4 : member.str *= 1.4; unapply ? member.str_mult /= 1.4 : member.str_mult *= 1.4;
unapply ? member.def /= 1.4 : member.def *= 1.4; unapply ? member.def_mult /= 1.4 : member.def_mult *= 1.4;
unapply ? member.agi /= 1.2 : member.agi *= 1.2; unapply ? member.agi_mult /= 1.2 : member.agi_mult *= 1.2;
break; break;
case "Steyr AUG": case "Steyr AUG":
unapply ? member.str /= 1.6 : member.str *= 1.6; unapply ? member.str_mult /= 1.6 : member.str_mult *= 1.6;
unapply ? member.def /= 1.6 : member.def *= 1.6; unapply ? member.def_mult /= 1.6 : member.def_mult *= 1.6;
break; break;
case "AK-47": case "AK-47":
unapply ? member.str /= 1.8 : member.str *= 1.8; unapply ? member.str_mult /= 1.8 : member.str_mult *= 1.8;
unapply ? member.def /= 1.8 : member.def *= 1.8; unapply ? member.def_mult /= 1.8 : member.def_mult *= 1.8;
break; break;
case "M15A10 Assault Rifle": case "M15A10 Assault Rifle":
unapply ? member.str /= 1.9 : member.str *= 1.9; unapply ? member.str_mult /= 1.9 : member.str_mult *= 1.9;
unapply ? member.def /= 1.9 : member.def *= 1.9; unapply ? member.def_mult /= 1.9 : member.def_mult *= 1.9;
break; break;
case "AWM Sniper Rifle": case "AWM Sniper Rifle":
unapply ? member.str /= 1.8 : member.str *= 1.8; unapply ? member.str_mult /= 1.8 : member.str_mult *= 1.8;
unapply ? member.dex /= 1.8 : member.dex *= 1.8; unapply ? member.dex_mult /= 1.8 : member.dex_mult *= 1.8;
unapply ? member.agi /= 1.8 : member.agi *= 1.8; unapply ? member.agi_mult /= 1.8 : member.agi_mult *= 1.8;
break; break;
case "Bulletproof Vest": case "Bulletproof Vest":
unapply ? member.def /= 1.15 : member.def *= 1.15; unapply ? member.def_mult /= 1.15 : member.def_mult *= 1.15;
break; break;
case "Full Body Armor": 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; break;
case "Liquid Body Armor": case "Liquid Body Armor":
unapply ? member.def /= 1.5 : member.def *= 1.5; unapply ? member.def_mult /= 1.5 : member.def_mult *= 1.5;
unapply ? member.agi /= 1.5 : member.agi *= 1.5; unapply ? member.agi_mult /= 1.5 : member.agi_mult *= 1.5;
break; break;
case "Graphene Plating Armor": case "Graphene Plating Armor":
unapply ? member.def /= 2 : member.def *= 2; unapply ? member.def_mult /= 2 : member.def_mult *= 2;
break; break;
case "Ford Flex V20": case "Ford Flex V20":
unapply ? member.agi /= 1.2 : member.agi *= 1.2; unapply ? member.agi_mult /= 1.2 : member.agi_mult *= 1.2;
unapply ? member.cha /= 1.2 : member.cha *= 1.2; unapply ? member.cha_mult /= 1.2 : member.cha_mult *= 1.2;
break; break;
case "ATX1070 Superbike": case "ATX1070 Superbike":
unapply ? member.agi /= 1.4 : member.agi *= 1.4; unapply ? member.agi_mult /= 1.4 : member.agi_mult *= 1.4;
unapply ? member.cha /= 1.4 : member.cha *= 1.4; unapply ? member.cha_mult /= 1.4 : member.cha_mult *= 1.4;
break; break;
case "Mercedes-Benz S9001": case "Mercedes-Benz S9001":
unapply ? member.agi /= 1.6 : member.agi *= 1.6; unapply ? member.agi_mult /= 1.6 : member.agi_mult *= 1.6;
unapply ? member.cha /= 1.6 : member.cha *= 1.6; unapply ? member.cha_mult /= 1.6 : member.cha_mult *= 1.6;
break; break;
case "White Ferrari": case "White Ferrari":
unapply ? member.agi /= 1.8 : member.agi *= 1.8; unapply ? member.agi_mult /= 1.8 : member.agi_mult *= 1.8;
unapply ? member.cha /= 1.8 : member.cha *= 1.8; unapply ? member.cha_mult /= 1.8 : member.cha_mult *= 1.8;
break; break;
case "NUKE Rootkit": case "NUKE Rootkit":
unapply ? member.hack /= 1.2 : member.hack *= 1.2; unapply ? member.hack_mult /= 1.2 : member.hack_mult *= 1.2;
break; break;
case "Soulstealer Rootkit": case "Soulstealer Rootkit":
unapply ? member.hack /= 1.3 : member.hack *= 1.3; unapply ? member.hack_mult /= 1.3 : member.hack_mult *= 1.3;
break; break;
case "Demon Rootkit": case "Demon Rootkit":
unapply ? member.hack /= 1.5 : member.hack *= 1.5; unapply ? member.hack_mult /= 1.5 : member.hack_mult *= 1.5;
break; break;
default: default:
console.log("ERROR: Could not find this upgrade: " + this.name); 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 //Create a pop-up box that lets player purchase upgrades
var gangMemberUpgradeBoxOpened = false;
function createGangMemberUpgradeBox(memberObj) { function createGangMemberUpgradeBox(memberObj) {
console.log("Creating gang member upgrade box for " + memberObj.name);
var container = document.getElementById("gang-purchase-upgrade-container"); var container = document.getElementById("gang-purchase-upgrade-container");
if (container) { if (container) {
while (container.firstChild) { while (container.firstChild) {
@ -710,11 +728,13 @@ function createGangMemberUpgradeBox(memberObj) {
var container = document.createElement("div"); var container = document.createElement("div");
container.setAttribute("id", "gang-purchase-upgrade-container"); container.setAttribute("id", "gang-purchase-upgrade-container");
document.getElementById("entire-game-container").appendChild(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"); 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); container.appendChild(content);
var intro = document.createElement("p"); 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 " + "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 " + "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 " + "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 //Weapons
var weaponTxt = document.createElement("p"); var weaponTxt = document.createElement("p");
weaponTxt.style.display = "block";
content.appendChild(weaponTxt); content.appendChild(weaponTxt);
if (memberObj.weaponUpgrade instanceof GangMemberUpgrade) { if (memberObj.weaponUpgrade instanceof GangMemberUpgrade) {
weaponTxt.innerHTML = "Weapons (Current Equip: " + memberObj.weaponUpgrade.name + ")"; 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", var weaponNames = ["Baseball Bat", "Katana", "Glock 18C", "P90", "Steyr AUG",
"AK-47", "M15A10 Assault Rifle", "AWM Sniper Rifle"]; "AK-47", "M15A10 Assault Rifle", "AWM Sniper Rifle"];
createGangMemberUpgradeButtons(memberObj, weaponNames, memberObj.weaponUpgrade, content); createGangMemberUpgradeButtons(memberObj, weaponNames, memberObj.weaponUpgrade, content);
content.appendChild(document.createElement("br"));
var armorTxt = document.createElement("p"); var armorTxt = document.createElement("p");
armorTxt.style.display = "block";
content.appendChild(armorTxt); content.appendChild(armorTxt);
if (memberObj.armorUpgrade instanceof GangMemberUpgrade) { if (memberObj.armorUpgrade instanceof GangMemberUpgrade) {
armorTxt.innerHTML = "Armor (Current Equip: " + memberObj.armorUpgrade.name + ")"; armorTxt.innerHTML = "Armor (Current Equip: " + memberObj.armorUpgrade.name + ")";
@ -751,6 +774,7 @@ function createGangMemberUpgradeBox(memberObj) {
createGangMemberUpgradeButtons(memberObj, armorNames, memberObj.armorUpgrade, content); createGangMemberUpgradeButtons(memberObj, armorNames, memberObj.armorUpgrade, content);
var vehicleTxt = document.createElement("p"); var vehicleTxt = document.createElement("p");
vehicleTxt.style.display = "block";
content.appendChild(vehicleTxt); content.appendChild(vehicleTxt);
if (memberObj.vehicleUpgrade instanceof GangMemberUpgrade) { if (memberObj.vehicleUpgrade instanceof GangMemberUpgrade) {
vehicleTxt.innerHTML = "Vehicles (Current Equip: " + memberObj.vehicleUpgrade.name + ")"; vehicleTxt.innerHTML = "Vehicles (Current Equip: " + memberObj.vehicleUpgrade.name + ")";
@ -762,6 +786,7 @@ function createGangMemberUpgradeBox(memberObj) {
createGangMemberUpgradeButtons(memberObj, vehicleNames, memberObj.vehicleUpgrade, content); createGangMemberUpgradeButtons(memberObj, vehicleNames, memberObj.vehicleUpgrade, content);
var rootkitTxt = document.createElement("p"); var rootkitTxt = document.createElement("p");
rootkitTxt.style.display = "block";
content.appendChild(rootkitTxt); content.appendChild(rootkitTxt);
if (memberObj.hackingUpgrade instanceof GangMemberUpgrade) { if (memberObj.hackingUpgrade instanceof GangMemberUpgrade) {
rootkitTxt.innerHTML = "Rootkits (Current Equip: " + memberObj.hackingUpgrade.name + ")"; rootkitTxt.innerHTML = "Rootkits (Current Equip: " + memberObj.hackingUpgrade.name + ")";
@ -770,6 +795,8 @@ function createGangMemberUpgradeBox(memberObj) {
} }
var rootkitNames = ["NUKE Rootkit", "Soulstealer Rootkit", "Demon Rootkit"]; var rootkitNames = ["NUKE Rootkit", "Soulstealer Rootkit", "Demon Rootkit"];
createGangMemberUpgradeButtons(memberObj, rootkitNames, memberObj.hackingUpgrade, content); createGangMemberUpgradeButtons(memberObj, rootkitNames, memberObj.hackingUpgrade, content);
gangMemberUpgradeBoxOpened = true;
} }
function createGangMemberUpgradeButtons(memberObj, upgNames, memberUpgrade, content) { function createGangMemberUpgradeButtons(memberObj, upgNames, memberUpgrade, content) {
@ -778,19 +805,31 @@ function createGangMemberUpgradeButtons(memberObj, upgNames, memberUpgrade, cont
var upgrade = GangMemberUpgrades[upgNames[i]]; var upgrade = GangMemberUpgrades[upgNames[i]];
if (upgrade == null) { if (upgrade == null) {
console.log("ERROR: Could not find GangMemberUpgrade object for" + upgNames[i]); console.log("ERROR: Could not find GangMemberUpgrade object for" + upgNames[i]);
continue; return; //Return inside closure
} }
//Skip the currently owned upgrade //Skip the currently owned upgrade
if (memberUpgrade instanceof GangMemberUpgrade && if (memberUpgrade instanceof GangMemberUpgrade &&
memberUpgrade.name == upgrade.name) {continue;} memberUpgrade.name == upgrade.name) {return;}
//Create button
var btn = document.createElement("a"); var btn = document.createElement("a");
btn.innerHTML = upgrade.name + " - $" + numeral(upgrade.cost).format('(0.00a)'); btn.innerHTML = upgrade.name + " - $" + numeral(upgrade.cost).format('(0.00a)');
if (Player.money.gte(upgrade.cost)) { if (Player.money.gte(upgrade.cost)) {
btn.setAttribute("class", "a-link-button"); btn.setAttribute("class", "popup-box-button tooltip")
} else { } 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); content.appendChild(btn);
btn.addEventListener("click", function() { btn.addEventListener("click", function() {
upgrade.purchase(memberObj); upgrade.purchase(memberObj);
@ -1083,7 +1122,16 @@ function createGangMemberDisplayElement(memberObj) {
var statsP = document.createElement("p"); var statsP = document.createElement("p");
statsP.setAttribute("id", name + "gang-member-stats-text"); statsP.setAttribute("id", name + "gang-member-stats-text");
statsP.style.display = "inline"; 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(statsP);
statsDiv.appendChild(upgradeButton);
//Panel for Selecting task and show respect/wanted gain //Panel for Selecting task and show respect/wanted gain
var taskDiv = document.createElement("div"); var taskDiv = document.createElement("div");

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

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

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