Merge pull request #2 from danielyxie/dev

Dev v0.2
This commit is contained in:
danielyxie
2017-05-04 20:10:55 -05:00
committed by GitHub
29 changed files with 2671 additions and 718 deletions

View File

@ -66,8 +66,10 @@ TESTING TODO:
Should add something where if you click it in the "Active Scripts" GUI you can see the logs too
Seems to work fine
Tasks TODO:
Add Silhouette Criminal Faction
Adding augmentations for Silhouette fac
Factions Info page isn't formatted correctly
Augmentations that decrease time to make programs

View File

@ -4,10 +4,16 @@
/* Character Info */
#character-container {
position: fixed;
height: 100%;
padding-top: 10px;
padding-left: 10px;
margin-left: 10%;
width: 99%;
overflow-y: scroll;
}
#character-info {
overflow-y: scroll;
}
@ -24,24 +30,39 @@
padding-left: 10px;
height: 100%;
margin-left: 10%;
width: 75%;
color: #66ff33;
}
#script-editor-filename-tag {
padding-top: 10px;
padding-bottom: 0px;
float: left;
}
#script-editor-save-and-close-button {
float: right;
display: inline-block;
}
#script-editor-filename {
float: left;
resize: none;
color: #66ff33;
width: 100%;
margin: 4px;
padding: 4px;
border: none;
outline: none;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
border: 2px solid white;
-webkit-box-shadow:
inset 0 0 8px rgba(0,0,0,0.1),
0 0 16px rgba(0,0,0,0.1);
-moz-box-shadow:
inset 0 0 8px rgba(0,0,0,0.1),
0 0 16px rgba(0,0,0,0.1);
box-shadow:
inset 0 0 8px rgba(0,0,0,0.1),
0 0 16px rgba(0,0,0,0.1);
}
#script-editor-status {
@ -51,13 +72,21 @@
#script-editor-text {
color: #66ff33;
width: 90%;
width: 100%;
height: 100%;
margin: 4px;
padding: 4px;
outline: none;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
border: 2px solid white;
-webkit-box-shadow:
inset 0 0 8px rgba(0,0,0,0.1),
0 0 16px rgba(0,0,0,0.1);
-moz-box-shadow:
inset 0 0 8px rgba(0,0,0,0.1),
0 0 16px rgba(0,0,0,0.1);
box-shadow:
inset 0 0 8px rgba(0,0,0,0.1),
0 0 16px rgba(0,0,0,0.1);
}
/* Active scripts */
@ -75,6 +104,11 @@
overflow-y: scroll;
}
.active-scripts-list > li {
margin: 6px;
width: 80%;
}
.active-scripts-list>li h2{
color: #66ff33;
padding-top: 10px;
@ -91,6 +125,54 @@
text-decoration: none;
}
/* Hacknet Nodes */
#hacknet-nodes-container {
position: fixed;
padding: 10px;
height: 100%;
margin-left: 10%;
width: 99%;
overflow-y: scroll;
}
#hacknet-nodes-container li{
padding: 6px;
margin: 6px;
}
#hacknet-nodes-text,
#hacknet-nodes-money {
width: 80%;
margin: 10px;
padding: 10px;
}
.hacknet-node {
margin: 6px;
padding: 6px;
width: 85%;
border: 2px solid white;
-webkit-box-shadow:
inset 0 0 8px rgba(0,0,0,0.1),
0 0 16px rgba(0,0,0,0.1);
-moz-box-shadow:
inset 0 0 8px rgba(0,0,0,0.1),
0 0 16px rgba(0,0,0,0.1);
box-shadow:
inset 0 0 8px rgba(0,0,0,0.1),
0 0 16px rgba(0,0,0,0.1);
}
.hacknet-node-button-div a {
display: block;
}
.hacknet-node-button-div:not(:last-child) {
border-bottom: none;
}
/* World */
#world-container {
position: fixed;
@ -202,8 +284,6 @@
list-style-type: none;
}
/* Augmentations */
#augmentations-container {
position: fixed;
@ -215,6 +295,19 @@
color: #66ff33;
}
#augmentations-list > li {
margin: 6px;
width: 80%;
}
#augmentations-list > li h2{
color: #66ff33;
padding-top: 10px;
padding-left: 10px;
background-color: #333;
text-decoration: none;
}
.installed-augmentation {
/* TODO */
}
@ -227,21 +320,30 @@
padding-left: 10px;
height: 100%;
margin-left: 10%;
width: 99%;
width: 85%;
}
/* Location */
#location-container {
color: #66ff33;
position: fixed;
padding-top: 10px;
padding-left: 10px;
padding: 20px;
padding: 6px;
height: 100%;
margin-left: 10%;
width: 99%;
}
#location-slums-description {
width: 80%;
margin: 10px;
}
#location-return-to-world-button {
margin: 10px;
padding: 6px;
}
#location-container * {
margin: 10px 5px 10px 5px;
}
}

View File

@ -66,7 +66,7 @@
#purchase-server-box-content {
background-color: black;
margin: 15% auto; /* 15% from the top and centered */
padding: 1px;
padding: 12px;
border: 5px solid #FFFFFF;
width: 80%; /* Could be more or less, depending on screen size */
color: #66ff33;
@ -83,6 +83,7 @@
font-size: 16px;
font-weight: bold;
padding: 2px;
margin: 6px;
border: 1px solid white;
}
@ -100,6 +101,57 @@
cursor: pointer;
}
/* Purchase RAM for Home computer pop-up box */
#purchase-ram-for-home-box-container {
display: none; /* Hidden by default */
position: fixed; /* Stay in place */
z-index: 1; /* Sit on top */
left: 0;
right: 0;
bottom: 0;
top: 0;
width: 100%; /* Full width */
height: 100%; /* Full height */
overflow: auto; /* Enable scroll if needed */
background-color: black; /* Fallback color */
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
transition: opacity 400ms ease-in;
}
#purchase-ram-for-home-box-content {
background-color: black;
margin: 15% auto; /* 15% from the top and centered */
padding: 12px;
border: 5px solid #FFFFFF;
width: 80%; /* Could be more or less, depending on screen size */
color: #66ff33;
}
#purchase-ram-for-home-box-confirm,
#purchase-ram-for-home-box-cancel {
color: #aaa;
float: right;
font-size: 16px;
font-weight: bold;
padding: 2px;
margin: 6px;
border: 1px solid white;
}
#purchase-ram-for-home-box-confirm:hover,
#purchase-ram-for-home-box-confirm:focus {
color: #66ff33;
text-decoration: none;
cursor: pointer;
}
#purchase-ram-for-home-box-cancel:hover,
#purchase-ram-for-home-box-cancel:focus {
color: #66ff33;
text-decoration: none;
cursor: pointer;
}
/* Purchase Invitation Box */
#purchase-augmentation-box-container {
display: none; /* Hidden by default */
@ -120,7 +172,7 @@
#purchase-augmentation-box-content {
background-color: black;
margin: 15% auto; /* 15% from the top and centered */
padding: 1px;
padding: 8px;
border: 5px solid #FFFFFF;
width: 80%; /* Could be more or less, depending on screen size */
color: #66ff33;
@ -132,7 +184,8 @@
float: right;
font-size: 16px;
font-weight: bold;
padding: 2px;
padding: 4px;
margin: 6px;
border: 1px solid white;
}
@ -176,13 +229,18 @@
color: #66ff33;
}
#faction-invitation-box-warning {
margin: 4px;
padding: 4px;
}
#faction-invitation-box-yes,
#faction-invitation-box-no {
color: #aaa;
font-size: 20px;
font-weight: bold;
padding: 1px;
margin: 3px;
padding: 2px;
margin: 6px;
border: 1px solid white;
}
@ -232,8 +290,8 @@
color: #aaa;
font-size: 20px;
font-weight: bold;
padding: 3px;
margin: 3px;
padding: 2px;
margin: 6px;
border: 1px solid white;
}

View File

