Merge pull request #1 from danielyxie/dev

Dev - v0.1
This commit is contained in:
danielyxie 2017-04-21 15:57:47 -05:00 committed by GitHub
commit 93e7bed036
45 changed files with 11533 additions and 0 deletions

129
Netburner.txt Normal file

@ -0,0 +1,129 @@
Cyberpunk theme for now. Hacking? Play Hacknet through to get ideas
Requirements:
Prestige mechanic for replayability (Ascension)
Good progression system
A prestige system does offer a sense of progression, but its better to have multiple systems that allow for progression. For example clicker heroes had ascending, transcending, gilding, Ancients, etc.
Complexity and variety
Different types of gameplay, idle vs active
Allow for different strategies through upgrades (or the faction system like in Realm Grinder)
Crafting
Maybe reward active gameplay by allowing players to find things that allow them to craft. This isn't doable with idle gameplay
Multiplayer, maybe? Hacking other people
People seem to like comparing themselves to others (leaderboards, high scores, etc.)
People like a sense of exploration/discovery
RPG Elements
Suggestions from other people:
For me it's quite important to be able to do stuff differently, I want choice. Realm Grinder and its Mercenary, Research and Faction system is the perfect
example for it. Different factions have different perks and spells, later on you can make your own faction out of everyone and you can further customize
your playstyle by the research skill tree mid-game. I feel like that it is important that you can do other stuff each time you prestige, not just "click-level up-reset".
That might've sparked some ideas, if not something to consider in future content updates.
What I really hate about CH1 is the fact that your Mercs can die [and can only be revived with premium currency (though you can earn a fair amount of it while playing!)],
I don't like when a incremental game punishes me in any way. This is literally why I stopped Tap Titans even though I had a lot of fun with it! I know that some people
really want some kind of challenge or something, just look at Kittens Game and how many people love it.
Also, watch this video about Unfolding Games. It's not just addiction or a formula-that-works that keeps people here, or choice, or multiplayer - it's discovery. I want
to discover something new, not yet another "10 kills til next stage, every 5 is bosses who eventually give prestige currency" game. I want to wonder what comes next even
as I have my eyes on a visible goal. I want to unlock something and be surprised at the features that are enabled next. There are many, many games that do this successfully - just ask for me examples.
Keep in mind that the draw of Clicker Heroes, and indeed most of these games, is that it's an RPG without all the things people don't care about. Take a different aspect
of the RPG and make it part of your idle game, and you've made something new. So far it's got the "kill things for more gold for more ability to kill things, with diminishing returns"
aspect, but that's not all there is. Adding quests, adding more currency, adding skills, adding talent trees, adding travel time, adding monster variability, etc. all fits
the same underlying theme, as long as you keep them engaging and fun.
Hacking background Terminology (and stuff Hacknet game does)
Compromising the security of another computer is illegal under USC ACT 1030-18
Botnet
HackNet commands:
probe command to analyze open ports and security (or nmap)
SSHCrack [Port number] (usually 22)
PortHack [Port number] (usually 80, after ports are cracked)
FTPBounce [Port number] (usually 21)
SMTPoverflow [Port number] (usually 25)
WebServerWorm [Port number] (usually 80) - for HTTP port
SQL_MemCorrupt [Port number] (usually 1433) - The public-facing SQL ports
Decypher to decrypt something
Firewall
Analyze several times
Solve [FIREWALL_SOLUTION] to attempt to syndicate firewall
scp to download files
Shell command
Create a shell on your computer and you can overload proxys
forkbomb Down a system in a hurry
Trace - Traces you when you try to hack, takes some amount of time
Proxy Servers function as a buffering layer between a target computer and a connecting counterpart that filters,
caches, and monitors incoming traffic to both optimize web performacne for repeated queries, and prevent
some kinds of attacks. the most well-recognized flaw in proxy servers is their upper memory limit - which
when reached will force them to allow unchecked traffic to pass trhough. To exploit this, hackers and testers will
often run Shells on other computers that an attack has access to. Then, with a collection of shells on
servant machines, will connect to a target computer, and use the shells "overload" funcitonality to flood
the target proxy server with junk data, allowing other, potentially harmful traffic through.
Netburner
Features:
Command line interface
Hack - Active hack
A hack takes time
Scripts - Automatically perform hacks and other actions
Allow people to write their own scripts?
So, people could write their own complicate scripts
Servers - Allow you to run more hacks. Allow you to hack idly
Computers - More powerful hacks, more hacks
CPU usage stats that lets you do more stuff, goes up as you upgrade?
Hire people
Join different factions (each with different advantages)
Police
Cybersecurity
Hacker group
Botnet
Create and sell botnet
Use botnet to DDOS
Start with only command line, you can develop a GUI after a little
Eventually you can join a gym and go to the gym to train your stats. This can be done idly
Allow people to take jobs to earn money. Working a job can be done idly
Bitcoin - You can exchange USD for bitcoins. Bitcoin exchange rate reflects real exchange rate
Persistent companies, as in companies that stay there through ascensions and you hacking them will
affect their performance. So if you hack something it might give you 100k, but then hacking it again
right away will give less like 99k. Diminishing returns. Therefore you have to stop hacking it for a
little to to allow it to give full rewards again
Character stats:
Hacking skill
Strength - How much damage you give
Defense - How much damage you take
Agility - How fast you attack and dodge %
Dexterity - Accuracy
Prestige system
Ascend
Reset all stats, computers, scripts, get an augmentation
Reincarnate
Reset all stats and augmentations
Get some kind of big powerup for the next run
Crafting
Let's start small at first and add this in later

@ -1,2 +1,91 @@
# netburner # netburner
Netburner Idle Game Netburner Idle Game
TESTING TODO:
hack() and sleep() in a script
hack() seems to be working
Sleep() seems to be working
Creating the foreign server network doesn't seem to be working
--Seems to be fixed
Script RAM Usage and corresponding terminal commands
If a server has no more money available it cannot be hacked anymore
Should work automatically...because your money gained percentage will be multiplied by 0
When the game is loaded re-load all of the scripts in runningScripts
- Seems to be working
Update skill level on cycle
If a script has bad syntax...it fucks everything up when you try to run it so fix that
Try catch for script?
Check that killing scripts still works fine (TESTED - LOoks to work fine)
Check that if script has bad syntax it wont run at all and everthing works normally (Seems to work fine)
Check if script throws during runtime it shuts down correctly (seems to work fine)
Adjust leveling formula. Goes up way too high at first
http://gamedev.stackexchange.com/questions/55151/rpg-logarithmic-leveling-formula
- might be too slow now?
Scripts tab that shows script stats
Seems to work, at least the basics (for online production)
Script offline progress
Delete a script from Active scripts when the WorkerScript is deleted
Seems to work
Server growth
Implemented but it might need to be balance/formula readjusted
ctrl+C functionality for all running command like hack(), analyze(), and tail
Implemented for hack() and analyze(). Seems to work
Saving/Loading factions
No errors thrown when saving/loading game at the start
Scroll all the way down when something is post()ed
Purchasing Servers
Work
Companies
Add possible CompanyPositions for every Company
Applying/working for companies
Factions
Change Company pages to display "apply for promotion" and other stuff when you are already employed there
Augmentations
rm command seems to work
Make it so that a script cannot be edited if it is running
+ Traveling
Script logging functionality? Logs to internal "log file" (property of script itself)
Can see log with tail.
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
Factions Info page isn't formatted correctly
Augmentations that decrease time to make programs
New server hostname in Purchase Server Pop-up Box needs limits..don't think the ones set in HTML work
Tutorial and help - INTERACTIVE TUTORIAL
Secret Servers
Hack time formula needs rebalancing I think, so does hack exp formula
Create new menu page for purchased servers
Gyms - Later..don't need for MVP
Update CONSTANTS.HelpText
Account for Max possible int when gaining exp (it will overflow)
Text in script editor that says ("ctrl + x" to save and quit)
OPTIMIZATION
https://gamealchemist.wordpress.com/2013/05/01/lets-get-those-javascript-arrays-to-work-fast/

247
css/menupages.css Normal file

@ -0,0 +1,247 @@
/* CSS for different main menu pages, such as character info, script editor, etc (but excluding
terminal which has its own page) */
/* Character Info */
#character-container {
position: fixed;
padding-top: 10px;
padding-left: 10px;
margin-left: 10%;
width: 99%;
}
/* Script Editor */
/* This temp element is used for auto adjusting filename field */
.tmp-element {
visibility: hidden;
white-space: pre;
}
#script-editor-container {
position: fixed;
padding-top: 10px;
padding-left: 10px;
height: 100%;
margin-left: 10%;
color: #66ff33;
}
#script-editor-filename-tag {
float: left;
}
#script-editor-filename {
float: left;
resize: none;
color: #66ff33;
width: 100%;
border: none;
outline: none;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
#script-editor-status {
float: left;
color: #ffffff;
}
#script-editor-text {
color: #66ff33;
width: 90%;
height: 100%;
outline: none;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
/* Active scripts */
.active-scripts-list {
list-style-type: none;
}
#active-scripts-container {
position: fixed;
padding-top: 10px;
padding-left: 10px;
height: 100%;
margin-left: 10%;
width: 99%;
overflow-y: scroll;
}
.active-scripts-list>li h2{
color: #66ff33;
padding-top: 10px;
padding-left: 10px;
background-color: #333;
text-decoration: none;
}
.active-scripts-list>li p {
color: #66ff33;
padding: 10px;
padding-left: 40px;
background-color: #333;
text-decoration: none;
}
/* World */
#world-container {
position: fixed;
padding-top: 10px;
padding-left: 10px;
height: 100%;
margin-left: 10%;
width: 99%;
}
/* Create program */
#create-program-container {
position: fixed;
padding-top: 10px;
padding-left: 10px;
height: 100%;
margin-left: 10%;
width: 99%;
}
.create-program-a-link-button {
text-decoration: none;
background-color: #555;
color: #FFFFFF;
padding: 4px 4px 4px 4px;
border-top: 1px solid #333333;
border-right: 1px solid #333333;
border-bottom: 1px solid #333333;
border-left: 1px solid #333333;
}
.create-program-a-link-button-inactive {
text-decoration: none;
background-color: #555;
color: #FFFFFF;
padding: 4px 4px 4px 4px;
border-top: 1px solid #333333;
border-right: 1px solid #333333;
border-bottom: 1px solid #333333;
border-left: 1px solid #333333;
pointer-events: none;
cursor: default;
}
/* Factions and Faction (Single Faction page) */
#factions-container {
position: fixed;
padding-top: 10px;
padding-left: 10px;
height: 100%;
margin-left: 10%;
width: 99%;
color: #66ff33;
}
#faction-container {
position: fixed;
padding-top: 10px;
padding-left: 10px;
height: 100%;
margin-left: 10%;
width: 90%;
}
#factions-list li {
padding: 6px;
margin: 6px;
}
#faction-hack-button-div, #faction-hack-text-div {
display:inline-block;
}
#faction-fieldwork-button-div, #faction-fieldwork-text-div {
display:inline-block;
}
#faction-securitywork-button-div, #faction-securitywork-text-div {
display:inline-block;
}
#faction-container p {
padding: 6px;
margin: 6px;
}
/* Faction Augmentations */
#faction-augmentations-container{
position: fixed;
padding-top: 10px;
padding-left: 10px;
height: 100%;
margin-left: 10%;
width: 99%;
color: #66ff33;
}
#faction-augmentations-container p,
#faction-augmentations-container a,
#faction-augmentations-container ul,
#faction-augmentations-container h1{
margin: 8px;
padding: 4px;
}
/* World */
#world-container li {
margin: 0 0 15px 0;
list-style-type: none;
}
/* Augmentations */
#augmentations-container {
position: fixed;
padding-top: 10px;
padding-left: 10px;
height: 100%;
margin-left: 10%;
width: 99%;
color: #66ff33;
}
.installed-augmentation {
/* TODO */
}
/* Tutorial */
#tutorial-container {
color: #66ff33;
position: fixed;
padding-top: 10px;
padding-left: 10px;
height: 100%;
margin-left: 10%;
width: 99%;
}
/* Location */
#location-container {
color: #66ff33;
position: fixed;
padding-top: 10px;
padding-left: 10px;
padding: 20px;
height: 100%;
margin-left: 10%;
width: 99%;
}
#location-container * {
margin: 10px 5px 10px 5px;
}

252
css/popupboxes.css Normal file

@ -0,0 +1,252 @@
/* Pop-up boxes */
/* Pop-up Dialog Box */
#dialog-box-container {
display: none; /* Hidden by default */
position: fixed; /* Stay in place */
z-index: 1; /* Sit on top */
left: 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 */
}
#dialog-box-content {
background-color: black;
margin: 20% auto; /* 15% from the top and centered */
padding: 10px;
border: 5px solid #FFFFFF;
width: 40%; /* Could be more or less, depending on screen size */
}
.dialog-box-text {
color: #66ff33;
}
#dialog-box-close-button {
color: #aaa;
float: right;
font-size: 20px;
font-weight: bold;
-webkit-border-radius: 12px;
-moz-border-radius: 12px;
border-radius: 12px;
-moz-box-shadow: 1px 1px 3px #000;
-webkit-box-shadow: 1px 1px 3px #000;
box-shadow: 1px 1px 3px #000;
}
#dialog-box-close-button:hover,
#dialog-box-close-button:focus {
color: white;
text-decoration: none;
cursor: pointer;
}
/* Purchase server box */
#purchase-server-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-server-box-content {
background-color: black;
margin: 15% auto; /* 15% from the top and centered */
padding: 1px;
border: 5px solid #FFFFFF;
width: 80%; /* Could be more or less, depending on screen size */
color: #66ff33;
}
#purchase-server-box-input {
color: white;
}
#purchase-server-box-confirm,
#purchase-server-box-cancel {
color: #aaa;
float: right;
font-size: 16px;
font-weight: bold;
padding: 2px;
border: 1px solid white;
}
#purchase-server-box-confirm:hover,
#purchase-server-box-confirm:focus {
color: #66ff33;
text-decoration: none;
cursor: pointer;
}
#purchase-server-box-cancel:hover,
#purchase-server-box-cancel:focus {
color: #66ff33;
text-decoration: none;
cursor: pointer;
}
/* Purchase Invitation Box */
#purchase-augmentation-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-augmentation-box-content {
background-color: black;
margin: 15% auto; /* 15% from the top and centered */
padding: 1px;
border: 5px solid #FFFFFF;
width: 80%; /* Could be more or less, depending on screen size */
color: #66ff33;
}
#purchase-augmentation-box-confirm,
#purchase-augmentation-box-cancel {
color: #aaa;
float: right;
font-size: 16px;
font-weight: bold;
padding: 2px;
border: 1px solid white;
}
#purchase-augmentation-box-confirm:hover,
#purchase-augmentation-box-confirm:focus {
color: #66ff33;
text-decoration: none;
cursor: pointer;
}
#purchase-augmentation-box-cancel:hover,
#purchase-augmentation-box-cancel:focus {
color: #66ff33;
text-decoration: none;
cursor: pointer;
}
/* Faction invitation box */
#faction-invitation-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;
}
#faction-invitation-box-content {
background-color: black;
margin: 15% auto; /* 15% from the top and centered */
padding: 10px;
border: 5px solid #FFFFFF;
width: 80%; /* Could be more or less, depending on screen size */
color: #66ff33;
}
#faction-invitation-box-yes,
#faction-invitation-box-no {
color: #aaa;
font-size: 20px;
font-weight: bold;
padding: 1px;
margin: 3px;
border: 1px solid white;
}
#faction-invitation-box-yes:hover,
#faction-invitation-box-yes:focus {
color: white;
text-decoration: none;
cursor: pointer;
}
#faction-invitation-box-no:hover,
#faction-invitation-box-no:focus {
color: white;
text-decoration: none;
cursor: pointer;
}
/* Travel Pop-up Box */
#travel-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;
}
#travel-box-content {
background-color: black;
margin: 15% auto; /* 15% from the top and centered */
padding: 10px;
border: 5px solid #FFFFFF;
width: 80%; /* Could be more or less, depending on screen size */
color: #66ff33;
}
#travel-box-confirm,
#travel-box-cancel {
color: #aaa;
font-size: 20px;
font-weight: bold;
padding: 3px;
margin: 3px;
border: 1px solid white;
}
#travel-box-confirm:hover,
#travel-box-confirm:focus {
color: white;
text-decoration: none;
cursor: pointer;
}
#travel-box-cancel:hover,
#travel-box-cancel:focus {
color: white;
text-decoration: none;
cursor: pointer;
}

98
css/styles.css Normal file

@ -0,0 +1,98 @@
/** This removes all padding and margins as well as
setting a default font size and family for the page **/
* {
margin: 0;
padding: 0;
font-size: 16px;
font-family: 'Lucida Console', 'Lucida Sans Unicode', 'Fira Mono', 'Consolas', 'Times New Roman';
background-color: #252527;
background-color: black;
}
p {
color: #66ff33;
}
h1 {
color: #66ff33;
}
h2 {
color: #66ff33;
}
ul {
list-style-type: none;
}
li {
list-style-type: none;
}
/* Main menu */
.mainmenu {
list-style-type: none;
margin: 0;
padding: 0;
width: 10%;
position: fixed;
height: 100%;
overflow: auto;
border: 0;
border-bottom: 1px solid #000000;
border-radius: 0;
background-color: #333;
}
.mainmenu>li a {
display: block;
color: #e6e6e6;
background-color: #333;
padding: 16px;
text-decoration: none;
}
.mainmenu>li a:hover:not(.active) {
background-color: #555;
color: white;
}
.mainmenu>li a:focus {
background-color: #555;
}
.mainmenu>li a.active {
background-color: #555;
color: white;
}
/* Make html links ("a" elements) nice looking buttons with this class */
.a-link-button {
text-decoration: none;
background-color: #555;
color: #FFFFFF;
padding: 6px;
margin: 6px;
border-top: 1px solid #333333;
border-right: 1px solid #333333;
border-bottom: 1px solid #333333;
border-left: 1px solid #333333;
}
/* Make anchor tags ("a" elements) inactive (not clickable) */
.a-link-button-inactive {
text-decoration: none;
background-color: #555;
color: #FFFFFF;
padding: 6px;
margin: 6px;
border-top: 1px solid #333333;
border-right: 1px solid #333333;
border-bottom: 1px solid #333333;
border-left: 1px solid #333333;
pointer-events: none;
cursor: default;
}

39
css/terminal.css Normal file

@ -0,0 +1,39 @@
#terminal-container {
position: fixed;
margin-left: 10%;
height: 100%;
width: 99%;
overflow: auto;
overflow-y: scroll;
}
#terminal {
padding-top: 10px;
padding-left: 10px;
height: auto;
width: 100%;
font-size: 16px;
overflow: auto;
overflow-y: scroll;
}
#terminal-input {
background-color: black;
color: #66ff33;
transition: height 1s;
}
.terminal-input {
display: table-cell;
width: 90%;
padding: 0px !important;
margin: 0px !important;
border: 0px;
background-color: black;
font-size: 16px;
outline: none;
color: #66ff33;
}

34
css/workinprogress.css Normal file

@ -0,0 +1,34 @@
#work-in-progress-container {
color: #66ff33;
position: fixed;
padding-top: 10px;
padding-left: 10px;
height: 100%;
}
#work-in-progress-text {
color: #66ff33;
}
#work-in-progress-cancel-button {
color: #aaa;
float: right;
font-size: 20px;
font-weight: bold;
-webkit-border-radius: 12px;
-moz-border-radius: 12px;
margin: 10px;
padding: 5px;
border-radius: 12px;
border: 3px solid white;
-moz-box-shadow: 1px 1px 3px #000;
-webkit-box-shadow: 1px 1px 3px #000;
box-shadow: 1px 1px 3px #000;
}
#work-in-progress-cancel-button:hover,
#work-in-progress-cancel-button:focus {
color: white;
text-decoration: none;
cursor: pointer;
}

554
index.html Normal file

@ -0,0 +1,554 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Netburner</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" />
<link rel="stylesheet" type="text/css" href="css/workinprogress.css" />
<link rel="stylesheet" type="text/css" href="css/popupboxes.css" />
<!-- We'll add in the jQuery library here - direct from
the Google CDN (Content Delivery Network). -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<!-- Utils -->
<script src="utils/IPAddress.js"></script>
<script src="utils/JSONReviver.js"></script>
<script src="utils/StringHelperFunctions.js"></script>
<script src="utils/HelperFunctions.js"></script>
<script src="utils/DialogBox.js"></script>
<script src="utils/PurchaseServerBox.js"></script>
<script src="utils/FactionInvitationBox.js"></script>
<script src="utils/PurchaseAugmentationBox.js"></script>
<script src="utils/TravelBox.js"></script>
<!-- Netscript -->
<script src="src/netscript/NetScriptWorker.js"></script>
<script src="src/netscript/InputStream.js"></script>
<script src="src/netscript/Tokenizer.js"></script>
<script src="src/netscript/Parser.js"></script>
<script src="src/netscript/Evaluator.js"></script>
<script src="src/netscript/Environment.js"></script>
<!-- Main game files -->
<script src="src/Constants.js"></script>
<script src="src/SpecialServerIps.js"></script>
<script src="src/Location.js"></script>
<script src="src/Script.js"></script>
<script src="src/Server.js"></script>
<script src="src/Player.js"></script>
<script src="src/Faction.js"></script>
<script src="src/FactionInfo.js"></script>
<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/CreateProgram.js"></script>
<script src="src/Augmentations.js"></script>
<script src="src/Perk.js"></script>
<script src="src/engine.js"></script>
</head>
<body>
<div id="mainmenu-container">
<!-- Main menu -->
<ul class="mainmenu">
<li class="terminal-tab">
<a href="#" id="terminal-menu-link"> Terminal </a>
</li>
<li class="character-tab">
<a href="#" id="character-menu-link"> Character </a>
</li>
<!-- These scripts stuff should be hidden until level 2, but leave them visible for now to test -->
<li class="create-script-tab">
<a href="#" id="create-script-menu-link"> Create Script </a>
</li>
<li class="active-scripts-tab">
<a href="#" id="active-scripts-menu-link"> Active Scripts </a>
</li>
<li class="world-tab">
<a href="#" id="world-menu-link"> World </a>
</li>
<li class="create-program-tab">
<a href="#" id="create-program-menu-link"> Create Program </a>
</li>
<li class="factions-tab">
<a href="#" id="factions-menu-link"> Factions </a>
</li>
<li class="augmentations-tab">
<a href="#" id="augmentations-menu-link"> Augmentations </a>
</li>
<li class="tutorial-tab">
<a href="#" id="tutorial-menu-link"> Tutorial </a>
</li>
<li class="save-game-tab">
<a href="#" id="save-game-link"> Save Game </a>
</li>
<li class="delete-game-tab">
<a href="#" id="delete-game-link"> Delete Game </a>
</li>
</ul>
</div>
<!-- Terminal page -->
<div id="terminal-container">
<table id="terminal">
<tr id="terminal-input">
<td id="terminal-input-td">$ <input type="text" class="terminal-input"/></td>
</tr>
</table>
</div>
<!-- Character Info page -->
<div id="character-container">
<p id="character-info"> </p>
</div>
<!-- Script editor -->
<div id="script-editor-container">
<p id="script-editor-filename-tag"> Script name: </p>
<input id="script-editor-filename" type="text" maxlength="30"> </input>
<br>
<br><br>
<textarea id="script-editor-text" style="border: none" autofocus> </textarea>
</div>
<!-- Active scripts info page -->
<div id="active-scripts-container">
<ul class="active-scripts-list" id="active-scripts-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-ecorp-li">
<a href="#" id="aevum-ecorp" class="a-link-button"> ECorp </a>
</li>
<li id="aevum-bachmanandassociates-li">
<a href="#" id="aevum-bachmanandassociates" class="a-link-button"> Bachman & Associates</a>
</li>
<li id="aevum-clarkeincorporated-li">
<a href="#" id="aevum-clarkeincorporated" class="a-link-button"> Clarke Incorporated </a>
</li>
<li id="aevum-fulcrumtechnologies-li">
<a href="#" id="aevum-fulcrumtechnologies" class="a-link-button"> Fulcrum Technologies </a>
</li>
<li id="aevum-aerocorp-li">
<a href="#" id="aevum-aerocorp" class="a-link-button"> AeroCorp </a>
</li>
<li id="aevum-galacticcybersystems-li">
<a href="#" id="aevum-galacticcybersystems" class="a-link-button"> Galactic Cybersystems </a>
</li>
<li id="aevum-watchdogsecurity-li">
<a href="#" id="aevum-watchdogsecurity" class="a-link-button">Watchdog Security </a>
</li>
<li id="aevum-rhoconstruction-li">
<a href="#" id="aevum-rhoconstruction" class="a-link-button">Rho Construction </a>
</li>
<li id="aevum-aevumpolice-li">
<a href="#" id="aevum-aevumpolice" class="a-link-button">Aevum Police</a>
</li>
<li id="aevum-netlinktechnologies-li">
<a href="#" id="aevum-netlinktechnologies" class="a-link-button">NetLink Technologies</a>
</li>
<li id="aevum-crushfitnessgym-li">
<a href="#" id="aevum-crushfitnessgym" class="a-link-button">Crush Fitness Gym </a>
</li>
<li id="aevum-snapfitnessgym-li">
<a href="#" id="aevum-snapfitnessgym" class="a-link-button">Snap Fitness Gym</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 id="chonqging-kuaigonginternational-li">
<a href="#" id="chongqing-kuaigonginternational" class="a-link-button">KuaiGong International </a>
<li>
<li id="chongqing-solarisspacesystems-li">
<a href="#" id="chongqing-solarisspacesystems" class="a-link-button">Solaris Space Systems</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 id="sector12-megacorp-li">
<a href="#" id="sector12-megacorp" class="a-link-button">MegaCorp</a>
<li>
<li id="sector12-bladeindustries-li">
<a href="#" id="sector12-bladeindustries" class="a-link-button"> Blade Industries</a>
<li>
<li id="sector12-foursigma-li">
<a href="#" id="sector12-foursigma" class="a-link-button">Four Sigma</a>
<li>
<li id="sector12-icarusmicrosystems-li">
<a href="#" id="sector12-icarusmicrosystems" class="a-link-button"> Icarus Microsystems</a>
<li>
<li id="sector12-universalenergy-li">
<a href="#" id="sector12-universalenergy" class="a-link-button">Universal Energy </a>
<li>
<li id="sector12-deltaone-li">
<a href="#" id="sector12-deltaone" class="a-link-button">DeltaOne </a>
<li>
<li id="sector12-cia-li">
<a href="#" id="sector12-cia" class="a-link-button">Central Intelligence Agency </a>
<li>
<li id="sector12-nsa-li">
<a href="#" id="sector12-nsa" class="a-link-button">National Security Agency </a>
<li>
<li id="sector12-alphaenterprises-li">
<a href="#" id="sector12-alphaenterprises" class="a-link-button">Alpha Enterprises</a>
<li>
<li id="sector12-carmichaelsecurity-li">
<a href="#" id="sector12-carmichaelsecurity" class="a-link-button"> Carmichael Security</a>
<li>
<li id="sector12-foodnstuff-li">
<a href="#" id="sector12-foodnstuff" class="a-link-button">FoodNStuff</a>
<li>
<li id="sector12-joesguns-li">
<a href="#" id="sector12-joesguns" class="a-link-button"> Joe's Guns</a>
<li>
<li id="sector12-irongym-li">
<a href="#" id="sector12-irongym" class="a-link-button">Iron Gym </a>
<li>
<li id="sector12-powerhousegym-li">
<a href="#" id="sector12-powerhousegym" class="a-link-button">Powerhouse Gym</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 id="newtokyo-defcomm-li">
<a href="#" id="newtokyo-defcomm" class="a-link-button"> DefComm</a>
<li>
<li id="newtokyo-vitalife-li">
<a href="#" id="newtokyo-vitalife" class="a-link-button">VitaLife </a>
<li>
<li id="newtokyo-globalpharmaceuticals-li">
<a href="#" id="newtokyo-globalpharmaceuticals" class="a-link-button">Global Pharmaceuticals</a>
<li>
<li id="newtokyo-noodlebar-li">
<a href="#" id="newtokyo-noodlebar" class="a-link-button">Noodle Bar </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 id="ishima-stormtechnologies-li">
<a href="#" id="ishima-stormtechnologies" class="a-link-button">Storm Technologies</a>
<li>
<li id="ishima-novamedical-li">
<a href="#" id="ishima-novamedical" class="a-link-button">Nova Medical</a>
<li>
<li id="ishima-omegasoftware-li">
<a href="#" id="ishima-omegasoftware" class="a-link-button">Omega Software </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 id="volhaven-omnitekincorporated-li">
<a href="#" id="volhaven-omnitekincorporated" class="a-link-button">OmniTek Incorporated </a>
<li>
<li id="volhaven-nwo-li">
<a href="#" id="volhaven-nwo" class="a-link-button">NWO</a>
<li>
<li id="volhaven-helislabs-li">
<a href="#" id="volhaven-helioslabs" class="a-link-button">Helios Labs</a>
<li>
<li id="volhaven-omniacybersystems-li">
<a href="#" id="volhaven-omniacybersystems" class="a-link-button">Omnia Cybersystems</a>
<li>
<li id="volhaven-lexocorp-li">
<a href="#" id="volhaven-lexocorp" class="a-link-button">LexoCorp</a>
<li>
<li id="volhaven-syscoresecurities-li">
<a href="#" id="volhaven-syscoresecurities" class="a-link-button">SysCore Securities</a>
<li>
<li id="volhaven-computek-li">
<a href="#" id="volhaven-computek" class="a-link-button">CompuTek</a>
<li>
<li id="volhaven-milleniumfitnessgym-li">
<a href="#" id="volhaven-milleniumfitnessgym" class="a-link-button">Millenium Fitness Gym</a>
<li>
</ul>
</div>
<!-- Create a program(executable) -->
<div id="create-program-container">
<ul id="create-program-list">
<a class="create-program-a-link-button" id="create-program-porthack" href="#">
PortHack.exe
</a>
<a class="create-program-a-link-button" id="create-program-brutessh" href="#">
BruteSSH.exe
</a>
<a class="create-program-a-link-button" id="create-program-ftpcrack" href="#">
FTPCrack.exe
</a>
<a class="create-program-a-link-button" id="create-program-relaysmtp" href="#">
relaySMTP.exe
</a>
<a class="create-program-a-link-button" id="create-program-httpworm" href="#">
HTTPWorm.exe
</a>
<a class="create-program-a-link-button" id="create-program-sqlinject" href="#">
SQLInject.exe
</a>
</ul>
</div>
<!-- Factions -->
<div id="factions-container">
<h1> Factions </h1>
<p> Lists all factions you have joined </p>
<ul class="factions-list" id="factions-list">
</ul>
</div>
<!-- Single Faction info (when you select a faction from the Factions menu) -->
<div id="faction-container">
<h1 id="faction-name"></h1>
<p id="faction-info"></p>
<p id="faction-reputation"></p>
<p id="work-description-text">
Perform work/carry out assignments for your faction to help further its cause! Each
task takes a certain amount of time to complete, which is dependent on your stats. Completing
a task will earn you exp and increase your reputation with the faction. Note that you cannot
use your terminal or create scripts when you are performing a task!
</p>
<div id="faction-hack-div">
<a href="#" id="faction-hack-button" class="a-link-button">Hacking Contracts</a>
<p id="faction-hack-text">
Complete hacking contracts for your faction! <br>
Your effectiveness, which determines how much reputation you gain for this faction, is based on your hacking skill. <br>
Gain hacking exp.
</p>
<div id="faction-hack-text-div">
</div>
</div>
<div id="faction-fieldwork-div">
<a href="#" id="faction-fieldwork-button" class="a-link-button">Field Work</a>
<div id="faction-fieldwork-text-div">
<p id="faction-fieldwork-text">
Carry out field missions for your faction. <br>
Your effectiveness, which determines how much reputation you gain for this faction, is based on all of your stats. <br>
Gains exp for all stats.
</p>
</div>
</div>
<div id="faction-securitywork-div">
<a href="#" id="faction-securitywork-button" class="a-link-button">Security Work</a>
<div id="faction-securitywork-text-div">
<p id="faction-securitywork-text">
Serve in a security detail for your faction. <br>
Your effectiveness, which determines how much reputation you gain for this faction, is based on your combat stats. <br>
Gains exp for all combat stats.
</p>
</div>
</div>
<p>
As your reputation with this faction rises, you will unlock Augmentations, which you
can purchase to enhance your abilities.
</p>
<a href="#" id="faction-purchase-augmentations" class="a-link-button">Purchase Augmentations</a>
</div>
<div id="faction-augmentations-container">
<a href="#" id="faction-augmentations-back-button" class="a-link-button"> Back </a>
<h1> Faction Augmentations </h1>
<p id="faction-augmentations-page-desc"> Lists all augmentations that are available to purchase from </p>
<ul class="faction-augmentations-list" id="faction-augmentations-list">
</ul>
</div>
<!-- Installed augmentations -->
<div id="augmentations-container">
<h1> Augmentations </h1>
<p> Lists all augmentations you have installed </p>
<ul id="augmentations-list">
</ul>
</div>
<!-- Tutorial content -->
<div id="tutorial-container">
<a href="#" id="tutorial-getting-started-link" class="a-link-button"> Getting Started </a>
<a href="#" id="tutorial-networking-link" class="a-link-button"> Networking </a>
<a href="#" id="tutorial-hacking-link" class="a-link-button"> Hacking </a>
<a href="#" id="tutorial-scripts-link" class="a-link-button"> Scripts </a>
<a href="#" id="tutorial-traveling-link" class="a-link-button"> Traveling </a>
<a href="#" id="tutorial-jobs-link" class="a-link-button"> Jobs </a>
<a href="#" id="tutorial-factions-link" class="a-link-button"> Factions </a>
<a href="#" id="tutorial-augmentations-link" class="a-link-button"> Augmentations </a>
<a href="#" id="tutorial-back-button" class="a-link-button"> Back </a>
<p id="tutorial-text"> </p>
</div>
<!-- Location (visiting a location in World) -->
<div id="location-container">
<a href="#" id="location-return-to-world-button" class="a-link-button"> Return to World </a>
<h1 id="location-name"></h1>
<p id="location-info"> </p>
<p id="location-job-title"> </p>
<p id="location-job-reputation"> </p>
<!-- Jobs/Work at a company -->
<a href="#" id="location-software-job" class="a-link-button"> Apply for Software Job</a>
<a href="#" id="location-it-job" class="a-link-button"> Apply for IT Job </a>
<a href="#" id="location-security-engineer-job" class="a-link-button"> Apply for Security Engineer Job</a>
<a href="#" id="location-network-engineer-job" class="a-link-button"> Apply for Network Engineer Job</a>
<a href="#" id="location-business-job" class="a-link-button"> Apply for Business Job</a>
<a href="#" id="location-security-job" class="a-link-button"> Apply for Security Job</a>
<a href="#" id="location-agent-job" class="a-link-button"> Apply to be an Agent</a>
<a href="#" id="location-employee-job" class="a-link-button"> Apply to be an Employee </a>
<a href="#" id="location-waiter-job" class="a-link-button"> Apply to be a Waiter</a>
<a href="#" id="location-work" class="a-link-button"> Work </a>
<!-- Gym -->
<a href="#" id="location-gym-train-str" class="a-link-button">Train Strength</a>
<a href="#" id="location-gym-train-def" class="a-link-button">Train Defense </a>
<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>
<!-- 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-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-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-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-tor" class="a-link-button"> Purchase TOR Router - $2,000,000</a>
<!-- Travel agency -->
<p id="location-travel-agency-text">
From here, you can travel to any other city! A ticket costs $1,000,000.
</p>
<a href="#" id="location-travel-to-aevum" class="a-link-button"> Travel to Aevum </a>
<a href="#" id="location-travel-to-chongqing" class="a-link-button"> Travel to Chongqing</a>
<a href="#" id="location-travel-to-sector12" class="a-link-button"> Travel to Sector-12</a>
<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>
</div>
<!-- Dialog Box, displays status text only -->
<div id="dialog-box-container">
<div id="dialog-box-content">
<span id="dialog-box-close-button">&times;</span>
<p id="dialog-box-text-1" class="dialog-box-text"> </p>
<p id="dialog-box-text-2" class="dialog-box-text"> </p>
<p id="dialog-box-text-3" class="dialog-box-text"> </p>
<p id="dialog-box-text-4" class="dialog-box-text"> </p>
</div>
</div>
<!-- Purchase Server Pop-up Box -->
<div id="purchase-server-box-container">
<div id="purchase-server-box-content">
<p id="purchase-server-box-text"> </p>
<p id="purchase-server-box-enter-name"> Enter new server hostname: </p>
<input type="text" id="purchase-server-box-input" pattern="[a-zA-Z0-9-_]+ maxlength="30"> </input>
<span id="purchase-server-box-confirm"> Purchase </span>
<span id="purchase-server-box-cancel"> Cancel </span>
</div>
</div>
<!-- Travel Pop-up Box -->
<div id="travel-box-container">
<div id="travel-box-content">
<p id="travel-box-text"> </p>
<span id="travel-box-confirm"> Yes </span>
<span id="travel-box-cancel"> No </span>
</div>
</div>
<!-- Purchase Augmentation Pop-up Box -->
<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>
Stats/Skill levels and Experience <br>
Money <br>
Scripts <br>
Faction/Company reputation <br><br>
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>
<span id="purchase-augmentation-box-confirm"> Purchase </span>
<span id="purchase-augmentation-box-cancel"> Cancel </span>
</div>
</div>
<!-- Faction Invitation Pop-up Box -->
<div id="faction-invitation-box-container">
<div id="faction-invitation-box-content">
<p id="faction-invitation-box-text"> </p>
<p id="faction-invitation-box-message"> </p>
<p id="faction-invitation-box-warning">
Would you like to join? <br> <br>
Warning: Joining this faction may prevent you from joining other factions during this run!
</p>
<span id="faction-invitation-box-yes"> Yes </span>
<span id="faction-invitation-box-no"> No </span>
</div>
</div>
<!-- Work in progress screen -->
<div id="work-in-progress-container">
<p id="work-in-progress-text"> </p>
<span id="work-in-progress-cancel-button"> Cancel Work </span>
</div>
</body>
</html>

710
src/Augmentations.js Normal file

@ -0,0 +1,710 @@
//Augmentations
function Augmentation(name) {
this.name = name;
this.info = "";
this.owned = false; //Whether the player has it (you can only have each augmentation once)
this.factionInstalledBy = ""; //Which faction the Player got this from
//Price and reputation base requirements (can change based on faction multipliers)
this.baseRepRequirement = 0;
this.baseCost = 0;
}
Augmentation.prototype.setInfo = function(inf) {
this.info = inf;
}
Augmentation.prototype.setRequirements = function(rep, cost) {
this.baseRepRequirement = rep;
this.baseCost = cost;
}
//Takes in an array of faction names and adds this augmentation to all of those factions
Augmentation.prototype.addToFactions = function(factionList) {
for (var i = 0; i < factionList.length; ++i) {
var faction = Factions[factionList[i]];
if (faction == null) {
console.log("Error: Could not find faction with this name:" + factionList[i]);
continue;
}
faction.augmentations.push(this.name);
}
}
Augmentation.prototype.toJSON = function() {
return Generic_toJSON("Augmentation", this);
}
Augmentation.fromJSON = function(value) {
return Generic_fromJSON(Augmentation, value.data);
}
Reviver.constructors.Augmentation = Augmentation;
Augmentations = {}
AddToAugmentations = function(aug) {
var name = aug.name;
Augmentations[name] = aug;
}
//TODO Something that decreases RAM usage of scripts
initAugmentations = function() {
//Combat stat augmentations
var Targeting1 = new Augmentation("Augmented Targeting I");
Targeting1.setRequirements(36000, 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" +
"This augmentation increases the player's dexterity by 10%.");
Targeting1.addToFactions(["The Dark Army", "The Syndicate", "Sector-12", "Volhaven", "Ishima",
"OmniTek Incorporated", "KuaiGong International", "Blade Industries"]);
AddToAugmentations(Targeting1);
var Targeting2 = new Augmentation("Augmented Targeting II");
Targeting2.setRequirements(72000, 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%.");
Targeting2.addToFactions(["The Dark Army", "The Syndicate", "Sector-12", "Volhaven", "Ishima",
"OmniTek Incorporated", "KuaiGong International", "Blade Industries"]);
AddToAugmentations(Targeting2);
var Targeting3 = new Augmentation("Augmented Targeting III");
Targeting3.setRequirements(144000, 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%.");
Targeting3.addToFactions(["The Dark Army", "The Syndicate", "OmniTek Incorporated",
"KuaiGong International", "Blade Industries", "The Covenant"]);
AddToAugmentations(Targeting3);
var SyntheticHeart = new Augmentation("Synthetic Heart");
SyntheticHeart.setRequirements(1000000, 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%");
SyntheticHeart.addToFactions(["KuaiGong International", "Fulcrum Secret Technologies", "Speakers for the Dead",
"NWO", "The Covenant", "Daedalus", "Illuminati"]);
AddToAugmentations(SyntheticHeart);
var SynfibrilMuscle = new Augmentation("Synfibril Muscle");
SynfibrilMuscle.setRequirements(900000, 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" +
"strength and defense by 50%.");
SynfibrilMuscle.addToFactions(["KuaiGong International", "Fulcrum Secret Technologies", "Speakers for the Dead",
"NWO", "The Covenant", "Daedalus", "Illuminati", "Blade Industries"]);
AddToAugmentations(SynfibrilMuscle)
var CombatRib1 = new Augmentation("Combat Rib I");
CombatRib1.setRequirements(50000, 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%.");
CombatRib1.addToFactions(["The Dark Army", "The Syndicate", "Sector-12", "Volhaven", "Ishima",
"OmniTek Incorporated", "KuaiGong International", "Blade Industries"]);
AddToAugmentations(CombatRib1);
var CombatRib2 = new Augmentation("Combat Rib II");
CombatRib2.setRequirements(100000, 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",
"OmniTek Incorporated", "KuaiGong International", "Blade Industries"]);
AddToAugmentations(CombatRib2);
var CombatRib3 = new Augmentation("Combat Rib III");
CombatRib3.setRequirements(200000, 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",
"KuaiGong International", "Blade Industries", "The Covenant"]);
AddToAugmentations(CombatRib3);
var NanofiberWeave = new Augmentation("Nanofiber Weave");
NanofiberWeave.setRequirements(400000, 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%.");
NanofiberWeave.addToFactions(["Tian Di Hui", "The Syndicate", "The Dark Army", "Speakers for the Dead",
"Blade Industries", "Fulcrum Secret Technologies", "OmniTek Incorporated"]);
AddToAugmentations(NanofiberWeave);
var SubdermalArmor = new Augmentation("NEMEAN Subdermal Weave");
SubdermalArmor.setRequirements(1000000, 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" +
"at stopping piercing blows and reducing blunt trauma. The properties of graphene allow the plating to\n" +
"mitigate damage from any fire-related or electrical traumas.\n\n" +
"This augmentation increases the player's defense by 150%.");
SubdermalArmor.addToFactions(["The Syndicate", "Fulcrum Secret Technologies", "Illuminati", "Daedalus",
"The Covenant"]);
AddToAugmentations(SubdermalArmor);
var WiredReflexes = new Augmentation("Wired Reflexes");
WiredReflexes.setRequirements(36000, 10000000);
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%.");
WiredReflexes.addToFactions(["Tian Di Hui", "Sector-12", "Volhaven", "Aevum", "Ishima",
"The Syndicate", "The Dark Army", "Speakers for the Dead"]);
AddToAugmentations(WiredReflexes);
var GrapheneBoneLacings = new Augmentation("Graphene Bone Lacings");
GrapheneBoneLacings.setRequirements(1500000, 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%.");
GrapheneBoneLacings.addToFactions(["Fulcrum Secret Technologies", "The Covenant"]);
AddToAugmentations(GrapheneBoneLacings);
var BionicSpine = new Augmentation("Bionic Spine");
BionicSpine.setRequirements(250000, 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" +
"greatly improved senses and reaction speeds.\n\n" +
"This augmentation increases all of the player's combat stats by 20%.");
BionicSpine.addToFactions(["Speakers for the Dead", "The Syndicate", "KuaiGong International",
"OmniTek Incorporated", "Blade Industries"]);
AddToAugmentations(BionicSpine);
var GrapheneBionicSpine = new Augmentation("Graphene Bionic Spine Upgrade");
GrapheneBionicSpine.setRequirements(1200000, 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%.");
GrapheneBionicSpine.addToFactions(["Fulcrum Secret Technologies", "ECorp"]);
AddToAugmentations(GrapheneBionicSpine);
var BionicLegs = new Augmentation("Bionic Legs");
BionicLegs.setRequirements(200000, 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",
"OmniTek Incorporated", "Blade Industries"]);
AddToAugmentations(BionicLegs);
var GrapheneBionicLegs = new Augmentation("Graphene Bionic Legs Upgrade");
GrapheneBionicLegs.setRequirements(1000000, 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%.");
GrapheneBionicLegs.addToFactions(["MegaCorp", "ECorp", "Fulcrum Secret Technologies"]);
AddToAugmentations(GrapheneBionicLegs);
//Labor stat augmentations
var SpeechProcessor = new Augmentation("Speech Processor Implant"); //Cochlear imlant?
SpeechProcessor.setRequirements(50000, 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" +
"This augmentation increases the player's charisma by 20%.");
SpeechProcessor.addToFactions(["Tian Di Hui", "Chongqing", "Sector-12", "New Tokyo", "Aevum",
"Ishima", "Volhaven"]);
AddToAugmentations(SpeechProcessor);
TITN41Injection = new Augmentation("TITN-41 Gene-Modification Injection");
TITN41Injection.setRequirements(150000, 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" +
"This augmentation increases the player's charisma and charisma experience gain rate by 15%");
TITN41Injection.addToFactions(["Silhouette"]);
var EnhancedSocialInteractionImplant = new Augmentation("Enhanced Social Interaction Implant");
EnhancedSocialInteractionImplant.setRequirements(750000, 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" +
"situations. The implant also uses deep learning software to continuously learn new behavior\n" +
"patterns and how to best respond.\n\n" +
"This augmentation increases the player's charisma and charisma experience gain rate by 50%.");
EnhancedSocialInteractionImplant.addToFactions(["Bachman & Associates", "NWO", "Clarke Incorporated",
"OmniTek Incorporated", "Four Sigma"]);
AddToAugmentations(EnhancedSocialInteractionImplant);
//Hacking augmentations
var ArtificialBioNeuralNetwork = new Augmentation("Artificial Bio-neural Network Implant");
ArtificialBioNeuralNetwork.setRequirements(750000, 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" +
"nanoprocessors are programmed to perform computations much faster than organic neurons,\n" +
"allowing its user to solve much more complex problems at a much faster rate.\n\n" +
"This augmentation:\n" +
"Increases the player's hacking speed by 2%\n" +
"Increases the amount of money the player's gains from hacking by 10%\n" +
"Inreases the player's hacking skill by 10%");
ArtificialBioNeuralNetwork.addToFactions(["BitRunners", "Fulcrum Secret Technologies"]);
AddToAugmentations(ArtificialBioNeuralNetwork);
var ArtificialSynapticPotentiation = new Augmentation("Artificial Synaptic Potentiation");
ArtificialSynapticPotentiation.setRequirements(600000, 400000000);
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%.");
ArtificialSynapticPotentiation.addToFactions(["The Black Hand", "NiteSec"]);
AddToAugmentations(ArtificialSynapticPotentiation);
var EnhancedMyelinSheathing = new Augmentation("Enhanced Myelin Sheathing");
EnhancedMyelinSheathing.setRequirements(900000, 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" +
"counterparts, leading to greater processing speeds and better brain function.\n\n" +
"This augmentation:\n" +
"Increases the player's hacking speed by 1%\n" +
"Increases the player's hacking skill by 5%\n" +
"Increases the player's hacking experience gain rate by 5%");
EnhancedMyelinSheathing.addToFactions(["Fulcrum Secret Technologies", "BitRunners", "The Black Hand"]);
AddToAugmentations(EnhancedMyelinSheathing);
var SynapticEnhancement = new Augmentation("Synaptic Enhancement Implant");
SynapticEnhancement.setRequirements(50000, 35000000);
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%.");
SynapticEnhancement.addToFactions(["CyberSec"]);
AddToAugmentations(SynapticEnhancement);
var NeuralRetentionEnhancement = new Augmentation("Neural-Retention Enhancement");
NeuralRetentionEnhancement.setRequirements(200000, 250000000);
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%.");
NeuralRetentionEnhancement.addToFactions(["CyberSec", "NiteSec"]);
AddToAugmentations(NeuralRetentionEnhancement);
var DataJack = new Augmentation("DataJack");
DataJack.setRequirements(750000, 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" +
"This augmentation increases the amount of money the player gains from hacking by 20%");
DataJack.addToFactions(["BitRunners", "The Black Hand", "NiteSec", "Chongqing", "New Tokyo"]);
AddToAugmentations(DataJack);
var ENM = new Augmentation("Embedded Netburner Module");
ENM.setRequirements(500000, 300000000);
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" +
"not do much, but a variety of very powerful upgrades can be installed that allow you to fully\n" +
"control the traffic on a network.\n\n" +
"This augmentation increases the player's hacking skill by 1%");
ENM.addToFactions(["BitRunners", "The Black Hand", "NiteSec", "ECorp", "MegaCorp",
"Fulcrum Secret Technologies", "NWO", "Blade Industries"]);
AddToAugmentations(ENM);
var ENMCore = new Augmentation("Embedded Netburner Module Core Implant");
ENMCore.setRequirements(750000, 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" +
"Increases the player's hacking speed by 2%\n" +
"Increases the amount of money the player gains from hacking by 10%\n" +
"Increases the player's chance of successfully performing a hack by 2%\n" +
"Increases the player's hacking experience gain rate by 10%\n" +
"Increases the player's hacking skill by 1%");
ENMCore.addToFactions(["BitRunners", "The Black Hand", "NiteSec", "ECorp", "MegaCorp",
"Fulcrum Secret Technologies", "NWO", "Blade Industries"]);
AddToAugmentations(ENMCore);
var ENMCoreV2 = new Augmentation("Embedded Netburner Module Core V2 Upgrade");
ENMCoreV2.setRequirements(1000000, 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" +
"packets.\n\n" +
"This augmentation: \n" +
"Increases the player's hacking speed by 5%\n" +
"Increases the amount of money the player gains from hacking by 50%\n" +
"Increases the player's chance of successfully performing a hack by 5%\n" +
"Increases the player's hacking experience gain rate by 50%\n" +
"Increases the player's hacking skill by 5%");
ENMCoreV2.addToFactions(["ECorp", "MegaCorp", "Fulcrum Secret Technologies", "NWO",
"Blade Industries", "OmniTek Incorporated", "KuaiGong International"]);
AddToAugmentations(ENMCoreV2);
var ENMCoreV3 = new Augmentation("Embedded Netburner Module Core V3 Upgrade");
ENMCoreV3.setRequirements(1500000, 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" +
"This augmentation:\n" +
"Increases the player's hacking speed by 5%\n" +
"Increases the amount of money the player gains from hacking by 50%\n" +
"Increases the player's chance of successfully performing a hack by 10%\n" +
"Increases the player's hacking experience gain rate by 100%\n" +
"Increases the player's hacking skill by 10%");
ENMCoreV3.addToFactions(["ECorp", "MegaCorp", "Fulcrum Secret Technologies", "NWO",
"Daedalus", "The Covenant", "Illuminati"]);
AddToAugmentations(ENMCoreV3);
var ENMAnalyzeEngine = new Augmentation("Embedded Netburner Module Analyze Engine");
ENMAnalyzeEngine.setRequirements(1250000, 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%.");
ENMAnalyzeEngine.addToFactions(["ECorp", "MegaCorp", "Fulcrum Secret Technologies", "NWO",
"Daedalus", "The Covenant", "Illuminati"]);
AddToAugmentations(ENMAnalyzeEngine);
var ENMDMA = new Augmentation("Embedded Netburner Module Direct Memory Access Upgrade");
ENMDMA.setRequirements(1350000, 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" +
"This augmentation: \n" +
"Increases the amount of money the player gains from hacking by 50%\n" +
"Increases the player's chance of successfully performing a hack by 20%");
ENMDMA.addToFactions(["ECorp", "MegaCorp", "Fulcrum Secret Technologies", "NWO",
"Daedalus", "The Covenant", "Illuminati"]);
AddToAugmentations(ENMDMA);
var Neuralstimulator = new Augmentation("Neuralstimulator");
Neuralstimulator.setRequirements(500000, 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" +
"Increases the player's hacking speed by 1%\n" +
"Increases the player's chance of successfully performing a hack by 10%\n" +
"Increases the player's hacking experience gain rate by 20%");
Neuralstimulator.addToFactions(["The Black Hand", "Chongqing", "Sector-12", "New Tokyo", "Aevum",
"Ishima", "Volhaven", "Bachman & Associates", "Clarke Incorporated",
"Four Sigma"]);
AddToAugmentations(Neuralstimulator);
//Work Augmentations
var NuoptimalInjectorImplant = new Augmentation("Nuoptimal Nootropic Injector Implant");
NuoptimalInjectorImplant.setRequirements(100000, 90000000);
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" +
"This augmentation increases the amount of reputation the player gains \n" +
"when working for a company by 10%.");
NuoptimalInjectorImplant.addToFactions(["Tian Di Hui", "Volhaven", "New Tokyo", "Chongqing", "Ishima",
"Clarke Incorporated", "Four Sigma", "Bachman & Associates"]);
AddToAugmentations(NuoptimalInjectorImplant);
var SpeechEnhancement = new Augmentation("Speech Enhancement");
SpeechEnhancement.setRequirements(50000, 45000000);
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" +
"This augmentation:\n" +
"Increases the player's charisma by 5%\n" +
"Increases the amount of reputation the player gains when working for a company by 5%");
SpeechEnhancement.addToFactions(["Tian Di Hui", "Speakers for the Dead", "Four Sigma", "KuaiGong International",
"Clarke Incorporated", "Four Sigma", "Bachman & Associates"]);
AddToAugmentations(SpeechEnhancement);
var FocusWire = new Augmentation("FocusWire"); //Stops procrastination
FocusWire.setRequirements(400000, 350000000);
FocusWire.setInfo("A cranial implant that stops procrastination by blocking specific neural pathways\n" +
"in the brain.\n\n" +
"This augmentation: \n" +
"Increases all experience gains by 10%\n" +
"Increases the amount of money the player gains from working by 5%\n" +
"Increases the amount of reputation the player gains when working for a company by 5%");
FocusWire.addToFactions(["Bachman & Associates", "Clarke Incorporated", "Four Sigma", "KuaiGong International"]);
AddToAugmentations(FocusWire)
var PCDNI = new Augmentation("PC Direct-Neural Interface");
PCDNI.setRequirements(750000, 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" +
"This augmentation:\n" +
"Increases the amount of reputation the player gains when working for a company by 10%\n" +
"Increases the player's hacking skill by 10%");
PCDNI.addToFactions(["Four Sigma", "OmniTek Incorporated", "ECorp", "Blade Industries"]);
AddToAugmentations(PCDNI);
var PCDNIOptimizer = new Augmentation("PC Direct-Neural Interface Optimization Submodule");
PCDNIOptimizer.setRequirements(1000000, 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" +
"This augmentation:\n" +
"Increases the amount of reputation the player gains when working for a company by 20%\n" +
"Increases the player's hacking skill by 20%");
PCDNIOptimizer.addToFactions(["Fulcrum Secret Technologies", "ECorp", "Blade Industries"]);
AddToAugmentations(PCDNIOptimizer);
var PCDNINeuralNetwork = new Augmentation("PC Direct-Neural Interface NeuroNet Injector");
PCDNINeuralNetwork.setRequirements(1200000, 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" +
"processing power to aid the computer in computational tasks.\n\n" +
"This augmentation:\n" +
"Increases the amount of reputation the player gains when working for a company by 10%\n" +
"Increases the player's hacking skill by 10%\n" +
"Increases the player's hacking speed by 2%");
PCDNINeuralNetwork.addToFactions(["Fulcrum Secret Technologies"]);
AddToAugmentations(PCDNINeuralNetwork);
//Misc augmentations
var Neurotrainer1 = new Augmentation("Neurotrainer I");
Neurotrainer1.setRequirements(50000, 35000000);
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" +
"and retrieve information.\n\n" +
"This augmentation increases the player's experience gain rate for all stats by 5%");
Neurotrainer1.addToFactions(["CyberSec"]);
AddToAugmentations(Neurotrainer1);
var Neurotrainer2 = new Augmentation("Neurotrainer II");
Neurotrainer2.setRequirements(300000, 150000000);
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" +
"This augmentation increases the player's experience gain rate for all stats by 10%");
Neurotrainer2.addToFactions(["BitRunners", "NiteSec"]);
AddToAugmentations(Neurotrainer2);
var Neurotrainer3 = new Augmentation("Neurotrainer III");
Neurotrainer3.setRequirements(900000, 725000000);
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" +
"This augmentation increases the player's experience gain rate for all stats by 20%");
Neurotrainer3.addToFactions(["NWO", "Four Sigma"]);
AddToAugmentations(Neurotrainer3);
var Hypersight = new Augmentation("HyperSight Corneal Implant");
Hypersight.setInfo("A bionic eye implant that grants sight capabilities far beyond those of a natural human.\n" +
"Embedded circuitry within the implant provides the ability to detect heat and movement\n" +
"through solid objects such as wells, thus providing 'x-ray vision'-like capabilities.\n\n" +
"This augmentation: \n" +
"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.addToFactions(["Blade Industries", "KuaiGong International"]);
AddToAugmentations(Hypersight);
}
applyAugmentation = function(aug, faction) {
if (aug.owned) {
throw new Error("This Augmentation is already owned/applied...somethings wrong");
return;
}
switch(aug.name) {
//Combat stat augmentations
case "Augmented Targeting I":
Player.dexterity_mult *= 1.1;
break;
case "Augmented Targeting II":
Player.dexterity_mult *= 1.2;
break;
case "Augmented Targeting III":
Player.dexterity_mult *= 1.5;
break;
case "Synthetic Heart": //High level
Player.agility_mult *= 2.0;
Player.strength_mult *= 2.0;
break;
case "Synfibril Muscle": //Medium-high level
Player.strength_mult *= 1.5;
Player.defense_mult *= 1.5;
break;
case "Combat Rib I":
//Str and Defense 5%
Player.strength_mult *= 1.1;
Player.defense_mult *= 1.1;
break;
case "Combat Rib II":
Player.strength_mult *= 1.2;
Player.defense_mult *= 1.2;
break;
case "Combat Rib III":
Player.strength_mult *= 1.3;
Player.defense_mult *= 1.3;
break;
case "Nanofiber Weave": //Med level
Player.strength_mult *= 1.3;
Player.defense_mult *= 1.3;
break;
case "NEMEAN Subdermal Weave": //High level
Player.defense_mult *= 2.5;
break;
case "Wired Reflexes": //Low level
Player.agility_mult *= 1.05;
break;
case "Graphene Bone Lacings": //High level
Player.strength_mult *= 2;
Player.defense_mult *= 2;
break;
case "Bionic Spine": //Med level
Player.strength_mult *= 1.2;
Player.defense_mult *= 1.2;
Player.agility_mult *= 1.2;
Player.dexterity_mult *= 1.2;
break;
case "Graphene Bionic Spine Upgrade": //High level
Player.strength_mult *= 2;
Player.defense_mult *= 2;
Player.agility_mult *= 2;
Player.dexterity_mult *= 2;
break;
case "Bionic Legs": //Med level
Player.agility_mult *= 1.5;
break;
case "Graphene Bionic Legs Upgrade": //High level
player.agility_mult *= 3.0;
break;
//Labor stats augmentations
case "Enhanced Social Interaction Implant": //Med-high level
Player.charisma_mult *= 1.5;
Player.charisma_exp_mult *= 1.5;
break;
case "Speech Processor Implant": //Med level
Player.charisma_mult *= 1.2;
break;
//Hacking augmentations
case "Artificial Bio-neural Network Implant": //Med level
Player.hacking_speed_mult *= .98;
Player.hacking_money_mult *= 1.1;
Player.hacking_mult *= 1.1;
break;
case "Artificial Synaptic Potentiation": //Med level
Player.hacking_speed_mult *= .99;
Player.hacking_chance_mult *= 1.01;
break;
case "Enhanced Myelin Sheathing": //Med level
Player.hacking_speed_mult *= .99;
Player.hacking_exp_mult *= 1.05;
Player.hacking_mult *= 1.05;
break;
case "Synaptic Enhancement Implant": //Low Level
Player.hacking_speed_mult *= .99;
break;
case "Neural-Retention Enhancement": //Med level
Player.hacking_exp_mult *= 1.4;
break;
case "DataJack": //Med low level
Player.hacking_money_mult *= 1.2;
break;
case "Embedded Netburner Module": //Medium level
Player.hacking_mult *= 1.01;
break;
case "Embedded Netburner Module Core Implant": //Medium level
Player.hacking_speed_mult *= .98;
Player.hacking_money_mult *= 1.1;
Player.hacking_chance_mult *= 1.02;
Player.hacking_exp_mult *= 1.1;
Player.hacking_mult *= 1.01;
break;
case "Embedded Netburner Module Core V2 Upgrade": //Medium high level
Player.hacking_speed_mult *= .95;
Player.hacking_money_mult *= 1.5;
Player.hacking_chance_mult *= 1.05;
Player.hacking_exp_mult *= 1.5;
Player.hacking_mult *= 1.05;
break;
case "Embedded Netburner Module Core V3 Upgrade": //High level
Player.hacking_speed_mult *= .95;
Player.hacking_money_mult *= 1.5;
Player.hacking_chance_mult *= 1.1;
Player.hacking_exp_mult *= 2.0;
Player.hacking_mult *= 1.1;
break;
case "Embedded Netburner Module Analyze Engine": //High level
//Hacking speed 20% - High level
Player.hacking_speed_mult *= 0.9;
break;
case "Embedded Netburner Module Direct Memory Access Upgrade": //High level
//Money hacked 20% - High level
Player.hacking_money_mult *= 1.5;
Player.hacking_chance_mult *= 1.2;
break;
case "Neuralstimulator": //Medium Level
Player.hacking_speed_mult *= .99;
Player.hacking_chance_mult *= 1.1;
Player.hacking_exp_mult *= 1.2;
break;
//Work augmentations
case "Nuoptimal Nootropic Injector Implant": //Low medium level
Player.company_rep_mult *= 1.1;
break;
case "Speech Enhancement": //Low level
Player.company_rep_mult *= 1.05;
Player.charisma_mult *= 1.05;
break;
case "FocusWire": //Med level
Player.hacking_exp_mult *= 1.1;
Player.strength_exp_mult *= 1.1;
Player.defense_exp_mult *= 1.1;
Player.dexterity_exp_mult *= 1.1;
Player.agility_exp_mult *= 1.1;
Player.charisma_exp_mult *= 1.1;
Player.company_rep_mult *= 1.05;
Player.work_money_mult *= 1.05;
break;
case "PC Direct-Neural Interface": //Med level
Player.company_rep_mult *= 1.1;
Player.hacking_mult *= 1.1;
break;
case "PC Direct-Neural Interface Optimization Submodule": //High level
//Allows u to better optimize code/pc when connecting with PC DNI..helps with software/IT jobs
Player.company_rep_mult *= 1.2;
Player.hacking_mult *= 1.2;
break;
case "PC Direct-Neural Interface NeuroNet Injector": //High level
Player.company_rep_mult *= 1.1;
Player.hacking_mult *= 1.1;
Player.hacking_speed_mult *= .98;
break;
//Misc augmentations
case "Neurotrainer I": //Low Level
Player.hacking_exp_mult *= 1.05;
Player.strength_exp_mult *= 1.05;
Player.defense_exp_mult *= 1.05;
Player.dexterity_exp_mult *= 1.05;
Player.agility_exp_mult *= 1.05;
this.charisma_exp_mult *= 1.05;
break;
case "Neurotrainer II": //Medium level
Player.hacking_exp_mult *= 1.1;
Player.strength_exp_mult *= 1.1;
Player.defense_exp_mult *= 1.1;
Player.dexterity_exp_mult *= 1.1;
Player.agility_exp_mult *= 1.1;
Player.charisma_exp_mult *= 1.1;
break;
case "Neurotrainer III": //High Level
Player.hacking_exp_mult *= 1.2;
Player.strength_exp_mult *= 1.2;
Player.defense_exp_mult *= 1.2;
Player.dexterity_exp_mult *= 1.2;
Player.agility_exp_mult *= 1.2;
Player.charisma_exp_mult *= 1.2;
break;
case "HyperSight Corneal Implant": //Medium high level
Player.dexterity_mult *= 1.5;
Player.hacking_speed_mult *= .99;
Player.hacking_money_mult *= 1.1;
break;
default:
console.log("ERROR: No such augmentation!");
return;
}
aug.owned = true;
aug.factionInstalledBy = faction.name;
Player.augmentations.push(aug.name);
++Player.numAugmentations;
}

873
src/Company.js Normal file

@ -0,0 +1,873 @@
//Netburner Company class
// Note: Company Positions can be loaded every time with init() but Company class needs
// to be saved/loaded from localStorage
function Company() {
this.companyName = "";
this.info = "";
this.companyPositions = []; //Names (only name, not object) of all company positions
this.perks = []; //Available Perks
this.salaryMultiplier = 1; //Multiplier for base salary
this.expMultiplier = 1; //Multiplier for base exp gain
//The additional levels you need in the relevant stat to qualify for a job.
//E.g the offset for a megacorporation will be high, let's say 200, so the
//stat level you'd need to get an intern job would be 200 instead of 1.
this.jobStatReqOffset = 1;
//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
};
Company.prototype.init = function(name, salaryMult, expMult, jobStatReqOffset) {
this.companyName = name;
this.salaryMultiplier = salaryMult;
this.expMultiplier = expMult;
this.jobStatReqOffset = jobStatReqOffset;
}
Company.prototype.setInfo = function(inf) {
this.info = inf;
}
Company.prototype.addPosition = function(pos) {
this.companyPositions.push(pos.positionName); //Company object holds only name of positions
}
Company.prototype.addPositions = function(positions) {
for (var i = 0; i < positions.length; i++) {
this.addPosition(positions[i]);
}
}
Company.prototype.hasPosition = function(pos) {
for (var i = 0; i < this.companyPositions.length; ++i) {
if (pos.name == this.companyPositions[i]) {
return true;
}
}
return false;
}
Company.prototype.toJSON = function() {
return Generic_toJSON("Company", this);
}
Company.fromJSON = function(value) {
return Generic_fromJSON(Company, value.data);
}
Reviver.constructors.Company = Company;
//Object that defines a position within a Company and its requirements
function CompanyPosition(name, reqHack, reqStr, reqDef, reqDex, reqAgi, reqCha, reqRep, salary) {
this.positionName = name;
this.requiredHacking = reqHack;
this.requiredStrength = reqStr;
this.requiredDefense = reqDef;
this.requiredDexterity = reqDex;
this.requiredAgility = reqAgi;
this.requiredCharisma = reqCha;
this.requiredReputation = reqRep;
//Base salary for a position. This will be multiplied by a company-specific multiplier. Better companies will have
//higher multipliers.
//
//NOTE: This salary denotes the $ gained every loop (200 ms)
this.baseSalary = salary;
};
//Set the parameters that are used to determine how good/effective the Player is at a job.
//The Player's "effectiveness" at a job determines how much reputation he gains when he works
//
//NOTE: These parameters should total to 100, such that each parameter represents a "weighting" of how
// important that stat/skill is for the job
CompanyPosition.prototype.setPerformanceParameters = function(hackEff, strEff, defEff, dexEff, agiEff, chaEff) {
if (hackEff + strEff + defEff + dexEff + agiEff + chaEff != 100) {
console.log("CompanyPosition.setPerformanceParameters() arguments do not total to 100");
return;
}
this.hackingEffectiveness = hackEff;
this.strengthEffectiveness = strEff;
this.defenseEffectiveness = defEff;
this.dexterityEffectiveness = dexEff;
this.agilityEffectiveness = agiEff;
this.charismaEffectiveness = chaEff;
}
//Set the stat/skill experience a Player should gain for working at a CompanyPosition. The experience is per game loop (200 ms)
//These will be constant for a single position, but is affected by a company-specific multiplier
CompanyPosition.prototype.setExperienceGains = function(hack, str, def, dex, agi, cha) {
this.hackingExpGain = hack;
this.strengthExpGain = str;
this.defenseExpGain = def;
this.dexterityExpGain = dex;
this.agilityExpGain = agi;
this.charismaExpGain = cha;
}
//Calculate a player's effectiveness at a certain job. Returns the amount of job reputation
//that should be gained every game loop (200 ms)
CompanyPosition.prototype.calculateJobPerformance = function(hacking, str, def, dex, agi, cha) {
var hackRatio = this.hackingEffectiveness * hacking / CONSTANTS.MaxSkillLevel;
var strRatio = this.strengthEffectiveness * str / CONSTANTS.MaxSkillLevel;
var defRatio = this.defenseEffectiveness * def / CONSTANTS.MaxSkillLevel;
var dexRatio = this.dexterityEffectiveness * dex / CONSTANTS.MaxSkillLevel;
var agiRatio = this.agilityEffectiveness * agi / CONSTANTS.MaxSkillLevel;
var chaRatio = this.charismaEffectiveness * cha / CONSTANTS.MaxSkillLevel;
return (hackRatio + strRatio + defRatio + dexRatio + agiRatio + chaRatio) / 100;
}
CompanyPosition.prototype.isSoftwareJob = function() {
if (this.positionName == "Software Engineering Intern" ||
this.positionName == "Junior Software Engineer" ||
this.positionName == "Senior Software Engineer" ||
this.positionName == "Lead Software Developer" ||
this.positionName == "Head of Software" ||
this.positionName == "Head of Engineering" ||
this.positionName == "Vice President of Technology" ||
this.positionName == "Chief Technology Officer") {
return true;
}
return false;
}
CompanyPosition.prototype.isITJob = function() {
if (this.positionName == "IT Intern" ||
this.positionName == "IT Analyst" ||
this.positionName == "IT Manager" ||
this.positionName == "Systems Administrator") {
return true;
}
return false;
}
CompanyPosition.prototype.isSecurityEngineerJob = function() {
if (this.positionName == "Security Engineer") {
return true;
}
return false;
}
CompanyPosition.prototype.isNetworkEngineerJob = function() {
if (this.positionName == "Network Engineer" || this.positionName == "Network Administrator") {
return true;
}
return false;
}
CompanyPosition.prototype.isBusinessJob = function() {
if (this.positionName == "Business Intern" ||
this.positionName == "Business Analyst" ||
this.positionName == "Business Manager" ||
this.positionName == "Operations Manager" ||
this.positionName == "Chief Financial Officer" ||
this.positionName == "Chief Executive Officer") {
return true;
}
return false;
}
CompanyPosition.prototype.isSecurityJob = function() {
if (this.positionName == "Security Guard" ||
this.positionName == "Police Officer" ||
this.positionName == "Security Officer" ||
this.positionName == "Security Supervisor" ||
this.positionName == "Head of Security") {
return true;
}
return false;
}
CompanyPosition.prototype.isAgentJob = function() {
if (this.positionName == "Field Agent" ||
this.positionName == "Secret Agent" ||
this.positionName == "Special Operative") {
return true;
}
return false;
}
CompanyPosition.prototype.toJSON = function() {
return Generic_toJSON("CompanyPosition", this);
}
CompanyPosition.fromJSON = function(value) {
return Generic_fromJSON(CompanyPosition, value.data);
}
Reviver.constructors.CompanyPosition = CompanyPosition;
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),
//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),
//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),
//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),
//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),
init: function() {
//Argument order: hack, str, def, dex, agi, cha
//Software
CompanyPositions.SoftwareIntern.setPerformanceParameters(90, 0, 0, 0, 0, 10);
CompanyPositions.SoftwareIntern.setExperienceGains(.1, 0, 0, 0, 0, .02);
CompanyPositions.JuniorDev.setPerformanceParameters(85, 0, 0, 0, 0, 15);
CompanyPositions.JuniorDev.setExperienceGains(.2, 0, 0, 0, 0, .04);
CompanyPositions.SeniorDev.setPerformanceParameters(75, 0, 0, 0, 0, 25);
CompanyPositions.SeniorDev.setExperienceGains(.4, 0, 0, 0, 0, .08);
CompanyPositions.LeadDev.setPerformanceParameters(70, 0, 0, 0, 0, 30);
CompanyPositions.LeadDev.setExperienceGains(.5, 0, 0, 0, 0, .1);
//Security
CompanyPositions.ITIntern.setPerformanceParameters(90, 0, 0, 0, 0, 10);
CompanyPositions.ITIntern.setExperienceGains(.05, 0, 0, 0, 0, .01);
CompanyPositions.ITAnalyst.setPerformanceParameters(85, 0, 0, 0, 0, 15);
CompanyPositions.ITAnalyst.setExperienceGains(.15, 0, 0, 0, 0, .02);
CompanyPositions.ITManager.setPerformanceParameters(75, 0, 0, 0, 0, 25);
CompanyPositions.ITManager.setExperienceGains(.4, 0, 0, 0, 0, .1);
CompanyPositions.SysAdmin.setPerformanceParameters(80, 0, 0, 0, 0, 20);
CompanyPositions.SysAdmin.setExperienceGains(.5, 0, 0, 0, 0, .05);
CompanyPositions.SecurityEngineer.setPerformanceParameters(85, 0, 0, 0, 0, 15);
CompanyPositions.SecurityEngineer.setExperienceGains(0.4, 0, 0, 0, 0, .05);
CompanyPositions.NetworkEngineer.setPerformanceParameters(85, 0, 0, 0, 0, 15);
CompanyPositions.NetworkEngineer.setExperienceGains(0.4, 0, 0, 0, 0, .05);
CompanyPositions.NetworkAdministrator.setPerformanceParameters(75, 0, 0, 0, 0, 25);
CompanyPositions.NetworkAdministrator.setExperienceGains(0.5, 0, 0, 0, 0, .1);
//Technology management
CompanyPositions.HeadOfSoftware.setPerformanceParameters(65, 0, 0, 0, 0, 35);
CompanyPositions.HeadOfSoftware.setExperienceGains(1, 0, 0, 0, 0, .5);
CompanyPositions.HeadOfEngineering.setPerformanceParameters(60, 0, 0, 0, 0, 40);
CompanyPositions.HeadOfEngineering.setExperienceGains(1.1, 0, 0, 0, 0, .5);
CompanyPositions.VicePresident.setPerformanceParameters(60, 0, 0, 0, 0, 40);
CompanyPositions.VicePresident.setExperienceGains(1.2, 0, 0, 0, 0, .6);
CompanyPositions.CTO.setPerformanceParameters(50, 0, 0, 0, 0, 50);
CompanyPositions.CTO.setExperienceGains(1.5, 0, 0, 0, 1);
//Business
CompanyPositions.BusinessIntern.setPerformanceParameters(10, 0, 0, 0, 0, 90);
CompanyPositions.BusinessIntern.setExperienceGains(.01, 0, 0, 0, 0, .1);
CompanyPositions.BusinessAnalyst.setPerformanceParameters(20, 0, 0, 0, 0, 80);
CompanyPositions.BusinessAnalyst.setExperienceGains(.02, 0, 0, 0, 0, .2);
CompanyPositions.BusinessManager.setPerformanceParameters(15, 0, 0, 0, 0, 85);
CompanyPositions.BusinessManager.setExperienceGains(.02, 0, 0, 0, 0, .4);
CompanyPositions.OperationsManager.setPerformanceParameters(15, 0, 0, 0, 0, 85);
CompanyPositions.OperationsManager.setExperienceGains(.02, 0, 0, 0, 0, .4);
CompanyPositions.CFO.setPerformanceParameters(10, 0, 0, 0, 0, 90);
CompanyPositions.CFO.setExperienceGains(.05, 0, 0, 0, 0, 1);
CompanyPositions.CEO.setPerformanceParameters(10, 0, 0, 0, 0, 90);
CompanyPositions.CEO.setExperienceGains(.1, 0, 0, 0, 0, 1.5);
//Non-tech/management jobs
//TODO These parameters might need to be balanced
CompanyPositions.Waiter.setPerformanceParameters(0, 10, 0, 10, 10, 70);
CompanyPositions.Waiter.setExperienceGains(0, .01, .01, .01, .01, .05);
CompanyPositions.Employee.setPerformanceParameters(0, 10, 0, 10, 10, 70);
CompanyPositions.Employee.setExperienceGains(0, .01, .01, .01, .01, .015);
CompanyPositions.SecurityGuard.setPerformanceParameters(5, 20, 20, 20, 20, 15);
CompanyPositions.SecurityGuard.setExperienceGains(.01, .02, .02, .02, .02, .01);
CompanyPositions.PoliceOfficer.setPerformanceParameters(5, 20, 20, 20, 20, 15);
CompanyPositions.PoliceOfficer.setExperienceGains(.01, .04, .04, .04, .04, .02);
CompanyPositions.PoliceChief.setPerformanceParameters(5, 20, 20, 20, 20, 15);
CompanyPositions.PoliceChief.setExperienceGains(.02, .06, .06, .06, .06, .05);
CompanyPositions.SecurityOfficer.setPerformanceParameters(10, 20, 20, 20, 20, 10);
CompanyPositions.SecurityOfficer.setExperienceGains(.02, .06, .06, .06, .06, .04);
CompanyPositions.SecuritySupervisor.setPerformanceParameters(10, 15, 15, 15, 15, 30);
CompanyPositions.SecuritySupervisor.setExperienceGains(.02, .06, .06, .06, .06, .08);
CompanyPositions.HeadOfSecurity.setPerformanceParameters(10, 15, 15, 15, 15, 30);
CompanyPositions.HeadOfSecurity.setExperienceGains(.05, .1, .1, .1, .1, .1);
CompanyPositions.FieldAgent.setPerformanceParameters(10, 15, 15, 20, 20, 20);
CompanyPositions.FieldAgent.setExperienceGains(.04, .06, .06, .06, .06, .04);
CompanyPositions.SecretAgent.setPerformanceParameters(15, 15, 15, 20, 20, 15);
CompanyPositions.SecretAgent.setExperienceGains(.08, .1, .1, .1, .1, .08);
CompanyPositions.SpecialOperative.setPerformanceParameters(15, 15, 15, 20, 20, 15);
CompanyPositions.SpecialOperative.setExperienceGains(.12, .15, .15, .15, .15, .12);
}
}
//Returns the next highest position in the company for the relevant career/field
//I.E returns what your next job would be if you qualify for a promotion
getNextCompanyPosition = function(currPos) {
//Software
if (currPos.positionName == CompanyPositions.SoftwareIntern.positionName) {
return CompanyPositions.JuniorDev;
}
if (currPos.positionName == CompanyPositions.JuniorDev.positionName) {
return CompanyPositions.SeniorDev;
}
if (currPos.positionName == CompanyPositions.SeniorDev.positionName) {
return CompanyPositions.LeadDev;
}
if (currPos.positionName == CompanyPositions.LeadDev.positionname) {
return CompanyPositions.HeadOfSoftware;
}
//IT
if (currPos.positionName == CompanyPositions.ITIntern.positionName) {
return CompanyPositions.ITAnalyst;
}
if (currPos.positionName == CompanyPositions.ITAnalyst.positionName) {
return CompanyPositions.ITManager;
}
if (currPos.positionName == CompanyPositions.ITManager.positionName) {
return CompanyPositions.SysAdmin;
}
if (currPos.positionName == CompanyPositions.SysAdmin.positionName) {
return CompanyPositions.HeadOfEngineering;
}
//Security/Network Engineer
if (currPos.positionName == CompanyPositions.SecurityEngineer.positionName) {
return CompanyPositions.HeadOfEngineering;
}
if (currPos.positionName == CompanyPositions.NetworkEngineer.positionName) {
return CompanyPositions.NetworkAdministrator;
}
if (currPos.positionName == CompanyPositions.NetworkAdministrator.positionName) {
return CompanyPositions.HeadOfEngineering;
}
//Technology management
if (currPos.positionName == CompanyPositions.HeadOfSoftware.positionName) {
return CompanyPositions.HeadOfEngineering;
}
if (currPos.positionName == CompanyPositions.HeadOfEngineering.positionName) {
return CompanyPositions.VicePresident;
}
if (currPos.positionName == CompanyPositions.VicePresident.positionName) {
return CompanyPositions.CTO;
}
//Business
if (currPos.positionName == CompanyPositions.BusinessIntern.positionName) {
return CompanyPositions.BusinessAnalyst;
}
if (currPos.positionName == CompanyPositions.BusinessAnalyst.positionName) {
return CompanyPositions.BusinessManager;
}
if (currPos.positionName == CompanyPositions.BusinessManager.positionName) {
return CompanyPositions.OperationsManager;
}
if (currPos.positionName == CompanyPositions.OperationsManager.positionName) {
return CompanyPositions.CFO;
}
if (currPos.positionName == CompanyPositions.CFO.positionName) {
return CompanyPositions.CEO;
}
//Police
if (currPos.positionName == CompanyPositions.PoliceOffier.positionName) {
return CompanyPositions.PoliceChief;
}
//Security
if (currPos.positionName == CompanyPositions.SecurityGuard.positionName) {
return CompanyPositions.SecurityOfficer;
}
if (currPos.positionName == CompanyPositions.SecurityOfficer.positionName) {
return CompanyPositions.SecuritySupervisor;
}
if (currPos.positionName == CompanyPositions.SecuritySupervisor.positionName) {
return CompanyPositions.HeadOfSecurity;
}
//Agent
if (currPos.positionName == CompanyPositions.FieldAgent.positionName) {
return CompanyPositions.SecretAgent;
}
if (currPos.positionName == CompanyPositions.SecretAgent.positionName) {
return CompanyPositions.SpecialOperative;
}
return null;
}
/* Initialize all companies. Only called when creating new game. Otherwise companies are
* usually loaded from localStorage */
initCompanies = function() {
/* Companies that also have servers */
//Megacorporations
var ECorp = new Company();
ECorp.init(Locations.AevumECorp, 3.0, 3.0, 250);
ECorp.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.ITIntern, CompanyPositions.BusinessIntern,
CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, CompanyPositions.LeadDev,
CompanyPositions.ITAnalyst, CompanyPositions.ITManager, CompanyPositions.SysAdmin,
CompanyPositions.SecurityEngineer, CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator,
CompanyPositions.HeadOfSoftware, CompanyPositions.HeadOfEngineering,
CompanyPositions.VicePresident, CompanyPositions.CTO, CompanyPositions.BusinessAnalyst,
CompanyPositions.BusinessManager, CompanyPositions.OperationsManager, CompanyPositions.CFO,
CompanyPositions.CEO, CompanyPositions.SecurityGuard, CompanyPositions.SecurityOfficer,
CompanyPositions.SecuritySupervisor, CompanyPositions.HeadOfSecurity]);
AddToCompanies(ECorp);
var MegaCorp = new Company();
MegaCorp.init(Locations.Sector12MegaCorp, 3.0, 3.0, 250);
MegaCorp.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.ITIntern, CompanyPositions.BusinessIntern,
CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, CompanyPositions.LeadDev,
CompanyPositions.ITAnalyst, CompanyPositions.ITManager, CompanyPositions.SysAdmin,
CompanyPositions.SecurityEngineer, CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator,
CompanyPositions.HeadOfSoftware, CompanyPositions.HeadOfEngineering,
CompanyPositions.VicePresident, CompanyPositions.CTO, CompanyPositions.BusinessAnalyst,
CompanyPositions.BusinessManager, CompanyPositions.OperationsManager, CompanyPositions.CFO,
CompanyPositions.CEO, CompanyPositions.SecurityGuard, CompanyPositions.SecurityOfficer,
CompanyPositions.SecuritySupervisor, CompanyPositions.HeadOfSecurity]);
AddToCompanies(MegaCorp);
var BachmanAndAssociates = new Company();
BachmanAndAssociates.init(Locations.AevumBachmanAndAssociates, 2.6, 2.6, 225);
BachmanAndAssociates.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.ITIntern, CompanyPositions.BusinessIntern,
CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, CompanyPositions.LeadDev,
CompanyPositions.ITAnalyst, CompanyPositions.ITManager, CompanyPositions.SysAdmin,
CompanyPositions.SecurityEngineer, CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator,
CompanyPositions.HeadOfSoftware, CompanyPositions.HeadOfEngineering,
CompanyPositions.VicePresident, CompanyPositions.CTO, CompanyPositions.BusinessAnalyst,
CompanyPositions.BusinessManager, CompanyPositions.OperationsManager, CompanyPositions.CFO,
CompanyPositions.CEO, CompanyPositions.SecurityGuard, CompanyPositions.SecurityOfficer,
CompanyPositions.SecuritySupervisor, CompanyPositions.HeadOfSecurity]);
AddToCompanies(BachmanAndAssociates);
var BladeIndustries = new Company();
BladeIndustries.init(Locations.Sector12BladeIndustries, 2.75, 2.75, 225);
BladeIndustries.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.ITIntern, CompanyPositions.BusinessIntern,
CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, CompanyPositions.LeadDev,
CompanyPositions.ITAnalyst, CompanyPositions.ITManager, CompanyPositions.SysAdmin,
CompanyPositions.SecurityEngineer, CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator,
CompanyPositions.HeadOfSoftware, CompanyPositions.HeadOfEngineering,
CompanyPositions.VicePresident, CompanyPositions.CTO, CompanyPositions.BusinessAnalyst,
CompanyPositions.BusinessManager, CompanyPositions.OperationsManager, CompanyPositions.CFO,
CompanyPositions.CEO, CompanyPositions.SecurityGuard, CompanyPositions.SecurityOfficer,
CompanyPositions.SecuritySupervisor, CompanyPositions.HeadOfSecurity]);
AddToCompanies(BladeIndustries);
var NWO = new Company();
NWO.init(Locations.VolhavenNWO, 2.75, 2.75, 250);
NWO.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.ITIntern, CompanyPositions.BusinessIntern,
CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, CompanyPositions.LeadDev,
CompanyPositions.ITAnalyst, CompanyPositions.ITManager, CompanyPositions.SysAdmin,
CompanyPositions.SecurityEngineer, CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator,
CompanyPositions.HeadOfSoftware, CompanyPositions.HeadOfEngineering,
CompanyPositions.VicePresident, CompanyPositions.CTO, CompanyPositions.BusinessAnalyst,
CompanyPositions.BusinessManager, CompanyPositions.OperationsManager, CompanyPositions.CFO,
CompanyPositions.CEO, CompanyPositions.SecurityGuard, CompanyPositions.SecurityOfficer,
CompanyPositions.SecuritySupervisor, CompanyPositions.HeadOfSecurity]);
AddToCompanies(NWO);
var ClarkeIncorporated = new Company();
ClarkeIncorporated.init(Locations.AevumClarkeIncorporated, 2.25, 2.25, 225);
ClarkeIncorporated.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.ITIntern, CompanyPositions.BusinessIntern,
CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, CompanyPositions.LeadDev,
CompanyPositions.ITAnalyst, CompanyPositions.ITManager, CompanyPositions.SysAdmin,
CompanyPositions.SecurityEngineer, CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator,
CompanyPositions.HeadOfSoftware, CompanyPositions.HeadOfEngineering,
CompanyPositions.VicePresident, CompanyPositions.CTO, CompanyPositions.BusinessAnalyst,
CompanyPositions.BusinessManager, CompanyPositions.OperationsManager, CompanyPositions.CFO,
CompanyPositions.CEO, CompanyPositions.SecurityGuard, CompanyPositions.SecurityOfficer,
CompanyPositions.SecuritySupervisor, CompanyPositions.HeadOfSecurity]);
AddToCompanies(ClarkeIncorporated);
var OmniTekIncorporated = new Company();
OmniTekIncorporated.init(Locations.VolhavenOmniTekIncorporated, 2.25, 2.25, 225);
OmniTekIncorporated.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.ITIntern, CompanyPositions.BusinessIntern,
CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, CompanyPositions.LeadDev,
CompanyPositions.ITAnalyst, CompanyPositions.ITManager, CompanyPositions.SysAdmin,
CompanyPositions.SecurityEngineer, CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator,
CompanyPositions.HeadOfSoftware, CompanyPositions.HeadOfEngineering,
CompanyPositions.VicePresident, CompanyPositions.CTO, CompanyPositions.BusinessAnalyst,
CompanyPositions.BusinessManager, CompanyPositions.OperationsManager, CompanyPositions.CFO,
CompanyPositions.CEO, CompanyPositions.SecurityGuard, CompanyPositions.SecurityOfficer,
CompanyPositions.SecuritySupervisor, CompanyPositions.HeadOfSecurity]);
AddToCompanies(OmniTekIncorporated);
var FourSigma = new Company();
FourSigma.init(Locations.Sector12FourSigma, 2.5, 2.5, 225);
FourSigma.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.ITIntern, CompanyPositions.BusinessIntern,
CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, CompanyPositions.LeadDev,
CompanyPositions.ITAnalyst, CompanyPositions.ITManager, CompanyPositions.SysAdmin,
CompanyPositions.SecurityEngineer, CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator,
CompanyPositions.HeadOfSoftware, CompanyPositions.HeadOfEngineering,
CompanyPositions.VicePresident, CompanyPositions.CTO, CompanyPositions.BusinessAnalyst,
CompanyPositions.BusinessManager, CompanyPositions.OperationsManager, CompanyPositions.CFO,
CompanyPositions.CEO, CompanyPositions.SecurityGuard, CompanyPositions.SecurityOfficer,
CompanyPositions.SecuritySupervisor, CompanyPositions.HeadOfSecurity]);
AddToCompanies(FourSigma);
var KuaiGongInternational = new Company();
KuaiGongInternational.init(Locations.ChongqingKuaiGongInternational, 2.2, 2.2, 225);
KuaiGongInternational.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.ITIntern, CompanyPositions.BusinessIntern,
CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, CompanyPositions.LeadDev,
CompanyPositions.ITAnalyst, CompanyPositions.ITManager, CompanyPositions.SysAdmin,
CompanyPositions.SecurityEngineer, CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator,
CompanyPositions.HeadOfSoftware, CompanyPositions.HeadOfEngineering,
CompanyPositions.VicePresident, CompanyPositions.CTO, CompanyPositions.BusinessAnalyst,
CompanyPositions.BusinessManager, CompanyPositions.OperationsManager, CompanyPositions.CFO,
CompanyPositions.CEO, CompanyPositions.SecurityGuard, CompanyPositions.SecurityOfficer,
CompanyPositions.SecuritySupervisor, CompanyPositions.HeadOfSecurity]);
AddToCompanies(KuaiGongInternational);
//Technology and communication companies ("Large" servers)
var FulcrumTechnologies = new Company();
FulcrumTechnologies.init(Locations.AevumFulcrumTechnologies, 2.0, 2.0, 225);
FulcrumTechnologies.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.ITIntern, CompanyPositions.BusinessIntern,
CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, CompanyPositions.LeadDev,
CompanyPositions.ITAnalyst, CompanyPositions.ITManager, CompanyPositions.SysAdmin,
CompanyPositions.SecurityEngineer, CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator,
CompanyPositions.HeadOfSoftware, CompanyPositions.HeadOfEngineering,
CompanyPositions.VicePresident, CompanyPositions.CTO, CompanyPositions.BusinessAnalyst,
CompanyPositions.BusinessManager, CompanyPositions.OperationsManager, CompanyPositions.CFO,
CompanyPositions.CEO]);
AddToCompanies(FulcrumTechnologies);
var StormTechnologies = new Company();
StormTechnologies.init(Locations.IshimaStormTechnologies, 1.8, 1.8, 200);
StormTechnologies.addPositions([
CompanyPositions.SoftwareIntern,
CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, CompanyPositions.LeadDev,
CompanyPositions.ITAnalyst, CompanyPositions.ITManager, CompanyPositions.SysAdmin,
CompanyPositions.SecurityEngineer, CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator,
CompanyPositions.HeadOfSoftware, CompanyPositions.HeadOfEngineering,
CompanyPositions.VicePresident, CompanyPositions.CTO, CompanyPositions.BusinessAnalyst,
CompanyPositions.BusinessManager, CompanyPositions.OperationsManager, CompanyPositions.CFO,
CompanyPositions.CEO]);
AddToCompanies(StormTechnologies);
var DefComm = new Company();
DefComm.init(Locations.NewTokyoDefComm, 1.75, 1.75, 200);
DefComm.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,
CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst,
CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer,
CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware,
CompanyPositions.HeadOfEngineering, CompanyPositions.CTO, CompanyPositions.CFO, CompanyPositions.CEO]);
AddToCompanies(DefComm);
var HeliosLabs = new Company();
HeliosLabs.init(Locations.VolhavenHeliosLabs, 1.8, 1.8, 200);
HeliosLabs.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,
CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst,
CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer,
CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware,
CompanyPositions.HeadOfEngineering, CompanyPositions.CTO, CompanyPositions.CFO, CompanyPositions.CEO]);
AddToCompanies(HeliosLabs);
var VitaLife = new Company();
VitaLife.init(Locations.NewTokyoVitaLife, 1.8, 1.8, 200);
VitaLife.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,
CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst,
CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer,
CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware,
CompanyPositions.HeadOfEngineering, CompanyPositions.CTO, CompanyPositions.BusinessManager,
CompanyPositions.OperationsManager, CompanyPositions.CFO, CompanyPositions.CEO]);
AddToCompanies(VitaLife);
var IcarusMicrosystems = new Company();
IcarusMicrosystems.init(Locations.Sector12IcarusMicrosystems, 1.9, 1.9, 200);
IcarusMicrosystems.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,
CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst,
CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer,
CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware,
CompanyPositions.HeadOfEngineering, CompanyPositions.CTO, CompanyPositions.BusinessManager,
CompanyPositions.OperationsManager, CompanyPositions.CFO, CompanyPositions.CEO]);
AddToCompanies(IcarusMicrosystems);
var UniversalEnergy = new Company();
UniversalEnergy.init(Locations.Sector12UniversalEnergy, 2.0, 2.0, 200);
UniversalEnergy.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,
CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst,
CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer,
CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware,
CompanyPositions.HeadOfEngineering, CompanyPositions.CTO, CompanyPositions.BusinessManager,
CompanyPositions.OperationsManager, CompanyPositions.CFO, CompanyPositions.CEO]);
AddToCompanies(UniversalEnergy);
var GalacticCybersystems = new Company();
GalacticCybersystems.init(Locations.AevumGalacticCybersystems, 1.9, 1.9, 200);
GalacticCybersystems.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,
CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst,
CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer,
CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware,
CompanyPositions.HeadOfEngineering, CompanyPositions.CTO, CompanyPositions.BusinessManager,
CompanyPositions.OperationsManager, CompanyPositions.CFO, CompanyPositions.CEO]);
AddToCompanies(GalacticCybersystems);
//Defense Companies ("Large" Companies)
var AeroCorp = new Company();
AeroCorp.init(Locations.AevumAeroCorp, 1.7, 1.7, 200);
AeroCorp.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,
CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst,
CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer,
CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware,
CompanyPositions.HeadOfEngineering, CompanyPositions.CTO,
CompanyPositions.OperationsManager, CompanyPositions.CFO, CompanyPositions.CEO,
CompanyPositions.SecurityGuard, CompanyPositions.SecurityOfficer, CompanyPositions.SecuritySupervisor,
CompanyPositions.HeadOfSecurity]);
AddToCompanies(AeroCorp);
var OmniaCybersystems = new Company();
OmniaCybersystems.init(Locations.VolhavenOmniaCybersystems, 1.7, 1.7, 200);
OmniaCybersystems.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,
CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst,
CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer,
CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware,
CompanyPositions.HeadOfEngineering, CompanyPositions.CTO,
CompanyPositions.OperationsManager, CompanyPositions.CFO, CompanyPositions.CEO,
CompanyPositions.SecurityGuard, CompanyPositions.SecurityOfficer, CompanyPositions.SecuritySupervisor,
CompanyPositions.HeadOfSecurity]);
AddToCompanies(OmniaCybersystems);
var SolarisSpaceSystems = new Company();
SolarisSpaceSystems.init(Locations.ChongqingSolarisSpaceSystems, 1.7, 1.7, 200);
SolarisSpaceSystems.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,
CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst,
CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer,
CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware,
CompanyPositions.HeadOfEngineering, CompanyPositions.CTO,
CompanyPositions.OperationsManager, CompanyPositions.CFO, CompanyPositions.CEO,
CompanyPositions.SecurityGuard, CompanyPositions.SecurityOfficer, CompanyPositions.SecuritySupervisor,
CompanyPositions.HeadOfSecurity]);
AddToCompanies(SolarisSpaceSystems);
var DeltaOne = new Company();
DeltaOne.init(Locations.Sector12DeltaOne, 1.6, 1.6, 200);
DeltaOne.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,
CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst,
CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer,
CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware,
CompanyPositions.HeadOfEngineering, CompanyPositions.CTO,
CompanyPositions.OperationsManager, CompanyPositions.CFO, CompanyPositions.CEO,
CompanyPositions.SecurityGuard, CompanyPositions.SecurityOfficer, CompanyPositions.SecuritySupervisor,
CompanyPositions.HeadOfSecurity]);
AddToCompanies(DeltaOne);
//Health, medicine, pharmaceutical companies ("Large" servers)
var GlobalPharmaceuticals = new Company();
GlobalPharmaceuticals.init(Locations.NewTokyoGlobalPharmaceuticals, 1.8, 1.8, 225);
GlobalPharmaceuticals.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.ITIntern, CompanyPositions.BusinessIntern,
CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, CompanyPositions.LeadDev,
CompanyPositions.ITAnalyst, CompanyPositions.ITManager, CompanyPositions.SecurityEngineer,
CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator,
CompanyPositions.HeadOfSoftware, CompanyPositions.CTO, CompanyPositions.BusinessAnalyst,
CompanyPositions.BusinessManager, CompanyPositions.OperationsManager,
CompanyPositions.CFO, CompanyPositions.CEO, CompanyPositions.SecurityGuard,
CompanyPositions.SecuritySupervisor, CompanyPositions.HeadOfSecurity]);
AddToCompanies(GlobalPharmaceuticals);
var NovaMedical = new Company();
NovaMedical.init(Locations.IshimaNovaMedical, 1.75, 1.75, 200);
NovaMedical.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.ITIntern, CompanyPositions.BusinessIntern,
CompanyPositions.JuniorDev, CompanyPositions.SeniorDev, CompanyPositions.LeadDev,
CompanyPositions.ITAnalyst, CompanyPositions.ITManager, CompanyPositions.SecurityEngineer,
CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator,
CompanyPositions.HeadOfSoftware, CompanyPositions.CTO, CompanyPositions.BusinessAnalyst,
CompanyPositions.BusinessManager, CompanyPositions.OperationsManager,
CompanyPositions.CFO, CompanyPositions.CEO, CompanyPositions.SecurityGuard,
CompanyPositions.SecuritySupervisor, CompanyPositions.HeadOfSecurity]);
AddToCompanies(NovaMedical);
//Other large companies
var CIA = new Company();
CIA.init(Locations.Sector12CIA, 2.0, 2.0, 150);
CIA.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,
CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst,
CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer,
CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware,
CompanyPositions.HeadOfEngineering, CompanyPositions.SecurityGuard, CompanyPositions.SecurityOfficer,
CompanyPositions.SecuritySupervisor, CompanyPositions.HeadOfSecurity, CompanyPositions.FieldAgent,
CompanyPositions.SecretAgent, CompanyPositions.SpecialOperative]);
AddToCompanies(CIA);
var NSA = new Company();
NSA.init(Locations.Sector12NSA, 2.0, 2.0, 150);
NSA.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,
CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst,
CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer,
CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware,
CompanyPositions.HeadOfEngineering, CompanyPositions.SecurityGuard, CompanyPositions.SecurityOfficer,
CompanyPositions.SecuritySupervisor, CompanyPositions.HeadOfSecurity, CompanyPositions.FieldAgent,
CompanyPositions.SecretAgent, CompanyPositions.SpecialOperative]);
AddToCompanies(NSA);
var WatchdogSecurity = new Company();
WatchdogSecurity.init(Locations.AevumWatchdogSecurity, 1.5, 1.5, 125);
WatchdogSecurity.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,
CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst,
CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer,
CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware,
CompanyPositions.HeadOfEngineering, CompanyPositions.SecurityGuard, CompanyPositions.SecurityOfficer,
CompanyPositions.SecuritySupervisor, CompanyPositions.HeadOfSecurity, CompanyPositions.FieldAgent,
CompanyPositions.SecretAgent, CompanyPositions.SpecialOperative]);
AddToCompanies(WatchdogSecurity);
//"Medium level" companies
var LexoCorp = new Company();
LexoCorp.init(Locations.VolhavenLexoCorp, 1.4, 1.4, 100);
LexoCorp.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,
CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst,
CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer,
CompanyPositions.NetworkEngineer, CompanyPositions.HeadOfSoftware, CompanyPositions.CTO,
CompanyPositions.BusinessIntern, CompanyPositions.BusinessAnalyst,
CompanyPositions.OperationsManager, CompanyPositions.CFO, CompanyPositions.CEO,
CompanyPositions.SecurityGuard, CompanyPositions.SecurityOfficer, CompanyPositions.HeadOfSecurity]);
AddToCompanies(LexoCorp);
var RhoConstruction = new Company();
RhoConstruction.init(Locations.AevumRhoConstruction, 1.3, 1.3, 50);
RhoConstruction.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,
CompanyPositions.LeadDev, CompanyPositions.BusinessIntern, CompanyPositions.BusinessAnalyst,
CompanyPositions.BusinessManager, CompanyPositions.OperationsManager]);
AddToCompanies(RhoConstruction);
var AlphaEnterprises = new Company();
AlphaEnterprises.init(Locations.Sector12AlphaEnterprises, 1.5, 1.5, 100);
AlphaEnterprises.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,
CompanyPositions.LeadDev, CompanyPositions.BusinessIntern, CompanyPositions.BusinessAnalyst,
CompanyPositions.BusinessManager, CompanyPositions.OperationsManager]);
AddToCompanies(AlphaEnterprises);
var AevumPolice = new Company();
AevumPolice.init(Locations.AevumPolice, 1.3, 1.3, 100);
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.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,
CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst,
CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer,
CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware,
CompanyPositions.CTO]);
AddToCompanies(SysCoreSecurities);
var CompuTek = new Company();
CompuTek.init(Locations.VolhavenCompuTek, 1.2, 1.2, 75);
CompuTek.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,
CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst,
CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer,
CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware,
CompanyPositions.CTO]);
AddToCompanies(CompuTek);
var NetLinkTechnologies = new Company();
NetLinkTechnologies.init(Locations.AevumNetLinkTechnologies, 1.2, 1.2, 100);
NetLinkTechnologies.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,
CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst,
CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer,
CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware,
CompanyPositions.CTO]);
AddToCompanies(NetLinkTechnologies);
var CarmichaelSecurity = new Company();
CarmichaelSecurity.init(Locations.Sector12CarmichaelSecurity, 1.2, 1.2, 75);
CarmichaelSecurity.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,
CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst,
CompanyPositions.ITManager, CompanyPositions.SysAdmin, CompanyPositions.SecurityEngineer,
CompanyPositions.NetworkEngineer, CompanyPositions.NetworkAdministrator, CompanyPositions.HeadOfSoftware,
CompanyPositions.HeadOfEngineering, CompanyPositions.SecurityGuard, CompanyPositions.SecurityOfficer,
CompanyPositions.SecuritySupervisor, CompanyPositions.HeadOfSecurity, CompanyPositions.FieldAgent,
CompanyPositions.SecretAgent, CompanyPositions.SpecialOperative]);
AddToCompanies(CarmichaelSecurity);
//"Low level" companies
var FoodNStuff = new Company();
FoodNStuff.init(Locations.Sector12FoodNStuff, 1, 1, 0);
FoodNStuff.addPositions([CompanyPositions.Employee]);
AddToCompanies(FoodNStuff);
var JoesGuns = new Company();
JoesGuns.init(Locations.Sector12JoesGuns, 1, 1, 0);
JoesGuns.addPositions([CompanyPositions.Employee]);
AddToCompanies(JoesGuns);
var OmegaSoftware = new Company();
OmegaSoftware.init(Locations.IshimaOmegaSoftware, 1.1, 1.1, 50);
OmegaSoftware.addPositions([
CompanyPositions.SoftwareIntern, CompanyPositions.JuniorDev, CompanyPositions.SeniorDev,
CompanyPositions.LeadDev, CompanyPositions.ITIntern, CompanyPositions.ITAnalyst,
CompanyPositions.ITManager, CompanyPositions.CTO, CompanyPositions.CEO]);
AddToCompanies(OmegaSoftware);
/* Companies that do not have servers */
var NoodleBar = new Company();
NoodleBar.init(Locations.NewTokyoNoodleBar, 1, 1, 0);
NoodleBar.addPositions([CompanyPositions.Waiter]);
AddToCompanies(NoodleBar);
}
//Map of all companies that exist in the game, indexed by their name
Companies = {}
//Add a Company object onto the map of all Companies in the game
AddToCompanies = function (company) {
var name = company.companyName;
Companies[name] = company;
}

@ -0,0 +1,164 @@
/* Functions that handle applying for different jobs/positions in a Company */
//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");
}
var currCompany = "";
if (this.companyName != "") {
currCompany = Companies[this.companyName];
}
var currPositionName = "";
if (this.companyPosition != "") {
currPositionName = this.companyPosition.positionName;
}
var company = Companies[this.location]; //Company being applied to
var pos = entryPosType;
if (!this.isQualified(company, pos)) {
dialogBoxCreate("You are not qualified for this position");
return;
}
while (true) {
if (Engine.Debug) {console.log("Determining qualification for next Company Position");}
var newPos = getNextCompanyPosition(pos);
if (newPos == null) {
if (Engine.Debug) {
console.log("Player already at highest position, cannot go any higher");
}
break;
}
//Check if this company has this position
if (company.hasPosition(newPos)) {
if (!this.isQualified(company, newPos)) {
//If player not qualified for next job, break loop so player will be given current job
break;
}
pos = newPos;
} else {
break;
}
}
//Check if the determined job is the same as the player's current job
if (currCompany != "") {
if (currCompany.companyName == company.companyName &&
pos.positionName == currPositionName) {
dialogBoxCreate("Unfortunately, you do not qualify for a promotion");
return; //Same job, do nothing
}
}
//Lose reputation from a Company if you are leaving it for another job
if (currCompany != "") {
if (currCompany.companyName != company.companyName) {
company.playerReputation -= 1000;
if (company.playerReputation < 0) {company.playerReputation = 0;}
if (Engine.debug) {
console.log("Lost reputation for " + company.companyName + ". It is now " + company.playerReputation);
}
}
}
this.companyName = company.companyName;
this.companyPosition = pos;
dialogBoxCreate("Congratulations! You were offered a new job at ", this.companyName, " as a " + pos.positionName);
Engine.loadLocationContent();
}
PlayerObject.prototype.applyForSoftwareJob = function() {
this.applyForJob(CompanyPositions.SoftwareIntern);
}
PlayerObject.prototype.applyForItJob = function() {
this.applyForJob(CompanyPositions.ITIntern);
}
PlayerObject.prototype.applyForSecurityEngineerJob = function() {
var company = Companies[this.location]; //Company being applied to
if (this.isQualified(company, CompanyPositions.SecurityEngineer)) {
this.companyName = company.companyName;
this.companyPosition = CompanyPositions.SecurityEngineer;
dialogBoxCreate("Congratulations, you were offered a position at ", this.companyName, " as a Security Engineer!" , "");
Engine.loadLocationContent();
} else {
dialogBoxCreate("Unforunately, you do not qualify for this position");
}
}
PlayerObject.prototype.applyForNetworkEngineerJob = function() {
var company = Companies[this.location]; //Company being applied to
if (this.isQualified(company, CompanyPositions.NetworkEngineer)) {
this.applyForJob(CompanyPositions.NetworkEngineer);
} else {
dialogBoxCreate("Unforunately, you do not qualify for this position");
}
}
PlayerObject.prototype.applyForBusinessJob = function() {
this.applyForJob(CompanyPositions.BusinessIntern);
}
PlayerObject.prototype.applyForSecurityJob = function() {
//TODO If case for POlice departments
this.applyForJob(CompanyPositions.SecurityGuard);
}
PlayerObject.prototype.applyForAgentJob = function() {
var company = Companies[this.location]; //Company being applied to
if (this.isQualified(company, CompanyPositions.FieldAgent)) {
this.applyForJob(CompanyPositions.FieldAgent);
} else {
dialogBoxCreate("Unforunately, you do not qualify for this position");
}
}
PlayerObject.prototype.applyForEmployeeJob = function() {
var company = Companies[this.location]; //Company being applied to
if (this.isQualified(company, CompanyPositions.Employee)) {
this.companyName = company.companyName;
this.companyPosition = CompanyPositions.Employee;
dialogBoxCreate("Congratulations, you are now employed at ", this.companyName, "", "");
Engine.loadLocationContent();
} else {
dialogBoxCreate("Unforunately, you do not qualify for this position");
}
}
PlayerObject.prototype.applyForWaiterJob = function() {
var company = Companies[this.location]; //Company being applied to
if (this.isQualified(company, CompanyPositions.Waiter)) {
this.companyName = company.companyName;
this.companyPosition = CompanyPositions.Waiter;
dialogBoxCreate("Congratulations, you are now employed as a waiter at ", this.companyName, "", "");
Engine.loadLocationContent();
} else {
dialogBoxCreate("Unforunately, you do not qualify for this position");
}
}
//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 &&
company.playerReputation >= position.requiredReputation) {
return true;
}
return false;
}

177
src/Constants.js Normal file

@ -0,0 +1,177 @@
CONSTANTS = {
//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,
/* Script related things */
//Time (ms) it takes to run one operation in Netscript.
CodeInstructionRunTime: 1500,
//Time (seconds) it takes to run one operation in Netscript OFFLINE
CodeOfflineExecutionTime: 10,
//Maximum number of log entries for a script
MaxLogCapacity: 20,
//How much a TOR router costs
TorRouterCost: 2000000,
MillisecondsPer20Hours: 72000000,
GameCyclesPer20Hours: 72000000 / 200,
MillisecondsPer10Hours: 36000000,
GameCyclesPer10Hours: 36000000 / 200,
MillisecondsPer8Hours: 28800000,
GameCyclesPer8Hours: 28800000 / 200,
MillisecondsPer4Hours: 14400000,
GameCyclesPer4Hours: 14400000 / 200,
MillisecondsPerHour: 3600000,
GameCyclesPerHour: 3600000 / 200,
FactionWorkHacking: "Faction Hacking Work",
FactionWorkField: "Faction Field Work",
FactionWorkSecurity: "Faction Security Work",
//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>" +
"cls See 'clear' command <br>" +
"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>" +
"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>" +
"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>" +
"ps Display all scripts that are currently running<br>" +
"rm Delete a script/program from the machine. (WARNING: Permanent)<br>" +
"run [script/program] Execute a program or a script<br>" +
"scan See 'netstat' command<br>" +
"tail [script] Display script logs (logs contain details about active scripts)" +
"telnet [ip/hostname] See 'connect' command<br>" +
"top Display all running scripts and their RAM usage<br>",
/* Tutorial related things */
TutorialGettingStartedText: "Todo...",
TutorialNetworkingText: "Servers are a central part of the game. You start with a single personal server (your home computer) " +
"and you can purchase additional servers as you progress through the game. Connecting to other servers " +
"and hacking them can be a major source of income and experience. Servers can also be used to run " +
"scripts which can automatically hack servers for you. <br><br>" +
"In order to navigate between machines, use the 'scan' or 'netstat' commands to see all servers " +
"that are reachable from your current server. Then, you can use the 'connect [hostname/ip]' or " +
"'telnet [hostname/ip]' commands to connect to one of the available machines. <br><br>" +
"The 'hostname' and 'ifconfig' commands can be used to display the hostname/IP of the " +
"server you are currently connected to.",
TutorialHackingText: "In the year 2077, currency has become digital and decentralized. People and corporations " +
"store their money on servers. By hacking these servers, you can steal their money and gain " +
"experience. <br><br>" +
"Gaining root access <br>" +
"The key to hacking a server is to gain root access to that server. This can be done using " +
"the NUKE virus (NUKE.exe). You start the game with a copy of the NUKE virus on your home " +
"computer. The NUKE virus attacks the target server's open ports using buffer overflow " +
"exploits. When successful, you are granted root administrative access to the machine. <br>" +
"Typically, in order for the NUKE virus to succeed, the target server needs to have at least " +
"one of its ports opened. Some servers have no security and will not need any ports opened. Some " +
"will have very high security and will need many ports opened. In order to open ports on another " +
"server, you will need to run programs that attack the server to open specific ports. These programs " +
"can be coded once your hacking skill gets high enough, or they can be purchased if you can find " +
"a seller. <br><br>" +
"In order to determine how many ports need to be opened to successfully NUKE a server, connect to " +
"that server and run the 'analyze' command. This will also show you which ports have already been " +
"opened. <br>" +
"Once you have enough ports opened and have ran the NUKE virus to gain root access, the server " +
"can then be hacked by simply calling the 'hack' command through terminal, or by using a script.<br><br>" +
"Hacking mechanics <br>" +
"When you execute the hack command, either manually through the terminal or automatically through " +
"a script, you attempt to hack the server. This action takes time. The more advanced a server's " +
"security is, the more time it will take. Your hacking skill level also affects the hacking time, " +
"with a higher hacking skill leading to shorter hacking times. Also, running the hack command " +
"manually through terminal is faster than hacking from a script. <br>" +
"Your attempt to hack a server will not always succeed. The chance you have to successfully hack a " +
"server is also determined by the server's security and your hacking skill level. Even if your " +
"hacking attempt is unsuccessful, you will still gain experience points. <br>" +
"When you successfully hack a server. You steal a certain percentage of that server's total money. This " +
"percentage is determined by the server's security and your hacking skill level. The amount of money " +
"on a server is not limitless. So, if you constantly hack a server and deplete its money, then you will " +
"encounter diminishing returns in your hacking (since you are only hacking a certain percentage). A server " +
"will regain money at a slow rate over time. ",
TutorialScriptsText: "Scripts can be used to automate the hacking process. Scripts must be written in the Netscript language " +
"and are saved as a file. Running a script requires RAM. The more complex a script is, the more RAM " +
"it requires to run. Scripts can be run on any server you have root access to. <br><br>" +
"Here are some commands that are useful when working with scripts: <br>" +
"free - Shows the current server's RAM usage <br>" +
"kill [script] - Stops a script that is running <br>" +
"nano [script] - Edit a script <br>" +
"ps - Displays all scripts that are actively running on the current server<br>" +
"run [script] - Run a script <br>" +
"tail [script] - Displays a script's logs<br>" +
"top - Displays all active scripts and their RAM usage <br><br>",
TutorialTravelingText:"There are six major cities in the world that you are able to travel to: <br> " +
" Aevum<br>" +
" Chongqing<br>" +
" Sector-12<br>" +
" New Tokyo<br>" +
" Ishima<br>" +
" Volhaven<br>" +
"To travel between cities, visit your current city's travel agency through the 'World' page. " +
"From the travel agency you can travel to any other city. Doing so costs money. <br>" +
"Each city has its own set of companies and unique locations. ",
TutorialJobsText: "Hacking is not the only way to gain money and experience! Located around the world are many " +
"different companies which you can work for. By working for a company you can earn money, " +
"train your various labor skills, and unlock powerful passive perks. <br> " +
"To apply for a job, visit the company you want to work for through the 'World' menu. The company " +
"page will have options that let you apply to positions in the company. There might be several different" +
"positions you can apply for, ranging from software engineer to business analyst to security officer. <br> " +
"When you apply for a job, you will get the offer if your stats are high enough. Your first position at " +
"a company will be an entry-level position such as 'intern'. Once you get the job, an button will appear on " +
"the company page that allows you to work for the company. Click this button to start working. <br>" +
"Working occurs in 8 hour shifts. Once you start working, you will begin earning money, experience, " +
"and reputation. The rate at which you money and experience depends on the company and your position. " +
"The amount of reputation you gain for your company is based on your job performance, which is affected by " +
"your stats. Different positions value different stats. When you are working, you are unable to perform any " +
"other actions such as using your terminal or visiting other locations (However, note that any scripts you have " +
"running on servers will continue to run as you work!). It is possible to cancel your work shift before the " +
"8 hours is up, but doing so will result in you gaining only half of all of the money, experience, and reputation " +
"that you had earned up to that point. <br>" +
"As you continue to work at a company, you will gain more and more reputation at that company. When your stats " +
"and reputation are high enough, you can get a promotion. You can apply for a promotion on the company page, just like " +
"you applied for the job originally. Higher positions at a company provide better salaries and stat gains",
TutorialFactionsText: "Throughout the game you may receive invitations from factions. There are many different factions, and each faction " +
"has different criteria for determining its potential members. Joining a faction and furthering its cause is crucial " +
"to progressing in the game and unlocking endgame content. <br> " +
"It is possible to join multiple factions if you receive invitations from them. However, note that joining a faction " +
"may prevent you from joining other rival factions. <br> " +
"The 'Factions' link on the menu brings up a list of all factions that you have joined. " +
"You can select a Faction on this list to go to that Faction page. This page displays general " +
"information about the Faction and also lets you perform work for the faction. " +
"Working for a Faction is similar to working for a company except that you don't get paid a salary. " +
"You will only earn reputation in your Faction and train your stats. Also, cancelling work early " +
"when working for a Faction does not result in reduced experience/reputation earnings. <br>" +
"Earning reputation for a Faction unlocks powerful upgrades. These upgrades vary from faction to faction. ",
TutorialAugmentationsText: "Advances in science and medicine have lead to powerful new technologies that allow people to augment themselves " +
"beyond normal human capabilities. There are many different types of Augmentations, ranging from cybernetic to " +
"genetic to biological. Acquiring these Augmentations enhances the user's physical and mental faculties. <br>" +
"Because of how powerful these Augmentations are, the technology behind them is kept private and secret by the " +
"corporations and organizations that create them. Therefore, the only way for the player to obtain Augmentations is " +
"through Factions. After joining a Faction and earning enough reputation in it, you will be able to purchase " +
"its Augmentations. Different Factions offer different Augmentations. Augmentations must be purchased in order to be installed, " +
"and they are fairly expensive. <br>" +
"Unfortunately, installing an Augmentation has side effects. All of your stats and experience will be reset to 1. " +
"You will lose all of your digital assets as well, such as your money, programs, scripts, and purchased servers. " +
"You will lose all of the reputation you have earned from every company and faction and will no longer be an employee " +
"or member of any. The only thing you will keep when you install an Augmentation is all of the past Augmentations " +
"you have installed. ",
}

82
src/CreateProgram.js Normal file

@ -0,0 +1,82 @@
/* Create programs */
Programs = {
NukeProgram: "NUKE.exe",
BruteSSHProgram: "BruteSSH.exe",
FTPCrackProgram: "FTPCrack.exe",
RelaySMTPProgram: "relaySMTP.exe",
HTTPWormProgram: "HTTPWorm.exe",
SQLInjectProgram: "SQLInject.exe",
}
//TODO Right now the times needed to complete work are hard-coded...
//maybe later make this dependent on hacking level or something
function displayCreateProgramContent() {
var portHackALink = document.getElementById("create-program-porthack");
var bruteSshALink = document.getElementById("create-program-brutessh");
var ftpCrackALink = document.getElementById("create-program-ftpcrack");
var relaySmtpALink = document.getElementById("create-program-relaysmtp");
var httpWormALink = document.getElementById("create-program-httpworm");
var sqlInjectALink = document.getElementById("create-program-sqlinject");
portHackALink.style.display = "none";
bruteSshALink.style.display = "none";
ftpCrackALink.style.display = "none";
relaySmtpALink.style.display = "none";
httpWormALink.style.display = "none";
sqlInjectALink.style.display = "none";
//TODO These addEventListeners should only happen once so I guess just put them in Engine.init()
//PortHack.exe (in case you delete it lol)
if (Player.getHomeComputer().programs.indexOf(Programs.NukeProgram) == -1) {
portHackALink.style.display = "block";
portHackALink.addEventListener("click", function() {
createProgram(Programs.PortHackProgram);
});
}
//BruteSSH
if (Player.getHomeComputer().programs.indexOf(Programs.BruteSSHProgram) == -1 &&
Player.hacking_skill >= 50) {
bruteSshALink.style.display = "block";
bruteSshALink.addEventListener("click", function() {
Player.startCreateProgramWork(Programs.BruteSSHProgram, CONSTANTS.MillisecondsPerHour);
});
}
//FTPCrack
if (Player.getHomeComputer().programs.indexOf(Programs.FTPCrackProgram) == -1 &&
Player.hacking_skill >= 125) {
ftpCrackALink.style.display = "block";
ftpCrackALink.addEventListener("click", function() {
Player.startCreateProgramWork(Programs.FTPCrackProgram, CONSTANTS.MillisecondsPer4Hours);
});
}
//relaySMTP
if (Player.getHomeComputer().programs.indexOf(Programs.RelaySMTPProgram) == -1 &&
Player.hacking_skill >= 300) {
relaySmtpALink.style.display = "block";
relaySmtpAlink.addEventListener("click", function() {
Player.startCreateProgramWork(Programs.RelaySMTPProgram. CONSTANTS.MillisecondsPer8Hours);
});
}
//HTTPWorm
if (Player.getHomeComputer().programs.indexOf(Programs.HTTPWormProgram) == -1 &&
Player.hacking_skill >= 500) {
httpWormALink.style.display = "block";
httpWormALink.addEventListener("click", function() {
Player.startCreateProgramWork(Programs.HTTPWormProgram, CONSTANTS.MillisecondsPer10Hours);
});
}
//SQLInject
if (Player.getHomeComputer().programs.indexOf(Programs.SQLInjectProgram) == -1 &&
Player.hacking_skill >= 750) {
sqlInjectALink.style.display = "block";
sqlInjectALink.addEventListener("click", function() {
Player.startCreateProgramWork(Programs.SQLInjectProgram, CONSTANTS.MillisecondsPer10Hours);
});
}
}

4
src/DarkWeb.js Normal file

@ -0,0 +1,4 @@
/* DarkWeb.js */
executeDarkwebTerminalCommand = function() {
}

747
src/Faction.js Normal file

@ -0,0 +1,747 @@
//Netburner Faction class
function Faction(name) {
this.name = name;
this.augmentations = []; //Name of augmentation only
this.info = ""; //Introductory/informational text about the faction
//Player-related properties for faction
this.isMember = false; //Whether player is member
this.isBanned = false; //Whether or not player is banned from joining this faction
this.playerReputation = 0; //"Reputation" within faction
//Multipliers for unlocking and purchasing augmentations
this.augmentationPriceMult = 1;
this.augmentationRepRequirementMult = 1;
};
Faction.prototype.setAugmentationMultipliers = function(price, rep) {
this.augmentationPriceMult = price;
this.augmentationRepRequirementMult = rep;
}
Faction.prototype.setInfo = function(inf) {
this.info = inf;
}
Faction.prototype.toJSON = function() {
return Generic_toJSON("Faction", this);
}
Faction.fromJSON = function(value) {
return Generic_fromJSON(Faction, value.data);
}
Reviver.constructors.Faction = Faction;
//Map of factions indexed by faction name
Factions = {}
AddToFactions = function(faction) {
var name = faction.name;
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() {
//Endgame
var Illuminati = new Faction("Illuminati");
Illuminati.setInfo(FactionInfo.IlluminatiInfo);
AddToFactions(Illuminati);
var Daedalus = new Faction("Daedalus");
Daedalus.setInfo(FactionInfo.DaedalusInfo);
AddToFactions(Daedalus);
var Covenant = new Faction("The Covenant");
Covenant.setInfo(FactionInfo.CovenantInfo);
AddToFactions(Covenant);
//Megacorporations, each forms its own faction
var ECorp = new Faction("ECorp");
ECorp.setInfo(FactionInfo.ECorpInfo);
AddToFactions(ECorp);
var MegaCorp = new Faction("MegaCorp");
MegaCorp.setInfo(FactionInfo.MegaCorpInfo);
AddToFactions(MegaCorp);
var BachmanAndAssociates = new Faction("Bachman & Associates");
BachmanAndAssociates.setInfo(FactionInfo.BachmanAndAssociatesInfo);
AddToFactions(BachmanAndAssociates);
var BladeIndustries = new Faction("Blade Industries");
BladeIndustries.setInfo(FactionInfo.BladeIndustriesInfo);
AddToFactions(BladeIndustries);
var NWO = new Faction("NWO");
NWO.setInfo(FactionInfo.NWOInfo);
AddToFactions(NWO);
var ClarkeIncorporated = new Faction("Clarke Incorporated");
ClarkeIncorporated.setInfo(FactionInfo.ClarkeIncorporatedInfo);
AddToFactions(ClarkeIncorporated);
var OmniTekIncorporated = new Faction("OmniTek Incorporated");
OmniTekIncorporated.setInfo(FactionInfo.OmniTekIncorporatedInfo);
AddToFactions(OmniTekIncorporated);
var FourSigma = new Faction("Four Sigma");
FourSigma.setInfo(FactionInfo.FourSigmaInfo);
AddToFactions(FourSigma);
var KuaiGongInternational = new Faction("KuaiGong International");
KuaiGongInternational.setInfo(FactionInfo.KuaiGongInternationalInfo);
AddToFactions(KuaiGongInternational);
//Other corporations
var FulcrumTechnologies = new Faction("Fulcrum Secret Technologies");
FulcrumTechnologies.setInfo(FactionInfo.FulcrumSecretTechnologiesInfo);
AddToFactions(FulcrumTechnologies);
//Hacker groups
var BitRunners = new Faction("BitRunners");
BitRunners.setInfo(FactionInfo.BitRunnersInfo);
AddToFactions(BitRunners);
var BlackHand = new Faction("The Black Hand");
BlackHand.setInfo(FactionInfo.BlackHandInfo);
AddToFactions(BlackHand);
var NiteSec = new Faction("NiteSec");
NiteSec.setInfo(FactionInfo.NiteSecInfo);
AddToFactions(NiteSec);
//City factions, essentially governments
var Chongqing = new Faction("Chongqing");
Chongqing.setInfo(FactionInfo.ChongqingInfo);
AddToFactions(Chongqing);
var Sector12 = new Faction("Sector-12");
Sector12.setInfo(FactionInfo.Sector12Info);
AddToFactions(Sector12);
var NewTokyo = new Faction("New Tokyo");
NewTokyo.setInfo(FactionInfo.NewTokyoInfo);
AddToFactions(NewTokyo);
var Aevum = new Faction("Aevum");
Aevum.setInfo(FactionInfo.AevumInfo);
AddToFactions(Aevum);
var Ishima = new Faction("Ishima");
Ishima.setInfo(FactionInfo.IshimaInfo);
AddToFactions(Ishima);
var Volhaven = new Faction("Volhaven");
Volhaven.setInfo(FactionInfo.VolhavenInfo);
AddToFactions(Volhaven);
//Criminal Organizations/Gangs
var SpeakersForTheDead = new Faction("Speakers for the Dead");
SpeakersForTheDead.setInfo(FactionInfo.SpeakersForTheDeadInfo);
AddToFactions(SpeakersForTheDead);
var DarkArmy = new Faction("The Dark Army");
DarkArmy.setInfo(FactionInfo.DarkArmyInfo);
AddToFactions(DarkArmy);
var TheSyndicate = new Faction("The Syndicate");
TheSyndicate.setInfo(FactionInfo.TheSyndicateInfo);
AddToFactions(TheSyndicate);
var Silhouette = new Faction("Silhouette");
Silhouette.setInfo(FactionInfo.SilhouetteInfo);
AddToFactions(Silhouette);
//Earlygame factions - factions the player will prestige with early on that don't
//belong in other categories
var TianDiHui = new Faction("Tian Di Hui"); //Society of the Heaven and Earth
TianDiHui.setInfo(FactionInfo.TianDiHuiInfo);
AddToFactions(TianDiHui);
var CyberSec = new Faction("CyberSec");
CyberSec.setInfo(FactionInfo.CyberSecInfo);
AddToFactions(CyberSec);
}
//This function sets the requirements to join a Faction. It checks whether the Player meets
//those requirements and will return an array of all factions that the Player should
//receive an invitation to
PlayerObject.prototype.checkForFactionInvitations = function() {
if (Engine.Debug) {
console.log("checkForFactionInvitations() called");
}
invitedFactions = []; //Array which will hold all Factions th eplayer should be invited to
var company = Companies[this.companyName];
var companyRep = 0;
if (company != null) {
companyRep = company.playerReputation;
}
//Illuminati
var illuminatiFac = Factions["Illuminati"];
if (illuminatiFac.isBanned == false && illuminatiFac.isMember == false &&
this.numAugmentations >= 10 &&
this.money >= 10000000000 && this.total_money >= 20000000000 &&
this.hacking_skill >= 800 && this.total_hacking >= 7000 &&
this.strength >= 900 && this.total_strength >= 10000 &&
this.defense >= 900 && this.total_defense >= 10000 &&
this.dexterity >= 900 && this.total_dexterity >= 10000 &&
this.agility >= 900 && this.total_agility >= 10000) {
invitedFactions.push(illuminatiFac);
}
//Daedalus
var daedalusFac = Factions["Daedalus"];
if (daedalusFac.isBanned == false && daedalusFac.isMember == false &&
this.numAugmentations >= 15 &&
this.money >= 1000000000 && this.total_money >= 10000000000 &&
this.hacking_skill >= 1000 && this.total_hacking >= 10000 &&
this.strength >= 500 && this.total_strength >= 8000 &&
this.defense >= 500 && this.total_defense >= 8000 &&
this.dexterity >= 500 && this.total_dexterity >= 8000 &&
this.agility >= 500 && this.total_agility >= 8000) {
invitedFactions.push(daedalusFac);
}
//The Covenant
var covenantFac = Factions["The Covenant"];
if (covenantFac.isBanned == false && covenantFac.isMember == false &&
this.numAugmentations >= 12 &&
this.money >= 5000000000 && this.total_money >= 10000000000 &&
this.hacking_skill >= 850 && this.total_hack >= 5000 &&
this.strength >= 850 && this.total_strength >= 5000 &&
this.defense >= 850 && this.total_defense >= 5000 &&
this.dexterity >= 850 && this.total_dexterity >= 5000 &&
this.agility >= 850 && this.total_agility >= 5000) {
invitedFactions.push(covenantFac);
}
//ECorp
var ecorpFac = Factions["ECorp"];
if (ecorpFac.isBanned == false && ecorpFac.isMember == false &&
this.companyName == Locations.AevumECorp && companyRep >= CONSTANTS.CorpFactionRepRequirement) {
invitedFactions.push(ecorpFac);
}
//MegaCorp
var megacorpFac = Factions["MegaCorp"];
if (megacorpFac.isBanned == false && megacorpFac.isMember == false &&
this.companyName == Locations.Sector12MegaCorp && companyRep >= CONSTANTS.CorpFactionRepRequirement) {
invitedFactions.push(megacorpFac);
}
//Bachman & Associates
var bachmanandassociatesFac = Factions["Bachman & Associates"];
if (bachmanandassociatesFac.isBanned == false && bachmanandassociatesFac.isMember == false &&
this.companyName == Locations.AevumBachmanAndAssociates && companyRep >= CONSTANTS.CorpFactionRepRequirement) {
invitedFactions.push(bachmanandassociatesFac);
}
//Blade Industries
var bladeindustriesFac = Factions["Blade Industries"];
if (bladeindustriesFac.isBanned == false && bladeindustriesFac.isMember == false &&
this.companyName == Locations.Sector12BladeIndustries && companyRep >= CONSTANTS.CorpFactionRepRequirement) {
invitedFactions.push(bladeindustriesFac);
}
//NWO
var nwoFac = Factions["NWO"];
if (nwoFac.isBanned == false && nwoFac.isMember == false &&
this.companyName == Locations.VolhavenNWO && companyRep >= CONSTANTS.CorpFactionRepRequirement) {
invitedFactions.push(nwoFac);
}
//Clarke Incorporated
var clarkeincorporatedFac = Factions["Clarke Incorporated"];
if (clarkeincorporatedFac.isBanned == false && clarkeincorporatedFac.isMember == false &&
this.companyName == Locations.AevumClarkeIncorporated && companyRep >= CONSTANTS.CorpFactionRepRequirement) {
invitedFactions.push(clarkeincorporatedFac);
}
//OmniTek Incorporated
var omnitekincorporatedFac = Factions["OmniTek Incorporated"];
if (omnitekincorporatedFac.isBanned == false && omnitekincorporatedFac.isMember == false &&
this.companyName == Locations.VolhavenOmniTekIncorporated && companyRep >= CONSTANTS.CorpFactionRepRequirement) {
invitedFactions.push(omnitekincorporatedFac);
}
//Four Sigma
var foursigmaFac = Factions["Four Sigma"];
if (foursigmaFac.isBanned == false && foursigmaFac.isMember == false &&
this.companyName == Locations.Sector12FourSigma && companyRep >= CONSTANTS.CorpFactionRepRequirement) {
invitedFactions.push(foursigmaFac);
}
//KuaiGong International
var kuaigonginternationalFac = Factions["KuaiGong International"];
if (kuaigonginternationalFac.isBanned == false && kuaigonginternationalFac.isMember == false &&
this.companyName == Locations.ChongqingKuaiGongInternational && companyRep >= CONSTANTS.CorpFactionRepRequirement) {
invitedFactions.push(kuaigonginternationalFac);
}
//Fulcrum Secret Technologies - If u've unlocked fulcrum secret technolgoies server and have a high rep with the company
var fulcrumsecrettechonologiesFac = Factions["Fulcrum Secret Technologies"];
var fulcrumSecretServer = AllServers[SpecialServerIps["Fulcrum Secret Technologies Server"]];
if (fulcrumSecretServer == null) {
console.log("Error: Could not find Fulcrum Secret Technologies Server");
}
if (fulcrumsecrettechonologiesFac.isBanned == false && fulcrumsecrettechonologiesFac.isMember == false &&
fulcrumSecretServer.hasAdminRights &&
this.companyName == Locations.AevumFulcrumTechnologies && companyRep >= 250000) {
invitedFactions.push(fulcrumsecrettechonologiesFac);
}
//BitRunners
var bitrunnersFac = Factions["BitRunners"];
var homeComp = Player.getHomeComputer();
if (bitrunnersFac.isBanned == false && bitrunnersFac.isMember == false &&
this.hacking_skill >= 600 && homeComp.maxRam >= 32) {
invitedFactions.push(bitrunnersFac);
}
//The Black Hand
var theblackhandFac = Factions["The Black Hand"];
if (theblackhandFac.isBanned == false && theblackhandFac.isMember == false &&
this.hacking_skill >= 400 && this.strength >= 300 && this.defense >= 300 &&
this.agility >= 300 && this.dexterity >= 300 && homeComp.maxRam >= 16) {
invitedFactions.push(theblackhandFac);
}
//NiteSec
var nitesecFac = Factions["NiteSec"];
if (nitesecFac.isBanned == false && nitesecFac.isMember == false &&
this.hacking_skill >= 500 && homeComp.maxRam >= 32) {
invitedFactions.push(nitesecFac);
}
//Chongqing
var chongqingFac = Factions["Chongqing"];
if (chongqingFac.isBanned == false && chongqingFac.isMember == false &&
this.money >= 20000000 && this.location == Locations.Chongqing) {
invitedFactions.push(chongqingFac);
}
//Sector-12
var sector12Fac = Factions["Sector-12"];
if (sector12Fac.isBanned == false && sector12Fac.isMember == false &&
this.money >= 50000000 && this.location == Locations.Sector12) {
invitedFactions.push(sector12Fac);
}
//New Tokyo
var newtokyoFac = Factions["New Tokyo"];
if (newtokyoFac.isBanned == false && newtokyoFac.isMember == false &&
this.money >= 20000000 && this.location == Locations.NewTokyo) {
invitedFactions.push(newtokyoFac);
}
//Aevum
var aevumFac = Factions["Aevum"];
if (aevumFac.isBanned == false && aevumFac.isMember == false &&
this.money >= 40000000 && this.location == Locations.Aevum) {
invitedFactions.push(aevumFac);
}
//Ishima
var ishimaFac = Factions["Ishima"];
if (ishimaFac.isBanned == false && ishimaFac.isMember == false &&
this.money >= 30000000 && this.location == Locations.Ishima) {
invitedFactions.push(ishimaFac);
}
//Volhaven
var volhavenFac = Factions["Volhaven"];
if (volhavenFac.isBanned == false && volhavenFac.isMember == false &&
this.money >= 50000000 && this.location == Locations.Volhaven) {
invitedFactions.push(volhavenFac);
}
//Speakers for the Dead
var speakersforthedeadFac = Factions["Speakers for the Dead"];
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.companyName != Locations.Sector12NSA) {
invitedFactions.push(speakersforthedeadFac);
}
//The Dark Army
var thedarkarmyFac = Factions["The Dark Army"];
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.companyName != Locations.Sector12NSA) {
invitedFactions.push(thedarkarmyFac);
}
//The Syndicate
var thesyndicateFac = Factions["The Syndicate"];
if (thesyndicateFac.isBanned == false && thesyndicateFac.isMember == false &&
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) {
invitedFactions.push(thesyndicateFac);
}
//Silhouette
var silhouetteFac = Factions["Silhouette"];
if (silhouetteFac.isBanned == false && silhouetteFac.isMember == false &&
(this.companyPosition.positionName == CompanyPositions.CTO.positionName ||
this.companyPosition.positionName == CompanyPositions.CFO.positionName ||
this.companyPosition.positionName == CompanyPositions.CEO.positionName) &&
this.money >= 15000000) {
invitedFactions.push(silhouetteFac);
}
//Tian Di Hui
var tiandihuiFac = Factions["Tian Di Hui"];
if (tiandihuiFac.isBanned == false && tiandihuiFac.isMember == false &&
this.money >= 1000000 && this.hacking_skill >= 50 &&
(this.location == Locations.Chongqing || this.location == Locations.NewTokyo ||
this.location == Locations.Ishima)) {
invitedFactions.push(tiandihuiFac);
}
//CyberSec
var cybersecFac = Factions["CyberSec"];
if (cybersecFac.isBanned == false && cybersecFac.isMember == false &&
this.hacking_skill >= 50) {
invitedFactions.push(cybersecFac);
}
return invitedFactions;
}
inviteToFaction = function(faction) {
if (Engine.Debug) {
console.log("inviteToFaction() called with faction: " + faction.name);
}
factionInvitationBoxCreate(faction);
}
joinFaction = function(faction) {
faction.isMember = true;
Player.factions.push(faction.name);
//Determine what factions you are banned from now that you have joined this faction
if (faction.name == "BitRunners") {
Factions["The Black Hand"].isBanned = true;
Factions["NiteSec"].isBanned = true;
} else if (faction.name == "The Black Hand") {
Factions["BitRunners"].isBanned = true;
Factions["NiteSec"].isBanned = true;
} else if (faction.name == "NiteSec") {
Factions["BitRunners"].isBanned = true;
Factions["The Black Hand"].isBanned = true;
} else if (faction.name == "Chongqing") {
Factions["Sector-12"].isBanned = true;
Factions["Aevum"].isBanned = true;
Factions["Volhaven"].isBanned = true;
} else if (faction.name == "Sector-12") {
Factions["Chongqing"].isBanned = true;
Factions["New Tokyo"].isBanned = true;
Factions["Ishima"].isBanned = true;
Factions["Volhaven"].isBanned = true;
} else if (faction.name == "New Tokyo") {
Factions["Sector-12"].isBanned = true;
Factions["Aevum"].isBanned = true;
Factions["Volhaven"].isBanned = true;
} else if (faction.name == "Aevum") {
Factions["Chongqing"].isBanned = true;
Factions["New Tokyo"].isBanned = true;
Factions["Ishima"].isBanned = true;
Factions["Volhaven"].isBanned = true;
} else if (faction.name == "Ishima") {
Factions["Sector-12"].isBanned = true;
Factions["Aevum"].isBanned = true;
Factions["Volhaven"].isBanned = true;
} else if (faction.name == "Volhaven") {
Factions["Chongqing"].isBanned = true;
Factions["Sector-12"].isBanned = true;
Factions["New Tokyo"].isBanned = true;
Factions["Aevum"].isBanned = true;
Factions["Ishima"].isBanned = true;
}
}
leaveFaction = function(faction) {
faction.isMember = false;
var i = Player.factions.indexOf(faction.name);
if (i > -1) {
Player.factions.splice(i, 1);
}
//Unban from faction
if (faction.name == "BitRunners") {
Factions["The Black Hand"].isBanned = false;
Factions["NiteSec"].isBanned = false;
} else if (faction.name == "The Black Hand") {
Factions["BitRunners"].isBanned = false;
Factions["NiteSec"].isBanned = false;
} else if (faction.name == "NiteSec") {
Factions["BitRunners"].isBanned = false;
Factions["The Black Hand"].isBanned = false;
} else if (faction.name == "Chongqing") {
Factions["Sector-12"].isBanned = false;
Factions["Aevum"].isBanned = false;
Factions["Volhaven"].isBanned = false;
} else if (faction.name == "Sector-12") {
Factions["Chongqing"].isBanned = false;
Factions["New Tokyo"].isBanned = false;
Factions["Ishima"].isBanned = false;
Factions["Volhaven"].isBanned = false;
} else if (faction.name == "New Tokyo") {
Factions["Sector-12"].isBanned = false;
Factions["Aevum"].isBanned = false;
Factions["Volhaven"].isBanned = false;
} else if (faction.name == "Aevum") {
Factions["Chongqing"].isBanned = false;
Factions["New Tokyo"].isBanned = false;
Factions["Ishima"].isBanned = false;
Factions["Volhaven"].isBanned = false;
} else if (faction.name == "Ishima") {
Factions["Sector-12"].isBanned = false;
Factions["Aevum"].isBanned = false;
Factions["Volhaven"].isBanned = false;
} else if (faction.name == "Volhaven") {
Factions["Chongqing"].isBanned = false;
Factions["Sector-12"].isBanned = false;
Factions["New Tokyo"].isBanned = false;
Factions["Aevum"].isBanned = false;
Factions["Ishima"].isBanned = false;
}
}
//Displays the HTML content for a specific faction
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);
var hackDiv = document.getElementById("faction-hack-div");
var fieldWorkDiv = document.getElementById("faction-fieldwork-div");
var securityWorkDiv = document.getElementById("faction-securitywork-div");
var hackButton = document.getElementById("faction-hack-button");
var fieldWorkButton = document.getElementById("faction-fieldwork-button");
var securityWorkButton = document.getElementById("faction-securitywork-button");
//Set new event listener for all of the work buttons
//The old buttons need to be replaced to clear the old event listeners
var newHackButton = hackButton.cloneNode(true);
var newFieldWorkButton = fieldWorkButton.cloneNode(true);
var newSecurityWorkButton = securityWorkButton.cloneNode(true);
hackButton.parentNode.replaceChild(newHackButton, hackButton);
fieldWorkButton.parentNode.replaceChild(newFieldWorkButton, fieldWorkButton);
securityWorkButton.parentNode.replaceChild(newSecurityWorkButton, securityWorkButton);
newHackButton.addEventListener("click", function() {
Player.startFactionHackWork(faction);
return false;
});
newFieldWorkButton.addEventListener("click", function() {
Player.startFactionFieldWork(faction);
return false;
});
newSecurityWorkButton.addEventListener("click", function() {
Player.startFactionSecurityWork(faction);
return false;
});
//Set new event listener for the purchase augmentation buttons
//The old button needs to be replaced to clear the old event listeners
var purchaseAugmentations = document.getElementById("faction-purchase-augmentations");
var newPurchaseAugmentationsButton = purchaseAugmentations.cloneNode(true);
purchaseAugmentations.parentNode.replaceChild(newPurchaseAugmentationsButton, purchaseAugmentations);
newPurchaseAugmentationsButton.addEventListener("click", function() {
Engine.hideAllContent();
Engine.Display.factionAugmentationsContent.style.visibility = "visible";
var backButton = document.getElementById("faction-augmentations-back-button");
var newBackButton = backButton.cloneNode(true);
backButton.parentNode.replaceChild(newBackButton, backButton);
newBackButton.addEventListener("click", function() {
Engine.loadFactionContent();
displayFactionContent(factionName);
return false;
});
displayFactionAugmentations(factionName);
return false;
});
if (faction.isMember) {
switch(faction.name) {
case "Illuminati":
hackDiv.style.display = "inline";
fieldWorkDiv.style.display = "inline";
securityWorkDiv.style.display = "none";
break;
case "Daedalus":
hackDiv.style.display = "inline";
fieldWorkDiv.style.display = "inline";
securityWorkDiv.style.display = "none";
break;
case "The Covenant":
hackDiv.style.display = "inline";
fieldWorkDiv.style.display = "inline";
securityWorkDiv.style.display = "none";
break;
case "ECorp":
hackDiv.style.display = "inline";
fieldWorkDiv.style.display = "inline";
securityWorkDiv.style.display = "inline";
break;
case "MegaCorp":
hackDiv.style.display = "inline";
fieldWorkDiv.style.display = "inline";
securityWorkDiv.style.display = "inline";
break;
case "Bachman & Associates":
hackDiv.style.display = "inline";
fieldWorkDiv.style.display = "inline";
securityWorkDiv.style.display = "inline";
break;
case "Blade Industries":
hackDiv.style.display = "inline";
fieldWorkDiv.style.display = "inline";
securityWorkDiv.style.display = "inline";
break;
case "NWO":
hackDiv.style.display = "inline";
fieldWorkDiv.style.display = "inline";
securityWorkDiv.style.display = "inline";
break;
case "Clarke Incorporated":
hackDiv.style.display = "inline";
fieldWorkDiv.style.display = "inline";
securityWorkDiv.style.display = "inline";
break;
case "OmniTek Incorporated":
hackDiv.style.display = "inline";
fieldWorkDiv.style.display = "inline";
securityWorkDiv.style.display = "inline";
break;
case "Four Sigma":
hackDiv.style.display = "inline";
fieldWorkDiv.style.display = "inline";
securityWorkDiv.style.display = "inline";
break;
case "KuaiGong International":
hackDiv.style.display = "inline";
fieldWorkDiv.style.display = "inline";
securityWorkDiv.style.display = "inline";
break;
case "BitRunners":
hackDiv.style.display = "inline";
fieldWorkDiv.style.display = "none";
securityWorkDiv.style.display = "none";
break;
case "The Black Hand":
hackDiv.style.display = "inline";
fieldWorkDiv.style.display = "inline";
securityWorkDiv.style.display = "none";
break;
case "NiteSec":
hackDiv.style.display = "inline";
fieldWorkDiv.style.display = "none";
securityWorkDiv.style.display = "none";
break;
case "Chongqing":
hackDiv.style.display = "inline";
fieldWorkDiv.style.display = "inline";
securityWorkDiv.style.display = "inline";
break;
case "Sector-12":
hackDiv.style.display = "inline";
fieldWorkDiv.style.display = "inline";
securityWorkDiv.style.display = "inline";
break;
case "New Tokyo":
hackDiv.style.display = "inline";
fieldWorkDiv.style.display = "inline";
securityWorkDiv.style.display = "inline";
break;
case "Aevum":
hackDiv.style.display = "inline";
fieldWorkDiv.style.display = "inline";
securityWorkDiv.style.display = "inline";
break;
case "Ishima":
hackDiv.style.display = "inline";
fieldWorkDiv.style.display = "inline";
securityWorkDiv.style.display = "inline";
break;
case "Volhaven":
hackDiv.style.display = "inline";
fieldWorkDiv.style.display = "inline";
securityWorkDiv.style.display = "inline";
break;
case "Speakers for the Dead":
hackDiv.style.display = "inline";
fieldWorkDiv.style.display = "inline";
securityWorkDiv.style.display = "inline";
break;
case "The Dark Army":
hackDiv.style.display = "inline";
fieldWorkDiv.style.display = "inline";
securityWorkDiv.style.display = "none";
break;
case "The Syndicate":
hackDiv.style.display = "inline";
fieldWorkDiv.style.display = "inline";
securityWorkDiv.style.display = "inline";
break;
case "Silhouette":
hackDiv.style.display = "inline";
fieldWorkDiv.style.display = "inline";
securityWorkDiv.style.display = "none";
case "Tian Di Hui":
hackDiv.style.display = "inline";
fieldWorkDiv.style.display = "none";
securityWorkDiv.style.display = "inline";
break;
case "CyberSec":
hackDiv.style.display = "inline";
fieldWorkDiv.style.display = "none";
securityWorkDiv.style.display = "none";
break;
default:
console.log("Faction does not exist");
break;
}
} else {
console.log("Not a member of this faction, cannot display faction information");
}
}
displayFactionAugmentations = function(factionName) {
document.getElementById("faction-augmentations-page-desc").innerHTML = "Lists all augmentations that are available to purchase from" + factionName;
var faction = Factions[factionName];
var augmentationsList = document.getElementById("faction-augmentations-list");
while (augmentationsList.firstChild) {
augmentationsList.removeChild(augmentationsList.firstChild);
}
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);
}
}

125
src/FactionInfo.js Normal file

@ -0,0 +1,125 @@
//Contains the "information" property for all the Factions, which is just a description
//of each faction
FactionInfo = {
//Endgame
IlluminatiInfo: "Humanity never changes. No matter how civilized society becomes, it will eventually fall back\n" +
"into chaos. And out of this chaos, we will lead them to order.\n" +
"We are the Invisible Hand. We are forever.",
DaedalusInfo: "If all of human \n" +
"history is but a single lesson, it is that the individual may be remembered, but the organization \n" +
"persists and thrives. A single artist, a single general, a single hero or a single villain may all die,\n" +
"but it is impossible to kill a people, a nation, an idea -- except when that idea has grown weak and is \n" +
"overpowered by one that is stronger. -- The Doctrine of the Mighty\n\n" +
"Surrender yourself. Give up your empty individuality to become part of something great, something eternal.\n" +
"Become a slave. Submit your mind, body, and soul. Only then can you set yourself free.\n\n" +
"Only then can you discover immortality.",
CovenantInfo: "Yesterday we obeyed kings and bent our necks to emperors. Today we kneel only to truth.",
//Megacorporations, each forms its own faction
ECorpInfo: "ECorp's mission is simple: to connect the world of today with the technology of tomorrow.\n" +
"With our wide range of Internet-related software and commercial hardware, ECorp makes the world's\n" +
"information universally accessible.",
MegaCorpInfo: "MegaCorp does things that others don't. We imagine. We create. We invent. We build things that\n" +
"others have never even dreamed of. Our work fills the world's needs for food, water, power, and\n" +
"transporation on an unprecendented scale, in ways that no other company can.\n\n" +
"In its labs and factories and on the ground with customers, MegaCorp is ushering in a new era for the world.",
BachmanAndAssociatesInfo: "TODO",
BladeIndustriesInfo: "TODO",
NWOInfo: "The human being created civilization not because of willingness but of a need to be assimilated into higher orders of structure and meaning.",
ClarkeIncorporatedInfo: "TODO",
OmniTekIncorporatedInfo: "Simply put, our mission is to design and build robots that make a difference",
FourSigmaInfo: "TODO",
KuaiGongInternationalInfo: "TODO",
//Other Corporations
FulcrumSecretTechnologiesInfo: "TODO",
//Hacker groups
BitRunnersInfo: "Our entire lives are controlled by bits. All of our actions, our thoughts, our personal information. \n"+
"It's all transformed into bits, stored in bits, communicated through bits. Its impossible for any person\n" +
"to move, to live, to operate at any level without the use of bits.\n\n" +
"And when a person moves, lives, and operates, they leave behind their bits, mere traces of seemingly\n" +
"meaningly fragments of information. But these bits can be reconstructed. Transformed. Used.\n\n" +
"Those who run the bits, run the world",
BlackHandInfo: "This is real freedom, freedom to own property, make a profit, make your life. \n" +
"The West, so afraid of strong government, now has no government. Only financial power.\n" +
"And those at the top rule with an invisible hand. They built a society where the rich get richer,\n" +
"and everyone else suffers. \n\n" +
"So much pain. So many lives. Their darkness must end.",
NiteSecInfo:
" __..__ <br>" +
" _.nITESECNIt. <br>" +
" .-'NITESECNITESEc. <br>" +
" .' NITESECNITESECn <br>" +
" / NITESECNITESEC; <br>" +
" : :NITESECNITESEC; <br>" +
" ; @ NITESECNITESECN <br>" +
" : _, ,N'ITESECNITESEC <br>" +
" : .+''`, : `NITESECNIT <br>" +
" ) /), `-,-=,NITESECNI <br>" +
" / ` ,-;|NITESECN; <br>" +
" / _.'(o) '-';NITESECN <br>" +
" ( , o ,-''`^NITE' <br>" +
" )` :`. .' <br>" +
" )-. ; `- / <br>" +
" \ _.-' : <br>" +
" ( _.-' \. \ <br>" +
" \------. \ \ <br>" +
" \. \ \ <br>" +
" bug \ _.nIt <br>" +
" \ _.nITESECNi <br>" +
" nITESECNIT^' \ <br>" +
" NITE^' ___ \ <br>" +
" / .gP''''Tp. \ <br>" +
" : d' . `b \ <br>" +
" ; d' o `b ; <br>" +
" / d; `b| <br>" +
" /, $; @ `: <br>" +
" /' $$ ; <br>" +
" .' $$b (o) | <br>" +
" .' d$$$; : <br>" +
" / .d$$$$; , ; <br>" +
" d .d$$$$$$$ $ | <br>" +
" :bp.__.g$$$$$$$$$ :$ ; <br>" +
" $$$$$$$$$$$$$$$$$ $$b : <br>",
//City factions, essentially governments
ChongqingInfo: "TODO",
Sector12Info: "TODO",
HongKongInfo: "TODO",
AevumInfo: "TODO",
IshimaInfo: "TODO",
VolhavenInfo: "TODO",
//Criminal Organizations/Gangs
SpeakersForTheDeadInfo: "It is better to reign in hell than to serve in heaven.",
DarkArmyInfo: "The World doesn't care about right or wrong. It's all about power.",
TheSyndicateInfo: "TODO",
SilhouetteInfo: "Corporations are so big, you don't even know who you're working for. That's terror. Terror built into the system.",
//Earlygame factions - factions the player will prestige with early on that don't
//belong in other categories
TianDiHuiInfo: "Obey Heaven and Work Righteousness",
CyberSecInfo: "The Internet is the first thing that humanity has built that humanity doesnt understand,\n" +
"the largest experiment in anarchy that we have ever had. And as the world becomes increasingly \n" +
"dominated by the internet, society approaches the brink of total chaos. \n\n" +
"We serve only to protect society, to protect humanity, to protect the world from its imminent collapse.",
}

1305
src/Location.js Normal file

File diff suppressed because it is too large Load Diff

@ -0,0 +1,49 @@
/* Environment
* NetScript program environment
*/
function Environment(parent) {
this.vars = Object.create(parent ? parent.vars : null);
this.parent = parent;
this.stopFlag = false;
}
Environment.prototype = {
//Create a "subscope", which is a new new "sub-environment"
//The subscope is linked to this through its parent variable
extend: function() {
return new Environment(this);
},
//Finds the scope where the variable with the given name is defined
lookup: function(name) {
var scope = this;
while (scope) {
if (Object.prototype.hasOwnProperty.call(scope.vars, name))
return scope;
scope = scope.parent;
}
},
//Get the current value of a variable
get: function(name) {
if (name in this.vars)
return this.vars[name];
throw new Error("Undefined variable " + name);
},
//Sets the value of a variable in any scope
set: function(name, value) {
var scope = this.lookup(name);
// let's not allow defining globals from a nested environment
//
// If scope is null (aka existing variable with name could not be found)
// and this is NOT the global scope, throw error
if (!scope && this.parent)
throw new Error("Undefined variable " + name);
return (scope || this).vars[name] = value;
},
//Creates (or overwrites) a variable in the current scope
def: function(name, value) {
return this.vars[name] = value;
}
};

549
src/Netscript/Evaluator.js Normal file

@ -0,0 +1,549 @@
/* Evaluator
* Evaluates the Abstract Syntax Tree for Netscript
* generated by the Parser class
*/
// Evaluator should return a Promise, so that any call to evaluate() can just
//wait for that promise to finish before continuing
function evaluate(exp, workerScript) {
var env = workerScript.env;
switch (exp.type) {
case "num":
case "str":
case "bool":
return new Promise(function(resolve, reject) {
if (env.stopFlag) {reject(workerScript);}
resolve(exp.value);
});
break;
case "var":
return new Promise(function(resolve, reject) {
if (env.stopFlag) {reject(workerScript);}
try {
resolve(env.get(exp.value));
} catch (e) {
throw new Error("|" + workerScript.serverIp + "|" + workerScript.name + "|" + e.toString());
}
});
break;
//Can currently only assign to "var"s
case "assign":
return new Promise(function(resolve, reject) {
if (env.stopFlag) {reject(workerScript);}
if (exp.left.type != "var")
throw new Error("|" + workerScript.serverIp + "|" + workerScript.name + "| Cannot assign to " + JSON.stringify(exp.left));
var p = new Promise(function(resolve, reject) {
setTimeout(function() {
var expRightPromise = evaluate(exp.right, workerScript);
expRightPromise.then(function(expRight) {
resolve(expRight);
}, function(e) {
reject(e);
});
}, CONSTANTS.CodeInstructionRunTime)
});
p.then(function(expRight) {
try {
env.set(exp.left.value, expRight);
} catch (e) {
throw new Error("|" + workerScript.serverIp + "|" + workerScript.name + "|" + e.toString());
}
resolve("assignFinished");
}, function(e) {
reject(e);
});
});
case "binary":
return new Promise(function(resolve, reject) {
if (env.stopFlag) {reject(workerScript);}
var pLeft = new Promise(function(resolve, reject) {
setTimeout(function() {
var promise = evaluate(exp.left, workerScript);
promise.then(function(valLeft) {
resolve(valLeft);
}, function(e) {
reject(e);
});
}, CONSTANTS.CodeInstructionRunTime);
});
pLeft.then(function(valLeft) {
var pRight = new Promise(function(resolve, reject) {
setTimeout(function() {
var promise = evaluate(exp.right, workerScript);
promise.then(function(valRight) {
resolve([valLeft, valRight]);
}, function(e) {
reject(e);
});
}, CONSTANTS.CodeInstructionRunTime);
});
pRight.then(function(args) {
try {
resolve(apply_op(exp.operator, args[0], args[1]));
} catch (e) {
reject("|" + workerScript.serverIp + "|" + workerScript.name + "|" + e.toString());
}
}, function(e) {
reject(e);
});
}, function(e) {
reject(e);
});
});
break;
//TODO
case "if":
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)");
}
for (var i = 0; i < numConds; i++) {
var cond = evaluate(exp.cond[i], workerScript);
if (cond) return evaluate(exp.then[i], workerScript);
}
//Evaluate else if it exists, snce none of the conditionals
//were true
return exp.else ? evaluate(exp.else, workerScript) : false;
case "for":
return new Promise(function(resolve, reject) {
if (env.stopFlag) {reject(workerScript);}
console.log("for loop encountered in evaluator");
var pInit = new Promise(function(resolve, reject) {
setTimeout(function() {
var resInit = evaluate(exp.init, workerScript);
resInit.then(function(foo) {
resolve(resInit);
}, function(e) {
reject(e);
});
}, CONSTANTS.CodeInstructionRunTime);
});
pInit.then(function(expInit) {
var pForLoop = evaluateFor(exp, workerScript);
pForLoop.then(function(forLoopRes) {
resolve("forLoopDone");
}, function(e) {
reject(e);
});
}, function(e) {
reject(e);
});
});
break;
case "while":
return new Promise(function(resolve, reject) {
if (env.stopFlag) {reject(workerScript);}
var pEvaluateWhile = evaluateWhile(exp, workerScript);
pEvaluateWhile.then(function(whileLoopRes) {
resolve("whileLoopDone");
}, function(e) {
reject(e);
});
});
break;
case "prog":
return new Promise(function(resolve, reject) {
if (env.stopFlag) {reject(workerScript);}
var evaluateProgPromise = evaluateProg(exp, workerScript, 0);
evaluateProgPromise.then(function(w) {
resolve(workerScript);
}, function(e) {
reject(e);
});
});
break;
/* Currently supported function calls:
* hack()
* sleep(N) - sleep N seconds
* print(x) - Prints a variable or constant
*
*/
case "call":
//Define only valid function calls here, like hack() and stuff
//var func = evaluate(exp.func, env);
//return func.apply(null, exp.args.map(function(arg){
// return evaluate(arg, env);
//}));
return new Promise(function(resolve, reject) {
if (env.stopFlag) {reject(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");
}
//IP 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) {
resolve("Invalid IP or server hostname passed in");
workerScript.scriptRef.log("Cannot hack(). Invalid IP or hostname passed in: " + ip);
}
//Calculate the hacking time
var hackingTime = scriptCalculateHackingTime(server); //This is in seconds
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("Attempting to hack " + ip + " in " + hackingTime + " seconds");
var p = new Promise(function(resolve, reject) {
if (env.stopFlag) {reject(workerScript);}
console.log("Hacking " + server.hostname + " after " + hackingTime.toString() + " seconds.");
setTimeout(function() {
var hackChance = scriptCalculateHackingChance(server);
var rand = Math.random();
var expGainedOnSuccess = scriptCalculateExpGain(server);
var expGainedOnFailure = Math.round(expGainedOnSuccess / 4);
if (rand < hackChance) { //Success!
var moneyGained = scriptCalculatePercentMoneyHacked(server);
moneyGained = Math.floor(server.moneyAvailable * moneyGained);
//Safety check
if (moneyGained <= 0) {moneyGained = 0;}
server.moneyAvailable -= moneyGained;
Player.gainMoney(moneyGained);
workerScript.scriptRef.onlineMoneyMade += moneyGained;
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");
resolve("Hack success");
} else {
//Player only gains 25% exp for failure? TODO Can change this later to balance
Player.gainHackingExp(expGainedOnFailure);
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");
resolve("Hack failure");
}
}, hackingTime * 1000);
});
p.then(function(res) {
resolve("hackExecuted");
}, function(e) {
reject(e);
});
}, function(e) {
reject(e);
});
} 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.");
}
var sleepTimePromise = evaluate(exp.args[0], workerScript);
sleepTimePromise.then(function(sleepTime) {
workerScript.scriptRef.log("Sleeping for " + sleepTime + " milliseconds");
var p = new Promise(function(resolve, reject) {
setTimeout(function() {
resolve("foo");
}, sleepTime);
});
p.then(function(res) {
resolve("sleepExecuted");
}, function(e) {
reject(e);
});
}, 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");
}
var p = new Promise(function(resolve, reject) {
setTimeout(function() {
var evaluatePromise = evaluate(exp.args[0], workerScript);
evaluatePromise.then(function(res) {
resolve(res);
}, function(e) {
reject(e);
});
}, CONSTANTS.CodeInstructionRunTime);
});
p.then(function(res) {
post(res.toString());
resolve("printExecuted");
}, function(e) {
reject(e);
});
}
}, CONSTANTS.CodeInstructionRunTime);
});
break;
default:
throw new Error("|" + 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);}
var pCond = new Promise(function(resolve, reject) {
setTimeout(function() {
var evaluatePromise = evaluate(exp.cond, workerScript);
evaluatePromise.then(function(resCond) {
console.log("Conditional evaluated to: " + resCond);
resolve(resCond);
}, function(e) {
reject(e);
});
}, CONSTANTS.CodeInstructionRunTime);
});
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);
});
}, CONSTANTS.CodeInstructionRunTime);
});
//After the code executes make a recursive call
pCode.then(function(resCode) {
var pPostLoop = new Promise(function(resolve, reject) {
setTimeout(function() {
var evaluatePromise = evaluate(exp.postloop, workerScript);
evaluatePromise.then(function(foo) {
console.log("Evaluated for loop postloop");
resolve("postLoopFinished");
}, function(e) {
reject(e);
});
}, CONSTANTS.CodeInstructionRunTime);
});
pPostLoop.then(function(resPostloop) {
var recursiveCall = evaluateFor(exp, workerScript);
recursiveCall.then(function(foo) {
resolve("endForLoop");
}, function(e) {
reject(e);
});
}, function(e) {
reject(e);
});
}, function(e) {
reject(e);
});
} else {
console.log("Cond is false, stopping for loop");
resolve("endForLoop"); //Doesn't need to resolve to any particular value
}
}, function(e) {
reject(e);
});
});
}
function evaluateWhile(exp, workerScript) {
var env = workerScript.env;
console.log("evaluateWhile() called");
return new Promise(function(resolve, reject) {
if (env.stopFlag) {reject(workerScript);}
var pCond = new Promise(function(resolve, reject) {
setTimeout(function() {
var evaluatePromise = evaluate(exp.cond, workerScript);
evaluatePromise.then(function(resCond) {
console.log("Conditional evaluated to: " + resCond);
resolve(resCond);
}, function(e) {
reject(e);
});
}, CONSTANTS.CodeInstructionRunTime);
});
pCond.then(function(resCond) {
if (resCond) {
//Run the while 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 while loop code");
resolve(resCode);
}, function(e) {
reject(e);
});
}, CONSTANTS.CodeInstructionRunTime);
});
//After the code executes make a recursive call
pCode.then(function(resCode) {
var recursiveCall = evaluateWhile(exp, workerScript);
recursiveCall.then(function(foo) {
resolve("endWhileLoop");
}, function(e) {
reject(e);
});
}, function(e) {
reject(e);
});
} else {
console.log("Cond is false, stopping while loop");
resolve("endWhileLoop"); //Doesn't need to resolve to any particular value
}
}, function(e) {
reject(e);
});
});
}
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
var code = new Promise(function(resolve, reject) {
setTimeout(function() {
var evaluatePromise = evaluate(exp.prog[index], workerScript);
evaluatePromise.then(function(evalRes) {
resolve(evalRes);
}, function(e) {
reject(e);
});
}, CONSTANTS.CodeInstructionRunTime);
});
//After the code finishes evaluating, evaluate the next line recursively
code.then(function(codeRes) {
var nextLine = evaluateProg(exp, workerScript, index + 1);
nextLine.then(function(nextLineRes) {
resolve(workerScript);
}, function(e) {
reject(e);
});
}, function(e) {
reject(e);
});
}
});
}
function apply_op(op, a, b) {
function num(x) {
if (typeof x != "number")
throw new Error("Expected number but got " + x);
return x;
}
function div(x) {
if (num(x) == 0)
throw new Error("Divide by zero");
return x;
}
switch (op) {
case "+": return num(a) + num(b);
case "-": return num(a) - num(b);
case "*": return num(a) * num(b);
case "/": return num(a) / div(b);
case "%": return num(a) % div(b);
case "&&": return a !== false && b;
case "||": return a !== false ? a : b;
case "<": return num(a) < num(b);
case ">": return num(a) > num(b);
case "<=": return num(a) <= num(b);
case ">=": return num(a) >= num(b);
case "==": return a === b;
case "!=": return a !== b;
}
throw new Error("Can't apply operator " + op);
}
//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 skillChance = (skillMult - server.requiredHackingSkill) / skillMult;
var chance = skillChance * difficultyMult;
if (chance < 0) {return 0;}
else {return chance;}
}
//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
return hackingTime;
}
//The same as Player's calculateExpGain() function but takes in the server as an argument
function scriptCalculateExpGain(server) {
return Math.round(server.hackDifficulty * Player.hacking_exp_mult);
}
//The same as Player's calculatePercentMoneyHacked() function but takes in the server as an argument
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);
if (percentMoneyHacked < 0) {return 0;}
if (percentMoneyHacked > 1) {return 1;}
return percentMoneyHacked;
}

@ -0,0 +1,25 @@
/* InputStream class. Creates a "stream object" that provides operations to read
* from a string. */
function InputStream(input) {
var pos = 0, line = 1, col = 0;
return {
next : next,
peek : peek,
eof : eof,
croak : croak,
};
function next() {
var ch = input.charAt(pos++);
if (ch == "\n") line++, col = 0; else col++;
return ch;
}
function peek() {
return input.charAt(pos);
}
function eof() {
return peek() == "";
}
function croak(msg) {
throw new Error(msg + " (" + line + ":" + col + ")");
}
}

@ -0,0 +1,162 @@
/* Worker code, contains Netscript scripts that are actually running */
//TODO Tested For and while and generic call statements. Have not tested if statements
/* Actual Worker Code */
function WorkerScript(script) {
this.name = "";
this.running = false;
this.serverIp = null;
this.code = "";
this.env = new Environment();
this.output = "";
this.ramUsage = 0;
this.scriptRef = script;
}
//Returns the server on which the workerScript is running
WorkerScript.prototype.getServer = function() {
return AllServers[this.serverIp];
}
//Array containing all scripts that are running across all servers, to easily run them all
var workerScripts = [];
//Loop through workerScripts and run every script that is not currently running
function runScriptsLoop() {
//Run any scripts that haven't been started
for (var i = 0; i < workerScripts.length; i++) {
//If it isn't running, start the script
if (workerScripts[i].running == false && workerScripts[i].env.stopFlag == false) {
try {
var ast = Parser(Tokenizer(InputStream(workerScripts[i].code)));
} catch (e) {
dialogBoxCreate("Syntax ERROR in " + workerScripts[i].name + ":", e, "", "");
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
//running status to false
p.then(function(w) {
console.log("Stopping script " + w.name + " because it finished running naturally");
w.running = false;
w.env.stopFlag = true;
}, function(w) {
if (w instanceof Error) {
//Error text format: |serverip|scriptname|error message
var errorText = w.toString();
if (Engine.Debug) {
console.log("Error in script: " + errorText);
}
var errorTextArray = errorText.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];
//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
for (var i = 0; i < workerScripts.length; ++i) {
if (workerScripts[i].serverIp == serverIp && workerScripts[i].name == scriptName) {
workerScripts[i].running = false;
workerScripts[i].env.stopFlag = true;
return;
}
}
} else {
console.log("Stopping script" + w.name + " because it was manually stopped (rejected)")
w.running = false;
w.env.stopFlag = true;
}
});
}
}
//Delete any scripts that finished or have been killed. Loop backwards bc removing
//items fucks up the indexing
for (var i = workerScripts.length - 1; i >= 0; i--) {
if (workerScripts[i].running == false && workerScripts[i].env.stopFlag == true) {
console.log("Deleting script: " + workerScripts[i].name);
//Delete script from the runningScripts array on its host serverIp
var ip = workerScripts[i].serverIp;
var name = workerScripts[i].name;
for (var j = 0; j < AllServers[ip].runningScripts.length; j++) {
if (AllServers[ip].runningScripts[j] == name) {
AllServers[ip].runningScripts.splice(j, 1);
break;
}
}
//Free RAM
AllServers[ip].ramUsed -= workerScripts[i].ramUsage;
//Delete script from workerScripts
workerScripts.splice(i, 1);
//Delete script from Active Scripts
Engine.deleteActiveScriptsItem(i);
}
}
setTimeout(runScriptsLoop, 10000);
}
//Queues a script to be killed by settings its stop flag to true. Then, the code will reject
//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;
}
}
}
//Queues a script to be run
function addWorkerScript(script, server) {
var filename = script.filename;
//Update server's ram usage
server.ramUsed += script.ramUsage;
//Create the WorkerScript
var s = new WorkerScript(script);
s.name = filename;
s.code = script.code;
s.serverIp = server.ip;
s.ramUsage = script.ramUsage;
//Add the WorkerScript to the Active Scripts list
Engine.addActiveScriptsItem(s);
//Add the WorkerScript
workerScripts.push(s);
console.log("Pushed script onto workerScripts");
return;
}
//Updates the online running time stat of all running scripts
function updateOnlineScriptTimes(numCycles = 1) {
var time = (numCycles * Engine._idleSpeed) / 1000; //seconds
for (var i = 0; i < workerScripts.length; ++i) {
workerScripts[i].scriptRef.onlineRunningTime += time;
}
}
runScriptsLoop();

250
src/Netscript/Parser.js Normal file

@ -0,0 +1,250 @@
/* Parser
* Creates Abstract Syntax Tree Nodes
* Operates on a stream of tokens from the Tokenizer
*/
var FALSE = {type: "bool", value: false};
function Parser(input) {
var PRECEDENCE = {
"=": 1,
"||": 2,
"&&": 3,
"<": 7, ">": 7, "<=": 7, ">=": 7, "==": 7, "!=": 7,
"+": 10, "-": 10,
"*": 20, "/": 20, "%": 20,
};
return parse_toplevel();
//Returns true if the next token is a punc type with value ch
function is_punc(ch) {
var tok = input.peek();
return tok && tok.type == "punc" && (!ch || tok.value == ch) && tok;
}
//Returns true if the next token is the kw keyword
function is_kw(kw) {
var tok = input.peek();
return tok && tok.type == "kw" && (!kw || tok.value == kw) && tok;
}
//Returns true if the next token is an op type with the given op value
function is_op(op) {
var tok = input.peek();
return tok && tok.type == "op" && (!op || tok.value == op) && tok;
}
//Checks that the next character is the given punctuation character and throws
//an error if it's not. If it is, skips over it in the input
function checkPuncAndSkip(ch) {
if (is_punc(ch)) input.next();
else input.croak("Expecting punctuation: \"" + ch + "\"");
}
//Checks that the next character is the given keyword and throws an error
//if its not. If it is, skips over it in the input
function checkKeywordAndSkip(kw) {
if (is_kw(kw)) input.next();
else input.croak("Expecting keyword: \"" + kw + "\"");
}
//Checks that the next character is the given operator and throws an error
//if its not. If it is, skips over it in the input
function checkOpAndSkip(op) {
if (is_op(op)) input.next();
else input.croak("Expecting operator: \"" + op + "\"");
}
function unexpected() {
input.croak("Unexpected token: " + JSON.stringify(input.peek()));
}
function maybe_binary(left, my_prec) {
var tok = is_op();
if (tok) {
var his_prec = PRECEDENCE[tok.value];
if (his_prec > my_prec) {
input.next();
return maybe_binary({
type : tok.value == "=" ? "assign" : "binary",
operator : tok.value,
left : left,
right : maybe_binary(parse_atom(), his_prec)
}, my_prec);
}
}
return left;
}
function delimited(start, stop, separator, parser) {
var a = [], first = true;
checkPuncAndSkip(start);
while (!input.eof()) {
if (is_punc(stop)) break;
if (first) first = false; else checkPuncAndSkip(separator);
if (is_punc(stop)) break;
a.push(parser());
}
checkPuncAndSkip(stop);
return a;
}
function parse_call(func) {
return {
type: "call",
func: func,
args: delimited("(", ")", ",", parse_expression),
};
}
function parse_varname() {
var name = input.next();
if (name.type != "var") input.croak("Expecting variable name");
return name.value;
}
/* type: "if",
* cond: [ {"type": "var", "value": "cond1"}, {"type": "var", "value": "cond2"}...]
* then: [ {"type": "var", "value": "then1"}, {"type": "var", "value": "then2"}...]
* else: {"type": "var", "value": "foo"}
*/
function parse_if() {
console.log("Parsing if token");
checkKeywordAndSkip("if");
//Conditional
var cond = parse_expression();
//Body
var then = parse_expression();
var ret = {
type: "if",
cond: [],
then: [],
};
ret.cond.push(cond);
ret.then.push(then);
// Parse all elif branches
while (is_kw("elif")) {
input.next();
var cond = parse_expression();
var then = parse_expression();
ret.cond.push(cond);
ret.then.push(then);
}
// Parse else branch, if it exists
if (is_kw("else")) {
input.next();
ret.else = parse_expression();
}
return ret;
}
/* for (init, cond, postloop) {code;}
*
* type: "for",
* init: assign node,
* cond: var node,
* postloop: assign node
* code: prog node
*/
function parse_for() {
console.log("Parsing for token");
checkKeywordAndSkip("for");
splitExpressions = delimited("(", ")", ";", parse_expression);
code = parse_expression();
if (splitExpressions.length != 3) {
throw new Error("for statement has incorrect number of arugments");
}
//TODO Check type of the init, cond, and postloop nodes
return {
type: "for",
init: splitExpressions[0],
cond: splitExpressions[1],
postloop: splitExpressions[2],
code: code
}
}
/* while (cond) {}
*
* type: "while",
* cond: var node
* code: prog node
*/
function parse_while() {
checkKeywordAndSkip("while");
var cond = parse_expression();
var code = parse_expression();
return {
type: "while",
cond: cond,
code: code
}
}
function parse_bool() {
return {
type : "bool",
value : input.next().value == "true"
};
}
function maybe_call(expr) {
expr = expr();
return is_punc("(") ? parse_call(expr) : expr;
}
function parse_atom() {
return maybe_call(function(){
if (is_punc("(")) {
input.next();
var exp = parse_expression();
checkPuncAndSkip(")");
return exp;
}
if (is_punc("{")) return parse_prog();
if (is_kw("if")) return parse_if();
if (is_kw("for")) return parse_for();
if (is_kw("while")) return parse_while();
//Note, let for loops be function calls (call node types)
if (is_kw("true") || is_kw("false")) return parse_bool();
var tok = input.next();
if (tok.type == "var" || tok.type == "num" || tok.type == "str")
return tok;
unexpected();
});
}
function parse_toplevel() {
var prog = [];
while (!input.eof()) {
prog.push(parse_expression());
if (!input.eof()) checkPuncAndSkip(";");
}
//Return the top level Abstract Syntax Tree, where the top node is a "prog" node
return { type: "prog", prog: prog };
}
function parse_prog() {
var prog = delimited("{", "}", ";", parse_expression);
if (prog.length == 0) return FALSE;
if (prog.length == 1) return prog[0];
return { type: "prog", prog: prog };
}
function parse_expression() {
return maybe_call(function(){
return maybe_binary(parse_atom(), 0);
});
}
}

168
src/Netscript/Tokenizer.js Normal file

@ -0,0 +1,168 @@
/* Tokenizer
* Acts on top of the InputStream class. Takes in a character input stream and and parses it into tokens.
* Tokens can be accessed with peek() and next().
*
* Token types:
* {type: "punc", value: "(" } // punctuation: parens, comma, semicolon etc.
* {type: "num", value: 5 } // numbers (including floats)
* {type: "str", value: "Hello World!" } // strings
* {type: "kw", value: "for/if/" } // keywords, see defs below
* {type: "var", value: "a" } // identifiers/variables
* {type: "op", value: "!=" } // operator characters
* {type: "bool", value: "true" } // Booleans
*
*/
function Tokenizer(input) {
var current = null;
var keywords = " if elif else true false while for ";
return {
next : next,
peek : peek,
eof : eof,
croak : input.croak
}
function is_keyword(x) {
return keywords.indexOf(" " + x + " ") >= 0;
}
function is_digit(ch) {
return /[0-9]/i.test(ch);
}
//An identifier can start with any letter or an underscore
function is_id_start(ch) {
return /[a-z_]/i.test(ch);
}
function is_id(ch) {
return is_id_start(ch) || "?!-<>=0123456789".indexOf(ch) >= 0;
}
function is_op_char(ch) {
return "+-*/%=&|<>!".indexOf(ch) >= 0;
}
function is_punc(ch) {
return ",;(){}[]".indexOf(ch) >= 0;
}
function is_whitespace(ch) {
return " \t\n".indexOf(ch) >= 0;
}
function read_while(predicate) {
var str = "";
while (!input.eof() && predicate(input.peek()))
str += input.next();
return str;
}
function read_number() {
var has_dot = false;
//Reads the number from the input. Checks for only a single decimal point
var number = read_while(function(ch){
if (ch == ".") {
if (has_dot) return false;
has_dot = true;
return true;
}
return is_digit(ch);
});
return { type: "num", value: parseFloat(number) };
}
//This function also checks the identifier against a list of known keywords (defined at the top)
//and will return a kw object rather than identifier if it is one
function read_ident() {
//Identifier must start with a letter or underscore..and can contain anything from ?!-<>=0123456789
var id = read_while(is_id);
return {
type : is_keyword(id) ? "kw" : "var",
value : id
};
}
function read_escaped(end) {
var escaped = false, str = "";
input.next(); //Skip the quotation mark
while (!input.eof()) {
var ch = input.next();
if (escaped) {
str += ch;
escaped = false;
} else if (ch == "\\") {
escaped = true;
} else if (ch == end) {
break;
} else {
str += ch;
}
}
return str;
}
function read_string(ch) {
if (ch == '"') {
return { type: "str", value: read_escaped('"') };
} else if (ch == '\'') {
return { type: "str", value: read_escaped('\'') };
}
}
//Only supports single-line comments right now
function skip_comment() {
read_while(function(ch){ return ch != "\n" });
input.next();
}
//Gets the next token
function read_next() {
//Skip over whitespace
read_while(is_whitespace);
if (input.eof()) return null;
//Peek the next character and decide what to do based on what that
//next character is
var ch = input.peek();
if (ch == "//") {
skip_comment();
return read_next();
}
if (ch == '"' || ch == '\'') return read_string(ch);
if (is_digit(ch)) return read_number();
if (is_id_start(ch)) return read_ident();
if (is_punc(ch)) return {
type : "punc",
value : input.next()
}
if (is_op_char(ch)) return {
type : "op",
value : read_while(is_op_char)
}
}
function peek() {
//Returns current token, unless its null in which case it grabs the next one
//and returns it
return current || (current = read_next());
}
function next() {
//The token might have been peaked already, in which case read_next() was already
//called so just return current
var tok = current;
current = null;
return tok || read_next();
}
function eof() {
return peek() == null;
}
}

116
src/Perk.js Normal file

@ -0,0 +1,116 @@
/* Perks
* Defines Perks that are unlocked when you gain enough reputation in a
* company or faction
*/
Perks = {
FreeCoffeeCompanyPerk: "Free Coffee",
FreeFoodCompanyPerk: "Free Food",
NetworkingCompanyPerk: "Networking",
PersonalTrainerCompanyPerk: "Personal Trainer",
KnowledgeBaseCompanyPerk: "Company Knowledge Base",
NootropicsCompanyPerk: "Company-provided Nootropics",
NetworkingFactionPerk: "Networking",
SupercomputerFactionPerk: "Remote Supercomputer Use",
VPNFactionPerk: "High-Speed VPN",
PrivateServerFactionPerk: "Private Faction Server",
InsiderKnowledgeFactionPerk: "Insider Knowledge",
}
function Perk(name, reqRep, info) {
this.name = name;
this.info = info;
this.requiredRep = reqRep;
//Company/faction specific multipliers
this.mult1 = 1;
this.mult2 = 1;
this.mult3 = 1;
/* Properties below set when a Perk is gained by the player */
this.applied = false;
this.companyPerk = false;
this.companyName = "";
this.factionPerk = false;
this.factionName = "";
}
Perk.prototype.setCompany = function(companyName) {
if (this.factionPerk) {
console.log("ERR: Perk cannot be both faction and company perk");
return;
}
this.companyPerk = true;
this.companyName = companyName;
}
Perk.prototype.setFaction = function(factionName) {
if (this.companyPerk) {
console.log("ERR: Perk cannot be both faction and company perk");
return;
}
this.factionPerk = true;
this.factionName = factionName;
}
Perk.prototype.toJSON = function() {
return Generic_toJSON("Perk", this);
}
Perk.fromJSON = function(value) {
return Generic_fromJSON(Perk, value.data);
}
Reviver.constructors.Perk = Perk;
/* Company Perks */
//Free Coffee - Increased money and hacking exp gain
//Free Food - Increased combat stat gain
//Networking - Company Rep Gain Rate + , Charisma exp gain rate +
//Company Personal Trainer - Increase in combat stat gain rates
//Knowledge Base - Increase hacking skill by some percentage
//Nootropics - Increase hacking mult, and hacking exp gain mult
/* Faction Perks */
//Networking - Faction Rep Gain Rate + , Chariasma Exp Gain Rate +
//Remote Supercomputer - increase in hacking speed, chance, and money
//High Speed VPN - Hack chance increase
//Private Server - Gives you a server with a lot of RAM that you can use
//Insider Knowledge - Ppl in faction from other companies have insider information that lets you hack
// other servers easier. Increase in hack chance
applyPerk = function(perk) {
switch (perk.name) {
case Perks.FreeCoffeeCompanyPerk:
break;
case Perks.FreeFoodCompanyPerk:
break;
case Perks.NetworkingCompanyPerk:
break;
case Perks.PersonalTrainerCompanyPerk:
break;
case Perks.KnowledgeBaseCompanyPerk:
break;
case Perks.NootropicsCompanyPerk:
break;
case Perks.NetworkingFactionPerk:
break;
case Perks.SupercomputerFactionPerk:
break;
case Perks.VPNFactionPerk:
break;
case Perks.PrivateServerFactionPerk:
break;
case Perks.InsiderKnowledgeFactionPerk:
break;
default:
console.log("WARNING: Unrecognized perk: " + perk.name);
return;
}
}
losePerk = function(perk) {
}

759
src/Player.js Normal file

@ -0,0 +1,759 @@
//Netburner Player class
function PlayerObject() {
//Skills and stats
this.hacking_skill = 1;
//Fighting
this.strength = 1; //Damage dealt
this.defense = 1; //Damage received
this.dexterity = 1; //Accuracy
this.agility = 1; //Dodge %
//Labor stats
this.charisma = 1;
//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
//Note: "Lifetime" refers to current ascension, "total" refers to the entire game history
//Accumulative stats and skills
this.total_hacking = 1;
this.total_strength = 1;
this.total_defense = 1;
this.total_dexterity = 1;
this.total_agility = 1;
this.total_charisma = 1;
this.lifetime_hacking = 1;
this.lifetime_strength = 1;
this.lifetime_defense = 1;
this.lifetime_dexterity = 1;
this.lifetime_agility = 1;
this.lifetime_charisma = 1;
//Experience and multipliers
this.hacking_exp = 0;
this.strength_exp = 0;
this.defense_exp = 0;
this.dexterity_exp = 0;
this.agility_exp = 0;
this.charisma_exp = 0;
this.hacking_mult = 1;
this.strength_mult = 1;
this.defense_mult = 1;
this.dexterity_mult = 1;
this.agility_mult = 1;
this.charisma_mult = 1;
this.hacking_exp_mult = 1;
this.strength_exp_mult = 1;
this.defense_exp_mult = 1;
this.dexterity_exp_mult = 1;
this.agility_exp_mult = 1;
this.charisma_exp_mult = 1;
this.company_rep_mult = 1;
this.faction_rep_mult = 1;
//Money
this.money = 0;
this.total_money = 0; //Total money ever earned
this.lifetime_money = 0; //Total money ever earned
//IP Address of Starting (home) computer
this.homeComputer = "";
//Location information
this.city = Locations.Sector12;
this.location = "";
//Company Information
this.companyName = ""; //Name of Company, equivalent to an object from Locations
this.companyPosition = ""; //CompanyPosition object
//Servers
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 = [];
//Factions
this.factions = []; //Names of all factions player has joined
//Augmentations
this.augmentations = []; //Names of all installed augmentations
this.numAugmentations = 0;
//Misc statistics
this.numPeopleKilled = 0;
this.numPeopleKilledTotal = 0;
this.numPeopleKilledLifetime = 0;
//Achievements and achievement progress
//Flag to let the engine know the player is starting an action
// Current actions: hack, analyze
this.startAction = false;
this.actionTime = 0;
//Flags/variables for working (Company, Faction, and Creating Programin)
this.isWorking = false;
this.currentWorkFactionName = "";
this.currentWorkFactionDescription = "";
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.createProgramName = "";
this.timeWorked = 0; //in ms
this.timeNeededToCompleteWork = 0;
this.work_money_mult = 1;
//Used to store the last update time.
this.lastUpdate = new Date().getTime();
};
PlayerObject.prototype.init = function() {
/* Initialize Player's home computer */
var t_homeComp = new Server();
t_homeComp.init(createRandomIp(), "home", "Home PC", true, true, true, true, 1);
this.homeComputer = t_homeComp.ip;
this.currentServer = t_homeComp.ip;
AddToAllServers(t_homeComp);
this.getHomeComputer().programs.push(Programs.NukeProgram);
}
PlayerObject.prototype.getCurrentServer = function() {
return AllServers[this.currentServer];
}
PlayerObject.prototype.getHomeComputer = function() {
return AllServers[this.homeComputer];
}
//Calculates skill level based on experience. The same formula will be used for every skill
// At the maximum possible exp (MAX_INT = 9007199254740991), the hacking skill will be 1796 TODO REcalculate this
// Gets to level 1000 hacking skill at (TODO Determine this)
PlayerObject.prototype.calculateSkill = function(exp) {
return Math.max(Math.floor(32 * Math.log(exp + 534.5) - 200), 1);
}
PlayerObject.prototype.updateSkillLevels = function() {
//TODO Account for total and lifetime stats for achievements and stuff
this.hacking_skill = Math.floor(this.calculateSkill(this.hacking_exp) * this.hacking_mult);
this.strength = Math.floor(this.calculateSkill(this.strength_exp) * this.strength_mult);
this.defense = Math.floor(this.calculateSkill(this.defense_exp) * this.defense_mult);
this.dexterity = Math.floor(this.calculateSkill(this.dexterity_exp) * this.dexterity_mult);
this.agility = Math.floor(this.calculateSkill(this.agility_exp) * this.agility_mult);
this.charisma = Math.floor(this.calculateSkill(this.charisma_exp) * this.charisma_mult);
}
//Calculates the chance of hacking a server
//The formula is:
// (hacking_chance_multiplier * hacking_skill - requiredLevel) 100 - difficulty
// ----------------------------------------------------------- * -----------------
// (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 skillChance = (skillMult - this.getCurrentServer().requiredHackingSkill) / skillMult;
var chance = skillChance * difficultyMult;
if (chance < 0) {return 0;}
else {return chance;}
}
//Calculate the time it takes to hack a server in seconds. Returns the time
//The formula is:
// (requiredLevel * difficulty)
// ------------------------------- * hacking_speed_multiplier
// hacking_skill
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;
}
//Calculates the PERCENTAGE of a server's money that the player will hack from the server if successful
//The formula is:
// (hacking_skill - (requiredLevel-1)) 100 - difficulty
// --------------------------------------* ----------------------- * hacking_money_multiplier
// hacking_skill 100
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;
console.log("Percent money hacked calculated to be: " + percentMoneyHacked);
if (percentMoneyHacked < 0) {return 0;}
if (percentMoneyHacked > 1) {return 1;}
return percentMoneyHacked;
}
//Returns how much EXP the player gains on a successful hack
//The formula is:
// difficulty * requiredLevel * hacking_multiplier
//
// Note: Keep it at an integer for now,
PlayerObject.prototype.calculateExpGain = function() {
return Math.round(this.getCurrentServer().hackDifficulty * this.hacking_exp_mult);
}
//Hack/Analyze a server. Return the amount of time the hack will take. This lets the Terminal object know how long to disable itself for
//This assumes that the server being hacked is not purchased by the player, that the player's hacking skill is greater than the
//required hacking skill and that the player has admin rights.
PlayerObject.prototype.hack = function() {
this.actionTime = this.calculateHackingTime();
console.log("Hacking time: " + this.actionTime);
//Set the startAction flag so the engine starts the hacking process
this.startAction = true;
}
PlayerObject.prototype.analyze = function() {
//TODO Analyze only takes 5 seconds for now..maybe change this in the future?
this.actionTime = 5;
this.startAction = true;
}
PlayerObject.prototype.gainMoney = function(money) {
if (isNaN(money)) {
console.log("ERR: NaN passed into Player.gainMoney()"); return;
}
this.money += money;
this.total_money += money;
this.lifetime_money += money;
}
PlayerObject.prototype.gainHackingExp = function(exp) {
if (isNaN(exp)) {
console.log("ERR: NaN passed into Player.gainHackingExp()"); return;
}
this.hacking_exp += exp;
}
PlayerObject.prototype.gainStrengthExp = function(exp) {
if (isNaN(exp)) {
console.log("ERR: NaN passed into Player.gainStrengthExp()"); return;
}
this.strength_exp += exp;
}
PlayerObject.prototype.gainDefenseExp = function(exp) {
if (isNaN(exp)) {
console.log("ERR: NaN passed into player.gainDefenseExp()"); return;
}
this.defense_exp += exp;
}
PlayerObject.prototype.gainDexterityExp = function(exp) {
if (isNaN(exp)) {
console.log("ERR: NaN passed into Player.gainDexterityExp()"); return;
}
this.dexterity_exp += exp;
}
PlayerObject.prototype.gainAgilityExp = function(exp) {
if (isNaN(exp)) {
console.log("ERR: NaN passed into Player.gainAgilityExp()"); return;
}
this.agility_exp += exp;
}
PlayerObject.prototype.gainCharismaExp = function(exp) {
if (isNaN(exp)) {
console.log("ERR: NaN passed into Player.gainCharismaExp()"); return;
}
this.charisma_exp += exp;
}
/* Working for Company */
PlayerObject.prototype.finishWork = function(cancelled) {
//Since the work was cancelled early, player only gains half of what they've earned so far
var cancMult = 1;
if (cancelled) {cancMult = 2;}
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);
var company = Companies[this.companyName];
company.playerReputation += (this.workRepGained / cancMult);
this.gainMoney(this.workMoneyGained / cancMult);
this.updateSkillLevels();
var txt = "";
if (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>";
} 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>";
}
dialogBoxCreate(txt);
var mainMenu = document.getElementById("mainmenu-container");
mainMenu.style.visibility = "visible";
this.isWorking = false;
Engine.loadTerminalContent();
}
PlayerObject.prototype.startWork = function() {
this.isWorking = true;
this.currentWorkFactionName = "";
this.currentWorkFactionDescription = "";
this.createProgramName = "";
this.workHackExpGainRate = this.getWorkHackExpGain();
this.workStrExpGainRate = this.getWorkStrExpGain();
this.workDefExpGainRate = this.getWorkDefExpGain();
this.workDexExpGainRate = this.getWorkDexExpGain();
this.workAgiExpGainRate = this.getWorkAgiExpGain();
this.workChaExpGainRate = this.getWorkChaExpGain();
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");
//Remove all old event listeners from Cancel button
var newCancelButton = cancelButton.cloneNode(true);
cancelButton.parentNode.replaceChild(newCancelButton, cancelButton);
newCancelButton.addEventListener("click", function() {
Player.finishWork(true);
return false;
});
//Display Work In Progress Screen
Engine.loadWorkInProgressContent();
}
PlayerObject.prototype.work = function(numCycles) {
this.workRepGainRate = this.getWorkRepGain();
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;
var cyclesPerSec = 1000 / Engine._idleSpeed;
this.timeWorked += Engine._idleSpeed * numCycles;
//If timeWorked == 8 hours, then finish. You can only gain 8 hours worth of exp and money
if (this.timeWorked >= CONSTANTS.MillisecondsPer8Hours) {
var maxCycles = CONSTANTS.GameCyclesPer8Hours;
this.workHackExpGained = this.workHackExpGainRate * maxCycles;
this.workStrExpGained = this.workStrExpGainRate * maxCycles;
this.workDefExpGained = this.workDefExpGainRate * maxCycles;
this.workDexExpGained = this.workDexExpGainRate * maxCycles;
this.workAgiExpGained = this.workAgiExpGainRate * maxCycles;
this.workChaExpGained = this.workChaExpGainRate * maxCycles;
this.workRepGained = this.workRepGainRate * maxCycles;
this.workMoneyGained = this.workMoneyGainRate * maxCycles;
this.finishWork(false);
}
var txt = document.getElementById("work-in-progress-text");
txt.innerHTML = "You are currently working as a " + this.companyPosition.positionName +
" 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>" +
"You will automatically finish after working for 8 hours. You can cancel earlier if you wish, <br>" +
"but you will only gain half of the experience, money, and reputation you've earned so far."
}
/* 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);
var faction = Factions[this.currentWorkFactionName];
faction.playerReputation += (this.workRepGained);
this.gainMoney(this.workMoneyGained);
this.updateSkillLevels();
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>";
dialogBoxCreate(txt);
var mainMenu = document.getElementById("mainmenu-container");
mainMenu.style.visibility = "visible";
Player.isWorking = false;
Engine.loadTerminalContent();
}
PlayerObject.prototype.startFactionWork = function(faction) {
this.isWorking = true;
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");
//Remove all old event listeners from Cancel button
var newCancelButton = cancelButton.cloneNode(true);
cancelButton.parentNode.replaceChild(newCancelButton, cancelButton);
newCancelButton.addEventListener("click", function() {
Player.finishFactionWork(true, faction);
return false;
});
//Display Work In Progress Screen
Engine.loadWorkInProgressContent();
}
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.workRepGainRate = this.hacking_skill / CONSTANTS.MaxSkillLevel * this.faction_rep_mult;
this.workMoneyGainRate = 0;
this.factionWorkType = CONSTANTS.FactionWorkHacking;
this.currentWorkFactionDescription = "carrying out hacking contracts";
this.startFactionWork(faction);
}
PlayerObject.prototype.startFactionFieldWork = function(faction) {
this.workHackExpGainRate = .05 * this.hacking_exp_mult;
this.workStrExpGainRate = .05 * this.strength_exp_mult;
this.workDefExpGainRate = .05 * this.defense_exp_mult;
this.workDexExpGainRate = .05 * this.dexterity_exp_mult;
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"
this.startFactionWork(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.workRepGainRate = this.getFactionSecurityWorkRepGain();
this.workMoneyGainRate = 0;
this.factionWorkType = CONSTANTS.FactionWorkSecurity;
this.currentWorkFactionDescription = "performing security detail"
this.startFactionWork(faction);
}
PlayerObject.prototype.workForFaction = function(numCycles) {
var faction = Factions[this.currentWorkFactionName];
//Constantly update the rep gain rate
switch (this.factionWorkType) {
case CONSTANTS.FactionWorkHacking:
this.workRepGainRate = this.hacking_skill / CONSTANTS.MaxSkillLevel * this.faction_rep_mult;
break;
case CONSTANTS.FactionWorkField:
this.workRepGainRate = this.getFactionFieldWorkRepGain();
break;
case CONSTANTS.FactionWorkSecurity:
this.workRepGainRate = this.getFactionSecurityWorkRepGain();
break;
default:
break;
}
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;
var cyclesPerSec = 1000 / Engine._idleSpeed;
this.timeWorked += Engine._idleSpeed * numCycles;
//If timeWorked == 20 hours, then finish. You can only work for the faction for 20 hours
if (this.timeWorked >= CONSTANTS.MillisecondsPer20Hours) {
var maxCycles = CONSTANTS.GameCyclesPer20Hours;
this.workHackExpGained = this.workHackExpGainRate * maxCycles;
this.workStrExpGained = this.workStrExpGainRate * maxCycles;
this.workDefExpGained = this.workDefExpGainRate * maxCycles;
this.workDexExpGained = this.workDexExpGainRate * maxCycles;
this.workAgiExpGained = this.workAgiExpGainRate * maxCycles;
this.workChaExpGained = this.workChaExpGainRate * maxCycles;
this.workRepGained = this.workRepGainRate * maxCycles;
this.workMoneyGained = this.workMoneyGainRate * maxCycles;
this.finishFactionWork(false, faction);
}
var txt = document.getElementById("work-in-progress-text");
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>" +
"You will automatically finish after working for 20 hours. You can cancel earlier if you wish.<br>" +
"There is no penalty for cancelling earlier.";
}
//Money gained per game cycle
PlayerObject.prototype.getWorkMoneyGain = function() {
var company = Companies[this.companyName];
return this.companyPosition.baseSalary * company.salaryMultiplier * this.work_money_mult;
}
//Hack exp gained per game cycle
PlayerObject.prototype.getWorkHackExpGain = function() {
var company = Companies[this.companyName];
return this.companyPosition.hackingExpGain * company.expMultiplier * this.hacking_exp_mult;
}
//Str exp gained per game cycle
PlayerObject.prototype.getWorkStrExpGain = function() {
var company = Companies[this.companyName];
return this.companyPosition.strengthExpGain * company.expMultiplier * this.strength_exp_mult;
}
//Def exp gained per game cycle
PlayerObject.prototype.getWorkDefExpGain = function() {
var company = Companies[this.companyName];
return this.companyPosition.defenseExpGain * company.expMultiplier * this.defense_exp_mult;
}
//Dex exp gained per game cycle
PlayerObject.prototype.getWorkDexExpGain = function() {
var company = Companies[this.companyName];
return this.companyPosition.dexterityExpGain * company.expMultiplier * this.dexterity_exp_mult;
}
//Agi exp gained per game cycle
PlayerObject.prototype.getWorkAgiExpGain = function() {
var company = Companies[this.companyName];
return this.companyPosition.agilityExpGain * company.expMultiplier * this.agility_exp_mult;
}
//Charisma exp gained per game cycle
PlayerObject.prototype.getWorkChaExpGain = function() {
var company = Companies[this.companyName];
return this.companyPosition.charismaExpGain * company.expMultiplier * this.charisma_exp_mult;
}
//Reputation gained per game cycle
PlayerObject.prototype.getWorkRepGain = function() {
var jobPerformance = this.companyPosition.calculateJobPerformance(this.hacking_skill, this.strength,
this.defense, this.dexterity,
this.agility, this.charisma);
return jobPerformance * this.company_rep_mult;
}
PlayerObject.prototype.getFactionSecurityWorkRepGain = function() {
var t = (this.hacking_skill / CONSTANTS.MaxSkillLevel +
this.strength / CONSTANTS.MaxSkillLevel +
this.defense / CONSTANTS.MaxSkillLevel +
this.dexterity / CONSTANTS.MaxSkillLevel +
this.agility / CONSTANTS.MaxSkillLevel) / 5;
return t * this.faction_rep_mult;
}
PlayerObject.prototype.getFactionFieldWorkRepGain = function() {
var t = (this.hacking_skill / CONSTANTS.MaxSkillLevel +
this.strength / CONSTANTS.MaxSkillLevel +
this.defense / CONSTANTS.MaxSkillLevel +
this.dexterity / CONSTANTS.MaxSkillLevel +
this.agility / CONSTANTS.MaxSkillLevel +
this.charisma / CONSTANTS.MaxSkillLevel) / 6;
return t * this.faction_rep_mult;
}
/* Creating a Program */
PlayerObject.prototype.startCreateProgramWork = function(programName, time) {
this.isWorking = true;
this.timeWorked = 0;
this.timeNeededToCompleteWork = time;
this.currentWorkFactionName = "";
this.currentWorkFactionDescription = "";
this.createProgramName = programName;
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.finishCreateProgramWork(true, programName);
return false;
});
//Display Work In Progress Screen
Engine.loadWorkInProgressContent();
}
PlayerObject.prototype.createProgramWork = function(numCycles) {
this.timeWorked += Engine._idleSpeed * numCycles;
var programName = this.createProgramName;
if (this.timeWorked >= this.timeNeededToCompleteWork) {
this.finishCreateProgramWork(false, programName);
}
var txt = document.getElementById("work-in-progress-text");
txt.innerHTML = "You are currently working on coding " + programName + ".<br><br> " +
"You have been working for " + convertTimeMsToTimeElapsedString(this.timeWorked) + "<br><br>" +
"The program is " + (this.timeWorked / this.timeNeededToCompleteWork * 100).toFixed(2) + "% complete. <br>" +
"If you cancel, you will lose all of your progress.";
}
PlayerObject.prototype.finishCreateProgramWork = function(cancelled, programName) {
if (cancelled == false) {
dialogBoxCreate("You've finished creating " + programName + "!<br>" +
"The new program can be found on your home computer.");
Player.getHomeComputer().programs.push(programName);
}
var mainMenu = document.getElementById("mainmenu-container");
mainMenu.style.visibility = "visible";
Player.isWorking = false;
Engine.loadTerminalContent();
}
//Functions for saving and loading the Player data
PlayerObject.prototype.toJSON = function() {
return Generic_toJSON("PlayerObject", this);
}
PlayerObject.fromJSON = function(value) {
return Generic_fromJSON(PlayerObject, value.data);
}
Reviver.constructors.PlayerObject = PlayerObject;
Player = new PlayerObject();

110
src/Prestige.js Normal file

@ -0,0 +1,110 @@
/* Prestige functions */
//Prestige by purchasing augmentation
function prestigeAugmentation() {
Player.total_hacking += Player.hacking_skill;
Player.lifetime_hacking += Player.hacking_skill;
Player.total_strength += Player.strength;
Player.lifetime_strength += Player.strength;
Player.total_defense += Player.defense;
Player.lifetime_defense += Player.defense;
Player.total_dexterity += Player.dexterity;
Player.lifetime_dexterity += Player.dexterity;
Player.total_agility += Player.agility;
Player.lifetime_agility += Player.agility;
Player.total_charisma += Player.charisma;
Player.lifetime_charisma += Player.charisma;
Player.hacking_skill = 1;
Player.strength = 1;
Player.defense = 1;
Player.dexterity = 1;
Player.agility = 1;
Player.charisma = 1;
Player.hacking_exp = 0;
Player.strength_exp = 0;
Player.defense_exp = 0;
Player.dexterity_exp = 0;
Player.agility_exp = 0;
Player.charisma_exp = 0;
Player.money = 0;
Player.homeComputer = "";
Player.city = Locations.Sector12;
Player.location = "";
Player.companyName = "";
Player.companyPosition = "";
Player.currentServer = "";
Player.discoveredServers = [];
Player.purchasedServers = [];
Player.factions = [];
Player.startAction = false;
Player.actionTime = 0;
Player.isWorking = false;
Player.currentWorkFactionName = "";
Player.currentWorkFactionDescription = "";
Player.workHackExpGainRate = 0;
Player.workStrExpGainRate = 0;
Player.workDefExpGainRate = 0;
Player.workDexExpGainRate = 0;
Player.workAgiExpGainRate = 0;
Player.workChaExpGainRate = 0;
Player.workRepGainRate = 0;
Player.workMoneyGainRate = 0;
Player.workHackExpGained = 0;
Player.workStrExpGained = 0;
Player.workDefExpGained = 0;
Player.workDexExpGained = 0;
Player.workAgiExpGained = 0;
Player.workChaExpGained = 0;
Player.workRepGained = 0;
Player.workMoneyGained = 0;
Player.timeWorked = 0;
Player.lastUpdate = new Date().getTime();
//Delete all servers
for (var member in AllServers) {
delete AllServers[member];
}
AllServers = {};
//Delete Special Server IPs
for (var member in SpecialServerIps) {
delete SpecialServerIps[member];
}
SpecialServersIps = null;
//Delete Companies
for (var member in Companies) {
delete Companies[member];
}
Companies = {};
//Delete Factions
for (var member in Factions) {
delete Factions[member];
}
Factions = {};
//Inititialization
SpecialServerIps = new SpecialServerIpsMap();
Player.init();
initForeignServers();
initCompanies();
initFactions();
CompanyPositions.init();
}

31
src/PurchaseServers.js Normal file

@ -0,0 +1,31 @@
/* Functions to handle Purchase of Servers */
purchaseServer = function(ram, cost) {
//Check if player has enough money
if (cost > Player.money) {
dialogBoxCreate("You don't have enough money to purchase this server!");
return;
}
var newServ = new Server();
var hostname = document.getElementById("purchase-server-box-input").value;
if (hostname == "") {
dialogBoxCreate("You must enter a hostname for your new server!");
return;
}
//Create server
newServ.init(createRandomIp(), hostname, "", true, false, true, true, ram);
AddToAllServers(newServ);
//Add to Player's purchasedServers array
Player.purchasedServers.push(newServ.ip);
//Connect new server to home computer
var homeComputer = Player.getHomeComputer();
homeComputer.serversOnNetwork.push(newServ.ip);
newServ.serversOnNetwork.push(homeComputer.ip);
Player.money -= cost;
dialogBoxCreate("Server successfully purchased with hostname " + hostname);
}

221
src/Script.js Normal file

@ -0,0 +1,221 @@
/* Script.js
* Script object
*/
//Define key commands in script editor (ctrl x to 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();
}
}
});
//Checks that the string contains only valid characters for a filename, which are alphanumeric,
// underscores and hyphens
function checkValidFilename(filename) {
var regex = /^[a-zA-Z0-9_-]+$/;
if (filename.match(regex)) {
return true;
}
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 = "";
this.ramUsage = 0;
this.server = ""; //IP of server this script is on
this.logs = []; //Script logging. Array of strings, with each element being a log entry
/* Properties to calculate offline progress. Only applies for infinitely looping scripts */
//Number of instructions ("lines") in the code. Any call ending in a ;
//is considered one instruction. Used to calculate ramUsage
this.numInstructions = 0;
//Stats to display on the Scripts menu, and used to determine offline progress
this.offlineRunningTime = 0; //Seconds
this.offlineMoneyMade = 0;
this.offlineExpGained = 0;
this.onlineRunningTime = 0; //Seconds
this.onlineMoneyMade = 0;
this.onlineExpGained = 0;
};
//Get the script data from the Script Editor and save it to the object
Script.prototype.saveScript = function() {
if (Engine.currentPage == Engine.Page.ScriptEditor) {
//Update code and filename
var code = document.getElementById("script-editor-text").value;
this.code = code;
var filename = document.getElementById("script-editor-filename").value + ".script";
this.filename = filename;
//Server
this.server = Player.currentServer;
//Calculate/update number of instructions, ram usage, execution time, etc.
this.updateNumInstructions();
this.updateRamUsage();
//Clear the stats when the script is updated
this.offlineRunningTime = 0; //Seconds
this.offlineMoneyMade = 0;
this.onlineRunningTime = 0; //Seconds
this.onlineMoneyMade = 0;
this.lastUpdate = 0;
}
}
//Calculates the number of instructions, which is just determined by number of semicolons
Script.prototype.updateNumInstructions = function() {
var numSemicolons = this.code.split(";").length - 1;
this.numInstructions = numSemicolons;
}
//Updates how much RAM the script uses when it is running.
//Right now, it is determined solely by the number of instructions
//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;
}
Script.prototype.log = function(txt) {
if (this.logs.length > CONSTANTS.MaxLogCapacity) {
//Delete first element and add new log entry to the end.
//TODO Eventually it might be better to replace this with circular array
//to improve performance
this.logs.shift();
}
this.logs.push(txt);
}
Script.prototype.displayLog = function() {
for (var i = 0; i < this.logs.length; ++i) {
post(this.logs[i]);
}
}
Script.prototype.toJSON = function() {
return Generic_toJSON("Script", this);
}
Script.fromJSON = function(value) {
return Generic_fromJSON(Script, value.data);
}
Reviver.constructors.Script = Script;
//Called when the game is loaded. Loads all running scripts (from all servers)
//into worker scripts so that they will start running
loadAllRunningScripts = function() {
var count = 0;
for (var property in AllServers) {
if (AllServers.hasOwnProperty(property)) {
var server = AllServers[property];
//Reset each server's RAM usage to 0
server.ramUsed = 0;
for (var j = 0; j < server.runningScripts.length; ++j) {
count++;
//runningScripts array contains only names, so find the actual script object
var script = server.getScript(server.runningScripts[j]);
if (script == null) {continue;}
addWorkerScript(script, server);
//Offline production
scriptCalculateOfflineProduction(script);
}
}
}
console.log("Loaded " + count.toString() + " running scripts");
}
scriptCalculateOfflineProduction = function(script) {
//The Player object stores the last update time from when we were online
var thisUpdate = new Date().getTime();
var lastUpdate = Player.lastUpdate;
var timePassed = (thisUpdate - lastUpdate) / 1000; //Seconds
console.log("Offline for " + timePassed.toString() + " seconds");
//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;
if (confidence >= 1) {confidence = 1;}
console.log("onlineRunningTime: " + script.onlineRunningTime.toString());
console.log("Confidence: " + confidence.toString());
//A script's offline production will always be at most half of its online production.
var production = (1/2) * (script.onlineMoneyMade / script.onlineRunningTime) * timePassed;
production *= confidence;
var expGain = (1/2) * (script.onlineExpGained / script.onlineRunningTime) * timePassed;
expGain *= confidence;
//Account for production in Player and server
Player.gainMoney(production);
Player.hacking_exp += expGain;
var server = AllServers[script.server];
server.moneyAvailable -= production;
if (server.moneyAvailable < 0) {server.moneyAvailable = 0;}
//Update script stats
script.offlineMoneyMade += production;
script.offlineRunningTime += timePassed;
script.offlineExpGained += expGain;
//DEBUG
var serverName = AllServers[script.server].hostname;
console.log(script.filename + " from server " + serverName + " generated $" + production.toString() + " while offline");
}

698
src/Server.js Normal file

@ -0,0 +1,698 @@
//Netburner Server class
//TODO Make a map of all IPS in the game so far so that we don't accidentally
// get duplicate IPs..however unlikely it is
function Server() {
/* Properties */
//Connection information
this.ip = "0.0.0.0";
this.hostname = "";
this.organizationName = "";
this.isOnline = true;
this.isConnectedTo = false; //Whether the player is connected to this server
//Access information
this.hasAdminRights = false; //Whether player has admin rights
this.purchasedByPlayer = false;
//RAM, CPU speed and Scripts
this.maxRam = 1; //GB
this.ramUsed = 0;
this.cpuSpeed = 1; //MHz
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
//by a separate formula
this.requiredHackingSkill = 1;
//Total money available on this server. How much of this you hack will be determined
//by a formula related to hacking skill. The money available on a server will steadily increase
//over time, and it will decrease when you hack it
this.moneyAvailable = 0;
//Parameters used in formulas that dictate how moneyAvailable and requiredHackingSkill change.
this.hackDifficulty = 1; //Affects hack success rate and how the requiredHackingSkill increases over time (1-100)
this.serverGrowth = 0; //Affects how the moneyAvailable increases (0-100)
this.timesHacked = 0;
//The IP's of all servers reachable from this one (what shows up if you run scan/netstat)
// NOTE: Only contains IP and not the Server objects themselves
this.serversOnNetwork = [];
//Port information, required for porthacking servers to get admin rights
this.numOpenPortsRequired = 5;
this.sshPortOpen = false; //Port 22
this.ftpPortOpen = false; //Port 21
this.smtpPortOpen = false; //Port 25
this.httpPortOpen = false; //Port 80
this.sqlPortOpen = false; //Port 1433
this.openPortCount = 0;
};
//Initialize the properties of a server
Server.prototype.init = function(ip, hostname, organizationName, onlineStatus, isConnectedTo, adminRights, purchasedByPlayer, maxRam) {
this.ip = ip;
this.hostname = hostname;
this.organizationName = organizationName;
this.isOnline = onlineStatus;
this.isConnectedTo = isConnectedTo;
this.hasAdminRights = adminRights;
this.purchasedByPlayer = purchasedByPlayer;
this.maxRam = maxRam;
}
//Set the hacking properties of a server
Server.prototype.setHackingParameters = function(requiredHackingSkill, moneyAvailable, hackDifficulty, serverGrowth) {
this.requiredHackingSkill = requiredHackingSkill;
this.moneyAvailable = moneyAvailable;
this.hackDifficulty = hackDifficulty;
this.serverGrowth = serverGrowth;
}
//Set the port properties of a server
//Right now its only the number of open ports needed to PortHack the server.
Server.prototype.setPortProperties = function(numOpenPortsReq) {
this.numOpenPortsRequired = numOpenPortsReq;
}
//The serverOnNetwork array holds the IP of all the servers. This function
//returns the actual Server objects
Server.prototype.getServerOnNetwork = function(i) {
if (i > this.serversOnNetwork.length) {
console.log("Tried to get server on network that was out of range");
return;
}
return AllServers[this.serversOnNetwork[i]];
}
//Given the name of the script, returns the corresponding
//script object on the server (if it exists)
Server.prototype.getScript = function(scriptName) {
for (var i = 0; i < this.scripts.length; i++) {
if (this.scripts[i].filename == scriptName) {
return this.scripts[i];
}
}
return null;
}
//Functions for loading and saving a Server
Server.prototype.toJSON = function() {
return Generic_toJSON("Server", this);
}
Server.fromJSON = function(value) {
return Generic_fromJSON(Server, value.data);
}
Reviver.constructors.Server = Server;
//world_daemon: new Server(), //Final server for 2nd tier prestige. Discover that the world is a simulation
/* Initialization. Called only when loading a new game( no save file) */
initForeignServers = function() {
//MegaCorporations
var ECorpServer = new Server();
ECorpServer.init(createRandomIp(), "ecorp", "ECorp", true, false, false, false, 256);
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.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.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.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.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.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.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.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.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.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.setHackingParameters(999, 1000000, 99, 1);
FulcrumSecretTechnologiesServer.setPortProperties(5);
AddToAllServers(FulcrumSecretTechnologiesServer);
SpecialServerIps.addIp("Fulcrum Secret Technologies Server", FulcrumSecretTechnologiesServer.ip);
var StormTechnologiesServer = new Server();
StormTechnologiesServer.init(createRandomIp(), "stormtech", "Storm Technologies", true, false, false, false, 128);
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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.setHackingParameters(275, 100000000, 50, 50);
JohnsonOrthopedicsServer.setPortProperties(2);
AddToAllServers(JohnsonOrthopedicsServer);
//"Low level" targets
var FoodNStuffServer = new Server();
FoodNStuffServer.init(createRandomIp(), "foodnstuff", "Food N Stuff Supermarket", true, false, false, false, 2);
FoodNStuffServer.setHackingParameters(1, 500000, 10, 5);
FoodNStuffServer.setPortProperties(0);
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.setPortProperties(0);
AddToAllServers(SigmaCosmeticsServer);
var JoesGunsServer = new Server();
JoesGunsServer.init(createRandomIp(), "joesguns", "Joe's Guns", true, false, false, false, 8);
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.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.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.setPortProperties(1);
AddToAllServers(NeoNightclubServer);
var SilverHelixServer = new Server();
SilverHelixServer.init(createRandomIp(), "silver-helix", "Silver Helix", true, false, false, false, 8);
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);
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.setPortProperties(1);
AddToAllServers(HaraKiriSushiBarServer);
var PhantasyServer = new Server();
PhantasyServer.init(createRandomIp(), "phantasy", "Phantasy Club", true, false, false, false, 8);
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.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.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.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.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.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.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.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.setPortProperties(4);
AddToAllServers(BitRunnersServer);
var NiteSecServer = new Server();
NiteSecServer.init(createRandomIp(), "avmnite-02h", "NiteSec", true, false, false, false, 1);
NiteSecServer.setPortProperties(2);
AddToAllServers(NiteSecServer);
var DarkArmyServer = new Server();
DarkArmyServer.init(createRandomIp(), ".", ".", true, false, false, false, 1);
DarkArmyServer.setPortProperties(5);
AddToAllServers(DarkArmyServer);
var CyberSecServer = new Server();
CyberSecServer.init(createRandomIp(), "CSEC", "CyberSec", true, false, false, false, 1);
CyberSecServer.setPortProperties(2);
AddToAllServers(CyberSecServer);
/* Create a randomized network for all the foreign servers */
//Groupings for creating a randomized network
var NetworkGroup1 = [IronGymServer, FoodNStuffServer, SigmaCosmeticsServer, JoesGunsServer, HongFangTeaHouseServer, HaraKiriSushiBarServer];
var NetworkGroup2 = [MaxHardwareServer, NectarNightclubServer, Zer0NightclubServer];
var NetworkGroup3 = [OmegaSoftwareServer, PhantasyServer, SilverHelixServer, NeoNightclubServer];
var NetworkGroup4 = [CrushFitnessGymServer, NetLinkTechnologiesServer, CompuTekServer, TheHubServer, JohnsonOrthopedicsServer];
var NetworkGroup5 = [CatalystVenturesServer, SysCoreSecuritiesServer, SummitUniversityServer, ZBInstituteOfTechnologyServer, RothmanUniversityServer];
var NetworkGroup6 = [LexoCorpServer, RhoConstructionServer, AlphaEnterprisesServer, AevumPoliceServer, MilleniumFitnessGymServer, CyberSecServer, NiteSecServer];
var NetworkGroup7 = [GlobalPharmaceuticalsServer, AeroCorpServer, GalacticCyberSystemsServer, SnapFitnessGymServer];
var NetworkGroup8 = [DeltaOneServer, UnitaLifeGroupServer, OmniaCybersystemsServer];
var NetworkGroup9 = [ZeusMedicalServer, SolarisSpaceSystemsServer, UniversalEnergyServer, IcarusMicrosystemsServer, DefCommServer];
var NetworkGroup10 = [NovaMedicalServer, ZBDefenseServer, TaiYangDigitalServer, InfoCommServer];
var NetworkGroup11 = [AppliedEnergeticsServer, MicrodyneTechnologiesServer, TitanLabsServer, BitRunnersServer];
var NetworkGroup12 = [VitaLifeServer, HeliosLabsServer, StormTechnologiesServer, FulcrumTechnologiesServer];
var NetworkGroup13 = [KuaiGongInternationalServer, FourSigmaServer, OmniTekIncorporatedServer, DarkArmyServer];
var NetworkGroup14 = [PowerhouseGymServer, ClarkeIncorporatedServer, NWOServer, BladeIndustriesServer, BachmanAndAssociatesServer];
var NetworkGroup15 = [FulcrumSecretTechnologiesServer, MegaCorpServer, ECorpServer];
for (var i = 0; i < NetworkGroup2.length; i++) {
var randomServerFromPrevGroup = NetworkGroup1[Math.floor(Math.random() * NetworkGroup1.length)];
NetworkGroup2[i].serversOnNetwork.push(randomServerFromPrevGroup.ip);
randomServerFromPrevGroup.serversOnNetwork.push(NetworkGroup2[i].ip);
}
for (var i = 0; i < NetworkGroup3.length; i++) {
var randomServerFromPrevGroup = NetworkGroup2[Math.floor(Math.random() * NetworkGroup2.length)];
NetworkGroup3[i].serversOnNetwork.push(randomServerFromPrevGroup.ip);
randomServerFromPrevGroup.serversOnNetwork.push(NetworkGroup3[i].ip);
}
for (var i = 0; i < NetworkGroup4.length; i++) {
var randomServerFromPrevGroup = NetworkGroup3[Math.floor(Math.random() * NetworkGroup3.length)];
NetworkGroup4[i].serversOnNetwork.push(randomServerFromPrevGroup.ip);
randomServerFromPrevGroup.serversOnNetwork.push(NetworkGroup4[i].ip);
}
for (var i = 0; i < NetworkGroup5.length; i++) {
var randomServerFromPrevGroup = NetworkGroup4[Math.floor(Math.random() * NetworkGroup4.length)];
NetworkGroup5[i].serversOnNetwork.push(randomServerFromPrevGroup.ip);
randomServerFromPrevGroup.serversOnNetwork.push(NetworkGroup5[i].ip);
}
for (var i = 0; i < NetworkGroup6.length; i++) {
var randomServerFromPrevGroup = NetworkGroup5[Math.floor(Math.random() * NetworkGroup5.length)];
NetworkGroup6[i].serversOnNetwork.push(randomServerFromPrevGroup.ip);
randomServerFromPrevGroup.serversOnNetwork.push(NetworkGroup6[i].ip);
}
for (var i = 0; i < NetworkGroup7.length; i++) {
var randomServerFromPrevGroup = NetworkGroup6[Math.floor(Math.random() * NetworkGroup6.length)];
NetworkGroup7[i].serversOnNetwork.push(randomServerFromPrevGroup.ip);
randomServerFromPrevGroup.serversOnNetwork.push(NetworkGroup7[i].ip);
}
for (var i = 0; i < NetworkGroup8.length; i++) {
var randomServerFromPrevGroup = NetworkGroup7[Math.floor(Math.random() * NetworkGroup7.length)];
NetworkGroup8[i].serversOnNetwork.push(randomServerFromPrevGroup.ip);
randomServerFromPrevGroup.serversOnNetwork.push(NetworkGroup8[i].ip);
}
for (var i = 0; i < NetworkGroup9.length; i++) {
var randomServerFromPrevGroup = NetworkGroup8[Math.floor(Math.random() * NetworkGroup8.length)];
NetworkGroup9[i].serversOnNetwork.push(randomServerFromPrevGroup.ip);
randomServerFromPrevGroup.serversOnNetwork.push(NetworkGroup9[i].ip);
}
for (var i = 0; i < NetworkGroup10.length; i++) {
var randomServerFromPrevGroup = NetworkGroup9[Math.floor(Math.random() * NetworkGroup9.length)];
NetworkGroup10[i].serversOnNetwork.push(randomServerFromPrevGroup.ip);
randomServerFromPrevGroup.serversOnNetwork.push(NetworkGroup10[i].ip);
}
for (var i = 0; i < NetworkGroup11.length; i++) {
var randomServerFromPrevGroup = NetworkGroup10[Math.floor(Math.random() * NetworkGroup10.length)];
NetworkGroup11[i].serversOnNetwork.push(randomServerFromPrevGroup.ip);
randomServerFromPrevGroup.serversOnNetwork.push(NetworkGroup11[i].ip);
}
for (var i = 0; i < NetworkGroup12.length; i++) {
var randomServerFromPrevGroup = NetworkGroup11[Math.floor(Math.random() * NetworkGroup11.length)];
NetworkGroup12[i].serversOnNetwork.push(randomServerFromPrevGroup.ip);
randomServerFromPrevGroup.serversOnNetwork.push(NetworkGroup12[i].ip);
}
for (var i = 0; i < NetworkGroup13.length; i++) {
var randomServerFromPrevGroup = NetworkGroup12[Math.floor(Math.random() * NetworkGroup12.length)];
NetworkGroup13[i].serversOnNetwork.push(randomServerFromPrevGroup.ip);
randomServerFromPrevGroup.serversOnNetwork.push(NetworkGroup13[i].ip);
}
for (var i = 0; i < NetworkGroup14.length; i++) {
var randomServerFromPrevGroup = NetworkGroup13[Math.floor(Math.random() * NetworkGroup13.length)];
NetworkGroup14[i].serversOnNetwork.push(randomServerFromPrevGroup.ip);
randomServerFromPrevGroup.serversOnNetwork.push(NetworkGroup14[i].ip);
}
for (var i = 0; i < NetworkGroup15.length; i++) {
var randomServerFromPrevGroup = NetworkGroup14[Math.floor(Math.random() * NetworkGroup14.length)];
NetworkGroup15[i].serversOnNetwork.push(randomServerFromPrevGroup.ip);
randomServerFromPrevGroup.serversOnNetwork.push(NetworkGroup15[i].ip);
}
//Connect the first tier of servers to the player's home computer
for (var i = 0; i < NetworkGroup1.length; i++) {
Player.getHomeComputer().serversOnNetwork.push(NetworkGroup1[i].ip);
NetworkGroup1[i].serversOnNetwork.push(Player.homeComputer);
}
},
//Server growth
processServerGrowth = function(numCycles) {
var numServerGrowthCycles = Math.max(Math.floor(numCycles / 450), 0);
for (var ip in AllServers) {
if (AllServers.hasOwnProperty(ip)) {
var server = AllServers[ip];
//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(1.0004, numServerGrowthCyclesAdjusted);
//console.log("serverGrowth ratio: " + serverGrowth);
server.moneyAvailable *= serverGrowth;
}
}
console.log("Server growth processed for " + numServerGrowthCycles + " cycles");
},
//List of all servers that exist in the game, indexed by their ip
AllServers = {};
SizeOfAllServers = function() {
var size = 0, key;
for (key in AllServers) {
if (AllServers.hasOwnProperty(key)) size++;
}
return size;
}
//Add a server onto the map of all servers in the game
AddToAllServers = function(server) {
var serverIp = server.ip;
if (ipExists(serverIp)) {
console.log("IP of server that's being added: " + serverIp);
console.log("Hostname of the server thats being added: " + server.hostname);
console.log("The server that already has this IP is: " + AllServers[serverIp].hostname);
throw new Error("Error: Trying to add a server with an existing IP");
return;
}
AllServers[serverIp] = server;
}
//Returns server object with corresponding hostname
// Relatively slow, would rather not use this a lot
GetServerByHostname = function(hostname) {
for (var ip in AllServers) {
if (AllServers.hasOwnProperty(ip)) {
if (AllServers[ip].hostname == hostname) {
return AllServers[ip];
}
}
}
return null;
}
//Debugging tool
PrintAllServers = function() {
for (var ip in AllServers) {
if (AllServers.hasOwnProperty(ip)) {
console.log("Ip: " + ip + ", hostname: " + AllServers[ip].hostname);
}
}
}

19
src/SpecialServerIps.js Normal file

@ -0,0 +1,19 @@
/* Holds IP of Special Servers */
function SpecialServerIpsMap() {
}
SpecialServerIpsMap.prototype.addIp = function(name, ip) {
this[name] = ip;
}
SpecialServerIpsMap.prototype.toJSON = function() {
return Generic_toJSON("SpecialServerIpsMap", this);
}
SpecialServerIpsMap.fromJSON = function(value) {
return Generic_fromJSON(SpecialServerIpsMap, value.data);
}
Reviver.constructors.SpecialServerIpsMap = SpecialServerIpsMap();
SpecialServerIps = null;

610
src/Terminal.js Normal file

@ -0,0 +1,610 @@
//Terminal
/* Write text to terminal */
var post = function(input) {
$("#terminal-input").before('<tr class="posted"><td style="color: #66ff33;">' + input.replace( / /g, "&nbsp;" ) + '</td></tr>');
updateTerminalScroll();
}
//Same thing as post but the td cells have ids so they can be animated for the hack progress bar
var hackProgressBarPost = function(input) {
$("#terminal-input").before('<tr class="posted"><td id="hack-progress-bar" style="color: #66ff33;">' + input + '</td></tr>');
updateTerminalScroll();
}
var hackProgressPost = function(input) {
$("#terminal-input").before('<tr class="posted"><td id="hack-progress" style="color: #66ff33;">' + input + '</td></tr>');
updateTerminalScroll();
}
function updateTerminalScroll() {
var element = document.getElementById("terminal-container");
element.scrollTop = element.scrollHeight;
}
var postNetburnerText = function() {
post("Netburner v0.1");
}
//Defines key commands in terminal
$(document).keyup(function(event) {
//Terminal
if (Engine.currentPage == Engine.Page.Terminal) {
//Enter
if (event.keyCode == 13) {
var command = $('input[class=terminal-input]').val();
if (command.length > 0) {
post("> " + command);
//TODO Do i have to switch the order of these two?
Terminal.executeCommand(command);
$('input[class=terminal-input]').val("");
}
}
//Ctrl + c when an "Action" is in progress
if (event.keyCode == 67 && event.ctrlKey && Engine._actionInProgress) {
post("Cancelling...");
Engine._actionInProgress = false;
Terminal.finishAction(true);
}
}
});
//Keep terminal in focus
terminalCtrlPressed = false;
$(document).ready(function() {
if (Engine.currentPage == Engine.Page.Terminal) {
$('.terminal-input').focus();
}
});
$(document).keydown(function(e) {
if (Engine.currentPage == Engine.Page.Terminal) {
if (e.which == 17) {
terminalCtrlPressed = true;
} else if (terminalCtrlPressed == true) {
//Don't focus
} else {
$('.terminal-input').focus();
terminalCtrlPressed = false;
}
}
})
$(document).keyup(function(e) {
if (Engine.currentPage == Engine.Page.Terminal) {
if (e.which == 17) {
terminalCtrlPressed = false;
}
}
})
var Terminal = {
//Flags to determine whether the player is currently running a hack or an analyze
hackFlag: false,
analyzeFlag: false,
finishAction: function(cancelled = false) {
if (Terminal.hackFlag) {
Terminal.finishHack(cancelled);
} else if (Terminal.analyzeFlag) {
Terminal.finishAnalyze(cancelled);
}
},
//Complete the hack/analyze command
finishHack: function(cancelled = false) {
if (cancelled == false) {
console.log("Hack done. Determining success/failure of hack. Re-enabling terminal and changing the id of the hack progress bar");
//Calculate whether hack was successful
var hackChance = Player.calculateHackingChance();
var rand = Math.random();
console.log("Hack success chance: " + hackChance + ", rand: " + rand);
var expGainedOnSuccess = Player.calculateExpGain();
var expGainedOnFailure = Math.round(expGainedOnSuccess / 4);
if (rand < hackChance) { //Success!
var moneyGained = Player.calculatePercentMoneyHacked();
moneyGained = Math.floor(Player.getCurrentServer().moneyAvailable * moneyGained);
//Safety check
if (moneyGained <= 0) {moneyGained = 0;}
Player.getCurrentServer().moneyAvailable -= moneyGained;
Player.gainMoney(moneyGained);
Player.gainHackingExp(expGainedOnSuccess)
post("Hack successful! Gained $" + moneyGained + " and " + expGainedOnSuccess + " hacking EXP");
} else { //Failure
//Player only gains 25% exp for failure? TODO Can change this later to balance
Player.gainHackingExp(expGainedOnFailure)
post("Failed to hack " + Player.getCurrentServer().hostname + ". Gained " + expGainedOnFailure + " hacking EXP");
}
}
//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"/>';
$('input[class=terminal-input]').prop('disabled', false);
Terminal.hackFlag = false;
},
finishAnalyze: function(cancelled = false) {
if (cancelled == false) {
post(Player.getCurrentServer().hostname + ": ");
post("Required hacking skill: " + Player.getCurrentServer().requiredHackingSkill);
//TODO Make these actual estimates by adding a random offset to result?
//TODO Change the text to sound better
post("Estimated chance to hack: " + Math.round(Player.calculateHackingChance() * 100) + "%");
post("Estimated time to hack: " + Math.round(Player.calculateHackingTime()) + " seconds");
post("Estimed total money available on server: $" + Player.getCurrentServer().moneyAvailable);
post("Required number of open ports for NUKE: " + Player.getCurrentServer().numOpenPortsRequired);
if (Player.getCurrentServer().sshPortOpen) {
post("SSH port: Open")
} else {
post("SSH port: Closed")
}
if (Player.getCurrentServer().ftpPortOpen) {
post("FTP port: Open")
} else {
post("FTP port: Closed")
}
if (Player.getCurrentServer().smtpPortOpen) {
post("SMTP port: Open")
} else {
post("SMTP port: Closed")
}
if (Player.getCurrentServer().httpPortOpen) {
post("HTTP port: Open")
} else {
post("HTTP port: Closed")
}
if (Player.getCurrentServer().sqlPortOpen) {
post("SQL port: Open")
} else {
post("SQL port: Closed")
}
}
Terminal.analyzeFlag = false;
//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"/>';
$('input[class=terminal-input]').prop('disabled', false);
},
executeCommand: function(command) {
var commandArray = command.split(" ");
if (commandArray.length == 0) {
return;
}
switch (commandArray[0]) {
case "analyze":
if (commandArray.length != 1) {
post("Incorrect usage of analyze command. Usage: analyze"); return;
}
//Analyze the current server for information
Terminal.analyzeFlag = true;
post("Analyzing system...");
hackProgressPost("Time left:");
hackProgressBarPost("[");
Player.analyze();
//Disable terminal
document.getElementById("terminal-input-td").innerHTML = '<input type="text" class="terminal-input"/>';
$('input[class=terminal-input]').prop('disabled', true);
break;
case "clear":
case "cls":
if (commandArray.length != 1) {
post("Incorrect usage of clear/cls command. Usage: clear/cls"); return;
}
$("#terminal tr:not(:last)").remove();
postNetburnerText();
break;
case "connect":
case "telnet":
//Disconnect from current server in terminal and connect to new one
if (commandArray.length != 2) {
post("Incorrect usage of connect/telnet command. Usage: connect/telnet [ip/hostname]");
return;
}
var ip = commandArray[1];
for (var i = 0; i < Player.getCurrentServer().serversOnNetwork.length; i++) {
if (Player.getCurrentServer().getServerOnNetwork(i).ip == ip || Player.getCurrentServer().getServerOnNetwork(i).hostname == ip) {
Player.getCurrentServer().isConnectedTo = false;
Player.currentServer = Player.getCurrentServer().getServerOnNetwork(i).ip;
Player.getCurrentServer().isConnectedTo = true;
post("Connected to " + ip);
return;
}
}
post("Host not found");
break;
case "free":
if (commandArray.length != 1) {
post("Incorrect usage of free command. Usage: free"); return;
}
post("Total: " + Player.getCurrentServer().maxRam.toString() + " GB");
post("Used: " + Player.getCurrentServer().ramUsed.toString() + " GB");
post("Available: " + (Player.getCurrentServer().maxRam - Player.getCurrentServer().ramUsed).toString() + " GB");
break;
case "hack":
if (commandArray.length != 1) {
post("Incorrect usage of hack command. Usage: hack"); return;
}
//Hack the current PC (usually for money)
//You can't hack your home pc or servers you purchased
if (Player.getCurrentServer().purchasedByPlayer) {
post("Cannot hack your own machines! You are currently connected to your home PC or one of your purchased servers");
} else if (Player.getCurrentServer().hasAdminRights == false ) {
post("You do not have admin rights for this machine! Cannot hack");
} else if (Player.getCurrentServer().requiredHackingSkill > Player.hacking_skill) {
post("Your hacking skill is not high enough to attempt hacking this machine. Try analyzing the machine to determine the required hacking skill");
} else {
Terminal.hackFlag = true;
hackProgressPost("Time left:");
hackProgressBarPost("[");
Player.hack();
//Disable terminal
document.getElementById("terminal-input-td").innerHTML = '<input type="text" class="terminal-input"/>';
$('input[class=terminal-input]').prop('disabled', true);
}
break;
case "help":
if (commandArray.length != 1) {
post("Incorrect usage of help command. Usage: help"); return;
}
post(CONSTANTS.HelpText);
break;
case "home":
//TODO return to home computer
break;
case "hostname":
if (commandArray.length != 1) {
post("Incorrect usage of hostname command. Usage: hostname"); return;
}
//Print the hostname of current system
post(Player.getCurrentServer().hostname);
break;
case "ifconfig":
if (commandArray.length != 1) {
post("Incorrect usage of ifconfig command. Usage: ifconfig"); return;
}
//Print the IP address of the current system
post(Player.getCurrentServer().ip);
break;
case "kill":
if (commandArray.length != 2) {
post("Incorrect usage of kill command. Usage: kill [scriptname]"); return;
}
var scriptName = commandArray[1];
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");
return;
}
}
post("No such script is running. Nothing to kill");
break;
case "ls":
if (commandArray.length != 1) {
post("Incorrect usage of ls command. Usage: ls"); return;
}
//Display all programs and scripts
var allFiles = [];
//Get all of the programs and scripts on the machine into one temporary array
for (var i = 0; i < Player.getCurrentServer().programs.length; i++) {
allFiles.push(Player.getCurrentServer().programs[i]);
}
for (var i = 0; i < Player.getCurrentServer().scripts.length; i++) {
allFiles.push(Player.getCurrentServer().scripts[i].filename);
}
//Sort the files alphabetically then print each
allFiles.sort();
for (var i = 0; i < allFiles.length; i++) {
post(allFiles[i]);
}
break;
case "nano":
if (commandArray.length != 2) {
post("Incorrect usage of nano command. Usage: nano [scriptname]"); return;
}
var filename = commandArray[1];
//Can only edit script files
if (filename.endsWith(".script") == false) {
post("Error: Only .script files are editable with nano (filename must end with .script)"); return;
}
//Script name is the filename without the .script at the end
var scriptname = filename.substr(0, filename.indexOf(".script"));
//Cannot edit scripts that are currently running
for (var i = 0; i < Player.getCurrentServer().runningScripts.length; i++) {
if (filename == Player.getCurrentServer().runningScripts[i]) {
post("Cannot open/edit scripts that are currently running!"); return;
}
}
//Check if the script already exists
for (var i = 0; i < Player.getCurrentServer().scripts.length; i++) {
if (filename == Player.getCurrentServer().scripts[i].filename) {
Engine.loadScriptEditorContent(scriptname, Player.getCurrentServer().scripts[i].code);
return;
}
}
Engine.loadScriptEditorContent(scriptname, "");
break;
case "netstat":
case "scan":
if (commandArray.length != 1) {
post("Incorrect usage of netstat/scan command. Usage: netstat/scan"); return;
}
//Displays available network connections using TCP
post("Hostname IP Root Access");
for (var i = 0; i < Player.getCurrentServer().serversOnNetwork.length; i++) {
//Add hostname
var entry = Player.getCurrentServer().getServerOnNetwork(i).hostname;
//Calculate padding and add IP
var numSpaces = 21 - entry.length;
var spaces = Array(numSpaces+1).join(" ");
entry += spaces;
entry += Player.getCurrentServer().getServerOnNetwork(i).ip;
//Calculate padding and add root access info
var hasRoot;
if (Player.getCurrentServer().getServerOnNetwork(i).hasAdminRights) {
hasRoot = 'Y';
} else {
hasRoot = 'N';
}
numSpaces = 21 - Player.getCurrentServer().getServerOnNetwork(i).ip.length;
spaces = Array(numSpaces+1).join(" ");
entry += spaces;
entry += hasRoot;
post(entry);
}
break;
case "ps":
if (commandArray.length != 1) {
post("Incorrect usage of ps command. Usage: ps"); return;
}
for (var i = 0; i < Player.getCurrentServer().runningScripts.length; i++) {
post(Player.getCurrentServer().runningScripts[i]);
}
break;
case "rm":
if (commandArray.length != 2) {
post("Incorrect number of arguments. Usage: rm [program/script]"); return;
}
//Check programs
var delTarget = commandArray[1];
var s = Player.getCurrentServer();
for (var i = 0; i < s.programs.length; ++i) {
if (s.programs[i] == delTarget) {
s.programs.splice(i, 1);
return;
}
}
//Check scripts
for (var i = 0; i < s.scripts.length; ++i) {
if (s.scripts[i].filename == delTarget) {
//Check that the script isnt currently running
if (s.runningScripts.indexOf(delTarget) > -1) {
post("Cannot delete a script that is currently running!");
} else {
s.scripts.splice(i, 1);
}
return;
}
}
post("No such file exists");
break;
case "run":
//Run a program or a script
if (commandArray.length != 2) {
post("Incorrect number of arguments. Usage: run [program/script]");
} else {
var executableName = commandArray[1];
//Check if its a script or just a program/executable
if (executableName.indexOf(".script") == -1) {
//Not a script
Terminal.runProgram(executableName);
} else {
//Script
Terminal.runScript(executableName);
}
}
break;
case "scp":
//TODO
break;
case "tail":
if (commandArray.length != 2) {
post("Incorrect number of arguments. Usage: tail [script]");
} else {
var scriptName = commandArray[1];
//Can only tail script files
if (scriptName.endsWith(".script") == false) {
post("Error: tail can only be called on .script files (filename must end with .script)"); return;
}
//Check that the script exists on this machine
var currScripts = Player.getCurrentServer().scripts;
for (var i = 0; i < currScripts.length; ++i) {
if (scriptName == currScripts[i].filename) {
currScripts[i].displayLog();
return;
}
}
post("Error: No such script exists");
}
break;
case "top":
//TODO List each's script RAM usage
break;
default:
post("Command not found");
}
},
//First called when the "run [program]" command is called. Checks to see if you
//have the executable and, if you do, calls the executeProgram() function
runProgram: function(programName) {
//Check if you have the program on your computer. If you do, execute it, otherwise
//display an error message
for (var i = 0; i < Player.getHomeComputer().programs.length; i++) {
if (Player.getHomeComputer().programs[i] == programName) {
Terminal.executeProgram(programName);
return;
}
}
post("ERROR: No such executable on home computer (Only programs that exist on your home computer can be run)");
},
//Contains the implementations of all possible programs
executeProgram: function(programName) {
var s = Player.getCurrentServer();
switch (programName) {
case Programs.NukeProgram:
if (s.hasAdminRights) {
post("You already have root access to this computer. There is no reason to run NUKE.exe");
} else {
if (s.openPortCount >= Player.getCurrentServer().numOpenPortsRequired) {
s.hasAdminRights = true;
post("NUKE successful! Gained root access to " + Player.getCurrentServer().hostname);
//TODO Make this take time rather than be instant
} else {
post("NUKE unsuccessful. Not enough ports have been opened");
}
}
break;
case Programs.BruteSSHProgram:
if (s.hasAdminRights == false) {
post("Permission denied. You do not have root access to this computer.");
} else if (s.sshPortOpen) {
post("SSH Port (22) is already open!");
} else {
s.sshPortOpen = true;
post("Opened SSH Port(22)!")
++s.openPortCount;
}
break;
case Programs.FTPCrackProgram:
if (s.hasAdminRights == false) {
post("Permission denied. You do not have root access to this computer.");
} else if (s.ftpPortOpen) {
post("FTP Port (21) is already open!");
} else {
s.ftpPortOpen = true;
post("Opened FTP Port (21)!");
++s.openPortCount;
}
break;
case Programs.RelaySMTPProgram:
if (s.hasAdminRights == false) {
post("Permission denied. You do not have root access to this computer.");
} else if (s.smtpPortOpen) {
post("SMTP Port (25) is already open!");
} else {
s.smtpPortOpen = true;
post("Opened SMTP Port (25)!");
++s.openPortCount;
}
break;
case Programs.HTTPWormProgram:
if (s.hasAdminRights == false) {
post("permission denied. You do not have root access to this computer.");
} else if (s.httpPortOpen) {
post("HTTP Port (80) is already open!");
} else {
s.httpPortOpen = true;
post("Opened HTTP Port (80)!");
++s.openPortCount;
}
break;
case Programs.SQLInjectProgram:
if (s.hasAdminRights == false) {
post("permission denied. You do not have root access to this computer.");
} else if (s.sqlPortOpen) {
post("SQL Port (1433) is already open!");
} else {
s.sqlPortOpen = true;
post("Opened SQL Port (1433)!");
++s.openPortCount;
}
break;
default:
post("Executable not found");
return;
}
},
runScript: function(scriptName) {
var server = Player.getCurrentServer();
//Check if this script is already running
for (var i = 0; i < server.runningScripts.length; i++) {
if (server.runningScripts[i] == scriptName) {
post("ERROR: This script is already running. Cannot run multiple instances");
return;
}
}
//Check if the script exists and if it does run it
for (var i = 0; i < server.scripts.length; i++) {
if (server.scripts[i].filename == scriptName) {
//Check for admin rights and that there is enough RAM availble to run
var ramUsage = server.scripts[i].ramUsage;
var ramAvailable = server.maxRam - server.ramUsed;
if (server.hasAdminRights == false) {
post("Need root access to run script");
return;
} else if (ramUsage > ramAvailable){
post("This machine does not have enough RAM to run this script. Script requires " + ramUsage + "GB of RAM");
return;
}else {
//Able to run script
post("Running script. May take a few seconds to start up the process...");
var script = server.scripts[i];
server.runningScripts.push(script.filename); //Push onto runningScripts
addWorkerScript(script, server);
return;
}
}
}
post("ERROR: No such script");
}
};

911
src/engine.js Normal file

@ -0,0 +1,911 @@
var Engine = {
Debug: true,
//Clickable objects
Clickables: {
//Main menu buttons
terminalMainMenuButton: null,
characterMainMenuButton: null,
scriptEditorMainMenuButton: null,
activeScriptsMainMenuButton: null,
worldMainMenuButton: null,
createProgramMainMenuButton: null,
factionsMainMenuButton: null,
augmentationsMainMenuButton: null,
tutorialMainMenuButton: null,
saveMainMenuButton: null,
deleteMainMenuButton: null,
//Tutorial buttons
tutorialGettingStartedButton: null,
tutorialNetworkingButton: null,
tutorialHackingButton: null,
tutorialScriptsButton: null,
tutorialTravelingButton: null,
tutorialJobsButton: null,
tutorialFactionsButton: null,
tutorialAugmentationsButton: null,
tutorialBackButton: null,
},
//Display objects
Display: {
//Progress bar
progress: null,
//Display for status text (such as "Saved" or "Loaded")
statusText: null,
hacking_skill: null,
//Main menu content
terminalContent: null,
characterContent: null,
scriptEditorContent: null,
activeScriptsContent: null,
worldContent: null,
createProgramContent: null,
factionsContent: null,
factionContent: null,
factionAugmentationsContent: null,
augmentationsContent: null,
tutorialContent: null,
locationContent: null,
workInProgressContent: null,
//Character info
characterInfo: null,
//Script editor text
scriptEditorText: null,
},
//Current page status
Page: {
Terminal: "Terminal",
CharacterInfo: "CharacterInfo",
ScriptEditor: "ScriptEditor",
ActiveScripts: "ActiveScripts",
World: "World",
CreateProgram: "CreateProgram",
Factions: "Factions",
Faction: "Faction",
Augmentations: "Augmentations",
Tutorial: "Tutorial",
Location: "Location",
workInProgress: "WorkInProgress",
},
currentPage: null,
//Time variables (milliseconds unix epoch time)
_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() {
Engine.hideAllContent();
Engine.Display.terminalContent.style.visibility = "visible";
Engine.currentPage = Engine.Page.Terminal;
},
loadCharacterContent: function() {
Engine.hideAllContent();
Engine.Display.characterContent.style.visibility = "visible";
Engine.displayCharacterInfo();
Engine.currentPage = Engine.Page.CharacterInfo;
},
loadScriptEditorContent: function(filename = "", code = "") {
Engine.hideAllContent();
Engine.Display.scriptEditorContent.style.visibility = "visible";
if (filename == "") {
document.getElementById("script-editor-filename").value = "untitled";
} else {
document.getElementById("script-editor-filename").value = filename;
}
document.getElementById("script-editor-text").value = code;
Engine.currentPage = Engine.Page.ScriptEditor;
},
loadActiveScriptsContent: function() {
Engine.hideAllContent();
Engine.Display.activeScriptsContent.style.visibility = "visible";
Engine.currentPage = Engine.Page.ActiveScripts;
},
loadWorldContent: function() {
Engine.hideAllContent();
Engine.Display.worldContent.style.visibility = "visible";
Engine.displayWorldInfo();
Engine.currentPage = Engine.Page.World;
},
loadCreateProgramContent: function() {
Engine.hideAllContent();
Engine.Display.createProgramContent.style.visibility = "visible";
displayCreateProgramContent();
Engine.currentPage = Engine.Page.CreateProgram;
},
loadFactionsContent: function() {
Engine.hideAllContent();
Engine.Display.factionsContent.style.visibility = "visible";
Engine.displayFactionsInfo();
Engine.currentPage = Engine.Page.Factions;
},
loadFactionContent: function() {
Engine.hideAllContent();
Engine.Display.factionContent.style.visibility = "visible";
Engine.currentPage = Engine.Page.Faction;
},
loadAugmentationsContent: function() {
Engine.hideAllContent();
Engine.Display.augmentationsContent.style.visibility = "visible";
Engine.displayAugmentationsContent();
Engine.currentPage = Engine.Page.Augmentations;
},
loadTutorialContent: function() {
Engine.hideAllContent();
Engine.Display.tutorialContent.style.visibility = "visible";
Engine.displayTutorialContent();
Engine.currentPage = Engine.Page.Tutorial;
},
loadLocationContent: function() {
Engine.hideAllContent();
Engine.Display.locationContent.style.visibility = "visible";
displayLocationContent();
Engine.currentPage = Engine.Page.Location;
},
loadWorkInProgressContent: function() {
Engine.hideAllContent();
var mainMenu = document.getElementById("mainmenu-container");
mainMenu.style.visibility = "hidden";
Engine.Display.workInProgressContent.style.visibility = "visible";
Engine.currentPage = Engine.Page.WorkInProgress;
},
//Helper function that hides all content
hideAllContent: function() {
Engine.Display.terminalContent.style.visibility = "hidden";
Engine.Display.characterContent.style.visibility = "hidden";
Engine.Display.scriptEditorContent.style.visibility = "hidden";
Engine.Display.activeScriptsContent.style.visibility = "hidden";
Engine.Display.worldContent.style.visibility = "hidden";
Engine.Display.createProgramContent.style.visibility = "hidden";
Engine.Display.factionsContent.style.visibility = "hidden";
Engine.Display.factionContent.style.visibility = "hidden";
Engine.Display.factionAugmentationsContent.style.visibility = "hidden";
Engine.Display.augmentationsContent.style.visibility = "hidden";
Engine.Display.tutorialContent.style.visibility = "hidden";
Engine.Display.locationContent.style.visibility = "hidden";
Engine.Display.workInProgressContent.style.visibility = "hidden";
//Location lists
Engine.aevumLocationsList.style.display = "none";
Engine.chongqingLocationsList.style.display = "none";
Engine.sector12LocationsList.style.display = "none";
Engine.newTokyoLocationsList.style.display = "none";
Engine.ishimaLocationsList.style.display = "none";
Engine.volhavenLocationsList.style.display = "none";
},
/* Display character info */
displayCharacterInfo: function() {
var companyPosition = "";
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();
},
/* Display locations in the world*/
aevumLocationsList: null,
chongqingLocationsList: null,
sector12LocationsList: null,
newTokyoLocationsList: null,
ishimaLocationsList: null,
volhavenLocationsList: null,
displayWorldInfo: function() {
Engine.aevumLocationsList.style.display = "none";
Engine.chongqingLocationsList.style.display = "none";
Engine.sector12LocationsList.style.display = "none";
Engine.newTokyoLocationsList.style.display = "none";
Engine.ishimaLocationsList.style.display = "none";
Engine.volhavenLocationsList.style.display = "none";
switch(Player.city) {
case Locations.Aevum:
Engine.aevumLocationsList.style.display = "inline";
break;
case Locations.Chongqing:
Engine.chongqingLocationsList.style.display = "inline";
break;
case Locations.Sector12:
Engine.sector12LocationsList.style.display = "inline";
break;
case Locations.NewTokyo:
Engine.newTokyoLocationsList.style.display = "inline";
break;
case Locations.Ishima:
Engine.ishimaLocationsList.style.display = "inline";
break;
case Locations.Volhaven:
Engine.volhavenLocationsList.style.display = "inline";
break;
default:
console.log("Invalid city value in Player object!");
break;
}
},
/* Functions used to update information on the Active Scripts page */
ActiveScriptsList: null,
//Creates and adds the <li> object for a given workerScript
addActiveScriptsItem: function(workerscript) {
var item = document.createElement("li");
Engine.createActiveScriptsText(workerscript, item);
//Add the li element onto the list
if (Engine.ActiveScriptsList == null) {
Engine.ActiveScriptsList = document.getElementById("active-scripts-list");
}
Engine.ActiveScriptsList.appendChild(item);
},
deleteActiveScriptsItem: function(i) {
var list = Engine.ActiveScriptsList.querySelectorAll('#active-scripts-list li');
if (i >= list.length) {
throw new Error("Trying to delete an out-of-range Active Scripts item");
}
var li = list[i];
li.parentNode.removeChild(li);
},
//Update the ActiveScriptsItems array
updateActiveScriptsItems: function() {
for (var i = 0; i < workerScripts.length; ++i) {
Engine.updateActiveScriptsItemContent(i, workerScripts[i]);
}
},
//Updates the content of the given item in the Active Scripts list
updateActiveScriptsItemContent: function(i, workerscript) {
var list = Engine.ActiveScriptsList.getElementsByTagName("li");
if (i >= list.length) {
throw new Error("Trying to update an out-of-range Active Scripts Item");
}
var item = list[i];
//Clear the item
while (item.firstChild) {
item.removeChild(item.firstChild);
}
//Add the updated text back
Engine.createActiveScriptsText(workerscript, item);
},
createActiveScriptsText: function(workerscript, item) {
//Script name
var scriptName = document.createElement("h2");
scriptName.appendChild(document.createTextNode(workerscript.name));
item.appendChild(scriptName);
var itemText = document.createElement("p");
//Server ip/hostname
var hostname = workerscript.getServer().hostname;
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 onlineMps = workerscript.scriptRef.onlineMoneyMade / workerscript.scriptRef.onlineRunningTime;
var onlineMpsText = "Online production rate: $" + onlineMps.toFixed(2) + "/second";
var onlineEps = workerscript.scriptRef.onlineExpGained / workerscript.scriptRef.onlineRunningTime;
var onlineEpsText = (Array(25).join(" ") + onlineEps.toFixed(4) + " 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 offlineMps = workerscript.scriptRef.offlineMoneyMade / workerscript.scriptRef.offlineRunningTime;
var offlineMpsText = "Offline production rate: $" + offlineMps.toFixed(2) + "/second";
var offlineEps = workerscript.scriptRef.offlineExpGained / workerscript.scriptRef.offlineRunningTime;
var offlineEpsText = (Array(26).join(" ") + offlineEps.toFixed(4) + " exp/second").replace( / /g, "&nbsp;");
itemText.innerHTML = serverIpHostname + "<br>" + onlineTotalMoneyMade + "<br>" + onlineTotalExpEarned + "<br>" +
onlineMpsText + "<br>" + onlineEpsText + "<br>" + offlineTotalMoneyMade + "<br>" + offlineTotalExpEarned + "<br>" +
offlineMpsText + "<br>" + offlineEpsText + "<br>";
item.appendChild(itemText);
},
displayFactionsInfo: function() {
var factionsList = document.getElementById("factions-list");
//Clear the list
while (factionsList.firstChild) {
factionsList.removeChild(factionsList.firstChild);
}
//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);
}
},
displayAugmentationsContent: function() {
var augmentationsList = document.getElementById("augmentations-list");
for (var i = 0; i < Player.augmentations.length; ++i) {
var augName = Player.augmentations[i];
var aug = Augmentations[augName];
var item = document.createElement("li");
var hElem = document.createElement("h2");
var pElem = document.createElement("p");
item.setAttribute("class", "installed-augmentation");
hElem.innerHTML = augName;
pElem.innerHTML = aug.info;
item.appendChild(hElem);
item.appendChild(pElem);
augmentationsList.appendChild(item);
}
},
displayTutorialContent: function() {
Engine.Clickables.tutorialGettingStartedButton.style.display = "block";
Engine.Clickables.tutorialNetworkingButton.style.display = "block";
Engine.Clickables.tutorialHackingButton.style.display = "block";
Engine.Clickables.tutorialScriptsButton.style.display = "block";
Engine.Clickables.tutorialTravelingButton.style.display = "block";
Engine.Clickables.tutorialJobsButton.style.display = "block";
Engine.Clickables.tutorialFactionsButton.style.display = "block";
Engine.Clickables.tutorialAugmentationsButton.style.display = "block";
Engine.Clickables.tutorialBackButton.style.display = "none";
document.getElementById("tutorial-text").style.display = "none";
},
//Displays the text when a section of the Tutorial is opened
displayTutorialPage: function(text) {
Engine.Clickables.tutorialGettingStartedButton.style.display = "none";
Engine.Clickables.tutorialNetworkingButton.style.display = "none";
Engine.Clickables.tutorialHackingButton.style.display = "none";
Engine.Clickables.tutorialScriptsButton.style.display = "none";
Engine.Clickables.tutorialTravelingButton.style.display = "none";
Engine.Clickables.tutorialJobsButton.style.display = "none";
Engine.Clickables.tutorialFactionsButton.style.display = "none";
Engine.Clickables.tutorialAugmentationsButton.style.display = "none";
Engine.Clickables.tutorialBackButton.style.display = "inline-block";
document.getElementById("tutorial-text").style.display = "block";
document.getElementById("tutorial-text").innerHTML = text;
},
/* Main Event Loop */
idleTimer: function() {
//Get time difference
var _thisUpdate = new Date().getTime();
var diff = _thisUpdate - Engine._lastUpdate;
var offset = diff % Engine._idleSpeed;
//Divide this by cycle time to determine how many cycles have elapsed since last update
diff = Math.floor(diff / Engine._idleSpeed);
if (diff > 0) {
//Update the game engine by the calculated number of cycles
Engine.updateGame(diff);
Engine._lastUpdate = _thisUpdate - offset;
Player.lastUpdate = _thisUpdate - offset;
}
window.requestAnimationFrame(Engine.idleTimer);
},
updateGame: function(numCycles = 1) {
//Start Manual hack
if (Player.startAction == true) {
Engine._totalActionTime = Player.actionTime;
Engine._actionTimeLeft = Player.actionTime;
Engine._actionInProgress = true;
Engine._actionProgressBarCount = 1;
Engine._actionProgressStr = "[ ]";
Engine._actionTimeStr = "Time left: ";
Player.startAction = false;
}
if (Player.isWorking) {
if (Player.currentWorkFactionName != "") {
Player.workForFaction(numCycles);
} else if (Player.createProgramName != "") {
Player.createProgramWork(numCycles);
} else {
Player.work(numCycles);
}
}
//Counters
Engine.decrementAllCounters(numCycles);
Engine.checkCounters();
//Manual hacks
if (Engine._actionInProgress == true) {
Engine.updateHackProgress(numCycles);
}
//Update the running time of all active scripts
updateOnlineScriptTimes(numCycles);
},
//Counters for the main event loop. Represent the number of game cycles are required
//for something to happen.
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
serverGrowth: 450, //Process server growth every minute and a half
checkFactionInvitations: 1500, //Check whether you qualify for any faction invitations every 5 minutes
},
decrementAllCounters: function(numCycles = 1) {
for (var counter in Engine.Counters) {
if (Engine.Counters.hasOwnProperty(counter)) {
Engine.Counters[counter] = Engine.Counters[counter] - numCycles;
}
}
},
//Checks if any counters are 0 and if they are, executes whatever
//is necessary and then resets the counter
checkCounters: function() {
if (Engine.Counters.autoSaveCounter <= 0) {
Engine.saveGame();
Engine.Counters.autoSaveCounter = 300;
}
if (Engine.Counters.updateSkillLevelsCounter <= 0) {
Player.updateSkillLevels();
Engine.Counters.updateSkillLevelsCounter = 10;
}
if (Engine.Counters.updateDisplays <= 0) {
if (Engine.currentPage == Engine.Page.ActiveScripts) {
Engine.updateActiveScriptsItems();
} else if (Engine.currentPage == Engine.Page.CharacterInfo) {
Engine.displayCharacterInfo();
}
Engine.Counters.updateDisplays = 5;
}
if (Engine.Counters.serverGrowth <= 0) {
var numCycles = Math.floor((450 - Engine.Counters.serverGrowth));
processServerGrowth(numCycles);
Engine.Counters.serverGrowth = 450;
}
if (Engine.Counters.checkFactionInvitations <= 0) {
var invitedFactions = Player.checkForFactionInvitations();
if (invitedFactions.length > 0) {
var randFaction = invitedFactions[Math.floor(Math.random() * invitedFactions.length)];
inviteToFaction(randFaction);
}
Engine.Counters.checkFactionInvitations = 1500;
}
},
/* Calculates the hack progress for a manual (non-scripted) hack and updates the progress bar/time accordingly */
_totalActionTime: 0,
_actionTimeLeft: 0,
_actionTimeStr: "Time left: ",
_actionProgressStr: "[ ]",
_actionProgressBarCount: 1,
_actionInProgress: false,
updateHackProgress: function(numCycles = 1) {
var timeElapsedMilli = numCycles * Engine._idleSpeed;
Engine._actionTimeLeft -= (timeElapsedMilli/ 1000); //Substract idle speed (ms)
Engine._actionTimeLeft = Math.max(Engine._actionTimeLeft, 0);
//Calculate percent filled
var percent = Math.round((1 - Engine._actionTimeLeft / Engine._totalActionTime) * 100);
//Update progress bar
while (Engine._actionProgressBarCount * 2 <= percent) {
Engine._actionProgressStr = Engine._actionProgressStr.replaceAt(Engine._actionProgressBarCount, "|");
Engine._actionProgressBarCount += 1;
}
//Update hack time remaining
Engine._actionTimeStr = "Time left: " + Math.max(0, Math.round(Engine._actionTimeLeft)).toString() + "s";
document.getElementById("hack-progress").innerHTML = Engine._actionTimeStr;
//Dynamically update progress bar
document.getElementById("hack-progress-bar").innerHTML = Engine._actionProgressStr.replace( / /g, "&nbsp;" );
//Once percent is 100, the hack is completed
if (percent >= 100) {
Engine._actionInProgress = false;
Terminal.finishAction();
}
},
/* Initialization */
init: function() {
//Main menu buttons and content
Engine.Clickables.terminalMainMenuButton = document.getElementById("terminal-menu-link");
Engine.Clickables.terminalMainMenuButton.addEventListener("click", function() {
Engine.loadTerminalContent();
return false;
});
Engine.Clickables.characterMainMenuButton = document.getElementById("character-menu-link");
Engine.Clickables.characterMainMenuButton.addEventListener("click", function() {
Engine.loadCharacterContent();
return false;
});
Engine.Clickables.scriptEditorMainMenuButton = document.getElementById("create-script-menu-link");
Engine.Clickables.scriptEditorMainMenuButton.addEventListener("click", function() {
Engine.loadScriptEditorContent();
return false;
});
Engine.Clickables.activeScriptsMainMenuButton = document.getElementById("active-scripts-menu-link");
Engine.Clickables.activeScriptsMainMenuButton.addEventListener("click", function() {
Engine.loadActiveScriptsContent();
return false;
});
Engine.Clickables.worldMainMenuButton = document.getElementById("world-menu-link");
Engine.Clickables.worldMainMenuButton.addEventListener("click", function() {
Engine.loadWorldContent();
return false;
});
Engine.Clickables.createProgramMainMenuButton = document.getElementById("create-program-menu-link");
Engine.Clickables.createProgramMainMenuButton.addEventListener("click", function() {
Engine.loadCreateProgramContent();
return false;
});
Engine.Clickables.factionsMainMenuButton = document.getElementById("factions-menu-link");
Engine.Clickables.factionsMainMenuButton.addEventListener("click", function() {
Engine.loadFactionsContent();
return false;
});
Engine.Clickables.augmentationsMainMenuButton = document.getElementById("augmentations-menu-link");
Engine.Clickables.augmentationsMainMenuButton.addEventListener("click", function() {
Engine.loadAugmentationsContent();
return false;
});
Engine.Clickables.tutorialMainMenuButton = document.getElementById("tutorial-menu-link");
Engine.Clickables.tutorialMainMenuButton.addEventListener("click", function() {
Engine.loadTutorialContent();
return false;
});
//Active scripts list
Engine.ActiveScriptsList = document.getElementById("active-scripts-list");
Engine.Clickables.saveMainMenuButton = document.getElementById("save-game-link");
Engine.Clickables.saveMainMenuButton.addEventListener("click", function() {
Engine.saveGame();
return false;
});
Engine.Clickables.deleteMainMenuButton = document.getElementById("delete-game-link");
Engine.Clickables.deleteMainMenuButton.addEventListener("click", function() {
Engine.deleteSave();
return false;
});
//Tutorial buttons
Engine.Clickables.tutorialGettingStartedButton = document.getElementById("tutorial-getting-started-link");
Engine.Clickables.tutorialGettingStartedButton.addEventListener("click", function() {
Engine.displayTutorialPage(CONSTANTS.TutorialGettingStartedText);
});
Engine.Clickables.tutorialNetworkingButton = document.getElementById("tutorial-networking-link");
Engine.Clickables.tutorialNetworkingButton.addEventListener("click", function() {
Engine.displayTutorialPage(CONSTANTS.TutorialNetworkingText);
});
Engine.Clickables.tutorialHackingButton = document.getElementById("tutorial-hacking-link");
Engine.Clickables.tutorialHackingButton.addEventListener("click", function() {
Engine.displayTutorialPage(CONSTANTS.TutorialHackingText);
});
Engine.Clickables.tutorialScriptsButton = document.getElementById("tutorial-scripts-link");
Engine.Clickables.tutorialScriptsButton.addEventListener("click", function() {
Engine.displayTutorialPage(CONSTANTS.TutorialScriptsText);
});
Engine.Clickables.tutorialTravelingButton = document.getElementById("tutorial-traveling-link");
Engine.Clickables.tutorialTravelingButton.addEventListener("click", function() {
Engine.displayTutorialPage(CONSTANTS.TutorialTravelingText);
});
Engine.Clickables.tutorialJobsButton = document.getElementById("tutorial-jobs-link");
Engine.Clickables.tutorialJobsButton.addEventListener("click", function() {
Engine.displayTutorialPage(CONSTANTS.TutorialJobsText);
});
Engine.Clickables.tutorialFactionsButton = document.getElementById("tutorial-factions-link");
Engine.Clickables.tutorialFactionsButton.addEventListener("click", function() {
Engine.displayTutorialPage(CONSTANTS.TutorialFactionsText);
});
Engine.Clickables.tutorialAugmentationsButton = document.getElementById("tutorial-augmentations-link");
Engine.Clickables.tutorialAugmentationsButton.addEventListener("click", function() {
Engine.displayTutorialPage(CONSTANTS.TutorialAugmentationsText);
});
Engine.Clickables.tutorialBackButton = document.getElementById("tutorial-back-button");
Engine.Clickables.tutorialBackButton.addEventListener("click", function() {
Engine.displayTutorialContent();
});
//Content elements
Engine.Display.terminalContent = document.getElementById("terminal-container");
Engine.currentPage = Engine.Page.Terminal;
Engine.Display.characterContent = document.getElementById("character-container");
Engine.Display.characterContent.style.visibility = "hidden";
Engine.Display.scriptEditorContent = document.getElementById("script-editor-container");
Engine.Display.scriptEditorContent.style.visibility = "hidden";
Engine.Display.activeScriptsContent = document.getElementById("active-scripts-container");
Engine.Display.activeScriptsContent.style.visibility = "hidden";
Engine.Display.worldContent = document.getElementById("world-container");
Engine.Display.worldContent.style.visibility = "hidden";
Engine.Display.createProgramContent = document.getElementById("create-program-container");
Engine.Display.createProgramContent.style.visibility = "hidden";
Engine.Display.factionsContent = document.getElementById("factions-container");
Engine.Display.factionsContent.style.visibility = "hidden";
Engine.Display.factionContent = document.getElementById("faction-container");
Engine.Display.factionContent.style.visibility = "hidden";
Engine.Display.factionAugmentationsContent = document.getElementById("faction-augmentations-container");
Engine.Display.factionAugmentationsContent.style.visibility = "hidden";
Engine.Display.augmentationsContent = document.getElementById("augmentations-container");
Engine.Display.augmentationsContent.style.visibility = "hidden";
Engine.Display.tutorialContent = document.getElementById("tutorial-container");
Engine.Display.tutorialContent.style.visibility = "hidden";
//Character info
Engine.Display.characterInfo = document.getElementById("character-info");
//Location lists
Engine.aevumLocationsList = document.getElementById("aevum-locations-list");
Engine.chongqingLocationsList = document.getElementById("chongqing-locations-list");
Engine.sector12LocationsList = document.getElementById("sector12-locations-list");
Engine.newTokyoLocationsList = document.getElementById("newtokyo-locations-list");
Engine.ishimaLocationsList = document.getElementById("ishima-locations-list");
Engine.volhavenLocationsList = document.getElementById("volhaven-locations-list");
//Location page (page that shows up when you visit a specific location in World)
Engine.Display.locationContent = document.getElementById("location-container");
Engine.Display.locationContent.style.visibility = "hidden";
//Work In Progress
Engine.Display.workInProgressContent = document.getElementById("work-in-progress-container");
Engine.Display.workInProgressContent.style.visibility = "hidden";
//Init Location buttons
initLocationButtons();
//Script editor
Engine.Display.scriptEditorText = document.getElementById("script-editor-text");
//Load game from save or create new game
if (Engine.loadSave()) {
console.log("Loaded game from save");
CompanyPositions.init();
//Calculate the number of cycles have elapsed while offline
var thisUpdate = new Date().getTime();
var lastUpdate = Player.lastUpdate;
var numCyclesOffline = Math.floor((thisUpdate - lastUpdate) / Engine._idleSpeed);
processServerGrowth(numCyclesOffline); //Should be done before offline production for scripts
loadAllRunningScripts(); //This also takes care of offline production for those scripts
Player.work(numCyclesOffline);
} else {
//No save found, start new game
console.log("Initializing new game");
SpecialServerIps = new SpecialServerIpsMap();
Player.init();
initForeignServers();
initCompanies();
initFactions();
CompanyPositions.init();
initAugmentations();
}
//Message at the top of terminal
postNetburnerText();
//Player was working
if (Player.isWorking) {
var cancelButton = document.getElementById("work-in-progress-cancel-button");
cancelButton.addEventListener("click", function() {
Player.finishWork(true);
});
Engine.loadWorkInProgressContent();
}
//Run main loop
Engine.idleTimer();
//Scripts
runScriptsLoop();
}
};
window.onload = function() {
Engine.init();
};

360
src/tags Normal file

@ -0,0 +1,360 @@
!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/
!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
!_TAG_PROGRAM_AUTHOR Darren Hiebert /dhiebert@users.sourceforge.net/
!_TAG_PROGRAM_NAME Exuberant Ctags //
!_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/
!_TAG_PROGRAM_VERSION 5.8 //
$.analyzeFlag C:\Users\daniel.xie\Desktop\netburner\netburner\src\Terminal.js 84;" kind:property line:84 language:JavaScript
$.executeCommand C:\Users\daniel.xie\Desktop\netburner\netburner\src\Terminal.js 183;" kind:method line:183 language:JavaScript
$.finishAction C:\Users\daniel.xie\Desktop\netburner\netburner\src\Terminal.js 86;" kind:method line:86 language:JavaScript
$.finishAnalyze C:\Users\daniel.xie\Desktop\netburner\netburner\src\Terminal.js 134;" kind:method line:134 language:JavaScript
$.finishHack C:\Users\daniel.xie\Desktop\netburner\netburner\src\Terminal.js 95;" kind:method line:95 language:JavaScript
$.hackFlag C:\Users\daniel.xie\Desktop\netburner\netburner\src\Terminal.js 83;" kind:property line:83 language:JavaScript
AddToAllServers C:\Users\daniel.xie\Desktop\netburner\netburner\src\Server.js 666;" kind:function line:666 language:JavaScript
AllServersSave C:\Users\daniel.xie\Desktop\netburner\netburner\src\engine.js 88;" kind:variable line:88 language:JavaScript
Augmentation C:\Users\daniel.xie\Desktop\netburner\netburner\src\Augmentations.js 2;" kind:class line:2 language:JavaScript
Augmentation.addToFactions C:\Users\daniel.xie\Desktop\netburner\netburner\src\Augmentations.js 23;" kind:method line:23 language:JavaScript
Augmentation.fromJSON C:\Users\daniel.xie\Desktop\netburner\netburner\src\Augmentations.js 38;" kind:function line:38 language:JavaScript
Augmentation.setInfo C:\Users\daniel.xie\Desktop\netburner\netburner\src\Augmentations.js 13;" kind:method line:13 language:JavaScript
Augmentation.setRequirements C:\Users\daniel.xie\Desktop\netburner\netburner\src\Augmentations.js 17;" kind:method line:17 language:JavaScript
Augmentation.toJSON C:\Users\daniel.xie\Desktop\netburner\netburner\src\Augmentations.js 34;" kind:method line:34 language:JavaScript
AugmentationsSave C:\Users\daniel.xie\Desktop\netburner\netburner\src\engine.js 92;" kind:variable line:92 language:JavaScript
CONSTANTS.CodeInstructionRunTime C:\Users\daniel.xie\Desktop\netburner\netburner\src\Constants.js 11;" kind:property line:11 language:JavaScript
CONSTANTS.CodeOfflineExecutionTime C:\Users\daniel.xie\Desktop\netburner\netburner\src\Constants.js 14;" kind:property line:14 language:JavaScript
CONSTANTS.CorpFactionRepRequirement C:\Users\daniel.xie\Desktop\netburner\netburner\src\Constants.js 7;" kind:property line:7 language:JavaScript
CONSTANTS.GameCyclesPer20Hours C:\Users\daniel.xie\Desktop\netburner\netburner\src\Constants.js 23;" kind:property line:23 language:JavaScript
CONSTANTS.MaxLogCapacity C:\Users\daniel.xie\Desktop\netburner\netburner\src\Constants.js 17;" kind:property line:17 language:JavaScript
CONSTANTS.MaxSkillLevel C:\Users\daniel.xie\Desktop\netburner\netburner\src\Constants.js 4;" kind:property line:4 language:JavaScript
CONSTANTS.MillisecondsPer20Hours C:\Users\daniel.xie\Desktop\netburner\netburner\src\Constants.js 22;" kind:property line:22 language:JavaScript
CONSTANTS.TorRouterCost C:\Users\daniel.xie\Desktop\netburner\netburner\src\Constants.js 20;" kind:property line:20 language:JavaScript
CompaniesSave C:\Users\daniel.xie\Desktop\netburner\netburner\src\engine.js 89;" kind:variable line:89 language:JavaScript
Company C:\Users\daniel.xie\Desktop\netburner\netburner\src\Company.js 4;" kind:class line:4 language:JavaScript
Company.addPosition C:\Users\daniel.xie\Desktop\netburner\netburner\src\Company.js 34;" kind:method line:34 language:JavaScript
Company.addPositions C:\Users\daniel.xie\Desktop\netburner\netburner\src\Company.js 38;" kind:method line:38 language:JavaScript
Company.fromJSON C:\Users\daniel.xie\Desktop\netburner\netburner\src\Company.js 57;" kind:function line:57 language:JavaScript
Company.hasPosition C:\Users\daniel.xie\Desktop\netburner\netburner\src\Company.js 44;" kind:method line:44 language:JavaScript
Company.init C:\Users\daniel.xie\Desktop\netburner\netburner\src\Company.js 23;" kind:method line:23 language:JavaScript
Company.setInfo C:\Users\daniel.xie\Desktop\netburner\netburner\src\Company.js 30;" kind:method line:30 language:JavaScript
Company.toJSON C:\Users\daniel.xie\Desktop\netburner\netburner\src\Company.js 53;" kind:method line:53 language:JavaScript
CompanyPosition C:\Users\daniel.xie\Desktop\netburner\netburner\src\Company.js 64;" kind:class line:64 language:JavaScript
CompanyPosition.calculateJobPerformance C:\Users\daniel.xie\Desktop\netburner\netburner\src\Company.js 112;" kind:method line:112 language:JavaScript
CompanyPosition.fromJSON C:\Users\daniel.xie\Desktop\netburner\netburner\src\Company.js 196;" kind:function line:196 language:JavaScript
CompanyPosition.isAgentJob C:\Users\daniel.xie\Desktop\netburner\netburner\src\Company.js 183;" kind:method line:183 language:JavaScript
CompanyPosition.isBusinessJob C:\Users\daniel.xie\Desktop\netburner\netburner\src\Company.js 160;" kind:method line:160 language:JavaScript
CompanyPosition.isITJob C:\Users\daniel.xie\Desktop\netburner\netburner\src\Company.js 136;" kind:method line:136 language:JavaScript
CompanyPosition.isNetworkEngineerJob C:\Users\daniel.xie\Desktop\netburner\netburner\src\Company.js 153;" kind:method line:153 language:JavaScript
CompanyPosition.isSecurityEngineerJob C:\Users\daniel.xie\Desktop\netburner\netburner\src\Company.js 146;" kind:method line:146 language:JavaScript
CompanyPosition.isSecurityJob C:\Users\daniel.xie\Desktop\netburner\netburner\src\Company.js 172;" kind:method line:172 language:JavaScript
CompanyPosition.isSoftwareJob C:\Users\daniel.xie\Desktop\netburner\netburner\src\Company.js 122;" kind:method line:122 language:JavaScript
CompanyPosition.setExperienceGains C:\Users\daniel.xie\Desktop\netburner\netburner\src\Company.js 101;" kind:method line:101 language:JavaScript
CompanyPosition.setPerformanceParameters C:\Users\daniel.xie\Desktop\netburner\netburner\src\Company.js 86;" kind:method line:86 language:JavaScript
CompanyPosition.toJSON C:\Users\daniel.xie\Desktop\netburner\netburner\src\Company.js 192;" kind:method line:192 language:JavaScript
CompanyPositions.SoftwareIntern C:\Users\daniel.xie\Desktop\netburner\netburner\src\Company.js 206;" kind:property line:206 language:JavaScript
Engine.Clickables C:\Users\daniel.xie\Desktop\netburner\netburner\src\engine.js 5;" kind:property line:5 language:JavaScript
Engine.Debug C:\Users\daniel.xie\Desktop\netburner\netburner\src\engine.js 2;" kind:property line:2 language:JavaScript
Environment C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Environment.js 4;" kind:class line:4 language:JavaScript
Environment.def C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Environment.js 46;" kind:method line:46 language:JavaScript
Environment.extend C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Environment.js 12;" kind:method line:12 language:JavaScript
Environment.get C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Environment.js 27;" kind:method line:27 language:JavaScript
Environment.lookup C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Environment.js 17;" kind:method line:17 language:JavaScript
Environment.set C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Environment.js 34;" kind:method line:34 language:JavaScript
FALSE.type C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Parser.js 6;" kind:property line:6 language:JavaScript
FALSE.value C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Parser.js 6;" kind:property line:6 language:JavaScript
Faction C:\Users\daniel.xie\Desktop\netburner\netburner\src\Faction.js 2;" kind:class line:2 language:JavaScript
Faction.fromJSON C:\Users\daniel.xie\Desktop\netburner\netburner\src\Faction.js 30;" kind:function line:30 language:JavaScript
Faction.setAugmentationMultipliers C:\Users\daniel.xie\Desktop\netburner\netburner\src\Faction.js 17;" kind:method line:17 language:JavaScript
Faction.setInformation C:\Users\daniel.xie\Desktop\netburner\netburner\src\Faction.js 22;" kind:method line:22 language:JavaScript
Faction.toJSON C:\Users\daniel.xie\Desktop\netburner\netburner\src\Faction.js 26;" kind:method line:26 language:JavaScript
FactionInfo.HelpText C:\Users\daniel.xie\Desktop\netburner\netburner\src\FactionInfo.js 5;" kind:property line:5 language:JavaScript
FactionsSave C:\Users\daniel.xie\Desktop\netburner\netburner\src\engine.js 90;" kind:variable line:90 language:JavaScript
GetServerByHostname C:\Users\daniel.xie\Desktop\netburner\netburner\src\Server.js 680;" kind:function line:680 language:JavaScript
InputStream C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\InputStream.js 3;" kind:function line:3 language:JavaScript
Locations.Aevum C:\Users\daniel.xie\Desktop\netburner\netburner\src\Location.js 6;" kind:property line:6 language:JavaScript
Locations.AevumAeroCorp C:\Users\daniel.xie\Desktop\netburner\netburner\src\Location.js 20;" kind:property line:20 language:JavaScript
Locations.AevumBachmanAndAssociates C:\Users\daniel.xie\Desktop\netburner\netburner\src\Location.js 17;" kind:property line:17 language:JavaScript
Locations.AevumClarkeIncorporated C:\Users\daniel.xie\Desktop\netburner\netburner\src\Location.js 18;" kind:property line:18 language:JavaScript
Locations.AevumCrushFitnessGym C:\Users\daniel.xie\Desktop\netburner\netburner\src\Location.js 26;" kind:property line:26 language:JavaScript
Locations.AevumECorp C:\Users\daniel.xie\Desktop\netburner\netburner\src\Location.js 16;" kind:property line:16 language:JavaScript
Locations.AevumFulcrumTechnologies C:\Users\daniel.xie\Desktop\netburner\netburner\src\Location.js 19;" kind:property line:19 language:JavaScript
Locations.AevumGalacticCybersystems C:\Users\daniel.xie\Desktop\netburner\netburner\src\Location.js 21;" kind:property line:21 language:JavaScript
Locations.AevumNetLinkTechnologies C:\Users\daniel.xie\Desktop\netburner\netburner\src\Location.js 25;" kind:property line:25 language:JavaScript
Locations.AevumPolice C:\Users\daniel.xie\Desktop\netburner\netburner\src\Location.js 24;" kind:property line:24 language:JavaScript
Locations.AevumRhoConstruction C:\Users\daniel.xie\Desktop\netburner\netburner\src\Location.js 23;" kind:property line:23 language:JavaScript
Locations.AevumSnapFitnessGym C:\Users\daniel.xie\Desktop\netburner\netburner\src\Location.js 27;" kind:property line:27 language:JavaScript
Locations.AevumTravelAgency C:\Users\daniel.xie\Desktop\netburner\netburner\src\Location.js 15;" kind:property line:15 language:JavaScript
Locations.AevumWatchdogSecurity C:\Users\daniel.xie\Desktop\netburner\netburner\src\Location.js 22;" kind:property line:22 language:JavaScript
Locations.Chongqing C:\Users\daniel.xie\Desktop\netburner\netburner\src\Location.js 7;" kind:property line:7 language:JavaScript
Locations.ChongqingKuaiGongInternational C:\Users\daniel.xie\Desktop\netburner\netburner\src\Location.js 31;" kind:property line:31 language:JavaScript
Locations.ChongqingSolarisSpaceSystems C:\Users\daniel.xie\Desktop\netburner\netburner\src\Location.js 32;" kind:property line:32 language:JavaScript
Locations.ChongqingTravelAgency C:\Users\daniel.xie\Desktop\netburner\netburner\src\Location.js 30;" kind:property line:30 language:JavaScript
Locations.Ishima C:\Users\daniel.xie\Desktop\netburner\netburner\src\Location.js 10;" kind:property line:10 language:JavaScript
Locations.IshimaNovaMedical C:\Users\daniel.xie\Desktop\netburner\netburner\src\Location.js 61;" kind:property line:61 language:JavaScript
Locations.IshimaOmegaSoftware C:\Users\daniel.xie\Desktop\netburner\netburner\src\Location.js 62;" kind:property line:62 language:JavaScript
Locations.IshimaStormTechnologies C:\Users\daniel.xie\Desktop\netburner\netburner\src\Location.js 60;" kind:property line:60 language:JavaScript
Locations.IshimaTravelAgency C:\Users\daniel.xie\Desktop\netburner\netburner\src\Location.js 59;" kind:property line:59 language:JavaScript
Locations.NewTokyo C:\Users\daniel.xie\Desktop\netburner\netburner\src\Location.js 9;" kind:property line:9 language:JavaScript
Locations.NewTokyoDefComm C:\Users\daniel.xie\Desktop\netburner\netburner\src\Location.js 53;" kind:property line:53 language:JavaScript
Locations.NewTokyoGlobalPharmaceuticals C:\Users\daniel.xie\Desktop\netburner\netburner\src\Location.js 55;" kind:property line:55 language:JavaScript
Locations.NewTokyoNoodleBar C:\Users\daniel.xie\Desktop\netburner\netburner\src\Location.js 56;" kind:property line:56 language:JavaScript
Locations.NewTokyoTravelAgency C:\Users\daniel.xie\Desktop\netburner\netburner\src\Location.js 52;" kind:property line:52 language:JavaScript
Locations.NewTokyoVitaLife C:\Users\daniel.xie\Desktop\netburner\netburner\src\Location.js 54;" kind:property line:54 language:JavaScript
Locations.Sector12 C:\Users\daniel.xie\Desktop\netburner\netburner\src\Location.js 8;" kind:property line:8 language:JavaScript
Locations.Sector12AlphaEnterprises C:\Users\daniel.xie\Desktop\netburner\netburner\src\Location.js 44;" kind:property line:44 language:JavaScript
Locations.Sector12BladeIndustries C:\Users\daniel.xie\Desktop\netburner\netburner\src\Location.js 37;" kind:property line:37 language:JavaScript
Locations.Sector12CIA C:\Users\daniel.xie\Desktop\netburner\netburner\src\Location.js 42;" kind:property line:42 language:JavaScript
Locations.Sector12CarmichaelSecurity C:\Users\daniel.xie\Desktop\netburner\netburner\src\Location.js 45;" kind:property line:45 language:JavaScript
Locations.Sector12DeltaOne C:\Users\daniel.xie\Desktop\netburner\netburner\src\Location.js 41;" kind:property line:41 language:JavaScript
Locations.Sector12FoodNStuff C:\Users\daniel.xie\Desktop\netburner\netburner\src\Location.js 46;" kind:property line:46 language:JavaScript
Locations.Sector12FourSigma C:\Users\daniel.xie\Desktop\netburner\netburner\src\Location.js 38;" kind:property line:38 language:JavaScript
Locations.Sector12IcarusMicrosystems C:\Users\daniel.xie\Desktop\netburner\netburner\src\Location.js 39;" kind:property line:39 language:JavaScript
Locations.Sector12IronGym C:\Users\daniel.xie\Desktop\netburner\netburner\src\Location.js 48;" kind:property line:48 language:JavaScript
Locations.Sector12JoesGuns C:\Users\daniel.xie\Desktop\netburner\netburner\src\Location.js 47;" kind:property line:47 language:JavaScript
Locations.Sector12MegaCorp C:\Users\daniel.xie\Desktop\netburner\netburner\src\Location.js 36;" kind:property line:36 language:JavaScript
Locations.Sector12NSA C:\Users\daniel.xie\Desktop\netburner\netburner\src\Location.js 43;" kind:property line:43 language:JavaScript
Locations.Sector12PowerhouseGym C:\Users\daniel.xie\Desktop\netburner\netburner\src\Location.js 49;" kind:property line:49 language:JavaScript
Locations.Sector12TravelAgency C:\Users\daniel.xie\Desktop\netburner\netburner\src\Location.js 35;" kind:property line:35 language:JavaScript
Locations.Sector12UniversalEnergy C:\Users\daniel.xie\Desktop\netburner\netburner\src\Location.js 40;" kind:property line:40 language:JavaScript
Locations.Volhaven C:\Users\daniel.xie\Desktop\netburner\netburner\src\Location.js 11;" kind:property line:11 language:JavaScript
Locations.VolhavenCompuTek C:\Users\daniel.xie\Desktop\netburner\netburner\src\Location.js 72;" kind:property line:72 language:JavaScript
Locations.VolhavenHeliosLabs C:\Users\daniel.xie\Desktop\netburner\netburner\src\Location.js 68;" kind:property line:68 language:JavaScript
Locations.VolhavenLexoCorp C:\Users\daniel.xie\Desktop\netburner\netburner\src\Location.js 70;" kind:property line:70 language:JavaScript
Locations.VolhavenMilleniumFitnessGym C:\Users\daniel.xie\Desktop\netburner\netburner\src\Location.js 73;" kind:property line:73 language:JavaScript
Locations.VolhavenNWO C:\Users\daniel.xie\Desktop\netburner\netburner\src\Location.js 67;" kind:property line:67 language:JavaScript
Locations.VolhavenOmniTekIncorporated C:\Users\daniel.xie\Desktop\netburner\netburner\src\Location.js 66;" kind:property line:66 language:JavaScript
Locations.VolhavenOmniaCybersystems C:\Users\daniel.xie\Desktop\netburner\netburner\src\Location.js 69;" kind:property line:69 language:JavaScript
Locations.VolhavenSysCoreSecurities C:\Users\daniel.xie\Desktop\netburner\netburner\src\Location.js 71;" kind:property line:71 language:JavaScript
Locations.VolhavenTravelAgency C:\Users\daniel.xie\Desktop\netburner\netburner\src\Location.js 65;" kind:property line:65 language:JavaScript
Parser C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Parser.js 8;" kind:function line:8 language:JavaScript
Parser.PRECEDENCE.!= C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Parser.js 13;" kind:property line:13 language:JavaScript
Parser.PRECEDENCE.% C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Parser.js 15;" kind:property line:15 language:JavaScript
Parser.PRECEDENCE.&& C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Parser.js 12;" kind:property line:12 language:JavaScript
Parser.PRECEDENCE.* C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Parser.js 15;" kind:property line:15 language:JavaScript
Parser.PRECEDENCE.+ C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Parser.js 14;" kind:property line:14 language:JavaScript
Parser.PRECEDENCE.- C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Parser.js 14;" kind:property line:14 language:JavaScript
Parser.PRECEDENCE./ C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Parser.js 15;" kind:property line:15 language:JavaScript
Parser.PRECEDENCE.< C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Parser.js 13;" kind:property line:13 language:JavaScript
Parser.PRECEDENCE.<= C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Parser.js 13;" kind:property line:13 language:JavaScript
Parser.PRECEDENCE.= C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Parser.js 10;" kind:property line:10 language:JavaScript
Parser.PRECEDENCE.== C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Parser.js 13;" kind:property line:13 language:JavaScript
Parser.PRECEDENCE.> C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Parser.js 13;" kind:property line:13 language:JavaScript
Parser.PRECEDENCE.>= C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Parser.js 13;" kind:property line:13 language:JavaScript
Parser.PRECEDENCE.|| C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Parser.js 11;" kind:property line:11 language:JavaScript
Parser.checkKeywordAndSkip C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Parser.js 46;" kind:function line:46 language:JavaScript
Parser.checkOpAndSkip C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Parser.js 53;" kind:function line:53 language:JavaScript
Parser.checkPuncAndSkip C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Parser.js 39;" kind:function line:39 language:JavaScript
Parser.delimited C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Parser.js 79;" kind:function line:79 language:JavaScript
Parser.is_kw C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Parser.js 26;" kind:function line:26 language:JavaScript
Parser.is_op C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Parser.js 32;" kind:function line:32 language:JavaScript
Parser.is_punc C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Parser.js 20;" kind:function line:20 language:JavaScript
Parser.maybe_binary C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Parser.js 62;" kind:function line:62 language:JavaScript
Parser.parse_call C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Parser.js 92;" kind:function line:92 language:JavaScript
Parser.unexpected C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Parser.js 58;" kind:function line:58 language:JavaScript
Perk C:\Users\daniel.xie\Desktop\netburner\netburner\src\Perk.js 40;" kind:class line:40 language:JavaScript
Perk.fromJSON C:\Users\daniel.xie\Desktop\netburner\netburner\src\Perk.js 62;" kind:function line:62 language:JavaScript
Perk.setCompany C:\Users\daniel.xie\Desktop\netburner\netburner\src\Perk.js 40;" kind:method line:40 language:JavaScript
Perk.setFaction C:\Users\daniel.xie\Desktop\netburner\netburner\src\Perk.js 49;" kind:method line:49 language:JavaScript
Perk.toJSON C:\Users\daniel.xie\Desktop\netburner\netburner\src\Perk.js 58;" kind:method line:58 language:JavaScript
Perks.FreeCoffeeCompanyPerk C:\Users\daniel.xie\Desktop\netburner\netburner\src\Perk.js 6;" kind:property line:6 language:JavaScript
Perks.FreeFoodCompanyPerk C:\Users\daniel.xie\Desktop\netburner\netburner\src\Perk.js 7;" kind:property line:7 language:JavaScript
Perks.InsiderKnowledgeFactionPerk C:\Users\daniel.xie\Desktop\netburner\netburner\src\Perk.js 17;" kind:property line:17 language:JavaScript
Perks.KnowledgeBaseCompanyPerk C:\Users\daniel.xie\Desktop\netburner\netburner\src\Perk.js 10;" kind:property line:10 language:JavaScript
Perks.NetworkingCompanyPerk C:\Users\daniel.xie\Desktop\netburner\netburner\src\Perk.js 8;" kind:property line:8 language:JavaScript
Perks.NetworkingFactionPerk C:\Users\daniel.xie\Desktop\netburner\netburner\src\Perk.js 13;" kind:property line:13 language:JavaScript
Perks.NootropicsCompanyPerk C:\Users\daniel.xie\Desktop\netburner\netburner\src\Perk.js 11;" kind:property line:11 language:JavaScript
Perks.PersonalTrainerCompanyPerk C:\Users\daniel.xie\Desktop\netburner\netburner\src\Perk.js 9;" kind:property line:9 language:JavaScript
Perks.PrivateServerFactionPerk C:\Users\daniel.xie\Desktop\netburner\netburner\src\Perk.js 16;" kind:property line:16 language:JavaScript
Perks.SupercomputerFactionPerk C:\Users\daniel.xie\Desktop\netburner\netburner\src\Perk.js 14;" kind:property line:14 language:JavaScript
Perks.VPNFactionPerk C:\Users\daniel.xie\Desktop\netburner\netburner\src\Perk.js 15;" kind:property line:15 language:JavaScript
PlayerObject C:\Users\daniel.xie\Desktop\netburner\netburner\src\CompanyJobApplication.js 5;" kind:class line:5 language:JavaScript
PlayerObject C:\Users\daniel.xie\Desktop\netburner\netburner\src\Faction.js 121;" kind:class line:121 language:JavaScript
PlayerObject C:\Users\daniel.xie\Desktop\netburner\netburner\src\Player.js 2;" kind:class line:2 language:JavaScript
PlayerObject.PlayerObject C:\Users\daniel.xie\Desktop\netburner\netburner\src\Player.js 436;" kind:class line:436 language:JavaScript
PlayerObject.PlayerObject C:\Users\daniel.xie\Desktop\netburner\netburner\src\Player.js 730;" kind:method line:730 language:JavaScript
PlayerObject.PlayerObject.createProgramWork C:\Users\daniel.xie\Desktop\netburner\netburner\src\Player.js 690;" kind:method line:690 language:JavaScript
PlayerObject.PlayerObject.finishCreateProgramWork C:\Users\daniel.xie\Desktop\netburner\netburner\src\Player.js 709;" kind:method line:709 language:JavaScript
PlayerObject.PlayerObject.getFactionFieldWorkRepGain C:\Users\daniel.xie\Desktop\netburner\netburner\src\Player.js 655;" kind:method line:655 language:JavaScript
PlayerObject.PlayerObject.getFactionSecurityWorkRepGain C:\Users\daniel.xie\Desktop\netburner\netburner\src\Player.js 646;" kind:method line:646 language:JavaScript
PlayerObject.PlayerObject.getWorkAgiExpGain C:\Users\daniel.xie\Desktop\netburner\netburner\src\Player.js 626;" kind:method line:626 language:JavaScript
PlayerObject.PlayerObject.getWorkChaExpGain C:\Users\daniel.xie\Desktop\netburner\netburner\src\Player.js 632;" kind:method line:632 language:JavaScript
PlayerObject.PlayerObject.getWorkDefExpGain C:\Users\daniel.xie\Desktop\netburner\netburner\src\Player.js 614;" kind:method line:614 language:JavaScript
PlayerObject.PlayerObject.getWorkDexExpGain C:\Users\daniel.xie\Desktop\netburner\netburner\src\Player.js 620;" kind:method line:620 language:JavaScript
PlayerObject.PlayerObject.getWorkHackExpGain C:\Users\daniel.xie\Desktop\netburner\netburner\src\Player.js 602;" kind:method line:602 language:JavaScript
PlayerObject.PlayerObject.getWorkMoneyGain C:\Users\daniel.xie\Desktop\netburner\netburner\src\Player.js 596;" kind:method line:596 language:JavaScript
PlayerObject.PlayerObject.getWorkRepGain C:\Users\daniel.xie\Desktop\netburner\netburner\src\Player.js 638;" kind:method line:638 language:JavaScript
PlayerObject.PlayerObject.getWorkStrExpGain C:\Users\daniel.xie\Desktop\netburner\netburner\src\Player.js 608;" kind:method line:608 language:JavaScript
PlayerObject.PlayerObject.startCreateProgramWork C:\Users\daniel.xie\Desktop\netburner\netburner\src\Player.js 666;" kind:method line:666 language:JavaScript
PlayerObject.PlayerObject.startFactionFieldWork C:\Users\daniel.xie\Desktop\netburner\netburner\src\Player.js 517;" kind:method line:517 language:JavaScript
PlayerObject.PlayerObject.startFactionHackWork C:\Users\daniel.xie\Desktop\netburner\netburner\src\Player.js 502;" kind:method line:502 language:JavaScript
PlayerObject.PlayerObject.startFactionSecurityWork C:\Users\daniel.xie\Desktop\netburner\netburner\src\Player.js 532;" kind:method line:532 language:JavaScript
PlayerObject.PlayerObject.startFactionWork C:\Users\daniel.xie\Desktop\netburner\netburner\src\Player.js 471;" kind:method line:471 language:JavaScript
PlayerObject.PlayerObject.toJSON C:\Users\daniel.xie\Desktop\netburner\netburner\src\Player.js 726;" kind:method line:726 language:JavaScript
PlayerObject.PlayerObject.workForFaction C:\Users\daniel.xie\Desktop\netburner\netburner\src\Player.js 547;" kind:method line:547 language:JavaScript
PlayerObject.analyze C:\Users\daniel.xie\Desktop\netburner\netburner\src\Player.js 230;" kind:method line:230 language:JavaScript
PlayerObject.applyForAgentJob C:\Users\daniel.xie\Desktop\netburner\netburner\src\CompanyJobApplication.js 118;" kind:method line:118 language:JavaScript
PlayerObject.applyForBusinessJob C:\Users\daniel.xie\Desktop\netburner\netburner\src\CompanyJobApplication.js 109;" kind:method line:109 language:JavaScript
PlayerObject.applyForEmployeeJob C:\Users\daniel.xie\Desktop\netburner\netburner\src\CompanyJobApplication.js 127;" kind:method line:127 language:JavaScript
PlayerObject.applyForItJob C:\Users\daniel.xie\Desktop\netburner\netburner\src\CompanyJobApplication.js 84;" kind:method line:84 language:JavaScript
PlayerObject.applyForJob C:\Users\daniel.xie\Desktop\netburner\netburner\src\CompanyJobApplication.js 5;" kind:method line:5 language:JavaScript
PlayerObject.applyForNetworkEngineerJob C:\Users\daniel.xie\Desktop\netburner\netburner\src\CompanyJobApplication.js 100;" kind:method line:100 language:JavaScript
PlayerObject.applyForSecurityEngineerJob C:\Users\daniel.xie\Desktop\netburner\netburner\src\CompanyJobApplication.js 88;" kind:method line:88 language:JavaScript
PlayerObject.applyForSecurityJob C:\Users\daniel.xie\Desktop\netburner\netburner\src\CompanyJobApplication.js 113;" kind:method line:113 language:JavaScript
PlayerObject.applyForSoftwareJob C:\Users\daniel.xie\Desktop\netburner\netburner\src\CompanyJobApplication.js 80;" kind:method line:80 language:JavaScript
PlayerObject.applyForWaiterJob C:\Users\daniel.xie\Desktop\netburner\netburner\src\CompanyJobApplication.js 139;" kind:method line:139 language:JavaScript
PlayerObject.calculateExpGain C:\Users\daniel.xie\Desktop\netburner\netburner\src\Player.js 216;" kind:method line:216 language:JavaScript
PlayerObject.calculateHackingChance C:\Users\daniel.xie\Desktop\netburner\netburner\src\Player.js 176;" kind:method line:176 language:JavaScript
PlayerObject.calculateHackingTime C:\Users\daniel.xie\Desktop\netburner\netburner\src\Player.js 190;" kind:method line:190 language:JavaScript
PlayerObject.calculatePercentMoneyHacked C:\Users\daniel.xie\Desktop\netburner\netburner\src\Player.js 201;" kind:method line:201 language:JavaScript
PlayerObject.calculateSkill C:\Users\daniel.xie\Desktop\netburner\netburner\src\Player.js 157;" kind:method line:157 language:JavaScript
PlayerObject.checkForFactionInvitations C:\Users\daniel.xie\Desktop\netburner\netburner\src\Faction.js 121;" kind:method line:121 language:JavaScript
PlayerObject.finishWork C:\Users\daniel.xie\Desktop\netburner\netburner\src\Player.js 288;" kind:method line:288 language:JavaScript
PlayerObject.gainAgilityExp C:\Users\daniel.xie\Desktop\netburner\netburner\src\Player.js 273;" kind:method line:273 language:JavaScript
PlayerObject.gainCharismaExp C:\Users\daniel.xie\Desktop\netburner\netburner\src\Player.js 280;" kind:method line:280 language:JavaScript
PlayerObject.gainDefenseExp C:\Users\daniel.xie\Desktop\netburner\netburner\src\Player.js 259;" kind:method line:259 language:JavaScript
PlayerObject.gainDexterityExp C:\Users\daniel.xie\Desktop\netburner\netburner\src\Player.js 266;" kind:method line:266 language:JavaScript
PlayerObject.gainHackingExp C:\Users\daniel.xie\Desktop\netburner\netburner\src\Player.js 245;" kind:method line:245 language:JavaScript
PlayerObject.gainMoney C:\Users\daniel.xie\Desktop\netburner\netburner\src\Player.js 236;" kind:method line:236 language:JavaScript
PlayerObject.gainStrengthExp C:\Users\daniel.xie\Desktop\netburner\netburner\src\Player.js 252;" kind:method line:252 language:JavaScript
PlayerObject.getCurrentServer C:\Users\daniel.xie\Desktop\netburner\netburner\src\Player.js 146;" kind:method line:146 language:JavaScript
PlayerObject.getHomeComputer C:\Users\daniel.xie\Desktop\netburner\netburner\src\Player.js 150;" kind:method line:150 language:JavaScript
PlayerObject.hack C:\Users\daniel.xie\Desktop\netburner\netburner\src\Player.js 223;" kind:method line:223 language:JavaScript
PlayerObject.init C:\Users\daniel.xie\Desktop\netburner\netburner\src\Player.js 135;" kind:method line:135 language:JavaScript
PlayerObject.isQualified C:\Users\daniel.xie\Desktop\netburner\netburner\src\CompanyJobApplication.js 152;" kind:method line:152 language:JavaScript
PlayerObject.startWork C:\Users\daniel.xie\Desktop\netburner\netburner\src\Player.js 346;" kind:method line:346 language:JavaScript
PlayerObject.updateSkillLevels C:\Users\daniel.xie\Desktop\netburner\netburner\src\Player.js 161;" kind:method line:161 language:JavaScript
PlayerObject.work C:\Users\daniel.xie\Desktop\netburner\netburner\src\Player.js 387;" kind:method line:387 language:JavaScript
PrintAllServers C:\Users\daniel.xie\Desktop\netburner\netburner\src\Server.js 692;" kind:function line:692 language:JavaScript
Programs.BruteSSHProgram C:\Users\daniel.xie\Desktop\netburner\netburner\src\CreateProgram.js 4;" kind:property line:4 language:JavaScript
Programs.FTPCrackProgram C:\Users\daniel.xie\Desktop\netburner\netburner\src\CreateProgram.js 5;" kind:property line:5 language:JavaScript
Programs.HTTPWormProgram C:\Users\daniel.xie\Desktop\netburner\netburner\src\CreateProgram.js 7;" kind:property line:7 language:JavaScript
Programs.NukeProgram C:\Users\daniel.xie\Desktop\netburner\netburner\src\CreateProgram.js 3;" kind:property line:3 language:JavaScript
Programs.RelaySMTPProgram C:\Users\daniel.xie\Desktop\netburner\netburner\src\CreateProgram.js 6;" kind:property line:6 language:JavaScript
Programs.SQLInjectProgram C:\Users\daniel.xie\Desktop\netburner\netburner\src\CreateProgram.js 8;" kind:property line:8 language:JavaScript
Script C:\Users\daniel.xie\Desktop\netburner\netburner\src\Script.js 66;" kind:class line:66 language:JavaScript
Script.displayLog C:\Users\daniel.xie\Desktop\netburner\netburner\src\Script.js 139;" kind:method line:139 language:JavaScript
Script.fromJSON C:\Users\daniel.xie\Desktop\netburner\netburner\src\Script.js 150;" kind:function line:150 language:JavaScript
Script.log C:\Users\daniel.xie\Desktop\netburner\netburner\src\Script.js 129;" kind:method line:129 language:JavaScript
Script.saveScript C:\Users\daniel.xie\Desktop\netburner\netburner\src\Script.js 90;" kind:method line:90 language:JavaScript
Script.toJSON C:\Users\daniel.xie\Desktop\netburner\netburner\src\Script.js 145;" kind:method line:145 language:JavaScript
Script.updateNumInstructions C:\Users\daniel.xie\Desktop\netburner\netburner\src\Script.js 116;" kind:method line:116 language:JavaScript
Script.updateRamUsage C:\Users\daniel.xie\Desktop\netburner\netburner\src\Script.js 125;" kind:method line:125 language:JavaScript
ScriptEditorLastStatus C:\Users\daniel.xie\Desktop\netburner\netburner\src\Script.js 56;" kind:variable line:56 language:JavaScript
Server C:\Users\daniel.xie\Desktop\netburner\netburner\src\Server.js 4;" kind:class line:4 language:JavaScript
Server.fromJSON C:\Users\daniel.xie\Desktop\netburner\netburner\src\Server.js 108;" kind:function line:108 language:JavaScript
Server.getScript C:\Users\daniel.xie\Desktop\netburner\netburner\src\Server.js 94;" kind:method line:94 language:JavaScript
Server.getServerOnNetwork C:\Users\daniel.xie\Desktop\netburner\netburner\src\Server.js 84;" kind:method line:84 language:JavaScript
Server.init C:\Users\daniel.xie\Desktop\netburner\netburner\src\Server.js 57;" kind:method line:57 language:JavaScript
Server.setHackingParameters C:\Users\daniel.xie\Desktop\netburner\netburner\src\Server.js 69;" kind:method line:69 language:JavaScript
Server.setPortProperties C:\Users\daniel.xie\Desktop\netburner\netburner\src\Server.js 78;" kind:method line:78 language:JavaScript
Server.toJSON C:\Users\daniel.xie\Desktop\netburner\netburner\src\Server.js 104;" kind:method line:104 language:JavaScript
SizeOfAllServers C:\Users\daniel.xie\Desktop\netburner\netburner\src\Server.js 657;" kind:function line:657 language:JavaScript
SpecialServerIpsMap C:\Users\daniel.xie\Desktop\netburner\netburner\src\SpecialServerIps.js 2;" kind:function line:2 language:JavaScript
SpecialServerIpsMap C:\Users\daniel.xie\Desktop\netburner\netburner\src\SpecialServerIps.js 5;" kind:class line:5 language:JavaScript
SpecialServerIpsMap.addIp C:\Users\daniel.xie\Desktop\netburner\netburner\src\SpecialServerIps.js 5;" kind:method line:5 language:JavaScript
SpecialServerIpsMap.fromJSON C:\Users\daniel.xie\Desktop\netburner\netburner\src\SpecialServerIps.js 13;" kind:function line:13 language:JavaScript
SpecialServerIpsMap.toJSON C:\Users\daniel.xie\Desktop\netburner\netburner\src\SpecialServerIps.js 9;" kind:method line:9 language:JavaScript
SpecialServerIpsSave C:\Users\daniel.xie\Desktop\netburner\netburner\src\engine.js 91;" kind:variable line:91 language:JavaScript
Tokenizer C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Tokenizer.js 16;" kind:function line:16 language:JavaScript
WorkerScript C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\NetscriptWorker.js 6;" kind:class line:6 language:JavaScript
WorkerScript.getServer C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\NetscriptWorker.js 18;" kind:method line:18 language:JavaScript
addWorkerScript C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\NetscriptWorker.js 132;" kind:function line:132 language:JavaScript
allFiles C:\Users\daniel.xie\Desktop\netburner\netburner\src\Terminal.js 312;" kind:variable line:312 language:JavaScript
applyAugmentation C:\Users\daniel.xie\Desktop\netburner\netburner\src\Augmentations.js 486;" kind:function line:486 language:JavaScript
applyPerk C:\Users\daniel.xie\Desktop\netburner\netburner\src\Perk.js 84;" kind:function line:84 language:JavaScript
apply_op C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Evaluator.js 498;" kind:function line:498 language:JavaScript
apply_op.div C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Evaluator.js 504;" kind:function line:504 language:JavaScript
apply_op.num C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Evaluator.js 499;" kind:function line:499 language:JavaScript
checkValidFilename C:\Users\daniel.xie\Desktop\netburner\netburner\src\Script.js 47;" kind:function line:47 language:JavaScript
createProgram C:\Users\daniel.xie\Desktop\netburner\netburner\src\CreateProgram.js 82;" kind:function line:82 language:JavaScript
croak C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\InputStream.js 22;" kind:function line:22 language:JavaScript
delTarget C:\Users\daniel.xie\Desktop\netburner\netburner\src\Terminal.js 405;" kind:variable line:405 language:JavaScript
diff C:\Users\daniel.xie\Desktop\netburner\netburner\src\engine.js 536;" kind:variable line:536 language:JavaScript
displayFactionAugmentations C:\Users\daniel.xie\Desktop\netburner\netburner\src\Faction.js 616;" kind:function line:616 language:JavaScript
displayFactionContent C:\Users\daniel.xie\Desktop\netburner\netburner\src\Faction.js 417;" kind:function line:417 language:JavaScript
eof C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\InputStream.js 19;" kind:function line:19 language:JavaScript
eof C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Tokenizer.js 165;" kind:function line:165 language:JavaScript
evaluate C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Evaluator.js 7;" kind:function line:7 language:JavaScript
evaluateFor C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Evaluator.js 333;" kind:function line:333 language:JavaScript
evaluateProg C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Evaluator.js 460;" kind:function line:460 language:JavaScript
evaluateWhile C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Evaluator.js 405;" kind:function line:405 language:JavaScript
executeDarkwebTerminalCommand C:\Users\daniel.xie\Desktop\netburner\netburner\src\DarkWeb.js 2;" kind:function line:2 language:JavaScript
filename C:\Users\daniel.xie\Desktop\netburner\netburner\src\Terminal.js 334;" kind:variable line:334 language:JavaScript
getNextCompanyPosition C:\Users\daniel.xie\Desktop\netburner\netburner\src\Company.js 328;" kind:function line:328 language:JavaScript
hackProgressBarPost C:\Users\daniel.xie\Desktop\netburner\netburner\src\Terminal.js 10;" kind:function line:10 language:JavaScript
hackProgressPost C:\Users\daniel.xie\Desktop\netburner\netburner\src\Terminal.js 15;" kind:function line:15 language:JavaScript
hostname C:\Users\daniel.xie\Desktop\netburner\netburner\src\engine.js 422;" kind:variable line:422 language:JavaScript
initAugmentations C:\Users\daniel.xie\Desktop\netburner\netburner\src\Augmentations.js 52;" kind:function line:52 language:JavaScript
initCompanies C:\Users\daniel.xie\Desktop\netburner\netburner\src\Company.js 425;" kind:function line:425 language:JavaScript
initFactions C:\Users\daniel.xie\Desktop\netburner\netburner\src\Faction.js 47;" kind:function line:47 language:JavaScript
initForeignServers C:\Users\daniel.xie\Desktop\netburner\netburner\src\Server.js 117;" kind:function line:117 language:JavaScript
initLocationButtons C:\Users\daniel.xie\Desktop\netburner\netburner\src\Location.js 759;" kind:function line:759 language:JavaScript
inviteToFaction C:\Users\daniel.xie\Desktop\netburner\netburner\src\Faction.js 362;" kind:function line:362 language:JavaScript
ip C:\Users\daniel.xie\Desktop\netburner\netburner\src\Terminal.js 222;" kind:variable line:222 language:JavaScript
is_digit C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Tokenizer.js 31;" kind:function line:31 language:JavaScript
is_id C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Tokenizer.js 40;" kind:function line:40 language:JavaScript
is_id_start C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Tokenizer.js 36;" kind:function line:36 language:JavaScript
is_keyword C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Tokenizer.js 27;" kind:function line:27 language:JavaScript
is_op_char C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Tokenizer.js 44;" kind:function line:44 language:JavaScript
is_punc C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Tokenizer.js 48;" kind:function line:48 language:JavaScript
is_whitespace C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Tokenizer.js 52;" kind:function line:52 language:JavaScript
item C:\Users\daniel.xie\Desktop\netburner\netburner\src\engine.js 402;" kind:variable line:402 language:JavaScript
itemText C:\Users\daniel.xie\Desktop\netburner\netburner\src\engine.js 419;" kind:variable line:419 language:JavaScript
joinFaction C:\Users\daniel.xie\Desktop\netburner\netburner\src\Faction.js 369;" kind:function line:369 language:JavaScript
killWorkerScript C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\NetscriptWorker.js 122;" kind:function line:122 language:JavaScript
li C:\Users\daniel.xie\Desktop\netburner\netburner\src\engine.js 384;" kind:variable line:384 language:JavaScript
loadAllRunningScripts C:\Users\daniel.xie\Desktop\netburner\netburner\src\Script.js 159;" kind:function line:159 language:JavaScript
losePerk C:\Users\daniel.xie\Desktop\netburner\netburner\src\Perk.js 114;" kind:function line:114 language:JavaScript
mainMenu C:\Users\daniel.xie\Desktop\netburner\netburner\src\engine.js 263;" kind:variable line:263 language:JavaScript
maybe_call C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Parser.js 203;" kind:function line:203 language:JavaScript
next C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\InputStream.js 11;" kind:function line:11 language:JavaScript
next C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Tokenizer.js 157;" kind:function line:157 language:JavaScript
offlineEps C:\Users\daniel.xie\Desktop\netburner\netburner\src\engine.js 440;" kind:variable line:440 language:JavaScript
offlineMps C:\Users\daniel.xie\Desktop\netburner\netburner\src\engine.js 438;" kind:variable line:438 language:JavaScript
offlineMpsText C:\Users\daniel.xie\Desktop\netburner\netburner\src\engine.js 439;" kind:variable line:439 language:JavaScript
offlineTotalMoneyMade C:\Users\daniel.xie\Desktop\netburner\netburner\src\engine.js 435;" kind:variable line:435 language:JavaScript
offset C:\Users\daniel.xie\Desktop\netburner\netburner\src\engine.js 537;" kind:variable line:537 language:JavaScript
onlineEps C:\Users\daniel.xie\Desktop\netburner\netburner\src\engine.js 431;" kind:variable line:431 language:JavaScript
onlineMps C:\Users\daniel.xie\Desktop\netburner\netburner\src\engine.js 429;" kind:variable line:429 language:JavaScript
onlineMpsText C:\Users\daniel.xie\Desktop\netburner\netburner\src\engine.js 430;" kind:variable line:430 language:JavaScript
onlineTotalMoneyMade C:\Users\daniel.xie\Desktop\netburner\netburner\src\engine.js 426;" kind:variable line:426 language:JavaScript
parse_atom C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Parser.js 208;" kind:function line:208 language:JavaScript
parse_bool C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Parser.js 196;" kind:function line:196 language:JavaScript
parse_expression C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Parser.js 248;" kind:function line:248 language:JavaScript
parse_for C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Parser.js 154;" kind:function line:154 language:JavaScript
parse_if C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Parser.js 111;" kind:function line:111 language:JavaScript
parse_if.ret.cond C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Parser.js 122;" kind:property line:122 language:JavaScript
parse_if.ret.type C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Parser.js 121;" kind:property line:121 language:JavaScript
parse_prog C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Parser.js 240;" kind:function line:240 language:JavaScript
parse_toplevel C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Parser.js 230;" kind:function line:230 language:JavaScript
parse_varname C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Parser.js 100;" kind:function line:100 language:JavaScript
parse_while C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Parser.js 182;" kind:function line:182 language:JavaScript
peek C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\InputStream.js 16;" kind:function line:16 language:JavaScript
peek C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Tokenizer.js 151;" kind:function line:151 language:JavaScript
percent C:\Users\daniel.xie\Desktop\netburner\netburner\src\engine.js 657;" kind:variable line:657 language:JavaScript
post C:\Users\daniel.xie\Desktop\netburner\netburner\src\Terminal.js 4;" kind:function line:4 language:JavaScript
postNetburnerText C:\Users\daniel.xie\Desktop\netburner\netburner\src\Terminal.js 25;" kind:function line:25 language:JavaScript
postScriptEditorStatus C:\Users\daniel.xie\Desktop\netburner\netburner\src\Script.js 57;" kind:function line:57 language:JavaScript
prestigeAugmentation C:\Users\daniel.xie\Desktop\netburner\netburner\src\Prestige.js 4;" kind:function line:4 language:JavaScript
purchaseServer C:\Users\daniel.xie\Desktop\netburner\netburner\src\PurchaseServers.js 2;" kind:function line:2 language:JavaScript
purchaseTor C:\Users\daniel.xie\Desktop\netburner\netburner\src\Location.js 1292;" kind:function line:1292 language:JavaScript
read_escaped C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Tokenizer.js 88;" kind:function line:88 language:JavaScript
read_ident C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Tokenizer.js 79;" kind:function line:79 language:JavaScript
read_next C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Tokenizer.js 122;" kind:function line:122 language:JavaScript
read_number C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Tokenizer.js 63;" kind:function line:63 language:JavaScript
read_string C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Tokenizer.js 107;" kind:function line:107 language:JavaScript
read_while C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Tokenizer.js 56;" kind:function line:56 language:JavaScript
runScriptsLoop C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\NetscriptWorker.js 26;" kind:function line:26 language:JavaScript
s C:\Users\daniel.xie\Desktop\netburner\netburner\src\Terminal.js 406;" kind:variable line:406 language:JavaScript
scriptCalculateExpGain C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Evaluator.js 546;" kind:function line:546 language:JavaScript
scriptCalculateHackingChance C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Evaluator.js 528;" kind:function line:528 language:JavaScript
scriptCalculateHackingTime C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Evaluator.js 538;" kind:function line:538 language:JavaScript
scriptCalculateOfflineProduction C:\Users\daniel.xie\Desktop\netburner\netburner\src\Script.js 183;" kind:function line:183 language:JavaScript
scriptCalculatePercentMoneyHacked C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Evaluator.js 551;" kind:function line:551 language:JavaScript
scriptName C:\Users\daniel.xie\Desktop\netburner\netburner\src\Terminal.js 296;" kind:variable line:296 language:JavaScript
scriptname C:\Users\daniel.xie\Desktop\netburner\netburner\src\Terminal.js 342;" kind:variable line:342 language:JavaScript
serverIpHostname C:\Users\daniel.xie\Desktop\netburner\netburner\src\engine.js 423;" kind:variable line:423 language:JavaScript
skip_comment C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\Tokenizer.js 116;" kind:function line:116 language:JavaScript
travelToCity C:\Users\daniel.xie\Desktop\netburner\netburner\src\Location.js 1280;" kind:function line:1280 language:JavaScript
updateOnlineScriptTimes C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\NetscriptWorker.js 155;" kind:function line:155 language:JavaScript
updateTerminalScroll C:\Users\daniel.xie\Desktop\netburner\netburner\src\Terminal.js 20;" kind:function line:20 language:JavaScript
window.onload C:\Users\daniel.xie\Desktop\netburner\netburner\src\engine.js 904;" kind:function line:904 language:JavaScript
workerScripts C:\Users\daniel.xie\Desktop\netburner\netburner\src\Netscript\NetscriptWorker.js 23;" kind:variable line:23 language:JavaScript

BIN
src/tags.idx Normal file

Binary file not shown.

359
tags Normal file

@ -0,0 +1,359 @@
!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/
!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
!_TAG_PROGRAM_AUTHOR Darren Hiebert /dhiebert@users.sourceforge.net/
!_TAG_PROGRAM_NAME Exuberant Ctags //
!_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/
!_TAG_PROGRAM_VERSION 5.8 //
$.analyzeFlag C:\Users\daniel.xie\Desktop\netburner\src\Terminal.js 84;" kind:property line:84 language:JavaScript
$.executeCommand C:\Users\daniel.xie\Desktop\netburner\src\Terminal.js 183;" kind:method line:183 language:JavaScript
$.finishAction C:\Users\daniel.xie\Desktop\netburner\src\Terminal.js 86;" kind:method line:86 language:JavaScript
$.finishAnalyze C:\Users\daniel.xie\Desktop\netburner\src\Terminal.js 134;" kind:method line:134 language:JavaScript
$.finishHack C:\Users\daniel.xie\Desktop\netburner\src\Terminal.js 95;" kind:method line:95 language:JavaScript
$.hackFlag C:\Users\daniel.xie\Desktop\netburner\src\Terminal.js 83;" kind:property line:83 language:JavaScript
AddToAllServers C:\Users\daniel.xie\Desktop\netburner\src\Server.js 666;" kind:function line:666 language:JavaScript
AllServersSave C:\Users\daniel.xie\Desktop\netburner\src\engine.js 77;" kind:variable line:77 language:JavaScript
Augmentation C:\Users\daniel.xie\Desktop\netburner\src\Augmentations.js 2;" kind:class line:2 language:JavaScript
Augmentation.addToFactions C:\Users\daniel.xie\Desktop\netburner\src\Augmentations.js 23;" kind:method line:23 language:JavaScript
Augmentation.fromJSON C:\Users\daniel.xie\Desktop\netburner\src\Augmentations.js 38;" kind:function line:38 language:JavaScript
Augmentation.setInfo C:\Users\daniel.xie\Desktop\netburner\src\Augmentations.js 13;" kind:method line:13 language:JavaScript
Augmentation.setRequirements C:\Users\daniel.xie\Desktop\netburner\src\Augmentations.js 17;" kind:method line:17 language:JavaScript
Augmentation.toJSON C:\Users\daniel.xie\Desktop\netburner\src\Augmentations.js 34;" kind:method line:34 language:JavaScript
AugmentationsSave C:\Users\daniel.xie\Desktop\netburner\src\engine.js 81;" kind:variable line:81 language:JavaScript
CONSTANTS.BruteSSHProgram C:\Users\daniel.xie\Desktop\netburner\src\Constants.js 22;" kind:property line:22 language:JavaScript
CONSTANTS.CodeInstructionRunTime C:\Users\daniel.xie\Desktop\netburner\src\Constants.js 12;" kind:property line:12 language:JavaScript
CONSTANTS.CodeOfflineExecutionTime C:\Users\daniel.xie\Desktop\netburner\src\Constants.js 15;" kind:property line:15 language:JavaScript
CONSTANTS.CorpFactionRepRequirement C:\Users\daniel.xie\Desktop\netburner\src\Constants.js 7;" kind:property line:7 language:JavaScript
CONSTANTS.FTPCrackProgram C:\Users\daniel.xie\Desktop\netburner\src\Constants.js 23;" kind:property line:23 language:JavaScript
CONSTANTS.HTTPWormProgram C:\Users\daniel.xie\Desktop\netburner\src\Constants.js 25;" kind:property line:25 language:JavaScript
CONSTANTS.HelpText C:\Users\daniel.xie\Desktop\netburner\src\Constants.js 29;" kind:property line:29 language:JavaScript
CONSTANTS.MaxLogCapacity C:\Users\daniel.xie\Desktop\netburner\src\Constants.js 18;" kind:property line:18 language:JavaScript
CONSTANTS.MaxSkillLevel C:\Users\daniel.xie\Desktop\netburner\src\Constants.js 4;" kind:property line:4 language:JavaScript
CONSTANTS.PortHackProgram C:\Users\daniel.xie\Desktop\netburner\src\Constants.js 21;" kind:property line:21 language:JavaScript
CONSTANTS.RelaySMTPProgram C:\Users\daniel.xie\Desktop\netburner\src\Constants.js 24;" kind:property line:24 language:JavaScript
CONSTANTS.SQLInjectProgram C:\Users\daniel.xie\Desktop\netburner\src\Constants.js 26;" kind:property line:26 language:JavaScript
CompaniesSave C:\Users\daniel.xie\Desktop\netburner\src\engine.js 78;" kind:variable line:78 language:JavaScript
Company C:\Users\daniel.xie\Desktop\netburner\src\Company.js 4;" kind:class line:4 language:JavaScript
Company.addPosition C:\Users\daniel.xie\Desktop\netburner\src\Company.js 34;" kind:method line:34 language:JavaScript
Company.addPositions C:\Users\daniel.xie\Desktop\netburner\src\Company.js 38;" kind:method line:38 language:JavaScript
Company.fromJSON C:\Users\daniel.xie\Desktop\netburner\src\Company.js 57;" kind:function line:57 language:JavaScript
Company.hasPosition C:\Users\daniel.xie\Desktop\netburner\src\Company.js 44;" kind:method line:44 language:JavaScript
Company.init C:\Users\daniel.xie\Desktop\netburner\src\Company.js 23;" kind:method line:23 language:JavaScript
Company.setInfo C:\Users\daniel.xie\Desktop\netburner\src\Company.js 30;" kind:method line:30 language:JavaScript
Company.toJSON C:\Users\daniel.xie\Desktop\netburner\src\Company.js 53;" kind:method line:53 language:JavaScript
CompanyPosition C:\Users\daniel.xie\Desktop\netburner\src\Company.js 64;" kind:class line:64 language:JavaScript
CompanyPosition.calculateJobPerformance C:\Users\daniel.xie\Desktop\netburner\src\Company.js 112;" kind:method line:112 language:JavaScript
CompanyPosition.fromJSON C:\Users\daniel.xie\Desktop\netburner\src\Company.js 196;" kind:function line:196 language:JavaScript
CompanyPosition.isAgentJob C:\Users\daniel.xie\Desktop\netburner\src\Company.js 183;" kind:method line:183 language:JavaScript
CompanyPosition.isBusinessJob C:\Users\daniel.xie\Desktop\netburner\src\Company.js 160;" kind:method line:160 language:JavaScript
CompanyPosition.isITJob C:\Users\daniel.xie\Desktop\netburner\src\Company.js 136;" kind:method line:136 language:JavaScript
CompanyPosition.isNetworkEngineerJob C:\Users\daniel.xie\Desktop\netburner\src\Company.js 153;" kind:method line:153 language:JavaScript
CompanyPosition.isSecurityEngineerJob C:\Users\daniel.xie\Desktop\netburner\src\Company.js 146;" kind:method line:146 language:JavaScript
CompanyPosition.isSecurityJob C:\Users\daniel.xie\Desktop\netburner\src\Company.js 172;" kind:method line:172 language:JavaScript
CompanyPosition.isSoftwareJob C:\Users\daniel.xie\Desktop\netburner\src\Company.js 122;" kind:method line:122 language:JavaScript
CompanyPosition.setExperienceGains C:\Users\daniel.xie\Desktop\netburner\src\Company.js 101;" kind:method line:101 language:JavaScript
CompanyPosition.setPerformanceParameters C:\Users\daniel.xie\Desktop\netburner\src\Company.js 86;" kind:method line:86 language:JavaScript
CompanyPosition.toJSON C:\Users\daniel.xie\Desktop\netburner\src\Company.js 192;" kind:method line:192 language:JavaScript
CompanyPositions.SoftwareIntern C:\Users\daniel.xie\Desktop\netburner\src\Company.js 206;" kind:property line:206 language:JavaScript
Engine.Clickables C:\Users\daniel.xie\Desktop\netburner\src\engine.js 5;" kind:property line:5 language:JavaScript
Engine.Debug C:\Users\daniel.xie\Desktop\netburner\src\engine.js 2;" kind:property line:2 language:JavaScript
Environment C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Environment.js 4;" kind:class line:4 language:JavaScript
Environment.def C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Environment.js 46;" kind:method line:46 language:JavaScript
Environment.extend C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Environment.js 12;" kind:method line:12 language:JavaScript
Environment.get C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Environment.js 27;" kind:method line:27 language:JavaScript
Environment.lookup C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Environment.js 17;" kind:method line:17 language:JavaScript
Environment.set C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Environment.js 34;" kind:method line:34 language:JavaScript
FALSE.type C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Parser.js 6;" kind:property line:6 language:JavaScript
FALSE.value C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Parser.js 6;" kind:property line:6 language:JavaScript
Faction C:\Users\daniel.xie\Desktop\netburner\src\Faction.js 2;" kind:class line:2 language:JavaScript
Faction.fromJSON C:\Users\daniel.xie\Desktop\netburner\src\Faction.js 30;" kind:function line:30 language:JavaScript
Faction.setAugmentationMultipliers C:\Users\daniel.xie\Desktop\netburner\src\Faction.js 17;" kind:method line:17 language:JavaScript
Faction.setInformation C:\Users\daniel.xie\Desktop\netburner\src\Faction.js 22;" kind:method line:22 language:JavaScript
Faction.toJSON C:\Users\daniel.xie\Desktop\netburner\src\Faction.js 26;" kind:method line:26 language:JavaScript
FactionInfo.HelpText C:\Users\daniel.xie\Desktop\netburner\src\FactionInfo.js 5;" kind:property line:5 language:JavaScript
FactionsSave C:\Users\daniel.xie\Desktop\netburner\src\engine.js 79;" kind:variable line:79 language:JavaScript
Generic_fromJSON C:\Users\daniel.xie\Desktop\netburner\utils\JSONReviver.js 58;" kind:function line:58 language:JavaScript
Generic_toJSON C:\Users\daniel.xie\Desktop\netburner\utils\JSONReviver.js 36;" kind:function line:36 language:JavaScript
GetServerByHostname C:\Users\daniel.xie\Desktop\netburner\src\Server.js 680;" kind:function line:680 language:JavaScript
InputStream C:\Users\daniel.xie\Desktop\netburner\src\Netscript\InputStream.js 3;" kind:function line:3 language:JavaScript
Locations.Aevum C:\Users\daniel.xie\Desktop\netburner\src\Location.js 6;" kind:property line:6 language:JavaScript
Locations.AevumAeroCorp C:\Users\daniel.xie\Desktop\netburner\src\Location.js 20;" kind:property line:20 language:JavaScript
Locations.AevumBachmanAndAssociates C:\Users\daniel.xie\Desktop\netburner\src\Location.js 17;" kind:property line:17 language:JavaScript
Locations.AevumClarkeIncorporated C:\Users\daniel.xie\Desktop\netburner\src\Location.js 18;" kind:property line:18 language:JavaScript
Locations.AevumCrushFitnessGym C:\Users\daniel.xie\Desktop\netburner\src\Location.js 26;" kind:property line:26 language:JavaScript
Locations.AevumECorp C:\Users\daniel.xie\Desktop\netburner\src\Location.js 16;" kind:property line:16 language:JavaScript
Locations.AevumFulcrumTechnologies C:\Users\daniel.xie\Desktop\netburner\src\Location.js 19;" kind:property line:19 language:JavaScript
Locations.AevumGalacticCybersystems C:\Users\daniel.xie\Desktop\netburner\src\Location.js 21;" kind:property line:21 language:JavaScript
Locations.AevumNetLinkTechnologies C:\Users\daniel.xie\Desktop\netburner\src\Location.js 25;" kind:property line:25 language:JavaScript
Locations.AevumPolice C:\Users\daniel.xie\Desktop\netburner\src\Location.js 24;" kind:property line:24 language:JavaScript
Locations.AevumRhoConstruction C:\Users\daniel.xie\Desktop\netburner\src\Location.js 23;" kind:property line:23 language:JavaScript
Locations.AevumSnapFitnessGym C:\Users\daniel.xie\Desktop\netburner\src\Location.js 27;" kind:property line:27 language:JavaScript
Locations.AevumTravelAgency C:\Users\daniel.xie\Desktop\netburner\src\Location.js 15;" kind:property line:15 language:JavaScript
Locations.AevumWatchdogSecurity C:\Users\daniel.xie\Desktop\netburner\src\Location.js 22;" kind:property line:22 language:JavaScript
Locations.Chongqing C:\Users\daniel.xie\Desktop\netburner\src\Location.js 7;" kind:property line:7 language:JavaScript
Locations.ChongqingKuaiGongInternational C:\Users\daniel.xie\Desktop\netburner\src\Location.js 31;" kind:property line:31 language:JavaScript
Locations.ChongqingSolarisSpaceSystems C:\Users\daniel.xie\Desktop\netburner\src\Location.js 32;" kind:property line:32 language:JavaScript
Locations.ChongqingTravelAgency C:\Users\daniel.xie\Desktop\netburner\src\Location.js 30;" kind:property line:30 language:JavaScript
Locations.Ishima C:\Users\daniel.xie\Desktop\netburner\src\Location.js 10;" kind:property line:10 language:JavaScript
Locations.IshimaNovaMedical C:\Users\daniel.xie\Desktop\netburner\src\Location.js 61;" kind:property line:61 language:JavaScript
Locations.IshimaOmegaSoftware C:\Users\daniel.xie\Desktop\netburner\src\Location.js 62;" kind:property line:62 language:JavaScript
Locations.IshimaStormTechnologies C:\Users\daniel.xie\Desktop\netburner\src\Location.js 60;" kind:property line:60 language:JavaScript
Locations.IshimaTravelAgency C:\Users\daniel.xie\Desktop\netburner\src\Location.js 59;" kind:property line:59 language:JavaScript
Locations.NewTokyo C:\Users\daniel.xie\Desktop\netburner\src\Location.js 9;" kind:property line:9 language:JavaScript
Locations.NewTokyoDefComm C:\Users\daniel.xie\Desktop\netburner\src\Location.js 53;" kind:property line:53 language:JavaScript
Locations.NewTokyoGlobalPharmaceuticals C:\Users\daniel.xie\Desktop\netburner\src\Location.js 55;" kind:property line:55 language:JavaScript
Locations.NewTokyoNoodleBar C:\Users\daniel.xie\Desktop\netburner\src\Location.js 56;" kind:property line:56 language:JavaScript
Locations.NewTokyoTravelAgency C:\Users\daniel.xie\Desktop\netburner\src\Location.js 52;" kind:property line:52 language:JavaScript
Locations.NewTokyoVitaLife C:\Users\daniel.xie\Desktop\netburner\src\Location.js 54;" kind:property line:54 language:JavaScript
Locations.Sector12 C:\Users\daniel.xie\Desktop\netburner\src\Location.js 8;" kind:property line:8 language:JavaScript
Locations.Sector12AlphaEnterprises C:\Users\daniel.xie\Desktop\netburner\src\Location.js 44;" kind:property line:44 language:JavaScript
Locations.Sector12BladeIndustries C:\Users\daniel.xie\Desktop\netburner\src\Location.js 37;" kind:property line:37 language:JavaScript
Locations.Sector12CIA C:\Users\daniel.xie\Desktop\netburner\src\Location.js 42;" kind:property line:42 language:JavaScript
Locations.Sector12CarmichaelSecurity C:\Users\daniel.xie\Desktop\netburner\src\Location.js 45;" kind:property line:45 language:JavaScript
Locations.Sector12DeltaOne C:\Users\daniel.xie\Desktop\netburner\src\Location.js 41;" kind:property line:41 language:JavaScript
Locations.Sector12FoodNStuff C:\Users\daniel.xie\Desktop\netburner\src\Location.js 46;" kind:property line:46 language:JavaScript
Locations.Sector12FourSigma C:\Users\daniel.xie\Desktop\netburner\src\Location.js 38;" kind:property line:38 language:JavaScript
Locations.Sector12IcarusMicrosystems C:\Users\daniel.xie\Desktop\netburner\src\Location.js 39;" kind:property line:39 language:JavaScript
Locations.Sector12IronGym C:\Users\daniel.xie\Desktop\netburner\src\Location.js 48;" kind:property line:48 language:JavaScript
Locations.Sector12JoesGuns C:\Users\daniel.xie\Desktop\netburner\src\Location.js 47;" kind:property line:47 language:JavaScript
Locations.Sector12MegaCorp C:\Users\daniel.xie\Desktop\netburner\src\Location.js 36;" kind:property line:36 language:JavaScript
Locations.Sector12NSA C:\Users\daniel.xie\Desktop\netburner\src\Location.js 43;" kind:property line:43 language:JavaScript
Locations.Sector12PowerhouseGym C:\Users\daniel.xie\Desktop\netburner\src\Location.js 49;" kind:property line:49 language:JavaScript
Locations.Sector12TravelAgency C:\Users\daniel.xie\Desktop\netburner\src\Location.js 35;" kind:property line:35 language:JavaScript
Locations.Sector12UniversalEnergy C:\Users\daniel.xie\Desktop\netburner\src\Location.js 40;" kind:property line:40 language:JavaScript
Locations.Volhaven C:\Users\daniel.xie\Desktop\netburner\src\Location.js 11;" kind:property line:11 language:JavaScript
Locations.VolhavenCompuTek C:\Users\daniel.xie\Desktop\netburner\src\Location.js 72;" kind:property line:72 language:JavaScript
Locations.VolhavenHeliosLabs C:\Users\daniel.xie\Desktop\netburner\src\Location.js 68;" kind:property line:68 language:JavaScript
Locations.VolhavenLexoCorp C:\Users\daniel.xie\Desktop\netburner\src\Location.js 70;" kind:property line:70 language:JavaScript
Locations.VolhavenMilleniumFitnessGym C:\Users\daniel.xie\Desktop\netburner\src\Location.js 73;" kind:property line:73 language:JavaScript
Locations.VolhavenNWO C:\Users\daniel.xie\Desktop\netburner\src\Location.js 67;" kind:property line:67 language:JavaScript
Locations.VolhavenOmniTekIncorporated C:\Users\daniel.xie\Desktop\netburner\src\Location.js 66;" kind:property line:66 language:JavaScript
Locations.VolhavenOmniaCybersystems C:\Users\daniel.xie\Desktop\netburner\src\Location.js 69;" kind:property line:69 language:JavaScript
Locations.VolhavenSysCoreSecurities C:\Users\daniel.xie\Desktop\netburner\src\Location.js 71;" kind:property line:71 language:JavaScript
Locations.VolhavenTravelAgency C:\Users\daniel.xie\Desktop\netburner\src\Location.js 65;" kind:property line:65 language:JavaScript
Parser C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Parser.js 8;" kind:function line:8 language:JavaScript
Parser.PRECEDENCE.!= C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Parser.js 13;" kind:property line:13 language:JavaScript
Parser.PRECEDENCE.% C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Parser.js 15;" kind:property line:15 language:JavaScript
Parser.PRECEDENCE.&& C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Parser.js 12;" kind:property line:12 language:JavaScript
Parser.PRECEDENCE.* C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Parser.js 15;" kind:property line:15 language:JavaScript
Parser.PRECEDENCE.+ C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Parser.js 14;" kind:property line:14 language:JavaScript
Parser.PRECEDENCE.- C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Parser.js 14;" kind:property line:14 language:JavaScript
Parser.PRECEDENCE./ C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Parser.js 15;" kind:property line:15 language:JavaScript
Parser.PRECEDENCE.< C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Parser.js 13;" kind:property line:13 language:JavaScript
Parser.PRECEDENCE.<= C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Parser.js 13;" kind:property line:13 language:JavaScript
Parser.PRECEDENCE.= C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Parser.js 10;" kind:property line:10 language:JavaScript
Parser.PRECEDENCE.== C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Parser.js 13;" kind:property line:13 language:JavaScript
Parser.PRECEDENCE.> C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Parser.js 13;" kind:property line:13 language:JavaScript
Parser.PRECEDENCE.>= C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Parser.js 13;" kind:property line:13 language:JavaScript
Parser.PRECEDENCE.|| C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Parser.js 11;" kind:property line:11 language:JavaScript
Parser.checkKeywordAndSkip C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Parser.js 46;" kind:function line:46 language:JavaScript
Parser.checkOpAndSkip C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Parser.js 53;" kind:function line:53 language:JavaScript
Parser.checkPuncAndSkip C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Parser.js 39;" kind:function line:39 language:JavaScript
Parser.delimited C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Parser.js 79;" kind:function line:79 language:JavaScript
Parser.is_kw C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Parser.js 26;" kind:function line:26 language:JavaScript
Parser.is_op C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Parser.js 32;" kind:function line:32 language:JavaScript
Parser.is_punc C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Parser.js 20;" kind:function line:20 language:JavaScript
Parser.maybe_binary C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Parser.js 62;" kind:function line:62 language:JavaScript
Parser.parse_call C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Parser.js 92;" kind:function line:92 language:JavaScript
Parser.unexpected C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Parser.js 58;" kind:function line:58 language:JavaScript
PlayerObject C:\Users\daniel.xie\Desktop\netburner\src\CompanyJobApplication.js 5;" kind:class line:5 language:JavaScript
PlayerObject C:\Users\daniel.xie\Desktop\netburner\src\Faction.js 121;" kind:class line:121 language:JavaScript
PlayerObject C:\Users\daniel.xie\Desktop\netburner\src\Player.js 2;" kind:class line:2 language:JavaScript
PlayerObject.PlayerObject C:\Users\daniel.xie\Desktop\netburner\src\Player.js 385;" kind:class line:385 language:JavaScript
PlayerObject.PlayerObject C:\Users\daniel.xie\Desktop\netburner\src\Player.js 676;" kind:method line:676 language:JavaScript
PlayerObject.PlayerObject.createProgramWork C:\Users\daniel.xie\Desktop\netburner\src\Player.js 636;" kind:method line:636 language:JavaScript
PlayerObject.PlayerObject.finishCreateProgramWork C:\Users\daniel.xie\Desktop\netburner\src\Player.js 655;" kind:method line:655 language:JavaScript
PlayerObject.PlayerObject.getFactionFieldWorkRepGain C:\Users\daniel.xie\Desktop\netburner\src\Player.js 603;" kind:method line:603 language:JavaScript
PlayerObject.PlayerObject.getFactionSecurityWorkRepGain C:\Users\daniel.xie\Desktop\netburner\src\Player.js 594;" kind:method line:594 language:JavaScript
PlayerObject.PlayerObject.getWorkAgiExpGain C:\Users\daniel.xie\Desktop\netburner\src\Player.js 574;" kind:method line:574 language:JavaScript
PlayerObject.PlayerObject.getWorkChaExpGain C:\Users\daniel.xie\Desktop\netburner\src\Player.js 580;" kind:method line:580 language:JavaScript
PlayerObject.PlayerObject.getWorkDefExpGain C:\Users\daniel.xie\Desktop\netburner\src\Player.js 562;" kind:method line:562 language:JavaScript
PlayerObject.PlayerObject.getWorkDexExpGain C:\Users\daniel.xie\Desktop\netburner\src\Player.js 568;" kind:method line:568 language:JavaScript
PlayerObject.PlayerObject.getWorkHackExpGain C:\Users\daniel.xie\Desktop\netburner\src\Player.js 550;" kind:method line:550 language:JavaScript
PlayerObject.PlayerObject.getWorkMoneyGain C:\Users\daniel.xie\Desktop\netburner\src\Player.js 544;" kind:method line:544 language:JavaScript
PlayerObject.PlayerObject.getWorkRepGain C:\Users\daniel.xie\Desktop\netburner\src\Player.js 586;" kind:method line:586 language:JavaScript
PlayerObject.PlayerObject.getWorkStrExpGain C:\Users\daniel.xie\Desktop\netburner\src\Player.js 556;" kind:method line:556 language:JavaScript
PlayerObject.PlayerObject.startCreateProgramWork C:\Users\daniel.xie\Desktop\netburner\src\Player.js 614;" kind:method line:614 language:JavaScript
PlayerObject.PlayerObject.startFactionFieldWork C:\Users\daniel.xie\Desktop\netburner\src\Player.js 465;" kind:method line:465 language:JavaScript
PlayerObject.PlayerObject.startFactionHackWork C:\Users\daniel.xie\Desktop\netburner\src\Player.js 450;" kind:method line:450 language:JavaScript
PlayerObject.PlayerObject.startFactionSecurityWork C:\Users\daniel.xie\Desktop\netburner\src\Player.js 480;" kind:method line:480 language:JavaScript
PlayerObject.PlayerObject.startFactionWork C:\Users\daniel.xie\Desktop\netburner\src\Player.js 420;" kind:method line:420 language:JavaScript
PlayerObject.PlayerObject.toJSON C:\Users\daniel.xie\Desktop\netburner\src\Player.js 672;" kind:method line:672 language:JavaScript
PlayerObject.PlayerObject.workForFaction C:\Users\daniel.xie\Desktop\netburner\src\Player.js 495;" kind:method line:495 language:JavaScript
PlayerObject.analyze C:\Users\daniel.xie\Desktop\netburner\src\Player.js 226;" kind:method line:226 language:JavaScript
PlayerObject.applyForAgentJob C:\Users\daniel.xie\Desktop\netburner\src\CompanyJobApplication.js 114;" kind:method line:114 language:JavaScript
PlayerObject.applyForBusinessJob C:\Users\daniel.xie\Desktop\netburner\src\CompanyJobApplication.js 105;" kind:method line:105 language:JavaScript
PlayerObject.applyForEmployeeJob C:\Users\daniel.xie\Desktop\netburner\src\CompanyJobApplication.js 123;" kind:method line:123 language:JavaScript
PlayerObject.applyForItJob C:\Users\daniel.xie\Desktop\netburner\src\CompanyJobApplication.js 80;" kind:method line:80 language:JavaScript
PlayerObject.applyForJob C:\Users\daniel.xie\Desktop\netburner\src\CompanyJobApplication.js 5;" kind:method line:5 language:JavaScript
PlayerObject.applyForNetworkEngineerJob C:\Users\daniel.xie\Desktop\netburner\src\CompanyJobApplication.js 96;" kind:method line:96 language:JavaScript
PlayerObject.applyForSecurityEngineerJob C:\Users\daniel.xie\Desktop\netburner\src\CompanyJobApplication.js 84;" kind:method line:84 language:JavaScript
PlayerObject.applyForSecurityJob C:\Users\daniel.xie\Desktop\netburner\src\CompanyJobApplication.js 109;" kind:method line:109 language:JavaScript
PlayerObject.applyForSoftwareJob C:\Users\daniel.xie\Desktop\netburner\src\CompanyJobApplication.js 76;" kind:method line:76 language:JavaScript
PlayerObject.applyForWaiterJob C:\Users\daniel.xie\Desktop\netburner\src\CompanyJobApplication.js 135;" kind:method line:135 language:JavaScript
PlayerObject.calculateExpGain C:\Users\daniel.xie\Desktop\netburner\src\Player.js 212;" kind:method line:212 language:JavaScript
PlayerObject.calculateHackingChance C:\Users\daniel.xie\Desktop\netburner\src\Player.js 176;" kind:method line:176 language:JavaScript
PlayerObject.calculateHackingTime C:\Users\daniel.xie\Desktop\netburner\src\Player.js 188;" kind:method line:188 language:JavaScript
PlayerObject.calculatePercentMoneyHacked C:\Users\daniel.xie\Desktop\netburner\src\Player.js 199;" kind:method line:199 language:JavaScript
PlayerObject.calculateSkill C:\Users\daniel.xie\Desktop\netburner\src\Player.js 157;" kind:method line:157 language:JavaScript
PlayerObject.checkForFactionInvitations C:\Users\daniel.xie\Desktop\netburner\src\Faction.js 121;" kind:method line:121 language:JavaScript
PlayerObject.finishWork C:\Users\daniel.xie\Desktop\netburner\src\Player.js 239;" kind:method line:239 language:JavaScript
PlayerObject.gainMoney C:\Users\daniel.xie\Desktop\netburner\src\Player.js 232;" kind:method line:232 language:JavaScript
PlayerObject.getCurrentServer C:\Users\daniel.xie\Desktop\netburner\src\Player.js 146;" kind:method line:146 language:JavaScript
PlayerObject.getHomeComputer C:\Users\daniel.xie\Desktop\netburner\src\Player.js 150;" kind:method line:150 language:JavaScript
PlayerObject.hack C:\Users\daniel.xie\Desktop\netburner\src\Player.js 219;" kind:method line:219 language:JavaScript
PlayerObject.init C:\Users\daniel.xie\Desktop\netburner\src\Player.js 135;" kind:method line:135 language:JavaScript
PlayerObject.isQualified C:\Users\daniel.xie\Desktop\netburner\src\CompanyJobApplication.js 148;" kind:method line:148 language:JavaScript
PlayerObject.startWork C:\Users\daniel.xie\Desktop\netburner\src\Player.js 298;" kind:method line:298 language:JavaScript
PlayerObject.updateSkillLevels C:\Users\daniel.xie\Desktop\netburner\src\Player.js 161;" kind:method line:161 language:JavaScript
PlayerObject.work C:\Users\daniel.xie\Desktop\netburner\src\Player.js 336;" kind:method line:336 language:JavaScript
PrintAllServers C:\Users\daniel.xie\Desktop\netburner\src\Server.js 692;" kind:function line:692 language:JavaScript
Reviver C:\Users\daniel.xie\Desktop\netburner\utils\JSONReviver.js 8;" kind:function line:8 language:JavaScript
Script C:\Users\daniel.xie\Desktop\netburner\src\Script.js 66;" kind:class line:66 language:JavaScript
Script.displayLog C:\Users\daniel.xie\Desktop\netburner\src\Script.js 139;" kind:method line:139 language:JavaScript
Script.fromJSON C:\Users\daniel.xie\Desktop\netburner\src\Script.js 150;" kind:function line:150 language:JavaScript
Script.log C:\Users\daniel.xie\Desktop\netburner\src\Script.js 129;" kind:method line:129 language:JavaScript
Script.saveScript C:\Users\daniel.xie\Desktop\netburner\src\Script.js 90;" kind:method line:90 language:JavaScript
Script.toJSON C:\Users\daniel.xie\Desktop\netburner\src\Script.js 145;" kind:method line:145 language:JavaScript
Script.updateNumInstructions C:\Users\daniel.xie\Desktop\netburner\src\Script.js 116;" kind:method line:116 language:JavaScript
Script.updateRamUsage C:\Users\daniel.xie\Desktop\netburner\src\Script.js 125;" kind:method line:125 language:JavaScript
ScriptEditorLastStatus C:\Users\daniel.xie\Desktop\netburner\src\Script.js 56;" kind:variable line:56 language:JavaScript
Server C:\Users\daniel.xie\Desktop\netburner\src\Server.js 4;" kind:class line:4 language:JavaScript
Server.fromJSON C:\Users\daniel.xie\Desktop\netburner\src\Server.js 108;" kind:function line:108 language:JavaScript
Server.getScript C:\Users\daniel.xie\Desktop\netburner\src\Server.js 94;" kind:method line:94 language:JavaScript
Server.getServerOnNetwork C:\Users\daniel.xie\Desktop\netburner\src\Server.js 84;" kind:method line:84 language:JavaScript
Server.init C:\Users\daniel.xie\Desktop\netburner\src\Server.js 57;" kind:method line:57 language:JavaScript
Server.setHackingParameters C:\Users\daniel.xie\Desktop\netburner\src\Server.js 69;" kind:method line:69 language:JavaScript
Server.setPortProperties C:\Users\daniel.xie\Desktop\netburner\src\Server.js 78;" kind:method line:78 language:JavaScript
Server.toJSON C:\Users\daniel.xie\Desktop\netburner\src\Server.js 104;" kind:method line:104 language:JavaScript
SizeOfAllServers C:\Users\daniel.xie\Desktop\netburner\src\Server.js 657;" kind:function line:657 language:JavaScript
SpecialServerIpsMap C:\Users\daniel.xie\Desktop\netburner\src\SpecialServerIps.js 2;" kind:function line:2 language:JavaScript
SpecialServerIpsMap C:\Users\daniel.xie\Desktop\netburner\src\SpecialServerIps.js 5;" kind:class line:5 language:JavaScript
SpecialServerIpsMap.addIp C:\Users\daniel.xie\Desktop\netburner\src\SpecialServerIps.js 5;" kind:method line:5 language:JavaScript
SpecialServerIpsMap.fromJSON C:\Users\daniel.xie\Desktop\netburner\src\SpecialServerIps.js 13;" kind:function line:13 language:JavaScript
SpecialServerIpsMap.toJSON C:\Users\daniel.xie\Desktop\netburner\src\SpecialServerIps.js 9;" kind:method line:9 language:JavaScript
SpecialServerIpsSave C:\Users\daniel.xie\Desktop\netburner\src\engine.js 80;" kind:variable line:80 language:JavaScript
String C:\Users\daniel.xie\Desktop\netburner\utils\StringHelperFunctions.js 23;" kind:class line:23 language:JavaScript
String.replaceAt C:\Users\daniel.xie\Desktop\netburner\utils\StringHelperFunctions.js 23;" kind:method line:23 language:JavaScript
Tokenizer C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Tokenizer.js 16;" kind:function line:16 language:JavaScript
WorkerScript C:\Users\daniel.xie\Desktop\netburner\src\Netscript\NetscriptWorker.js 9;" kind:class line:9 language:JavaScript
WorkerScript.getServer C:\Users\daniel.xie\Desktop\netburner\src\Netscript\NetscriptWorker.js 21;" kind:method line:21 language:JavaScript
addWorkerScript C:\Users\daniel.xie\Desktop\netburner\src\Netscript\NetscriptWorker.js 134;" kind:function line:134 language:JavaScript
allFiles C:\Users\daniel.xie\Desktop\netburner\src\Terminal.js 317;" kind:variable line:317 language:JavaScript
applyAugmentation C:\Users\daniel.xie\Desktop\netburner\src\Augmentations.js 488;" kind:function line:488 language:JavaScript
apply_op C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Evaluator.js 493;" kind:function line:493 language:JavaScript
apply_op.div C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Evaluator.js 499;" kind:function line:499 language:JavaScript
apply_op.num C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Evaluator.js 494;" kind:function line:494 language:JavaScript
checkValidFilename C:\Users\daniel.xie\Desktop\netburner\src\Script.js 47;" kind:function line:47 language:JavaScript
convertTimeMsToTimeElapsedString C:\Users\daniel.xie\Desktop\netburner\utils\StringHelperFunctions.js 31;" kind:function line:31 language:JavaScript
createRandomByte C:\Users\daniel.xie\Desktop\netburner\utils\IPAddress.js 30;" kind:function line:30 language:JavaScript
createRandomIp C:\Users\daniel.xie\Desktop\netburner\utils\IPAddress.js 5;" kind:function line:5 language:JavaScript
croak C:\Users\daniel.xie\Desktop\netburner\src\Netscript\InputStream.js 22;" kind:function line:22 language:JavaScript
dialogBoxClose C:\Users\daniel.xie\Desktop\netburner\utils\DialogBox.js 18;" kind:function line:18 language:JavaScript
dialogBoxCreate C:\Users\daniel.xie\Desktop\netburner\utils\DialogBox.js 42;" kind:function line:42 language:JavaScript
dialogBoxInit C:\Users\daniel.xie\Desktop\netburner\utils\DialogBox.js 2;" kind:function line:2 language:JavaScript
dialogBoxOpen C:\Users\daniel.xie\Desktop\netburner\utils\DialogBox.js 26;" kind:function line:26 language:JavaScript
dialogBoxSetText C:\Users\daniel.xie\Desktop\netburner\utils\DialogBox.js 31;" kind:function line:31 language:JavaScript
diff C:\Users\daniel.xie\Desktop\netburner\src\engine.js 481;" kind:variable line:481 language:JavaScript
displayFactionAugmentations C:\Users\daniel.xie\Desktop\netburner\src\Faction.js 613;" kind:function line:613 language:JavaScript
displayFactionContent C:\Users\daniel.xie\Desktop\netburner\src\Faction.js 418;" kind:function line:418 language:JavaScript
eof C:\Users\daniel.xie\Desktop\netburner\src\Netscript\InputStream.js 19;" kind:function line:19 language:JavaScript
eof C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Tokenizer.js 165;" kind:function line:165 language:JavaScript
evaluate C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Evaluator.js 7;" kind:function line:7 language:JavaScript
evaluateFor C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Evaluator.js 328;" kind:function line:328 language:JavaScript
evaluateProg C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Evaluator.js 455;" kind:function line:455 language:JavaScript
evaluateWhile C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Evaluator.js 400;" kind:function line:400 language:JavaScript
factionInvitationBoxClose C:\Users\daniel.xie\Desktop\netburner\utils\FactionInvitationBox.js 17;" kind:function line:17 language:JavaScript
factionInvitationBoxCreate C:\Users\daniel.xie\Desktop\netburner\utils\FactionInvitationBox.js 38;" kind:function line:38 language:JavaScript
factionInvitationBoxInit C:\Users\daniel.xie\Desktop\netburner\utils\FactionInvitationBox.js 2;" kind:function line:2 language:JavaScript
factionInvitationBoxOpen C:\Users\daniel.xie\Desktop\netburner\utils\FactionInvitationBox.js 22;" kind:function line:22 language:JavaScript
factionInvitationSetMessage C:\Users\daniel.xie\Desktop\netburner\utils\FactionInvitationBox.js 32;" kind:function line:32 language:JavaScript
factionInvitationSetText C:\Users\daniel.xie\Desktop\netburner\utils\FactionInvitationBox.js 27;" kind:function line:27 language:JavaScript
filename C:\Users\daniel.xie\Desktop\netburner\src\Terminal.js 339;" kind:variable line:339 language:JavaScript
getIndicesOf C:\Users\daniel.xie\Desktop\netburner\utils\StringHelperFunctions.js 5;" kind:function line:5 language:JavaScript
getNextCompanyPosition C:\Users\daniel.xie\Desktop\netburner\src\Company.js 328;" kind:function line:328 language:JavaScript
hackProgressBarPost C:\Users\daniel.xie\Desktop\netburner\src\Terminal.js 10;" kind:function line:10 language:JavaScript
hackProgressPost C:\Users\daniel.xie\Desktop\netburner\src\Terminal.js 15;" kind:function line:15 language:JavaScript
hostname C:\Users\daniel.xie\Desktop\netburner\src\engine.js 410;" kind:variable line:410 language:JavaScript
initAugmentations C:\Users\daniel.xie\Desktop\netburner\src\Augmentations.js 54;" kind:function line:54 language:JavaScript
initCompanies C:\Users\daniel.xie\Desktop\netburner\src\Company.js 425;" kind:function line:425 language:JavaScript
initFactions C:\Users\daniel.xie\Desktop\netburner\src\Faction.js 47;" kind:function line:47 language:JavaScript
initForeignServers C:\Users\daniel.xie\Desktop\netburner\src\Server.js 117;" kind:function line:117 language:JavaScript
initLocationButtons C:\Users\daniel.xie\Desktop\netburner\src\Location.js 745;" kind:function line:745 language:JavaScript
inviteToFaction C:\Users\daniel.xie\Desktop\netburner\src\Faction.js 363;" kind:function line:363 language:JavaScript
ip C:\Users\daniel.xie\Desktop\netburner\src\Terminal.js 225;" kind:variable line:225 language:JavaScript
ipExists C:\Users\daniel.xie\Desktop\netburner\utils\IPAddress.js 19;" kind:function line:19 language:JavaScript
isValidIPAddress C:\Users\daniel.xie\Desktop\netburner\utils\IPAddress.js 34;" kind:function line:34 language:JavaScript
is_digit C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Tokenizer.js 31;" kind:function line:31 language:JavaScript
is_id C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Tokenizer.js 40;" kind:function line:40 language:JavaScript
is_id_start C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Tokenizer.js 36;" kind:function line:36 language:JavaScript
is_keyword C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Tokenizer.js 27;" kind:function line:27 language:JavaScript
is_op_char C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Tokenizer.js 44;" kind:function line:44 language:JavaScript
is_punc C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Tokenizer.js 48;" kind:function line:48 language:JavaScript
is_whitespace C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Tokenizer.js 52;" kind:function line:52 language:JavaScript
item C:\Users\daniel.xie\Desktop\netburner\src\engine.js 390;" kind:variable line:390 language:JavaScript
itemText C:\Users\daniel.xie\Desktop\netburner\src\engine.js 407;" kind:variable line:407 language:JavaScript
joinFaction C:\Users\daniel.xie\Desktop\netburner\src\Faction.js 370;" kind:function line:370 language:JavaScript
killWorkerScript C:\Users\daniel.xie\Desktop\netburner\src\Netscript\NetscriptWorker.js 124;" kind:function line:124 language:JavaScript
li C:\Users\daniel.xie\Desktop\netburner\src\engine.js 372;" kind:variable line:372 language:JavaScript
loadAllRunningScripts C:\Users\daniel.xie\Desktop\netburner\src\Script.js 159;" kind:function line:159 language:JavaScript
mainMenu C:\Users\daniel.xie\Desktop\netburner\src\engine.js 251;" kind:variable line:251 language:JavaScript
maybe_call C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Parser.js 203;" kind:function line:203 language:JavaScript
next C:\Users\daniel.xie\Desktop\netburner\src\Netscript\InputStream.js 11;" kind:function line:11 language:JavaScript
next C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Tokenizer.js 157;" kind:function line:157 language:JavaScript
offlineEps C:\Users\daniel.xie\Desktop\netburner\src\engine.js 422;" kind:variable line:422 language:JavaScript
offlineMps C:\Users\daniel.xie\Desktop\netburner\src\engine.js 420;" kind:variable line:420 language:JavaScript
offlineMpsText C:\Users\daniel.xie\Desktop\netburner\src\engine.js 421;" kind:variable line:421 language:JavaScript
offset C:\Users\daniel.xie\Desktop\netburner\src\engine.js 482;" kind:variable line:482 language:JavaScript
onlineEps C:\Users\daniel.xie\Desktop\netburner\src\engine.js 416;" kind:variable line:416 language:JavaScript
onlineMps C:\Users\daniel.xie\Desktop\netburner\src\engine.js 414;" kind:variable line:414 language:JavaScript
onlineMpsText C:\Users\daniel.xie\Desktop\netburner\src\engine.js 415;" kind:variable line:415 language:JavaScript
parse_atom C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Parser.js 208;" kind:function line:208 language:JavaScript
parse_bool C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Parser.js 196;" kind:function line:196 language:JavaScript
parse_expression C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Parser.js 248;" kind:function line:248 language:JavaScript
parse_for C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Parser.js 154;" kind:function line:154 language:JavaScript
parse_if C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Parser.js 111;" kind:function line:111 language:JavaScript
parse_if.ret.cond C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Parser.js 122;" kind:property line:122 language:JavaScript
parse_if.ret.type C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Parser.js 121;" kind:property line:121 language:JavaScript
parse_prog C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Parser.js 240;" kind:function line:240 language:JavaScript
parse_toplevel C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Parser.js 230;" kind:function line:230 language:JavaScript
parse_varname C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Parser.js 100;" kind:function line:100 language:JavaScript
parse_while C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Parser.js 182;" kind:function line:182 language:JavaScript
peek C:\Users\daniel.xie\Desktop\netburner\src\Netscript\InputStream.js 16;" kind:function line:16 language:JavaScript
peek C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Tokenizer.js 151;" kind:function line:151 language:JavaScript
percent C:\Users\daniel.xie\Desktop\netburner\src\engine.js 595;" kind:variable line:595 language:JavaScript
post C:\Users\daniel.xie\Desktop\netburner\src\Terminal.js 4;" kind:function line:4 language:JavaScript
postNetburnerText C:\Users\daniel.xie\Desktop\netburner\src\Terminal.js 25;" kind:function line:25 language:JavaScript
postScriptEditorStatus C:\Users\daniel.xie\Desktop\netburner\src\Script.js 57;" kind:function line:57 language:JavaScript
prestigeAugmentation C:\Users\daniel.xie\Desktop\netburner\src\Prestige.js 4;" kind:function line:4 language:JavaScript
purchaseAugmentationBoxClose C:\Users\daniel.xie\Desktop\netburner\utils\PurchaseAugmentationBox.js 17;" kind:function line:17 language:JavaScript
purchaseAugmentationBoxCreate C:\Users\daniel.xie\Desktop\netburner\utils\PurchaseAugmentationBox.js 33;" kind:function line:33 language:JavaScript
purchaseAugmentationBoxInit C:\Users\daniel.xie\Desktop\netburner\utils\PurchaseAugmentationBox.js 2;" kind:function line:2 language:JavaScript
purchaseAugmentationBoxOpen C:\Users\daniel.xie\Desktop\netburner\utils\PurchaseAugmentationBox.js 22;" kind:function line:22 language:JavaScript
purchaseAugmentationBoxSetText C:\Users\daniel.xie\Desktop\netburner\utils\PurchaseAugmentationBox.js 27;" kind:function line:27 language:JavaScript
purchaseServer C:\Users\daniel.xie\Desktop\netburner\src\PurchaseServers.js 2;" kind:function line:2 language:JavaScript
purchaseServerBoxClose C:\Users\daniel.xie\Desktop\netburner\utils\PurchaseServerBox.js 17;" kind:function line:17 language:JavaScript
purchaseServerBoxCreate C:\Users\daniel.xie\Desktop\netburner\utils\PurchaseServerBox.js 33;" kind:function line:33 language:JavaScript
purchaseServerBoxInit C:\Users\daniel.xie\Desktop\netburner\utils\PurchaseServerBox.js 2;" kind:function line:2 language:JavaScript
purchaseServerBoxOpen C:\Users\daniel.xie\Desktop\netburner\utils\PurchaseServerBox.js 22;" kind:function line:22 language:JavaScript
purchaseServerBoxSetText C:\Users\daniel.xie\Desktop\netburner\utils\PurchaseServerBox.js 27;" kind:function line:27 language:JavaScript
read_escaped C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Tokenizer.js 88;" kind:function line:88 language:JavaScript
read_ident C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Tokenizer.js 79;" kind:function line:79 language:JavaScript
read_next C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Tokenizer.js 122;" kind:function line:122 language:JavaScript
read_number C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Tokenizer.js 63;" kind:function line:63 language:JavaScript
read_string C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Tokenizer.js 107;" kind:function line:107 language:JavaScript
read_while C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Tokenizer.js 56;" kind:function line:56 language:JavaScript
runScriptsLoop C:\Users\daniel.xie\Desktop\netburner\src\Netscript\NetscriptWorker.js 29;" kind:function line:29 language:JavaScript
scriptCalculateExpGain C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Evaluator.js 539;" kind:function line:539 language:JavaScript
scriptCalculateHackingChance C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Evaluator.js 523;" kind:function line:523 language:JavaScript
scriptCalculateHackingTime C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Evaluator.js 531;" kind:function line:531 language:JavaScript
scriptCalculateOfflineProduction C:\Users\daniel.xie\Desktop\netburner\src\Script.js 183;" kind:function line:183 language:JavaScript
scriptCalculatePercentMoneyHacked C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Evaluator.js 544;" kind:function line:544 language:JavaScript
scriptName C:\Users\daniel.xie\Desktop\netburner\src\Terminal.js 301;" kind:variable line:301 language:JavaScript
scriptname C:\Users\daniel.xie\Desktop\netburner\src\Terminal.js 347;" kind:variable line:347 language:JavaScript
serverIpHostname C:\Users\daniel.xie\Desktop\netburner\src\engine.js 411;" kind:variable line:411 language:JavaScript
sizeOfObject C:\Users\daniel.xie\Desktop\netburner\utils\ObjectHelperFunctions.js 4;" kind:function line:4 language:JavaScript
skip_comment C:\Users\daniel.xie\Desktop\netburner\src\Netscript\Tokenizer.js 116;" kind:function line:116 language:JavaScript
updateOnlineScriptTimes C:\Users\daniel.xie\Desktop\netburner\src\Netscript\NetscriptWorker.js 157;" kind:function line:157 language:JavaScript
updateTerminalScroll C:\Users\daniel.xie\Desktop\netburner\src\Terminal.js 20;" kind:function line:20 language:JavaScript
window.onload C:\Users\daniel.xie\Desktop\netburner\src\engine.js 794;" kind:function line:794 language:JavaScript
workerScripts C:\Users\daniel.xie\Desktop\netburner\src\Netscript\NetscriptWorker.js 26;" kind:variable line:26 language:JavaScript

BIN
tags.idx Normal file

Binary file not shown.

42
utils/DialogBox.js Normal file

@ -0,0 +1,42 @@
/* Pop up Dialog Box */
function dialogBoxInit() {
var closeButton = document.getElementById("dialog-box-close-button");
var dialogBox = document.getElementById("dialog-box-container");
//Close Dialog box
closeButton.addEventListener("click", function() {
dialogBoxClose();
return false;
});
};
document.addEventListener("DOMContentLoaded", dialogBoxInit, false);
dialogBoxClose = function() {
if (Engine.Debug) {
console.log("Dialog Box Close called");
}
var dialogBox = document.getElementById("dialog-box-container");
dialogBox.style.display = "none";
}
dialogBoxOpen = function() {
var dialogBox = document.getElementById("dialog-box-container");
dialogBox.style.display = "block";
}
dialogBoxSetText = function(txt1, txt2="", txt3="", txt4="") {
var dialogBoxText1 = document.getElementById("dialog-box-text-1");
var dialogBoxText2 = document.getElementById("dialog-box-text-2");
var dialogBoxText3 = document.getElementById("dialog-box-text-3");
var dialogBoxText4 = document.getElementById("dialog-box-text-4");
dialogBoxText1.innerHTML = txt1;
dialogBoxText2.innerHTML = txt2;
dialogBoxText3.innerHTML = txt3;
dialogBoxText4.innerHTML = txt4;
}
dialogBoxCreate = function(txt1, txt2="", txt3="", txt4="") {
dialogBoxSetText(txt1, txt2, txt3, txt4);
dialogBoxOpen();
}

@ -0,0 +1,50 @@
/* Faction Invitation Pop-up box */
function factionInvitationBoxInit() {
var cancelButton = document.getElementById("faction-invitation-box-no");
//Close Dialog box
cancelButton.addEventListener("click", function() {
factionInvitationBoxClose();
return false;
});
};
document.addEventListener("DOMContentLoaded", factionInvitationBoxInit, false);
factionInvitationBoxClose = function() {
var factionInvitationBox = document.getElementById("faction-invitation-box-container");
factionInvitationBox.style.display = "none";
}
factionInvitationBoxOpen = function() {
var factionInvitationBox = document.getElementById("faction-invitation-box-container");
factionInvitationBox.style.display = "block";
}
factionInvitationSetText = function(txt) {
var textBox = document.getElementById("faction-invitation-box-text");
textBox.innerHTML = txt;
}
factionInvitationSetMessage = function(msg) {
var msgBox = document.getElementById("faction-invitation-box-message");
msgBox.innerHTML = msg;
}
//ram argument is in GB
factionInvitationBoxCreate = function(faction) {
factionInvitationSetText("You have received a faction invitation from " + faction.name);
//TODO Faction invitation message
var yesButton = document.getElementById("faction-invitation-box-yes");
var newYesButton = yesButton.cloneNode(true);
yesButton.parentNode.replaceChild(newYesButton, yesButton);
newYesButton.addEventListener("click", function() {
joinFaction(faction);
factionInvitationBoxClose();
return false;
});
factionInvitationBoxOpen();
}

21
utils/HelperFunctions.js Normal file

@ -0,0 +1,21 @@
//General helper functions
//Returns the size (number of keys) of an object
function sizeOfObject(obj) {
var size = 0, key;
for (key in obj) {
if (obj.hasOwnProperty(key)) size++;
}
return size;
}
//Adds a random offset to a number within a certain percentage
//e.g. addOffset(100, 5) will return anything from 95 to 105.
//The percentage argument must be between 0 and 100;
function addOffset(n, percentage) {
if (percentage < 0 || percentage > 100) {return ;}
var offset = n * (percentage / 100);
return n * (Math.random() * (2 * offset) - offset);
}

41
utils/IPAddress.js Normal file

@ -0,0 +1,41 @@
/* Functions to deal with manipulating IP addresses*/
//Generate a random IP address
//Will not return an IP address that already exists in the AllServers array
createRandomIp = function() {
var ip = createRandomByte() +'.' +
createRandomByte() +'.' +
createRandomByte() +'.' +
createRandomByte();
//If the Ip already exists, recurse to create a new one
if (ipExists(ip)) {
return createRandomIp();
}
return ip;
}
//Returns true if the IP already exists in one of the game's servers
ipExists = function(ip) {
for (var property in AllServers) {
if (AllServers.hasOwnProperty(property)) {
if (property == ip) {
return true;
}
}
}
return false;
}
createRandomByte = function() {
return Math.round(Math.random()*256);
}
isValidIPAddress = function(ipaddress) {
if (/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(ipaddress))
{
return true;
}
console.log("Invalid IP address");
return false ;
}

68
utils/JSONReviver.js Normal file

@ -0,0 +1,68 @@
/* Generic Reviver, toJSON, and fromJSON functions used for saving and loading objects */
// A generic "smart reviver" function.
// Looks for object values with a `ctor` property and
// a `data` property. If it finds them, and finds a matching
// constructor that has a `fromJSON` property on it, it hands
// off to that `fromJSON` fuunction, passing in the value.
function Reviver(key, value) {
var ctor;
if (value == null) {
console.log("Reviver WRONGLY called with key: " + key + ", and value: " + value);
}
if (typeof value === "object" &&
typeof value.ctor === "string" &&
typeof value.data !== "undefined") {
ctor = Reviver.constructors[value.ctor] || window[value.ctor];
if (typeof ctor === "function" &&
typeof ctor.fromJSON === "function") {
return ctor.fromJSON(value);
}
}
return value;
}
Reviver.constructors = {}; // A list of constructors the smart reviver should know about
// A generic "toJSON" function that creates the data expected
// by Reviver.
// `ctorName` The name of the constructor to use to revive it
// `obj` The object being serialized
// `keys` (Optional) Array of the properties to serialize,
// if not given then all of the objects "own" properties
// that don't have function values will be serialized.
// (Note: If you list a property in `keys`, it will be serialized
// regardless of whether it's an "own" property.)
// Returns: The structure (which will then be turned into a string
// as part of the JSON.stringify algorithm)
function Generic_toJSON(ctorName, obj, keys) {
var data, index, key;
if (!keys) {
keys = Object.keys(obj); // Only "own" properties are included
}
data = {};
for (index = 0; index < keys.length; ++index) {
key = keys[index];
data[key] = obj[key];
}
return {ctor: ctorName, data: data};
}
// A generic "fromJSON" function for use with Reviver: Just calls the
// constructor function with no arguments, then applies all of the
// key/value pairs from the raw data to the instance. Only useful for
// constructors that can be reasonably called without arguments!
// `ctor` The constructor to call
// `data` The data to apply
// Returns: The object
function Generic_fromJSON(ctor, data) {
var obj, name;
obj = new ctor();
for (name in data) {
obj[name] = data[name];
}
return obj;
}

@ -0,0 +1,154 @@
/* Pop up Purchase Augmentation Box */
function purchaseAugmentationBoxInit() {
var cancelButton = document.getElementById("purchase-augmentation-box-cancel");
//Close Dialog box
cancelButton.addEventListener("click", function() {
purchaseAugmentationBoxClose();
return false;
});
};
document.addEventListener("DOMContentLoaded", purchaseAugmentationBoxInit, false);
purchaseAugmentationBoxClose = function() {
var purchaseAugmentationBox = document.getElementById("purchase-augmentation-box-container");
purchaseAugmentationBox.style.display = "none";
}
purchaseAugmentationBoxOpen = function() {
var purchaseAugmentationBox = document.getElementById("purchase-augmentation-box-container");
purchaseAugmentationBox.style.display = "block";
}
purchaseAugmentationBoxSetText = function(txt) {
var purchaseAugmentationBox = document.getElementById("purchase-augmentation-box-text");
purchaseAugmentationBox.innerHTML = txt;
}
//ram argument is in GB
purchaseAugmentationBoxCreate = function(aug, fac) {
purchaseAugmentationBoxSetText("Would you like to purchase the " + aug.name + " Augmentation for $" +
(aug.baseCost * fac.augmentationPriceMult) + "?");
//Clear old event listeners from Confirm button
var confirmButton = document.getElementById("purchase-augmentation-box-confirm");
var newConfirmButton = confirmButton.cloneNode(true);
confirmButton.parentNode.replaceChild(newConfirmButton, confirmButton);
newConfirmButton.addEventListener("click", function() {
//TODO Requirements for specific augmentations (e.g Embedded Netburner Module b4 its upgrades)
if (aug.name == "Augmented Targeting II") {
var targeting1 = Augmentations["Augmented Targeting I"];
if (targeting1 == null) {
console.log("ERROR: Could not find Augmented Targeting I");
return;
}
if (targeting1.owned == false) {
dialogBoxCreate("You must first install Augmented Targeting I before you can upgrade it to Augmented Targeting II");
}
} else if (aug.name == "Augmented Targeting III") {
var targeting2 = Augmentations["Augmented Targeting II"];
if (targeting2 == null) {
console.log("ERROR: Could not find Augmented Targeting II");
return;
}
if (targeting2.owned == false) {
dialogBoxCreate("You must first install Augmented Targeting II before you can upgrade it to Augmented Targeting III");
}
} else if (aug.name == "Combat Rib II") {
var combatRib1 = Augmentations["Combat Rib I"];
if (combatRib1 == null) {
console.log("ERROR: Could not find Combat Rib I");
return;
}
if (combatRib1.owned == false) {
dialogBoxCreate("You must first install Combat Rib I before you can upgrade it to Combat Rib II");
}
} else if (aug.name == "Combat Rib III") {
var combatRib2 = Augmentations["Combat Rib II"];
if (combatRib2 == null) {
console.log("ERROR: Could not find Combat Rib II");
return;
}
if (combatRib2.owned == false) {
dialogBoxCreate("You must first install Combat Rib II before you can upgrade it to Combat Rib III");
}
} else if (aug.name == "Graphene Bionic Spine Upgrade") {
var bionicSpine = Augmentations["Bionic Spine"];
if (bionicSpine == null) {
console.log("ERROR: Could not find Bionic Spine");
return;
}
if (bionicSpine.owned == false) {
dialogBoxCreate("You must first install a Bionic Spine before you can upgrade it to a Graphene Bionic Spine");
}
} else if (aug.name == "Graphene Bionic Legs Upgrade") {
var bionicLegs = Augmentations["Bionic Legs"];
if (bionicLegs == null) {
console.log("ERROR: Could not find Bionic Legs");
return;
}
if (bionicLegs.owned == false ) {
dialogBoxCreate("You must first install Bionic Legs before you can upgrade it to Graphene Bionic Legs");
}
} else if (aug.name == "Embedded Netburner Module Core V2 Upgrade") {
var coreImplant = Augmentations["Embedded Netburner Module Core Implant"];
if (coreImplant == null) {
console.log("ERROR: Could not find ENM Core Implant");
return;
}
if (coreImplant.owned == false) {
dialogBoxCreate("You must first install Embedded Netburner Module Core Implant before you can upgrade it to V2");
}
} else if (aug.name == "Embedded Netburner Module Core V3 Upgrade") {
var v2Upgrade = Augmentations["Embedded Netburner Module Core V2 Upgrade"];
if (v2Upgrade == null) {
console.log("ERROR: Could not find ENM Core V2 upgrade");
return;
}
if (v2Upgrade.owned == false) {
dialogBoxCreate("You must first install Embedded Netburner Module Core V2 Upgrade before you can upgrade it to V3");
}
} else if (aug.name == "Embedded Netburner Module Core Implant" ||
aug.name == "Embedded Netburner Module Analyze Engine" ||
aug.name == "Embedded Netburner Module Direct Memory Access Upgrade") {
var enm = Augmentations["Embedded Netburner Module"];
if (enm == null) {
console.log("ERROR: Could not find ENM");
return;
}
if (enm.owned == false) {
dialogBoxCreate("You must first install the Embedded Netburner Module before installing any upgrades to it");
}
} else if (aug.name == "PC Direct-Neural Interface Optimization Submodule" ||
aug.name == "PC Direct-Neural Interface NeuroNet Injector") {
var pcdni = Augmentations["PC Direct-Neural Interface"];
if (pcdni == null) {
console.log("ERROR: Could not find PC Direct Neural Interface");
return;
}
if (pcdni.owned == false) {
dialogBoxCreate("You must first install the PD Direct-Neural Interface before installing this upgrade");
}
} 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>" +
"You wake up in your home...you feel different...");
prestigeAugmentation();
} else {
dialogBoxCreate("You don't have enough money to purchase this Augmentation!");
}
purchaseAugmentationBoxClose();
return false;
});
purchaseAugmentationBoxOpen();
}

@ -0,0 +1,44 @@
/* Pop up Purchase Server Box */
function purchaseServerBoxInit() {
var cancelButton = document.getElementById("purchase-server-box-cancel");
//Close Dialog box
cancelButton.addEventListener("click", function() {
purchaseServerBoxClose();
return false;
});
};
document.addEventListener("DOMContentLoaded", purchaseServerBoxInit, false);
purchaseServerBoxClose = function() {
var purchaseServerBox = document.getElementById("purchase-server-box-container");
purchaseServerBox.style.display = "none";
}
purchaseServerBoxOpen = function() {
var purchaseServerBox = document.getElementById("purchase-server-box-container");
purchaseServerBox.style.display = "block";
}
purchaseServerBoxSetText = function(txt) {
var purchaseServerBox = document.getElementById("purchase-server-box-text");
purchaseServerBox.innerHTML = txt;
}
//ram argument is in GB
purchaseServerBoxCreate = function(ram, cost) {
purchaseServerBoxSetText("Would you like to purchase a new server with " + ram + "GB of RAM for $" + cost + "?" );
//Clear old event listeners from Confirm button
var confirmButton = document.getElementById("purchase-server-box-confirm");
var newConfirmButton = confirmButton.cloneNode(true);
confirmButton.parentNode.replaceChild(newConfirmButton, confirmButton);
newConfirmButton.addEventListener("click", function() {
purchaseServerBoxClose();
purchaseServer(ram, cost);
return false;
});
purchaseServerBoxOpen();
}

@ -0,0 +1,44 @@
//Netburner String helper functions
//Searches for every occurence of searchStr within str and returns an array of the indices of
//all these occurences
function getIndicesOf(searchStr, str, caseSensitive) {
var searchStrLen = searchStr.length;
if (searchStrLen == 0) {
return [];
}
var startIndex = 0, index, indices = [];
if (!caseSensitive) {
str = str.toLowerCase();
searchStr = searchStr.toLowerCase();
}
while ((index = str.indexOf(searchStr, startIndex)) > -1) {
indices.push(index);
startIndex = index + searchStrLen;
}
return indices;
}
//Replaces the character at an index with a new character
String.prototype.replaceAt=function(index, character) {
return this.substr(0, index) + character + this.substr(index+character.length);
}
//Converts a date representing time in milliseconds to a string with the format
// H hours M minutes and S seconds
// e.g. 10000 -> "0 hours 0 minutes and 10 seconds"
// 120000 -> "0 0 hours 2 minutes and 0 seconds"
function convertTimeMsToTimeElapsedString(time) {
//Convert ms to seconds, since we only have second-level precision
time = Math.floor(time / 1000);
var hours = Math.floor(time / 3600);
time %= 3600;
var minutes = Math.floor(time / 60);
time %= 60;
var seconds = time;
return hours + " hours " + minutes + " minutes " + seconds + " seconds";
}

43
utils/TravelBox.js Normal file

@ -0,0 +1,43 @@
/* Pop up Purchase Server Box */
function travelBoxInit() {
var cancelButton = document.getElementById("travel-box-cancel");
//Close Dialog box
cancelButton.addEventListener("click", function() {
travelBoxClose();
return false;
});
};
document.addEventListener("DOMContentLoaded", travelBoxInit, false);
travelBoxClose = function() {
var travelBox = document.getElementById("travel-box-container");
travelBox.style.display = "none";
}
travelBoxOpen = function() {
var travelBox = document.getElementById("travel-box-container");
travelBox.style.display = "block";
}
travelBoxSetText = function(txt) {
var travelBoxText = document.getElementById("travel-box-text");
travelBoxText.innerHTML = txt;
}
travelBoxCreate = function(destCityName, cost) {
travelBoxSetText("Would you like to travel to " + destCityName + "? The trip will cost $" + cost + ".");
//Clear old event listeners from Confirm button
var confirmButton = document.getElementById("travel-box-confirm");
var newConfirmButton = confirmButton.cloneNode(true);
confirmButton.parentNode.replaceChild(newConfirmButton, confirmButton);
newConfirmButton.addEventListener("click", function() {
travelBoxClose();
travelToCity(destCityName, cost);
return false;
});
travelBoxOpen();
}