@ -22,6 +22,7 @@ h2 {
}
ul {
padding: 6px;
list-style-type: none;
}
@ -29,6 +30,20 @@ li {
list-style-type: none;
}
span {
margin: 4px;
padding: 4px;
}
/* Disable border highlight on elements */
input:focus,
textarea:focus,
button:focus,
td:focus,
tr:focus {
outline:none;
}
/* Main menu */
.mainmenu {
list-style-type: none;
@ -81,10 +96,14 @@ li {
border-left: 1px solid #333333;
}
.a-link-button:hover {
background-color: #666;
}
/* Make anchor tags ("a" elements) inactive (not clickable) */
.a-link-button-inactive {
text-decoration: none;
background-color: #555;
background-color: #333;
color: #FFFFFF;
padding: 6px;
margin: 6px;

View File

@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8">
<title>Netburner</title>
<title>Bitburner</title>
<link rel="stylesheet" type="text/css" href="css/styles.css" />
<link rel="stylesheet" type="text/css" href="css/terminal.css" />
<link rel="stylesheet" type="text/css" href="css/menupages.css" />
@ -23,6 +23,7 @@
<script src="utils/FactionInvitationBox.js"></script>
<script src="utils/PurchaseAugmentationBox.js"></script>
<script src="utils/TravelBox.js"></script>
<script src="utils/PurchaseRamForHomeBox.js"></script>
<!-- Netscript -->
<script src="src/netscript/NetScriptWorker.js"></script>
@ -44,10 +45,14 @@
<script src="src/Company.js"></script>
<script src="src/CompanyJobApplication.js"></script>
<script src="src/Terminal.js"></script>
<script src="src/PurchaseServers.js"></script>
<script src="src/ServerPurchases.js"></script>
<script src="src/CreateProgram.js"></script>
<script src="src/Augmentations.js"></script>
<script src="src/Perk.js"></script>
<script src="src/HacknetNode.js"></script>
<script src="src/Crimes.js"></script>
<script src="src/Prestige.js"></script>
<script src="src/SaveObject.js"></script>
<script src="src/engine.js"></script>
@ -72,6 +77,10 @@
<li class="active-scripts-tab">
<a href="#" id="active-scripts-menu-link"> Active Scripts </a>
</li>
<li class="hacknet-nodes-tab">
<a href="#" id="hacknet-nodes-menu-link"> Hacknet Nodes </a>
</li>
<li class="world-tab">
<a href="#" id="world-menu-link"> World </a>
@ -107,7 +116,10 @@
<div id="terminal-container">
<table id="terminal">
<tr id="terminal-input">
<td id="terminal-input-td">$ <input type="text" class="terminal-input"/></td>
<td id="terminal-input-td" tabindex="2">$
<input type="text" id="terminal-input-text-box" class="terminal-input" tabindex="1"
onfocus="this.value = this.value;"/>
</td>
</tr>
</table>
@ -120,12 +132,15 @@
<!-- Script editor -->
<div id="script-editor-container">
<div>
<p id="script-editor-filename-tag"> Script name: </p>
<span id="script-editor-save-and-close-button" float="right" class="a-link-button">Save & Close (Ctrl + b)</span>
</div>
<input id="script-editor-filename" type="text" maxlength="30"> </input>
<input id="script-editor-filename" type="text" maxlength="30" tabindex="1"> </input>
<br>
<br><br>
<textarea id="script-editor-text" style="border: none" autofocus> </textarea>
<textarea id="script-editor-text" tabindex="2" autofocus> </textarea>
</div>
<!-- Active scripts info page -->
@ -133,12 +148,36 @@
<ul class="active-scripts-list" id="active-scripts-list" style="list-style: none;">
</ul>
</div>
<!-- Hacknet Nodes -->
<div id="hacknet-nodes-container">
<h1 id="hacknet-nodes-title"> Hacknet Nodes </h1>
<p id="hacknet-nodes-text">
The Hacknet is a global, decentralized network of machines. It is used by hackers all around
the world to anonymously share computing power and perform distributed cyberattacks without the
fear of being traced.
<br><br>
Here, you can purchase a Hacknet Node, a specialized machine that can connect and contribute its
resources to the Hacknet network. This allows you to take a small percentage of profits
from hacks performed on the network. Essentially, you are renting out your Node's computing power.
<br><br>
Each Hacknet Node you purchase will passively earn you money. Each Hacknet Node can be upgraded
in order to increase its computing power and thereby increase the profit you earn from it.
</p>
<a href="#" id="hacknet-nodes-purchase-button" class="a-link-button"> Purchase Hacknet Node </a>
<p id="hacknet-nodes-money"> </p>
<ul id="hacknet-nodes-list" style="list-style : none;">
</ul>
</div>
<!-- World -->
<div id="world-container" class="world-container">
<ul id="aevum-locations-list">
<li id="aevum-travelagency-li">
<a href="#" id="aevum-travelagency" class="a-link-button"> Travel Agency </a>
</li>
<li id="aevum-summituniversity-li">
<a href="#" id="aevum-summituniversity" class="a-link-button"> Summit University </a>
</li>
<li id="aevum-ecorp-li">
<a href="#" id="aevum-ecorp" class="a-link-button"> ECorp </a>
@ -176,129 +215,153 @@
<li id="aevum-snapfitnessgym-li">
<a href="#" id="aevum-snapfitnessgym" class="a-link-button">Snap Fitness Gym</a>
</li>
<li id="aevum-slums-li">
<a href="#" id="aevum-slums" class="a-link-button">The Slums</a>
</li>
</ul>
<ul id="chongqing-locations-list">
<li id="chongqing-travelagency-li">
<a href="#" id="chongqing-travelagency" class="a-link-button"> Travel Agency </a>
<li>
</li>
<li id="chonqging-kuaigonginternational-li">
<a href="#" id="chongqing-kuaigonginternational" class="a-link-button">KuaiGong International </a>
<li>
</li>
<li id="chongqing-solarisspacesystems-li">
<a href="#" id="chongqing-solarisspacesystems" class="a-link-button">Solaris Space Systems</a>
<li>
</li>
<li id="chongqing-slums-li">
<a href="#" id="chongqing-slums" class="a-link-button">The Slums</a>
</li>
</ul>
<ul id="sector12-locations-list">
<li id="sector12-travelagency-li">
<a href="#" id="sector12-travelagency" class="a-link-button">Travel Agency </a>
<li>
</li>
<li id="sector12-rothmanuniversity-li">
<a href="#" id="sector12-rothmanuniversity" class="a-link-button"> Rothman University</a>
</li>
<li id="sector12-megacorp-li">
<a href="#" id="sector12-megacorp" class="a-link-button">MegaCorp</a>
<li>
</li>
<li id="sector12-bladeindustries-li">
<a href="#" id="sector12-bladeindustries" class="a-link-button"> Blade Industries</a>
<li>
</li>
<li id="sector12-foursigma-li">
<a href="#" id="sector12-foursigma" class="a-link-button">Four Sigma</a>
<li>
</li>
<li id="sector12-icarusmicrosystems-li">
<a href="#" id="sector12-icarusmicrosystems" class="a-link-button"> Icarus Microsystems</a>
<li>
</li>
<li id="sector12-universalenergy-li">
<a href="#" id="sector12-universalenergy" class="a-link-button">Universal Energy </a>
<li>
</li>
<li id="sector12-deltaone-li">
<a href="#" id="sector12-deltaone" class="a-link-button">DeltaOne </a>
<li>
</li>
<li id="sector12-cia-li">
<a href="#" id="sector12-cia" class="a-link-button">Central Intelligence Agency </a>
<li>
</li>
<li id="sector12-nsa-li">
<a href="#" id="sector12-nsa" class="a-link-button">National Security Agency </a>
<li>
</li>
<li id="sector12-alphaenterprises-li">
<a href="#" id="sector12-alphaenterprises" class="a-link-button">Alpha Enterprises</a>
<li>
</li>
<li id="sector12-carmichaelsecurity-li">
<a href="#" id="sector12-carmichaelsecurity" class="a-link-button"> Carmichael Security</a>
<li>
</li>
<li id="sector12-foodnstuff-li">
<a href="#" id="sector12-foodnstuff" class="a-link-button">FoodNStuff</a>
<li>
</li>
<li id="sector12-joesguns-li">
<a href="#" id="sector12-joesguns" class="a-link-button"> Joe's Guns</a>
<li>
</li>
<li id="sector12-irongym-li">
<a href="#" id="sector12-irongym" class="a-link-button">Iron Gym </a>
<li>
</li>
<li id="sector12-powerhousegym-li">
<a href="#" id="sector12-powerhousegym" class="a-link-button">Powerhouse Gym</a>
<li>
</li>
<li id="sector12-slums-li">
<a href="#" id="sector12-slums" class="a-link-button">The Slums</a>
</li>
</ul>
<ul id="newtokyo-locations-list">
<li id="newtokyo-travelagency-li">
<a href="#" id="newtokyo-travelagency" class="a-link-button"> Travel Agency</a>
<li>
</li>
<li id="newtokyo-defcomm-li">
<a href="#" id="newtokyo-defcomm" class="a-link-button"> DefComm</a>
<li>
</li>
<li id="newtokyo-vitalife-li">
<a href="#" id="newtokyo-vitalife" class="a-link-button">VitaLife </a>
<li>
</li>
<li id="newtokyo-globalpharmaceuticals-li">
<a href="#" id="newtokyo-globalpharmaceuticals" class="a-link-button">Global Pharmaceuticals</a>
<li>
</li>
<li id="newtokyo-noodlebar-li">
<a href="#" id="newtokyo-noodlebar" class="a-link-button">Noodle Bar </a>
<li>
</li>
<li id="newtokyo-slums-li">
<a href="#" id="newtokyo-slums" class="a-link-button">The Slums</a>
</li>
</ul>
<ul id="ishima-locations-list">
<li id="ishima-travelagency-li">
<a href="#" id="ishima-travelagency" class="a-link-button">Travel Agency </a>
<li>
</li>
<li id="ishima-stormtechnologies-li">
<a href="#" id="ishima-stormtechnologies" class="a-link-button">Storm Technologies</a>
<li>
</li>
<li id="ishima-novamedical-li">
<a href="#" id="ishima-novamedical" class="a-link-button">Nova Medical</a>
<li>
</li>
<li id="ishima-omegasoftware-li">
<a href="#" id="ishima-omegasoftware" class="a-link-button">Omega Software </a>
<li>
</li>
<li id="ishima-slums-li">
<a href="#" id="ishima-slums" class="a-link-button">The Slums</a>
</li>
</ul>
<ul id="volhaven-locations-list">
<li id="volhaven-travelagency-li">
<a href="#" id="volhaven-travelagency" class="a-link-button">Travel Agency </a>
<li>
</li>
<li id="volhaven-zbinstituteoftechnology-li">
<a href="#" id="volhaven-zbinstituteoftechnology" class="a-link-button">ZB Insitute of Technology</a>
</li>
<li id="volhaven-omnitekincorporated-li">
<a href="#" id="volhaven-omnitekincorporated" class="a-link-button">OmniTek Incorporated </a>
<li>
</li>
<li id="volhaven-nwo-li">
<a href="#" id="volhaven-nwo" class="a-link-button">NWO</a>
<li>
</li>
<li id="volhaven-helislabs-li">
<a href="#" id="volhaven-helioslabs" class="a-link-button">Helios Labs</a>
<li>
</li>
<li id="volhaven-omniacybersystems-li">
<a href="#" id="volhaven-omniacybersystems" class="a-link-button">Omnia Cybersystems</a>
<li>
</li>
<li id="volhaven-lexocorp-li">
<a href="#" id="volhaven-lexocorp" class="a-link-button">LexoCorp</a>
<li>
</li>
<li id="volhaven-syscoresecurities-li">
<a href="#" id="volhaven-syscoresecurities" class="a-link-button">SysCore Securities</a>
<li>
</li>
<li id="volhaven-computek-li">
<a href="#" id="volhaven-computek" class="a-link-button">CompuTek</a>
<li>
</li>
<li id="volhaven-milleniumfitnessgym-li">
<a href="#" id="volhaven-milleniumfitnessgym" class="a-link-button">Millenium Fitness Gym</a>
<li>
</li>
<li id="volhaven-slums-li">
<a href="#" id="volhaven-slums" class="a-link-button">The Slums</a>
</li>
</ul>
</div>
@ -454,19 +517,28 @@
<a href="#" id="location-gym-train-dex" class="a-link-button">Train Dexterity</a>
<a href="#" id="location-gym-train-agi" class="a-link-button">Train Agility</a>
<!-- Study/Take classes at a university -->
<a href="#" id="location-study-computer-science" class="a-link-button">Study Computer Science (free)</a>
<a href="#" id="location-data-structures-class" class="a-link-button">Take Data Structures course</a>
<a href="#" id="location-networks-class" class="a-link-button">Take Networks course</a>
<a href="#" id="location-algorithms-class" class="a-link-button">Take Algorithms course</a>
<a href="#" id="location-management-class" class="a-link-button">Take Management course</a>
<a href="#" id="location-leadership-class" class="a-link-button">Take Leadership course</a>
<!-- Purchase servers -->
<a href="#" id="location-purchase-1gb" class="a-link-button"> Purchase 1GB Server - $100,000</a>
<a href="#" id="location-purchase-2gb" class="a-link-button"> Purchase 2GB Server - $250,000</a>
<a href="#" id="location-purchase-4gb" class="a-link-button"> Purchase 4GB Server - $600,000</a>
<a href="#" id="location-purchase-8gb" class="a-link-button"> Purchase 8GB Server - $1,500,000</a>
<a href="#" id="location-purchase-1gb" class="a-link-button"> Purchase 1GB Server - $50,000</a>
<a href="#" id="location-purchase-2gb" class="a-link-button"> Purchase 2GB Server - $100,000</a>
<a href="#" id="location-purchase-4gb" class="a-link-button"> Purchase 4GB Server - $250,000</a>
<a href="#" id="location-purchase-8gb" class="a-link-button"> Purchase 8GB Server - $1,000,000</a>
<a href="#" id="location-purchase-16gb" class="a-link-button"> Purchase 16GB Server - $4,000,000</a>
<a href="#" id="location-purchase-32gb" class="a-link-button"> Purchase 32GB Server - $9,000,000</a>
<a href="#" id="location-purchase-32gb" class="a-link-button"> Purchase 32GB Server - $10,000,000</a>
<a href="#" id="location-purchase-64gb" class="a-link-button"> Purchase 64GB Server - $20,000,000</a>
<a href="#" id="location-purchase-128gb" class="a-link-button"> Purchase 128GB Server - $45,000,000</a>
<a href="#" id="location-purchase-128gb" class="a-link-button"> Purchase 128GB Server - $50,000,000</a>
<a href="#" id="location-purchase-256gb" class="a-link-button"> Purchase 256GB Server - $100,000,000</a>
<a href="#" id="location-purchase-512gb" class="a-link-button"> Purchase 512GB Server - $250,000,000</a>
<a href="#" id="location-purchase-1tb" class="a-link-button"> Purchase 1TB Server - $600,000,000</a>
<a href="#" id="location-purchase-1tb" class="a-link-button"> Purchase 1TB Server - $750,000,000</a>
<a href="#" id="location-purchase-tor" class="a-link-button"> Purchase TOR Router - $2,000,000</a>
<a href="#" id="location-purchase-home-ram" class="a-link-button"> Purchase RAM for Home computer </a>
<!-- Travel agency -->
<p id="location-travel-agency-text">
@ -478,6 +550,22 @@
<a href="#" id="location-travel-to-newtokyo" class="a-link-button"> Travel to New Tokyo</a>
<a href="#" id="location-travel-to-ishima" class="a-link-button"> Travel to Ishima</a>
<a href="#" id="location-travel-to-volhaven" class="a-link-button"> Travel to Volhaven</a>
<!-- Slums -->
<p id="location-slums-description">
You have entered the Slums, a poverty-ridden district filled with gangs, criminals, and
other shadowy entities. The city's government and police have neglected this area for years... <br><br><br>
In the Slums you can commit crimes to earn money and experience. Crime attempts are not always
successful. Your chance at successfully committing a crime is determined by your stats.
</p>
<a href="#" id="location-slums-shoplift" class="a-link-button"> Shoplift </a>
<a href="#" id="location-slums-mug" class="a-link-button"> Mug someone </a>
<a href="#" id="location-slums-deal-drugs" class="a-link-button"> Deal Drugs </a>
<a href="#" id="location-slums-traffic-arms" class="a-link-button"> Traffick Illegal Arms </a>
<a href="#" id="location-slums-homicide" class="a-link-button"> Homicide </a>
<a href="#" id="location-slums-kidnap" class="a-link-button"> Kidnap and Ransom </a>
</div>
<!-- Dialog Box, displays status text only -->
@ -485,8 +573,11 @@
<div id="dialog-box-content">
<span id="dialog-box-close-button">&times;</span>
<p id="dialog-box-text-1" class="dialog-box-text"> </p>
<br>
<p id="dialog-box-text-2" class="dialog-box-text"> </p>
<br>
<p id="dialog-box-text-3" class="dialog-box-text"> </p>
<br>
<p id="dialog-box-text-4" class="dialog-box-text"> </p>
</div>
</div>
@ -502,6 +593,15 @@
</div>
</div>
<!-- Purchase RAM for Home Computer Pop-up Box -->
<div id="purchase-ram-for-home-box-container">
<div id="purchase-ram-for-home-box-content">
<p id="purchase-ram-for-home-box-text"> </p>
<span id="purchase-ram-for-home-box-confirm"> Purchase </span>
<span id="purchase-ram-for-home-box-cancel"> Cancel </span>
</div>
</div>
<!-- Travel Pop-up Box -->
<div id="travel-box-container">
<div id="travel-box-content">
@ -515,7 +615,7 @@
<div id="purchase-augmentation-box-container">
<div id="purchase-augmentation-box-content">
<p id="purchase-augmentation-box-text"> </p>
<p> WARNING: Purchasing an Augmentation resets most of your progress, including: <br>
<p> <br> WARNING: Purchasing an Augmentation resets most of your progress, including: <br>
Stats/Skill levels and Experience <br>
Money <br>
Scripts <br>
@ -523,7 +623,7 @@
Purchasing an Augmentation lets you start over with the perks and benefits granted by all
of the Augmentations you have ever purchased (purchasing an Augmentation does not reset the benefits
of Augmentations you have previously purchased).
<p>
</p>
<span id="purchase-augmentation-box-confirm"> Purchase </span>
<span id="purchase-augmentation-box-cancel"> Cancel </span>
</div>

View File

@ -52,7 +52,7 @@ AddToAugmentations = function(aug) {
initAugmentations = function() {
//Combat stat augmentations
var Targeting1 = new Augmentation("Augmented Targeting I");
Targeting1.setRequirements(36000, 10000000);
Targeting1.setRequirements(8000, 10000000);
Targeting1.setInfo("This cranial implant is embedded within the player's inner ear structure and optic nerves. It regulates and enhances the user's" +
"balance and hand-eye coordination. It is also capable of augmenting reality by projecting digital information\n" +
"directly onto the retina. These enhancements allow the player to better lock-on and keep track of enemies. \n\n" +
@ -62,7 +62,7 @@ initAugmentations = function() {
AddToAugmentations(Targeting1);
var Targeting2 = new Augmentation("Augmented Targeting II");
Targeting2.setRequirements(72000, 20000000);
Targeting2.setRequirements(30000, 20000000);
Targeting2.setInfo("This is an upgrade of the Augmented Targeting I cranial implant, which is capable of augmenting reality\n" +
"and enhances the user's balance and hand-eye coordination. \n\nThis upgrade increases the player's dexterity" +
"by an additional 20%.");
@ -71,7 +71,7 @@ initAugmentations = function() {
AddToAugmentations(Targeting2);
var Targeting3 = new Augmentation("Augmented Targeting III");
Targeting3.setRequirements(144000, 50000000);
Targeting3.setRequirements(80000, 50000000);
Targeting3.setInfo("This is an upgrade of the Augmented Targeting II cranial implant, which is capable of augmenting reality\n" +
"and enhances the user's balance and hand-eye coordination. \n\nThis upgrade increases the player's dexterity" +
"by an additional 50%.");
@ -80,7 +80,7 @@ initAugmentations = function() {
AddToAugmentations(Targeting3);
var SyntheticHeart = new Augmentation("Synthetic Heart");
SyntheticHeart.setRequirements(1000000, 500000000);
SyntheticHeart.setRequirements(400000, 500000000);
SyntheticHeart.setInfo("This advanced artificial heart, created from plasteel and graphene, is capable of pumping more blood\n" +
"at much higher efficiencies than a normal human heart.\n\n This augmentation increases the player's agility" +
"and strength by 100%");
@ -89,7 +89,7 @@ initAugmentations = function() {
AddToAugmentations(SyntheticHeart);
var SynfibrilMuscle = new Augmentation("Synfibril Muscle");
SynfibrilMuscle.setRequirements(900000, 400000000);
SynfibrilMuscle.setRequirements(300000, 400000000);
SynfibrilMuscle.setInfo("The myofibrils in human muscles are injected with special chemicals that react with the proteins inside\n" +
"the myofibrils, altering their underlying structure. The end result is muscles that are stronger and more elastic.\n" +
"Scientists have named these artificially enhanced units 'synfibrils'.\n\n This augmentation increases the player's" +
@ -99,7 +99,7 @@ initAugmentations = function() {
AddToAugmentations(SynfibrilMuscle)
var CombatRib1 = new Augmentation("Combat Rib I");
CombatRib1.setRequirements(50000, 15000000);
CombatRib1.setRequirements(12000, 15000000);
CombatRib1.setInfo("The human body's ribs are replaced with artificial ribs that automatically and continuously release cognitive" +
"and performance-enhancing drugs into the bloodstream, improving the user's abilities in combat.\n\n" +
"This augmentation increases the player's strength and defense by 10%.");
@ -108,7 +108,7 @@ initAugmentations = function() {
AddToAugmentations(CombatRib1);
var CombatRib2 = new Augmentation("Combat Rib II");
CombatRib2.setRequirements(100000, 40000000);
CombatRib2.setRequirements(40000, 40000000);
CombatRib2.setInfo("This is an upgrade to the Combat Rib I augmentation, and is capable of releasing even more potent combat-enhancing\n" +
"drugs into the bloodstream\n\n. This upgrade increases the player's strength and defense by an additional 20%.")
CombatRib2.addToFactions(["The Dark Army", "The Syndicate", "Sector-12", "Volhaven", "Ishima",
@ -116,7 +116,7 @@ initAugmentations = function() {
AddToAugmentations(CombatRib2);
var CombatRib3 = new Augmentation("Combat Rib III");
CombatRib3.setRequirements(200000, 100000000);
CombatRib3.setRequirements(120000, 100000000);
CombatRib3.setInfo("This is an upgrade to the Combat Rib II augmentation, and is capable of releasing even more potent combat-enhancing\n" +
"drugs into the bloodstream\n\n. This upgrade increases the player's strength and defense by an additional 30%.");
CombatRib3.addToFactions(["The Dark Army", "The Syndicate", "OmniTek Incorporated",
@ -124,7 +124,7 @@ initAugmentations = function() {
AddToAugmentations(CombatRib3);
var NanofiberWeave = new Augmentation("Nanofiber Weave");
NanofiberWeave.setRequirements(400000, 250000000);
NanofiberWeave.setRequirements(150000, 250000000);
NanofiberWeave.setInfo("Synthetic nanofibers are woven into the skin's extracellular matrix using electrospinning.\n" +
"This improves the skin's ability to regenerate itself and protect the body from external stresses and forces.\n\n" +
"This augmentation increases the player's strength and defense by 30%.");
@ -133,7 +133,7 @@ initAugmentations = function() {
AddToAugmentations(NanofiberWeave);
var SubdermalArmor = new Augmentation("NEMEAN Subdermal Weave");
SubdermalArmor.setRequirements(1000000, 750000000);
SubdermalArmor.setRequirements(600000, 750000000);
SubdermalArmor.setInfo("The NEMEAN Subdermal Weave is a thin, light-weight, graphene plating that houses a dilatant fluid.\n" +
"The material is implanted underneath the skin, and is the most advanced form of defensive enhancement\n" +
"that has ever been created. The dilatant fluid, despite being thin and light, is extremely effective\n" +
@ -145,7 +145,7 @@ initAugmentations = function() {
AddToAugmentations(SubdermalArmor);
var WiredReflexes = new Augmentation("Wired Reflexes");
WiredReflexes.setRequirements(36000, 10000000);
WiredReflexes.setRequirements(3000, 6000000);
WiredReflexes.setInfo("Synthetic nerve-enhancements are injected into all major parts of the somatic nervous system,\n" +
"supercharging the body's ability to send signals through neurons. This results in increased reflex speed.\n\n" +
"This augmentation increases the player's agility by 5%.");
@ -154,7 +154,7 @@ initAugmentations = function() {
AddToAugmentations(WiredReflexes);
var GrapheneBoneLacings = new Augmentation("Graphene Bone Lacings");
GrapheneBoneLacings.setRequirements(1500000, 1000000000);
GrapheneBoneLacings.setRequirements(750000, 1000000000);
GrapheneBoneLacings.setInfo("A graphene-based material is grafted and fused into the user's bones, significantly increasing\n" +
"their density and tensile strength.\n\n" +
"This augmentation increases the player's strength and defense by 100%.");
@ -162,7 +162,7 @@ initAugmentations = function() {
AddToAugmentations(GrapheneBoneLacings);
var BionicSpine = new Augmentation("Bionic Spine");
BionicSpine.setRequirements(250000, 75000000);
BionicSpine.setRequirements(150000, 75000000);
BionicSpine.setInfo("An artificial spine created from plasteel and carbon fibers that completely replaces the organic spine.\n" +
"Not only is the Bionic Spine physically stronger than a human spine, but it is also capable of digitally\n" +
"stimulating and regulating the neural signals that are sent and received by the spinal cord. This results in\n" +
@ -173,7 +173,7 @@ initAugmentations = function() {
AddToAugmentations(BionicSpine);
var GrapheneBionicSpine = new Augmentation("Graphene Bionic Spine Upgrade");
GrapheneBionicSpine.setRequirements(1200000, 1000000000);
GrapheneBionicSpine.setRequirements(650000, 1000000000);
GrapheneBionicSpine.setInfo("An upgrade to the Bionic Spine augmentation. It fuses the implant with an advanced graphene\n" +
"material to make it much stronger and lighter.\n\n" +
"This augmentation increases all of the player's combat stats by 100%.");
@ -181,7 +181,7 @@ initAugmentations = function() {
AddToAugmentations(GrapheneBionicSpine);
var BionicLegs = new Augmentation("Bionic Legs");
BionicLegs.setRequirements(200000, 60000000);
BionicLegs.setRequirements(100000, 60000000);
BionicLegs.setInfo("Cybernetic legs created from plasteel and carbon fibers that completely replace the user's organic legs. \n\n" +
"This augmentation increases the player's agility by 50%.");
BionicLegs.addToFactions(["Speakers for the Dead", "The Syndicate", "KuaiGong International",
@ -189,7 +189,7 @@ initAugmentations = function() {
AddToAugmentations(BionicLegs);
var GrapheneBionicLegs = new Augmentation("Graphene Bionic Legs Upgrade");
GrapheneBionicLegs.setRequirements(1000000, 900000000);
GrapheneBionicLegs.setRequirements(400000, 900000000);
GrapheneBionicLegs.setInfo("An upgrade to the Bionic Legs augmentation. It fuses the implant with an advanced graphene\n" +
"material to make it much stronger and lighter\n\n" +
"This augmentation increases the player's agility by an additional 150%.");
@ -198,7 +198,7 @@ initAugmentations = function() {
//Labor stat augmentations
var SpeechProcessor = new Augmentation("Speech Processor Implant"); //Cochlear imlant?
SpeechProcessor.setRequirements(50000, 15000000);
SpeechProcessor.setRequirements(25000, 15000000);
SpeechProcessor.setInfo("A cochlear implant with an embedded computer that analyzes incoming speech.\n" +
"The embedded computer processes characteristics of incoming speech, such as tone\n" +
"and inflection, to pick up on subtle cues and aid in social interaction.\n\n" +
@ -208,7 +208,7 @@ initAugmentations = function() {
AddToAugmentations(SpeechProcessor);
TITN41Injection = new Augmentation("TITN-41 Gene-Modification Injection");
TITN41Injection.setRequirements(150000, 75000000);
TITN41Injection.setRequirements(40000, 75000000);
TITN41Injection.setInfo("TITN is a series of viruses that targets and alters the sequences of human DNA in genes that \n" +
"control personality. The TITN-41 strain alters these genes so that the subject becomes more \n " +
"outgoing and socialable. \n\n" +
@ -216,7 +216,7 @@ initAugmentations = function() {
TITN41Injection.addToFactions(["Silhouette"]);
var EnhancedSocialInteractionImplant = new Augmentation("Enhanced Social Interaction Implant");
EnhancedSocialInteractionImplant.setRequirements(750000, 500000000);
EnhancedSocialInteractionImplant.setRequirements(500000, 500000000);
EnhancedSocialInteractionImplant.setInfo("A cranial implant that greatly assists in the user's ability to analyze social situations\n" +
"and interactions. The system uses a wide variety of factors such as facial expression, body\n" +
"language, and the voice's tone/inflection to determine the best course of action during social\n" +
@ -229,7 +229,7 @@ initAugmentations = function() {
//Hacking augmentations
var ArtificialBioNeuralNetwork = new Augmentation("Artificial Bio-neural Network Implant");
ArtificialBioNeuralNetwork.setRequirements(750000, 600000000);
ArtificialBioNeuralNetwork.setRequirements(150000, 600000000);
ArtificialBioNeuralNetwork.setInfo("A network consisting of millions of nanoprocessors is embedded into the brain. \n" +
"The network is meant to mimick the way a biological brain solves a problem, which each\n" +
"nanoprocessor acting similar to the way a neuron would in a neural network. However, these\n" +
@ -243,7 +243,7 @@ initAugmentations = function() {
AddToAugmentations(ArtificialBioNeuralNetwork);
var ArtificialSynapticPotentiation = new Augmentation("Artificial Synaptic Potentiation");
ArtificialSynapticPotentiation.setRequirements(600000, 400000000);
ArtificialSynapticPotentiation.setRequirements(20000, 80000000);
ArtificialSynapticPotentiation.setInfo("The body is injected with a chemical that artificially induces synaptic potentiation,\n" +
"otherwise known as the strengthening of synapses. This results in a enhanced cognitive abilities.\n\n" +
"This augmentation increases the player's hacking speed and hacking chance by 1%.");
@ -251,7 +251,7 @@ initAugmentations = function() {
AddToAugmentations(ArtificialSynapticPotentiation);
var EnhancedMyelinSheathing = new Augmentation("Enhanced Myelin Sheathing");
EnhancedMyelinSheathing.setRequirements(900000, 850000000);
EnhancedMyelinSheathing.setRequirements(300000, 850000000);
EnhancedMyelinSheathing.setInfo("Electrical signals are used to induce a new, artificial form of myelinogensis in the human body.\n" +
"This process results in the proliferation of new, synthetic myelin sheaths in the nervous\n" +
"system. These myelin sheaths can propogate neuro-signals much faster than their organic\n" +
@ -264,7 +264,7 @@ initAugmentations = function() {
AddToAugmentations(EnhancedMyelinSheathing);
var SynapticEnhancement = new Augmentation("Synaptic Enhancement Implant");
SynapticEnhancement.setRequirements(50000, 35000000);
SynapticEnhancement.setRequirements(6000, 2000000);
SynapticEnhancement.setInfo("A small cranial implant that continuously uses weak electric signals to stimulate the brain and \n" +
"induce stronger synaptic activity. This improves the the user's cognitive abilities.\n\n" +
"This augmentation increases the player's hacking speed by 1%.");
@ -272,7 +272,7 @@ initAugmentations = function() {
AddToAugmentations(SynapticEnhancement);
var NeuralRetentionEnhancement = new Augmentation("Neural-Retention Enhancement");
NeuralRetentionEnhancement.setRequirements(200000, 250000000);
NeuralRetentionEnhancement.setRequirements(80000, 100000000);
NeuralRetentionEnhancement.setInfo("Chemical injections are used to permanently alter and strengthen the brain's neuronal\n" +
"circuits, strengthening its ability to retain information.\n\n" +
"This augmentation increases the player's hacking experience gain rate by 40%.");
@ -280,7 +280,7 @@ initAugmentations = function() {
AddToAugmentations(NeuralRetentionEnhancement);
var DataJack = new Augmentation("DataJack");
DataJack.setRequirements(750000, 75000000);
DataJack.setRequirements(200000, 75000000);
DataJack.setInfo("A brain implant that provides an interface for direct, wireless communication between a computer's main\n" +
"memory and the mind. This implant allows the user to not only access a computer's memory, but also alter\n" +
"and delete it.\n\n" +
@ -289,7 +289,7 @@ initAugmentations = function() {
AddToAugmentations(DataJack);
var ENM = new Augmentation("Embedded Netburner Module");
ENM.setRequirements(500000, 300000000);
ENM.setRequirements(20000, 100000000);
ENM.setInfo("A thin device embedded inside the arm containing a wireless module capable of connecting\n" +
"to nearby networks. Once connected, the Netburner Module is capable of capturing and\n" +
"processing all of the traffic on that network. By itself, the Embedded Netburner Module does\n" +
@ -301,7 +301,7 @@ initAugmentations = function() {
AddToAugmentations(ENM);
var ENMCore = new Augmentation("Embedded Netburner Module Core Implant");
ENMCore.setRequirements(750000, 500000000);
ENMCore.setRequirements(250000, 500000000);
ENMCore.setInfo("The Core library is an implant that upgrades the firmware of the Embedded Netburner Module.\n" +
"This upgrade allows the Embedded Netburner Module to generate its own data on a network.\n\n" +
"This augmentation:\n" +
@ -315,7 +315,7 @@ initAugmentations = function() {
AddToAugmentations(ENMCore);
var ENMCoreV2 = new Augmentation("Embedded Netburner Module Core V2 Upgrade");
ENMCoreV2.setRequirements(1000000, 1000000000);
ENMCoreV2.setRequirements(500000, 1000000000);
ENMCoreV2.setInfo("The Core V2 library is an implant that upgrades the firmware of the Embedded Netburner Module.\n" +
"This upgraded firmware allows the Embedded Netburner Module to control the information on\n" +
"a network by re-routing traffic, spoofing IP addresses, or altering the data inside network\n" +
@ -331,7 +331,7 @@ initAugmentations = function() {
AddToAugmentations(ENMCoreV2);
var ENMCoreV3 = new Augmentation("Embedded Netburner Module Core V3 Upgrade");
ENMCoreV3.setRequirements(1500000, 1250000000);
ENMCoreV3.setRequirements(750000, 1250000000);
ENMCoreV3.setInfo("The Core V3 library is an implant that upgrades the firmware of the Embedded Netburner Module.\n" +
"This upgraded firmware allows the Embedded Netburner Module to seamlessly inject code into\n" +
"any device on a network.\n\n" +
@ -346,7 +346,7 @@ initAugmentations = function() {
AddToAugmentations(ENMCoreV3);
var ENMAnalyzeEngine = new Augmentation("Embedded Netburner Module Analyze Engine");
ENMAnalyzeEngine.setRequirements(1250000, 1000000000);
ENMAnalyzeEngine.setRequirements(700000, 1000000000);
ENMAnalyzeEngine.setInfo("Installs the Analyze Engine for the Embedded Netburner Module, which is a CPU cluster\n" +
"that vastly outperforms the Netburner Module's native single-core processor.\n\n" +
"This augmentation increases the player's hacking speed by 10%.");
@ -355,7 +355,7 @@ initAugmentations = function() {
AddToAugmentations(ENMAnalyzeEngine);
var ENMDMA = new Augmentation("Embedded Netburner Module Direct Memory Access Upgrade");
ENMDMA.setRequirements(1350000, 1100000000);
ENMDMA.setRequirements(750000, 1100000000);
ENMDMA.setInfo("This implant installs a Direct Memory Access (DMA) controller into the\n" +
"Embedded Netburner Module. This allows the Module to send and receive data\n" +
"directly to and from the main memory of devices on a network.\n\n" +
@ -367,7 +367,7 @@ initAugmentations = function() {
AddToAugmentations(ENMDMA);
var Neuralstimulator = new Augmentation("Neuralstimulator");
Neuralstimulator.setRequirements(500000, 600000000);
Neuralstimulator.setRequirements(120000, 600000000);
Neuralstimulator.setInfo("A cranial implant that intelligently stimulates certain areas of the brain \n" +
"in order to improve cognitive functions\n\n" +
"This augmentation:\n" +
@ -381,7 +381,7 @@ initAugmentations = function() {
//Work Augmentations
var NuoptimalInjectorImplant = new Augmentation("Nuoptimal Nootropic Injector Implant");
NuoptimalInjectorImplant.setRequirements(100000, 90000000);
NuoptimalInjectorImplant.setRequirements(12000, 30000000);
NuoptimalInjectorImplant.setInfo("This torso implant automatically injects nootropic supplements into\n" +
"the bloodstream to improve memory, increase focus, and provide other\n" +
"cognitive enhancements.\n\n" +
@ -392,7 +392,7 @@ initAugmentations = function() {
AddToAugmentations(NuoptimalInjectorImplant);
var SpeechEnhancement = new Augmentation("Speech Enhancement");
SpeechEnhancement.setRequirements(50000, 45000000);
SpeechEnhancement.setRequirements(6000, 4000000);
SpeechEnhancement.setInfo("An advanced neural implant that improves your speaking abilities, making\n" +
"you more convincing and likable in conversations and overall improving your\n" +
"social interactions.\n\n" +
@ -404,7 +404,7 @@ initAugmentations = function() {
AddToAugmentations(SpeechEnhancement);
var FocusWire = new Augmentation("FocusWire"); //Stops procrastination
FocusWire.setRequirements(400000, 350000000);
FocusWire.setRequirements(100000, 200000000);
FocusWire.setInfo("A cranial implant that stops procrastination by blocking specific neural pathways\n" +
"in the brain.\n\n" +
"This augmentation: \n" +
@ -415,7 +415,7 @@ initAugmentations = function() {
AddToAugmentations(FocusWire)
var PCDNI = new Augmentation("PC Direct-Neural Interface");
PCDNI.setRequirements(750000, 650000000);
PCDNI.setRequirements(400000, 650000000);
PCDNI.setInfo("Installs a Direct-Neural Interface jack into your arm that is compatible with most\n" +
"computers. Connecting to a computer through this jack allows you to interface with\n" +
"it using the brain's electrochemical signals.\n\n" +
@ -426,7 +426,7 @@ initAugmentations = function() {
AddToAugmentations(PCDNI);
var PCDNIOptimizer = new Augmentation("PC Direct-Neural Interface Optimization Submodule");
PCDNIOptimizer.setRequirements(1000000, 875000000);
PCDNIOptimizer.setRequirements(500000, 875000000);
PCDNIOptimizer.setInfo("This is a submodule upgrade to the PC Direct-Neural Interface augmentation. It\n" +
"improves the performance of the interface and gives the user more control options\n" +
"to the connected computer.\n\n" +
@ -437,7 +437,7 @@ initAugmentations = function() {
AddToAugmentations(PCDNIOptimizer);
var PCDNINeuralNetwork = new Augmentation("PC Direct-Neural Interface NeuroNet Injector");
PCDNINeuralNetwork.setRequirements(1200000, 1100000000);
PCDNINeuralNetwork.setRequirements(600000, 1100000000);
PCDNINeuralNetwork.setInfo("This is an additional installation that upgrades the functionality of the \n" +
"PC Direct-Neural Interface augmentation. When connected to a computer,\n" +
"The NeuroNet Injector upgrade allows the user to use his/her own brain's\n" +
@ -449,9 +449,62 @@ initAugmentations = function() {
PCDNINeuralNetwork.addToFactions(["Fulcrum Secret Technologies"]);
AddToAugmentations(PCDNINeuralNetwork);
//HacknetNode Augmentations
var HacknetNodeCPUUpload = new Augmentation("Hacknet Node CPU Architecture Neural-Upload");
HacknetNodeCPUUpload.setRequirements(15000, 12000000);
HacknetNodeCPUUpload.setInfo("Uploads the architecture and design details of a Hacknet Node's CPU into \n" +
"the brain. This allows the user to engineer custom hardware and software \n " +
"for the Hacknet Node that provides better performance.\n\n" +
"This augmentation:\n" +
"Increases the amount of money produced by Hacknet Nodes by 15%\n" +
"Decreases the cost of purchasing a Hacknet Node Core by 10%");
HacknetNodeCPUUpload.addToFactions(["Netburners"]);
AddToAugmentations(HacknetNodeCPUUpload);
var HacknetNodeCacheUpload = new Augmentation("Hacknet Node Cache Architecture Neural-Upload");
HacknetNodeCacheUpload.setRequirements(6000, 6000000);
HacknetNodeCacheUpload.setInfo("Uploads the architecture and design details of a Hacknet Node's main-memory cacge\n" +
"into the brain. This allows the user to engineer custom cache hardware for the \n" +
"Hacknet Node that offers better performance.\n\n" +
"This augmentation:\n " +
"Increases the amount of money produced by Hacknet Nodes by 10%\n" +
"Decreases the cost of leveling up a Hacknet Node by 10%");
HacknetNodeCacheUpload.addToFactions(["Netburners"]);
AddToAugmentations(HacknetNodeCacheUpload);
var HacknetNodeNICUpload = new Augmentation("HacknetNode NIC Architecture Neural-Upload");
HacknetNodeNICUpload.setRequirements(2000, 2000000);
HacknetNodeNICUpload.setInfo("Uploads the architecture and design details of a Hacknet Node's Network Interface Card (NIC)\n" +
"into the brain. This allows the user to engineer a custom NIC for the Hacknet Node that \n" +
"offers better performance.\n\n" +
"This augmentation:\n" +
"Increases the amount of money produced by Hacknet Nodes by 5%\n" +
"Decreases the cost of purchasing a Hacknet Node by 5%");
HacknetNodeNICUpload.addToFactions(["Netburners"]);
AddToAugmentations(HacknetNodeNICUpload);
var HacknetNodeKernelDNI = new Augmentation("Hacknet Node Kernel Direct-Neural Interface");
HacknetNodeKernelDNI.setRequirements(25000, 30000000);
HacknetNodeKernelDNI.setInfo("Installs a Direct-Neural Interface jack into the arm that is capable of connecting to a\n" +
"Hacknet Node. This lets the user access and manipulate the Node's kernel using the mind's\n" +
"electrochemical signals.\n\n" +
"This augmentation increases the amount of money produced by Hacknet Nodes by 50%.");
HacknetNodeKernelDNI.addToFactions(["Netburners"]);
AddToAugmentations(HacknetNodeKernelDNI);
var HacknetNodeCoreDNI = new Augmentation("Hacknet Node Core Direct-Neural Interface");
HacknetNodeCoreDNI.setRequirements(40000, 50000000);
HacknetNodeCoreDNI.setInfo("Installs a Direct-Neural Interface jack into the arm that is capable of connecting \n" +
"to a Hacknet Node. This lets the user access and manipulate the Node's processing logic using" +
"the mind's electrochemical signals.\n\n" +
"This augmentation increases the amount of money produced by Hacknet Nodes by 75%.");
HacknetNodeCoreDNI.addToFactions(["Netburners"]);
AddToAugmentations(HacknetNodeCoreDNI);
//Misc augmentations
var Neurotrainer1 = new Augmentation("Neurotrainer I");
Neurotrainer1.setRequirements(50000, 35000000);
Neurotrainer1.setRequirements(4000, 3000000);
Neurotrainer1.setInfo("A decentralized cranial implant that improves the brain's ability to learn. It is\n" +
"installed by releasing millions of nanobots into the human brain, each of which\n" +
"attaches to a different neural pathway to enhance the brain's ability to retain\n" +
@ -461,7 +514,7 @@ initAugmentations = function() {
AddToAugmentations(Neurotrainer1);
var Neurotrainer2 = new Augmentation("Neurotrainer II");
Neurotrainer2.setRequirements(300000, 150000000);
Neurotrainer2.setRequirements(16000, 20000000);
Neurotrainer2.setInfo("A decentralized cranial implant that improves the brain's ability to learn. This\n" +
"is a more powerful version of the Neurotrainer I augmentation, but it does not\n" +
"require Neurotrainer I to be installed as a prerequisite.\n\n" +
@ -470,7 +523,7 @@ initAugmentations = function() {
AddToAugmentations(Neurotrainer2);
var Neurotrainer3 = new Augmentation("Neurotrainer III");
Neurotrainer3.setRequirements(900000, 725000000);
Neurotrainer3.setRequirements(40000, 100000000);
Neurotrainer3.setInfo("A decentralized cranial implant that improves the brain's ability to learn. This\n" +
"is a more powerful version of the Neurotrainer I and Neurotrainer II augmentation,\n" +
"but it does not require either of them to be installed as a prerequisite.\n\n" +
@ -486,7 +539,7 @@ initAugmentations = function() {
"Increases the player's dexterity by 50%\n" +
"Increases the player's hacking speed by 1%" +
"Increases the amount of money the player gains from hacking by 10%");
Hypersight.setRequirements(800000, 650000000);
Hypersight.setRequirements(120000, 650000000);
Hypersight.addToFactions(["Blade Industries", "KuaiGong International"]);
AddToAugmentations(Hypersight);
}
@ -667,6 +720,26 @@ applyAugmentation = function(aug, faction) {
Player.hacking_speed_mult *= .98;
break;
//Hacknet Node Augmentations
case "Hacknet Node CPU Architecture Neural-Upload":
Player.hacknet_node_money_mult *= 1.15;
Player.hacknet_node_purchase_cost_mult *= 0.90;
break;
case "Hacknet Node Cache Architecture Neural-Upload":
Player.hacknet_node_money_mult *= 1.10;
Player.hacknet_node_level_cost_mult *= 0.90;
break;
case "HacknetNode NIC Architecture Neural-Upload":
Player.hacknet_node_money_mult *= 1.05;
Player.hacknet_node_purchase_cost_mult *= 0.95;
break;
case "Hacknet Node Kernel Direct-Neural Interface":
Player.hacknet_node_money_mult *= 1.50;
break;
case "Hacknet Node Core Direct-Neural Interface":
Player.hacknet_node_money_mult *= 1.75;
break;
//Misc augmentations
case "Neurotrainer I": //Low Level
Player.hacking_exp_mult *= 1.05;

View File

@ -17,7 +17,7 @@ function Company() {
//Player-related properties for company
this.isPlayerEmployed = false;
this.playerPosition = ""; //Name (only name, not object) of the current position player holds
this.playerReputation = 0; //"Reputation" within company, gain reputation by working for company
this.playerReputation = 1; //"Reputation" within company, gain reputation by working for company
};
Company.prototype.init = function(name, salaryMult, expMult, jobStatReqOffset) {
@ -43,7 +43,7 @@ Company.prototype.addPositions = function(positions) {
Company.prototype.hasPosition = function(pos) {
for (var i = 0; i < this.companyPositions.length; ++i) {
if (pos.name == this.companyPositions[i]) {
if (pos.positionName == this.companyPositions[i]) {
return true;
}
}
@ -203,46 +203,46 @@ CompanyPositions = {
//Constructor: CompanyPosition(name, reqHack, reqStr, reqDef, reqDex, reqAgi, reqCha, reqRep, salary)
//Software
SoftwareIntern: new CompanyPosition("Software Engineering Intern", 1, 1, 1, 1, 1, 1, 0, 1),
JuniorDev: new CompanyPosition("Junior Software Engineer", 50, 1, 1, 1, 1, 1, 9000, 5),
SeniorDev: new CompanyPosition("Senior Software Engineer", 250, 1, 1, 1, 1, 50, 36000, 12),
LeadDev: new CompanyPosition("Lead Software Developer", 400, 1, 1, 1, 1, 100, 72000, 15),
SoftwareIntern: new CompanyPosition("Software Engineering Intern", 1, 0, 0, 0, 0, 0, 0, 1.2),
JuniorDev: new CompanyPosition("Junior Software Engineer", 51, 0, 0, 0, 0, 0, 9000, 6),
SeniorDev: new CompanyPosition("Senior Software Engineer", 251, 0, 0, 0, 0, 51, 36000, 15),
LeadDev: new CompanyPosition("Lead Software Developer", 401, 0, 0, 0, 0, 151, 144000, 20),
//IT
ITIntern: new CompanyPosition("IT Intern", 1, 1, 1, 1, 1, 1, 0, .8),
ITAnalyst: new CompanyPosition("IT Analyst", 25, 1, 1, 1, 1, 1, 9000, 2),
ITManager: new CompanyPosition("IT Manager", 150, 1, 1, 1, 1, 50, 36000, 8),
SysAdmin: new CompanyPosition("Systems Administrator", 250, 1, 1, 1, 1, 75, 72000, 13),
SecurityEngineer: new CompanyPosition("Security Engineer", 150, 1, 1, 1, 1, 25, 36000, 10),
NetworkEngineer: new CompanyPosition("Network Engineer", 150, 1, 1, 1, 1, 25, 36000, 10),
NetworkAdministrator: new CompanyPosition("Network Administrator", 250, 1, 1, 1, 1, 75, 72000, 12),
ITIntern: new CompanyPosition("IT Intern", 1, 0, 0, 0, 0, 0, 0, 1),
ITAnalyst: new CompanyPosition("IT Analyst", 26, 0, 0, 0, 0, 0, 9000, 4),
ITManager: new CompanyPosition("IT Manager", 151, 0, 0, 0, 0, 51, 36000, 14),
SysAdmin: new CompanyPosition("Systems Administrator", 251, 0, 0, 0, 0, 76, 144000, 14),
SecurityEngineer: new CompanyPosition("Security Engineer", 151, 0, 0, 0, 0, 26, 36000, 12),
NetworkEngineer: new CompanyPosition("Network Engineer", 151, 0, 0, 0, 0, 26, 36000, 12),
NetworkAdministrator: new CompanyPosition("Network Administrator", 251, 0, 0, 0, 0, 76, 144000, 15),
//Technology management
HeadOfSoftware: new CompanyPosition("Head of Software", 500, 1, 1, 1, 1, 250, 108000, 30),
HeadOfEngineering: new CompanyPosition("Head of Engineering", 500, 1, 1, 1, 1, 250, 10800, 30),
VicePresident: new CompanyPosition("Vice President of Technology", 600, 1, 1, 1, 1, 400, 144000, 40),
CTO: new CompanyPosition("Chief Technology Officer", 750, 1, 1, 1, 1, 500, 216000, 50),
HeadOfSoftware: new CompanyPosition("Head of Software", 501, 0, 0, 0, 0, 251, 288000, 35),
HeadOfEngineering: new CompanyPosition("Head of Engineering", 501, 0, 0, 0, 0, 251, 576000, 40),
VicePresident: new CompanyPosition("Vice President of Technology", 601, 0, 0, 0, 0, 401, 1152000, 45),
CTO: new CompanyPosition("Chief Technology Officer", 751, 0, 0, 0, 0, 501, 4608000, 50),
//Business
BusinessIntern: new CompanyPosition("Business Intern", 1, 1, 1, 1, 1, 1, 0, 1),
BusinessAnalyst: new CompanyPosition("Business Analyst", 5, 1, 1, 1, 1, 50, 9000, 8),
BusinessManager: new CompanyPosition("Business Manager", 50, 1, 1, 1, 1, 100, 36000, 15),
OperationsManager: new CompanyPosition("Operations Manager", 50, 1, 1, 1, 1, 200, 72000, 20),
CFO: new CompanyPosition("Chief Financial Officer", 75, 1, 1, 1, 1, 500, 108000, 50),
CEO: new CompanyPosition("Chief Executive Officer", 100, 1, 1, 1, 1, 750, 216000, 100),
BusinessIntern: new CompanyPosition("Business Intern", 1, 0, 0, 0, 0, 1, 0, 1.2),
BusinessAnalyst: new CompanyPosition("Business Analyst", 6, 0, 0, 0, 0, 51, 9000, 10),
BusinessManager: new CompanyPosition("Business Manager", 51, 0, 0, 0, 0, 101, 36000, 18),
OperationsManager: new CompanyPosition("Operations Manager", 51, 0, 0, 0, 0, 201, 144000, 22),
CFO: new CompanyPosition("Chief Financial Officer", 76, 0, 0, 0, 0, 501, 576000, 50),
CEO: new CompanyPosition("Chief Executive Officer", 101, 0, 0, 0, 0, 751, 4608000, 100),
//Non-tech/management jobs
Waiter: new CompanyPosition("Waiter", 1, 1, 1, 1, 1, 1, 0, .5),
Employee: new CompanyPosition("Employee", 1, 1, 1, 1, 1, 1, 0, .5),
PoliceOfficer: new CompanyPosition("Police Officer", 10, 100, 100, 100, 100, 9000, 4),
PoliceChief: new CompanyPosition("Police Chief", 100, 300, 300, 300, 300, 18000, 10),
SecurityGuard: new CompanyPosition("Security Guard", 1, 50, 50, 50, 50, 0, 3),
SecurityOfficer: new CompanyPosition("Security Officer", 25, 150, 150, 150, 150, 9000, 6),
SecuritySupervisor: new CompanyPosition("Security Supervisor", 25, 250, 250, 250, 250, 36000, 12),
HeadOfSecurity: new CompanyPosition("Head of Security", 50, 500, 500, 500, 500, 72000, 20),
FieldAgent: new CompanyPosition("Field Agent", 100, 100, 100, 100, 100, 9000, 4),
SecretAgent: new CompanyPosition("Secret Agent", 200, 250, 250, 250, 250, 36000, 10),
SpecialOperative: new CompanyPosition("Special Operative", 250, 500, 500, 500, 500, 108000, 20),
Waiter: new CompanyPosition("Waiter", 0, 0, 0, 0, 0, 0, 0, .75),
Employee: new CompanyPosition("Employee", 0, 0, 0, 0, 0, 0, 0, .75),
PoliceOfficer: new CompanyPosition("Police Officer", 11, 101, 101, 101, 101, 51, 9000, 5),
PoliceChief: new CompanyPosition("Police Chief", 101, 301, 301, 301, 301, 151, 36000, 12),
SecurityGuard: new CompanyPosition("Security Guard", 0, 51, 51, 51, 51, 1, 0, 4),
SecurityOfficer: new CompanyPosition("Security Officer", 26, 151, 151, 151, 151, 51, 9000, 8),
SecuritySupervisor: new CompanyPosition("Security Supervisor", 26, 251, 251, 251, 251, 101, 36000, 15),
HeadOfSecurity: new CompanyPosition("Head of Security", 51, 501, 501, 501, 501, 151, 144000, 22),
FieldAgent: new CompanyPosition("Field Agent", 101, 101, 101, 101, 101, 101, 9000, 6),
SecretAgent: new CompanyPosition("Secret Agent", 201, 251, 251, 251, 251, 36000, 15),
SpecialOperative: new CompanyPosition("Special Operative", 251, 501, 501, 501, 501, 144000, 25),
init: function() {
//Argument order: hack, str, def, dex, agi, cha
@ -426,7 +426,7 @@ initCompanies = function() {
/* Companies that also have servers */
//Megacorporations
var ECorp = new Company();
ECorp.init(Locations.AevumECorp, 3.0, 3.0, 250);
ECorp.init(Locations.AevumECorp, 3.0, 3.0, 249);
ECorp.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.ITIntern, CompanyPositions.BusinessIntern,
CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, CompanyPositions.LeadDev,
@ -440,7 +440,7 @@ initCompanies = function() {
AddToCompanies(ECorp);
var MegaCorp = new Company();
MegaCorp.init(Locations.Sector12MegaCorp, 3.0, 3.0, 250);
MegaCorp.init(Locations.Sector12MegaCorp, 3.0, 3.0, 249);
MegaCorp.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.ITIntern, CompanyPositions.BusinessIntern,
CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, CompanyPositions.LeadDev,
@ -454,7 +454,7 @@ initCompanies = function() {
AddToCompanies(MegaCorp);
var BachmanAndAssociates = new Company();
BachmanAndAssociates.init(Locations.AevumBachmanAndAssociates, 2.6, 2.6, 225);
BachmanAndAssociates.init(Locations.AevumBachmanAndAssociates, 2.6, 2.6, 224);
BachmanAndAssociates.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.ITIntern, CompanyPositions.BusinessIntern,
CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, CompanyPositions.LeadDev,
@ -468,7 +468,7 @@ initCompanies = function() {
AddToCompanies(BachmanAndAssociates);
var BladeIndustries = new Company();
BladeIndustries.init(Locations.Sector12BladeIndustries, 2.75, 2.75, 225);
BladeIndustries.init(Locations.Sector12BladeIndustries, 2.75, 2.75, 224);
BladeIndustries.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.ITIntern, CompanyPositions.BusinessIntern,
CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, CompanyPositions.LeadDev,
@ -482,7 +482,7 @@ initCompanies = function() {
AddToCompanies(BladeIndustries);
var NWO = new Company();
NWO.init(Locations.VolhavenNWO, 2.75, 2.75, 250);
NWO.init(Locations.VolhavenNWO, 2.75, 2.75, 249);
NWO.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.ITIntern, CompanyPositions.BusinessIntern,
CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, CompanyPositions.LeadDev,
@ -496,7 +496,7 @@ initCompanies = function() {
AddToCompanies(NWO);
var ClarkeIncorporated = new Company();
ClarkeIncorporated.init(Locations.AevumClarkeIncorporated, 2.25, 2.25, 225);
ClarkeIncorporated.init(Locations.AevumClarkeIncorporated, 2.25, 2.25, 224);
ClarkeIncorporated.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.ITIntern, CompanyPositions.BusinessIntern,
CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, CompanyPositions.LeadDev,
@ -510,7 +510,7 @@ initCompanies = function() {
AddToCompanies(ClarkeIncorporated);
var OmniTekIncorporated = new Company();
OmniTekIncorporated.init(Locations.VolhavenOmniTekIncorporated, 2.25, 2.25, 225);
OmniTekIncorporated.init(Locations.VolhavenOmniTekIncorporated, 2.25, 2.25, 224);
OmniTekIncorporated.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.ITIntern, CompanyPositions.BusinessIntern,
CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, CompanyPositions.LeadDev,
@ -524,7 +524,7 @@ initCompanies = function() {
AddToCompanies(OmniTekIncorporated);
var FourSigma = new Company();
FourSigma.init(Locations.Sector12FourSigma, 2.5, 2.5, 225);
FourSigma.init(Locations.Sector12FourSigma, 2.5, 2.5, 224);
FourSigma.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.ITIntern, CompanyPositions.BusinessIntern,
CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, CompanyPositions.LeadDev,
@ -538,7 +538,7 @@ initCompanies = function() {
AddToCompanies(FourSigma);
var KuaiGongInternational = new Company();
KuaiGongInternational.init(Locations.ChongqingKuaiGongInternational, 2.2, 2.2, 225);
KuaiGongInternational.init(Locations.ChongqingKuaiGongInternational, 2.2, 2.2, 224);
KuaiGongInternational.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.ITIntern, CompanyPositions.BusinessIntern,
CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, CompanyPositions.LeadDev,
@ -553,7 +553,7 @@ initCompanies = function() {
//Technology and communication companies ("Large" servers)
var FulcrumTechnologies = new Company();
FulcrumTechnologies.init(Locations.AevumFulcrumTechnologies, 2.0, 2.0, 225);
FulcrumTechnologies.init(Locations.AevumFulcrumTechnologies, 2.0, 2.0, 224);
FulcrumTechnologies.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.ITIntern, CompanyPositions.BusinessIntern,
CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, CompanyPositions.LeadDev,
@ -566,7 +566,7 @@ initCompanies = function() {
AddToCompanies(FulcrumTechnologies);
var StormTechnologies = new Company();
StormTechnologies.init(Locations.IshimaStormTechnologies, 1.8, 1.8, 200);
StormTechnologies.init(Locations.IshimaStormTechnologies, 1.8, 1.8, 199);
StormTechnologies.addPositions([
CompanyPositions.SoftwareIntern,
CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, CompanyPositions.LeadDev,
@ -579,7 +579,7 @@ initCompanies = function() {
AddToCompanies(StormTechnologies);
var DefComm = new Company();
DefComm.init(Locations.NewTokyoDefComm, 1.75, 1.75, 200);
DefComm.init(Locations.NewTokyoDefComm, 1.75, 1.75, 199);
DefComm.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,
CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst,
@ -589,7 +589,7 @@ initCompanies = function() {
AddToCompanies(DefComm);
var HeliosLabs = new Company();
HeliosLabs.init(Locations.VolhavenHeliosLabs, 1.8, 1.8, 200);
HeliosLabs.init(Locations.VolhavenHeliosLabs, 1.8, 1.8, 199);
HeliosLabs.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,
CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst,
@ -599,7 +599,7 @@ initCompanies = function() {
AddToCompanies(HeliosLabs);
var VitaLife = new Company();
VitaLife.init(Locations.NewTokyoVitaLife, 1.8, 1.8, 200);
VitaLife.init(Locations.NewTokyoVitaLife, 1.8, 1.8, 199);
VitaLife.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,
CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst,
@ -610,7 +610,7 @@ initCompanies = function() {
AddToCompanies(VitaLife);
var IcarusMicrosystems = new Company();
IcarusMicrosystems.init(Locations.Sector12IcarusMicrosystems, 1.9, 1.9, 200);
IcarusMicrosystems.init(Locations.Sector12IcarusMicrosystems, 1.9, 1.9, 199);
IcarusMicrosystems.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,
CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst,
@ -621,7 +621,7 @@ initCompanies = function() {
AddToCompanies(IcarusMicrosystems);
var UniversalEnergy = new Company();
UniversalEnergy.init(Locations.Sector12UniversalEnergy, 2.0, 2.0, 200);
UniversalEnergy.init(Locations.Sector12UniversalEnergy, 2.0, 2.0, 199);
UniversalEnergy.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,
CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst,
@ -632,7 +632,7 @@ initCompanies = function() {
AddToCompanies(UniversalEnergy);
var GalacticCybersystems = new Company();
GalacticCybersystems.init(Locations.AevumGalacticCybersystems, 1.9, 1.9, 200);
GalacticCybersystems.init(Locations.AevumGalacticCybersystems, 1.9, 1.9, 199);
GalacticCybersystems.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,
CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst,
@ -644,7 +644,7 @@ initCompanies = function() {
//Defense Companies ("Large" Companies)
var AeroCorp = new Company();
AeroCorp.init(Locations.AevumAeroCorp, 1.7, 1.7, 200);
AeroCorp.init(Locations.AevumAeroCorp, 1.7, 1.7, 199);
AeroCorp.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,
CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst,
@ -657,7 +657,7 @@ initCompanies = function() {
AddToCompanies(AeroCorp);
var OmniaCybersystems = new Company();
OmniaCybersystems.init(Locations.VolhavenOmniaCybersystems, 1.7, 1.7, 200);
OmniaCybersystems.init(Locations.VolhavenOmniaCybersystems, 1.7, 1.7, 199);
OmniaCybersystems.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,
CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst,
@ -670,7 +670,7 @@ initCompanies = function() {
AddToCompanies(OmniaCybersystems);
var SolarisSpaceSystems = new Company();
SolarisSpaceSystems.init(Locations.ChongqingSolarisSpaceSystems, 1.7, 1.7, 200);
SolarisSpaceSystems.init(Locations.ChongqingSolarisSpaceSystems, 1.7, 1.7, 199);
SolarisSpaceSystems.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,
CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst,
@ -683,7 +683,7 @@ initCompanies = function() {
AddToCompanies(SolarisSpaceSystems);
var DeltaOne = new Company();
DeltaOne.init(Locations.Sector12DeltaOne, 1.6, 1.6, 200);
DeltaOne.init(Locations.Sector12DeltaOne, 1.6, 1.6, 199);
DeltaOne.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,
CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst,
@ -697,7 +697,7 @@ initCompanies = function() {
//Health, medicine, pharmaceutical companies ("Large" servers)
var GlobalPharmaceuticals = new Company();
GlobalPharmaceuticals.init(Locations.NewTokyoGlobalPharmaceuticals, 1.8, 1.8, 225);
GlobalPharmaceuticals.init(Locations.NewTokyoGlobalPharmaceuticals, 1.8, 1.8, 224);
GlobalPharmaceuticals.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.ITIntern, CompanyPositions.BusinessIntern,
CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, CompanyPositions.LeadDev,
@ -710,7 +710,7 @@ initCompanies = function() {
AddToCompanies(GlobalPharmaceuticals);
var NovaMedical = new Company();
NovaMedical.init(Locations.IshimaNovaMedical, 1.75, 1.75, 200);
NovaMedical.init(Locations.IshimaNovaMedical, 1.75, 1.75, 199);
NovaMedical.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.ITIntern, CompanyPositions.BusinessIntern,
CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, CompanyPositions.LeadDev,
@ -724,7 +724,7 @@ initCompanies = function() {
//Other large companies
var CIA = new Company();
CIA.init(Locations.Sector12CIA, 2.0, 2.0, 150);
CIA.init(Locations.Sector12CIA, 2.0, 2.0, 149);
CIA.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,
CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst,
@ -736,7 +736,7 @@ initCompanies = function() {
AddToCompanies(CIA);
var NSA = new Company();
NSA.init(Locations.Sector12NSA, 2.0, 2.0, 150);
NSA.init(Locations.Sector12NSA, 2.0, 2.0, 149);
NSA.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,
CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst,
@ -748,7 +748,7 @@ initCompanies = function() {
AddToCompanies(NSA);
var WatchdogSecurity = new Company();
WatchdogSecurity.init(Locations.AevumWatchdogSecurity, 1.5, 1.5, 125);
WatchdogSecurity.init(Locations.AevumWatchdogSecurity, 1.5, 1.5, 124);
WatchdogSecurity.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,
CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst,
@ -761,7 +761,7 @@ initCompanies = function() {
//"Medium level" companies
var LexoCorp = new Company();
LexoCorp.init(Locations.VolhavenLexoCorp, 1.4, 1.4, 100);
LexoCorp.init(Locations.VolhavenLexoCorp, 1.4, 1.4, 99);
LexoCorp.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,
CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst,
@ -773,7 +773,7 @@ initCompanies = function() {
AddToCompanies(LexoCorp);
var RhoConstruction = new Company();
RhoConstruction.init(Locations.AevumRhoConstruction, 1.3, 1.3, 50);
RhoConstruction.init(Locations.AevumRhoConstruction, 1.3, 1.3, 49);
RhoConstruction.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,
CompanyPositions.LeadDev, CompanyPositions.BusinessIntern, CompanyPositions.BusinessAnalyst,
@ -781,7 +781,7 @@ initCompanies = function() {
AddToCompanies(RhoConstruction);
var AlphaEnterprises = new Company();
AlphaEnterprises.init(Locations.Sector12AlphaEnterprises, 1.5, 1.5, 100);
AlphaEnterprises.init(Locations.Sector12AlphaEnterprises, 1.5, 1.5, 99);
AlphaEnterprises.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,
CompanyPositions.LeadDev, CompanyPositions.BusinessIntern, CompanyPositions.BusinessAnalyst,
@ -789,14 +789,14 @@ initCompanies = function() {
AddToCompanies(AlphaEnterprises);
var AevumPolice = new Company();
AevumPolice.init(Locations.AevumPolice, 1.3, 1.3, 100);
AevumPolice.init(Locations.AevumPolice, 1.3, 1.3, 99);
AevumPolice.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,
CompanyPositions.LeadDev, CompanyPositions.SecurityGuard, CompanyPositions.PoliceOfficer]);
AddToCompanies(AevumPolice);
var SysCoreSecurities = new Company();
SysCoreSecurities.init(Locations.VolhavenSysCoreSecurities, 1.3, 1.3, 125);
SysCoreSecurities.init(Locations.VolhavenSysCoreSecurities, 1.3, 1.3, 124);
SysCoreSecurities.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,
CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst,
@ -806,7 +806,7 @@ initCompanies = function() {
AddToCompanies(SysCoreSecurities);
var CompuTek = new Company();
CompuTek.init(Locations.VolhavenCompuTek, 1.2, 1.2, 75);
CompuTek.init(Locations.VolhavenCompuTek, 1.2, 1.2, 74);
CompuTek.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,
CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst,
@ -816,7 +816,7 @@ initCompanies = function() {
AddToCompanies(CompuTek);
var NetLinkTechnologies = new Company();
NetLinkTechnologies.init(Locations.AevumNetLinkTechnologies, 1.2, 1.2, 100);
NetLinkTechnologies.init(Locations.AevumNetLinkTechnologies, 1.2, 1.2, 99);
NetLinkTechnologies.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,
CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst,
@ -826,7 +826,7 @@ initCompanies = function() {
AddToCompanies(NetLinkTechnologies);
var CarmichaelSecurity = new Company();
CarmichaelSecurity.init(Locations.Sector12CarmichaelSecurity, 1.2, 1.2, 75);
CarmichaelSecurity.init(Locations.Sector12CarmichaelSecurity, 1.2, 1.2, 74);
CarmichaelSecurity.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,
CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst,
@ -849,7 +849,7 @@ initCompanies = function() {
AddToCompanies(JoesGuns);
var OmegaSoftware = new Company();
OmegaSoftware.init(Locations.IshimaOmegaSoftware, 1.1, 1.1, 50);
OmegaSoftware.init(Locations.IshimaOmegaSoftware, 1.1, 1.1, 49);
OmegaSoftware.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,
CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst,

View File

@ -2,11 +2,7 @@
//Determines the job that the Player should get (if any) at the current
//company
PlayerObject.prototype.applyForJob = function(entryPosType) {
if (Engine.Debug) {
console.log("Player.applyForJob() called");
}
PlayerObject.prototype.applyForJob = function(entryPosType) {
var currCompany = "";
if (this.companyName != "") {
currCompany = Companies[this.companyName];
@ -20,7 +16,25 @@ PlayerObject.prototype.applyForJob = function(entryPosType) {
var pos = entryPosType;
if (!this.isQualified(company, pos)) {
dialogBoxCreate("You are not qualified for this position");
var offset = company.jobStatReqOffset;
var reqHacking = pos.requiredHacking > 0 ? pos.requiredHacking+offset : 0;
var reqStrength = pos.requiredStrength > 0 ? pos.requiredStrength+offset : 0;
var reqDefense = pos.requiredDefense > 0 ? pos.requiredDefense+offset : 0;
var reqDexterity = pos.requiredDexterity > 0 ? pos.requiredDexterity+offset : 0;
var reqAgility = pos.requiredDexterity > 0 ? pos.requiredDexterity+offset : 0;
var reqCharisma = pos.requiredCharisma > 0 ? pos.requiredCharisma+offset : 0;
var reqRep = pos.requiredReputation;
var reqText = "(Requires ";
if (reqHacking > 0) {reqText += (reqHacking + " hacking, ");}
if (reqStrength > 0) {reqText += (reqStrength + " strength, ");}
if (reqDefense > 0) {reqText += (reqDefense + " defense, ");}
if (reqDexterity > 0) {reqText += (reqDexterity + " dexterity, ");}
if (reqAgility > 0) {reqText += (reqAgility + " agility, ");}
if (reqCharisma > 0) {reqText += (reqCharisma + " charisma, ");}
if (reqRep > 1) {reqText += (reqRep + " reputation, ");}
reqText = reqText.substring(0, reqText.length - 2);
reqText += ")";
dialogBoxCreate("Unforunately, you do not qualify for this position", reqText);
return;
}
@ -52,15 +66,39 @@ PlayerObject.prototype.applyForJob = function(entryPosType) {
if (currCompany != "") {
if (currCompany.companyName == company.companyName &&
pos.positionName == currPositionName) {
dialogBoxCreate("Unfortunately, you do not qualify for a promotion");
var nextPos = getNextCompanyPosition(pos);
var offset = company.jobStatReqOffset;
var reqHacking = nextPos.requiredHacking > 0 ? nextPos.requiredHacking+offset : 0;
var reqStrength = nextPos.requiredStrength > 0 ? nextPos.requiredStrength+offset : 0;
var reqDefense = nextPos.requiredDefense > 0 ? nextPos.requiredDefense+offset : 0;
var reqDexterity = nextPos.requiredDexterity > 0 ? nextPos.requiredDexterity+offset : 0;
var reqAgility = nextPos.requiredDexterity > 0 ? nextPos.requiredDexterity+offset : 0;
var reqCharisma = nextPos.requiredCharisma > 0 ? nextPos.requiredCharisma+offset : 0;
var reqRep = nextPos.requiredReputation;
var reqText = "(Requires ";
if (reqHacking > 0) {reqText += (reqHacking + " hacking, ");}
if (reqStrength > 0) {reqText += (reqStrength + " strength, ");}
if (reqDefense > 0) {reqText += (reqDefense + " defense, ");}
if (reqDexterity > 0) {reqText += (reqDexterity + " dexterity, ");}
if (reqAgility > 0) {reqText += (reqAgility + " agility, ");}
if (reqCharisma > 0) {reqText += (reqCharisma + " charisma, ");}
if (reqRep > 1) {reqText += (reqRep + " reputation, ");}
reqText = reqText.substring(0, reqText.length - 2);
reqText += ")";
dialogBoxCreate("Unfortunately, you do not qualify for a promotion", reqText);
return; //Same job, do nothing
}
}
//Lose reputation from a Company if you are leaving it for another job
var leaveCompany = false;
var oldCompanyName = "";
if (currCompany != "") {
if (currCompany.companyName != company.companyName) {
leaveCompany = true;
oldCompanyName = currCompany.companyName;
company.playerReputation -= 1000;
if (company.playerReputation < 0) {company.playerReputation = 0;}
if (Engine.debug) {
@ -73,7 +111,13 @@ PlayerObject.prototype.applyForJob = function(entryPosType) {
this.companyName = company.companyName;
this.companyPosition = pos;
dialogBoxCreate("Congratulations! You were offered a new job at ", this.companyName, " as a " + pos.positionName);
if (leaveCompany) {
dialogBoxCreate("Congratulations! You were offered a new job at " + this.companyName + " as a " + pos.positionName + "!",
"You lost 1000 reputatation at your old company " + oldCompanyName + " because you left.");
} else {
dialogBoxCreate("Congratulations! You were offered a new job at " + this.companyName + " as a " + pos.positionName + "!");
}
Engine.loadLocationContent();
}
@ -151,12 +195,19 @@ PlayerObject.prototype.applyForWaiterJob = function() {
//Checks if the Player is qualified for a certain position
PlayerObject.prototype.isQualified = function(company, position) {
var offset = company.jobStatReqOffset;
if (this.hacking_skill >= position.requiredHacking+offset &&
this.strength >= position.requiredStrength+offset &&
this.defense >= position.requiredDefense+offset &&
this.dexterity >= position.requiredDexterity+offset &&
this.agility >= position.requiredAgility+offset &&
this.charisma >= position.requiredCharisma+offset &&
var reqHacking = position.requiredHacking > 0 ? position.requiredHacking+offset : 0;
var reqStrength = position.requiredStrength > 0 ? position.requiredStrength+offset : 0;
var reqDefense = position.requiredDefense > 0 ? position.requiredDefense+offset : 0;
var reqDexterity = position.requiredDexterity > 0 ? position.requiredDexterity+offset : 0;
var reqAgility = position.requiredDexterity > 0 ? position.requiredDexterity+offset : 0;
var reqCharisma = position.requiredCharisma > 0 ? position.requiredCharisma+offset : 0;
if (this.hacking_skill >= reqHacking &&
this.strength >= reqStrength &&
this.defense >= reqDefense &&
this.dexterity >= reqDexterity &&
this.agility >= reqAgility &&
this.charisma >= reqCharisma &&
company.playerReputation >= position.requiredReputation) {
return true;
}

View File

@ -1,10 +1,25 @@
CONSTANTS = {
Version: "0.1",
//Max level for any skill. Determined by max numerical value in javascript and the skill level
//formula in Player.js
MaxSkillLevel: 975,
//How much reputation is needed to join a megacorporation's faction
CorpFactionRepRequirement: 250000,
/* Base costs */
BaseCostFor1GBOfRam: 50000, //1 GB of RAM
BaseCostForHacknetNode: 1000,
BaseCostForHacknetNodeCore: 1000000,
/* Hacknet Node constants */
HacknetNodeMoneyGainPerLevel: 0.75,
HacknetNodePurchaseNextMult: 1.35, //Multiplier when purchasing an additional hacknet node
HacknetNodeUpgradeLevelMult: 1.08, //Multiplier for cost when upgrading level
HacknetNodeUpgradeRamMult: 1.2, //Multiplier for cost when upgrading RAM
HacknetNodeUpgradeCoreMult: 1.5, //Multiplier for cost when buying another core
/* Script related things */
//Time (ms) it takes to run one operation in Netscript.
@ -13,6 +28,9 @@ CONSTANTS = {
//Time (seconds) it takes to run one operation in Netscript OFFLINE
CodeOfflineExecutionTime: 10,
//Server growth rate
ServerGrowthRate: 1.00075,
//Maximum number of log entries for a script
MaxLogCapacity: 20,
@ -31,13 +49,42 @@ CONSTANTS = {
MillisecondsPer4Hours: 14400000,
GameCyclesPer4Hours: 14400000 / 200,
MillisecondsPer2Hours: 7200000,
GameCyclesPer2Hours: 7200000 / 200,
MillisecondsPerHour: 3600000,
GameCyclesPerHour: 3600000 / 200,
MillisecondsPerHalfHour: 1800000,
GameCyclesPerHalfHour: 1800000 / 200,
MillisecondsPerQuarterHour: 900000,
GameCyclesPerQuarterHour: 900000 / 200,
FactionWorkHacking: "Faction Hacking Work",
FactionWorkField: "Faction Field Work",
FactionWorkSecurity: "Faction Security Work",
WorkTypeCompany: "Working for Company",
WorkTypeFaction: "Working for Faction",
WorkTypeCreateProgram: "Working on Create a Program",
WorkTypeStudyClass: "Studying or Taking a class at university",
WorkTypeCrime: "Committing a crime",
ClassStudyComputerScience: "studying Computer Science",
ClassDataStructures: "taking a Data Structures course",
ClassNetworks: "taking a Networks course",
ClassAlgorithms: "taking an Algorithms course",
ClassManagement: "taking a Management course",
ClassLeadership: "taking a Leadership course",
CrimeShoplift: "shoplift",
CrimeMug: "mug someone",
CrimeDrugs: "deal drugs",
CrimeTraffickArms: "traffick illegal arms",
CrimeHomicide: "commit homicide",
CrimeKidnap: "kidnap someone for ransom",
//Text that is displayed when the 'help' command is ran in Terminal
HelpText: "analyze Get statistics and information about current machine <br>" +
"clear Clear all text on the terminal <br>" +
@ -45,10 +92,11 @@ CONSTANTS = {
"connect [ip/hostname] Connects to the machine given by its IP or hostname <br>" +
"free Check the machine's memory (RAM) usage<br>" +
"hack Hack the current machine<br>" +
"help Display this list<br>" +
"help Display this help text<br>" +
"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<br>" +
"kill [script name] Stops a script that is running on the current machine<br>" +
"ls Displays all programs and scripts on the machine<br>" +
"nano [script name] Text editor - Open up and edit a script<br>" +
"netstat Displays all available network connections<br>" +

View File

@ -40,25 +40,25 @@ function displayCreateProgramContent() {
Player.hacking_skill >= 50) {
bruteSshALink.style.display = "block";
bruteSshALink.addEventListener("click", function() {
Player.startCreateProgramWork(Programs.BruteSSHProgram, CONSTANTS.MillisecondsPerHour);
Player.startCreateProgramWork(Programs.BruteSSHProgram, CONSTANTS.MillisecondsPerQuarterHour);
});
}
//FTPCrack
if (Player.getHomeComputer().programs.indexOf(Programs.FTPCrackProgram) == -1 &&
Player.hacking_skill >= 125) {
Player.hacking_skill >= 100) {
ftpCrackALink.style.display = "block";
ftpCrackALink.addEventListener("click", function() {
Player.startCreateProgramWork(Programs.FTPCrackProgram, CONSTANTS.MillisecondsPer4Hours);
Player.startCreateProgramWork(Programs.FTPCrackProgram, CONSTANTS.MillisecondsHalfHour);
});
}
//relaySMTP
if (Player.getHomeComputer().programs.indexOf(Programs.RelaySMTPProgram) == -1 &&
Player.hacking_skill >= 300) {
Player.hacking_skill >= 250) {
relaySmtpALink.style.display = "block";
relaySmtpAlink.addEventListener("click", function() {
Player.startCreateProgramWork(Programs.RelaySMTPProgram. CONSTANTS.MillisecondsPer8Hours);
Player.startCreateProgramWork(Programs.RelaySMTPProgram. CONSTANTS.MillisecondsPer2Hours);
});
}
@ -67,7 +67,7 @@ function displayCreateProgramContent() {
Player.hacking_skill >= 500) {
httpWormALink.style.display = "block";
httpWormALink.addEventListener("click", function() {
Player.startCreateProgramWork(Programs.HTTPWormProgram, CONSTANTS.MillisecondsPer10Hours);
Player.startCreateProgramWork(Programs.HTTPWormProgram, CONSTANTS.MillisecondsPer4Hours);
});
}
@ -76,7 +76,7 @@ function displayCreateProgramContent() {
Player.hacking_skill >= 750) {
sqlInjectALink.style.display = "block";
sqlInjectALink.addEventListener("click", function() {
Player.startCreateProgramWork(Programs.SQLInjectProgram, CONSTANTS.MillisecondsPer10Hours);
Player.startCreateProgramWork(Programs.SQLInjectProgram, CONSTANTS.MillisecondsPer8Hours);
});
}
}

117
src/Crimes.js Normal file
View File

@ -0,0 +1,117 @@
/* Crimes.js */
function commitShopliftCrime() {
Player.crimeType = CONSTANTS.CrimeShoplift;
Player.startCrime(0, 1, 1, 1, 1, 0, 100, 3000); //$33.33/s, .333 exp/s
}
function commitMugCrime() {
Player.crimeType = CONSTANTS.CrimeMug;
Player.startCrime(0, 2, 2, 2, 2, 0, 250, 5000); //$50/s, .4 exp/s
}
function commitDealDrugsCrime() {
Player.crimeType = CONSTANTS.CrimeDrugs;
Player.startCrime(0, 2, 2, 2, 2, 4, 1000, 10000); //$100/s, .2 combat exp/s, .4 cha exp/s
}
function commitTraffickArmsCrime() {
Player.crimeType = CONSTANTS.CrimeTraffickArms;
Player.startCrime(0, 10, 10, 10, 10, 16, 5000, 40000); //$125/s, .25 combat exp/s, .4 cha exp/s
}
function commitHomicideCrime() {
Player.crimeType = CONSTANTS.CrimeHomicide;
Player.startCrime(0, 3, 3, 3, 3, 0, 300, 3000); //$100/s, 1 combat exp/s
}
function commitKidnapCrime() {
Player.crimeType = CONSTANTS.CrimeKidnap;
Player.startCrime(0, 30, 30, 30, 30, 30, 20000, 120000); //$166.67/s. .25 exp/s
}
function determineCrimeSuccess(crime, moneyGained) {
var chance = 0;
switch (crime) {
case CONSTANTS.CrimeShoplift:
chance = determineCrimeChanceShoplift();
break;
case CONSTANTS.CrimeMug:
chance = determineCrimeChanceMug();
break;
case CONSTANTS.CrimeDrugs:
chance = determineCrimeChanceDealDrugs();
break;
case CONSTANTS.CrimeTraffickArms:
chance = determineCrimeChanceTraffickArms();
break;
case CONSTANTS.CrimeHomicide:
chance = determineCrimeChanceHomicide();
break;
case CONSTANTS.CrimeKidnap:
chance = determineCrimeChanceKidnap();
break;
default:
dialogBoxCreate("ERR: Unrecognized crime type. This is probably a bug please contact the developer");
return;
}
if (Math.random() <= chance) {
//Success
Player.gainMoney(moneyGained);
return true;
} else {
//Failure
return false;
}
}
function determineCrimeChanceShoplift() {
var chance = ((Player.strength / CONSTANTS.MaxSkillLevel +
Player.defense / CONSTANTS.MaxSkillLevel +
Player.dexterity / CONSTANTS.MaxSkillLevel +
Player.agility / CONSTANTS.MaxSkillLevel)) * 8;
return Math.min(chance, 1);
}
function determineCrimeChanceMug() {
var chance = ((Player.strength / CONSTANTS.MaxSkillLevel +
Player.defense / CONSTANTS.MaxSkillLevel +
Player.dexterity / CONSTANTS.MaxSkillLevel +
Player.agility / CONSTANTS.MaxSkillLevel)) * 4;
return Math.min(chance, 1);
}
function determineCrimeChanceDealDrugs() {
var chance = ((1.5*Player.charisma / CONSTANTS.MaxSkillLevel +
Player.strength / CONSTANTS.MaxSkillLevel +
Player.defense / CONSTANTS.MaxSkillLevel +
Player.dexterity / CONSTANTS.MaxSkillLevel +
Player.agility / CONSTANTS.MaxSkillLevel));
return Math.min(chance, 1);
}
function determineCrimeChanceTraffickArms() {
var chance = ((Player.charisma / CONSTANTS.MaxSkillLevel +
Player.strength / CONSTANTS.MaxSkillLevel +
Player.defense / CONSTANTS.MaxSkillLevel +
Player.dexterity / CONSTANTS.MaxSkillLevel +
Player.agility / CONSTANTS.MaxSkillLevel));
return Math.min(chance, 1);
}
function determineCrimeChanceHomicide() {
var chance = ((Player.strength / CONSTANTS.MaxSkillLevel +
Player.defense / CONSTANTS.MaxSkillLevel +
Player.dexterity / CONSTANTS.MaxSkillLevel +
Player.agility / CONSTANTS.MaxSkillLevel));
return Math.min(chance, 1);
}
function determineCrimeChanceKidnap() {
return ((Player.charisma / CONSTANTS.MaxSkillLevel +
Player.strength / CONSTANTS.MaxSkillLevel +
Player.defense / CONSTANTS.MaxSkillLevel +
Player.dexterity / CONSTANTS.MaxSkillLevel +
Player.agility / CONSTANTS.MaxSkillLevel)) / 4;
return Math.min(chance, 1);
}

View File

@ -41,7 +41,6 @@ AddToFactions = function(faction) {
Factions[name] = faction;
}
//TODO Add faction information
//TODO Augmentation price and rep requirement mult are 1 for everything right now,
// This might change in the future for balance
initFactions = function() {
@ -137,6 +136,9 @@ initFactions = function() {
//Earlygame factions - factions the player will prestige with early on that don't
//belong in other categories
var Netburners = new Faction("Netburners");
Netburners.setInfo(FactionInfo.NetburnersInfo);
AddToFactions(Netburners);
var TianDiHui = new Faction("Tian Di Hui"); //Society of the Heaven and Earth
TianDiHui.setInfo(FactionInfo.TianDiHuiInfo);
AddToFactions(TianDiHui);
@ -344,7 +346,7 @@ PlayerObject.prototype.checkForFactionInvitations = function() {
if (speakersforthedeadFac.isBanned == false && speakersforthedeadFac.isMember == false &&
this.hacking_skill >= 100 && this.strength >= 300 && this.defense >= 300 &&
this.dexterity >= 300 && this.agility >= 300 && this.numPeopleKilled >= 10 &&
this.numPeopleKilledTotal >= 100 && this.companyName != Locations.Sector12CIA &&
this.numPeopleKilledTotal >= 100 && this.karma <= -50 && this.companyName != Locations.Sector12CIA &&
this.companyName != Locations.Sector12NSA) {
invitedFactions.push(speakersforthedeadFac);
}
@ -354,7 +356,7 @@ PlayerObject.prototype.checkForFactionInvitations = function() {
if (thedarkarmyFac.isBanned == false && thedarkarmyFac.isMember == false &&
this.hacking_skill >= 300 && this.strength >= 300 && this.defense >= 300 &&
this.dexterity >= 300 && this.agility >= 300 && this.location == Locations.Chongqing &&
this.numPeopleKilled >= 5 && this.companyName != Locations.Sector12CIA &&
this.numPeopleKilled >= 5 && this.karma <= -50 && this.companyName != Locations.Sector12CIA &&
this.companyName != Locations.Sector12NSA) {
invitedFactions.push(thedarkarmyFac);
}
@ -365,8 +367,8 @@ PlayerObject.prototype.checkForFactionInvitations = function() {
this.hacking_skill >= 200 && this.strength >= 200 && this.defense >= 200 &&
this.dexterity >= 200 && this.agility >= 200 &&
(this.location == Locations.Aevum || this.location == Locations.Sector12) &&
this.money >= 10000000 && this.companyName != Locations.Sector12CIA &&
this.companyName != Locations.Sector12NSA) {
this.money >= 10000000 && this.karma <= -100 &&
this.companyName != Locations.Sector12CIA && this.companyName != Locations.Sector12NSA) {
invitedFactions.push(thesyndicateFac);
}
@ -376,9 +378,25 @@ PlayerObject.prototype.checkForFactionInvitations = function() {
(this.companyPosition.positionName == CompanyPositions.CTO.positionName ||
this.companyPosition.positionName == CompanyPositions.CFO.positionName ||
this.companyPosition.positionName == CompanyPositions.CEO.positionName) &&
this.money >= 15000000) {
this.money >= 15000000 && this.karma <= -25) {
invitedFactions.push(silhouetteFac);
}
}
//Netburners
var netburnersFac = Factions["Netburners"];
var totalHacknetRam = 0;
var totalHacknetCores = 0;
var totalHacknetLevels = 0;
for (var i = 0; i < Player.hacknetNodes.length; ++i) {
totalHacknetLevels += Player.hacknetNodes[i].level;
totalHacknetRam += Player.hacknetNodes[i].ram;
totalHacknetCores += Player.hacknetNodes[i].numCores;
}
if (netburnersFac.isBanned == false && netburnersFac.isMember == false &&
this.hacking_skill >= 100 && totalHacknetRam >= 10 &&
totalHacknetCores >= 5 && totalHacknetLevels >= 100) {
invitedFactions.push(netburnersFac);
}
//Tian Di Hui
var tiandihuiFac = Factions["Tian Di Hui"];
@ -504,7 +522,7 @@ displayFactionContent = function(factionName) {
var faction = Factions[factionName];
document.getElementById("faction-name").innerHTML = factionName;
document.getElementById("faction-info").innerHTML = faction.info;
document.getElementById("faction-reputation").innerHTML = "Reputation: " + faction.playerReputation.toFixed(3);
document.getElementById("faction-reputation").innerHTML = "Reputation: " + formatNumber(faction.playerReputation, 4);
var hackDiv = document.getElementById("faction-hack-div");
var fieldWorkDiv = document.getElementById("faction-fieldwork-div");
@ -687,6 +705,10 @@ displayFactionContent = function(factionName) {
case "Silhouette":
hackDiv.style.display = "inline";
fieldWorkDiv.style.display = "inline";
securityWorkDiv.style.display = "none";
case "Netburners":
hackDiv.style.display = "inline";
fieldWorkDiv.style.display = "none";
securityWorkDiv.style.display = "none";
case "Tian Di Hui":
hackDiv.style.display = "inline";
@ -717,31 +739,52 @@ displayFactionAugmentations = function(factionName) {
}
for (var i = 0; i < faction.augmentations.length; ++i) {
var aug = Augmentations[faction.augmentations[i]];
var item = document.createElement("li");
var span = document.createElement("span");
var aElem = document.createElement("a");
var pElem = document.createElement("p");
aElem.setAttribute("href", "#");
var req = aug.baseRepRequirement * faction.augmentationRepRequirementMult;
if (faction.playerReputation >= req) {
aElem.setAttribute("class", "a-link-button");
pElem.innerHTML = "UNLOCKED";
//TODO Event listener for button to purchase augmentation
} else {
aElem.setAttribute("class", "a-link-button-inactive");
pElem.innerHTML = "LOCKED (Requires " + req + " faction reputation)";
pElem.style.color = "red";
}
aElem.style.display = "inline-block";
pElem.style.display = "inline-block";
aElem.innerHTML = aug.name;
span.appendChild(aElem);
span.appendChild(pElem);
item.appendChild(span);
augmentationsList.appendChild(item);
(function () {
var aug = Augmentations[faction.augmentations[i]];
var item = document.createElement("li");
var span = document.createElement("span");
var aElem = document.createElement("a");
var pElem = document.createElement("p");
aElem.setAttribute("href", "#");
var req = aug.baseRepRequirement * faction.augmentationRepRequirementMult;
if (faction.playerReputation >= req) {
aElem.setAttribute("class", "a-link-button");
pElem.innerHTML = "UNLOCKED - $" + formatNumber(aug.baseCost * faction.augmentationPriceMult, 2);
//TODO Event listener for button to purchase augmentation
} else {
aElem.setAttribute("class", "a-link-button-inactive");
pElem.innerHTML = "LOCKED (Requires " + formatNumber(req, 4) + " faction reputation)";
pElem.style.color = "red";
}
aElem.style.display = "inline-block";
pElem.style.display = "inline-block";
aElem.innerHTML = aug.name;
aElem.addEventListener("click", function() {
console.log("here");
purchaseAugmentationBoxCreate(aug, faction);
});
span.appendChild(aElem);
span.appendChild(pElem);
item.appendChild(span);
augmentationsList.appendChild(item);
}()); //Immediate invocation closure
}
}
function processPassiveFactionRepGain(numCycles) {
var numTimesGain = numCycles / 600;
for (var name in Factions) {
if (Factions.hasOwnProperty(name)) {
var faction = Factions[name];
//TODO Get hard value of 1 rep per "rep gain cycle"" for now..
//maybe later make this based on
//a player's 'status' like how powerful they are and how much money they have
if (faction.isMember) {faction.playerReputation += numTimesGain;}
}
}
}

View File

@ -115,6 +115,7 @@ FactionInfo = {
//Earlygame factions - factions the player will prestige with early on that don't
//belong in other categories
NetburnersInfo: "~~HACKNET BURNERS~~",
TianDiHuiInfo: "Obey Heaven and Work Righteousness",
CyberSecInfo: "The Internet is the first thing that humanity has built that humanity doesnt understand,\n" +

282
src/HacknetNode.js Normal file
View File

@ -0,0 +1,282 @@
/* HacknetNode.js */
function HacknetNode(name) {
this.level = 1;
this.ram = 1; //GB
this.numCores = 1;
this.name = name;
this.totalMoneyGenerated = 0;
this.onlineTimeSeconds = 0;
this.moneyGainRatePerSecond = 0;
}
HacknetNode.prototype.updateMoneyGainRate = function() {
//How much extra $/s is gained per level
var gainPerLevel = CONSTANTS.HacknetNodeMoneyGainPerLevel;
//Each CPU core doubles the speed. Every 1GB of ram adds 10% increase
this.moneyGainRatePerSecond = (this.level * gainPerLevel) *
Math.pow(1.1, this.ram-1) *
this.numCores * Player.hacknet_node_money_mult;
if (isNaN(this.moneyGainRatePerSecond)) {
throw new Error("Money gain rate calculated for Hacknet Node is NaN");
}
}
HacknetNode.prototype.calculateLevelUpgradeCost = function() {
//Upgrade cost = Base cost * multiplier ^ level
var mult = CONSTANTS.HacknetNodeUpgradeLevelMult;
return CONSTANTS.BaseCostForHacknetNode * Math.pow(mult, this.level) * Player.hacknet_node_level_cost_mult;
}
HacknetNode.prototype.purchaseLevelUpgrade = function() {
var cost = this.calculateLevelUpgradeCost();
if (isNaN(cost)) {throw new Error("Cost is NaN"); return;}
if (cost > Player.money) {return;}
Player.loseMoney(cost);
++this.level;
this.updateMoneyGainRate();
}
HacknetNode.prototype.calculateRamUpgradeCost = function() {
var numUpgrades = Math.log2(this.ram);
//Calculate cost
//Base cost of RAM is 50k per 1GB...but lets have this increase by 10% for every time
//the RAM has been upgraded
var cost = this.ram * CONSTANTS.BaseCostFor1GBOfRam;
var mult = Math.pow(CONSTANTS.HacknetNodeUpgradeRamMult, numUpgrades);
return cost * mult * Player.hacknet_node_ram_cost_mult;
}
HacknetNode.prototype.purchaseRamUpgrade = function() {
var cost = this.calculateRamUpgradeCost();
if (isNaN(cost)) {throw new Error("Cost is NaN"); return;}
if (cost > Player.money) {return;}
Player.loseMoney(cost);
this.ram *= 2; //Ram is always doubled
this.updateMoneyGainRate();
}
HacknetNode.prototype.calculateCoreUpgradeCost = function() {
var coreBaseCost = CONSTANTS.BaseCostForHacknetNodeCore;
var mult = CONSTANTS.HacknetNodeUpgradeCoreMult;
return coreBaseCost * Math.pow(mult, this.numCores-1) * Player.hacknet_node_core_cost_mult;
}
HacknetNode.prototype.purchaseCoreUpgrade = function() {
var cost = this.calculateCoreUpgradeCost();
if (isNaN(cost)) {throw new Error("Cost is NaN"); return;}
if (cost > Player.money) {return;}
Player.loseMoney(cost);
++this.numCores;
this.updateMoneyGainRate();
}
/* Saving and loading HackNets */
HacknetNode.prototype.toJSON = function() {
return Generic_toJSON("HacknetNode", this);
}
HacknetNode.fromJSON = function(value) {
return Generic_fromJSON(HacknetNode, value.data);
}
Reviver.constructors.HacknetNode = HacknetNode;
purchaseHacknet = function() {
var cost = getCostOfNextHacknetNode();
if (isNaN(cost)) {throw new Error("Cost is NaN"); return;}
if (cost > Player.money) {
dialogBoxCreate("You cannot afford to purchase a Hacknet Node!");
return;
}
//Auto generate a name for the node for now...TODO
var numOwned = Player.hacknetNodes.length;
var name = "hacknet-node-" + numOwned;
var node = new HacknetNode(name);
node.updateMoneyGainRate();
Player.loseMoney(cost);
Player.hacknetNodes.push(node);
displayHacknetNodesContent();
}
getCostOfNextHacknetNode = function() {
//Cost increases exponentially based on how many you own
var numOwned = Player.hacknetNodes.length;
var mult = CONSTANTS.HacknetNodePurchaseNextMult;
return CONSTANTS.BaseCostForHacknetNode * Math.pow(mult, numOwned) * Player.hacknet_node_purchase_cost_mult;
}
//Creates Hacknet Node DOM elements when the page is opened
displayHacknetNodesContent = function() {
//Update Hacknet Nodes button
var purchaseButton = document.getElementById("hacknet-nodes-purchase-button");
var newPurchaseButton = purchaseButton.cloneNode(true);
purchaseButton.parentNode.replaceChild(newPurchaseButton, purchaseButton);
newPurchaseButton.addEventListener("click", function() {
purchaseHacknet();
return false;
});
//Remove all old hacknet Node DOM elements
var hacknetNodesList = document.getElementById("hacknet-nodes-list");
while (hacknetNodesList.firstChild) {
hacknetNodesList.removeChild(hacknetNodesList.firstChild);
}
//Then re-create them
for (var i = 0; i < Player.hacknetNodes.length; ++i) {
createHacknetNodeDomElement(Player.hacknetNodes[i]);
}
updateHacknetNodesContent();
}
//Update information on all Hacknet Node DOM elements
updateHacknetNodesContent = function() {
//Set purchase button to inactive if not enough money, and update its price display
var cost = getCostOfNextHacknetNode();
var purchaseButton = document.getElementById("hacknet-nodes-purchase-button");
purchaseButton.innerHTML = "Purchase Hacknet Node - $" + formatNumber(cost, 2);
if (cost > Player.money) {
purchaseButton.setAttribute("class", "a-link-button-inactive");
} else {
purchaseButton.setAttribute("class", "a-link-button");
}
//Update player's money
document.getElementById("hacknet-nodes-money").innerHTML = "Money: $" + formatNumber(Player.money, 2);
//Update information in each owned hacknet node
for (var i = 0; i < Player.hacknetNodes.length; ++i) {
updateHacknetNodeDomElement(Player.hacknetNodes[i]);
}
}
//Creates a single Hacknet Node DOM element
createHacknetNodeDomElement = function(nodeObj) {
var nodeName = nodeObj.name;
var listItem = document.createElement("li");
listItem.setAttribute("class", "hacknet-node");
var span = document.createElement("span");
span.style.display = "inline";
var buttonDiv = document.createElement("div");
buttonDiv.setAttribute("class", "hacknet-node-button-div");
//Text
var txt = document.createElement("p");
//txt.setAttribute("id", "hacknet-node-text-" + nodeName);
txt.id = "hacknet-node-text-" + nodeName;
//Upgrade buttons
var upgradeLevelButton = document.createElement("a");
var upgradeRamButton = document.createElement("a");
var upgradeCoreButton = document.createElement("a");
//upgradeLevelButton.setAttribute("id", "hacknet-node-upgrade-level-" + nodeName);
upgradeLevelButton.id = "hacknet-node-upgrade-level-" + nodeName;
upgradeLevelButton.setAttribute("class", "a-link-button-inactive");
upgradeLevelButton.addEventListener("click", function() {
nodeObj.purchaseLevelUpgrade();
updateHacknetNodesContent();
return false;
});
//upgradeRamButton.setAttribute("id", "hacknet-node-upgrade-ram-" + nodeName);
upgradeRamButton.id = "hacknet-node-upgrade-ram-" + nodeName;
upgradeRamButton.setAttribute("class", "a-link-button-inactive");
upgradeRamButton.addEventListener("click", function() {
nodeObj.purchaseRamUpgrade();
updateHacknetNodesContent();
return false;
});
//upgradeCoreButton.setAttribute("id", "hacknet-node-upgrade-core-" + nodeName);
upgradeCoreButton.id = "hacknet-node-upgrade-core-" + nodeName;
upgradeCoreButton.setAttribute("class", "a-link-button-inactive");
upgradeCoreButton.addEventListener("click", function() {
nodeObj.purchaseCoreUpgrade();
updateHacknetNodesContent();
return false;
});
//Put all the components together in the li element
span.appendChild(txt);
buttonDiv.appendChild(upgradeLevelButton);
buttonDiv.appendChild(upgradeRamButton);
buttonDiv.appendChild(upgradeCoreButton);
span.appendChild(buttonDiv);
listItem.appendChild(span);
document.getElementById("hacknet-nodes-list").appendChild(listItem);
//Set the text and stuff inside the DOM element
updateHacknetNodeDomElement(nodeObj);
}
//Updates information on a single hacknet node DOM element
updateHacknetNodeDomElement = function(nodeObj) {
var nodeName = nodeObj.name;
var txt = document.getElementById("hacknet-node-text-" + nodeName);
if (txt == null) {throw new Error("Cannot find text element");}
txt.innerHTML = "Node name: " + nodeName + "<br>" +
"Production: $" + formatNumber(nodeObj.totalMoneyGenerated, 2) +
" ($" + formatNumber(nodeObj.moneyGainRatePerSecond, 2) + " / second) <br>" +
"Level: " + nodeObj.level + "<br>" +
"RAM: " + nodeObj.ram + "GB<br>" +
"Cores: " + nodeObj.numCores;
var upgradeLevelButton = document.getElementById("hacknet-node-upgrade-level-" + nodeName);
if (upgradeLevelButton == null) {throw new Error("Cannot find upgrade level button element");}
var upgradeLevelCost = nodeObj.calculateLevelUpgradeCost();
upgradeLevelButton.innerHTML = "Upgrade Hacknet Node Level - $" + formatNumber(upgradeLevelCost, 2);
if (upgradeLevelCost > Player.money) {
upgradeLevelButton.setAttribute("class", "a-link-button-inactive");
} else {
upgradeLevelButton.setAttribute("class", "a-link-button");
}
var upgradeRamButton = document.getElementById("hacknet-node-upgrade-ram-" + nodeName);
if (upgradeRamButton == null) {throw new Error("Cannot find upgrade ram button element");}
var upgradeRamCost = nodeObj.calculateRamUpgradeCost();
upgradeRamButton.innerHTML = "Upgrade Hacknet Node RAM -$" + formatNumber(upgradeRamCost, 2);
if (upgradeRamCost > Player.money) {
upgradeRamButton.setAttribute("class", "a-link-button-inactive");
} else {
upgradeRamButton.setAttribute("class", "a-link-button");
}
var upgradeCoreButton = document.getElementById("hacknet-node-upgrade-core-" + nodeName);
if (upgradeCoreButton == null) {throw new Error("Cannot find upgrade cores button element");}
var upgradeCoreCost = nodeObj.calculateCoreUpgradeCost();
upgradeCoreButton.innerHTML = "Purchase additional CPU Core - $" + formatNumber(upgradeCoreCost, 2);
if (upgradeCoreCost > Player.money) {
upgradeCoreButton.setAttribute("class", "a-link-button-inactive");
} else {
upgradeCoreButton.setAttribute("class", "a-link-button");
}
}
processAllHacknetNodeEarnings = function(numCycles) {
for (var i = 0; i < Player.hacknetNodes.length; ++i) {
processSingleHacknetNodeEarnings(numCycles, Player.hacknetNodes[i]);
}
}
processSingleHacknetNodeEarnings = function(numCycles, nodeObj) {
var cyclesPerSecond = 1000 / Engine._idleSpeed;
var earningPerCycle = nodeObj.moneyGainRatePerSecond / cyclesPerSecond;
if (isNaN(earningPerCycle)) {throw new Error("Calculated Earnings is not a number");}
var totalEarnings = numCycles * earningPerCycle;
nodeObj.totalMoneyGenerated += totalEarnings;
nodeObj.onlineTimeSeconds += (numCycles * (Engine._idleSpeed / 1000));
Player.gainMoney(totalEarnings);
}

View File

@ -10,9 +10,9 @@ Locations = {
Ishima: "Ishima",
Volhaven: "Volhaven",
//Aevum Locations
AevumTravelAgency: "Aevum Travel Agency",
AevumSummitUniversity: "Summit University",
AevumECorp: "ECorp",
AevumBachmanAndAssociates: "Bachman & Associates",
AevumClarkeIncorporated: "Clarke Incorporated",
@ -25,14 +25,17 @@ Locations = {
AevumNetLinkTechnologies: "NetLink Technologies",
AevumCrushFitnessGym: "Crush Fitness Gym",
AevumSnapFitnessGym: "Snap Fitness Gym",
AevumSlums: "Aevum Slums",
//Chongqing locations
ChongqingTravelAgency: "Chongqing Travel Agency",
ChongqingKuaiGongInternational: "KuaiGong International",
ChongqingSolarisSpaceSystems: "Solaris Space Systems",
ChongqingSlums: "Chongqing Slums",
//Sector 12
Sector12TravelAgency: "Sector-12 Travel Agency",
Sector12RothmanUniversity: "Rothman University",
Sector12MegaCorp: "MegaCorp",
Sector12BladeIndustries: "Blade Industries",
Sector12FourSigma: "Four Sigma",
@ -47,6 +50,7 @@ Locations = {
Sector12JoesGuns: "Joe's Guns",
Sector12IronGym: "Iron Gym",
Sector12PowerhouseGym: "Powerhouse Gym",
Sector12Slums: "Sector-12 Slums",
//New Tokyo
NewTokyoTravelAgency: "New Tokyo Travel Agency",
@ -54,23 +58,27 @@ Locations = {
NewTokyoVitaLife: "VitaLife",
NewTokyoGlobalPharmaceuticals: "Global Pharmaceuticals",
NewTokyoNoodleBar: "Noodle Bar",
NewTokyoSlums: "New Tokyo Slums",
//Ishima
IshimaTravelAgency: "Ishima Travel Agency",
IshimaStormTechnologies: "Storm Technologies",
IshimaNovaMedical: "Nova Medical",
IshimaOmegaSoftware: "Omega Software",
IshimaSlums: "Ishima Slums",
//Volhaven
VolhavenTravelAgency: "Volhaven Travel Agency",
VolhavenOmniTekIncorporated: "OmniTek Incorporated",
VolhavenNWO: "NWO",
VolhavenHeliosLabs: "Helios Labs",
VolhavenOmniaCybersystems: "Omnia Cybersystems",
VolhavenLexoCorp: "LexoCorp",
VolhavenSysCoreSecurities: "SysCore Securities",
VolhavenCompuTek: "CompuTek",
VolhavenMilleniumFitnessGym: "Millenium Fitness Gym",
VolhavenTravelAgency: "Volhaven Travel Agency",
VolhavenZBInstituteOfTechnology: "ZB Institute of Technology",
VolhavenOmniTekIncorporated: "OmniTek Incorporated",
VolhavenNWO: "NWO",
VolhavenHeliosLabs: "Helios Labs",
VolhavenOmniaCybersystems: "Omnia Cybersystems",
VolhavenLexoCorp: "LexoCorp",
VolhavenSysCoreSecurities: "SysCore Securities",
VolhavenCompuTek: "CompuTek",
VolhavenMilleniumFitnessGym: "Millenium Fitness Gym",
VolhavenSlums: "Volhaven Slums",
}
displayLocationContent = function() {
@ -103,6 +111,13 @@ displayLocationContent = function() {
var gymTrainDef = document.getElementById("location-gym-train-def");
var gymTrainDex = document.getElementById("location-gym-train-dex");
var gymTrainAgi = document.getElementById("location-gym-train-agi");
var studyComputerScience= document.getElementById("location-study-computer-science");
var classDataStructures = document.getElementById("location-data-structures-class");
var classNetworks = document.getElementById("location-networks-class");
var classAlgorithms = document.getElementById("location-algorithms-class");
var classManagement = document.getElementById("location-management-class");
var classLeadership = document.getElementById("location-leadership-class");
var purchase1gb = document.getElementById("location-purchase-1gb");
var purchase2gb = document.getElementById("location-purchase-2gb");
@ -116,6 +131,7 @@ displayLocationContent = function() {
var purchase512gb = document.getElementById("location-purchase-512gb");
var purchase1tb = document.getElementById("location-purchase-1tb");
var purchaseTor = document.getElementById("location-purchase-tor");
var purchaseHomeRam = document.getElementById("location-purchase-home-ram");
var travelAgencyText = document.getElementById("location-travel-agency-text");
var travelToAevum = document.getElementById("location-travel-to-aevum");
@ -125,6 +141,14 @@ displayLocationContent = function() {
var travelToIshima = document.getElementById("location-travel-to-ishima");
var travelToVolhaven = document.getElementById("location-travel-to-volhaven");
var slumsDescText = document.getElementById("location-slums-description");
var slumsShoplift = document.getElementById("location-slums-shoplift");
var slumsMug = document.getElementById("location-slums-mug");
var slumsDealDrugs = document.getElementById("location-slums-deal-drugs");
var slumsTrafficArms = document.getElementById("location-slums-traffic-arms");
var slumsHomicide = document.getElementById("location-slums-homicide");
var slumsKidnap = document.getElementById("location-slums-kidnap");
var loc = Player.location;
returnToWorld.addEventListener("click", function() {
@ -163,6 +187,13 @@ displayLocationContent = function() {
gymTrainDex.style.display = "none";
gymTrainAgi.style.display = "none";
studyComputerScience.style.display = "none";
classDataStructures.style.display = "none";
classNetworks.style.display = "none";
classAlgorithms.style.display = "none";
classManagement.style.display = "none";
classLeadership.style.display = "none";
purchase1gb.style.display = "none";
purchase2gb.style.display = "none";
purchase4gb.style.display = "none";
@ -175,6 +206,7 @@ displayLocationContent = function() {
purchase512gb.style.display = "none";
purchase1tb.style.display = "none";
purchaseTor.style.display = "none";
purchaseHomeRam.style.display = "none";
travelAgencyText.style.display = "none";
travelToAevum.style.display = "none";
@ -184,6 +216,14 @@ displayLocationContent = function() {
travelToIshima.style.display = "none";
travelToVolhaven.style.display = "none";
slumsDescText.style.display = "none";
slumsShoplift.style.display = "none";
slumsMug.style.display = "none";
slumsDealDrugs.style.display = "none";
slumsTrafficArms.style.display = "none";
slumsHomicide.style.display = "none";
slumsKidnap.style.display = "none";
//Check if the player is employed at this Location. If he is, display the "Work" button,
//update the job title, etc.
if (loc == Player.companyName) {
@ -233,6 +273,13 @@ displayLocationContent = function() {
travelToVolhaven.style.display = "block";
break;
case Locations.AevumSummitUniveristy:
var costMult = 3;
var expMult = 2;
displayUniversityLocationContent(costMult);
setUniversityLocationButtons(costMult, expMult);
break;
case Locations.AevumECorp:
locationInfo.innerHTML = Companies[loc].info;
@ -248,6 +295,7 @@ displayLocationContent = function() {
purchase512gb.style.display = "block";
purchase1tb.style.display = "block";
purchaseTor.style.display = "block";
purchaseHomeRam.style.display = "block";
break;
case Locations.AevumBachmanAndAssociates:
@ -286,6 +334,7 @@ displayLocationContent = function() {
purchase512gb.style.display = "block";
purchase1tb.style.display = "block";
purchaseTor.style.display = "block";
purchaseHomeRam.style.display = "block";
break;
case Locations.AevumAeroCorp:
@ -347,6 +396,7 @@ displayLocationContent = function() {
purchase4gb.style.display = "block";
purchase8gb.style.display = "block";
purchaseTor.style.display = "block";
purchaseHomeRam.style.display = "block";
break;
case Locations.AevumCrushFitnessGym:
@ -403,6 +453,13 @@ displayLocationContent = function() {
travelToIshima.style.display = "block";
travelToVolhaven.style.display = "block";
break;
case Locations.Sector12RothmanUniversity:
var costMult = 2;
var expMult = 1;
displayUniversityLocationContent(costMult);
setUniversityLocationButtons(costMult, expMult);
break;
case Locations.Sector12MegaCorp:
locationInfo.innerHTML = Companies[loc].info;
@ -499,6 +556,7 @@ displayLocationContent = function() {
purchase2gb.style.display = "block";
purchase4gb.style.display = "block";
purchaseTor.style.display = "block";
purchaseHomeRam.style.display = "block";
break;
case Locations.Sector12CarmichaelSecurity:
@ -611,6 +669,7 @@ displayLocationContent = function() {
purchase64gb.style.display = "block";
purchase128gb.style.display = "block";
purchase256gb.style.display = "block";
purchaseHomeRam.style.display = "block";
break;
case Locations.IshimaNovaMedical:
@ -635,9 +694,10 @@ displayLocationContent = function() {
purchase16gb.style.display = "block";
purchase32gb.style.display = "block";
purchaseTor.style.display = "block";
purchaseHomeRam.style.display = "block";
break;
case Locations.VolhavenTravelAgency:
case Locations.VolhavenTravelAgency:
travelAgencyText.style.display = "block";
travelToAevum.style.display = "block";
travelToChongqing.style.display = "block";
@ -645,6 +705,13 @@ displayLocationContent = function() {
travelToNewTokyo.style.display = "block";
travelToIshima.style.display = "block";
break;
case Locations.VolhavenZBInstituteOfTechnology:
var costMult = 4;
var expMult = 3;
displayUniversityLocationContent(costMult);
setUniversityLocationButtons(costMult, expMult);
break;
case Locations.VolhavenOmniTekIncorporated:
locationInfo.innerHTML = Companies[loc].info;
@ -729,7 +796,7 @@ displayLocationContent = function() {
purchase128gb.style.display = "block";
purchase256gb.style.display = "block";
purchaseTor.style.display = "block";
purchaseHomeRam.style.display = "block";
break;
case Locations.VolhavenMilleniumFitnessGym:
@ -739,6 +806,35 @@ displayLocationContent = function() {
gymTrainAgi.style.display = "block";
break;
//All Slums
case Locations.AevumSlums:
case Locations.ChongqingSlums:
case Locations.Sector12Slums:
case Locations.NewTokyokSlums:
case Locations.IshimaSlums:
case Locations.VolhavenSlums:
var shopliftChance = determineCrimeChanceShoplift();
var mugChance = determineCrimeChanceMug();
var drugsChance = determineCrimeChanceDealDrugs();
var armsChance = determineCrimeChanceTraffickArms();
var homicideChance = determineCrimeChanceHomicide();
var kidnapChance = determineCrimeChanceKidnap();
slumsDescText.style.display = "block";
slumsShoplift.style.display = "block";
slumsShoplift.innerHTML = "Shoplift (" + (shopliftChance*100).toFixed(3) + "% chance of success)";
slumsMug.style.display = "block";
slumsMug.innerHTML = "Mug someone (" + (mugChance*100).toFixed(3) + "% chance of success)";
slumsDealDrugs.style.display = "block";
slumsDealDrugs.innerHTML = "Deal Drugs (" + (drugsChance*100).toFixed(3) + "% chance of success)";
slumsTrafficArms.style.display = "block";
slumsTrafficArms.innerHTML = "Traffick Illegal Arms (" + (armsChance*100).toFixed(3) + "% chance of success)";
slumsHomicide.style.display = "block";
slumsHomicide.innerHTML = "Homicide (" + (homicideChance*100).toFixed(3) + "% chance of success)";
slumsKidnap.style.display = "block";
slumsKidnap.innerHTML = "Kidnap and Ransom (" + (kidnapChance*100).toFixed(3) + "% chance of success)";
break;
default:
console.log("ERROR: INVALID LOCATION");
@ -765,6 +861,13 @@ initLocationButtons = function() {
return false;
});
aevumSummitUniversity = document.getElementById("aevum-summituniversity");
aevumSummitUniversity.addEventListener("click", function() {
Player.location = Locations.AevumSummitUniversity;
Engine.loadLocationContent();
return false;
});
aevumECorp = document.getElementById("aevum-ecorp");
aevumECorp.addEventListener("click", function() {
Player.location = Locations.AevumECorp;
@ -848,6 +951,13 @@ initLocationButtons = function() {
Engine.loadLocationContent();
return false;
});
aevumSlums = document.getElementById("aevum-slums");
aevumSlums.addEventListener("click", function() {
Player.location = Locations.AevumSlums;
Engine.loadLocationContent();
return false;
});
chongqingTravelAgency = document.getElementById("chongqing-travelagency");
chongqingTravelAgency.addEventListener("click", function() {
@ -869,6 +979,14 @@ initLocationButtons = function() {
Engine.loadLocationContent();
return false;
});
chongqingSlums = document.getElementById("chongqing-slums");
chongqingSlums.addEventListener("click", function() {
Player.location = Locations.ChongqingSlums;
Engine.loadLocationContent();
return false;
});
sector12TravelAgency = document.getElementById("sector12-travelagency");
sector12TravelAgency.addEventListener("click", function() {
@ -877,6 +995,13 @@ initLocationButtons = function() {
return false;
});
sector12RothmanUniversity = document.getElementById("sector12-rothmanuniversity");
sector12RothmanUniversity.addEventListener("click", function() {
Player.location = Locations.Sector12RothmanUniversity;
Engine.loadLocationContent();
return false;
});
sector12MegaCorp = document.getElementById("sector12-megacorp");
sector12MegaCorp.addEventListener("click", function() {
Player.location = Locations.Sector12MegaCorp;
@ -974,6 +1099,13 @@ initLocationButtons = function() {
Engine.loadLocationContent();
return false;
});
sector12Slums = document.getElementById("sector12-slums");
sector12Slums.addEventListener("click", function() {
Player.location = Locations.Sector12Slums;
Engine.loadLocationContent();
return false;
});
newTokyoTravelAgency = document.getElementById("newtokyo-travelagency");
newTokyoTravelAgency.addEventListener("click", function() {
@ -1009,6 +1141,13 @@ initLocationButtons = function() {
Engine.loadLocationContent();
return false;
});
newTokyoSlums = document.getElementById("newtokyo-slums");
newTokyoSlums.addEventListener("click", function() {
Player.location = Locations.NewTokyoSlums;
Engine.loadLocationContent();
return false;
});
ishimaTravelAgency = document.getElementById("ishima-travelagency");
ishimaTravelAgency.addEventListener("click", function() {
@ -1037,6 +1176,13 @@ initLocationButtons = function() {
Engine.loadLocationContent();
return false;
});
ishimaSlums = document.getElementById("ishima-slums");
ishimaSlums.addEventListener("click", function() {
Player.location = Locations.IshimaSlums;
Engine.loadLocationContent();
return false;
});
volhavenTravelAgency = document.getElementById("volhaven-travelagency");
volhavenTravelAgency.addEventListener("click", function() {
@ -1044,6 +1190,13 @@ initLocationButtons = function() {
Engine.loadLocationContent();
return false;
});
volhavenZBInstituteOfTechnology = document.getElementById("volhaven-zbinstituteoftechnology");
volhavenZBInstituteOfTechnology.addEventListener("click", function() {
Player.location = Locations.VolhavenZBInstituteOfTechnology;
Engine.loadLocationContent();
return false;
});
volhavenOmniTekIncorporated = document.getElementById("volhaven-omnitekincorporated");
volhavenOmniTekIncorporated.addEventListener("click", function() {
@ -1101,6 +1254,13 @@ initLocationButtons = function() {
return false;
});
volhavenSlums = document.getElementById("volhaven-slums");
volhavenSlums.addEventListener("click", function() {
Player.location = Locations.VolhavenSlums;
Engine.loadLocationContent();
return false;
});
//Buttons to interact at a location (apply for job/promotion, train, purchase, etc.)
var softwareJob = document.getElementById("location-software-job");
@ -1132,6 +1292,7 @@ initLocationButtons = function() {
var purchase512gb = document.getElementById("location-purchase-512gb");
var purchase1tb = document.getElementById("location-purchase-1tb");
var purchaseTor = document.getElementById("location-purchase-tor");
var purchaseHomeRam = document.getElementById("location-purchase-home-ram");
var travelToAevum = document.getElementById("location-travel-to-aevum");
var travelToChongqing = document.getElementById("location-travel-to-chongqing");
@ -1140,6 +1301,13 @@ initLocationButtons = function() {
var travelToIshima = document.getElementById("location-travel-to-ishima");
var travelToVolhaven = document.getElementById("location-travel-to-volhaven");
var slumsShoplift = document.getElementById("location-slums-shoplift");
var slumsMug = document.getElementById("location-slums-mug");
var slumsDealDrugs = document.getElementById("location-slums-deal-drugs");
var slumsTrafficArms = document.getElementById("location-slums-traffic-arms");
var slumsHomicide = document.getElementById("location-slums-homicide");
var slumsKidnap = document.getElementById("location-slums-kidnap");
softwareJob.addEventListener("click", function() {
Player.applyForSoftwareJob();
return false;
@ -1186,22 +1354,22 @@ initLocationButtons = function() {
});
purchase1gb.addEventListener("click", function() {
purchaseServerBoxCreate(1, 100000);
purchaseServerBoxCreate(1, 50000);
return false;
});
purchase2gb.addEventListener("click", function() {
purchaseServerBoxCreate(2, 250000);
purchaseServerBoxCreate(2, 100000);
return false;
});
purchase4gb.addEventListener("click", function() {
purchaseServerBoxCreate(4, 600000);
purchaseServerBoxCreate(4, 250000);
return false;
});
purchase8gb.addEventListener("click", function() {
purchaseServerBoxCreate(8, 1500000);
purchaseServerBoxCreate(8, 1000000);
return false;
});
@ -1211,7 +1379,7 @@ initLocationButtons = function() {
});
purchase32gb.addEventListener("click", function() {
purchaseServerBoxCreate(32, 9000000);
purchaseServerBoxCreate(32, 10000000);
return false;
});
@ -1221,7 +1389,7 @@ initLocationButtons = function() {
});
purchase128gb.addEventListener("click", function() {
purchaseServerBoxCreate(128, 45000000);
purchaseServerBoxCreate(128, 50000000);
return false;
});
@ -1236,7 +1404,7 @@ initLocationButtons = function() {
});
purchase1tb.addEventListener("click", function() {
purchaseServerBoxCreate(1024, 600000000);
purchaseServerBoxCreate(1024, 750000000);
return false;
});
@ -1245,6 +1413,11 @@ initLocationButtons = function() {
return false;
});
purchaseHomeRam.addEventListener("click", function() {
purchaseRamForHomeBoxCreate();
return false;
});
travelToAevum.addEventListener("click", function() {
travelBoxCreate(Locations.Aevum, 1000000);
return false;
@ -1275,6 +1448,35 @@ initLocationButtons = function() {
return false;
});
slumsShoplift.addEventListener("click", function() {
commitShopliftCrime();
return false;
});
slumsMug.addEventListener("click", function() {
commitMugCrime();
return false;
});
slumsDealDrugs.addEventListener("click", function() {
commitDealDrugsCrime();
return false;
});
slumsTrafficArms.addEventListener("click", function() {
commitTraffickArmsCrime();
return false;
});
slumsHomicide.addEventListener("click", function() {
commitHomicideCrime();
return false;
});
slumsKidnap.addEventListener("click", function() {
commitKidnapCrime();
return false;
});
}
travelToCity = function(destCityName, cost) {
@ -1302,4 +1504,91 @@ purchaseTorRouter = function() {
Player.getHomeComputer().serversOnNetwork.push(darkweb.ip);
dialogBoxCreate("You have purchased a Tor router!", "You now have access to the dark web from your home computer", "Use the scan/netstat commands to search for the dark web connect.", "");
}
}
displayUniversityLocationContent = function(costMult) {
var studyComputerScienceButton = document.getElementById("location-study-computer-science");
var classDataStructuresButton = document.getElementById("location-data-structures-class");
var classNetworksButton = document.getElementById("location-networks-class");
var classAlgorithmsButton = document.getElementById("location-algorithms-class");
var classManagementButton = document.getElementById("location-management-class");
var classLeadershipButton = document.getElementById("location-leadership-class");
studyComputerScienceButton.style.display = "block";
classDataStructuresButton.style.display = "block";
classNetworksButton.style.display = "block";
classAlgorithmsButton.style.display = "block";
classManagementButton.style.display = "block";
classLeadershipButton.style.display = "block";
//Costs (per second)
var baseDataStructuresCost = 1;
var baseNetworksCost = 5;
var baseAlgorithmsCost = 20;
var baseManagementCost = 10;
var baseLeadershipCost = 20;
var dataStructuresCost = baseDataStructuresCost * costMult;
var networksCost = baseNetworksCost * costMult;
var algorithmsCost = baseAlgorithmsCost * costMult;
var managementCost = baseManagementCost * costMult;
var leadershipCost = baseLeadershipCost * costMult;
//Update button text to show cost
classDataStructuresButton.innerHTML = "Take Data Structures course ($" + dataStructuresCost + " / sec)";
classNetworksButton.innerHTML = "Take Networks course ($" + networksCost + " / second)";
classAlgorithmsButton.innerHTML = "Take Algorithms course ($" + algorithmsCost + " / second)";
classManagementButton.innerHTML = "Take Management course ($" + managementCost + " / second)";
classLeadershipButton.innerHTML = "Take Leadership course ($" + leadershipCost + " / second)";
}
setUniversityLocationButtons = function(costMult, expMult) {
var studyComputerScience= document.getElementById("location-study-computer-science");
var classDataStructures = document.getElementById("location-data-structures-class");
var classNetworks = document.getElementById("location-networks-class");
var classAlgorithms = document.getElementById("location-algorithms-class");
var classManagement = document.getElementById("location-management-class");
var classLeadership = document.getElementById("location-leadership-class");
var newStudyCS = studyComputerScience.cloneNode(true);
studyComputerScience.parentNode.replaceChild(newStudyCS, studyComputerScience)
newStudyCS.addEventListener("click", function() {
Player.startClass(costMult, expMult, CONSTANTS.ClassStudyComputerScience);
return false;
});
var newClassDataStructures = classDataStructures.cloneNode(true);
classDataStructures.parentNode.replaceChild(newClassDataStructures, classDataStructures);
newClassDataStructures.addEventListener("click", function() {
Player.startClass(costMult, expMult, CONSTANTS.ClassDataStructures);
return false;
});
var newClassNetworks = classNetworks.cloneNode(true);
classNetworks.parentNode.replaceChild(newClassNetworks, classNetworks);
newClassNetworks.addEventListener("click", function() {
Player.startClass(costMult, expMult, CONSTANTS.ClassNetworks);
return false;
});
var newClassAlgorithms = classAlgorithms.cloneNode(true);
classAlgorithms.parentNode.replaceChild(newClassAlgorithms, classAlgorithms);
newClassAlgorithms.addEventListener("click", function() {
Player.startClass(costMult, expMult, CONSTANTS.ClassAlgorithms);
return false;
});
var newClassManagement = classManagement.cloneNode(true);
classManagement.parentNode.replaceChild(newClassManagement, classManagement);
newClassManagement.addEventListener("click", function() {
Player.startClass(costMult, expMult, CONSTANTS.ClassManagement);
return false;
});
var newClassLeadership = classLeadership.cloneNode(true);
classLeadership.parentNode.replaceChild(newClassLeadership, classLeadership);
newClassLeadership.addEventListener("click", function() {
Player.startClass(costMult, expMult, CONSTANTS.ClassLeadership);
return false;
});
}

View File

@ -6,6 +6,11 @@
//wait for that promise to finish before continuing
function evaluate(exp, workerScript) {
var env = workerScript.env;
if (exp == null) {
return new Promise(function(resolve, reject) {
reject("|" + workerScript.serverIp + "|" + workerScript.name + "|Error: NULL expression");
});
}
switch (exp.type) {
case "num":
case "str":
@ -103,7 +108,7 @@ function evaluate(exp, workerScript) {
var numConds = exp.cond.length;
var numThens = exp.then.length;
if (numConds == 0 || numThens == 0 || numConds != numThens) {
throw new Error ("|" + workerScript.serverIp + "|" + workerScript.name + "|Number of conds and thens in if structure don't match (or there are none)");
reject("|" + workerScript.serverIp + "|" + workerScript.name + "|Number of conds and thens in if structure don't match (or there are none)");
}
for (var i = 0; i < numConds; i++) {
@ -120,6 +125,7 @@ function evaluate(exp, workerScript) {
if (env.stopFlag) {reject(workerScript);}
console.log("for loop encountered in evaluator");
workerScript.scriptRef.log("Entering for loop");
var pInit = new Promise(function(resolve, reject) {
setTimeout(function() {
var resInit = evaluate(exp.init, workerScript);
@ -135,6 +141,7 @@ function evaluate(exp, workerScript) {
var pForLoop = evaluateFor(exp, workerScript);
pForLoop.then(function(forLoopRes) {
resolve("forLoopDone");
workerScript.scriptRef.log("Exiting for loop");
}, function(e) {
reject(e);
});
@ -163,7 +170,8 @@ function evaluate(exp, workerScript) {
evaluateProgPromise.then(function(w) {
resolve(workerScript);
}, function(e) {
reject(e);
workerScript.errorMessage = e.toString();
reject(workerScript);
});
});
break;
@ -186,7 +194,7 @@ function evaluate(exp, workerScript) {
setTimeout(function() {
if (exp.func.value == "hack") {
if (exp.args.length != 1) {
throw new Error("|" + workerScript.serverIp + "|" + workerScript.name + "|Hack() call has incorrect number of arguments. Takes 1 argument");
reject("|" + workerScript.serverIp + "|" + workerScript.name + "|Hack() call has incorrect number of arguments. Takes 1 argument");
}
//IP of server to hack
@ -203,20 +211,28 @@ function evaluate(exp, workerScript) {
server = AllServers[ip];
}
if (server == null) {
resolve("Invalid IP or server hostname passed in");
reject("|" + workerScript.serverIp + "|" + workerScript.name + "|Invalid IP or hostname passed into hack() command");
workerScript.scriptRef.log("Cannot hack(). Invalid IP or hostname passed in: " + ip);
return;
}
//Calculate the hacking time
var hackingTime = scriptCalculateHackingTime(server); //This is in seconds
//No root access or skill level too low
if (server.hasAdminRights == false) {
console.log("Cannot hack server " + server.hostname);
resolve("Cannot hack, no admin rights");
workerScript.scriptRef.log("Cannot hack this server because user does not have root access");
workerScript.scriptRef.log("Cannot hack this server (" + server.hostname + ") because user does not have root access");
reject("|" + workerScript.serverIp + "|" + workerScript.name + "|Script crashed because it did not have root access to " + server.hostname);
return;
}
workerScript.scriptRef.log("Attempting to hack " + ip + " in " + hackingTime + " seconds");
if (server.requiredHackingSkill > Player.hacking_skill) {
workerScript.scriptRef.log("Cannot hack this server (" + server.hostaname + ") because user does not have root access");
reject("|" + workerScript.serverIp + "|" + workerScript.name + "|Script crashed because player's hacking skill is not high enough to hack " + server.hostname);
return;
}
workerScript.scriptRef.log("Attempting to hack " + ip + " in " + hackingTime.toFixed(3) + " seconds");
var p = new Promise(function(resolve, reject) {
if (env.stopFlag) {reject(workerScript);}
@ -240,7 +256,7 @@ function evaluate(exp, workerScript) {
Player.gainHackingExp(expGainedOnSuccess);
workerScript.scriptRef.onlineExpGained += expGainedOnSuccess;
console.log("Script successfully hacked " + server.hostname + " for $" + moneyGained + " and " + expGainedOnSuccess + " exp");
workerScript.scriptRef.log("Script successfully hacked " + server.hostname + " for $" + moneyGained + " and " + expGainedOnSuccess + " exp");
workerScript.scriptRef.log("Script SUCCESSFULLY hacked " + server.hostname + " for $" + moneyGained + " and " + expGainedOnSuccess + " exp");
resolve("Hack success");
} else {
//Player only gains 25% exp for failure? TODO Can change this later to balance
@ -248,7 +264,7 @@ function evaluate(exp, workerScript) {
workerScript.scriptRef.onlineExpGained += expGainedOnFailure;
console.log("Script unsuccessful to hack " + server.hostname + ". Gained " + expGainedOnFailure + " exp");
workerScript.scriptRef.log("Script unsuccessful to hack " + server.hostname + ". Gained " + expGainedOnFailure + " exp");
workerScript.scriptRef.log("Script FAILED to hack " + server.hostname + ". Gained " + expGainedOnFailure + " exp");
resolve("Hack failure");
}
}, hackingTime * 1000);
@ -265,7 +281,8 @@ function evaluate(exp, workerScript) {
} else if (exp.func.value == "sleep") {
if (exp.args.length != 1) {
throw new Error("|" + workerScript.serverIp + "|" + workerScript.name + "|Sleep() call has incorrect number of arguments. Takes 1 argument.");
reject("|" + workerScript.serverIp + "|" + workerScript.name + "|sleep() call has incorrect number of arguments. Takes 1 argument.");
return;
}
var sleepTimePromise = evaluate(exp.args[0], workerScript);
@ -285,11 +302,9 @@ function evaluate(exp, workerScript) {
}, function(e) {
reject(e)
});
} else if (exp.func.value == "print") {
if (exp.args.length != 1) {
throw new Error("|" + workerScript.serverIp + "|" + workerScript.name + "| Print() call has incorrect number of arguments. Takes 1 argument");
reject("|" + workerScript.serverIp + "|" + workerScript.name + "|print() call has incorrect number of arguments. Takes 1 argument");
}
var p = new Promise(function(resolve, reject) {
@ -304,25 +319,74 @@ function evaluate(exp, workerScript) {
});
p.then(function(res) {
post(res.toString());
workerScript.scriptRef.log(res.toString());
resolve("printExecuted");
}, function(e) {
reject(e);
});
}
} else if (exp.func.value == "grow") {
if (exp.args.length != 1) {
reject("|" + workerScript.serverIp + "|" + workerScript.name + "|grow() call has incorrect number of arguments. Takes 1 argument");
}
//IP/hostname of server to hack
var ipPromise = evaluate(exp.args[0], workerScript);
ipPromise.then(function(ip) {
//Check if its a valid IP address. If it's not, assume its a hostname and
//try to get the server. If its not a server, there is an error
var server = null;
if (!isValidIPAddress(ip)) {
//It's not an IP address, so see if its a hostanme
server = GetServerByHostname(ip);
} else {
server = AllServers[ip];
}
if (server == null) {
reject("|" + workerScript.serverIp + "|" + workerScript.name + "|Invalid IP or hostname passed into grow() command");
workerScript.scriptRef.log("Cannot grow(). Invalid IP or hostname passed in: " + ip);
return;
}
//No root access or skill level too low
if (server.hasAdminRights == false) {
workerScript.scriptRef.log("Cannot grow this server (" + server.hostname + ") because user does not have root access");
reject("|" + workerScript.serverIp + "|" + workerScript.name + "|Script crashed because it did not have root access to " + server.hostname);
return;
}
workerScript.scriptRef.log("Calling grow() on server " + server.hostname + " in 120 seconds");
var p = new Promise(function(resolve, reject) {
if (env.stopFlag) {reject(workerScript);}
console.log("Executing grow on " + server.hostname + " in 2 minutes ");
setTimeout(function() {
var growthPercentage = processSingleServerGrowth(server, 450);
resolve(growthPercentage);
}, 120 * 1000); //grow() takes flat 2 minutes right now
});
p.then(function(growthPercentage) {
resolve("hackExecuted");
workerScript.scriptRef.log("Using grow(), the money available on " + server.hostname + " was grown by " + (growthPercentage*100 - 100).toFixed(6) + "%");
}, function(e) {
reject(e);
});
}, function(e) {
reject(e);
});
}
}, CONSTANTS.CodeInstructionRunTime);
});
break;
default:
throw new Error("|" + workerScript.serverIp + "|" + workerScript.name + "| Can't evaluate type " + exp.type);
reject("|" + workerScript.serverIp + "|" + workerScript.name + "|Can't evaluate type " + exp.type);
}
}
//Evaluate the looping part of a for loop (Initialization block is NOT done in here)
function evaluateFor(exp, workerScript) {
var env = workerScript.env;
console.log("evaluateFor() called");
return new Promise(function(resolve, reject) {
if (env.stopFlag) {reject(workerScript);}
@ -330,7 +394,6 @@ function evaluateFor(exp, workerScript) {
setTimeout(function() {
var evaluatePromise = evaluate(exp.cond, workerScript);
evaluatePromise.then(function(resCond) {
console.log("Conditional evaluated to: " + resCond);
resolve(resCond);
}, function(e) {
reject(e);
@ -340,13 +403,11 @@ function evaluateFor(exp, workerScript) {
pCond.then(function(resCond) {
if (resCond) {
console.log("About to evaluate an iteration of for loop code");
//Run the for loop code
var pCode = new Promise(function(resolve, reject) {
setTimeout(function() {
var evaluatePromise = evaluate(exp.code, workerScript);
evaluatePromise.then(function(resCode) {
console.log("Evaluated an iteration of for loop code");
resolve(resCode);
}, function(e) {
reject(e);
@ -360,7 +421,6 @@ function evaluateFor(exp, workerScript) {
setTimeout(function() {
var evaluatePromise = evaluate(exp.postloop, workerScript);
evaluatePromise.then(function(foo) {
console.log("Evaluated for loop postloop");
resolve("postLoopFinished");
}, function(e) {
reject(e);
@ -383,7 +443,6 @@ function evaluateFor(exp, workerScript) {
reject(e);
});
} else {
console.log("Cond is false, stopping for loop");
resolve("endForLoop"); //Doesn't need to resolve to any particular value
}
}, function(e) {
@ -395,7 +454,6 @@ function evaluateFor(exp, workerScript) {
function evaluateWhile(exp, workerScript) {
var env = workerScript.env;
console.log("evaluateWhile() called");
return new Promise(function(resolve, reject) {
if (env.stopFlag) {reject(workerScript);}
@ -403,7 +461,6 @@ function evaluateWhile(exp, workerScript) {
setTimeout(function() {
var evaluatePromise = evaluate(exp.cond, workerScript);
evaluatePromise.then(function(resCond) {
console.log("Conditional evaluated to: " + resCond);
resolve(resCond);
}, function(e) {
reject(e);
@ -418,7 +475,6 @@ function evaluateWhile(exp, workerScript) {
setTimeout(function() {
var evaluatePromise = evaluate(exp.code, workerScript);
evaluatePromise.then(function(resCode) {
console.log("Evaluated an iteration of while loop code");
resolve(resCode);
}, function(e) {
reject(e);
@ -438,7 +494,6 @@ function evaluateWhile(exp, workerScript) {
reject(e);
});
} else {
console.log("Cond is false, stopping while loop");
resolve("endWhileLoop"); //Doesn't need to resolve to any particular value
}
}, function(e) {
@ -450,12 +505,10 @@ function evaluateWhile(exp, workerScript) {
function evaluateProg(exp, workerScript, index) {
var env = workerScript.env;
console.log("evaluateProg() called");
return new Promise(function(resolve, reject) {
if (env.stopFlag) {reject(workerScript);}
if (index >= exp.prog.length) {
console.log("Prog done. Resolving recursively");
resolve("progFinished");
} else {
//Evaluate this line of code in the prog
@ -514,10 +567,22 @@ function apply_op(op, a, b) {
throw new Error("Can't apply operator " + op);
}
function isScriptErrorMessage(msg) {
splitMsg = msg.split("|");
if (splitMsg.length != 4){
return false;
}
var ip = splitMsg[1];
if (!isValidIPAddress(ip)) {
return false;
}
return true;
}
//The same as Player's calculateHackingChance() function but takes in the server as an argument
function scriptCalculateHackingChance(server) {
var difficultyMult = (100 - server.hackDifficulty) / 100;
var skillMult = (Player.hacking_chance_mult * Player.hacking_skill);
var skillMult = (2 * Player.hacking_chance_mult * Player.hacking_skill);
var skillChance = (skillMult - server.requiredHackingSkill) / skillMult;
var chance = skillChance * difficultyMult;
if (chance < 0) {return 0;}
@ -527,8 +592,8 @@ function scriptCalculateHackingChance(server) {
//The same as Player's calculateHackingTime() function but takes in the server as an argument
function scriptCalculateHackingTime(server) {
var difficultyMult = server.requiredHackingSkill * server.hackDifficulty;
var skillFactor = (difficultyMult + 1000) / (Player.hacking_skill + 50);
var hackingTime = skillFactor * Player.hacking_speed_mult; //This is in seconds
var skillFactor = (2.5 * difficultyMult + 500) / (Player.hacking_skill + 50);
var hackingTime = skillFactor * Player.hacking_speed_mult * 5; //This is in seconds
return hackingTime;
}
@ -541,8 +606,7 @@ function scriptCalculateExpGain(server) {
function scriptCalculatePercentMoneyHacked(server) {
var difficultyMult = (100 - server.hackDifficulty) / 100;
var skillMult = (Player.hacking_skill - (server.requiredHackingSkill - 1)) / Player.hacking_skill;
var percentMoneyHacked = difficultyMult * skillMult * Player.hacking_money_mult;
console.log("Percent money hacked calculated to be: " + percentMoneyHacked);
var percentMoneyHacked = difficultyMult * skillMult * Player.hacking_money_mult / 1000;
if (percentMoneyHacked < 0) {return 0;}
if (percentMoneyHacked > 1) {return 1;}
return percentMoneyHacked;

View File

@ -12,6 +12,7 @@ function WorkerScript(script) {
this.output = "";
this.ramUsage = 0;
this.scriptRef = script;
this.errorMessage = "";
}
//Returns the server on which the workerScript is running
@ -35,11 +36,7 @@ function runScriptsLoop() {
workerScripts[i].env.stopFlag = true;
continue;
}
console.log("Starting new script: " + workerScripts[i].name);
console.log("AST of new script:");
console.log(ast);
workerScripts[i].running = true;
var p = evaluate(ast, workerScripts[i]);
//Once the code finishes (either resolved or rejected, doesnt matter), set its
@ -64,9 +61,6 @@ function runScriptsLoop() {
var scriptName = errorTextArray[2];
var errorMsg = errorTextArray[3];
//Post error message to terminal
//TODO Only post this if you're on the machine the script is running on?
post("Script runtime error: " + errorMsg);
dialogBoxCreate("Script runtime error: ", "Server Ip: " + serverIp, "Script name: " + scriptName, errorMsg);
//Find the corresponding workerscript and set its flags to kill it
@ -76,10 +70,20 @@ function runScriptsLoop() {
workerScripts[i].env.stopFlag = true;
return;
}
}
}
} else if (w instanceof WorkerScript) {
if (isScriptErrorMessage(w.errorMessage)) {
var errorTextArray = w.errorMessage.split("|");
if (errorTextArray.length != 4) {
console.log("ERROR: Something wrong with Error text in evaluator...");
console.log("Error text: " + errorText);
}
var serverIp = errorTextArray[1];
var scriptName = errorTextArray[2];
var errorMsg = errorTextArray[3];
} else {
console.log("Stopping script" + w.name + " because it was manually stopped (rejected)")
dialogBoxCreate("Script runtime error: ", "Server Ip: " + serverIp, "Script name: " + scriptName, errorMsg);
}
w.running = false;
w.env.stopFlag = true;
}
@ -120,7 +124,6 @@ function runScriptsLoop() {
//all of its promises recursively, and when it does so it will no longer be running.
//The runScriptsLoop() will then delete the script from worker scripts
function killWorkerScript(scriptName, serverIp) {
console.log("killWorkerScript called for script " + scriptName + " on server " + serverIp);
for (var i = 0; i < workerScripts.length; i++) {
if (workerScripts[i].name == scriptName && workerScripts[i].serverIp == serverIp) {
workerScripts[i].env.stopFlag = true;
@ -147,7 +150,6 @@ function addWorkerScript(script, server) {
//Add the WorkerScript
workerScripts.push(s);
console.log("Pushed script onto workerScripts");
return;
}

View File

@ -14,10 +14,9 @@ function PlayerObject() {
//Intelligence, perhaps?
//Hacking multipliers
this.hacking_chance_mult = 2; //Increase through ascensions/augmentations
this.hacking_speed_mult = 5; //Decrease through ascensions/augmentations
//this.hacking_speed_mult = 1; //Make it faster for debugging
this.hacking_money_mult = .001; //Increase through ascensions/augmentations. Can't go above 1
this.hacking_chance_mult = 1; //Increase through ascensions/augmentations
this.hacking_speed_mult = 1; //Decrease through ascensions/augmentations
this.hacking_money_mult = 1; //Increase through ascensions/augmentations. Can't go above 1
//Note: "Lifetime" refers to current ascension, "total" refers to the entire game history
//Accumulative stats and skills
@ -60,8 +59,8 @@ function PlayerObject() {
this.faction_rep_mult = 1;
//Money
this.money = 0;
this.total_money = 0; //Total money ever earned
this.money = 1000;
this.total_money = 0; //Total money ever earned in this "simulation"
this.lifetime_money = 0; //Total money ever earned
//IP Address of Starting (home) computer
@ -79,6 +78,7 @@ function PlayerObject() {
this.currentServer = ""; //IP address of Server currently being accessed through terminal
this.discoveredServers = []; //IP addresses of secret servers not in the network that you have discovered
this.purchasedServers = [];
this.hacknetNodes = [];
//Factions
this.factions = []; //Names of all factions player has joined
@ -87,10 +87,26 @@ function PlayerObject() {
this.augmentations = []; //Names of all installed augmentations
this.numAugmentations = 0;
//Misc statistics
this.numPeopleKilled = 0;
this.numPeopleKilledTotal = 0;
this.numPeopleKilledLifetime = 0;
//Crime statistics (Total refers to this 'simulation'. Lifetime is forever)
this.karma = 0;
this.numTimesShoplifted = 0;
this.numTimesShopliftedTotal = 0;
this.numTimesShopliftedLifetime = 0;
this.numPeopleMugged = 0;
this.numPeopleMuggedTotal = 0;
this.numPeopleMuggedLifetime = 0;
this.numTimesDealtDrugs = 0;
this.numTimesDealtDrugsTotal = 0;
this.numTimesDealtDrugsLifetime = 0;
this.numTimesTraffickArms = 0;
this.numTimesTraffickArmsTotal = 0;
this.numTimesTraffickArmsLifetime = 0;
this.numPeopleKilled = 0;
this.numPeopleKilledTotal = 0;
this.numPeopleKilledLifetime = 0;
this.numTimesKidnapped = 0;
this.numTimesKidnappedTotal = 0;
this.numTimesKidnappedLifetime = 0;
//Achievements and achievement progress
@ -99,8 +115,10 @@ function PlayerObject() {
this.startAction = false;
this.actionTime = 0;
//Flags/variables for working (Company, Faction, and Creating Programin)
//Flags/variables for working (Company, Faction, Creating Program, Taking Class)
this.isWorking = false;
this.workType = "";
this.currentWorkFactionName = "";
this.currentWorkFactionDescription = "";
@ -112,6 +130,7 @@ function PlayerObject() {
this.workChaExpGainRate = 0;
this.workRepGainRate = 0;
this.workMoneyGainRate = 0;
this.workMoneyLossRate = 0;
this.workHackExpGained = 0;
this.workStrExpGained = 0;
@ -124,10 +143,21 @@ function PlayerObject() {
this.createProgramName = "";
this.className = "";
this.crimeType = "";
this.timeWorked = 0; //in ms
this.timeNeededToCompleteWork = 0;
this.work_money_mult = 1;
//Hacknet Node multipliers
this.hacknet_node_money_mult = 1;
this.hacknet_node_purchase_cost_mult = 1;
this.hacknet_node_ram_cost_mult = 1;
this.hacknet_node_core_cost_mult = 1;
this.hacknet_node_level_cost_mult = 1;
//Used to store the last update time.
this.lastUpdate = new Date().getTime();
@ -176,7 +206,7 @@ PlayerObject.prototype.updateSkillLevels = function() {
// (hacking_chance_multiplier * hacking_skill) 100
PlayerObject.prototype.calculateHackingChance = function() {
var difficultyMult = (100 - this.getCurrentServer().hackDifficulty) / 100;
var skillMult = (this.hacking_chance_mult * this.hacking_skill);
var skillMult = (2 * this.hacking_chance_mult * this.hacking_skill);
var skillChance = (skillMult - this.getCurrentServer().requiredHackingSkill) / skillMult;
var chance = skillChance * difficultyMult;
if (chance < 0) {return 0;}
@ -185,13 +215,13 @@ PlayerObject.prototype.calculateHackingChance = function() {
//Calculate the time it takes to hack a server in seconds. Returns the time
//The formula is:
// (requiredLevel * difficulty)
// ------------------------------- * hacking_speed_multiplier
// hacking_skill
// (2.5 * requiredLevel * difficulty + 200)
// ----------------------------------- * hacking_speed_multiplier
// hacking_skill + 100
PlayerObject.prototype.calculateHackingTime = function() {
var difficultyMult = this.getCurrentServer().requiredHackingSkill * this.getCurrentServer().hackDifficulty;
var skillFactor = (difficultyMult + 500) / (this.hacking_skill + 100);
return skillFactor * this.hacking_speed_mult;
var skillFactor = (2.5 * difficultyMult + 200) / (this.hacking_skill + 100);
return skillFactor * this.hacking_speed_mult * 5;
}
//Calculates the PERCENTAGE of a server's money that the player will hack from the server if successful
@ -202,7 +232,7 @@ PlayerObject.prototype.calculateHackingTime = function() {
PlayerObject.prototype.calculatePercentMoneyHacked = function() {
var difficultyMult = (100 - this.getCurrentServer().hackDifficulty) / 100;
var skillMult = (this.hacking_skill - (this.getCurrentServer().requiredHackingSkill - 1)) / this.hacking_skill;
var percentMoneyHacked = difficultyMult * skillMult * this.hacking_money_mult;
var percentMoneyHacked = difficultyMult * skillMult * this.hacking_money_mult / 1000;
console.log("Percent money hacked calculated to be: " + percentMoneyHacked);
if (percentMoneyHacked < 0) {return 0;}
if (percentMoneyHacked > 1) {return 1;}
@ -229,8 +259,8 @@ PlayerObject.prototype.hack = function() {
}
PlayerObject.prototype.analyze = function() {
//TODO Analyze only takes 5 seconds for now..maybe change this in the future?
this.actionTime = 5;
//TODO Analyze only takes 1 seconds for now..maybe change this in the future?
this.actionTime = 1;
this.startAction = true;
}
@ -243,6 +273,13 @@ PlayerObject.prototype.gainMoney = function(money) {
this.lifetime_money += money;
}
PlayerObject.prototype.loseMoney = function(money) {
if (isNaN(money)) {
console.log("ERR: NaN passed into Player.loseMoney()"); return;
}
this.money -= money;
}
PlayerObject.prototype.gainHackingExp = function(exp) {
if (isNaN(exp)) {
console.log("ERR: NaN passed into Player.gainHackingExp()"); return;
@ -283,6 +320,43 @@ PlayerObject.prototype.gainCharismaExp = function(exp) {
console.log("ERR: NaN passed into Player.gainCharismaExp()"); return;
}
this.charisma_exp += exp;
}
/******* Working functions *******/
PlayerObject.prototype.resetWorkStatus = function() {
this.workHackExpGainRate = 0;
this.workStrExpGainRate = 0;
this.workDefExpGainRate = 0;
this.workDexExpGainRate = 0;
this.workAgiExpGainRate = 0;
this.workChaExpGainRate = 0;
this.workRepGainRate = 0;
this.workMoneyGainRate = 0;
this.workHackExpGained = 0;
this.workStrExpGained = 0;
this.workDefExpGained = 0;
this.workDexExpGained = 0;
this.workAgiExpGained = 0;
this.workChaExpGained = 0;
this.workRepGained = 0;
this.workMoneyGained = 0;
this.timeWorked = 0;
this.currentWorkFactionName = "";
this.currentWorkFactionDescription = "";
this.createProgramName = "";
this.className = "";
}
PlayerObject.prototype.gainWorkExp = function(divMult = 1) {
this.gainHackingExp(this.workHackExpGained / divMult);
this.gainStrengthExp(this.workStrExpGained / divMult);
this.gainDefenseExp(this.workDefExpGained / divMult);
this.gainDexterityExp(this.workDexExpGained / divMult);
this.gainAgilityExp(this.workAgiExpGained / divMult);
this.gainCharismaExp(this.workChaExpGained / divMult);
}
/* Working for Company */
@ -294,12 +368,8 @@ PlayerObject.prototype.finishWork = function(cancelled) {
if (Engine.Debug) {
console.log("Player finishWork() called with " + this.workMoneyGained / cancMult + " $ gained");
}
this.gainHackingExp(this.workHackExpGained / cancMult);
this.gainStrengthExp(this.workStrExpGained / cancMult);
this.gainDefenseExp(this.workDefExpGained / cancMult);
this.gainDexterityExp(this.workDexExpGained / cancMult);
this.gainAgilityExp(this.workAgiExpGained / cancMult);
this.gainCharismaExp(this.workChaExpGained / cancMult);
this.gainWorkExp(cancMult);
var company = Companies[this.companyName];
company.playerReputation += (this.workRepGained / cancMult);
@ -313,26 +383,26 @@ PlayerObject.prototype.finishWork = function(cancelled) {
txt = "You worked a short shift of " + convertTimeMsToTimeElapsedString(this.timeWorked) + " <br><br> " +
"Since you cancelled your work early, you only gained half of the experience, money, and reputation you earned. <br><br>" +
"You earned a total of: <br>" +
"$" + (this.workMoneyGained / cancMult).toFixed(2) + "<br>" +
(this.workRepGained / cancMult).toFixed(3) + " reputation for the company <br>" +
(this.workHackExpGained / cancMult).toFixed(3) + " hacking exp <br>" +
(this.workStrExpGained / cancMult).toFixed(3) + " strength exp <br>" +
(this.workDefExpGained / cancMult).toFixed(3) + " defense exp <br>" +
(this.workDexExpGained / cancMult).toFixed(3) + " dexterity exp <br>" +
(this.workAgiExpGained / cancMult).toFixed(3) + " agility exp <br>" +
(this.workChaExpGained / cancMult).toFixed(3) + " charisma exp<br>";
"$" + formatNumber(this.workMoneyGained / cancMult, 2) + "<br>" +
formatNumber(this.workRepGained / cancMult, 4) + " reputation for the company <br>" +
formatNumber(this.workHackExpGained / cancMult, 4) + " hacking exp <br>" +
formatNumber(this.workStrExpGained / cancMult, 4) + " strength exp <br>" +
formatNumber(this.workDefExpGained / cancMult, 4) + " defense exp <br>" +
formatNumber(this.workDexExpGained / cancMult, 4) + " dexterity exp <br>" +
formatNumber(this.workAgiExpGained / cancMult, 4) + " agility exp <br>" +
formatNumber(this.workChaExpGained / cancMult, 4) + " charisma exp<br>";
} else {
txt = "You worked a full shift of 8 hours! <br><br> " +
"You earned a total of: <br>" +
"$" + (this.workMoneyGained / cancMult) + "<br>" +
(this.workRepGained / cancMult).toFixed(3) + " reputation for the company <br>" +
(this.workHackExpGained / cancMult).toFixed(3) + " hacking exp <br>" +
(this.workStrExpGained / cancMult).toFixed(3) + " strength exp <br>" +
(this.workDefExpGained / cancMult).toFixed(3) + " defense exp <br>" +
(this.workDexExpGained / cancMult).toFixed(3) + " dexterity exp <br>" +
(this.workAgiExpGained / cancMult).toFixed(3) + " agility exp <br>" +
(this.workChaExpGained / cancMult).toFixed(3) + " charisma exp <br>";
"$" + formatNumber(this.workMoneyGained / cancMult, 2) + "<br>" +
formatNumber(this.workRepGained / cancMult, 4) + " reputation for the company <br>" +
formatNumber(this.workHackExpGained / cancMult, 4) + " hacking exp <br>" +
formatNumber(this.workStrExpGained / cancMult, 4) + " strength exp <br>" +
formatNumber(this.workDefExpGained / cancMult, 4) + " defense exp <br>" +
formatNumber(this.workDexExpGained / cancMult, 4) + " dexterity exp <br>" +
formatNumber(this.workAgiExpGained / cancMult, 4) + " agility exp <br>" +
formatNumber(this.workChaExpGained / cancMult, 4) + " charisma exp <br>";
}
dialogBoxCreate(txt);
@ -345,10 +415,9 @@ PlayerObject.prototype.finishWork = function(cancelled) {
}
PlayerObject.prototype.startWork = function() {
this.resetWorkStatus();
this.isWorking = true;
this.currentWorkFactionName = "";
this.currentWorkFactionDescription = "";
this.createProgramName = "";
this.workType = CONSTANTS.WorkTypeCompany;
this.workHackExpGainRate = this.getWorkHackExpGain();
this.workStrExpGainRate = this.getWorkStrExpGain();
@ -359,16 +428,6 @@ PlayerObject.prototype.startWork = function() {
this.workRepGainRate = this.getWorkRepGain();
this.workMoneyGainRate = this.getWorkMoneyGain();
this.workHackExpGained = 0;
this.workStrExpGained = 0;
this.workDefExpGained = 0;
this.workDexExpGained = 0;
this.workAgiExpGained = 0;
this.workChaExpGained = 0;
this.workRepGained = 0;
this.workMoneyGained = 0;
this.timeWorked = 0;
this.timeNeededToCompleteWork = CONSTANTS.MillisecondsPer8Hours;
var cancelButton = document.getElementById("work-in-progress-cancel-button");
@ -421,14 +480,14 @@ PlayerObject.prototype.work = function(numCycles) {
" at " + Player.companyName + "<br><br>" +
"You have been working for " + convertTimeMsToTimeElapsedString(this.timeWorked) + "<br><br>" +
"You have earned: <br><br>" +
"$" + this.workMoneyGained + " (" + (this.workMoneyGainRate * cyclesPerSec).toFixed(2) + " / sec) <br><br>" +
this.workRepGained.toFixed(3) + " (" + (this.workRepGainRate * cyclesPerSec).toFixed(3) + " / sec) reputation for this company <br><br>" +
this.workHackExpGained.toFixed(3) + " (" + (this.workHackExpGainRate * cyclesPerSec).toFixed(3) + " / sec) hacking exp <br><br>" +
this.workStrExpGained.toFixed(3) + " (" + (this.workStrExpGainRate * cyclesPerSec).toFixed(3) + " / sec) strength exp <br>" +
this.workDefExpGained.toFixed(3) + " (" + (this.workDefExpGainRate * cyclesPerSec).toFixed(3) + " / sec) defense exp <br>" +
this.workDexExpGained.toFixed(3) + " (" + (this.workDexExpGainRate * cyclesPerSec).toFixed(3) + " / sec) dexterity exp <br>" +
this.workAgiExpGained.toFixed(3) + " (" + (this.workAgiExpGainRate * cyclesPerSec).toFixed(3) + " / sec) agility exp <br><br> " +
this.workChaExpGained.toFixed(3) + " (" + (this.workChaExpGainRate * cyclesPerSec).toFixed(3) + " / sec) charisma exp <br><br>" +
"$" + formatNumber(this.workMoneyGained, 2) + " ($" + formatNumber(this.workMoneyGainRate * cyclesPerSec, 2) + " / sec) <br><br>" +
formatNumber(this.workRepGained, 4) + " (" + formatNumber(this.workRepGainRate * cyclesPerSec, 4) + " / sec) reputation for this company <br><br>" +
formatNumber(this.workHackExpGained, 4) + " (" + formatNumber(this.workHackExpGainRate * cyclesPerSec, 4) + " / sec) hacking exp <br><br>" +
formatNumber(this.workStrExpGained, 4) + " (" + formatNumber(this.workStrExpGainRate * cyclesPerSec, 4) + " / sec) strength exp <br>" +
formatNumber(this.workDefExpGained, 4) + " (" + formatNumber(this.workDefExpGainRate * cyclesPerSec, 4) + " / sec) defense exp <br>" +
formatNumber(this.workDexExpGained, 4) + " (" + formatNumber(this.workDexExpGainRate * cyclesPerSec, 4) + " / sec) dexterity exp <br>" +
formatNumber(this.workAgiExpGained, 4) + " (" + formatNumber(this.workAgiExpGainRate * cyclesPerSec, 4) + " / sec) agility exp <br><br> " +
formatNumber(this.workChaExpGained, 4) + " (" + formatNumber(this.workChaExpGainRate * cyclesPerSec, 4) + " / sec) charisma exp <br><br>" +
"You will automatically finish after working for 8 hours. You can cancel earlier if you wish, <br>" +
@ -438,12 +497,7 @@ PlayerObject.prototype.work = function(numCycles) {
/* Working for Faction */
PlayerObject.prototype.finishFactionWork = function(cancelled, faction) {
this.gainHackingExp(this.workHackExpGained);
this.gainStrengthExp(this.workStrExpGained);
this.gainDefenseExp(this.workDefExpGained);
this.gainDexterityExp(this.workDexExpGained);
this.gainAgilityExp(this.workAgiExpGained);
this.gainCharismaExp(this.workChaExpGained);
this.gainWorkExp();
var faction = Factions[this.currentWorkFactionName];
faction.playerReputation += (this.workRepGained);
@ -454,39 +508,29 @@ PlayerObject.prototype.finishFactionWork = function(cancelled, faction) {
var txt = "You worked for your faction " + faction.name + " for a total of " + convertTimeMsToTimeElapsedString(this.timeWorked) + " <br><br> " +
"You earned a total of: <br>" +
"$" + (this.workMoneyGained).toFixed(2) + "<br>" +
(this.workRepGained).toFixed(3) + " reputation for the company <br>" +
(this.workHackExpGained).toFixed(3) + " hacking exp <br>" +
(this.workStrExpGained).toFixed(3) + " strength exp <br>" +
(this.workDefExpGained).toFixed(3) + " defense exp <br>" +
(this.workDexExpGained).toFixed(3) + " dexterity exp <br>" +
(this.workAgiExpGained).toFixed(3) + " agility exp <br>" +
(this.workChaExpGained).toFixed(3) + " charisma exp<br>";
"$" + formatNumber(this.workMoneyGained, 2) + "<br>" +
formatNumber(this.workRepGained, 4) + " reputation for the faction <br>" +
formatNumber(this.workHackExpGained, 4) + " hacking exp <br>" +
formatNumber(this.workStrExpGained, 4) + " strength exp <br>" +
formatNumber(this.workDefExpGained, 4) + " defense exp <br>" +
formatNumber(this.workDexExpGained, 4) + " dexterity exp <br>" +
formatNumber(this.workAgiExpGained, 4) + " agility exp <br>" +
formatNumber(this.workChaExpGained, 4) + " charisma exp<br>";
dialogBoxCreate(txt);
var mainMenu = document.getElementById("mainmenu-container");
mainMenu.style.visibility = "visible";
Player.isWorking = false;
this.isWorking = false;
Engine.loadTerminalContent();
}
PlayerObject.prototype.startFactionWork = function(faction) {
this.isWorking = true;
this.workType = CONSTANTS.WorkTypeFaction;
this.currentWorkFactionName = faction.name;
this.createProgramName = "";
this.workHackExpGained = 0;
this.workStrExpGained = 0;
this.workDefExpGained = 0;
this.workDexExpGained = 0;
this.workAgiExpGained = 0;
this.workChaExpGained = 0;
this.workRepGained = 0;
this.workMoneyGained = 0;
this.timeWorked = 0;
this.timeNeededToCompleteWork = CONSTANTS.MillisecondsPer20Hours;
var cancelButton = document.getElementById("work-in-progress-cancel-button");
@ -505,14 +549,10 @@ PlayerObject.prototype.startFactionWork = function(faction) {
}
PlayerObject.prototype.startFactionHackWork = function(faction) {
this.workHackExpGainRate = .1 * this.hacking_exp_mult;
this.workStrExpGainRate = 0;
this.workDefExpGainRate = 0;
this.workDexExpGainRate = 0;
this.workAgiExpGainRate = 0;
this.workChaExpGainRate = 0;
this.resetWorkStatus();
this.workHackExpGainRate = .02 * this.hacking_exp_mult;
this.workRepGainRate = this.hacking_skill / CONSTANTS.MaxSkillLevel * this.faction_rep_mult;
this.workMoneyGainRate = 0;
this.factionWorkType = CONSTANTS.FactionWorkHacking;
this.currentWorkFactionDescription = "carrying out hacking contracts";
@ -521,6 +561,8 @@ PlayerObject.prototype.startFactionHackWork = function(faction) {
}
PlayerObject.prototype.startFactionFieldWork = function(faction) {
this.resetWorkStatus();
this.workHackExpGainRate = .05 * this.hacking_exp_mult;
this.workStrExpGainRate = .05 * this.strength_exp_mult;
this.workDefExpGainRate = .05 * this.defense_exp_mult;
@ -528,7 +570,6 @@ PlayerObject.prototype.startFactionFieldWork = function(faction) {
this.workAgiExpGainRate = .05 * this.agility_exp_mult;
this.workChaExpGainRate = .05 * this.charisma_exp_mult;
this.workRepGainRate = this.getFactionFieldWorkRepGain();
this.workMoneyGainRate = 0;
this.factionWorkType = CONSTANTS.factionWorkField;
this.currentWorkFactionDescription = "carrying out field missions"
@ -537,14 +578,15 @@ PlayerObject.prototype.startFactionFieldWork = function(faction) {
}
PlayerObject.prototype.startFactionSecurityWork = function(faction) {
this.workHackExpGainRate = .1 * this.hacking_exp_mult;
this.workStrExpGainRate = 0;
this.workDefExpGainRate = 0;
this.workDexExpGainRate = 0;
this.workAgiExpGainRate = 0;
this.workChaExpGainRate = 0;
this.resetWorkStatus();
this.workHackExpGainRate = 0.01 * this.hacking_exp_mult;
this.workStrExpGainRate = 0.01 * this.strength_exp_mult;
this.workDefExpGainRate = 0.01 * this.defense_exp_mult;
this.workDexExpGainRate = 0.01 * this.dexterity_exp_mult;
this.workAgiExpGainRate = 0.01 * this.agility_exp_mult;
this.workChaExpGainRate = 0.01 * this.charisma_exp_mult;
this.workRepGainRate = this.getFactionSecurityWorkRepGain();
this.workMoneyGainRate = 0;
this.factionWorkType = CONSTANTS.FactionWorkSecurity;
this.currentWorkFactionDescription = "performing security detail"
@ -601,14 +643,14 @@ PlayerObject.prototype.workForFaction = function(numCycles) {
txt.innerHTML = "You are currently " + this.currentWorkFactionDescription + " for your faction " + faction.name + "." +
"You have been doing this for " + convertTimeMsToTimeElapsedString(this.timeWorked) + "<br><br>" +
"You have earned: <br><br>" +
"$" + this.workMoneyGained + " (" + (this.workMoneyGainRate * cyclesPerSec).toFixed(2) + " / sec) <br><br>" +
this.workRepGained.toFixed(3) + " (" + (this.workRepGainRate * cyclesPerSec).toFixed(3) + " / sec) reputation for this faction <br><br>" +
this.workHackExpGained.toFixed(3) + " (" + (this.workHackExpGainRate * cyclesPerSec).toFixed(3) + " / sec) hacking exp <br><br>" +
this.workStrExpGained.toFixed(3) + " (" + (this.workStrExpGainRate * cyclesPerSec).toFixed(3) + " / sec) strength exp <br>" +
this.workDefExpGained.toFixed(3) + " (" + (this.workDefExpGainRate * cyclesPerSec).toFixed(3) + " / sec) defense exp <br>" +
this.workDexExpGained.toFixed(3) + " (" + (this.workDexExpGainRate * cyclesPerSec).toFixed(3) + " / sec) dexterity exp <br>" +
this.workAgiExpGained.toFixed(3) + " (" + (this.workAgiExpGainRate * cyclesPerSec).toFixed(3) + " / sec) agility exp <br><br> " +
this.workChaExpGained.toFixed(3) + " (" + (this.workChaExpGainRate * cyclesPerSec).toFixed(3) + " / sec) charisma exp <br><br>" +
"$" + formatNumber(this.workMoneyGained, 2) + " (" + formatNumber(this.workMoneyGainRate * cyclesPerSec, 2) + " / sec) <br><br>" +
formatNumber(this.workRepGained, 4) + " (" + formatNumber(this.workRepGainRate * cyclesPerSec, 4) + " / sec) reputation for this faction <br><br>" +
formatNumber(this.workHackExpGained, 4) + " (" + formatNumber(this.workHackExpGainRate * cyclesPerSec, 4) + " / sec) hacking exp <br><br>" +
formatNumber(this.workStrExpGained, 4) + " (" + formatNumber(this.workStrExpGainRate * cyclesPerSec, 4) + " / sec) strength exp <br>" +
formatNumber(this.workDefExpGained, 4) + " (" + formatNumber(this.workDefExpGainRate * cyclesPerSec, 4) + " / sec) defense exp <br>" +
formatNumber(this.workDexExpGained, 4) + " (" + formatNumber(this.workDexExpGainRate * cyclesPerSec, 4) + " / sec) dexterity exp <br>" +
formatNumber(this.workAgiExpGained, 4) + " (" + formatNumber(this.workAgiExpGainRate * cyclesPerSec, 4) + " / sec) agility exp <br><br> " +
formatNumber(this.workChaExpGained, 4) + " (" + formatNumber(this.workChaExpGainRate * cyclesPerSec, 4) + " / sec) charisma exp <br><br>" +
"You will automatically finish after working for 20 hours. You can cancel earlier if you wish.<br>" +
"There is no penalty for cancelling earlier.";
@ -687,13 +729,12 @@ PlayerObject.prototype.getFactionFieldWorkRepGain = function() {
/* Creating a Program */
PlayerObject.prototype.startCreateProgramWork = function(programName, time) {
this.resetWorkStatus();
this.isWorking = true;
this.workType = CONSTANTS.WorkTypeCreateProgram;
this.timeWorked = 0;
this.timeNeededToCompleteWork = time;
this.currentWorkFactionName = "";
this.currentWorkFactionDescription = "";
this.createProgramName = programName;
var cancelButton = document.getElementById("work-in-progress-cancel-button");
@ -742,7 +783,254 @@ PlayerObject.prototype.finishCreateProgramWork = function(cancelled, programName
Engine.loadTerminalContent();
}
//Functions for saving and loading the Player data
/* Studying/Taking Classes */
PlayerObject.prototype.startClass = function(costMult, expMult, className) {
this.resetWorkStatus();
this.isWorking = true;
this.workType = CONSTANTS.WorkTypeStudyClass;
this.className = className;
var gameCPS = 1000 / Engine._idleSpeed;
//Base costs/exp (per second)
var baseDataStructuresCost = 1;
var baseNetworksCost = 5;
var baseAlgorithmsCost = 20;
var baseManagementCost = 10;
var baseLeadershipCost = 20;
var baseStudyComputerScienceExp = 0.02;
var baseDataStructuresExp = 0.1;
var baseNetworksExp = 0.4;
var baseAlgorithmsExp = 1.5;
var baseManagementExp = 0.8;
var baseLeadershipExp = 1.5;
//Find cost and exp gain per game cycle
var cost = 0;
var hackExp = 0;
var chaExp = 0;
switch (className) {
case CONSTANTS.ClassStudyComputerScience:
hackExp = baseStudyComputerScienceExp * expMult / gameCPS;
break;
case CONSTANTS.ClassDataStructures:
cost = baseDataStructuresCost * costMult / gameCPS;
hackExp = baseDataStructuresExp * expMult / gameCPS;
break;
case CONSTANTS.ClassNetworks:
cost = baseNetworksCost * costMult / gameCPS;
hackExp = baseNetworksExp * expMult / gameCPS;
break;
case CONSTANTS.ClassAlgorithms:
cost = baseAlgorithmsCost * costMult / gameCPS;
hackExp = baseAlgorithmsExp * expMult / gameCPS;
break;
case CONSTANTS.ClassManagement:
cost = baseManagementCost * costMult / gameCPS;
chaExp = baseManagementExp * expMult / gameCPS;
break;
case CONSTANTS.ClassLeadership:
cost = baseLeadershipCost * costMult / gameCPS;
chaExp = baseLeadershipExp * expMult / gameCPS;
break;
default:
throw new Error("ERR: Invalid/unregocnized class name");
return;
}
this.workMoneyLossRate = cost;
this.workHackExpGainRate = hackExp * this.hacking_exp_mult;
this.workChaExpGainRate = chaExp * this.charisma_exp_mult;
var cancelButton = document.getElementById("work-in-progress-cancel-button");
//Remove all old event listeners from Cancel button
var newCancelButton = cancelButton.cloneNode(true);
cancelButton.parentNode.replaceChild(newCancelButton, cancelButton);
newCancelButton.addEventListener("click", function() {
Player.finishClass();
return false;
});
//Display Work In Progress Screen
Engine.loadWorkInProgressContent();
}
PlayerObject.prototype.takeClass = function(numCycles) {
this.timeWorked += Engine._idleSpeed * numCycles;
var className = this.className;
this.workHackExpGained += this.workHackExpGainRate * numCycles;
this.workStrExpGained += this.workStrExpGainRate * numCycles;
this.workDefExpGained += this.workDefExpGainRate * numCycles;
this.workDexExpGained += this.workDexExpGainRate * numCycles;
this.workAgiExpGained += this.workAgiExpGainRate * numCycles;
this.workChaExpGained += this.workChaExpGainRate * numCycles;
this.workRepGained += this.workRepGainRate * numCycles;
this.workMoneyGained += this.workMoneyGainRate * numCycles;
this.workMoneyGained -= this.workMoneyLossRate * numCycles;
var cyclesPerSec = 1000 / Engine._idleSpeed;
var txt = document.getElementById("work-in-progress-text");
txt.innerHTML = "You have been " + className + " for " + convertTimeMsToTimeElapsedString(this.timeWorked) + ".<br><br>" +
"This has cost you: <br>" +
"$" + formatNumber(this.workMoneyGained, 2) + " ($" + formatNumber(this.workMoneyLossRate * cyclesPerSec, 2) + " / sec) <br><br>" +
"You have gained: <br>" +
formatNumber(this.workHackExpGained, 4) + " (" + formatNumber(this.workHackExpGainRate * cyclesPerSec, 4) + " / sec) hacking exp <br>" +
formatNumber(this.workDefExpGained, 4) + " (" + formatNumber(this.workDefExpGainRate * cyclesPerSec, 4) + " / sec) defense exp <br>" +
formatNumber(this.workStrExpGained, 4) + " (" + formatNumber(this.workStrExpGainRate * cyclesPerSec, 4) + " / sec) strength exp <br>" +
formatNumber(this.workDexExpGained, 4) + " (" + formatNumber(this.workDexExpGainRate * cyclesPerSec, 4) + " / sec) dexterity exp <br>" +
formatNumber(this.workAgiExpGained, 4) + " (" + formatNumber(this.workAgiExpGainRate * cyclesPerSec, 4) + " / sec) agility exp <br>" +
formatNumber(this.workChaExpGained, 4) + " (" + formatNumber(this.workChaExpGainRate * cyclesPerSec, 4) + " / sec) charisma exp <br>" +
"You may cancel at any time";
}
PlayerObject.prototype.finishClass = function() {
this.gainWorkExp();
if (this.workMoneyGained > 0) {
throw new Error("ERR: Somehow gained money while taking class");
}
this.loseMoney(this.workMoneyGained * -1);
this.updateSkillLevels();
var txt = "After " + this.className + " for " + convertTimeMsToTimeElapsedString(this.timeWorked) + ", <br>" +
"you spent a total of $" + formatNumber(this.workMoneyGained * -1, 2) + ". <br><br>" +
"You earned a total of: <br>" +
formatNumber(this.workHackExpGained, 4) + " hacking exp <br>" +
formatNumber(this.workStrExpGained, 4) + " strength exp <br>" +
formatNumber(this.workDefExpGained, 4) + " defense exp <br>" +
formatNumber(this.workDexExpGained, 4) + " dexterity exp <br>" +
formatNumber(this.workAgiExpGained, 4) + " agility exp <br>" +
formatNumber(this.workChaExpGained, 4) + " charisma exp<br>";
dialogBoxCreate(txt);
var mainMenu = document.getElementById("mainmenu-container");
mainMenu.style.visibility = "visible";
this.isWorking = false;
Engine.loadLocationContent();
}
//The EXP and $ gains are hardcoded. Time is in ms
PlayerObject.prototype.startCrime = function(hackExp, strExp, defExp, dexExp, agiExp, chaExp, money, time) {
this.resetWorkStatus();
this.isWorking = true;
this.workType = CONSTANTS.WorkTypeCrime;
this.workHackExpGained = hackExp * this.hacking_exp_mult;
this.workStrExpGained = strExp * this.strength_exp_mult;
this.workDefExpGained = defExp * this.defense_exp_mult;
this.workDexExpGained = dexExp * this.dexterity_exp_mult;
this.workAgiExpGained = agiExp * this.agility_exp_mult;
this.workChaExpGained = chaExp * this.charisma_exp_mult;
this.workMoneyGained = money; //TODO multiplier for this?
this.timeNeededToCompleteWork = time;
var cancelButton = document.getElementById("work-in-progress-cancel-button");
//Remove all old event listeners from Cancel button
var newCancelButton = cancelButton.cloneNode(true);
cancelButton.parentNode.replaceChild(newCancelButton, cancelButton);
newCancelButton.addEventListener("click", function() {
Player.finishCrime(true);
return false;
});
//Display Work In Progress Screen
Engine.loadWorkInProgressContent();
}
PlayerObject.prototype.commitCrime = function (numCycles) {
this.timeWorked += Engine._idleSpeed * numCycles;
if (this.timeWorked >= this.timeNeededToCompleteWork) {Player.finishCrime(false);}
var txt = document.getElementById("work-in-progress-text");
txt.innerHTML = "You are attempting to " + Player.crimeType + ".<br>" +
"Time remaining: " + convertTimeMsToTimeElapsedString(this.timeNeededToCompleteWork - this.timeWorked);
}
PlayerObject.prototype.finishCrime = function(cancelled) {
//Determine crime success/failure
if (!cancelled) {
if (determineCrimeSuccess(this.crimeType, this.workMoneyGained)) {
//Handle Karma and crime statistics
switch(this.crimeType) {
case CONSTANTS.CrimeShoplift:
this.karma -= 0.1;
++this.numTimesShoplifted;
break;
case CONSTANTS.CrimeMug:
this.karma -= 0.2;
++this.numPeopleMugged;
break;
case CONSTANTS.CrimeDrugs:
++this.numTimesDealtDrugs;
this.karma -= 0.5;
break;
case CONSTANTS.CrimeTraffickArms:
++this.numTimesTraffickArms;
this.karma -= 1;
break;
case CONSTANTS.CrimeHomicide:
++this.numPeopleKilled;
this.karma -= 3;
break;
case CONSTANTS.CrimeKidnap:
++this.numTimesKidnapped;
this.karma -= 3;
break;
default:
dialogBoxCreate("ERR: Unrecognized crime type. This is probably a bug please contact the developer");
return;
}
//On a crime success, gain 2x exp
this.workHackExpGained *= 2;
this.workStrExpGained *= 2;
this.workDefExpGained *= 2;
this.workDexExpGained *= 2;
this.workAgiExpGained *= 2;
this.workChaExpGained *= 2;
dialogBoxCreate("Crime successful! <br><br>" +
"You gained:<br>"+
"$" + this.workMoneyGained + "<br>" +
this.workHackExpGained + " hacking experience <br>" +
this.workStrExpGained + " strength experience<br>" +
this.workDefExpGained + " defense experience<br>" +
this.workDexExpGained + " dexterity experience<br>" +
this.workAgiExpGained + " agility experience<br>" +
this.workChaExpGained + " charisma experience");
} else {
dialogBoxCreate("Crime failed! <br><br>" +
"You gained:<br>"+
this.workHackExpGained + " hacking experience <br>" +
this.workStrExpGained + " strength experience<br>" +
this.workDefExpGained + " defense experience<br>" +
this.workDexExpGained + " dexterity experience<br>" +
this.workAgiExpGained + " agility experience<br>" +
this.workChaExpGained + " charisma experience");
}
}
this.gainWorkExp();
var mainMenu = document.getElementById("mainmenu-container");
mainMenu.style.visibility = "visible";
this.isWorking = false;
Engine.loadLocationContent();
}
/* Functions for saving and loading the Player data */
PlayerObject.prototype.toJSON = function() {
return Generic_toJSON("PlayerObject", this);
}

View File

@ -2,6 +2,7 @@
//Prestige by purchasing augmentation
function prestigeAugmentation() {
//Sum up lifetime/total statistics
Player.total_hacking += Player.hacking_skill;
Player.lifetime_hacking += Player.hacking_skill;
Player.total_strength += Player.strength;
@ -15,6 +16,27 @@ function prestigeAugmentation() {
Player.total_charisma += Player.charisma;
Player.lifetime_charisma += Player.charisma;
//Crime statistics
Player.numTimesShopliftedTotal += Player.numTimesShoplifted;
Player.numTimesShopliftedLifetime += Player.numTimesShoplifted;
Player.numTimesShoplifted = 0;
Player.numPeopleMuggedTotal += Player.numPeopleMugged;
Player.numPeopleMuggedLifetime += Player.numPeopleMugged;
Player.numPeopleMugged = 0;
Player.numTimesDealtDrugsTotal += Player.numTimesDealtDrugs;
Player.numTimesDealtDrugsLifetime += Player.numTimesDealtDrugs;
Player.numTimesDealtDrugs = 0;
Player.numTimesTraffickArmsTotal += Player.numTimesTraffickArms;
Player.numTimesTraffickArmsLifetime += Player.numTimesTraffickArms;
Player.numTimesTraffickArms = 0;
Player.numPeopleKilledTotal += Player.numPeopleKilled;
Player.numPeopleKilledLifetime += Player.numPeopleKilled;
Player.numPeopleKilled = 0;
Player.numTimesKidnappedTotal += Player.numTimesKidnapped;
Player.numTimesKidnappedLifetime += Player.numTimesKidnapped;
Player.numTimesKidnapped = 0;
//Reset stats
Player.hacking_skill = 1;
Player.strength = 1;
@ -53,6 +75,9 @@ function prestigeAugmentation() {
Player.isWorking = false;
Player.currentWorkFactionName = "";
Player.currentWorkFactionDescription = "";
this.createProgramName = "";
this.className = "";
this.crimeType = "";
Player.workHackExpGainRate = 0;
Player.workStrExpGainRate = 0;
@ -82,6 +107,20 @@ function prestigeAugmentation() {
}
AllServers = {};
//Delete all running scripts objects
for (var i = 0; i < workerScripts.length; ++i) {
workerScripts[i].env.stopFlag = true;
}
//Delete active scripts display elements
var list = Engine.ActiveScriptsList.querySelectorAll('#active-scripts-list li');
for (var i = list.length-1; i >= 0; --i) {
Engine.deleteActiveScriptsItem(i);
}
workerScripts.length = 0;
//Delete Hacknet Nodes
Player.hacknetNodes.length = 0;
//Delete Special Server IPs
for (var member in SpecialServerIps) {
delete SpecialServerIps[member];
@ -107,4 +146,6 @@ function prestigeAugmentation() {
initCompanies();
initFactions();
CompanyPositions.init();
Engine.loadTerminalContent();
}

59
src/SaveObject.js Normal file
View File

@ -0,0 +1,59 @@
/* SaveObject.js
* Defines the object used to save/load games
*/
var saveObject = new BitburnerSaveObject();
function BitburnerSaveObject() {
this.PlayerSave = "";
this.AllServersSave = "";
this.CompaniesSave = "";
this.FactionsSave = "";
this.SpecialServerIpsSave = "";
this.AugmentationsSave = "";
}
BitburnerSaveObject.prototype.saveGame = function() {
this.PlayerSave = JSON.stringify(Player);
this.AllServersSave = JSON.stringify(AllServers);
this.CompaniesSave = JSON.stringify(Companies);
this.FactionsSave = JSON.stringify(Factions);
this.SpecialServerIpsSave = JSON.stringify(SpecialServerIps);
this.AugmentationsSave = JSON.stringify(Augmentations);
var saveString = JSON.stringify(this);
window.localStorage.setItem("bitburnerSave", saveString);
}
loadGame = function(saveObj) {
if (!window.localStorage.getItem("bitburnerSave")) {
console.log("No save file to load");
return false;
}
var saveString = window.localStorage.getItem("bitburnerSave");
saveObj = JSON.parse(saveString, Reviver);
Player = JSON.parse(saveObj.PlayerSave, Reviver);
AllServers = JSON.parse(saveObj.AllServersSave, Reviver);
Companies = JSON.parse(saveObj.CompaniesSave, Reviver);
Factions = JSON.parse(saveObj.FactionsSave, Reviver);
SpecialServerIps = JSON.parse(saveObj.SpecialServerIpsSave, Reviver);
Augmentations = JSON.parse(saveObj.AugmentationsSave, Reviver);
return true;
}
BitburnerSaveObject.prototype.deleteGame = function() {
if (window.localStorage.getItem("bitburnerSave")) {
window.localStorage.removeItem("bitburnerSave");
}
}
BitburnerSaveObject.prototype.toJSON = function() {
return Generic_toJSON("BitburnerSaveObject", this);
}
BitburnerSaveObject.fromJSON = function(value) {
return Generic_fromJSON(BitburnerSaveObject, value.data);
}
Reviver.constructors.BitburnerSaveObject = BitburnerSaveObject;

View File

@ -2,46 +2,68 @@
* Script object
*/
//Define key commands in script editor (ctrl x to close, etc.)
//Initialize the 'save and close' button on script editor page
function scriptEditorSaveCloseInit() {
var closeButton = document.getElementById("script-editor-save-and-close-button");
closeButton.addEventListener("click", function() {
saveAndCloseScriptEditor();
return false;
});
};
document.addEventListener("DOMContentLoaded", scriptEditorSaveCloseInit, false);
//Define key commands in script editor (ctrl o to save + close, etc.)
$(document).keydown(function(e) {
if (Engine.currentPage == Engine.Page.ScriptEditor) {
//Ctrl + x
if (e.keyCode == 88 && e.ctrlKey) {
var filename = document.getElementById("script-editor-filename").value;
if (checkValidFilename(filename) == false) {
postScriptEditorStatus("Script filename can contain only alphanumerics, hyphens, and underscores");
return;
}
filename += ".script";
//If the current script matches one thats currently running, throw an error
for (var i = 0; i < Player.getCurrentServer().runningScripts.length; i++) {
if (filename == Player.getCurrentServer().runningScripts[i].filename) {
postScriptEditorStatus("Cannot write to script that is currently running!");
return;
}
}
//If the current script already exists on the server, overwrite it
for (var i = 0; i < Player.getCurrentServer().scripts.length; i++) {
if (filename == Player.getCurrentServer().scripts[i].filename) {
Player.getCurrentServer().scripts[i].saveScript();
Engine.loadTerminalContent();
return;
}
}
//If the current script does NOT exist, create a new one
var script = new Script();
script.saveScript();
Player.getCurrentServer().scripts.push(script);
Engine.loadTerminalContent();
if (e.keyCode == 66 && e.ctrlKey) {
saveAndCloseScriptEditor();
}
}
});
function saveAndCloseScriptEditor() {
var filename = document.getElementById("script-editor-filename").value;
if (filename == "") {
//If no filename...just close and do nothing
Engine.loadTerminalContent();
return;
}
if (checkValidFilename(filename) == false) {
dialogBoxCreate("Script filename can contain only alphanumerics, hyphens, and underscores");
return;
}
filename += ".script";
//If the current script matches one thats currently running, throw an error
for (var i = 0; i < Player.getCurrentServer().runningScripts.length; i++) {
if (filename == Player.getCurrentServer().runningScripts[i].filename) {
dialogBoxCreate("Cannot write to script that is currently running!");
return;
}
}
//If the current script already exists on the server, overwrite it
for (var i = 0; i < Player.getCurrentServer().scripts.length; i++) {
if (filename == Player.getCurrentServer().scripts[i].filename) {
Player.getCurrentServer().scripts[i].saveScript();
Engine.loadTerminalContent();
return;
}
}
//If the current script does NOT exist, create a new one
var script = new Script();
script.saveScript();
Player.getCurrentServer().scripts.push(script);
Engine.loadTerminalContent();
}
//Checks that the string contains only valid characters for a filename, which are alphanumeric,
// underscores and hyphens
function checkValidFilename(filename) {
@ -53,16 +75,6 @@ function checkValidFilename(filename) {
return false;
}
var ScriptEditorLastStatus = null;
function postScriptEditorStatus(text) {
document.getElementById("script-editor-status").innerHTML = text;
clearTimeout(ScriptEditorLastStatus);
ScriptEditorLastStatus = setTimeout(function() {
document.getElementById("script-editor-status").innerHTML = "";
}, 3000);
}
function Script() {
this.filename = "";
this.code = "";
@ -123,7 +135,7 @@ Script.prototype.updateNumInstructions = function() {
//Ideally, I would want it to be based on type of instructions as well
// (e.g. hack() costs a lot but others dont)
Script.prototype.updateRamUsage = function() {
this.ramUsage = this.numInstructions * .25;
this.ramUsage = this.numInstructions * 0.5;
}
Script.prototype.log = function(txt) {
@ -189,8 +201,8 @@ scriptCalculateOfflineProduction = function(script) {
//Calculate the "confidence" rating of the script's true production. This is based
//entirely off of time. We will arbitrarily say that if a script has been running for
//120 minutes (7200 sec) then we are completely confident in its ability
var confidence = (script.onlineRunningTime) / 7200;
//4 hours (14400 sec) then we are completely confident in its ability
var confidence = (script.onlineRunningTime) / 14400;
if (confidence >= 1) {confidence = 1;}
console.log("onlineRunningTime: " + script.onlineRunningTime.toString());
console.log("Confidence: " + confidence.toString());
@ -202,11 +214,15 @@ scriptCalculateOfflineProduction = function(script) {
var expGain = (1/2) * (script.onlineExpGained / script.onlineRunningTime) * timePassed;
expGain *= confidence;
//Account for production in Player and server
//Account for production in Player and server)
var server = AllServers[script.server];
if (production > server.moneyAvailable) {
production = server.moneyAvailable;
}
Player.gainMoney(production);
Player.hacking_exp += expGain;
Player.gainHackingExp(expGain);
var server = AllServers[script.server];
server.moneyAvailable -= production;
if (server.moneyAvailable < 0) {server.moneyAvailable = 0;}

View File

@ -22,7 +22,7 @@ function Server() {
this.scripts = [];
this.runningScripts = []; //Names (and only names) of scripts being run
this.programs = [];
/* Hacking information (only valid for "foreign" aka non-purchased servers) */
//Skill required to attempt a hack. Whether a hack is successful will be determined
@ -117,68 +117,68 @@ Reviver.constructors.Server = Server;
initForeignServers = function() {
//MegaCorporations
var ECorpServer = new Server();
ECorpServer.init(createRandomIp(), "ecorp", "ECorp", true, false, false, false, 256);
ECorpServer.init(createRandomIp(), "ecorp", "ECorp", true, false, false, false, 0);
ECorpServer.setHackingParameters(900, 100000000000, 99, 99);
ECorpServer.setPortProperties(5);
AddToAllServers(ECorpServer);
var MegaCorpServer = new Server();
MegaCorpServer.init(createRandomIp(), "megacorp", "MegaCorp", true, false, false, false, 256);
MegaCorpServer.init(createRandomIp(), "megacorp", "MegaCorp", true, false, false, false, 0);
MegaCorpServer.setHackingParameters(900, 80000000000, 99, 99);
MegaCorpServer.setPortProperties(5);
AddToAllServers(MegaCorpServer);
var BachmanAndAssociatesServer = new Server();
BachmanAndAssociatesServer.init(createRandomIp(), "b-and-a", "Bachman & Associates", true, false, false, false, 224);
BachmanAndAssociatesServer.init(createRandomIp(), "b-and-a", "Bachman & Associates", true, false, false, false, 0);
BachmanAndAssociatesServer.setHackingParameters(900, 32000000000, 80, 70);
BachmanAndAssociatesServer.setPortProperties(5);
AddToAllServers(BachmanAndAssociatesServer);
var BladeIndustriesServer = new Server();
BladeIndustriesServer.init(createRandomIp(), "blade", "Blade Industries", true, false, false, false, 224);
BladeIndustriesServer.init(createRandomIp(), "blade", "Blade Industries", true, false, false, false, 0);
BladeIndustriesServer.setHackingParameters(900, 20000000000, 90, 65);
BladeIndustriesServer.setPortProperties(5);
AddToAllServers(BladeIndustriesServer);
var NWOServer = new Server();
NWOServer.init(createRandomIp(), "nwo", "New World Order", true, false, false, false, 256);
NWOServer.init(createRandomIp(), "nwo", "New World Order", true, false, false, false, 0);
NWOServer.setHackingParameters(900, 40000000000, 99, 80);
NWOServer.setPortProperties(5);
AddToAllServers(NWOServer);
var ClarkeIncorporatedServer = new Server();
ClarkeIncorporatedServer.init(createRandomIp(), "clarkeinc", "Clarke Incorporated", true, false, false, false, 224);
ClarkeIncorporatedServer.init(createRandomIp(), "clarkeinc", "Clarke Incorporated", true, false, false, false, 0);
ClarkeIncorporatedServer.setHackingParameters(900, 15000000000, 50, 60);
ClarkeIncorporatedServer.setPortProperties(5);
AddToAllServers(ClarkeIncorporatedServer);
var OmniTekIncorporatedServer = new Server();
OmniTekIncorporatedServer.init(createRandomIp(), "omnitek", "OmniTek Incorporated", true, false, false, false, 512);
OmniTekIncorporatedServer.init(createRandomIp(), "omnitek", "OmniTek Incorporated", true, false, false, false, 0);
OmniTekIncorporatedServer.setHackingParameters(900, 50000000000, 95, 99);
OmniTekIncorporatedServer.setPortProperties(5);
AddToAllServers(OmniTekIncorporatedServer);
var FourSigmaServer = new Server();
FourSigmaServer.init(createRandomIp(), "4sigma", "FourSigma", true, false, false, false, 224);
FourSigmaServer.init(createRandomIp(), "4sigma", "FourSigma", true, false, false, false, 0);
FourSigmaServer.setHackingParameters(900, 25000000000, 60, 80);
FourSigmaServer.setPortProperties(5);
AddToAllServers(FourSigmaServer);
var KuaiGongInternationalServer = new Server();
KuaiGongInternationalServer.init(createRandomIp(), "kuai-gong", "KuaiGong International", true, false, false, false, 256);
KuaiGongInternationalServer.init(createRandomIp(), "kuai-gong", "KuaiGong International", true, false, false, false, 0);
KuaiGongInternationalServer.setHackingParameters(925, 75000000000, 99, 99);
KuaiGongInternationalServer.setPortProperties(5);
AddToAllServers(KuaiGongInternationalServer);
//Technology and communications companies (large targets)
var FulcrumTechnologiesServer = new Server();
FulcrumTechnologiesServer.init(createRandomIp(), "fulcrumtech", "Fulcrum Technologies", true, false, false, false, 256);
FulcrumTechnologiesServer.init(createRandomIp(), "fulcrumtech", "Fulcrum Technologies", true, false, false, false, 64);
FulcrumTechnologiesServer.setHackingParameters(900, 2000000000, 90, 85);
FulcrumTechnologiesServer.setPortProperties(5);
AddToAllServers(FulcrumTechnologiesServer);
var FulcrumSecretTechnologiesServer = new Server();
FulcrumSecretTechnologiesServer.init(createRandomIp(), "fulcrumassets", "Fulcrum Technologies Assets", true, false, false, false, 512);
FulcrumSecretTechnologiesServer.init(createRandomIp(), "fulcrumassets", "Fulcrum Technologies Assets", true, false, false, false, 0);
FulcrumSecretTechnologiesServer.setHackingParameters(999, 1000000, 99, 1);
FulcrumSecretTechnologiesServer.setPortProperties(5);
AddToAllServers(FulcrumSecretTechnologiesServer);
@ -186,209 +186,209 @@ initForeignServers = function() {
SpecialServerIps.addIp("Fulcrum Secret Technologies Server", FulcrumSecretTechnologiesServer.ip);
var StormTechnologiesServer = new Server();
StormTechnologiesServer.init(createRandomIp(), "stormtech", "Storm Technologies", true, false, false, false, 128);
StormTechnologiesServer.init(createRandomIp(), "stormtech", "Storm Technologies", true, false, false, false, 0);
StormTechnologiesServer.setHackingParameters(850, 1500000000, 85, 80);
StormTechnologiesServer.setPortProperties(5);
AddToAllServers(StormTechnologiesServer);
var DefCommServer = new Server();
DefCommServer.init(createRandomIp(), "defcomm", "DefComm", true, false, false, false, 128);
DefCommServer.init(createRandomIp(), "defcomm", "DefComm", true, false, false, false, 0);
DefCommServer.setHackingParameters(825, 900000000, 90, 60);
DefCommServer.setPortProperties(5);
AddToAllServers(DefCommServer);
var InfoCommServer = new Server();
InfoCommServer.init(createRandomIp(), "infocomm", "InfoComm", true, false, false, false, 128);
InfoCommServer.init(createRandomIp(), "infocomm", "InfoComm", true, false, false, false, 0);
InfoCommServer.setHackingParameters(830, 750000000, 80, 50);
InfoCommServer.setPortProperties(5);
AddToAllServers(InfoCommServer);
var HeliosLabsServer = new Server();
HeliosLabsServer.init(createRandomIp(), "helios", "Helios Labs", true, false, false, false, 144);
HeliosLabsServer.init(createRandomIp(), "helios", "Helios Labs", true, false, false, false, 0);
HeliosLabsServer.setHackingParameters(800, 500000000, 90, 75);
HeliosLabsServer.setPortProperties(5);
AddToAllServers(HeliosLabsServer);
var VitaLifeServer = new Server();
VitaLifeServer.init(createRandomIp(), "vitalife", "VitaLife", true, false, false, false, 112);
VitaLifeServer.init(createRandomIp(), "vitalife", "VitaLife", true, false, false, false, 32);
VitaLifeServer.setHackingParameters(775, 800000000, 85, 70);
VitaLifeServer.setPortProperties(5);
AddToAllServers(VitaLifeServer);
var IcarusMicrosystemsServer = new Server();
IcarusMicrosystemsServer.init(createRandomIp(), "icarus", "Icarus Microsystems", true, false, false, false, 128);
IcarusMicrosystemsServer.init(createRandomIp(), "icarus", "Icarus Microsystems", true, false, false, false, 0);
IcarusMicrosystemsServer.setHackingParameters(810, 1100000000, 90, 90);
IcarusMicrosystemsServer.setPortProperties(5);
AddToAllServers(IcarusMicrosystemsServer);
var UniversalEnergyServer = new Server();
UniversalEnergyServer.init(createRandomIp(), "univ-energy", "Universal Energy", true, false, false, false, 128);
UniversalEnergyServer.init(createRandomIp(), "univ-energy", "Universal Energy", true, false, false, false, 32);
UniversalEnergyServer.setHackingParameters(790, 1500000000, 85, 85);
UniversalEnergyServer.setPortProperties(4);
AddToAllServers(UniversalEnergyServer);
var TitanLabsServer = new Server();
TitanLabsServer.init(createRandomIp(), "titan-labs", "Titan Laboratories", true, false, false, false, 128);
TitanLabsServer.init(createRandomIp(), "titan-labs", "Titan Laboratories", true, false, false, false, 32);
TitanLabsServer.setHackingParameters(795, 1000000000, 75, 70);
TitanLabsServer.setPortProperties(5);
AddToAllServers(TitanLabsServer);
var MicrodyneTechnologiesServer = new Server();
MicrodyneTechnologiesServer.init(createRandomIp(), "microdyne", "Microdyne Technologies", true, false, false, false, 144);
MicrodyneTechnologiesServer.init(createRandomIp(), "microdyne", "Microdyne Technologies", true, false, false, false, 16);
MicrodyneTechnologiesServer.setHackingParameters(800, 900000000, 70, 80);
MicrodyneTechnologiesServer.setPortProperties(5);
AddToAllServers(MicrodyneTechnologiesServer);
var TaiYangDigitalServer = new Server();
TaiYangDigitalServer.init(createRandomIp(), "taiyang-digital", "Taiyang Digital", true, false, false, false, 128);
TaiYangDigitalServer.init(createRandomIp(), "taiyang-digital", "Taiyang Digital", true, false, false, false, 0);
TaiYangDigitalServer.setHackingParameters(850, 1100000000, 75, 75);
TaiYangDigitalServer.setPortProperties(5);
AddToAllServers(TaiYangDigitalServer);
var GalacticCyberSystemsServer = new Server();
GalacticCyberSystemsServer.init(createRandomIp(), "galactic-cyber", "Galactic Cybersystems", true, false, false, false, 144);
GalacticCyberSystemsServer.init(createRandomIp(), "galactic-cyber", "Galactic Cybersystems", true, false, false, false, 0);
GalacticCyberSystemsServer.setHackingParameters(825, 500000000, 60, 80);
GalacticCyberSystemsServer.setPortProperties(5);
AddToAllServers(GalacticCyberSystemsServer);
//Defense Companies ("Large" Companies)
var AeroCorpServer = new Server();
AeroCorpServer.init(createRandomIp(), "aerocorp", "AeroCorp", true, false, false, false, 160);
AeroCorpServer.init(createRandomIp(), "aerocorp", "AeroCorp", true, false, false, false, 0);
AeroCorpServer.setHackingParameters(850, 1500000000, 85, 60);
AeroCorpServer.setPortProperties(5);
AddToAllServers(AeroCorpServer);
var OmniaCybersystemsServer = new Server();
OmniaCybersystemsServer.init(createRandomIp(), "omnia", "Omnia Cybersystems", true, false, false, false, 160);
OmniaCybersystemsServer.init(createRandomIp(), "omnia", "Omnia Cybersystems", true, false, false, false, 0);
OmniaCybersystemsServer.setHackingParameters(825, 1200000000, 90, 65);
OmniaCybersystemsServer.setPortProperties(5);
AddToAllServers(OmniaCybersystemsServer);
var ZBDefenseServer = new Server();
ZBDefenseServer.init(createRandomIp(), "zb-def", "ZB Defense Industries", true, false, false, false, 144);
ZBDefenseServer.init(createRandomIp(), "zb-def", "ZB Defense Industries", true, false, false, false, 0);
ZBDefenseServer.setHackingParameters(800, 1000000000, 60, 70);
ZBDefenseServer.setPortProperties(4);
AddToAllServers(ZBDefenseServer);
var AppliedEnergeticsServer = new Server();
AppliedEnergeticsServer.init(createRandomIp(), "applied-energetics", "Applied Energetics", true, false, false, false, 144);
AppliedEnergeticsServer.init(createRandomIp(), "applied-energetics", "Applied Energetics", true, false, false, false, 0);
AppliedEnergeticsServer.setHackingParameters(775, 1200000000, 70, 72);
AppliedEnergeticsServer.setPortProperties(4);
AddToAllServers(AppliedEnergeticsServer);
var SolarisSpaceSystemsServer = new Server();
SolarisSpaceSystemsServer.init(createRandomIp(), "solaris", "Solaris Space Systems", true, false, false, false, 144);
SolarisSpaceSystemsServer.init(createRandomIp(), "solaris", "Solaris Space Systems", true, false, false, false, 0);
SolarisSpaceSystemsServer.setHackingParameters(800, 900000000, 75, 75);
SolarisSpaceSystemsServer.setPortProperties(5);
AddToAllServers(SolarisSpaceSystemsServer);
var DeltaOneServer = new Server();
DeltaOneServer.init(createRandomIp(), "deltaone", "Delta One", true, false, false, false, 144);
DeltaOneServer.init(createRandomIp(), "deltaone", "Delta One", true, false, false, false, 0);
DeltaOneServer.setHackingParameters(810, 1500000000, 80, 60);
DeltaOneServer.setPortProperties(5);
AddToAllServers(DeltaOneServer);
//Health, medicine, pharmaceutical companies ("Large" targets)
var GlobalPharmaceuticalsServer = new Server();
GlobalPharmaceuticalsServer.init(createRandomIp(), "global-pharm", "Global Pharmaceuticals", true, false, false, false, 128);
GlobalPharmaceuticalsServer.init(createRandomIp(), "global-pharm", "Global Pharmaceuticals", true, false, false, false, 16);
GlobalPharmaceuticalsServer.setHackingParameters(775, 2000000000, 80, 85);
GlobalPharmaceuticalsServer.setPortProperties(4);
AddToAllServers(GlobalPharmaceuticalsServer);
var NovaMedicalServer = new Server();
NovaMedicalServer.init(createRandomIp(), "nova-med", "Nova Medical", true, false, false, false, 144);
NovaMedicalServer.init(createRandomIp(), "nova-med", "Nova Medical", true, false, false, false, 0);
NovaMedicalServer.setHackingParameters(800, 1500000000, 70, 75);
NovaMedicalServer.setPortProperties(4);
AddToAllServers(NovaMedicalServer);
var ZeusMedicalServer = new Server();
ZeusMedicalServer.init(createRandomIp(), "zeud-med", "Zeus Medical", true, false, false, false, 160);
ZeusMedicalServer.init(createRandomIp(), "zeud-med", "Zeus Medical", true, false, false, false, 0);
ZeusMedicalServer.setHackingParameters(810, 1750000000, 80, 75);
ZeusMedicalServer.setPortProperties(5);
AddToAllServers(ZeusMedicalServer);
var UnitaLifeGroupServer = new Server();
UnitaLifeGroupServer.init(createRandomIp(), "unitalife", "UnitaLife Group", true, false, false, false, 144);
UnitaLifeGroupServer.init(createRandomIp(), "unitalife", "UnitaLife Group", true, false, false, false, 32);
UnitaLifeGroupServer.setHackingParameters(790, 1400000000, 75, 75);
UnitaLifeGroupServer.setPortProperties(4);
AddToAllServers(UnitaLifeGroupServer);
//"Medium level" targets
var LexoCorpServer = new Server();
LexoCorpServer.init(createRandomIp(), "lexo-corp", "Lexo Corporation", true, false, false, false, 128);
LexoCorpServer.init(createRandomIp(), "lexo-corp", "Lexo Corporation", true, false, false, false, 16);
LexoCorpServer.setHackingParameters(700, 1000000000, 70, 60);
LexoCorpServer.setPortProperties(4);
AddToAllServers(LexoCorpServer);
var RhoConstructionServer = new Server();
RhoConstructionServer.init(createRandomIp(), "rho-construction", "Rho Construction", true, false, false, false, 64);
RhoConstructionServer.init(createRandomIp(), "rho-construction", "Rho Construction", true, false, false, false, 0);
RhoConstructionServer.setHackingParameters(500, 750000000, 50, 50);
RhoConstructionServer.setPortProperties(3);
AddToAllServers(RhoConstructionServer);
var AlphaEnterprisesServer = new Server();
AlphaEnterprisesServer.init(createRandomIp(), "alpha-ent", "Alpha Enterprises", true, false, false, false, 96);
AlphaEnterprisesServer.init(createRandomIp(), "alpha-ent", "Alpha Enterprises", true, false, false, false, 0);
AlphaEnterprisesServer.setHackingParameters(550, 800000000, 60, 55);
AlphaEnterprisesServer.setPortProperties(4);
AddToAllServers(AlphaEnterprisesServer);
var AevumPoliceServer = new Server();
AevumPoliceServer.init(createRandomIp(), "aevum-police", "Aevum Police Network", true, false, false, false, 80);
AevumPoliceServer.init(createRandomIp(), "aevum-police", "Aevum Police Network", true, false, false, false, 0);
AevumPoliceServer.setHackingParameters(425, 100000000, 75, 40);
AevumPoliceServer.setPortProperties(4);
AddToAllServers(AevumPoliceServer);
var RothmanUniversityServer = new Server();
RothmanUniversityServer.init(createRandomIp(), "rothman-uni", "Rothman University Network", true, false, false, false, 80);
RothmanUniversityServer.init(createRandomIp(), "rothman-uni", "Rothman University Network", true, false, false, false, 4);
RothmanUniversityServer.setHackingParameters(400, 250000000, 50, 40);
RothmanUniversityServer.setPortProperties(3);
AddToAllServers(RothmanUniversityServer);
var ZBInstituteOfTechnologyServer = new Server();
ZBInstituteOfTechnologyServer.init(createRandomIp(), "zb-institute", "ZB Institute of Technology Network", true, false, false, false, 128);
ZBInstituteOfTechnologyServer.init(createRandomIp(), "zb-institute", "ZB Institute of Technology Network", true, false, false, false, 4);
ZBInstituteOfTechnologyServer.setHackingParameters(750, 1000000000, 75, 80);
ZBInstituteOfTechnologyServer.setPortProperties(5);
AddToAllServers(ZBInstituteOfTechnologyServer);
var SummitUniversityServer = new Server();
SummitUniversityServer.init(createRandomIp(), "summit-uni", "Summit University Network", true, false, false, false, 64);
SummitUniversityServer.init(createRandomIp(), "summit-uni", "Summit University Network", true, false, false, false, 4);
SummitUniversityServer.setHackingParameters(450, 200000000, 55, 50);
SummitUniversityServer.setPortProperties(3);
AddToAllServers(SummitUniversityServer);
var SysCoreSecuritiesServer = new Server();
SysCoreSecuritiesServer.init(createRandomIp(), "syscore", "SysCore Securities", true, false, false, false, 96);
SysCoreSecuritiesServer.init(createRandomIp(), "syscore", "SysCore Securities", true, false, false, false, 0);
SysCoreSecuritiesServer.setHackingParameters(600, 600000000, 70, 65);
SysCoreSecuritiesServer.setPortProperties(4);
AddToAllServers(SysCoreSecuritiesServer);
var CatalystVenturesServer = new Server();
CatalystVenturesServer.init(createRandomIp(), "catalyst", "Catalyst Ventures", true, false, false, false, 80);
CatalystVenturesServer.init(createRandomIp(), "catalyst", "Catalyst Ventures", true, false, false, false, 0);
CatalystVenturesServer.setHackingParameters(425, 900000000, 65, 40);
CatalystVenturesServer.setPortProperties(3);
AddToAllServers(CatalystVenturesServer);
var TheHubServer = new Server();
TheHubServer.init(createRandomIp(), "the-hub", "The Hub", true, false, false, false, 64);
TheHubServer.init(createRandomIp(), "the-hub", "The Hub", true, false, false, false, 0);
TheHubServer.setHackingParameters(300, 250000000, 40, 50);
TheHubServer.setPortProperties(2);
AddToAllServers(TheHubServer);
var CompuTekServer = new Server();
CompuTekServer.init(createRandomIp(), "comptek", "CompuTek", true, false, false, false, 96);
CompuTekServer.init(createRandomIp(), "comptek", "CompuTek", true, false, false, false, 8);
CompuTekServer.setHackingParameters(350, 300000000, 60, 55);
CompuTekServer.setPortProperties(3);
AddToAllServers(CompuTekServer);
var NetLinkTechnologiesServer = new Server();
NetLinkTechnologiesServer.init(createRandomIp(), "netlink", "NetLink Technologies", true, false, false, false, 96);
NetLinkTechnologiesServer.init(createRandomIp(), "netlink", "NetLink Technologies", true, false, false, false, 0);
NetLinkTechnologiesServer.setHackingParameters(400, 350000000, 70, 60);
NetLinkTechnologiesServer.setPortProperties(3);
AddToAllServers(NetLinkTechnologiesServer);
var JohnsonOrthopedicsServer = new Server();
JohnsonOrthopedicsServer.init(createRandomIp(), "johnson-ortho", "Johnson Orthopedics", true, false, false, false, 64);
JohnsonOrthopedicsServer.init(createRandomIp(), "johnson-ortho", "Johnson Orthopedics", true, false, false, false, 4);
JohnsonOrthopedicsServer.setHackingParameters(275, 100000000, 50, 50);
JohnsonOrthopedicsServer.setPortProperties(2);
AddToAllServers(JohnsonOrthopedicsServer);
@ -401,120 +401,120 @@ initForeignServers = function() {
AddToAllServers(FoodNStuffServer);
var SigmaCosmeticsServer = new Server();
SigmaCosmeticsServer.init(createRandomIp(), "sigma-cosmetics", "Sigma Cosmetics", true, false, false, false, 8);
SigmaCosmeticsServer.setHackingParameters(5, 500000, 5, 10);
SigmaCosmeticsServer.init(createRandomIp(), "sigma-cosmetics", "Sigma Cosmetics", true, false, false, false, 0);
SigmaCosmeticsServer.setHackingParameters(5, 500000, 10, 10);
SigmaCosmeticsServer.setPortProperties(0);
AddToAllServers(SigmaCosmeticsServer);
var JoesGunsServer = new Server();
JoesGunsServer.init(createRandomIp(), "joesguns", "Joe's Guns", true, false, false, false, 8);
JoesGunsServer.init(createRandomIp(), "joesguns", "Joe's Guns", true, false, false, false, 2);
JoesGunsServer.setHackingParameters(10, 200000, 20, 25);
JoesGunsServer.setPortProperties(0);
AddToAllServers(JoesGunsServer);
var Zer0NightclubServer = new Server();
Zer0NightclubServer.init(createRandomIp(), "zer0", "ZER0 Nightclub", true, false, false, false, 16);
Zer0NightclubServer.setHackingParameters(50, 750000, 25, 40);
Zer0NightclubServer.init(createRandomIp(), "zer0", "ZER0 Nightclub", true, false, false, false, 2);
Zer0NightclubServer.setHackingParameters(75, 750000, 25, 40);
Zer0NightclubServer.setPortProperties(1);
AddToAllServers(Zer0NightclubServer);
var NectarNightclubServer = new Server();
NectarNightclubServer.init(createRandomIp(), "nectar-net", "Nectar Nightclub Network", true, false, false, false, 8);
NectarNightclubServer.setHackingParameters(25, 400000, 20, 25);
NectarNightclubServer.init(createRandomIp(), "nectar-net", "Nectar Nightclub Network", true, false, false, false, 2);
NectarNightclubServer.setHackingParameters(20, 400000, 20, 25);
NectarNightclubServer.setPortProperties(0);
AddToAllServers(NectarNightclubServer);
var NeoNightclubServer = new Server();
NeoNightclubServer.init(createRandomIp(), "neo-net", "Neo Nightclub Network", true, false, false, false, 16);
NeoNightclubServer.setHackingParameters(75, 500000, 25, 25);
NeoNightclubServer.init(createRandomIp(), "neo-net", "Neo Nightclub Network", true, false, false, false, 2);
NeoNightclubServer.setHackingParameters(50, 500000, 25, 25);
NeoNightclubServer.setPortProperties(1);
AddToAllServers(NeoNightclubServer);
var SilverHelixServer = new Server();
SilverHelixServer.init(createRandomIp(), "silver-helix", "Silver Helix", true, false, false, false, 8);
SilverHelixServer.init(createRandomIp(), "silver-helix", "Silver Helix", true, false, false, false, 2);
SilverHelixServer.setHackingParameters(150, 1000000, 30, 30);
SilverHelixServer.setPortProperties(2);
AddToAllServers(SilverHelixServer);
var HongFangTeaHouseServer = new Server();
HongFangTeaHouseServer.init(createRandomIp(), "hong-fang-tea", "HongFang Teahouse", true, false, false, false, 8);
HongFangTeaHouseServer.setHackingParameters(60, 250000, 15, 10);
HongFangTeaHouseServer.setPortProperties(1);
HongFangTeaHouseServer.init(createRandomIp(), "hong-fang-tea", "HongFang Teahouse", true, false, false, false, 0);
HongFangTeaHouseServer.setHackingParameters(30, 250000, 15, 10);
HongFangTeaHouseServer.setPortProperties(0);
AddToAllServers(HongFangTeaHouseServer);
var HaraKiriSushiBarServer = new Server();
HaraKiriSushiBarServer.setHackingParameters(50, 100000, 15, 40);
HaraKiriSushiBarServer.init(createRandomIp(), "harakiri-sushi", "HaraKiri Sushi Bar Network", true, false, false, false, 4);
HaraKiriSushiBarServer.setHackingParameters(40, 100000, 15, 40);
HaraKiriSushiBarServer.init(createRandomIp(), "harakiri-sushi", "HaraKiri Sushi Bar Network", true, false, false, false, 0);
HaraKiriSushiBarServer.setPortProperties(1);
AddToAllServers(HaraKiriSushiBarServer);
var PhantasyServer = new Server();
PhantasyServer.init(createRandomIp(), "phantasy", "Phantasy Club", true, false, false, false, 8);
PhantasyServer.init(createRandomIp(), "phantasy", "Phantasy Club", true, false, false, false, 4);
PhantasyServer.setHackingParameters(100, 300000, 20, 35);
PhantasyServer.setPortProperties(2);
AddToAllServers(PhantasyServer);
var MaxHardwareServer = new Server();
MaxHardwareServer.init(createRandomIp(), "max-hardware", "Max Hardware Store", true, false, false, false, 8);
MaxHardwareServer.init(createRandomIp(), "max-hardware", "Max Hardware Store", true, false, false, false, 0);
MaxHardwareServer.setHackingParameters(80, 150000, 15, 25);
MaxHardwareServer.setPortProperties(1);
AddToAllServers(MaxHardwareServer);
var OmegaSoftwareServer = new Server();
OmegaSoftwareServer.init(createRandomIp(), "omega-net", "Omega Software", true, false, false, false, 32);
OmegaSoftwareServer.init(createRandomIp(), "omega-net", "Omega Software", true, false, false, false, 8);
OmegaSoftwareServer.setHackingParameters(200, 1000000, 30, 30);
OmegaSoftwareServer.setPortProperties(2);
AddToAllServers(OmegaSoftwareServer);
//Gyms
var CrushFitnessGymServer = new Server();
CrushFitnessGymServer.init(createRandomIp(), "crush-fitness", "Crush Fitness", true, false, false, false, 4);
CrushFitnessGymServer.init(createRandomIp(), "crush-fitness", "Crush Fitness", true, false, false, false, 0);
CrushFitnessGymServer.setHackingParameters(250, 300000, 40, 25);
CrushFitnessGymServer.setPortProperties(2);
AddToAllServers(CrushFitnessGymServer);
var IronGymServer = new Server();
IronGymServer.init(createRandomIp(), "iron-gym", "Iron Gym Network", true, false, false, false, 4);
IronGymServer.init(createRandomIp(), "iron-gym", "Iron Gym Network", true, false, false, false, 0);
IronGymServer.setHackingParameters(100, 150000, 30, 15);
IronGymServer.setPortProperties(1);
AddToAllServers(IronGymServer);
var MilleniumFitnessGymServer = new Server();
MilleniumFitnessGymServer.init(createRandomIp(), "millenium-fitness", "Millenium Fitness Network", true, false, false, false, 8);
MilleniumFitnessGymServer.init(createRandomIp(), "millenium-fitness", "Millenium Fitness Network", true, false, false, false, 0);
MilleniumFitnessGymServer.setHackingParameters(500, 400000, 50, 30);
MilleniumFitnessGymServer.setPortProperties(3);
AddToAllServers(MilleniumFitnessGymServer);
var PowerhouseGymServer = new Server();
PowerhouseGymServer.init(createRandomIp(), "powerhouse-fitness", "Powerhouse Fitness", true, false, false, false, 8);
PowerhouseGymServer.init(createRandomIp(), "powerhouse-fitness", "Powerhouse Fitness", true, false, false, false, 0);
PowerhouseGymServer.setHackingParameters(1000, 1000000, 60, 50);
PowerhouseGymServer.setPortProperties(5);
AddToAllServers(PowerhouseGymServer);
var SnapFitnessGymServer = new Server();
SnapFitnessGymServer.init(createRandomIp(), "snap-fitness", "Snap Fitness", true, false, false, false, 8);
SnapFitnessGymServer.init(createRandomIp(), "snap-fitness", "Snap Fitness", true, false, false, false, 0);
SnapFitnessGymServer.setHackingParameters(750, 750000, 50, 45);
SnapFitnessGymServer.setPortProperties(4);
AddToAllServers(SnapFitnessGymServer);
//Faction servers, cannot hack money from these
var BitRunnersServer = new Server();
BitRunnersServer.init(createRandomIp(), "run4theh111z", "The Runners", true, false, false, false, 1);
BitRunnersServer.init(createRandomIp(), "run4theh111z", "The Runners", true, false, false, false, 0);
BitRunnersServer.setPortProperties(4);
AddToAllServers(BitRunnersServer);
var NiteSecServer = new Server();
NiteSecServer.init(createRandomIp(), "avmnite-02h", "NiteSec", true, false, false, false, 1);
NiteSecServer.init(createRandomIp(), "avmnite-02h", "NiteSec", true, false, false, false, 0);
NiteSecServer.setPortProperties(2);
AddToAllServers(NiteSecServer);
var DarkArmyServer = new Server();
DarkArmyServer.init(createRandomIp(), ".", ".", true, false, false, false, 1);
DarkArmyServer.init(createRandomIp(), ".", ".", true, false, false, false, 0);
DarkArmyServer.setPortProperties(5);
AddToAllServers(DarkArmyServer);
var CyberSecServer = new Server();
CyberSecServer.init(createRandomIp(), "CSEC", "CyberSec", true, false, false, false, 1);
CyberSecServer.init(createRandomIp(), "CSEC", "CyberSec", true, false, false, false, 0);
CyberSecServer.setPortProperties(2);
AddToAllServers(CyberSecServer);
@ -626,11 +626,12 @@ initForeignServers = function() {
Player.getHomeComputer().serversOnNetwork.push(NetworkGroup1[i].ip);
NetworkGroup1[i].serversOnNetwork.push(Player.homeComputer);
}
},
}
//Server growth
processServerGrowth = function(numCycles) {
//Server growth processed once every 450 game cycles
var numServerGrowthCycles = Math.max(Math.floor(numCycles / 450), 0);
for (var ip in AllServers) {
@ -643,13 +644,30 @@ processServerGrowth = function(numCycles) {
var numServerGrowthCyclesAdjusted = numServerGrowthCycles * serverGrowthPercentage;
//Apply serverGrowth for the calculated number of growth cycles
var serverGrowth = Math.pow(1.0004, numServerGrowthCyclesAdjusted);
var serverGrowth = Math.pow(CONSTANTS.ServerGrowthRate, numServerGrowthCyclesAdjusted);
//console.log("serverGrowth ratio: " + serverGrowth);
server.moneyAvailable *= serverGrowth;
}
}
console.log("Server growth processed for " + numServerGrowthCycles + " cycles");
},
}
//Applied server growth for a single server. Returns the percentage growth
processSingleServerGrowth = function(server, numCycles) {
//Server growth processed once every 450 game cycles
var numServerGrowthCycles = Math.max(Math.floor(numCycles / 450), 0);
//Get the number of server growth cycles that will be applied based on the
//server's serverGrowth property
var serverGrowthPercentage = server.serverGrowth / 100;
var numServerGrowthCyclesAdjusted = numServerGrowthCycles * serverGrowthPercentage;
//Apply serverGrowth for the calculated number of growth cycles
var serverGrowth = Math.pow(CONSTANTS.ServerGrowthRate, numServerGrowthCyclesAdjusted);
server.moneyAvailable *= serverGrowth;
return serverGrowth;
}
//List of all servers that exist in the game, indexed by their ip
AllServers = {};

View File

@ -1,4 +1,7 @@
/* Functions to handle Purchase of Servers */
/* Functions to handle any server-related purchasing:
* Purchasing new servers
* Purchasing more RAM for home computer
*/
purchaseServer = function(ram, cost) {
//Check if player has enough money
if (cost > Player.money) {
@ -25,7 +28,22 @@ purchaseServer = function(ram, cost) {
homeComputer.serversOnNetwork.push(newServ.ip);
newServ.serversOnNetwork.push(homeComputer.ip);
Player.money -= cost;
Player.loseMoney(cost);
dialogBoxCreate("Server successfully purchased with hostname " + hostname);
}
purchaseRamForHomeComputer = function(cost) {
if (cost > Player.money) {
dialogBoxCreate("You do not have enough money to purchase additional RAM for your home computer");
return;
}
var homeComputer = Player.getHomeComputer();
homeComputer.maxRam *= 2;
Player.loseMoney(cost);
dialogBoxCreate("Purchased additional RAM for home computer! It now has " + homeComputer.maxRam + "GB of RAM.");
}

View File

@ -17,19 +17,23 @@ var hackProgressPost = function(input) {
updateTerminalScroll();
}
//Scroll to the bottom of the terminal's 'text area'
function updateTerminalScroll() {
var element = document.getElementById("terminal-container");
element.scrollTop = element.scrollHeight;
}
var postNetburnerText = function() {
post("Netburner v0.1");
post("Bitburner v" + CONSTANTS.Version);
}
//Defines key commands in terminal
$(document).keyup(function(event) {
$(document).keydown(function(event) {
//Terminal
if (Engine.currentPage == Engine.Page.Terminal) {
var terminalInput = document.getElementById("terminal-input-text-box");
if (terminalInput != null && !event.ctrlKey && !event.shiftKey) {terminalInput.focus();}
//Enter
if (event.keyCode == 13) {
var command = $('input[class=terminal-input]').val();
@ -48,6 +52,69 @@ $(document).keyup(function(event) {
Engine._actionInProgress = false;
Terminal.finishAction(true);
}
//Up key to cycle through past commands
if (event.keyCode == 38) {
if (terminalInput == null) {return;}
var i = Terminal.commandHistoryIndex;
var len = Terminal.commandHistory.length;
if (len == 0) {return;}
if (i < 0 || i > len) {
Terminal.commandHistoryIndex = len;
}
if (i != 0) {
--Terminal.commandHistoryIndex;
}
var prevCommand = Terminal.commandHistory[Terminal.commandHistoryIndex];
terminalInput.value = prevCommand;
setTimeout(function(){terminalInput.selectionStart = terminalInput.selectionEnd = 10000; }, 0);
}
//Down key
if (event.keyCode == 40) {
if (terminalInput == null) {return;}
var i = Terminal.commandHistoryIndex;
var len = Terminal.commandHistory.length;
if (len == 0) {return;}
if (i < 0 || i > len) {
Terminal.commandHistoryIndex = len;
}
//Latest command, put nothing
if (i == len || i == len-1) {
Terminal.commandHistoryIndex = len;
terminalInput.value = "";
} else {
++Terminal.commandHistoryIndex;
var prevCommand = Terminal.commandHistory[Terminal.commandHistoryIndex];
terminalInput.value = prevCommand;
}
}
//Tab (autocomplete)
if (event.keyCode == 9) {
if (terminalInput == null) {return;}
var input = terminalInput.value;
if (input == "") {return;}
input = input.trim();
input = input.replace(/\s\s+/g, ' ');
var allPos = determineAllPossibilitiesForTabCompletion(input);
if (allPos.length == 0) {return;}
var commandArray = input.split(" ");
var arg = "";
if (commandArray.length == 0) {return;}
else if (commandArray.length > 1) {
arg = commandArray[1];
}
tabCompletion(commandArray[0], arg, allPos);
}
}
});
@ -65,7 +132,11 @@ $(document).keydown(function(e) {
} else if (terminalCtrlPressed == true) {
//Don't focus
} else {
$('.terminal-input').focus();
var inputTextBox = document.getElementById("terminal-input-text-box");
if (inputTextBox != null) {
inputTextBox.focus();
}
terminalCtrlPressed = false;
}
}
@ -78,11 +149,95 @@ $(document).keyup(function(e) {
}
})
//Implements a tab completion feature for terminal
// command - Command (first arg only)
// arg - Incomplete argument string that the function will try to complete, or will display
// a series of possible options for
// allPossibilities - Array of strings containing all possibilities that the
// string can complete to
function tabCompletion(command, arg, allPossibilities) {
if (!(allPossibilities.constructor === Array)) {return;}
if (!containsAllStrings(allPossibilities)) {return;}
for (var i = allPossibilities.length-1; i >= 0; --i) {
if (!allPossibilities[i].startsWith(arg)) {
allPossibilities.splice(i, 1);
}
}
if (allPossibilities.length == 0) {
return;
} else if (allPossibilities.length == 1) {
document.getElementById("terminal-input-text-box").value = command + " " + allPossibilities[0];
document.getElementById("terminal-input-text-box").focus();
} else {
var longestStartSubstr = longestCommonStart(allPossibilities);
//If the longest common starting substring of remaining possibilities is the same
//as whatevers already in terminal, just list all possible options. Otherwise,
//change the input in the terminal to the longest common starting substr
if (longestStartSubstr == arg) {
//List all possible options
var allOptionsStr = "";
for (var i = 0; i < allPossibilities.length; ++i) {
allOptionsStr += allPossibilities[i];
allOptionsStr += " ";
}
post("> " + command + " " + arg);
post(allOptionsStr);
} else {
document.getElementById("terminal-input-text-box").value = command + " " + longestStartSubstr;
document.getElementById("terminal-input-text-box").focus();
}
}
}
function determineAllPossibilitiesForTabCompletion(input) {
var allPos = [];
var currServ = Player.getCurrentServer();
if (input.startsWith("connect ") || input.startsWith("telnet ")) {
//All network connections
for (var i = 0; i < currServ.serversOnNetwork.length; ++i) {
var serv = AllServers[currServ.serversOnNetwork[i]];
if (serv == null) {continue;}
allPos.push(serv.ip); //IP
allPos.push(serv.hostname); //Hostname
}
return allPos;
}
if (input.startsWith("kill ") || input.startsWith("nano ") ||
input.startsWith("tail ") || input.startsWith("rm ")) {
//All Scripts
for (var i = 0; i < currServ.scripts.length; ++i) {
allPos.push(currServ.scripts[i].filename);
}
return allPos;
}
if (input.startsWith("run ")) {
//All programs and scripts
for (var i = 0; i < currServ.scripts.length; ++i) {
allPos.push(currServ.scripts[i].filename);
}
//Programs are on home computer
var homeComputer = Player.getHomeComputer();
for(var i = 0; i < homeComputer.programs.length; ++i) {
allPos.push(homeComputer.programs[i]);
}
return allPos;
}
return allPos;
}
var Terminal = {
//Flags to determine whether the player is currently running a hack or an analyze
hackFlag: false,
analyzeFlag: false,
commandHistory: [],
commandHistoryIndex: 0,
finishAction: function(cancelled = false) {
if (Terminal.hackFlag) {
Terminal.finishHack(cancelled);
@ -125,7 +280,7 @@ var Terminal = {
//Rename the progress bar so that the next hacks dont trigger it. Re-enable terminal
$("#hack-progress-bar").attr('id', "old-hack-progress-bar");
$("#hack-progress").attr('id', "old-hack-progress");
document.getElementById("terminal-input-td").innerHTML = '$ <input type="text" class="terminal-input"/>';
document.getElementById("terminal-input-td").innerHTML = '$ <input type="text" id="terminal-input-text-box" class="terminal-input" tabindex="1"/>';
$('input[class=terminal-input]').prop('disabled', false);
Terminal.hackFlag = false;
@ -176,11 +331,21 @@ var Terminal = {
//Rename the progress bar so that the next hacks dont trigger it. Re-enable terminal
$("#hack-progress-bar").attr('id', "old-hack-progress-bar");
$("#hack-progress").attr('id', "old-hack-progress");
document.getElementById("terminal-input-td").innerHTML = '$ <input type="text" class="terminal-input"/>';
document.getElementById("terminal-input-td").innerHTML = '$ <input type="text" id="terminal-input-text-box" class="terminal-input" tabindex="1"/>';
$('input[class=terminal-input]').prop('disabled', false);
},
executeCommand: function(command) {
command = command.trim();
//Replace all extra whitespace in command with a single space
command = command.replace(/\s\s+/g, ' ');
Terminal.commandHistory.push(command);
if (Terminal.commandHistory.length > 50) {
Terminal.commandHistory.splice(0, 1);
}
Terminal.commandHistoryIndex = Terminal.commandHistory.length;
var commandArray = command.split(" ");
if (commandArray.length == 0) {
@ -272,7 +437,13 @@ var Terminal = {
post(CONSTANTS.HelpText);
break;
case "home":
//TODO return to home computer
if (commandArray.length != 1) {
post("Incorrect usage of home command. Usage: home"); return;
}
Player.getCurrentServer().isConnectedTo = false;
Player.currentServer = Player.getHomeComputer().ip;
Player.getCurrentServer().isConnectedTo = true;
post("Connected to home");
break;
case "hostname":
if (commandArray.length != 1) {
@ -297,7 +468,7 @@ var Terminal = {
for (var i = 0; i < Player.getCurrentServer().runningScripts.length; i++) {
if (Player.getCurrentServer().runningScripts[i] == scriptName) {
killWorkerScript(scriptName, Player.getCurrentServer().ip);
post("Killing " + scriptName + ". May take a few seconds");
post("Killing " + scriptName + ". May take up to a few minutes for the scripts to die...");
return;
}
}
@ -470,6 +641,7 @@ var Terminal = {
break;
case "top":
//TODO List each's script RAM usage
post("Not yet implemented");
break;
default:
post("Command not found");
@ -508,9 +680,7 @@ var Terminal = {
}
break;
case Programs.BruteSSHProgram:
if (s.hasAdminRights == false) {
post("Permission denied. You do not have root access to this computer.");
} else if (s.sshPortOpen) {
if (s.sshPortOpen) {
post("SSH Port (22) is already open!");
} else {
s.sshPortOpen = true;
@ -519,9 +689,7 @@ var Terminal = {
}
break;
case Programs.FTPCrackProgram:
if (s.hasAdminRights == false) {
post("Permission denied. You do not have root access to this computer.");
} else if (s.ftpPortOpen) {
if (s.ftpPortOpen) {
post("FTP Port (21) is already open!");
} else {
s.ftpPortOpen = true;
@ -530,9 +698,7 @@ var Terminal = {
}
break;
case Programs.RelaySMTPProgram:
if (s.hasAdminRights == false) {
post("Permission denied. You do not have root access to this computer.");
} else if (s.smtpPortOpen) {
if (s.smtpPortOpen) {
post("SMTP Port (25) is already open!");
} else {
s.smtpPortOpen = true;
@ -541,9 +707,7 @@ var Terminal = {
}
break;
case Programs.HTTPWormProgram:
if (s.hasAdminRights == false) {
post("permission denied. You do not have root access to this computer.");
} else if (s.httpPortOpen) {
if (s.httpPortOpen) {
post("HTTP Port (80) is already open!");
} else {
s.httpPortOpen = true;
@ -552,9 +716,7 @@ var Terminal = {
}
break;
case Programs.SQLInjectProgram:
if (s.hasAdminRights == false) {
post("permission denied. You do not have root access to this computer.");
} else if (s.sqlPortOpen) {
if (s.sqlPortOpen) {
post("SQL Port (1433) is already open!");
} else {
s.sqlPortOpen = true;
@ -604,6 +766,7 @@ var Terminal = {
post("ERROR: No such script");
}
};

View File

@ -1,6 +1,6 @@
var Engine = {
Debug: true,
//Clickable objects
Clickables: {
//Main menu buttons
@ -8,6 +8,7 @@ var Engine = {
characterMainMenuButton: null,
scriptEditorMainMenuButton: null,
activeScriptsMainMenuButton: null,
hacknetNodesMainMenuButton: null,
worldMainMenuButton: null,
createProgramMainMenuButton: null,
factionsMainMenuButton: null,
@ -43,6 +44,7 @@ var Engine = {
characterContent: null,
scriptEditorContent: null,
activeScriptsContent: null,
hacknetNodesContent: null,
worldContent: null,
createProgramContent: null,
factionsContent: null,
@ -66,6 +68,7 @@ var Engine = {
CharacterInfo: "CharacterInfo",
ScriptEditor: "ScriptEditor",
ActiveScripts: "ActiveScripts",
HacknetNodes: "HacknetNodes",
World: "World",
CreateProgram: "CreateProgram",
Factions: "Factions",
@ -82,92 +85,6 @@ var Engine = {
_lastUpdate: new Date().getTime(),
_idleSpeed: 200, //Speed (in ms) at which the main loop is updated
//Save function
saveGame: function() {
var PlayerSave = JSON.stringify(Player);
var AllServersSave = JSON.stringify(AllServers);
var CompaniesSave = JSON.stringify(Companies);
var FactionsSave = JSON.stringify(Factions);
var SpecialServerIpsSave = JSON.stringify(SpecialServerIps);
var AugmentationsSave = JSON.stringify(Augmentations);
window.localStorage.setItem("netburnerPlayerSave", PlayerSave);
window.localStorage.setItem("netburnerAllServersSave", AllServersSave);
window.localStorage.setItem("netburnerCompaniesSave", CompaniesSave);
window.localStorage.setItem("netburnerFactionsSave", FactionsSave);
window.localStorage.setItem("netburnerSpecialServerIpsSave", SpecialServerIpsSave);
window.localStorage.setItem("netburnerAugmentationsSave", AugmentationsSave);
console.log("Game saved to local storage");
},
//Load saved game function
loadSave: function() {
//Check to see if file exists
if (!window.localStorage.getItem("netburnerPlayerSave")) {
console.log("No Player save to load");
return false;
} else if (!window.localStorage.getItem("netburnerAllServersSave")) {
console.log("No AllServers save to load");
return false;
} else if (!window.localStorage.getItem("netburnerCompaniesSave")) {
console.log("No Companies save to load");
return false;
} else if (!window.localStorage.getItem("netburnerFactionsSave")) {
console.log("No Factions save to load");
return false;
} else if (!window.localStorage.getItem("netburnerSpecialServerIpsSave")) {
console.log("No Special Server Ips save to load");
return false;
} else if (!window.localStorage.getItem("netburnerAugmentationsSave")) {
console.log("No Augmentations save to load");
return false;
} else {
var PlayerSave = window.localStorage.getItem("netburnerPlayerSave");
var AllServersSave = window.localStorage.getItem("netburnerAllServersSave");
var CompaniesSave = window.localStorage.getItem("netburnerCompaniesSave");
var FactionsSave = window.localStorage.getItem("netburnerFactionsSave");
var SpecialServerIpsSave = window.localStorage.getItem("netburnerSpecialServerIpsSave");
var AugmentationsSave = window.localStorage.getItem("netburnerAugmentationsSave");
Player = JSON.parse(PlayerSave, Reviver);
AllServers = JSON.parse(AllServersSave, Reviver);
Companies = JSON.parse(CompaniesSave, Reviver);
Factions = JSON.parse(FactionsSave, Reviver);
SpecialServerIps = JSON.parse(SpecialServerIpsSave, Reviver);
Augmentations = JSON.parse(AugmentationsSave, Reviver);
return true;
}
},
//Delete saved game function
deleteSave: function() {
//TODO if a save doesn't exist..maybe I shouldn't return? I just keep going
//or else nothing gets deleted. TODO Fix this
if (window.localStorage.getItem("netburnerPlayerSave")) {
window.localStorage.removeItem("netburnerPlayerSave");
}
if (window.localStorage.getItem("netburnerAllServersSave")) {
window.localStorage.removeItem("netburnerAllServersSave");
}
if (window.localStorage.getItem("netburnerCompaniesSave")) {
window.localStorage.removeItem("netburnerCompaniesSave");
}
if (window.localStorage.getItem("netburnerFactionsSave")) {
window.localStorage.removeItem("netburnerFactionsSave");
}
if (window.localStorage.getItem("netburnerSpecialServerIpsSave")) {
window.localStorage.removeItem("netburnerSpecialServerIpsSave");
}
if (window.localStorage.getItem("netburnerAugmentationsSave")) {
window.localStorage.removeItem("netburnerAugmentationsSave");
}
},
/* Load content when a main menu button is clicked */
loadTerminalContent: function() {
@ -202,6 +119,14 @@ var Engine = {
Engine.currentPage = Engine.Page.ActiveScripts;
},
loadHacknetNodesContent: function() {
Engine.hideAllContent();
Engine.Display.hacknetNodesContent.style.visibility = "visible";
displayHacknetNodesContent();
Engine.currentPage = Engine.Page.HacknetNodes;
},
loadWorldContent: function() {
Engine.hideAllContent();
Engine.Display.worldContent.style.visibility = "visible";
@ -274,6 +199,7 @@ var Engine = {
Engine.Display.characterContent.style.visibility = "hidden";
Engine.Display.scriptEditorContent.style.visibility = "hidden";
Engine.Display.activeScriptsContent.style.visibility = "hidden";
Engine.Display.hacknetNodesContent.style.visibility = "hidden";
Engine.Display.worldContent.style.visibility = "hidden";
Engine.Display.createProgramContent.style.visibility = "hidden";
Engine.Display.factionsContent.style.visibility = "hidden";
@ -299,23 +225,53 @@ var Engine = {
if (Player.companyPosition != "") {
companyPosition = Player.companyPosition.positionName;
}
Engine.Display.characterInfo.innerHTML = 'Current City: ' + Player.city + '<br><br>' +
'Employer: ' + Player.companyName + '<br><br>' +
'Job Title: ' + companyPosition + '<br><br><br><br>' +
'Money: $' + (Player.money.toFixed(2)).toLocaleString() + '<br><br>' +
'Hacking Level: ' + (Player.hacking_skill).toLocaleString() + '<br><br>' +
'Strength: ' + (Player.strength).toLocaleString() + '<br><br>' +
'Defense: ' + (Player.defense).toLocaleString() + '<br><br>' +
'Dexterity: ' + (Player.dexterity).toLocaleString() + '<br><br>' +
'Agility: ' + (Player.agility).toLocaleString() + '<br><br>' +
'Charisma: ' + (Player.charisma).toLocaleString() + '<br><br>' +
'Servers owned: ' + Player.purchasedServers.length + '<br><br>' +
'Hacking experience: ' + (Player.hacking_exp.toFixed(4)).toLocaleString() + '<br><br>' +
'Strength experience: ' + (Player.strength_exp.toFixed(4)).toLocaleString() + '<br><br>' +
'Defense experience: ' + (Player.defense_exp.toFixed(4)).toLocaleString() + '<br><br>' +
'Dexterity experience: ' + (Player.dexterity_exp.toFixed(4)).toLocaleString() + '<br><br>' +
'Agility experience: ' + (Player.agility_exp.toFixed(4)).toLocaleString() + '<br><br>' +
'Charisma experience: ' + (Player.charisma_exp.toFixed(4)).toLocaleString();
Engine.Display.characterInfo.innerHTML =
('<b>General</b><br><br>' +
'Current City: ' + Player.city + '<br><br>' +
'Employer: ' + Player.companyName + '<br>' +
'Job Title: ' + companyPosition + '<br><br>' +
'Money: $' + formatNumber(Player.money, 2)+ '<br><br><br>' +
'<b>Stats</b><br><br>' +
'Hacking Level: ' + (Player.hacking_skill).toLocaleString() +
" (" + formatNumber(Player.hacking_exp, 4) + ' experience)<br>' +
'Strength: ' + (Player.strength).toLocaleString() +
" (" + formatNumber(Player.strength_exp, 4) + ' experience)<br>' +
'Defense: ' + (Player.defense).toLocaleString() +
" (" + formatNumber(Player.defense_exp, 4) + ' experience)<br>' +
'Dexterity: ' + (Player.dexterity).toLocaleString() +
" (" + formatNumber(Player.dexterity_exp, 4) + ' experience)<br>' +
'Agility: ' + (Player.agility).toLocaleString() +
" (" + formatNumber(Player.agility_exp, 4) + ' experience)<br>' +
'Charisma: ' + (Player.charisma).toLocaleString() +
" (" + formatNumber(Player.charisma_exp, 4) + ' experience)<br><br><br>' +
'<b>Multipliers</b><br><br>' +
'Hacking Chance multiplier: ' + formatNumber(Player.hacking_chance_mult * 100, 2) + '%<br>' +
'Hacking Speed multiplier: ' + formatNumber(Player.hacking_speed_mult * 100, 2) + '%<br>' +
'Hacking money multiplier: ' + formatNumber(Player.hacking_money_mult * 100, 2) + '%<br><br>' +
'Hacking Level multiplier: ' + formatNumber(Player.hacking_mult * 100, 2) + '%<br>' +
'Hacking Experience multiplier: ' + formatNumber(Player.hacking_exp_mult * 100, 2) + '%<br><br>' +
'Strength Level multiplier: ' + formatNumber(Player.strength_mult * 100, 2) + '%<br>' +
'Strength Experience multiplier: ' + formatNumber(Player.strength_exp_mult * 100, 2) + '%<br><br>' +
'Defense Level multiplier: ' + formatNumber(Player.defense_mult * 100, 2) + '%<br>' +
'Defense Experience multiplier: ' + formatNumber(Player.defense_exp_mult * 100, 2) + '%<br><br>' +
'Dexterity Level multiplier: ' + formatNumber(Player.dexterity_mult * 100, 2) + '%<br>' +
'Dexterity Experience multiplier: ' + formatNumber(Player.dexterity_exp_mult * 100, 2) + '%<br><br>' +
'Agility Level multiplier: ' + formatNumber(Player.agility_mult * 100, 2) + '%<br>' +
'Agility Experience multiplier: ' + formatNumber(Player.agility_exp_mult * 100, 2) + '%<br><br>' +
'Charisma Level multiplier: ' + formatNumber(Player.charisma_mult * 100, 2) + '%<br>' +
'Charisma Experience multiplier: ' + formatNumber(Player.charisma_exp_mult * 100, 2) + '%<br><br>' +
'Hacknet Node production multiplier: ' + formatNumber(Player.hacknet_node_money_mult * 100, 2) + '%<br>' +
'Hacknet Node purchase cost multiplier: ' + formatNumber(Player.hacknet_node_purchase_cost_mult * 100, 2) + '%<br>' +
'Hacknet Node RAM upgrade cost multiplier: ' + formatNumber(Player.hacknet_node_ram_cost_mult * 100, 2) + '%<br>' +
'Hacknet Node Core purchase cost multiplier: ' + formatNumber(Player.hacknet_node_core_cost_mult * 100, 2) + '%<br>' +
'Hacknet Node level upgrade cost multiplier: ' + formatNumber(Player.hacknet_node_level_cost_mult * 100, 2) + '%<br><br>' +
'Company reputation gain multiplier: ' + formatNumber(Player.company_rep_mult * 100, 2) + '%<br>' +
'Faction reputation gain multiplier: ' + formatNumber(Player.faction_rep_mult * 100, 2) + '%<br>' +
'Salary multiplier: ' + formatNumber(Player.work_money_mult * 100, 2) + '%<br><br><br>' +
'<b>Misc</b><br><br>' +
'Servers owned: ' + Player.purchasedServers.length + '<br>' +
'Hacknet Nodes owned: ' + Player.hacknetNodes.length + '<br>').replace( / /g, "&nbsp;" );
},
/* Display locations in the world*/
@ -423,22 +379,22 @@ var Engine = {
var serverIpHostname = "Server: " + hostname + "(" + workerscript.serverIp + ")";
//Online
var onlineTotalMoneyMade = "Total online production: $" + workerscript.scriptRef.onlineMoneyMade.toFixed(2);
var onlineTotalExpEarned = (Array(26).join(" ") + workerscript.scriptRef.onlineExpGained.toFixed(2) + " exp").replace( / /g, "&nbsp;");
var onlineTotalMoneyMade = "Total online production: $" + formatNumber(workerscript.scriptRef.onlineMoneyMade, 2);
var onlineTotalExpEarned = (Array(26).join(" ") + formatNumber(workerscript.scriptRef.onlineExpGained, 2) + " hacking exp").replace( / /g, "&nbsp;");
var onlineMps = workerscript.scriptRef.onlineMoneyMade / workerscript.scriptRef.onlineRunningTime;
var onlineMpsText = "Online production rate: $" + onlineMps.toFixed(2) + "/second";
var onlineMpsText = "Online production rate: $" + formatNumber(onlineMps, 2) + "/second";
var onlineEps = workerscript.scriptRef.onlineExpGained / workerscript.scriptRef.onlineRunningTime;
var onlineEpsText = (Array(25).join(" ") + onlineEps.toFixed(4) + " exp/second").replace( / /g, "&nbsp;");
var onlineEpsText = (Array(25).join(" ") + formatNumber(onlineEps, 4) + " hacking exp/second").replace( / /g, "&nbsp;");
//Offline
var offlineTotalMoneyMade = "Total offline production: $" + workerscript.scriptRef.offlineMoneyMade.toFixed(2);
var offlineTotalExpEarned = (Array(27).join(" ") + workerscript.scriptRef.offlineExpGained.toFixed(2) + " exp").replace( / /g, "&nbsp;");
var offlineTotalMoneyMade = "Total offline production: $" + formatNumber(workerscript.scriptRef.offlineMoneyMade, 2);
var offlineTotalExpEarned = (Array(27).join(" ") + formatNumber(workerscript.scriptRef.offlineExpGained, 2) + " hacking exp").replace( / /g, "&nbsp;");
var offlineMps = workerscript.scriptRef.offlineMoneyMade / workerscript.scriptRef.offlineRunningTime;
var offlineMpsText = "Offline production rate: $" + offlineMps.toFixed(2) + "/second";
var offlineMpsText = "Offline production rate: $" + formatNumber(offlineMps, 2) + "/second";
var offlineEps = workerscript.scriptRef.offlineExpGained / workerscript.scriptRef.offlineRunningTime;
var offlineEpsText = (Array(26).join(" ") + offlineEps.toFixed(4) + " exp/second").replace( / /g, "&nbsp;");
var offlineEpsText = (Array(26).join(" ") + formatNumber(offlineEps, 4) + " hacking exp/second").replace( / /g, "&nbsp;");
itemText.innerHTML = serverIpHostname + "<br>" + onlineTotalMoneyMade + "<br>" + onlineTotalExpEarned + "<br>" +
onlineMpsText + "<br>" + onlineEpsText + "<br>" + offlineTotalMoneyMade + "<br>" + offlineTotalExpEarned + "<br>" +
@ -457,22 +413,25 @@ var Engine = {
//Re-add a link for each faction you are a member of
for (var i = 0; i < Player.factions.length; ++i) {
var factionName = Player.factions[i];
//Add the faction to the Factions page content
var item = document.createElement("li");
var aElem = document.createElement("a");
aElem.setAttribute("href", "#");
aElem.setAttribute("class", "a-link-button");
aElem.innerHTML = factionName;
aElem.addEventListener("click", function() {
Engine.loadFactionContent();
displayFactionContent(factionName);
return false;
});
item.appendChild(aElem);
factionsList.appendChild(item);
(function () {
var factionName = Player.factions[i];
//Add the faction to the Factions page content
var item = document.createElement("li");
var aElem = document.createElement("a");
aElem.setAttribute("href", "#");
aElem.setAttribute("class", "a-link-button");
aElem.innerHTML = factionName;
aElem.addEventListener("click", function() {
console.log("factionName:" + factionName)
Engine.loadFactionContent();
displayFactionContent(factionName);
return false;
});
item.appendChild(aElem);
factionsList.appendChild(item);
}()); //Immediate invocation
}
},
@ -561,11 +520,16 @@ var Engine = {
Player.startAction = false;
}
//Working
if (Player.isWorking) {
if (Player.currentWorkFactionName != "") {
if (Player.workType == CONSTANTS.WorkTypeFaction) {
Player.workForFaction(numCycles);
} else if (Player.createProgramName != "") {
} else if (Player.workType == CONSTANTS.WorkTypeCreateProgram) {
Player.createProgramWork(numCycles);
} else if (Player.workType == CONSTANTS.WorkTypeStudyClass) {
Player.takeClass(numCycles);
} else if (Player.workType == CONSTANTS.WorkTypeCrime) {
Player.commitCrime(numCycles);
} else {
Player.work(numCycles);
}
@ -582,6 +546,9 @@ var Engine = {
//Update the running time of all active scripts
updateOnlineScriptTimes(numCycles);
//Hacknet Nodes
processAllHacknetNodeEarnings(numCycles);
},
//Counters for the main event loop. Represent the number of game cycles are required
@ -589,9 +556,10 @@ var Engine = {
Counters: {
autoSaveCounter: 300, //Autosave every minute
updateSkillLevelsCounter: 10, //Only update skill levels every 2 seconds. Might improve performance
updateDisplays: 5, //Update displays such as Active Scripts display and character display
updateDisplays: 3, //Update displays such as Active Scripts display and character display
serverGrowth: 450, //Process server growth every minute and a half
checkFactionInvitations: 1500, //Check whether you qualify for any faction invitations every 5 minutes
passiveFactionGrowth: 600,
},
decrementAllCounters: function(numCycles = 1) {
@ -606,7 +574,7 @@ var Engine = {
//is necessary and then resets the counter
checkCounters: function() {
if (Engine.Counters.autoSaveCounter <= 0) {
Engine.saveGame();
saveObject.saveGame();
Engine.Counters.autoSaveCounter = 300;
}
@ -620,9 +588,11 @@ var Engine = {
Engine.updateActiveScriptsItems();
} else if (Engine.currentPage == Engine.Page.CharacterInfo) {
Engine.displayCharacterInfo();
}
} else if (Engine.currentPage == Engine.Page.HacknetNodes) {
updateHacknetNodesContent();
}
Engine.Counters.updateDisplays = 5;
Engine.Counters.updateDisplays = 3;
}
if (Engine.Counters.serverGrowth <= 0) {
@ -639,6 +609,12 @@ var Engine = {
}
Engine.Counters.checkFactionInvitations = 1500;
}
if (Engine.Counters.passiveFactionGrowth <= 0) {
var adjustedCycles = Math.floor((600 - Engine.Counters.passiveFactionGrowth));
processPassiveFactionRepGain(adjustedCycles);
Engine.Counters.passiveFactionGrowth = 600;
}
},
/* Calculates the hack progress for a manual (non-scripted) hack and updates the progress bar/time accordingly */
@ -703,6 +679,12 @@ var Engine = {
return false;
});
Engine.Clickables.hacknetNodesMainMenuButton = document.getElementById("hacknet-nodes-menu-link");
Engine.Clickables.hacknetNodesMainMenuButton.addEventListener("click", function() {
Engine.loadHacknetNodesContent();
return false;
});
Engine.Clickables.worldMainMenuButton = document.getElementById("world-menu-link");
Engine.Clickables.worldMainMenuButton.addEventListener("click", function() {
Engine.loadWorldContent();
@ -738,13 +720,13 @@ var Engine = {
Engine.Clickables.saveMainMenuButton = document.getElementById("save-game-link");
Engine.Clickables.saveMainMenuButton.addEventListener("click", function() {
Engine.saveGame();
saveObject.saveGame();
return false;
});
Engine.Clickables.deleteMainMenuButton = document.getElementById("delete-game-link");
Engine.Clickables.deleteMainMenuButton.addEventListener("click", function() {
Engine.deleteSave();
saveObject.deleteGame();
return false;
});
@ -808,6 +790,9 @@ var Engine = {
Engine.Display.activeScriptsContent = document.getElementById("active-scripts-container");
Engine.Display.activeScriptsContent.style.visibility = "hidden";
Engine.Display.hacknetNodesContent = document.getElementById("hacknet-nodes-container");
Engine.Display.hacknetNodesContent.style.visibility = "hidden";
Engine.Display.worldContent = document.getElementById("world-container");
Engine.Display.worldContent.style.visibility = "hidden";
@ -856,7 +841,7 @@ var Engine = {
Engine.Display.scriptEditorText = document.getElementById("script-editor-text");
//Load game from save or create new game
if (Engine.loadSave()) {
if (loadGame(saveObject)) {
console.log("Loaded game from save");
CompanyPositions.init();
@ -865,9 +850,26 @@ var Engine = {
var lastUpdate = Player.lastUpdate;
var numCyclesOffline = Math.floor((thisUpdate - lastUpdate) / Engine._idleSpeed);
/* Process offline progress */
processServerGrowth(numCyclesOffline); //Should be done before offline production for scripts
loadAllRunningScripts(); //This also takes care of offline production for those scripts
Player.work(numCyclesOffline);
if (Player.isWorking) {
if (Player.workType == CONSTANTS.WorkTypeFaction) {
Player.workForFaction(numCyclesOffline);
} else if (Player.workType == CONSTANTS.WorkTypeCreateProgram) {
Player.createProgramWork(numCyclesOffline);
} else if (Player.workType == CONSTANTS.WorkTypeStudyClass) {
Player.takeClass(numCyclesOffline);
} else {
Player.work(numCyclesOffline);
}
}
//Hacknet Nodes offline progress
processAllHacknetNodeEarnings(numCyclesOffline);
//Passive faction rep gain offline
processPassiveFactionRepGain(numCyclesOffline);
} else {
//No save found, start new game
console.log("Initializing new game");
@ -887,7 +889,16 @@ var Engine = {
if (Player.isWorking) {
var cancelButton = document.getElementById("work-in-progress-cancel-button");
cancelButton.addEventListener("click", function() {
Player.finishWork(true);
if (Player.workType == CONSTANTS.WorkTypeFaction) {
var fac = Factions[Player.currentWorkFactionName];
Player.finishFactionWork(true, fac);
} else if (Player.WorkType == CONSTANTS.WorkTypeCreateProgram) {
Player.finishCreateProgramWork(true, Player.createProgramName);
} else if (Player.workType == CONSTANTS.WorkTypeStudyClass) {
Player.finishClass();
} else {
Player.finishWork(true);
}
});
Engine.loadWorkInProgressContent();
}

View File

@ -36,6 +36,5 @@ isValidIPAddress = function(ipaddress) {
{
return true;
}
console.log("Invalid IP address");
return false ;
}

View File

@ -28,6 +28,7 @@ purchaseAugmentationBoxSetText = function(txt) {
//ram argument is in GB
purchaseAugmentationBoxCreate = function(aug, fac) {
console.log("here");
purchaseAugmentationBoxSetText("Would you like to purchase the " + aug.name + " Augmentation for $" +
(aug.baseCost * fac.augmentationPriceMult) + "?");
@ -137,8 +138,8 @@ purchaseAugmentationBoxCreate = function(aug, fac) {
} else if (Player.money >= (aug.baseCost * fac.augmentationPriceMult)) {
applyAugmentation(aug, fac);
//TODO Make this text better
dialogBoxCreate("You slowly drift to sleep as " + fac.name + "'s scientists put you under <br>" +
" in order to install the " + aug.name + " Augmentation. <br>br>" +
dialogBoxCreate("You slowly drift to sleep as " + fac.name + "'s scientists put you under " +
" in order to install the " + aug.name + " Augmentation. <br><br>" +
"You wake up in your home...you feel different...");
prestigeAugmentation();

View File

@ -0,0 +1,58 @@
/* Pop up Purchase Ram for Home Computer Pop-up Box */
function purchaseRamForHomeBoxInit() {
var cancelButton = document.getElementById("purchase-ram-for-home-box-cancel");
//Close Dialog box
cancelButton.addEventListener("click", function() {
purchaseRamForHomeBoxClose();
return false;
});
};
document.addEventListener("DOMContentLoaded", purchaseRamForHomeBoxInit, false);
purchaseRamForHomeBoxClose = function() {
var purchaseRamForHomeBox = document.getElementById("purchase-ram-for-home-box-container");
purchaseRamForHomeBox.style.display = "none";
}
purchaseRamForHomeBoxOpen = function() {
var purchaseRamForHomeBox = document.getElementById("purchase-ram-for-home-box-container");
purchaseRamForHomeBox.style.display = "block";
}
purchaseRamForHomeBoxSetText = function(txt) {
var textElem = document.getElementById("purchase-ram-for-home-box-text");
textElem.innerHTML = txt;
}
//ram argument is in GB
purchaseRamForHomeBoxCreate = function() {
//Calculate how many times ram has been upgraded (doubled)
var currentRam = Player.getHomeComputer().maxRam;
var newRam = currentRam * 2;
var numUpgrades = Math.log2(currentRam);
//Calculate cost
//Base cost of RAM is 50k per 1GB...but lets have this increase by 10% for every time
//the RAM has been upgraded
var cost = currentRam * CONSTANTS.BaseCostFor1GBOfRam;
var mult = Math.pow(1.1, numUpgrades);
cost = cost * mult;
purchaseRamForHomeBoxSetText("Would you like to purchase additional RAM for your home computer? <br><br>" +
"This will upgrade your RAM from " + currentRam + "GB to " + newRam + "GB. <br><br>" +
"This will cost $" + cost);
purchaseRamForHomeBoxOpen();
//Clear old event listeners from Confirm button
var confirmButton = document.getElementById("purchase-ram-for-home-box-confirm");
var newConfirmButton = confirmButton.cloneNode(true);
confirmButton.parentNode.replaceChild(newConfirmButton, confirmButton);
newConfirmButton.addEventListener("click", function() {
purchaseRamForHomeBoxClose();
purchaseRamForHomeComputer(cost);
return false;
});
}

View File

@ -41,4 +41,34 @@ function convertTimeMsToTimeElapsedString(time) {
var seconds = time;
return hours + " hours " + minutes + " minutes " + seconds + " seconds";
}
//Finds the longest common starting substring in a set of strings
function longestCommonStart(strings) {
if (!containsAllStrings(strings)) {return;}
if (strings.length == 0) {return;}
var A = strings.concat().sort(),
a1= A[0], a2= A[A.length-1], L= a1.length, i= 0;
while(i<L && a1.charAt(i)=== a2.charAt(i)) i++;
return a1.substring(0, i);
}
//Returns whether a variable is a string
function isString(str) {
return (typeof str === 'string' || str instanceof String);
}
//Returns whether an array contains entirely of string objects
function containsAllStrings(arr) {
return arr.every(isString);
}
//Formats a number with commas and a specific number of decimal digits
function formatNumber(num, numFractionDigits) {
return num.toLocaleString(undefined, {
minimumFractionDigits: numFractionDigits,
maximumFractionDigits: numFractionDigits
});
}