Merge branch 'master' into patch-1

This commit is contained in:
JJ 2018-02-26 19:10:30 -05:00
commit f684c42e8c
55 changed files with 5781 additions and 1839 deletions

@ -1,7 +1,7 @@
#cmpy-mgmt-container p,
#cmpy-mgmt-container a,
#cmpy-mgmt-container div {
font-size: 14px;
font-size: 13px;
}
@ -123,9 +123,10 @@
.cmpy-mgmt-upgrade-div {
display:inline-block;
border:1px solid white;
margin:4px;
padding:12px;
margin:2px;
padding:6px;
border-radius:25px;
font-size:"12px";
color:var(--my-font-color);
}

@ -222,8 +222,26 @@ a:link, a:visited {
z-index: 99;
}
/* Similar to a normal tooltip except its positioned on the left of the elemnt
rather than the right to avoid exceeding the elements normal width */
.tooltip .tooltiptextleft {
visibility: hidden;
width: 300px;
background-color: var(--my-background-color);
border: 2px solid var(--my-highlight-color);;
color: white;
text-align: center;
padding: 4px;
left: 40%;
bottom:-10%;
position: absolute;
z-index: 99;
}
.tooltip:hover .tooltiptext,
.tooltip:hover .tooltiptexthigh {
.tooltip:hover .tooltiptexthigh,
.tooltip:hover .tooltiptextleft {
visibility: visible;
}

2563
dist/bundle.js vendored

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
doc/build/doctrees/netscriptmisc.doctree vendored Normal file

Binary file not shown.

@ -23,3 +23,4 @@ to reach out to the developer!
Hacknet Node API <netscripthacknetnodeapi>
Trade Information eXchange (TIX) API <netscriptixapi>
Singularity Functions <netscriptsingularityfunctions>
Miscellaneous <netscriptmisc>

@ -12,7 +12,7 @@ hack
.. js:function:: hack(hostname/ip)
:param string hostname/ip: IP or hostname of the target server to hack
:returns: True if the hack is successful, false otherwise
:returns: The amount of money stolen if the hack is successful, and zero otherwise
Function that is used to try and hack servers to steal money and gain hacking experience. The runtime for this command depends
on your hacking level and the target server's security level. In order to hack a server you must first gain root access
@ -72,10 +72,9 @@ weaken
sleep
^^^^^
.. js:function:: sleep(n[, log=true])
.. js:function:: sleep(n)
:param number n: Number of milliseconds to sleep
:param boolean log: Optional boolean specifying whether or not to log the action
Suspends the script for n milliseconds.
@ -97,6 +96,39 @@ tprint
Prints a value or a variable to the Terminal
clearLog
^^^^^^^^
.. js:function:: clearLog()
Clears the script's logs
disableLog
^^^^^^^^^^
.. js:function:: disableLog(fn)
:param string fn: Name of function for which to disable logging
Disables logging for the given function. Logging can be disabled for
all functions by passing 'ALL' as the argument.
Note that this does not completely remove all logging functionality.
This only stops a function from logging
when the function is successful. If the function fails, it will still log the reason for failure.
Notable functions that cannot have their logs disabled: run, exec, exit
enableLog
^^^^^^^^^
.. js:function:: enableLog(fn)
:param string fn: Name of function for which to enable logging
Re-enables logging for the given function. If 'ALL' is passed into this function
as an argument, then it will revert the effects of disableLog('ALL')
scan
^^^^
@ -304,7 +336,8 @@ killall
:param string hostname/ip: IP or hostname of the server on which to kill all scripts
Kills all running scripts on the specified server. This function will always return true.
Kills all running scripts on the specified server. This function returns true if any scripts were killed, and
false otherwise. In other words, it will return true if there are any scripts running on the target server.
exit
@ -346,9 +379,10 @@ scp
ls
^^
.. js:function:: ls(hostname/ip)
.. js:function:: ls(hostname/ip, [grep])
:param string hostname/ip: Hostname or IP of the target server
:param string grep: a substring to search for in the filename
Returns an array with the filenames of all files on the specified server (as strings). The returned array
is sorted in alphabetic order
@ -639,15 +673,6 @@ getPurchasedServers
Returns an array with either the hostnames or IPs of all of the servers you have purchased.
round
^^^^^
.. js:function:: round(n)
:param number n: Number to round
Returns the argument *n* rounded to the nearest integer. If the argument passed in is not a number, then the function will return 0.
write
^^^^^
@ -684,6 +709,18 @@ read
If the argument *port/fn* is a string, then it specifies the name of a text file (.txt) and this function will return the data in the specified text file. If
the text file does not exist, an empty string will be returned.
peek
^^^^
.. js:function:: peek(port)
:param number port: Port to peek. Must be an integer between 1 and 10
This function is used to peek at the data from a port. It returns the first element in the specified port
without removing that element. If the port is empty, the string "NULL PORT DATA" will be returned.
Read about how `Netscript Ports work here <http://bitburner.wikia.com/wiki/Netscript_Ports>`_.
clear
^^^^^
@ -697,6 +734,16 @@ clear
If the *port/fn* argument is a string, then it specifies the name of a text file (.txt) and will delete all data from that text file.
rm
^^
.. js:function:: rm(fn)
:param string fn: Filename of file to remove. Must include the extension
:returns: True if it successfully deletes the file, and false otherwise
Removes the specified file from the current server. This function works for every file type except message (.msg) files.
scriptRunning
^^^^^^^^^^^^^

@ -2,9 +2,6 @@ Netscript Loops and Conditionals
================================
Loops and Conditionals
----------------------
Netscript loops and conditionals are the same as Javascript. However, the one caveat is that when declaring variables such as the
iterator for traversing a loop, you should not use the 'var' or 'let' keyword. For reference, you can see the Javascript
documentation for loops/conditionals here:

@ -0,0 +1,37 @@
Netscript Miscellaneous
=======================
Comments
--------
Netscript supports comments using the same syntax as `Javascript comments <https://www.w3schools.com/js/js_comments.asp>`_.
Comments are not evaluated as code, and can be used to document and/or explain code::
//This is a comment and will not get executed even though its in the code
/* Multi
* line
* comment */
print("This code will actually get executed");
Javascript Math Module
----------------------
The `Javascript Math Module <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math>`_ is
supported in Netscript and is used in the same way::
numThreads = Math.floor(getServerRam("foodnstuff")[1] / 3.4);
Javascript Date Module
----------------------
The `Javascript Date Module <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date>`_ is supported in Netscript.
However, since the 'new' operator does not work in Netscript, only the Date module's static functions can be used:
* now()
* UTC()
* Parse()
* Maybe some others I don't know about
Example::
time = Date.now();

@ -102,6 +102,8 @@
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="netscriptfunctions.html#clear">clear() (built-in function)</a>
</li>
<li><a href="netscriptfunctions.html#clearLog">clearLog() (built-in function)</a>
</li>
<li><a href="netscriptsingularityfunctions.html#createProgram">createProgram() (built-in function)</a>
</li>
@ -112,6 +114,10 @@
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="netscriptfunctions.html#deleteServer">deleteServer() (built-in function)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="netscriptfunctions.html#disableLog">disableLog() (built-in function)</a>
</li>
</ul></td>
</tr></table>
@ -119,10 +125,12 @@
<h2 id="E">E</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="netscriptfunctions.html#exec">exec() (built-in function)</a>
<li><a href="netscriptfunctions.html#enableLog">enableLog() (built-in function)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="netscriptfunctions.html#exec">exec() (built-in function)</a>
</li>
<li><a href="netscriptfunctions.html#exit">exit() (built-in function)</a>
</li>
</ul></td>
@ -317,16 +325,18 @@
<h2 id="P">P</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="netscriptfunctions.html#peek">peek() (built-in function)</a>
</li>
<li><a href="netscriptixapi.html#placeOrder">placeOrder() (built-in function)</a>
</li>
<li><a href="netscriptfunctions.html#print">print() (built-in function)</a>
</li>
<li><a href="netscriptfunctions.html#prompt">prompt() (built-in function)</a>
</li>
<li><a href="netscriptsingularityfunctions.html#purchaseAugmentation">purchaseAugmentation() (built-in function)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="netscriptsingularityfunctions.html#purchaseAugmentation">purchaseAugmentation() (built-in function)</a>
</li>
<li><a href="netscriptfunctions.html#purchaseHacknetNode">purchaseHacknetNode() (built-in function)</a>
</li>
<li><a href="netscriptsingularityfunctions.html#purchaseProgram">purchaseProgram() (built-in function)</a>
@ -347,7 +357,7 @@
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="netscriptfunctions.html#round">round() (built-in function)</a>
<li><a href="netscriptfunctions.html#rm">rm() (built-in function)</a>
</li>
<li><a href="netscriptfunctions.html#run">run() (built-in function)</a>
</li>

@ -75,10 +75,7 @@ secrets that you've been searching for.</p>
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="netscriptloopsandconditionals.html"> Loops and Conditionals</a><ul>
<li class="toctree-l3"><a class="reference internal" href="netscriptloopsandconditionals.html#loops-and-conditionals">Loops and Conditionals</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="netscriptloopsandconditionals.html"> Loops and Conditionals</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptscriptarguments.html"> Script Arguments</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html"> Basic Functions</a><ul>
<li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#hack">hack</a></li>
@ -87,6 +84,9 @@ secrets that you've been searching for.</p>
<li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#sleep">sleep</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#print">print</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#tprint">tprint</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#clearlog">clearLog</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#disablelog">disableLog</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#enablelog">enableLog</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#scan">scan</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#nuke">nuke</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#brutessh">brutessh</a></li>
@ -123,10 +123,11 @@ secrets that you've been searching for.</p>
<li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#purchaseserver">purchaseServer</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#deleteserver">deleteServer</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#getpurchasedservers">getPurchasedServers</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#round">round</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#write">write</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#read">read</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#peek">peek</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#clear">clear</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#rm">rm</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#scriptrunning">scriptRunning</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#scriptkill">scriptKill</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#getscriptram">getScriptRam</a></li>
@ -194,6 +195,12 @@ secrets that you've been searching for.</p>
<li class="toctree-l3"><a class="reference internal" href="netscriptsingularityfunctions.html#installaugmentations">installAugmentations</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="netscriptmisc.html"> Miscellaneous</a><ul>
<li class="toctree-l3"><a class="reference internal" href="netscriptmisc.html#comments">Comments</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptmisc.html#javascript-math-module">Javascript Math Module</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptmisc.html#javascript-date-module">Javascript Date Module</a></li>
</ul>
</li>
</ul>
</li>
</ul>

@ -76,10 +76,7 @@ to reach out to the developer!</p>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="netscriptloopsandconditionals.html"> Loops and Conditionals</a><ul>
<li class="toctree-l2"><a class="reference internal" href="netscriptloopsandconditionals.html#loops-and-conditionals">Loops and Conditionals</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="netscriptloopsandconditionals.html"> Loops and Conditionals</a></li>
<li class="toctree-l1"><a class="reference internal" href="netscriptscriptarguments.html"> Script Arguments</a></li>
<li class="toctree-l1"><a class="reference internal" href="netscriptfunctions.html"> Basic Functions</a><ul>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#hack">hack</a></li>
@ -88,6 +85,9 @@ to reach out to the developer!</p>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#sleep">sleep</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#print">print</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#tprint">tprint</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#clearlog">clearLog</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#disablelog">disableLog</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#enablelog">enableLog</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#scan">scan</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#nuke">nuke</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#brutessh">brutessh</a></li>
@ -124,10 +124,11 @@ to reach out to the developer!</p>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#purchaseserver">purchaseServer</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#deleteserver">deleteServer</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#getpurchasedservers">getPurchasedServers</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#round">round</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#write">write</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#read">read</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#peek">peek</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#clear">clear</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#rm">rm</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#scriptrunning">scriptRunning</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#scriptkill">scriptKill</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#getscriptram">getScriptRam</a></li>
@ -195,6 +196,12 @@ to reach out to the developer!</p>
<li class="toctree-l2"><a class="reference internal" href="netscriptsingularityfunctions.html#installaugmentations">installAugmentations</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="netscriptmisc.html"> Miscellaneous</a><ul>
<li class="toctree-l2"><a class="reference internal" href="netscriptmisc.html#comments">Comments</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptmisc.html#javascript-math-module">Javascript Math Module</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptmisc.html#javascript-date-module">Javascript Date Module</a></li>
</ul>
</li>
</ul>
</div>
</div>
@ -218,6 +225,7 @@ to reach out to the developer!</p>
<li class="toctree-l2"><a class="reference internal" href="netscripthacknetnodeapi.html"> Hacknet Node API</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptixapi.html"> Trade Information eXchange (TIX) API</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptsingularityfunctions.html"> Singularity Functions</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptmisc.html"> Miscellaneous</a></li>
</ul>
</li>
</ul>

@ -70,7 +70,7 @@ This includes information such as function signatures, what they do, and their r
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">True if the hack is successful, false otherwise</p>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">The amount of money stolen if the hack is successful, and zero otherwise</p>
</td>
</tr>
</tbody>
@ -158,14 +158,13 @@ root access to the target server, but there is no required hacking level to run
<h2>sleep<a class="headerlink" href="#sleep" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descname">sleep</code><span class="sig-paren">(</span><em>n</em><span class="optional">[</span>, <em>log=true</em><span class="optional">]</span><span class="sig-paren">)</span></dt>
<code class="descname">sleep</code><span class="sig-paren">(</span><em>n</em><span class="sig-paren">)</span></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>n</strong> (<em>number</em>) -- Number of milliseconds to sleep</li>
<li><strong>log</strong> (<em>boolean</em>) -- Optional boolean specifying whether or not to log the action</li>
</ul>
</td>
</tr>
@ -214,6 +213,61 @@ root access to the target server, but there is no required hacking level to run
<p>Prints a value or a variable to the Terminal</p>
</dd></dl>
</div>
<div class="section" id="clearlog">
<h2>clearLog<a class="headerlink" href="#clearlog" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt id="clearLog">
<code class="descname">clearLog</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#clearLog" title="Permalink to this definition"></a></dt>
<dd><p>Clears the script's logs</p>
</dd></dl>
</div>
<div class="section" id="disablelog">
<h2>disableLog<a class="headerlink" href="#disablelog" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt id="disableLog">
<code class="descname">disableLog</code><span class="sig-paren">(</span><em>fn</em><span class="sig-paren">)</span><a class="headerlink" href="#disableLog" title="Permalink to this definition"></a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>fn</strong> (<em>string</em>) -- Name of function for which to disable logging</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>Disables logging for the given function. Logging can be disabled for
all functions by passing 'ALL' as the argument.</p>
<p>Note that this does not completely remove all logging functionality.
This only stops a function from logging
when the function is successful. If the function fails, it will still log the reason for failure.</p>
<p>Notable functions that cannot have their logs disabled: run, exec, exit</p>
</dd></dl>
</div>
<div class="section" id="enablelog">
<h2>enableLog<a class="headerlink" href="#enablelog" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt id="enableLog">
<code class="descname">enableLog</code><span class="sig-paren">(</span><em>fn</em><span class="sig-paren">)</span><a class="headerlink" href="#enableLog" title="Permalink to this definition"></a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>fn</strong> (<em>string</em>) -- Name of function for which to enable logging</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>Re-enables logging for the given function. If 'ALL' is passed into this function
as an argument, then it will revert the effects of disableLog('ALL')</p>
</dd></dl>
</div>
<div class="section" id="scan">
<h2>scan<a class="headerlink" href="#scan" title="Permalink to this headline"></a></h2>
@ -544,7 +598,8 @@ is not the same as <em>foo.script</em> run with the argument 2, even though they
</tr>
</tbody>
</table>
<p>Kills all running scripts on the specified server. This function will always return true.</p>
<p>Kills all running scripts on the specified server. This function returns true if any scripts were killed, and
false otherwise. In other words, it will return true if there are any scripts running on the target server.</p>
</dd></dl>
</div>
@ -599,13 +654,14 @@ then this function will return true if at least one of the files in the array is
<h2>ls<a class="headerlink" href="#ls" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descname">ls</code><span class="sig-paren">(</span><em>hostname/ip</em><span class="sig-paren">)</span></dt>
<code class="descname">ls</code><span class="sig-paren">(</span><em>hostname/ip</em><span class="optional">[</span>, <em>grep</em><span class="optional">]</span><span class="sig-paren">)</span></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>hostname/ip</strong> (<em>string</em>) -- Hostname or IP of the target server</li>
<li><strong>grep</strong> (<em>string</em>) -- a substring to search for in the filename</li>
</ul>
</td>
</tr>
@ -1078,26 +1134,6 @@ then IPs will be returned. If this argument is omitted then it is true by defaul
<p>Returns an array with either the hostnames or IPs of all of the servers you have purchased.</p>
</dd></dl>
</div>
<div class="section" id="round">
<h2>round<a class="headerlink" href="#round" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descname">round</code><span class="sig-paren">(</span><em>n</em><span class="sig-paren">)</span></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>n</strong> (<em>number</em>) -- Number to round</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>Returns the argument <em>n</em> rounded to the nearest integer. If the argument passed in is not a number, then the function will return 0.</p>
</dd></dl>
</div>
<div class="section" id="write">
<h2>write<a class="headerlink" href="#write" title="Permalink to this headline"></a></h2>
@ -1152,6 +1188,28 @@ will remove the first element from that queue and return it. If the queue is emp
the text file does not exist, an empty string will be returned.</p>
</dd></dl>
</div>
<div class="section" id="peek">
<h2>peek<a class="headerlink" href="#peek" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descname">peek</code><span class="sig-paren">(</span><em>port</em><span class="sig-paren">)</span></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
<li><strong>port</strong> (<em>number</em>) -- Port to peek. Must be an integer between 1 and 10</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>This function is used to peek at the data from a port. It returns the first element in the specified port
without removing that element. If the port is empty, the string &quot;NULL PORT DATA&quot; will be returned.</p>
<p>Read about how <a class="reference external" href="http://bitburner.wikia.com/wiki/Netscript_Ports">Netscript Ports work here</a>.</p>
</dd></dl>
</div>
<div class="section" id="clear">
<h2>clear<a class="headerlink" href="#clear" title="Permalink to this headline"></a></h2>
@ -1174,6 +1232,29 @@ the text file does not exist, an empty string will be returned.</p>
<p>If the <em>port/fn</em> argument is a string, then it specifies the name of a text file (.txt) and will delete all data from that text file.</p>
</dd></dl>
</div>
<div class="section" id="rm">
<h2>rm<a class="headerlink" href="#rm" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descname">rm</code><span class="sig-paren">(</span><em>fn</em><span class="sig-paren">)</span></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first simple">
<li><strong>fn</strong> (<em>string</em>) -- Filename of file to remove. Must include the extension</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">True if it successfully deletes the file, and false otherwise</p>
</td>
</tr>
</tbody>
</table>
<p>Removes the specified file from the current server. This function works for every file type except message (.msg) files.</p>
</dd></dl>
</div>
<div class="section" id="scriptrunning">
<h2>scriptRunning<a class="headerlink" href="#scriptrunning" title="Permalink to this headline"></a></h2>
@ -1505,6 +1586,9 @@ you create in functions such as <a class="reference external" href="https://deve
<li class="toctree-l3"><a class="reference internal" href="#sleep">sleep</a></li>
<li class="toctree-l3"><a class="reference internal" href="#print">print</a></li>
<li class="toctree-l3"><a class="reference internal" href="#tprint">tprint</a></li>
<li class="toctree-l3"><a class="reference internal" href="#clearlog">clearLog</a></li>
<li class="toctree-l3"><a class="reference internal" href="#disablelog">disableLog</a></li>
<li class="toctree-l3"><a class="reference internal" href="#enablelog">enableLog</a></li>
<li class="toctree-l3"><a class="reference internal" href="#scan">scan</a></li>
<li class="toctree-l3"><a class="reference internal" href="#nuke">nuke</a></li>
<li class="toctree-l3"><a class="reference internal" href="#brutessh">brutessh</a></li>
@ -1541,10 +1625,11 @@ you create in functions such as <a class="reference external" href="https://deve
<li class="toctree-l3"><a class="reference internal" href="#purchaseserver">purchaseServer</a></li>
<li class="toctree-l3"><a class="reference internal" href="#deleteserver">deleteServer</a></li>
<li class="toctree-l3"><a class="reference internal" href="#getpurchasedservers">getPurchasedServers</a></li>
<li class="toctree-l3"><a class="reference internal" href="#round">round</a></li>
<li class="toctree-l3"><a class="reference internal" href="#write">write</a></li>
<li class="toctree-l3"><a class="reference internal" href="#read">read</a></li>
<li class="toctree-l3"><a class="reference internal" href="#peek">peek</a></li>
<li class="toctree-l3"><a class="reference internal" href="#clear">clear</a></li>
<li class="toctree-l3"><a class="reference internal" href="#rm">rm</a></li>
<li class="toctree-l3"><a class="reference internal" href="#scriptrunning">scriptRunning</a></li>
<li class="toctree-l3"><a class="reference internal" href="#scriptkill">scriptKill</a></li>
<li class="toctree-l3"><a class="reference internal" href="#getscriptram">getScriptRam</a></li>
@ -1566,6 +1651,7 @@ you create in functions such as <a class="reference external" href="https://deve
<li class="toctree-l2"><a class="reference internal" href="netscripthacknetnodeapi.html"> Hacknet Node API</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptixapi.html"> Trade Information eXchange (TIX) API</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptsingularityfunctions.html"> Singularity Functions</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptmisc.html"> Miscellaneous</a></li>
</ul>
</li>
</ul>

@ -53,8 +53,6 @@
<div class="section" id="netscript-loops-and-conditionals">
<h1>Netscript Loops and Conditionals<a class="headerlink" href="#netscript-loops-and-conditionals" title="Permalink to this headline"></a></h1>
<div class="section" id="loops-and-conditionals">
<h2>Loops and Conditionals<a class="headerlink" href="#loops-and-conditionals" title="Permalink to this headline"></a></h2>
<p>Netscript loops and conditionals are the same as Javascript. However, the one caveat is that when declaring variables such as the
iterator for traversing a loop, you should not use the 'var' or 'let' keyword. For reference, you can see the Javascript
documentation for loops/conditionals here:</p>
@ -86,7 +84,6 @@ Otherwise, the money available on the server will be grown using the grow() Nets
<span class="p">}</span>
</pre></div>
</div>
</div>
</div>
@ -101,16 +98,14 @@ Otherwise, the money available on the server will be grown using the grow() Nets
<li class="toctree-l1 current"><a class="reference internal" href="netscript.html"> Netscript</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="netscriptdatatypes.html"> Data Types and Variables</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptoperators.html"> Operators</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#"> Loops and Conditionals</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#loops-and-conditionals">Loops and Conditionals</a></li>
</ul>
</li>
<li class="toctree-l2 current"><a class="current reference internal" href="#"> Loops and Conditionals</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptscriptarguments.html"> Script Arguments</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html"> Basic Functions</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptadvancedfunctions.html"> Advanced Functions</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscripthacknetnodeapi.html"> Hacknet Node API</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptixapi.html"> Trade Information eXchange (TIX) API</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptsingularityfunctions.html"> Singularity Functions</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptmisc.html"> Miscellaneous</a></li>
</ul>
</li>
</ul>

161
doc/build/html/netscriptmisc.html vendored Normal file

@ -0,0 +1,161 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="English">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Netscript Miscellaneous &#8212; Bitburner 1.0 documentation</title>
<link rel="stylesheet" href="_static/agogo.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '1.0',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt'
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="prev" title="Netscript Singularity Functions" href="netscriptsingularityfunctions.html" />
</head>
<body>
<div class="header-wrapper" role="banner">
<div class="header">
<div class="headertitle"><a
href="index.html">Bitburner 1.0 documentation</a></div>
<div class="rel" role="navigation" aria-label="related navigation">
<a href="netscriptsingularityfunctions.html" title="Netscript Singularity Functions"
accesskey="P">previous</a> |
<a href="genindex.html" title="General Index"
accesskey="I">index</a>
</div>
</div>
</div>
<div class="content-wrapper">
<div class="content">
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="netscript-miscellaneous">
<h1>Netscript Miscellaneous<a class="headerlink" href="#netscript-miscellaneous" title="Permalink to this headline"></a></h1>
<div class="section" id="comments">
<h2>Comments<a class="headerlink" href="#comments" title="Permalink to this headline"></a></h2>
<p>Netscript supports comments using the same syntax as <a class="reference external" href="https://www.w3schools.com/js/js_comments.asp">Javascript comments</a>.
Comments are not evaluated as code, and can be used to document and/or explain code:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="o">//</span><span class="n">This</span> <span class="ow">is</span> <span class="n">a</span> <span class="n">comment</span> <span class="ow">and</span> <span class="n">will</span> <span class="ow">not</span> <span class="n">get</span> <span class="n">executed</span> <span class="n">even</span> <span class="n">though</span> <span class="n">its</span> <span class="ow">in</span> <span class="n">the</span> <span class="n">code</span>
<span class="o">/*</span> <span class="n">Multi</span>
<span class="o">*</span> <span class="n">line</span>
<span class="o">*</span> <span class="n">comment</span> <span class="o">*/</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;This code will actually get executed&quot;</span><span class="p">);</span>
</pre></div>
</div>
</div>
<div class="section" id="javascript-math-module">
<h2>Javascript Math Module<a class="headerlink" href="#javascript-math-module" title="Permalink to this headline"></a></h2>
<p>The <a class="reference external" href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math">Javascript Math Module</a> is
supported in Netscript and is used in the same way:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">numThreads</span> <span class="o">=</span> <span class="n">Math</span><span class="o">.</span><span class="n">floor</span><span class="p">(</span><span class="n">getServerRam</span><span class="p">(</span><span class="s2">&quot;foodnstuff&quot;</span><span class="p">)[</span><span class="mi">1</span><span class="p">]</span> <span class="o">/</span> <span class="mf">3.4</span><span class="p">);</span>
</pre></div>
</div>
</div>
<div class="section" id="javascript-date-module">
<h2>Javascript Date Module<a class="headerlink" href="#javascript-date-module" title="Permalink to this headline"></a></h2>
<p>The <a class="reference external" href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date">Javascript Date Module</a> is supported in Netscript.
However, since the 'new' operator does not work in Netscript, only the Date module's static functions can be used:</p>
<ul class="simple">
<li>now()</li>
<li>UTC()</li>
<li>Parse()</li>
<li>Maybe some others I don't know about</li>
</ul>
<p>Example:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">time</span> <span class="o">=</span> <span class="n">Date</span><span class="o">.</span><span class="n">now</span><span class="p">();</span>
</pre></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="sidebar">
<h3>Table Of Contents</h3>
<p class="caption"><span class="caption-text">Contents:</span></p>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="netscript.html"> Netscript</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="netscriptdatatypes.html"> Data Types and Variables</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptoperators.html"> Operators</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptloopsandconditionals.html"> Loops and Conditionals</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptscriptarguments.html"> Script Arguments</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html"> Basic Functions</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptadvancedfunctions.html"> Advanced Functions</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscripthacknetnodeapi.html"> Hacknet Node API</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptixapi.html"> Trade Information eXchange (TIX) API</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptsingularityfunctions.html"> Singularity Functions</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#"> Miscellaneous</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#comments">Comments</a></li>
<li class="toctree-l3"><a class="reference internal" href="#javascript-math-module">Javascript Math Module</a></li>
<li class="toctree-l3"><a class="reference internal" href="#javascript-date-module">Javascript Date Module</a></li>
</ul>
</li>
</ul>
</li>
</ul>
<div role="search">
<h3 style="margin-top: 1.5em;">Search</h3>
<form class="search" action="search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="clearer"></div>
</div>
</div>
<div class="footer-wrapper">
<div class="footer">
<div class="left">
<div role="navigation" aria-label="related navigaton">
<a href="netscriptsingularityfunctions.html" title="Netscript Singularity Functions"
>previous</a> |
<a href="genindex.html" title="General Index"
>index</a>
</div>
<div role="note" aria-label="source link">
<br/>
<a href="_sources/netscriptmisc.rst.txt"
rel="nofollow">Show Source</a>
</div>
</div>
<div class="right">
<div class="footer" role="contentinfo">
&#169; Copyright 2017, Bitburner.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.6.4.
</div>
</div>
<div class="clearer"></div>
</div>
</div>
</body>
</html>

@ -24,6 +24,7 @@
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Netscript Miscellaneous" href="netscriptmisc.html" />
<link rel="prev" title="Netscript Trade Information eXchange (TIX) API" href="netscriptixapi.html" />
</head>
<body>
@ -34,6 +35,8 @@
<div class="rel" role="navigation" aria-label="related navigation">
<a href="netscriptixapi.html" title="Netscript Trade Information eXchange (TIX) API"
accesskey="P">previous</a> |
<a href="netscriptmisc.html" title="Netscript Miscellaneous"
accesskey="N">next</a> |
<a href="genindex.html" title="General Index"
accesskey="I">index</a>
</div>
@ -696,6 +699,7 @@ This script will be run with no arguments and 1 thread. It must be located on yo
<li class="toctree-l3"><a class="reference internal" href="#installaugmentations">installAugmentations</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="netscriptmisc.html"> Miscellaneous</a></li>
</ul>
</li>
</ul>
@ -720,6 +724,8 @@ This script will be run with no arguments and 1 thread. It must be located on yo
<div role="navigation" aria-label="related navigaton">
<a href="netscriptixapi.html" title="Netscript Trade Information eXchange (TIX) API"
>previous</a> |
<a href="netscriptmisc.html" title="Netscript Miscellaneous"
>next</a> |
<a href="genindex.html" title="General Index"
>index</a>
</div>

Binary file not shown.

File diff suppressed because one or more lines are too long

43
doc/source/.tags Normal file

@ -0,0 +1,43 @@
!_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 //
author .\conf.py /^author = 'Bitburner'$/;" v
copyright .\conf-guzzle.py /^copyright = u'2017, Daniel Xie'$/;" v
copyright .\conf.py /^copyright = '2017, Bitburner'$/;" v
exclude_patterns .\conf-guzzle.py /^exclude_patterns = ['_build']$/;" v
exclude_patterns .\conf.py /^exclude_patterns = []$/;" v
extensions .\conf-guzzle.py /^extensions = []$/;" v
extensions .\conf.py /^extensions = ['sphinx.ext.autodoc',$/;" v
guzzle_sphinx_theme .\conf-guzzle.py /^import guzzle_sphinx_theme$/;" i
html_show_sourcelink .\conf-guzzle.py /^html_show_sourcelink = False$/;" v
html_static_path .\conf.py /^html_static_path = ['ystatic']$/;" v
html_theme .\conf-guzzle.py /^html_theme = 'guzzle_sphinx_theme'$/;" v
html_theme .\conf.py /^html_theme = 'agogo'$/;" v
html_theme_options .\conf-guzzle.py /^html_theme_options = {$/;" v
html_theme_path .\conf-guzzle.py /^html_theme_path = guzzle_sphinx_theme.html_theme_path()$/;" v
htmlhelp_basename .\conf.py /^htmlhelp_basename = 'Bitburnerdoc'$/;" v
intersphinx_mapping .\conf.py /^intersphinx_mapping = {'https:\/\/docs.python.org\/': None}$/;" v
language .\conf.py /^language = 'English'$/;" v
latex_documents .\conf.py /^latex_documents = [$/;" v
latex_elements .\conf.py /^latex_elements = {$/;" v
man_pages .\conf.py /^man_pages = [$/;" v
master_doc .\conf-guzzle.py /^master_doc = 'index'$/;" v
master_doc .\conf.py /^master_doc = 'index'$/;" v
os .\conf-guzzle.py /^import sys, os, subprocess$/;" i
project .\conf-guzzle.py /^project = u'Bitburner'$/;" v
project .\conf.py /^project = 'Bitburner'$/;" v
pygments_style .\conf.py /^pygments_style = 'sphinx'$/;" v
release .\conf.py /^release = '1.0'$/;" v
source_suffix .\conf-guzzle.py /^source_suffix = '.rst'$/;" v
source_suffix .\conf.py /^source_suffix = '.rst'$/;" v
subprocess .\conf-guzzle.py /^import sys, os, subprocess$/;" i
sys .\conf-guzzle.py /^import sys, os, subprocess$/;" i
templates_path .\conf-guzzle.py /^templates_path = ['_templates']$/;" v
templates_path .\conf.py /^templates_path = ['ytemplates']$/;" v
texinfo_documents .\conf.py /^texinfo_documents = [$/;" v
todo_include_todos .\conf.py /^todo_include_todos = True$/;" v
version .\conf-guzzle.py /^version = '1.0.0'$/;" v
version .\conf.py /^version = '1.0'$/;" v

@ -23,3 +23,4 @@ to reach out to the developer!
Hacknet Node API <netscripthacknetnodeapi>
Trade Information eXchange (TIX) API <netscriptixapi>
Singularity Functions <netscriptsingularityfunctions>
Miscellaneous <netscriptmisc>

@ -12,7 +12,7 @@ hack
.. js:function:: hack(hostname/ip)
:param string hostname/ip: IP or hostname of the target server to hack
:returns: True if the hack is successful, false otherwise
:returns: The amount of money stolen if the hack is successful, and zero otherwise
Function that is used to try and hack servers to steal money and gain hacking experience. The runtime for this command depends
on your hacking level and the target server's security level. In order to hack a server you must first gain root access
@ -72,10 +72,9 @@ weaken
sleep
^^^^^
.. js:function:: sleep(n[, log=true])
.. js:function:: sleep(n)
:param number n: Number of milliseconds to sleep
:param boolean log: Optional boolean specifying whether or not to log the action
Suspends the script for n milliseconds.
@ -97,6 +96,39 @@ tprint
Prints a value or a variable to the Terminal
clearLog
^^^^^^^^
.. js:function:: clearLog()
Clears the script's logs
disableLog
^^^^^^^^^^
.. js:function:: disableLog(fn)
:param string fn: Name of function for which to disable logging
Disables logging for the given function. Logging can be disabled for
all functions by passing 'ALL' as the argument.
Note that this does not completely remove all logging functionality.
This only stops a function from logging
when the function is successful. If the function fails, it will still log the reason for failure.
Notable functions that cannot have their logs disabled: run, exec, exit
enableLog
^^^^^^^^^
.. js:function:: enableLog(fn)
:param string fn: Name of function for which to enable logging
Re-enables logging for the given function. If 'ALL' is passed into this function
as an argument, then it will revert the effects of disableLog('ALL')
scan
^^^^
@ -304,7 +336,8 @@ killall
:param string hostname/ip: IP or hostname of the server on which to kill all scripts
Kills all running scripts on the specified server. This function will always return true.
Kills all running scripts on the specified server. This function returns true if any scripts were killed, and
false otherwise. In other words, it will return true if there are any scripts running on the target server.
exit
@ -346,9 +379,10 @@ scp
ls
^^
.. js:function:: ls(hostname/ip)
.. js:function:: ls(hostname/ip, [grep])
:param string hostname/ip: Hostname or IP of the target server
:param string grep: a substring to search for in the filename
Returns an array with the filenames of all files on the specified server (as strings). The returned array
is sorted in alphabetic order
@ -639,15 +673,6 @@ getPurchasedServers
Returns an array with either the hostnames or IPs of all of the servers you have purchased.
round
^^^^^
.. js:function:: round(n)
:param number n: Number to round
Returns the argument *n* rounded to the nearest integer. If the argument passed in is not a number, then the function will return 0.
write
^^^^^
@ -684,6 +709,18 @@ read
If the argument *port/fn* is a string, then it specifies the name of a text file (.txt) and this function will return the data in the specified text file. If
the text file does not exist, an empty string will be returned.
peek
^^^^
.. js:function:: peek(port)
:param number port: Port to peek. Must be an integer between 1 and 10
This function is used to peek at the data from a port. It returns the first element in the specified port
without removing that element. If the port is empty, the string "NULL PORT DATA" will be returned.
Read about how `Netscript Ports work here <http://bitburner.wikia.com/wiki/Netscript_Ports>`_.
clear
^^^^^
@ -697,6 +734,16 @@ clear
If the *port/fn* argument is a string, then it specifies the name of a text file (.txt) and will delete all data from that text file.
rm
^^
.. js:function:: rm(fn)
:param string fn: Filename of file to remove. Must include the extension
:returns: True if it successfully deletes the file, and false otherwise
Removes the specified file from the current server. This function works for every file type except message (.msg) files.
scriptRunning
^^^^^^^^^^^^^

@ -2,9 +2,6 @@ Netscript Loops and Conditionals
================================
Loops and Conditionals
----------------------
Netscript loops and conditionals are the same as Javascript. However, the one caveat is that when declaring variables such as the
iterator for traversing a loop, you should not use the 'var' or 'let' keyword. For reference, you can see the Javascript
documentation for loops/conditionals here:

@ -0,0 +1,37 @@
Netscript Miscellaneous
=======================
Comments
--------
Netscript supports comments using the same syntax as `Javascript comments <https://www.w3schools.com/js/js_comments.asp>`_.
Comments are not evaluated as code, and can be used to document and/or explain code::
//This is a comment and will not get executed even though its in the code
/* Multi
* line
* comment */
print("This code will actually get executed");
Javascript Math Module
----------------------
The `Javascript Math Module <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math>`_ is
supported in Netscript and is used in the same way::
numThreads = Math.floor(getServerRam("foodnstuff")[1] / 3.4);
Javascript Date Module
----------------------
The `Javascript Date Module <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date>`_ is supported in Netscript.
However, since the 'new' operator does not work in Netscript, only the Date module's static functions can be used:
* now()
* UTC()
* Parse()
* Maybe some others I don't know about
Example::
time = Date.now();

@ -870,7 +870,7 @@
</span>
</label>
<input type ="range" max="200" min="25"
<input type ="range" max="250" min="25"
step="1" name="settingsNSExecTimeRangeVal" id="settingsNSExecTimeRangeVal" value="100">
</input>
<em id="settingsNSExecTimeRangeValLabel" style="font-style: normal;"></em>

68
license.txt Normal file

@ -0,0 +1,68 @@
LIMITED USE SOFTWARE LICENSE AGREEMENT
This Limited Use Software License Agreement (the "Agreement") is a legal agreement between you, the end-user, and Daniel Xie,
the creator of the software, hereafter referred to as the Creator.
By downloading or purchasing the software material, which includes source code (the "Source Code"), artwork data, music and software
tools (collectively, the "Software"), you are agreeing to be bound by the terms of this Agreement. If you do not agree to the terms
of this Agreement, promptly destroy the Software you may have downloaded or copied.
SOFTWARE LICENSE
1. Grant of License. The Creator grants to you the right to use the Software. You have no ownership or proprietary rights in or to
the Software, or the Trademark. For purposes of this section, "use" means loading the Software into RAM, as well as installation
on a hard disk or other storage device. The Software, together with any archive copy thereof, shall be destroyed when no longer
used in accordance with this Agreement, or when the right to use the Software is terminated. You agree that the Software will not
be shipped, transferred or exported into any country in violation of the U.S. Export Administration Act (or any other law governing
such matters) and that you will not utilize, in any other manner, the Software in violation of any applicable law.
2. Permitted Uses. For educational purposes only, you, the end-user, may use portions of the Source Code, such as particular
routines, to develop your own software, but may not duplicate the Source Code, except as noted in paragraph 4. The limited
right referenced in the preceding sentence is hereinafter referred to as "Educational Use." By so exercising the Educational
Use right you shall not obtain any ownership, copyright, proprietary or other interest in or to the Source Code, or any portion
of the Source Code. You may dispose of your own software in your sole discretion. With the exception of the Educational Use right,
you may not otherwise use the Software, or an portion of the Software, which includes the Source Code, for commercial gain.
3. Prohibited Uses: Under no circumstances shall you, the end-user, be permitted, allowed or authorized to commercially
exploit the Software. Neither you nor anyone at your direction shall do any of the following acts with regard to the Software,
or any portion thereof:
Rent;
Sell;
Lease;
Offer on a pay-per-play basis;
Distribute for money or any other consideration; or
In any other manner and through any medium whatsoever commercially exploit or use for any commercial purpose.
Notwithstanding the foregoing prohibitions, you may commercially exploit the software you develop by exercising the Educational
Use right, referenced in paragraph 2. hereinabove.
4. Copyright. The Software and all copyrights related thereto (including all characters and other images generated by the
Software or depicted in the Software) are owned by the Creator and is protected by United States copyright laws and international treaty
provisions. Id shall retain exclusive ownership and copyright in and to the Software and all portions of the Software and you
shall have no ownership or other proprietary interest in such materials. You must treat the Software like any other copyrighted
material. You may not otherwise reproduce, copy or disclose to others, in whole or in any part, the Software. You may not copy the
written materials accompanying the Software. You agree to use your best efforts to see that any user of the Software licensed
hereunder complies with this Agreement.
5. NO WARRANTIES. The Creator DISCLAIMS ALL WARRANTIES, BOTH EXPRESS IMPLIED, INCLUDING BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE WITH RESPECT TO THE SOFTWARE. THIS LIMITED WARRANTY GIVES YOU SPECIFIC
LEGAL RIGHTS. YOU MAY HAVE OTHER RIGHTS WHICH VARY FROM JURISDICTION TO JURISDICTION. the Creator DOES NOT WARRANT THAT THE OPERATION
OF THE SOFTWARE WILL BE UNINTERRUPTED, ERROR FREE OR MEET YOUR SPECIFIC REQUIREMENTS. THE WARRANTY SET FORTH ABOVE IS IN LIEU
OF ALL OTHER EXPRESS WARRANTIES WHETHER ORAL OR WRITTEN. THE AGENTS, EMPLOYEES, DISTRIBUTORS, AND DEALERS OF THE CREATOR ARE NOT AUTHORIZED
TO MAKE MODIFICATIONS TO THIS WARRANTY, OR ADDITIONAL WARRANTIES ON BEHALF OF THE CREATOR.
Exclusive Remedies. The Software is being offered to you free of any charge. You agree that you have no remedy against the creator,
its affiliates, contractors, suppliers, and agents for loss or damage caused by any defect or failure in the Software regardless
of the form of action, whether in contract, tort, includinegligence, strict liability or otherwise, with regard to the Software.
This Agreement shall be construed in accordance with and governed by the laws of the State of Texas. Copyright and other
proprietary matters will be governed by United States laws and international treaties. IN ANY CASE, THE CREATOR SHALL NOT BE LIABLE
FOR LOSS OF DATA, LOSS OF PROFITS, LOST SAVINGS, SPECIAL, INCIDENTAL, CONSEQUENTIAL, INDIRECT OR OTHER SIMILAR DAMAGES ARISING
FROM BREACH OF WARRANTY, BREACH OF CONTRACT, NEGLIGENCE, OR OTHER LEGAL THEORY EVEN IF THE CREATOR OR ITS AGENT HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES, OR FOR ANY CLAIM BY ANY OTHER PARTY. Some jurisdictions do not allow the exclusion or limitation of
incidental or consequential damages, so the above limitation or exclusion may not apply to you.

2498
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

144
package.json Normal file

@ -0,0 +1,144 @@
{
"_from": "webpack",
"_id": "webpack@3.5.5",
"_inBundle": false,
"_integrity": "sha512-qeUx4nIbeLL53qqNTs3kObPBMkUVDrOjEfp/hTvMlx21qL2MsGNr8/tXCoX/lS12dLl9qtZaXv2qfBEctPScDg==",
"_location": "/webpack",
"_phantomChildren": {},
"_requested": {
"type": "tag",
"registry": true,
"raw": "webpack",
"name": "webpack",
"escapedName": "webpack",
"rawSpec": "",
"saveSpec": null,
"fetchSpec": "latest"
},
"_requiredBy": [
"#USER"
],
"_resolved": "https://registry.npmjs.org/webpack/-/webpack-3.5.5.tgz",
"_shasum": "3226f09fc8b3e435ff781e7af34f82b68b26996c",
"_spec": "webpack",
"_where": "C:\\Users\\danie",
"author": {
"name": "Tobias Koppers @sokra"
},
"bin": {
"webpack": "./bin/webpack.js"
},
"bugs": {
"url": "https://github.com/webpack/webpack/issues"
},
"bundleDependencies": false,
"dependencies": {
"acorn": "^5.0.0",
"acorn-dynamic-import": "^2.0.0",
"ajv": "^5.1.5",
"ajv-keywords": "^2.0.0",
"async": "^2.1.2",
"enhanced-resolve": "^3.4.0",
"escope": "^3.6.0",
"interpret": "^1.0.0",
"json-loader": "^0.5.4",
"json5": "^0.5.1",
"loader-runner": "^2.3.0",
"loader-utils": "^1.1.0",
"memory-fs": "~0.4.1",
"mkdirp": "~0.5.0",
"node-libs-browser": "^2.0.0",
"source-map": "^0.5.3",
"supports-color": "^4.2.1",
"tapable": "^0.2.7",
"uglifyjs-webpack-plugin": "^0.4.6",
"watchpack": "^1.4.0",
"webpack-sources": "^1.0.1",
"yargs": "^8.0.2"
},
"deprecated": false,
"description": "Packs CommonJs/AMD modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.",
"devDependencies": {
"beautify-lint": "^1.0.3",
"benchmark": "^2.1.1",
"bundle-loader": "~0.5.0",
"codacy-coverage": "^2.0.1",
"codecov.io": "^0.1.2",
"coffee-loader": "~0.7.1",
"coffee-script": "^1.10.0",
"coveralls": "^2.11.2",
"css-loader": "^0.28.3",
"es6-promise-polyfill": "^1.1.1",
"eslint": "^4.3.0",
"eslint-plugin-node": "^5.1.1",
"express": "~4.13.1",
"extract-text-webpack-plugin": "^3.0.0",
"file-loader": "^0.11.2",
"i18n-webpack-plugin": "^1.0.0",
"istanbul": "^0.4.5",
"jade": "^1.11.0",
"jade-loader": "~0.8.0",
"js-beautify": "^1.5.10",
"less": "^2.5.1",
"less-loader": "^4.0.3",
"lodash": "^4.17.4",
"mocha": "^3.2.0",
"mocha-lcov-reporter": "^1.0.0",
"nsp": "^2.6.1",
"raw-loader": "~0.5.0",
"react": "^15.2.1",
"react-dom": "^15.2.1",
"script-loader": "~0.7.0",
"should": "^11.1.1",
"simple-git": "^1.65.0",
"sinon": "^2.3.2",
"style-loader": "^0.18.1",
"url-loader": "~0.5.0",
"val-loader": "^1.0.2",
"vm-browserify": "~0.0.0",
"webpack-dev-middleware": "^1.9.0",
"worker-loader": "^0.8.0"
},
"engines": {
"node": ">=4.3.0 <5.0.0 || >=5.10"
},
"files": [
"lib/",
"bin/",
"buildin/",
"hot/",
"web_modules/",
"schemas/"
],
"homepage": "https://github.com/webpack/webpack",
"license": "MIT",
"main": "lib/webpack.js",
"name": "webpack",
"repository": {
"type": "git",
"url": "git+https://github.com/webpack/webpack.git"
},
"scripts": {
"appveyor:benchmark": "npm run benchmark",
"appveyor:test": "node node_modules\\mocha\\bin\\mocha --max-old-space-size=4096 --harmony test/*.test.js",
"beautify-lint": "beautify-lint \"lib/**/*.js\" \"hot/**/*.js\" \"bin/**/*.js\" \"benchmark/*.js\" \"test/*.js\"",
"benchmark": "mocha --max-old-space-size=4096 --harmony test/*.benchmark.js -R spec",
"build:examples": "cd examples && node buildAll.js",
"circleci:lint": "npm run lint-files && npm run nsp",
"circleci:test": "node node_modules/mocha/bin/mocha --max-old-space-size=4096 --harmony test/*.test.js",
"cover": "node --max-old-space-size=4096 --harmony ./node_modules/istanbul/lib/cli.js cover -x '**/*.runtime.js' node_modules/mocha/bin/_mocha -- test/*.test.js",
"cover:min": "node --max-old-space-size=4096 --harmony ./node_modules/.bin/istanbul cover -x '**/*.runtime.js' --report lcovonly node_modules/mocha/bin/_mocha -- test/*.test.js",
"fix": "npm run lint -- --fix",
"lint": "eslint lib bin hot buildin \"test/**/webpack.config.js\" \"test/binCases/**/test.js\" \"examples/**/webpack.config.js\"",
"lint-files": "npm run lint && npm run beautify-lint",
"nsp": "nsp check --output summary",
"pretest": "npm run lint-files",
"publish-patch": "npm run lint && npm run beautify-lint && mocha && npm version patch && git push && git push --tags && npm publish",
"test": "mocha test/*.test.js --max-old-space-size=4096 --harmony --check-leaks",
"travis:benchmark": "npm run benchmark",
"travis:lint": "npm run lint-files && npm run nsp",
"travis:test": "npm run cover:min"
},
"version": "3.5.5",
"web": "lib/webpack.web.js"
}

@ -124,7 +124,7 @@ let AugmentationNames = {
ADRPheromone2: "ADR-V2 Pheromone Gene",
HacknetNodeCPUUpload: "Hacknet Node CPU Architecture Neural-Upload",
HacknetNodeCacheUpload: "Hacknet Node Cache Architecture Neural-Upload",
HacknetNodeNICUpload: "HacknetNode NIC Architecture Neural-Upload",
HacknetNodeNICUpload: "Hacknet Node NIC Architecture Neural-Upload",
HacknetNodeKernelDNI: "Hacknet Node Kernel Direct-Neural Interface",
HacknetNodeCoreDNI: "Hacknet Node Core Direct-Neural Interface",
NeuroFluxGovernor: "NeuroFlux Governor",

@ -1,4 +1,5 @@
import {Engine} from "./engine.js";
import {showLiterature} from "./Literature.js";
import {Locations} from "./Location.js";
import {Player} from "./Player.js";
@ -11,7 +12,7 @@ import {getRandomInt, removeElementById,
import {Reviver, Generic_toJSON,
Generic_fromJSON} from "../utils/JSONReviver.js";
import numeral from "../utils/numeral.min.js";
import {formatNumber, isString} from "../utils/StringHelperFunctions.js";
import {formatNumber, isString, generateRandomString} from "../utils/StringHelperFunctions.js";
import {yesNoBoxCreate, yesNoTxtInpBoxCreate,
yesNoBoxGetYesButton, yesNoBoxGetNoButton,
yesNoTxtInpBoxGetYesButton, yesNoTxtInpBoxGetNoButton,
@ -51,7 +52,7 @@ Reviver.constructors.CorporationState = CorporationState;
/* Constants */
var TOTALSHARES = 1e9; //Total number of shares you have at your company
var CyclesPerMarketCycle = 100;
var CyclesPerMarketCycle = 75;
var CyclesPerIndustryStateCycle = CyclesPerMarketCycle / companyStates.length;
var SecsPerMarketCycle = CyclesPerMarketCycle / 5;
var Cities = ["Aevum", "Chongqing", "Sector-12", "New Tokyo", "Ishima", "Volhaven"];
@ -352,7 +353,7 @@ Product.prototype.finishProduct = function(employeeProd, industry) {
this.calculateRating(industry);
var advMult = 1 + (Math.pow(this.advCost, 0.1) / 100);
console.log("advMult: " + advMult);
this.mku = 100 / (advMult * this.qlt * (busRatio + mgmtRatio));
this.mku = 100 / (advMult * Math.pow((this.qlt + 0.001), 0.9) * (busRatio + mgmtRatio));
this.dmd = industry.awareness === 0 ? 20 : Math.min(100, advMult * (100 * (industry.popularity / industry.awareness)));
this.cmp = getRandomInt(0, 70);
@ -440,33 +441,47 @@ var IndustryStartingCosts = {
var IndustryDescriptions = {
Energy: "Engage in the production and distribution of energy.<br><br>" +
"Starting cost: " + numeral(IndustryStartingCosts.Energy).format("$0.000a"),
"Starting cost: " + numeral(IndustryStartingCosts.Energy).format("$0.000a") + "<br>" +
"Recommended starting Industry: NO",
Utilities: "Distributes water and provides wastewater services.<br><br>" +
"Starting cost: " + numeral(IndustryStartingCosts.Utilities).format("$0.000a"),
"Starting cost: " + numeral(IndustryStartingCosts.Utilities).format("$0.000a") + "<br>" +
"Recommended starting Industry: NO",
Agriculture: "Cultive crops and breed livestock to produce food.<br><br>" +
"Starting cost: " + numeral(IndustryStartingCosts.Agriculture).format("$0.000a"),
"Starting cost: " + numeral(IndustryStartingCosts.Agriculture).format("$0.000a") + "<br>" +
"Recommended starting Industry: YES",
Fishing: "Produce food through the breeding and processing of fish and fish products<br><br>" +
"Starting cost: " + numeral(IndustryStartingCosts.Fishing).format("$0.000a"),
"Starting cost: " + numeral(IndustryStartingCosts.Fishing).format("$0.000a") + "<br>" +
"Recommended starting Industry: NO",
Mining: "Extract and process metals from the earth.<br><br>" +
"Starting cost: " + numeral(IndustryStartingCosts.Mining).format("$0.000a"),
"Starting cost: " + numeral(IndustryStartingCosts.Mining).format("$0.000a") + "<br>" +
"Recommended starting Industry: NO",
Food: "Create your own restaurants all around the world.<br><br>" +
"Starting cost: " + numeral(IndustryStartingCosts.Food).format("$0.000a"),
"Starting cost: " + numeral(IndustryStartingCosts.Food).format("$0.000a") + "<br>" +
"Recommended starting Industry: YES",
Tobacco: "Create and distribute tobacco and tobacco-related products.<br><br>" +
"Starting cost: " + numeral(IndustryStartingCosts.Tobacco).format("$0.000a"),
"Starting cost: " + numeral(IndustryStartingCosts.Tobacco).format("$0.000a") + "<br>" +
"Recommended starting Industry: YES",
Chemical: "Product industrial chemicals<br><br>" +
"Starting cost: " + numeral(IndustryStartingCosts.Chemical).format("$0.000a"),
"Starting cost: " + numeral(IndustryStartingCosts.Chemical).format("$0.000a") + "<br>" +
"Recommended starting Industry: NO",
Pharmaceutical: "Discover, develop, and create new pharmaceutical drugs.<br><br>" +
"Starting cost: " + numeral(IndustryStartingCosts.Pharmaceutical).format("$0.000a"),
"Starting cost: " + numeral(IndustryStartingCosts.Pharmaceutical).format("$0.000a") + "<br>" +
"Recommended starting Industry: NO",
Computer: "Develop and manufacture new computer hardware and networking infrastructures.<br><br>" +
"Starting cost: " + numeral(IndustryStartingCosts.Computer).format("$0.000a"),
"Starting cost: " + numeral(IndustryStartingCosts.Computer).format("$0.000a") + "<br>" +
"Recommended starting Industry: NO",
Robotics: "Develop and create robots.<br><br>" +
"Starting cost: " + numeral(IndustryStartingCosts.Robotics).format("$0.000a"),
"Starting cost: " + numeral(IndustryStartingCosts.Robotics).format("$0.000a") + "<br>" +
"Recommended starting Industry: NO",
Software: "Develop computer software and create AI Cores.<br><br>" +
"Starting cost: " + numeral(IndustryStartingCosts.Software).format("$0.000a"),
"Starting cost: " + numeral(IndustryStartingCosts.Software).format("$0.000a") + "<br>" +
"Recommended starting Industry: YES",
Healthcare: "Create and manage hospitals.<br><br>" +
"Starting cost: " + numeral(IndustryStartingCosts.Healthcare).format("$0.000a"),
"Starting cost: " + numeral(IndustryStartingCosts.Healthcare).format("$0.000a") + "<br>" +
"Recommended starting Industry: NO",
RealEstate: "Develop and manuage real estate properties.<br><br>" +
"Starting cost: " + numeral(IndustryStartingCosts.RealEstate).format("$0.000a"),
"Starting cost: " + numeral(IndustryStartingCosts.RealEstate).format("$0.000a") + "<br>" +
"Recommended starting Industry: NO",
}
var ProductRatingWeights = {
@ -624,7 +639,7 @@ Industry.prototype.init = function() {
this.sciFac = 0.7;
this.robFac = 0.05;
this.aiFac = 0.3;
this.advFac = 0.2;
this.advFac = 0.07;
this.reqMats = {
"Hardware": 0.1,
"Metal": 0.25,
@ -637,7 +652,7 @@ Industry.prototype.init = function() {
this.sciFac = 0.6;
this.robFac = 0.3;
this.aiFac = 0.3;
this.advFac = 0.2;
this.advFac = 0.07;
this.reqMats = {
"Hardware": 0.1,
"Metal": 0.2,
@ -650,7 +665,7 @@ Industry.prototype.init = function() {
this.hwFac = 0.2;
this.robFac = 0.3;
this.aiFac = 0.3;
this.advFac = 0.05;
this.advFac = 0.04;
this.reqMats = {
"Water": 0.5,
"Energy": 0.5,
@ -663,7 +678,7 @@ Industry.prototype.init = function() {
this.hwFac = 0.35;
this.robFac = 0.5;
this.aiFac = 0.2;
this.advFac = 0.15;
this.advFac = 0.06;
this.reqMats = {
"Energy": 0.5,
}
@ -675,7 +690,7 @@ Industry.prototype.init = function() {
this.hwFac = 0.4;
this.robFac = 0.5;
this.aiFac = 0.5;
this.advFac = 0.05;
this.advFac = 0.04;
this.reqMats = {
"Energy": 0.8,
}
@ -687,7 +702,7 @@ Industry.prototype.init = function() {
this.hwFac = 0.15;
this.robFac = 0.3;
this.aiFac = 0.25;
this.advFac = 0.75;
this.advFac = 0.25;
this.reFac = 0.05;
this.reqMats = {
"Food": 0.5,
@ -702,7 +717,7 @@ Industry.prototype.init = function() {
this.hwFac = 0.15;
this.robFac = 0.2;
this.aiFac = 0.15;
this.advFac = 0.6;
this.advFac = 0.2;
this.reqMats = {
"Plants": 1,
"Water": 0.2,
@ -715,7 +730,7 @@ Industry.prototype.init = function() {
this.hwFac = 0.2;
this.robFac = 0.25;
this.aiFac = 0.2;
this.advFac = 0.1;
this.advFac = 0.05;
this.reqMats = {
"Plants": 1,
"Energy": 0.5,
@ -729,7 +744,7 @@ Industry.prototype.init = function() {
this.hwFac = 0.15;
this.robFac = 0.25;
this.aiFac = 0.2;
this.advFac = 0.55;
this.advFac = 0.15;
this.reqMats = {
"Chemicals": 2,
"Energy": 1,
@ -744,7 +759,7 @@ Industry.prototype.init = function() {
this.sciFac = 0.65;
this.robFac = 0.4;
this.aiFac = 0.2;
this.advFac = 0.5;
this.advFac = 0.17;
this.reqMats = {
"Metal": 2.5,
"Energy": 1,
@ -756,7 +771,7 @@ Industry.prototype.init = function() {
this.reFac = 0.35;
this.sciFac = 0.7;
this.aiFac = 0.4;
this.advFac = 0.6;
this.advFac = 0.2;
this.hwFac = 0.2;
this.reqMats = {
"Hardware": 5,
@ -767,7 +782,7 @@ Industry.prototype.init = function() {
break;
case Industries.Software:
this.sciFac = 0.7;
this.advFac = 0.5;
this.advFac = 0.18;
this.hwFac = 0.25;
this.reFac = 0.1;
this.aiFac = 0.1;
@ -782,7 +797,10 @@ Industry.prototype.init = function() {
case Industries.Healthcare:
//reFac is unique for this bc it diminishes greatly per city. Handle this separately in code?
this.sciFac = 0.75;
this.advFac = 0.3;
this.advFac = 0.1;
this.hwFac = 0.1;
this.robFac = 0.1;
this.aiFac = 0.1;
this.reqMats = {
"Robots": 10,
"AICores": 5,
@ -794,7 +812,9 @@ Industry.prototype.init = function() {
case Industries.RealEstate:
this.robFac = 0.6;
this.aiFac = 0.6;
this.advFac = 0.65;
this.advFac = 0.25;
this.sciFac = 0.05;
this.hwFac = 0.05;
this.reqMats = {
"Metal": 20,
"Energy": 10,
@ -1027,18 +1047,7 @@ Industry.prototype.processMaterials = function(marketCycles=1, company) {
var mat = warehouse.materials[this.prodMats[0]];
//Calculate the maximum production of this material based
//on the office's productivity
var total = office.employeeProd[EmployeePositions.Operations] +
office.employeeProd[EmployeePositions.Engineer] +
office.employeeProd[EmployeePositions.Management], ratio;
if (total === 0) {
ratio = 0;
} else {
ratio = (office.employeeProd[EmployeePositions.Operations] / total) *
(office.employeeProd[EmployeePositions.Engineer] / total) *
(office.employeeProd[EmployeePositions.Management] / total);
ratio = Math.max(0.01, ratio); //Minimum ratio value if you have employees
}
var maxProd = 2 * ratio * Math.pow(total, 0.3), prod;
var maxProd = this.getOfficeProductivity(office) * this.prodMult * company.getProductionMultiplier(), prod;
if (mat.prdman[0]) {
//Production is manually limited
@ -1046,7 +1055,7 @@ Industry.prototype.processMaterials = function(marketCycles=1, company) {
} else {
prod = maxProd;
}
prod *= (SecsPerMarketCycle * marketCycles * this.prodMult * company.getProductionMultiplier()); //Convert production from per second to per market cycle
prod *= (SecsPerMarketCycle * marketCycles); //Convert production from per second to per market cycle
//Calculate net change in warehouse storage making
//the produced materials will cost
var totalMatSize = 0;
@ -1153,10 +1162,12 @@ Industry.prototype.processMaterials = function(marketCycles=1, company) {
markup = mat.bCost / sCost;
}
}
var businessFactor = 1 + (office.employeeProd[EmployeePositions.Business] / office.employeeProd["total"]);
var maxSell = (mat.qlt + .001) * mat.dmd * (100 - mat.cmp)/100 * markup * businessFactor *
Math.pow(this.awareness + 1, 0.05) * Math.pow(this.popularity + 1, 0.07) * company.getSalesMultiplier() *
(this.awareness === 0 ? 0.01 : Math.max((this.popularity + .001) / this.awareness, 0.01));
//var businessFactor = 1 + (office.employeeProd[EmployeePositions.Business] / office.employeeProd["total"]);
var businessFactor = this.getBusinessFactor(office); //Business employee productivity
var advertisingFactor = this.getAdvertisingFactors()[0]; //Awareness + popularity
var marketFactor = this.getMarketFactor(mat); //Competition + demand
var maxSell = (mat.qlt + .001) * marketFactor * markup * businessFactor *
company.getSalesMultiplier() * advertisingFactor;
var sellAmt;
if (mat.sllman[1] !== -1) {
@ -1286,18 +1297,7 @@ Industry.prototype.processProduct = function(marketCycles=1, product, corporatio
case "PRODUCTION":
//Calculate the maximum production of this material based
//on the office's productivity
var total = office.employeeProd[EmployeePositions.Operations] +
office.employeeProd[EmployeePositions.Engineer] +
office.employeeProd[EmployeePositions.Management], ratio;
if (total === 0) {
ratio = 0;
} else {
ratio = (office.employeeProd[EmployeePositions.Operations] / total) *
(office.employeeProd[EmployeePositions.Engineer] / total) *
(office.employeeProd[EmployeePositions.Management] / total);
ratio = Math.max(0.01, ratio); //Minimum ratio value if you have employees
}
var maxProd = ratio * Math.pow(total, 0.2) *
var maxProd = this.getOfficeProductivity(office, {forProduct:true}) *
corporation.getProductionMultiplier() * this.prodMult, prod;
//Account for whether production is manually limited
@ -1308,7 +1308,6 @@ Industry.prototype.processProduct = function(marketCycles=1, product, corporatio
}
prod *= (SecsPerMarketCycle * marketCycles);
//Calculate net change in warehouse storage making the Products will cost
var netStorageSize = product.siz;
for (var reqMatName in product.reqMats) {
@ -1370,10 +1369,12 @@ Industry.prototype.processProduct = function(marketCycles=1, product, corporatio
markup = markupLimit / (product.sCost - product.pCost);
}
}
var businessFactor = 1 + (office.employeeProd[EmployeePositions.Business] / office.employeeProd["total"]);
var maxSell = Math.pow(product.rat, 0.95) * product.dmd * (1-(product.cmp/100)) * corporation.getSalesMultiplier() *
markup * businessFactor * Math.pow(this.awareness + 1, 0.05) * Math.pow(this.popularity + 1, 0.07) *
(this.awareness === 0 ? 0.01 : Math.max((this.popularity + .001) / this.awareness, 0.01)) ;
//var businessFactor = 1 + (office.employeeProd[EmployeePositions.Business] / office.employeeProd["total"]);
var businessFactor = this.getBusinessFactor(office); //Business employee productivity
var advertisingFactor = this.getAdvertisingFactors()[0]; //Awareness + popularity
var marketFactor = this.getMarketFactor(product); //Competition + demand
var maxSell = Math.pow(product.rat, 0.9) * marketFactor * corporation.getSalesMultiplier() *
markup * businessFactor * advertisingFactor;
var sellAmt;
if (product.sllman[city][0] && product.sllman[city][1] > 0) {
//Sell amount is manually limited
@ -1444,6 +1445,51 @@ Industry.prototype.upgrade = function(upgrade, refs) {
}
}
//Returns how much of a material can be produced based of office productivity (employee stats)
Industry.prototype.getOfficeProductivity = function(office, params) {
var total = office.employeeProd[EmployeePositions.Operations] +
office.employeeProd[EmployeePositions.Engineer] +
office.employeeProd[EmployeePositions.Management], ratio;
if (total === 0) {
ratio = 0;
} else {
ratio = (office.employeeProd[EmployeePositions.Operations] / total) *
(office.employeeProd[EmployeePositions.Engineer] / total) *
(office.employeeProd[EmployeePositions.Management] / total);
ratio = Math.max(0.01, ratio); //Minimum ratio value if you have employees
}
if (params && params.forProduct) {
return ratio * Math.pow(total, 0.2);
} else {
return 2 * ratio * Math.pow(total, 0.3);
}
}
//Returns a multiplier based on the office' 'Business' employees that affects sales
Industry.prototype.getBusinessFactor = function(office) {
var ratioMult = 1;
if (office.employeeProd["total"] > 0) {
ratioMult = 1 + (office.employeeProd[EmployeePositions.Business] / office.employeeProd["total"]);
}
return ratioMult * Math.pow(1 + office.employeeProd[EmployeePositions.Business], 0.1);
}
//Returns a set of multipliers based on the Industry's awareness, popularity, and advFac. This
//multiplier affects sales. The result is:
// [Total sales mult, total awareness mult, total pop mult, awareness/pop ratio mult]
Industry.prototype.getAdvertisingFactors = function() {
var awarenessFac = Math.pow(this.awareness + 1, this.advFac);
var popularityFac = Math.pow(this.popularity + 1, this.advFac);
var ratioFac = (this.awareness === 0 ? 0.01 : Math.max((this.popularity + .001) / this.awareness, 0.01));
var totalFac = awarenessFac * popularityFac * ratioFac;
return [totalFac, awarenessFac, popularityFac, ratioFac];
}
//Returns a multiplier based on a materials demand and competition that affects sales
Industry.prototype.getMarketFactor = function(mat) {
return mat.dmd * (100 - mat.cmp)/100;
}
Industry.prototype.toJSON = function() {
return Generic_toJSON("Industry", this);
}
@ -1460,7 +1506,8 @@ var EmployeePositions = {
Business: "Business",
Management: "Management",
RandD: "Research & Development",
Unassigned:"Unassigned"
Training:"Training",
Unassigned:"Unassigned",
}
function Employee(params={}) {
@ -1499,6 +1546,15 @@ Employee.prototype.process = function(marketCycles=1, office) {
this.cha -= det;
}
//Training
var trainingEff = gain * Math.random();
if (this.pos === EmployeePositions.Training) {
//To increase creativity and intelligence special upgrades are needed
this.cha += trainingEff;
this.exp += trainingEff;
this.eff += trainingEff;
}
//Weight based on how full office is
//Too many employees = more likely to decrease energy and happiness
var officeCapacityWeight = 0.5 * (office.employees.length / office.size - 0.5);
@ -1544,6 +1600,7 @@ Employee.prototype.calculateProductivity = function(corporation) {
(0.5 * effEff);
break;
case EmployeePositions.Unassigned:
case EmployeePositions.Training:
prodMult = 0;
break;
default:
@ -1822,6 +1879,40 @@ OfficeSpace.prototype.hireEmployee = function(employee, parentRefs) {
yesNoTxtInpBoxCreate("Give your employee a nickname!");
}
OfficeSpace.prototype.hireRandomEmployee = function(parentRefs) {
var company = parentRefs.corporation, division = parentRefs.division;
if (document.getElementById("cmpy-mgmt-hire-employee-popup") != null) {return;}
//Generate three random employees (meh, decent, amazing)
var mult = getRandomInt(76, 100)/100;
var int = getRandomInt(50, 100),
cha = getRandomInt(50, 100),
exp = getRandomInt(50, 100),
cre = getRandomInt(50, 100),
eff = getRandomInt(50, 100),
sal = 2.2 * (int + cha + exp + cre + eff);
var emp = new Employee({
intelligence: int * mult,
charisma: cha * mult,
experience: exp * mult,
creativity: cre * mult,
efficiency: eff * mult,
salary: sal * mult,
});
var name = generateRandomString(7);
for (var i = 0; i < this.employees.length; ++i) {
if (this.employees[i].name === name) {
return this.hireRandomEmployee(parentRefs);
}
}
emp.name = name;
this.employees.push(emp);
company.displayDivisionContent(division, currentCityUi);
}
//Finds the first unassigned employee and assigns its to the specified job
OfficeSpace.prototype.assignEmployeeToJob = function(job) {
for (var i = 0; i < this.employees.length; ++i) {
@ -1970,8 +2061,26 @@ Warehouse.prototype.createUI = function(parentRefs) {
console.log("ERROR: Invalid state: " + industry.state);
break;
}
//Material ratio text for tooltip
var reqRatioText = "The exact requirements for production are:<br>";
for (var matName in industry.reqMats) {
if (industry.reqMats.hasOwnProperty(matName)) {
reqRatioText += (industry.reqMats[matName] + " " + matName + "<br>");
}
}
reqRatioText += "in order to create ";
if (industry.prodMats.length > 0) {
reqRatioText += "one of each produced Material (" + industry.prodMats.join(", ") + ") ";
if (industry.makesProducts) {
reqRatioText += "or to create one of its Products";
}
} else if (industry.makesProducts) {
reqRatioText += "one of its Products";
}
industryWarehousePanel.appendChild(createElement("p", {
innerHTML:reqText,
innerHTML:reqText, tooltipleft:reqRatioText
}));
//Materials
@ -2550,15 +2659,19 @@ var CorporationUnlockUpgrades = {
"This allows you to purchase exactly however many materials you need for production."],
//Displays each material/product's demand
"2": [2, 25e9, "Market Research - Demand",
"2": [2, 5e9, "Market Research - Demand",
"Mine and analyze market data to determine the demand of all resources. " +
"The demand attribute, which affects sales, will be displayed for every material and product."],
//Display's each material/product's competition
"3": [3, 25e9, "Market Data - Competition",
"3": [3, 5e9, "Market Data - Competition",
"Mine and analyze market data to determine how much competition there is on the market " +
"for all resources. The competition attribute, which affects sales, will be displayed for " +
"for every material and product."],
"4": [4, 10e9, "VeChain",
"Use AI and blockchain technology to identify where you can improve your supply chain systems. " +
"This upgrade will allow you to view a wide array of useful statistics about your " +
"Corporation."]
}
//Corporation Upgrades
@ -2656,11 +2769,24 @@ Corporation.prototype.getState = function() {
return this.state.getState();
}
var numMarketCyclesPersist = 1;
Corporation.prototype.process = function(numCycles=1) {
var corp = this;
this.storedCycles += numCycles;
if (this.storedCycles >= CyclesPerIndustryStateCycle) {
var state = this.getState(), marketCycles = 1;
var state = this.getState();
//Determine number of market cycles at the START state
if (state === "START") {
if (this.storedCycles >= 2*CyclesPerMarketCycle) {
//Enough cycles stored for 2+ market cycles
numMarketCyclesPersist = Math.floor(this.storedCycles / CyclesPerMarketCycle);
} else {
numMarketCyclesPersist = 1;
}
}
var marketCycles = numMarketCyclesPersist;
this.storedCycles -= (marketCycles * CyclesPerIndustryStateCycle);
this.divisions.forEach(function(ind) {
ind.process(marketCycles, state, corp);
@ -2694,13 +2820,13 @@ Corporation.prototype.process = function(numCycles=1) {
Corporation.prototype.determineValuation = function() {
var val, profit = (this.revenue.minus(this.expenses)).toNumber();
if (this.public) {
val = this.funds.toNumber() + (profit * 100e3);
val = this.funds.toNumber() + (profit * 90e3);
val *= (Math.pow(1.1, this.divisions.length));
val = Math.max(val, 0);
} else {
val = 10e9 + Math.max(this.funds.toNumber(), 0) / 3; //Base valuation
if (profit > 0) {
val += (profit * 400e3);
val += (profit * 350e3);
val *= (Math.pow(1.1, this.divisions.length));
} else {
val = 10e9 * Math.pow(1.1, this.divisions.length);
@ -2914,7 +3040,8 @@ var companyManagementDiv, companyManagementHeaderTabs, companyManagementPanel,
currentCityUi,
corporationUnlockUpgrades, corporationUpgrades,
industryOverviewPanel, industryOverviewText,
industryEmployeePanel, industryEmployeeText, industryEmployeeHireButton, industryEmployeeManagementUI, industryEmployeeInfo,
industryEmployeePanel, industryEmployeeText, industryEmployeeHireButton, industryEmployeeAutohireButton,
industryEmployeeManagementUI, industryEmployeeInfo, industryIndividualEmployeeInfo,
industryOfficeUpgradeSizeButton,
industryWarehousePanel,
headerTabs, cityTabs;
@ -3040,12 +3167,15 @@ Corporation.prototype.updateUIHeaderTabs = function() {
});
//Add industry types to selector
//Have Agriculture be first as recommended option
selector.add(createElement("option", {
text:Industries["Agriculture"], value:"Agriculture"
}))
for (var key in Industries) {
if (Industries.hasOwnProperty(key)) {
if (key !== "Agriculture" && Industries.hasOwnProperty(key)) {
var ind = Industries[key];
selector.add(createElement("option", {
text: ind,
value:key,
text: ind,value:key,
}));
}
}
@ -3147,19 +3277,17 @@ Corporation.prototype.displayCorporationOverviewContent = function() {
}
}
if (!hasHandbook) {
companyManagementPanel.appendChild(createElement("a", {
class:"a-link-button", innerText:"Get Handbook", display:"inline-block",
tooltip:"Get a copy of 'The Complete Handbook for Creating a Successful Corporation.'" +
"This is a .lit file that provides some tips/pointers for helping you get started with " +
"starting and managing a Corporation.",
clickListener:()=>{
homeComp.messages.push(handbookFn);
this.displayCorporationOverviewContent();
return false;
}
}));
}
companyManagementPanel.appendChild(createElement("a", {
class:"a-link-button", innerText:"Getting Started Guide", display:"inline-block",
tooltip:"Get a copy of and read 'The Complete Handbook for Creating a Successful Corporation.' " +
"This is a .lit file that guides you through the beginning of setting up a Corporation and " +
"provides some tips/pointers for helping you get started with managing it.",
clickListener:()=>{
if (!hasHandbook) {homeComp.messages.push(handbookFn);}
showLiterature(handbookFn);
return false;
}
}));
//Investors
if (this.public) {
@ -3180,7 +3308,7 @@ Corporation.prototype.displayCorporationOverviewContent = function() {
type:"number", placeholder:"Shares to sell", margin:"5px",
inputListener: ()=> {
var numShares = Math.round(input.value);
if (isNaN(numShares)) {
if (isNaN(numShares) || shares <= 0) {
profitIndicator.innerText = "ERROR: Invalid value entered for number of shares to sell"
} else if (numShares > this.numShares) {
profitIndicator.innerText = "You don't have this many shares to sell!";
@ -3194,7 +3322,7 @@ Corporation.prototype.displayCorporationOverviewContent = function() {
class:"a-link-button", innerText:"Sell shares", display:"inline-block",
clickListener:()=>{
var shares = Math.round(input.value);
if (isNaN(shares)) {
if (isNaN(shares) || shares <= 0) {
dialogBoxCreate("ERROR: Invalid value for number of shares");
} else if (shares > this.numShares) {
dialogBoxCreate("ERROR: You don't have this many shares to sell");
@ -3247,7 +3375,7 @@ Corporation.prototype.displayCorporationOverviewContent = function() {
inputListener: ()=> {
var numShares = Math.round(input.value);
//TODO add conditional for if player doesn't have enough money
if (isNaN(numShares)) {
if (isNaN(numShares) || shares <= 0) {
costIndicator.innerText = "ERROR: Invalid value entered for number of shares to buyback"
} else if (numShares > this.issuedShares) {
costIndicator.innerText = "There are not this many shares available to buy back. " +
@ -3263,7 +3391,7 @@ Corporation.prototype.displayCorporationOverviewContent = function() {
clickListener:()=>{
var shares = Math.round(input.value);
var tempStockPrice = this.sharePrice;
if (isNaN(shares)) {
if (isNaN(shares) || shares <= 0) {
dialogBoxCreate("ERROR: Invalid value for number of shares");
} else if (shares > this.issuedShares) {
dialogBoxCreate("ERROR: There are not this many oustanding shares to buy back");
@ -3572,13 +3700,18 @@ Corporation.prototype.displayDivisionContent = function(division, city) {
//Industry overview text
industryOverviewText = createElement("p", {});
industryOverviewPanel.appendChild(industryOverviewText);
industryOverviewPanel.appendChild(createElement("br", {}));
//Industry overview Purchases & Upgrades
var numUpgrades = Object.keys(IndustryUpgrades).length;
while (division.upgrades.length < numUpgrades) {division.upgrades.push(0);} //Backwards compatibility
var industryOverviewUpgrades = createElement("div", {});
industryOverviewUpgrades.appendChild(createElement("h1", {innerText:"Purchases & Upgrades", margin:"4px", padding:"4px"}));
industryOverviewUpgrades.appendChild(createElement("u", {
innerText:"Purchases & Upgrades", margin:"2px", padding:"2px",
fontSize:"14px",
}));
industryOverviewUpgrades.appendChild(createElement("br", {}));
for (var i = 0; i < numUpgrades; ++i) {
(function(i, corp, division, office) {
var upgrade = IndustryUpgrades[i.toString()];
@ -3765,10 +3898,10 @@ Corporation.prototype.displayDivisionContent = function(division, city) {
});
industryEmployeePanel.appendChild(industryEmployeeText);
//Hire Employee button
industryEmployeeHireButton = createElement("a", {
class:"a-link-button",
innerText:"Hire Employee",
display:"inline-block",
class:"a-link-button",display:"inline-block",
innerText:"Hire Employee", fontSize:"13px",
clickListener:()=>{
office.findEmployees({corporation:this, division:division});
return false;
@ -3776,9 +3909,24 @@ Corporation.prototype.displayDivisionContent = function(division, city) {
});
industryEmployeePanel.appendChild(industryEmployeeHireButton);
//Autohire Employee button
industryEmployeeAutohireButton = createElement("a", {
class:"a-link-button", display:"inline-block",
innerText:"Autohire Employee", fontSize:"13px",
tooltip:"Automatically hires an employee and gives him/her a random name",
clickListener:()=>{
office.hireRandomEmployee({corporation:this, division:division});
return false;
}
});
industryEmployeePanel.appendChild(industryEmployeeAutohireButton);
//Upgrade Office Size button
industryEmployeePanel.appendChild(createElement("br", {}));
industryOfficeUpgradeSizeButton = createElement("a", {
class:"a-link-button", innerText:"Upgrade Office size", display:"inline-block", margin:"6px",
class:"a-link-button", innerText:"Upgrade size",
display:"inline-block", margin:"6px", fontSize:"13px",
tooltip:"Upgrade the office's size so that it can hold more employees!",
clickListener:()=>{
var popupId = "cmpy-mgmt-upgrade-office-size-popup";
var upgradeCost = OfficeInitialCost * Math.pow(1.07, Math.round(office.size / OfficeInitialSize));
@ -3821,9 +3969,9 @@ Corporation.prototype.displayDivisionContent = function(division, city) {
industryEmployeePanel.appendChild(industryOfficeUpgradeSizeButton);
//Throw Office Party
industryEmployeePanel.appendChild(createElement("br",{}));
industryEmployeePanel.appendChild(createElement("a", {
class:"a-link-button", display:"inline-block", innerText:"Throw Office Party",
class:"a-link-button", display:"inline-block", innerText:"Throw Party",
fontSize:"13px",
tooltip:"Throw an office party to increase your employee's morale and happiness",
clickListener:()=>{
var popupId = "cmpy-mgmt-throw-office-party-popup";
@ -3884,6 +4032,7 @@ Corporation.prototype.displayDivisionContent = function(division, city) {
}));
industryEmployeeManagementUI = createElement("div", {});
industryEmployeeInfo = createElement("p", {margin:"4px", padding:"4px"});
if (empManualAssignmentModeActive) {
//Employees manually assigned
industryEmployeeManagementUI.appendChild(createElement("a", {
@ -3899,16 +4048,15 @@ Corporation.prototype.displayDivisionContent = function(division, city) {
}));
industryEmployeeManagementUI.appendChild(createElement("br", {}));
industryEmployeeInfo = createElement("div", {margin:"4px", padding:"4px"});
industryIndividualEmployeeInfo = createElement("div", {margin:"4px", padding:"4px"});
var selector = createElement("select", {
color: "white", backgroundColor:"black", margin:"4px", padding:"4px",
changeListener:()=>{
var name = selector.options[selector.selectedIndex].text;
for (var i = 0; i < office.employees.length; ++i) {
if (office.employees[i].name === name) {
removeChildrenFromElement(industryEmployeeInfo);
office.employees[i].createUI(industryEmployeeInfo, this);
removeChildrenFromElement(industryIndividualEmployeeInfo);
office.employees[i].createUI(industryIndividualEmployeeInfo, this);
return;
}
}
@ -3922,9 +4070,9 @@ Corporation.prototype.displayDivisionContent = function(division, city) {
selector.selectedIndex = -1;
industryEmployeeManagementUI.appendChild(selector);
industryEmployeeManagementUI.appendChild(industryEmployeeInfo);
industryEmployeeManagementUI.appendChild(selector);
industryEmployeeManagementUI.appendChild(industryIndividualEmployeeInfo);
} else {
//Player only manages the number of each occupation, not who gets what job
industryEmployeeManagementUI.appendChild(createElement("a", {
@ -3940,7 +4088,8 @@ Corporation.prototype.displayDivisionContent = function(division, city) {
industryEmployeeManagementUI.appendChild(createElement("br", {}));
var opCount = 0, engCount = 0, busCount = 0,
mgmtCount = 0, rndCount = 0, unassignedCount = 0;
mgmtCount = 0, rndCount = 0, unassignedCount = 0,
trainingCount = 0;
for (var i = 0; i < office.employees.length; ++i) {
switch (office.employees[i].pos) {
case EmployeePositions.Operations:
@ -3955,6 +4104,8 @@ Corporation.prototype.displayDivisionContent = function(division, city) {
++rndCount; break;
case EmployeePositions.Unassigned:
++unassignedCount; break;
case EmployeePositions.Training:
++trainingCount; break;
default:
console.log("ERROR: Unrecognized employee position: " + office.employees[i].pos);
break;
@ -3969,19 +4120,25 @@ Corporation.prototype.displayDivisionContent = function(division, city) {
industryEmployeeManagementUI.appendChild(createElement("br", {}));
//General display of employee information (avg morale, avg energy, etc.)
industryEmployeeInfo = createElement("p", {margin:"4px", padding:"4px"});
industryEmployeeManagementUI.appendChild(industryEmployeeInfo);
industryEmployeeManagementUI.appendChild(createElement("br", {}));
var positions = [EmployeePositions.Operations, EmployeePositions.Engineer,
EmployeePositions.Business, EmployeePositions.Management,
EmployeePositions.RandD];
var counts = [opCount, engCount, busCount, mgmtCount, rndCount];
EmployeePositions.RandD, EmployeePositions.Training];
var descriptions = ["Manages supply chain operations. Improves production.", //Operations
"Develops and maintains products and production systems. Improves production.", //Engineer
"Handles sales and finances. Improves sales.", //Business
"Leads and oversees employees and office operations. Improves production.", //Management
"Research new innovative ways to improve the company. Generates Scientific Research", //RandD
"Set employee to training, which will increase some of their stats. Employees in training do not affect any company operations."] //Training
var counts = [opCount, engCount, busCount, mgmtCount, rndCount, trainingCount];
for (var i = 0; i < positions.length; ++i) {
(function(corp, i) {
var info = createElement("h2", {
display:"inline-block", width:"40%",
innerText: positions[i] + "(" + counts[i] + ")"
display:"inline-block", width:"40%", fontSize:"15px",
innerText: positions[i] + "(" + counts[i] + ")",
tooltipleft: descriptions[i]
});
var plusBtn = createElement("a", {
class: unassignedCount > 0 ? "a-link-button" : "a-link-button-inactive",
@ -4040,13 +4197,30 @@ Corporation.prototype.updateDivisionContent = function(division) {
console.log("ERROR: Invalid 'division' argument in Corporation.updateDivisionContent");
return;
}
var vechain = (this.unlockUpgrades[4] === 1);
//Industry Overview Text
var profit = division.lastCycleRevenue.minus(division.lastCycleExpenses).toNumber(),
profitStr = profit >= 0 ? numeral(profit).format("$0.000a") : "-" + numeral(-1 * profit).format("$0.000a");
var advertisingInfo = "";
if (vechain) {
var advertisingFactors = division.getAdvertisingFactors();
var awarenessFac = advertisingFactors[1];
var popularityFac = advertisingFactors[2];
var ratioFac = advertisingFactors[3];
var totalAdvertisingFac = advertisingFactors[0];
advertisingInfo =
"<p class='tooltip'>Advertising Multiplier: x" + formatNumber(totalAdvertisingFac, 3) +
"<span class='tooltiptext' style='font-size:12px'>Total multiplier for this industry's sales due to its awareness and popularity<br>" +
"Awareness Bonus: x" + formatNumber(awarenessFac, 3) + "<br>" +
"Popularity Bonus: x" + formatNumber(popularityFac, 3) + "<br>" +
"Ratio Multiplier: x" + formatNumber(ratioFac, 3) + "</span></p><br>"
}
industryOverviewText.innerHTML =
"Industry: " + division.type + "<br><br>" +
"Awareness: " + formatNumber(division.awareness, 3) + "<br>" +
"Popularity: " + formatNumber(division.popularity, 3) + "<br><br>" +
"Popularity: " + formatNumber(division.popularity, 3) + "<br>" +
advertisingInfo + "<br>" +
"Revenue: " + numeral(division.lastCycleRevenue.toNumber()).format("$0.000a") + " / s<br>" +
"Expenses: " + numeral(division.lastCycleExpenses.toNumber()).format("$0.000a") + " /s<br>" +
"Profit: " + profitStr + " / s<br><br>" +
@ -4065,30 +4239,51 @@ Corporation.prototype.updateDivisionContent = function(division) {
"Size: " + office.employees.length + " / " + office.size + " employees";
if (office.employees.length >= office.size) {
industryEmployeeHireButton.className = "a-link-button-inactive";
industryEmployeeAutohireButton.className = "a-link-button-inactive tooltip";
} else {
industryEmployeeHireButton.className = "a-link-button";
industryEmployeeAutohireButton.className = "a-link-button tooltip";
}
if (!empManualAssignmentModeActive) {
//Calculate average morale, happiness, and energy
var totalMorale = 0, totalHappiness = 0, totalEnergy = 0,
avgMorale = 0, avgHappiness = 0, avgEnergy = 0;
for (var i = 0; i < office.employees.length; ++i) {
totalMorale += office.employees[i].mor;
totalHappiness += office.employees[i].hap;
totalEnergy += office.employees[i].ene;
}
if (office.employees.length > 0) {
avgMorale = totalMorale / office.employees.length;
avgHappiness = totalHappiness / office.employees.length;
avgEnergy = totalEnergy / office.employees.length;
}
industryEmployeeInfo.innerHTML =
"Avg Employee Morale: " + formatNumber(avgMorale, 3) + "<br>" +
"Avg Employee Happiness: " + formatNumber(avgHappiness, 3) + "<br>" +
"Avg Employee Energy: " + formatNumber(avgEnergy, 3);
//Employee Overview stats
//Calculate average morale, happiness, and energy
var totalMorale = 0, totalHappiness = 0, totalEnergy = 0,
avgMorale = 0, avgHappiness = 0, avgEnergy = 0;
for (var i = 0; i < office.employees.length; ++i) {
totalMorale += office.employees[i].mor;
totalHappiness += office.employees[i].hap;
totalEnergy += office.employees[i].ene;
}
if (office.employees.length > 0) {
avgMorale = totalMorale / office.employees.length;
avgHappiness = totalHappiness / office.employees.length;
avgEnergy = totalEnergy / office.employees.length;
}
industryEmployeeInfo.innerHTML =
"Avg Employee Morale: " + formatNumber(avgMorale, 3) + "<br>" +
"Avg Employee Happiness: " + formatNumber(avgHappiness, 3) + "<br>" +
"Avg Employee Energy: " + formatNumber(avgEnergy, 3);
if (vechain) { //VeChain - Statistics
industryEmployeeInfo.appendChild(createElement("br", {}));
industryEmployeeInfo.appendChild(createElement("p", {
innerText:"Material Production: " + formatNumber(division.getOfficeProductivity(office), 3),
tooltip: "The base amount of material this office can produce. Does not include " +
"production multipliers from upgrades and materials. This value is based off " +
"the productivity of your Operations, Engineering, and Management employees"
}));
industryEmployeeInfo.appendChild(createElement("br", {}));
industryEmployeeInfo.appendChild(createElement("p", {
innerText:"Product Production: " + formatNumber(division.getOfficeProductivity(office, {forProduct:true}), 3),
tooltip: "The base amount of any given Product this office can produce. Does not include " +
"production multipliers from upgrades and materials. This value is based off " +
"the productivity of your Operations, Engineering, and Management employees"
}));
industryEmployeeInfo.appendChild(createElement("br", {}));
industryEmployeeInfo.appendChild(createElement("p", {
innerText: "Business Multiplier: x" + formatNumber(division.getBusinessFactor(office), 3),
tooltip: "The effect this office's 'Business' employees has on boosting sales"
}));
}
//Warehouse
var warehouse = division.warehouses[currentCityUi];
@ -4140,8 +4335,10 @@ Corporation.prototype.clearUI = function() {
industryEmployeePanel = null;
industryEmployeeText = null;
industryEmployeeHireButton = null;
industryEmployeeAutohireButton = null;
industryEmployeeManagementUI = null;
industryEmployeeInfo = null;
industryIndividualEmployeeInfo = null;
industryOfficeUpgradeSizeButton = null;

@ -1,5 +1,5 @@
let CONSTANTS = {
Version: "0.34.4",
Version: "0.34.5",
//Max level for any skill, assuming no multipliers. Determined by max numerical value in javascript for experience
//and the skill level formula in Player.js. Note that all this means it that when experience hits MAX_INT, then
@ -380,9 +380,9 @@ let CONSTANTS = {
"the execution of a script is when it saves/loads. </strong><br><br>",
TutorialNetscriptText: "Netscript is a programming language implemented for this game. The language has " +
"your basic programming constructs and several built-in commands that are used to hack. <br><br>" +
"<u><h1>Official Wiki and Documentation</h1></u><br>" +
"<a href='https://bitburner.wikia.com/wiki/Netscript' target='_blank'>Check out Bitburner's wiki for the official Netscript documentation</a>" +
". The wiki documentation will contain more details and " +
"<u><h1>Official Documentation</h1></u><br>" +
"<a href='https://bitburner.readthedocs.io/en/latest/index.html' target='_blank'>Check out Bitburner's official Netscript documentation</a>" +
". This official documentation will contain more details and " +
"code examples than this documentation page. Also, it can be opened up in another tab/window for convenience!<br><br>" +
"<u><h1> Variables and data types </h1></u><br>" +
"The following data types are supported by Netscript: <br>" +
@ -440,13 +440,10 @@ let CONSTANTS = {
"either the IP or hostname of the server you want to hack. The runtime for this command depends on your hacking level and the target server's security level. " +
" A script can hack a server from anywhere. It does not need to be running on the same server to hack that server. " +
"For example, you can create a script that hacks the 'foodnstuff' server and run that script on any server in the game. A successful hack() on " +
"a server will raise that server's security level by 0.002. Returns true if the hack is successful and " +
"false otherwise. <br>" +
"a server will raise that server's security level by 0.002. Returns the amount of money stolen if the hack is successful and " +
"0 if the hack fails. <br>" +
"Examples: hack('foodnstuff'); or hack('148.192.0.12');<br><br>" +
"<i><u>sleep(n, log=true)</u></i><br>Suspends the script for n milliseconds. The second argument is an optional boolean that indicates " +
"whether or not the function should log the sleep action. If this argument is true, then calling this function will write " +
"'Sleeping for N milliseconds' to the script's logs. If it's false, then this function will not log anything. " +
"If this argument is not specified then it will be true by default. <br>Example: sleep(5000);<br><br>" +
"<i><u>sleep(n)</u></i><br>Suspends the script for n milliseconds.<br>Example: sleep(5000);<br><br>" +
"<i><u>grow(hostname/ip)</u></i><br>Use your hacking skills to increase the amount of money available on a server. The argument passed in " +
"must be a string with either the IP or hostname of the target server. The runtime for this command depends on your hacking level and the target server's security level. " +
"When grow() completes, the money available on a target server will be increased by a certain, fixed percentage. This percentage " +
@ -466,6 +463,13 @@ let CONSTANTS = {
"<i><u>print(x)</u></i><br>Prints a value or a variable to the scripts logs (which can be viewed with the 'tail [script]' terminal command ). <br><br>" +
"<i><u>tprint(x)</u></i><br>Prints a value or a variable to the Terminal<br><br>" +
"<i><u>clearLog()</u></i><br>Clears the script's logs. <br><br>" +
"<i><u>disableLog(fn)</u></i><br>Disables logging for the given function. Logging can be disabled for every function " +
"by passing 'ALL' as an argument.<br><br>" +
"Note that this does not completely remove all logging functionality. This only stops a function from logging " +
"when the function is successful. If the function fails, it will still log the reason for failure.<br><br>" +
"Notable functions that cannot have their logs disabled: run, exec, exit<br><br>" +
"<i><u>enableLog(fn)</u></i><br>Re-enables logging for the given function. If 'ALL' is passed into this function " +
"as an argument, then it will revert the effects of disableLog('ALL')<br><br>" +
"<i><u>scan(hostname/ip, [hostnames=true])</u></i><br>Returns an array containing the hostnames or IPs of all servers that are one node away from the specified server. " +
"The argument must be a string containing the IP or hostname of the target server. The second argument is a boolean that specifies whether " +
"the hostnames or IPs of the scanned servers should be output. If it is true then hostnames will be returned, and if false then IP addresses will. " +
@ -526,8 +530,8 @@ let CONSTANTS = {
"kill('foo.script', getHostname());<br><br>" +
"If you are trying to kill a script named 'foo.script' on the current server that was ran with the arguments 1 and 'foodnstuff', use this:<br><br>" +
"kill('foo.script', getHostname(), 1, 'foodnstuff');<br><br>" +
"<i><u>killall(hostname/ip)</u></i><br> Kills all running scripts on the specified server. This function takes a single argument which " +
"must be a string containing the hostname or IP of the target server. This function will always return true. <br><br>" +
"<i><u>killall(hostname/ip)</u></i><br>Kills all running scripts on the specified server. This function takes a single argument which " +
"must be a string containing the hostname or IP of the target server. This function returns true if any scripts were killed, and false otherwise.<br><br>" +
"<i><u>exit()</u></i><br>Terminates the script immediately<br><br>" +
"<i><u>scp(script, [source], destination)</u></i><br>Copies a script or literature (.lit) file to another server. The first argument is a string with " +
"the filename of the script or literature file " +
@ -651,7 +655,6 @@ let CONSTANTS = {
"<i><u>getPurchasedServers([hostname=true])</u></i><br>Returns an array with either the hostname or IPs of all of the servers you " +
"have purchased. It takes an optional parameter specifying whether the hostname or IP addresses will be returned. If this " +
"parameter is not specified, it is true by default and hostnames will be returned<br><br>" +
"<i><u>round(n)</u></i><br>Rounds the number n to the nearest integer. If the argument passed in is not a number, then the function will return 0.<br><br>" +
"<i><u>write(port/fn, data='', mode='a')</u></i><br>This function can be used to either write data to a port or to a text file (.txt).<br><br>" +
"If the first argument is a number between 1 and 10, then it specifies a port and this function will write data to a port. If the second " +
"argument is not specified then it will write an empty string to the port. The third argument, mode, is not used when writing data to a port.<br><br>" +
@ -667,6 +670,9 @@ let CONSTANTS = {
"then the string 'NULL PORT DATA' will be returned.<br><br>" +
"If the first argument is a string, then it specifies the name of a text file and this function will return the data in the " +
"specified text file. If the text file does not exist, an empty string will be returned<br><br>" +
"<i><u>peek(port)</u></i><br>This function is used to peek data from a port. It returns the first element from the specified " +
"Netscript Port without removing that element. If the port is empty, then the string 'NULL PORT DATA' will be returned.<br><br>" +
"The argument must be an integer between 1 and 10.<br><br>" +
"<i><u>clear(port/fn)</u></i><br>This function is used to clear a Netscript Port or a text file.<br><br>" +
"It takes a single argument. If this argument is a number between 1 and 10, then it specifies a port and will clear it (deleting all data from it). " +
"If the argument is a string, then it specifies the name of a text file (.txt) and will clear the text file so that it is empty.<br><br>" +
@ -1129,20 +1135,38 @@ let CONSTANTS = {
"World Stock Exchange account and TIX API Access<br>",
LatestUpdate:
"v0.34.4<br>" +
"-Added several new features to Gang UI to make it easier to manage your Gang.<br>" +
"-Changed the Gang Member upgrade mechanic. Now, rather than only being able to have " +
"one weapon/armor/vehicle/etc., you can purchase all the upgrades for each Gang member " +
"and their multipliers will stack. To balance this out, the effects (AKA multipliers) of each Gang member upgrade " +
"were reduced.<br>" +
"-Added a new script editor option: Max Error Count. This affects how many approximate lines the script editor will " +
"process (JSHint) for common errors. Increase this option can affect performance<br>" +
"-Game theme colors (set using 'theme' Terminal command) are now saved when re-opening the game<br>" +
"-'download' Terminal command now works on scripts<br>" +
"-Added stopAction() Singularity function and the spawn() Netscript function<br>" +
"-The 'Purchase Augmentations' UI screen will now tell you if you need a certain prerequisite for Augmentations.<br>" +
"-Augmentations with prerequisites can now be purchased as long as their prerequisites are puchased (" +
"before, you had to actually install the prerequisites before being able to purchase)<br>"
"v0.34.5<br>" +
"-Corporation Management Changes:<br>" +
"---Market Research unlocks are now cheaper<br>" +
"---New 'VeChain' upgrade: displays useful statistics about Corporation<br>" +
"---Corporation cycles are processed 25% faster<br>" +
"---Corporation valuation was lowered by ~10% (this affects stock price and investments)<br>" +
"---Rebalanced the effects of advertising. Should now be more effective for every Industry<br>" +
"---Fixed several bugs/exploits involving selling and buying back stock shares<br>" +
"---You will now receive a Corporation Handbook (.lit file) when starting out BitNode-3. It contains a brief guide to help you get started. " +
"This same handbook can be viewed from the Corporation management screen<br>" +
"---Slightly decreased the amount by which a Product's sell price can be marked up<br>" +
"---Employees can now be assigned to a 'Training' task, during which they will slowly increase several of their stats<br>" +
"-Hopefully fixed an exploit with Array.forEach(). If there are any issues with using forEach, let me know<br>" +
"-Arguments passed into a script are now passed by value. This means modifying the 'args' array in a script " +
"should no longer cause issues<br>" +
"-Scripts executed programatically (via run(), exec(), etc.) will now fail if null/undefined is passed in " +
"as an argument<br>" +
"-Added peek() Netscript function<br>" +
"-killall() Netscript function now returns true if any scripts were killed, and false otherwise.<br>" +
"-hack() Netscript function now returns the amount of money gained for successful hacks, and 0 for failed hacks<br>" +
"-scp Terminal command and Netscript function now work for txt files<br>" +
"-Changes courtesy of Wraithan:<br>" +
"---Text files are now displayed using 'pre' rather than 'p' elements when using the 'cat' Terminal command. " +
"This means tabs are retained and lines don't automatically wrap<br>" +
"---ls() Netscript function now returns text files as well<br>" +
"-Removed round() Netscript function, since you can just use Math.round() instead<br>" +
"-Added disableLog() and enableLog() Netscript functions<br>" +
"-Removed the 'log' argument from sleep(), since you can now use the new disableLog function<br>" +
"-'Netscript Documentation' button on script editor now points to new readthedocs documentation rather than wiki<br>" +
"-When working for a faction, your current faction reputation is now displayed<br>" +
"-Bug Fix: Hacking Missions should no longer break when dragging an existing connection to another Node<br>" +
"-Bug Fix: Fixed RAM usage of getNextHacknetNodeCost() (is not 1.5GB instead of 4GB)<br>"
}
export {CONSTANTS};

@ -4,7 +4,7 @@ let TerminalHelpText =
'alias [-g] [name="value"] Create or display Terminal aliases<br>' +
"analyze Get information about the current machine <br>" +
"buy [-l/program] Purchase a program through the Dark Web<br>" +
"cat [file] Display a .msg or .lit file<br>" +
"cat [file] Display a .msg, .lit, or .txt file<br>" +
"check [script] [args...] Print a script's logs to Terminal<br>" +
"clear Clear all text on the terminal <br>" +
"cls See 'clear' command <br>" +
@ -27,7 +27,7 @@ let TerminalHelpText =
"run [name] [-t] [n] [args...] Execute a program or script<br>" +
"scan Prints all immediately-available network connections<br>" +
"scan-analyze [d] [-a] Prints info for all servers up to <i>d</i> nodes away<br>" +
"scp [file] [server] Copies a script or .lit file to a destination server<br>" +
"scp [file] [server] Copies a file to a destination server<br>" +
"sudov Shows whether you have root access on this computer<br>" +
"tail [script] [args...] Displays dynamic logs for the specified script<br>" +
"theme [preset] | bg txt hlgt Change the color scheme of the UI<br>" +
@ -65,10 +65,10 @@ let HelpTexts = {
"dark web to the Terminal, as well as their costs.<br><br>" +
"Otherwise, the name of the program must be passed in as a parameter. This is name is NOT case-sensitive.",
cat: "cat [file]<br>" +
"Display message files, which are files ending with the '.msg' extension, or a literature file, which " +
"are files ending with the '.lit' extension. Examples:<br><br>" +
"Display message (.msg), literature (.lit), or text (.txt) files. Examples:<br><br>" +
"cat j1.msg<br>" +
"cat foo.lit",
"cat foo.lit<br>" +
"cat servers.txt",
check: "check [script name] [args...]<br>" +
"Print the logs of the script specified by the script name and arguments to the Terminal. Each argument must be separated by " +
"a space. Remember that a running script is uniquely " +
@ -171,7 +171,8 @@ let HelpTexts = {
"-a flag at the end of the command if you would like to enable that.",
scp: "scp [filename] [target server]<br>" +
"Copies the specified file from the current server to the target server. " +
"This command only works for script files (.script extension) and literature files (.lit extension). " +
"This command only works for script files (.script extension), literature files (.lit extension), " +
"and text files (.txt extension). " +
"The second argument passed in must be the hostname or IP of the target server.",
sudov: "sudov<br>" +
"Prints whether or not you have root access to the current machine",

@ -41,17 +41,51 @@ function initLiterature() {
title = "The Complete Handbook for Creating a Successful Corporation";
fn = "corporation-management-handbook.lit";
txt = "This is a brief collection of tips/pointers on how to successfully start and manage a Corporation.<br><br>" +
"-Purchasing Hardware, Robots, AI Cores, and Real Estate can potentially increase your production. " +
"The effects of these depend on what industry you are in.<br><br>" +
"-In order to optimize your production, you will need a good balance of Operators, Managers, and Engineers<br><br>" +
"-Different employees excel in different jobs. For example, the highly intelligent employees will probably do best " +
"if they are assigned to do Engineering work or Research & Development.<br><br>" +
"-If your employees have low morale, energy, or happiness, their production will greatly suffer.<br><br>" +
"-Tech is important, but don't neglect sales! Having several Businessmen can boost your sales and your bottom line.<br><br>" +
"-Don't forget to advertise your company. You won't have any business if nobody knows you.<br><br>" +
"-Having company awareness is great, but what's really important is your company's popularity. Try to keep " +
"your popularity as high as possible to see the biggest benefit for your sales<br><br>";
txt = "<u>Getting Started with Corporations</u><br>" +
"To get started, visit the City Hall in Sector-12 in order to create a Corporation. This requires " +
"$150b of your own money, but this $150b will get put into your Corporation's funds. " +
"After creating your Corporation, you will see it listed as one of the locations in the city. Click on " +
"your Corporation in order to manage it.<br><br>" +
"Your Corporation can have many different divisions, each in a different Industry. There are many different " +
"types of Industries, each with different properties. To create your first division, click the " +
"'Expand into new Industry' button at the top of the management UI. The Agriculture " +
"and Software industries are recommended for your first division.<br><br>" +
"The first thing you'll need to do is hire some employees. Employees can be assigned to five different positions. " +
"Each position has a different effect on various aspects of your Corporation. It is recommended to have at least " +
"one employee at each position.<br><br>" +
"Each industry uses some combination of Materials in order to produce other Materials and/or create Products. " +
"Specific information about this is displayed in each of your divisions' UI.<br><br>" +
"Products are special, industry-specific objects. They are different than Materials because you " +
"must manually choose to develop them, and you can choose to develop any number of Products. Developing " +
"a Product takes time, but a Product typically generates significantly more revenue than any Material. " +
"Not all industries allow you to create Products. To create a Product, look for a button " +
"in the top-left panel of the division UI (e.g. For the Software Industry, the button says 'Develop Software').<br><br>" +
"To get your supply chain system started, " +
"purchase the Materials that your industry needs to produce other Materials/Products. This can be done " +
"by clicking the 'Buy' button next to the corresponding Material(s). After you have the required Materials, " +
"you will immediately start production. The amount of Materials/Products you produce is based on a variety of factors, " +
"one of which is your employees and their productivity.<br><br>" +
"Once you start producing Materials/Products, you can sell them in order to start earning revenue. This can be done " +
"by clicking the 'Sell' button next to the corresponding Material or Product. The amount of Material/Product you sell is dependent " +
"on a wide variety of different factors.<br><br>" +
"These are the basics of getting your Corporation up and running! Now, you can start purchasing upgrades to improve " +
"your bottom line. If you need money, consider looking for seed investors, who will give you money in exchange for stock shares. " +
"Otherwise, once you feel you are ready, take your Corporation public! Once your Corporation goes public, you can no longer " +
"find investors. Instead, your Corporation will be publicly traded and its stock price will change based on how well " +
"it's performing financially. You can then sell your stock shares in order to make money.<br><br>" +
"<u>Tips/Pointers</u><br>" +
"-Purchasing Hardware, Robots, AI Cores, and Real Estate can potentially increase your production. " +
"The effects of these depend on what industry you are in.<br><br>" +
"-In order to optimize your production, you will need a good balance of Operators, Managers, and Engineers<br><br>" +
"-Different employees excel in different jobs. For example, the highly intelligent employees will probably do best " +
"if they are assigned to do Engineering work or Research & Development.<br><br>" +
"-If your employees have low morale, energy, or happiness, their production will greatly suffer.<br><br>" +
"-Tech is important, but don't neglect sales! Having several Businessmen can boost your sales and your bottom line.<br><br>" +
"-Don't forget to advertise your company. You won't have any business if nobody knows you.<br><br>" +
"-Having company awareness is great, but what's really important is your company's popularity. Try to keep " +
"your popularity as high as possible to see the biggest benefit for your sales<br><br>" +
"-Remember, you need to spend money to make money!<br><br>" +
"-Corporations do not reset when installing Augmentations, but they do reset when destroying a BitNode";
Literatures[fn] = new Literature(title, fn, txt);
title = "A Green Tomorrow";

@ -1162,14 +1162,16 @@ HackingMission.prototype.processNode = function(nodeObj, numCycles=1) {
var targetNode = null, def, atk;
if (nodeObj.conn) {
var targetNode;
if (nodeObj.conn.target) {
if (nodeObj.conn.target != null) {
targetNode = this.getNodeFromElement(nodeObj.conn.target);
} else {
targetNode = this.getNodeFromElement(nodeObj.conn.targetId);
}
if (targetNode.plyrCtrl) {
if (targetNode == null) {
//Player is in the middle of dragging the connection,
//so the target node is null. Do nothing here
} else if (targetNode.plyrCtrl) {
def = this.playerDef;
atk = this.enemyAtk;
} else if (targetNode.enmyCtrl) {
@ -1186,17 +1188,20 @@ HackingMission.prototype.processNode = function(nodeObj, numCycles=1) {
var enmyHacking = this.difficulty * CONSTANTS.HackingMissionDifficultyToHacking;
switch(nodeObj.action) {
case NodeActions.Attack:
if (targetNode == null) {break;}
if (nodeObj.conn == null) {break;}
var dmg = this.calculateAttackDamage(atk, def, plyr ? Player.hacking_skill : enmyHacking);
targetNode.hp -= (dmg/5 * numCycles);
break;
case NodeActions.Scan:
if (targetNode == null) {break;}
if (nodeObj.conn == null) {break;}
var eff = this.calculateScanEffect(atk, def, plyr ? Player.hacking_skill : enmyHacking);
targetNode.def -= (eff/5 * numCycles);
calcStats = true;
break;
case NodeActions.Weaken:
if (targetNode == null) {break;}
if (nodeObj.conn == null) {break;}
var eff = this.calculateWeakenEffect(atk, def, plyr ? Player.hacking_skill : enmyHacking);
targetNode.atk -= (eff/5 * numCycles);

@ -75,19 +75,6 @@ Environment.prototype = {
}
return res[idx[idx.length-1]] = value;
},
/*
setArrayElement: function(name, idx, value) {
var scope = this.lookup(name);
if (!scope && this.parent) {
console.log("Here");
throw new Error("Undefined variable " + name);
}
var arr = (scope || this).vars[name];
if (!(arr.constructor === Array || arr instanceof Array)) {
throw new Error("Variable is not an array: " + name);
}
return (scope || this).vars[name][idx] = value;
},*/
//Creates (or overwrites) a variable in the current scope
def: function(name, value) {

@ -27,7 +27,6 @@ Promise.config({
* Returns a promise
*/
function evaluate(exp, workerScript) {
/* return new Promise(function(resolve, reject) {*/
return Promise.delay(Settings.CodeInstructionRunTime).then(function() {
var env = workerScript.env;
if (env.stopFlag) {return Promise.reject(workerScript);}
@ -139,6 +138,13 @@ function evaluate(exp, workerScript) {
} else if (exp.callee.type == "MemberExpression"){
return evaluate(exp.callee.object, workerScript).then(function(object) {
try {
if (func === "NETSCRIPTFOREACH") {
return evaluateForeach(object, args, workerScript).then(function(res) {
return Promise.resolve(res);
}).catch(function(e) {
return Promise.reject(e);
});
}
var res = func.apply(object,args);
return Promise.resolve(res);
} catch (e) {
@ -187,6 +193,9 @@ function evaluate(exp, workerScript) {
if (exp.property.name === "constructor") {
return Promise.reject(makeRuntimeRejectMsg(workerScript, "Illegal usage of constructor() method. If you have your own function named 'constructor', you must re-name it."));
}
if (object != null && object instanceof Array && exp.property.name === "forEach") {
return "NETSCRIPTFOREACH";
}
try {
return Promise.resolve(object[exp.property.name])
} catch (e) {
@ -537,35 +546,43 @@ function evaluateFor(exp, workerScript) {
}
recurse();
});
/*
return evaluate(exp.test, workerScript).then(function(resCond) {
if (resCond) {
//Execute code (body), update, and then recurse
return evaluate(exp.body, workerScript).then(function(resCode) {
return evaluate(exp.update, workerScript);
}).catch(function(e) {
if (e == "CONTINUESTATEMENT" ||
(e instanceof WorkerScript && e.errorMessage == "CONTINUESTATEMENT")) {
//Continue statement, recurse to next iteration
return evaluate(exp.update, workerScript).then(function(resPostloop) {
return evaluateFor(exp, workerScript);
}).then(function(foo) {
return Promise.resolve("endForLoop");
}).catch(function(e) {
return Promise.reject(e);
});
} else {
return Promise.reject(e);
}
}).then(function(resPostloop) {
return evaluateFor(exp, workerScript);
}).then(function(foo) {
return Promise.resolve("endForLoop");
});
} else {
return Promise.resolve("endForLoop"); //Doesn't need to resolve to any particular value
}
function evaluateForeach(arr, args, workerScript) {
console.log("evaluateForeach called");
if (!(arr instanceof Array)) {
return Promise.reject("Invalid array passed into forEach");
}
if (!(args instanceof Array) && args.length != 1) {
return Promise.reject("Invalid argument passed into forEach");
}
var func = args[0];
if (typeof func !== "function") {
return Promise.reject("Invalid function passed into forEach");
}
console.log(func);
return new Promise(function(resolve, reject) {
//Don't return a promise so the promise chain is broken on each recursion
function recurse(i) {
console.log("recurse() called with i: " + i);
if (i >= arr.length) {
resolve();
} else {
return Promise.delay(Settings.CodeInstructionRunTime).then(function() {
console.log("About to apply function");
var res = func.apply(null, [arr[i]]);
console.log("Applied function");
++i;
Promise.resolve(res).then(function(val) {
recurse(i);
}, reject).catch(function(e) {
return Promise.reject(e);
});
});
}
}
});*/
recurse(0);
});
}
function evaluateWhile(exp, workerScript) {
@ -703,6 +720,14 @@ function runScriptFromScript(server, scriptname, args, workerScript, threads=1)
return Promise.resolve(false);
}
//'null/undefined' arguments are not allowed
for (var i = 0; i < args.length; ++i) {
if (args[i] == null) {
workerScript.scriptRef.log("ERROR: Cannot execute a script with null/undefined as an argument");
return Promise.resolve(false);
}
}
//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) {

@ -128,7 +128,9 @@ function NetscriptFunctions(workerScript) {
}
out.push(entry);
}
workerScript.scriptRef.log('scan() returned ' + server.serversOnNetwork.length + ' connections for ' + server.hostname);
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.scan == null) {
workerScript.scriptRef.log('scan() returned ' + server.serversOnNetwork.length + ' connections for ' + server.hostname);
}
return out;
},
hack : function(ip){
@ -165,8 +167,9 @@ function NetscriptFunctions(workerScript) {
throw makeRuntimeRejectMsg(workerScript, "Cannot hack this server (" + server.hostname + ") because user's hacking skill is not high enough");
}
workerScript.scriptRef.log("Attempting to hack " + ip + " in " + hackingTime.toFixed(3) + " seconds (t=" + threads + ")");
//console.log("Hacking " + server.hostname + " after " + hackingTime.toString() + " seconds (t=" + threads + ")");
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.hack == null) {
workerScript.scriptRef.log("Attempting to hack " + ip + " in " + hackingTime.toFixed(3) + " seconds (t=" + threads + ")");
}
return netscriptDelay(hackingTime* 1000, workerScript).then(function() {
if (workerScript.env.stopFlag) {return Promise.reject(workerScript);}
var hackChance = scriptCalculateHackingChance(server);
@ -192,26 +195,28 @@ function NetscriptFunctions(workerScript) {
workerScript.scriptRef.recordHack(server.ip, moneyGained, threads);
Player.gainHackingExp(expGainedOnSuccess);
workerScript.scriptRef.onlineExpGained += expGainedOnSuccess;
//console.log("Script successfully hacked " + server.hostname + " for $" + formatNumber(moneyGained, 2) + " and " + formatNumber(expGainedOnSuccess, 4) + " exp");
workerScript.scriptRef.log("Script SUCCESSFULLY hacked " + server.hostname + " for $" + formatNumber(moneyGained, 2) + " and " + formatNumber(expGainedOnSuccess, 4) + " exp (t=" + threads + ")");
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.hack == null) {
workerScript.scriptRef.log("Script SUCCESSFULLY hacked " + server.hostname + " for $" + formatNumber(moneyGained, 2) + " and " + formatNumber(expGainedOnSuccess, 4) + " exp (t=" + threads + ")");
}
server.fortify(CONSTANTS.ServerFortifyAmount * threads);
return Promise.resolve(true);
return Promise.resolve(moneyGained);
} else {
//Player only gains 25% exp for failure? TODO Can change this later to balance
//Player only gains 25% exp for failure?
Player.gainHackingExp(expGainedOnFailure);
workerScript.scriptRef.onlineExpGained += expGainedOnFailure;
//console.log("Script unsuccessful to hack " + server.hostname + ". Gained " + formatNumber(expGainedOnFailure, 4) + " exp");
workerScript.scriptRef.log("Script FAILED to hack " + server.hostname + ". Gained " + formatNumber(expGainedOnFailure, 4) + " exp (t=" + threads + ")");
return Promise.resolve(false);
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.hack == null) {
workerScript.scriptRef.log("Script FAILED to hack " + server.hostname + ". Gained " + formatNumber(expGainedOnFailure, 4) + " exp (t=" + threads + ")");
}
return Promise.resolve(0);
}
});
},
sleep : function(time,log=true){
sleep : function(time){
if (workerScript.checkingRam) {return 0;}
if (time === undefined) {
throw makeRuntimeRejectMsg(workerScript, "sleep() call has incorrect number of arguments. Takes 1 argument");
}
if (log) {
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.sleep == null) {
workerScript.scriptRef.log("Sleeping for " + time + " milliseconds");
}
return netscriptDelay(time, workerScript).then(function() {
@ -245,8 +250,9 @@ function NetscriptFunctions(workerScript) {
}
var growTime = scriptCalculateGrowTime(server);
//console.log("Executing grow() on server " + server.hostname + " in " + formatNumber(growTime/1000, 3) + " seconds")
workerScript.scriptRef.log("Executing grow() on server " + server.hostname + " in " + formatNumber(growTime/1000, 3) + " seconds (t=" + threads + ")");
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.grow == null) {
workerScript.scriptRef.log("Executing grow() on server " + server.hostname + " in " + formatNumber(growTime/1000, 3) + " seconds (t=" + threads + ")");
}
return netscriptDelay(growTime, workerScript).then(function() {
if (workerScript.env.stopFlag) {return Promise.reject(workerScript);}
server.moneyAvailable += (1 * threads); //It can be grown even if it has no money
@ -256,9 +262,11 @@ function NetscriptFunctions(workerScript) {
if (growthPercentage == 1) {
expGain = 0;
}
workerScript.scriptRef.log("Available money on " + server.hostname + " grown by "
+ formatNumber(growthPercentage*100 - 100, 6) + "%. Gained " +
formatNumber(expGain, 4) + " hacking exp (t=" + threads +")");
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.grow == null) {
workerScript.scriptRef.log("Available money on " + server.hostname + " grown by " +
formatNumber(growthPercentage*100 - 100, 6) + "%. Gained " +
formatNumber(expGain, 4) + " hacking exp (t=" + threads +")");
}
workerScript.scriptRef.onlineExpGained += expGain;
Player.gainHackingExp(expGain);
return Promise.resolve(growthPercentage);
@ -291,15 +299,19 @@ function NetscriptFunctions(workerScript) {
}
var weakenTime = scriptCalculateWeakenTime(server);
workerScript.scriptRef.log("Executing weaken() on server " + server.hostname + " in " +
formatNumber(weakenTime/1000, 3) + " seconds (t=" + threads + ")");
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.weaken == null) {
workerScript.scriptRef.log("Executing weaken() on server " + server.hostname + " in " +
formatNumber(weakenTime/1000, 3) + " seconds (t=" + threads + ")");
}
return netscriptDelay(weakenTime, workerScript).then(function() {
if (workerScript.env.stopFlag) {return Promise.reject(workerScript);}
server.weaken(CONSTANTS.ServerWeakenAmount * threads);
workerScript.scriptRef.recordWeaken(server.ip, threads);
var expGain = scriptCalculateExpGain(server) * threads;
workerScript.scriptRef.log("Server security level on " + server.hostname + " weakened to " + server.hackDifficulty +
". Gained " + formatNumber(expGain, 4) + " hacking exp (t=" + threads + ")");
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.weaken == null) {
workerScript.scriptRef.log("Server security level on " + server.hostname + " weakened to " + server.hackDifficulty +
". Gained " + formatNumber(expGain, 4) + " hacking exp (t=" + threads + ")");
}
workerScript.scriptRef.onlineExpGained += expGain;
Player.gainHackingExp(expGain);
return Promise.resolve(CONSTANTS.ServerWeakenAmount * threads);
@ -331,6 +343,16 @@ function NetscriptFunctions(workerScript) {
if (workerScript.checkingRam) {return 0;}
workerScript.scriptRef.clearLog();
},
disableLog : function(fn) {
if (workerScript.checkingRam) {return 0;}
workerScript.disableLogs[fn] = true;
workerScript.scriptRef.log("Disabled logging for " + fn);
},
enableLog : function(fn) {
if (workerScript.checkingRam) {return 0;}
delete workerScript.disableLogs[fn];
workerScript.scriptRef.log("Enabled logging for " + fn);
},
nuke : function(ip){
if (workerScript.checkingRam) {
if (workerScript.loadedFns.nuke) {
@ -355,10 +377,14 @@ function NetscriptFunctions(workerScript) {
throw makeRuntimeRejectMsg(workerScript, "Not enough ports opened to use NUKE.exe virus");
}
if (server.hasAdminRights) {
workerScript.scriptRef.log("Already have root access to " + server.hostname);
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.nuke == null) {
workerScript.scriptRef.log("Already have root access to " + server.hostname);
}
} else {
server.hasAdminRights = true;
workerScript.scriptRef.log("Executed NUKE.exe virus on " + server.hostname + " to gain root access");
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.nuke == null) {
workerScript.scriptRef.log("Executed NUKE.exe virus on " + server.hostname + " to gain root access");
}
}
return true;
},
@ -384,11 +410,15 @@ function NetscriptFunctions(workerScript) {
throw makeRuntimeRejectMsg(workerScript, "You do not have the BruteSSH.exe program!");
}
if (!server.sshPortOpen) {
workerScript.scriptRef.log("Executed BruteSSH.exe on " + server.hostname + " to open SSH port (22)");
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.brutessh == null) {
workerScript.scriptRef.log("Executed BruteSSH.exe on " + server.hostname + " to open SSH port (22)");
}
server.sshPortOpen = true;
++server.openPortCount;
} else {
workerScript.scriptRef.log("SSH Port (22) already opened on " + server.hostname);
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.brutessh == null) {
workerScript.scriptRef.log("SSH Port (22) already opened on " + server.hostname);
}
}
return true;
},
@ -413,11 +443,15 @@ function NetscriptFunctions(workerScript) {
throw makeRuntimeRejectMsg(workerScript, "You do not have the FTPCrack.exe program!");
}
if (!server.ftpPortOpen) {
workerScript.scriptRef.log("Executed FTPCrack.exe on " + server.hostname + " to open FTP port (21)");
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.ftpcrack == null) {
workerScript.scriptRef.log("Executed FTPCrack.exe on " + server.hostname + " to open FTP port (21)");
}
server.ftpPortOpen = true;
++server.openPortCount;
} else {
workerScript.scriptRef.log("FTP Port (21) already opened on " + server.hostname);
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.ftpcrack == null) {
workerScript.scriptRef.log("FTP Port (21) already opened on " + server.hostname);
}
}
return true;
},
@ -442,11 +476,15 @@ function NetscriptFunctions(workerScript) {
throw makeRuntimeRejectMsg(workerScript, "You do not have the relaySMTP.exe program!");
}
if (!server.smtpPortOpen) {
workerScript.scriptRef.log("Executed relaySMTP.exe on " + server.hostname + " to open SMTP port (25)");
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.relaysmtp == null) {
workerScript.scriptRef.log("Executed relaySMTP.exe on " + server.hostname + " to open SMTP port (25)");
}
server.smtpPortOpen = true;
++server.openPortCount;
} else {
workerScript.scriptRef.log("SMTP Port (25) already opened on " + server.hostname);
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.relaysmtp == null) {
workerScript.scriptRef.log("SMTP Port (25) already opened on " + server.hostname);
}
}
return true;
},
@ -471,11 +509,15 @@ function NetscriptFunctions(workerScript) {
throw makeRuntimeRejectMsg(workerScript, "You do not have the HTTPWorm.exe program!");
}
if (!server.httpPortOpen) {
workerScript.scriptRef.log("Executed HTTPWorm.exe on " + server.hostname + " to open HTTP port (80)");
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.httpworm == null) {
workerScript.scriptRef.log("Executed HTTPWorm.exe on " + server.hostname + " to open HTTP port (80)");
}
server.httpPortOpen = true;
++server.openPortCount;
} else {
workerScript.scriptRef.log("HTTP Port (80) already opened on " + server.hostname);
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.httpworm == null) {
workerScript.scriptRef.log("HTTP Port (80) already opened on " + server.hostname);
}
}
return true;
},
@ -500,11 +542,15 @@ function NetscriptFunctions(workerScript) {
throw makeRuntimeRejectMsg(workerScript, "You do not have the SQLInject.exe program!");
}
if (!server.sqlPortOpen) {
workerScript.scriptRef.log("Executed SQLInject.exe on " + server.hostname + " to open SQL port (1433)");
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.sqlinject == null) {
workerScript.scriptRef.log("Executed SQLInject.exe on " + server.hostname + " to open SQL port (1433)");
}
server.sqlPortOpen = true;
++server.openPortCount;
} else {
workerScript.scriptRef.log("SQL Port (1433) already opened on " + server.hostname);
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.sqlinject == null) {
workerScript.scriptRef.log("SQL Port (1433) already opened on " + server.hostname);
}
}
return true;
},
@ -574,7 +620,9 @@ function NetscriptFunctions(workerScript) {
setTimeout(()=>{
NetscriptFunctions(workerScript).run.apply(this, arguments);
}, 20000);
workerScript.scriptRef.log("spawn() will execute " + scriptname + " in 20 seconds");
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.spawn == null) {
workerScript.scriptRef.log("spawn() will execute " + scriptname + " in 20 seconds");
}
NetscriptFunctions(workerScript).exit();
},
kill : function(filename,ip) {
@ -606,10 +654,14 @@ function NetscriptFunctions(workerScript) {
}
var res = killWorkerScript(runningScriptObj, server.ip);
if (res) {
workerScript.scriptRef.log("Killing " + filename + " on " + server.hostname + " with args: " + printArray(argsForKillTarget) + ". May take up to a few minutes for the scripts to die...");
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.kill == null) {
workerScript.scriptRef.log("Killing " + filename + " on " + server.hostname + " with args: " + printArray(argsForKillTarget) + ". May take up to a few minutes for the scripts to die...");
}
return true;
} else {
workerScript.scriptRef.log("kill() failed. No such script "+ filename + " on " + server.hostname + " with args: " + printArray(argsForKillTarget));
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.kill == null) {
workerScript.scriptRef.log("kill() failed. No such script "+ filename + " on " + server.hostname + " with args: " + printArray(argsForKillTarget));
}
return false;
}
},
@ -631,11 +683,14 @@ function NetscriptFunctions(workerScript) {
workerScript.scriptRef.log("killall() failed. Invalid IP or hostname passed in: " + ip);
throw makeRuntimeRejectMsg(workerScript, "killall() failed. Invalid IP or hostname passed in: " + ip);
}
var scriptsRunning = (server.runningScripts.length > 0);
for (var i = server.runningScripts.length-1; i >= 0; --i) {
killWorkerScript(server.runningScripts[i], server.ip);
}
workerScript.scriptRef.log("killall(): Killing all scripts on " + server.hostname + ". May take a few minutes for the scripts to die");
return true;
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.killall == null) {
workerScript.scriptRef.log("killall(): Killing all scripts on " + server.hostname + ". May take a few minutes for the scripts to die");
}
return scriptsRunning;
},
exit : function() {
if (workerScript.checkingRam) {
@ -678,8 +733,9 @@ function NetscriptFunctions(workerScript) {
});
return res;
}
if (!scriptname.endsWith(".lit") && !scriptname.endsWith(".script")) {
throw makeRuntimeRejectMsg(workerScript, "Error: scp() only works for .script and .lit files");
if (!scriptname.endsWith(".lit") && !scriptname.endsWith(".script") &&
!scriptname.endsWith("txt")) {
throw makeRuntimeRejectMsg(workerScript, "Error: scp() does not work with this file type. It only works for .script, .lit, and .txt files");
}
var destServer, currServ;
@ -718,6 +774,7 @@ function NetscriptFunctions(workerScript) {
for (var i = 0; i < currServ.messages.length; ++i) {
if (!(currServ.messages[i] instanceof Message) && currServ.messages[i] == scriptname) {
found = true;
break;
}
}
@ -728,12 +785,50 @@ function NetscriptFunctions(workerScript) {
for (var i = 0; i < destServer.messages.length; ++i) {
if (destServer.messages[i] === scriptname) {
workerScript.scriptRef.log(scriptname + " copied over to " + destServer.hostname);
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.scp == null) {
workerScript.scriptRef.log(scriptname + " copied over to " + destServer.hostname);
}
return true; //Already exists
}
}
destServer.messages.push(scriptname);
workerScript.scriptRef.log(scriptname + " copied over to " + destServer.hostname);
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.scp == null) {
workerScript.scriptRef.log(scriptname + " copied over to " + destServer.hostname);
}
return true;
}
//Scp for text files
if (scriptname.endsWith(".txt")) {
var found = false, txtFile;
for (var i = 0; i < currServ.textFiles.length; ++i) {
if (currServ.textFiles[i].fn === scriptname) {
found = true;
txtFile = currServ.textFiles[i];
break;
}
}
if (!found) {
workerScript.scriptRef.log(scriptname + " does not exist. scp() failed");
return false;
}
for (var i = 0; i < destServer.textFiles.length; ++i) {
if (destServer.textFiles[i].fn === scriptname) {
//Overwrite
destServer.textFiles[i].text = txtFile.text;
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.scp == null) {
workerScript.scriptRef.log(scriptname + " copied over to " + destServer.hostname);
}
return true;
}
}
var newFile = new TextFile(txtFile.fn, txtFile.text);
destServer.textFiles.push(newFile);
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.scp == null) {
workerScript.scriptRef.log(scriptname + " copied over to " + destServer.hostname);
}
return true;
}
@ -753,8 +848,10 @@ function NetscriptFunctions(workerScript) {
//Overwrite script if it already exists
for (var i = 0; i < destServer.scripts.length; ++i) {
if (scriptname == destServer.scripts[i].filename) {
workerScript.scriptRef.log("WARNING: " + scriptname + " already exists on " + destServer.hostname + " and it will be overwritten.");
workerScript.scriptRef.log(scriptname + " overwritten on " + destServer.hostname);
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.scp == null) {
workerScript.scriptRef.log("WARNING: " + scriptname + " already exists on " + destServer.hostname + " and it will be overwritten.");
workerScript.scriptRef.log(scriptname + " overwritten on " + destServer.hostname);
}
var oldScript = destServer.scripts[i];
oldScript.code = sourceScript.code;
oldScript.ramUsage = sourceScript.ramUsage;
@ -769,7 +866,9 @@ function NetscriptFunctions(workerScript) {
newScript.ramUsage = sourceScript.ramUsage;
newScript.server = destServer.ip;
destServer.scripts.push(newScript);
workerScript.scriptRef.log(scriptname + " copied over to " + destServer.hostname);
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.scp == null) {
workerScript.scriptRef.log(scriptname + " copied over to " + destServer.hostname);
}
return true;
},
ls : function(ip, grep) {
@ -834,6 +933,16 @@ function NetscriptFunctions(workerScript) {
}
}
for (var i = 0; i < server.textFiles.length; i++) {
if (filter) {
if (server.textFiles[i].fn.includes(filter)) {
allFiles.push(server.textFiles[i].fn);
}
} else {
allFiles.push(server.textFiles[i].fn);
}
}
//Sort the files alphabetically then print each
allFiles.sort();
return allFiles;
@ -897,7 +1006,9 @@ function NetscriptFunctions(workerScript) {
}
}
Player.updateSkillLevels();
workerScript.scriptRef.log("getHackingLevel() returned " + Player.hacking_skill);
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.getHackingLevel == null) {
workerScript.scriptRef.log("getHackingLevel() returned " + Player.hacking_skill);
}
return Player.hacking_skill;
},
getHackingMultipliers : function() {
@ -946,10 +1057,14 @@ function NetscriptFunctions(workerScript) {
}
if (server.hostname == "home") {
//Return player's money
workerScript.scriptRef.log("getServerMoneyAvailable('home') returned player's money: $" + formatNumber(Player.money.toNumber(), 2));
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.getServerMoneyAvailable == null) {
workerScript.scriptRef.log("getServerMoneyAvailable('home') returned player's money: $" + formatNumber(Player.money.toNumber(), 2));
}
return Player.money.toNumber();
}
workerScript.scriptRef.log("getServerMoneyAvailable() returned " + formatNumber(server.moneyAvailable, 2) + " for " + server.hostname);
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.getServerMoneyAvailable == null) {
workerScript.scriptRef.log("getServerMoneyAvailable() returned " + formatNumber(server.moneyAvailable, 2) + " for " + server.hostname);
}
return server.moneyAvailable;
},
getServerSecurityLevel : function(ip){
@ -966,7 +1081,9 @@ function NetscriptFunctions(workerScript) {
workerScript.scriptRef.log("getServerSecurityLevel() failed. Invalid IP or hostname passed in: " + ip);
throw makeRuntimeRejectMsg(workerScript, "getServerSecurityLevel() failed. Invalid IP or hostname passed in: " + ip);
}
workerScript.scriptRef.log("getServerSecurityLevel() returned " + formatNumber(server.hackDifficulty, 3) + " for " + server.hostname);
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.getServerSecurityLevel == null) {
workerScript.scriptRef.log("getServerSecurityLevel() returned " + formatNumber(server.hackDifficulty, 3) + " for " + server.hostname);
}
return server.hackDifficulty;
},
getServerBaseSecurityLevel : function(ip){
@ -983,7 +1100,9 @@ function NetscriptFunctions(workerScript) {
workerScript.scriptRef.log("getServerBaseSecurityLevel() failed. Invalid IP or hostname passed in: " + ip);
throw makeRuntimeRejectMsg(workerScript, "getServerBaseSecurityLevel() failed. Invalid IP or hostname passed in: " + ip);
}
workerScript.scriptRef.log("getServerBaseSecurityLevel() returned " + formatNumber(server.baseDifficulty, 3) + " for " + server.hostname);
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.getServerBaseSecurityLevel == null) {
workerScript.scriptRef.log("getServerBaseSecurityLevel() returned " + formatNumber(server.baseDifficulty, 3) + " for " + server.hostname);
}
return server.baseDifficulty;
},
getServerMinSecurityLevel : function(ip) {
@ -1000,7 +1119,9 @@ function NetscriptFunctions(workerScript) {
workerScript.scriptRef.log("getServerMinSecurityLevel() failed. Invalid IP or hostname passed in: " + ip);
throw makeRuntimeRejectMsg(workerScript, "getServerMinSecurityLevel() failed. Invalid IP or hostname passed in: " + ip);
}
workerScript.scriptRef.log("getServerMinSecurityLevel() returned " + formatNumber(server.minDifficulty, 3) + " for " + server.hostname);
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.getServerMinSecurityLevel == null) {
workerScript.scriptRef.log("getServerMinSecurityLevel() returned " + formatNumber(server.minDifficulty, 3) + " for " + server.hostname);
}
return server.minDifficulty;
},
getServerRequiredHackingLevel : function(ip) {
@ -1017,7 +1138,9 @@ function NetscriptFunctions(workerScript) {
workerScript.scriptRef.log("getServerRequiredHackingLevel() failed. Invalid IP or hostname passed in: " + ip);
throw makeRuntimeRejectMsg(workerScript, "getServerRequiredHackingLevel() failed. Invalid IP or hostname passed in: " + ip);
}
workerScript.scriptRef.log("getServerRequiredHackingLevel returned " + formatNumber(server.requiredHackingSkill, 0) + " for " + server.hostname);
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.getServerRequiredHackingLevel == null) {
workerScript.scriptRef.log("getServerRequiredHackingLevel returned " + formatNumber(server.requiredHackingSkill, 0) + " for " + server.hostname);
}
return server.requiredHackingSkill;
},
getServerMaxMoney : function(ip){
@ -1034,7 +1157,9 @@ function NetscriptFunctions(workerScript) {
workerScript.scriptRef.log("getServerMaxMoney() failed. Invalid IP or hostname passed in: " + ip);
throw makeRuntimeRejectMsg(workerScript, "getServerMaxMoney() failed. Invalid IP or hostname passed in: " + ip);
}
workerScript.scriptRef.log("getServerMaxMoney() returned " + formatNumber(server.moneyMax, 0) + " for " + server.hostname);
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.getServerMaxMoney == null) {
workerScript.scriptRef.log("getServerMaxMoney() returned " + formatNumber(server.moneyMax, 0) + " for " + server.hostname);
}
return server.moneyMax;
},
getServerGrowth : function(ip) {
@ -1051,7 +1176,9 @@ function NetscriptFunctions(workerScript) {
workerScript.scriptRef.log("getServerGrowth() failed. Invalid IP or hostname passed in: " + ip);
throw makeRuntimeRejectMsg(workerScript, "getServerGrowth() failed. Invalid IP or hostname passed in: " + ip);
}
workerScript.scriptRef.log("getServerGrowth() returned " + formatNumber(server.serverGrowth, 0) + " for " + server.hostname);
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.getServerGrowth == null) {
workerScript.scriptRef.log("getServerGrowth() returned " + formatNumber(server.serverGrowth, 0) + " for " + server.hostname);
}
return server.serverGrowth;
},
getServerNumPortsRequired : function(ip) {
@ -1068,7 +1195,9 @@ function NetscriptFunctions(workerScript) {
workerScript.scriptRef.log("getServerNumPortsRequired() failed. Invalid IP or hostname passed in: " + ip);
throw makeRuntimeRejectMsg(workerScript, "getServerNumPortsRequired() failed. Invalid IP or hostname passed in: " + ip);
}
workerScript.scriptRef.log("getServerNumPortsRequired() returned " + formatNumber(server.numOpenPortsRequired, 0) + " for " + server.hostname);
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.getServerNumPortsRequired == null) {
workerScript.scriptRef.log("getServerNumPortsRequired() returned " + formatNumber(server.numOpenPortsRequired, 0) + " for " + server.hostname);
}
return server.numOpenPortsRequired;
},
getServerRam : function(ip) {
@ -1085,7 +1214,9 @@ function NetscriptFunctions(workerScript) {
workerScript.scriptRef.log("getServerRam() failed. Invalid IP or hostname passed in: " + ip);
throw makeRuntimeRejectMsg(workerScript, "getServerRam() failed. Invalid IP or hostname passed in: " + ip);
}
workerScript.scriptRef.log("getServerRam() returned [" + formatNumber(server.maxRam, 2) + "GB, " + formatNumber(server.ramUsed, 2) + "GB]");
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.getServerRam == null) {
workerScript.scriptRef.log("getServerRam() returned [" + formatNumber(server.maxRam, 2) + "GB, " + formatNumber(server.ramUsed, 2) + "GB]");
}
return [server.maxRam, server.ramUsed];
},
serverExists : function(ip) {
@ -1167,7 +1298,7 @@ function NetscriptFunctions(workerScript) {
return 0;
} else {
workerScript.loadedFns.getNextHacknetNodeCost = true;
return CONSTANTS.ScriptHacknetNodesRamCost;
return CONSTANTS.ScriptPurchaseHacknetRamCost;
}
}
return getCostOfNextHacknetNode();
@ -1259,8 +1390,10 @@ function NetscriptFunctions(workerScript) {
if (Engine.currentPage == Engine.Page.StockMarket) {
updateStockPlayerPosition(stock);
}
workerScript.scriptRef.log("Bought " + formatNumber(shares, 0) + " shares of " + stock.symbol + " at $" +
formatNumber(stock.price, 2) + " per share");
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.buyStock == null) {
workerScript.scriptRef.log("Bought " + formatNumber(shares, 0) + " shares of " + stock.symbol + " at $" +
formatNumber(stock.price, 2) + " per share");
}
return stock.price;
},
sellStock : function(symbol, shares) {
@ -1302,9 +1435,11 @@ function NetscriptFunctions(workerScript) {
if (Engine.currentPage == Engine.Page.StockMarket) {
updateStockPlayerPosition(stock);
}
workerScript.scriptRef.log("Sold " + formatNumber(shares, 0) + " shares of " + stock.symbol + " at $" +
formatNumber(stock.price, 2) + " per share. Gained " +
"$" + formatNumber(gains, 2));
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.sellStock == null) {
workerScript.scriptRef.log("Sold " + formatNumber(shares, 0) + " shares of " + stock.symbol + " at $" +
formatNumber(stock.price, 2) + " per share. Gained " +
"$" + formatNumber(gains, 2));
}
return stock.price;
},
shortStock(symbol, shares) {
@ -1497,7 +1632,9 @@ function NetscriptFunctions(workerScript) {
homeComputer.serversOnNetwork.push(newServ.ip);
newServ.serversOnNetwork.push(homeComputer.ip);
Player.loseMoney(cost);
workerScript.scriptRef.log("Purchased new server with hostname " + newServ.hostname + " for $" + formatNumber(cost, 2));
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.purchaseServer == null) {
workerScript.scriptRef.log("Purchased new server with hostname " + newServ.hostname + " for $" + formatNumber(cost, 2));
}
return newServ.hostname;
},
deleteServer : function(hostname) {
@ -1562,7 +1699,9 @@ function NetscriptFunctions(workerScript) {
for (var i = 0; i < homeComputer.serversOnNetwork.length; ++i) {
if (ip == homeComputer.serversOnNetwork[i]) {
homeComputer.serversOnNetwork.splice(i, 1);
workerScript.scriptRef.log("Deleted server " + hostnameStr);
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.deleteServer == null) {
workerScript.scriptRef.log("Deleted server " + hostnameStr);
}
return true;
}
}
@ -1594,10 +1733,6 @@ function NetscriptFunctions(workerScript) {
});
return res;
},
round : function(n) {
if (isNaN(n)) {return 0;}
return Math.round(n);
},
write : function(port, data="", mode="a") {
if (workerScript.checkingRam) {
if (workerScript.loadedFns.write) {
@ -1663,7 +1798,7 @@ function NetscriptFunctions(workerScript) {
if (port == null) {
throw makeRuntimeRejectMsg(workerScript, "ERR: Could not find port: " + port + ". This is a bug contact the game developer");
}
if (port.length == 0) {
if (port.length === 0) {
return "NULL PORT DATA";
} else {
return port.shift();
@ -1684,6 +1819,30 @@ function NetscriptFunctions(workerScript) {
throw makeRuntimeRejectMsg(workerScript, "Invalid argument passed in for read(): " + port);
}
},
peek : function(port) {
if (workerScript.checkingRam) {
if (workerScript.loadedFns.peek) {
return 0;
} else {
workerScript.loadedFns.peek = true;
return CONSTANTS.ScriptReadWriteRamCost;
}
}
if (isNaN(port) || port < 1 || port > 10) {
throw makeRuntimeRejectMsg(workerScript, "ERR: peek() called with invalid argument. Must be a port number between 1 and 10");
}
var portName = "Port" + String(port);
var port = NetscriptPorts[portName];
if (port == null) {
throw makeRuntimeRejectMsg(workerScript, "ERR: Could not find port: " + port + ". This is a bug contact the game developer");
}
if (port.length === 0) {
return "NULL PORT DATA";
} else {
var foo = port.slice();
return foo[0];
}
},
clear : function(port) {
if (workerScript.checkingRam) {
if (workerScript.loadedFns.clear) {
@ -2010,7 +2169,9 @@ function NetscriptFunctions(workerScript) {
}
if (Player.isWorking) {
var txt = Player.singularityStopWork();
workerScript.scriptRef.log(txt);
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.universityCourse == null) {
workerScript.scriptRef.log(txt);
}
}
var costMult, expMult;
@ -2072,7 +2233,9 @@ function NetscriptFunctions(workerScript) {
return false;
}
Player.startClass(costMult, expMult, task);
workerScript.scriptRef.log("Started " + task + " at " + universityName);
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.universityCourse == null) {
workerScript.scriptRef.log("Started " + task + " at " + universityName);
}
return true;
},
@ -2099,7 +2262,9 @@ function NetscriptFunctions(workerScript) {
}
if (Player.isWorking) {
var txt = Player.singularityStopWork();
workerScript.scriptRef.log(txt);
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.gymWorkout == null) {
workerScript.scriptRef.log(txt);
}
}
var costMult, expMult;
switch(gymName.toLowerCase()) {
@ -2174,7 +2339,9 @@ function NetscriptFunctions(workerScript) {
workerScript.scriptRef.log("Invalid stat: " + stat + ". gymWorkout() failed");
return false;
}
workerScript.scriptRef.log("Started training " + stat + " at " + gymName);
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.gymWorkout == null) {
workerScript.scriptRef.log("Started training " + stat + " at " + gymName);
}
return true;
},
@ -2206,7 +2373,9 @@ function NetscriptFunctions(workerScript) {
Player.loseMoney(200000);
Player.city = cityname;
Player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain);
workerScript.scriptRef.log("Traveled to " + cityname);
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.travelToCity == null) {
workerScript.scriptRef.log("Traveled to " + cityname);
}
return true;
default:
workerScript.scriptRef.log("ERROR: Invalid city name passed into travelToCity().");
@ -2252,7 +2421,9 @@ function NetscriptFunctions(workerScript) {
Player.getHomeComputer().serversOnNetwork.push(darkweb.ip);
darkweb.serversOnNetwork.push(Player.getHomeComputer().ip);
Player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain);
workerScript.scriptRef.log("You have purchased a Tor router!");
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.purchaseTor == null) {
workerScript.scriptRef.log("You have purchased a Tor router!");
}
return true;
},
purchaseProgram(programName) {
@ -2284,8 +2455,9 @@ function NetscriptFunctions(workerScript) {
if (price > 0 && Player.money.gt(price)) {
Player.loseMoney(price);
Player.getHomeComputer().programs.push(Programs.BruteSSHProgram);
workerScript.scriptRef.log("You have purchased the BruteSSH.exe program. The new program " +
"can be found on your home computer.");
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.purchaseProgram == null) {
workerScript.scriptRef.log("You have purchased the BruteSSH.exe program. The new program can be found on your home computer.");
}
} else {
workerScript.scriptRef.log("Not enough money to purchase " + programName);
return false;
@ -2296,8 +2468,9 @@ function NetscriptFunctions(workerScript) {
if (price > 0 && Player.money.gt(price)) {
Player.loseMoney(price);
Player.getHomeComputer().programs.push(Programs.FTPCrackProgram);
workerScript.scriptRef.log("You have purchased the FTPCrack.exe program. The new program " +
"can be found on your home computer.");
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.purchaseProgram == null) {
workerScript.scriptRef.log("You have purchased the FTPCrack.exe program. The new program can be found on your home computer.");
}
} else {
workerScript.scriptRef.log("Not enough money to purchase " + programName);
return false;
@ -2308,8 +2481,9 @@ function NetscriptFunctions(workerScript) {
if (price > 0 && Player.money.gt(price)) {
Player.loseMoney(price);
Player.getHomeComputer().programs.push(Programs.RelaySMTPProgram);
workerScript.scriptRef.log("You have purchased the relaySMTP.exe program. The new program " +
"can be found on your home computer.");
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.purchaseProgram == null) {
workerScript.scriptRef.log("You have purchased the relaySMTP.exe program. The new program can be found on your home computer.");
}
} else {
workerScript.scriptRef.log("Not enough money to purchase " + programName);
return false;
@ -2320,8 +2494,9 @@ function NetscriptFunctions(workerScript) {
if (price > 0 && Player.money.gt(price)) {
Player.loseMoney(price);
Player.getHomeComputer().programs.push(Programs.HTTPWormProgram);
workerScript.scriptRef.log("You have purchased the HTTPWorm.exe program. The new program " +
"can be found on your home computer.");
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.purchaseProgram == null) {
workerScript.scriptRef.log("You have purchased the HTTPWorm.exe program. The new program can be found on your home computer.");
}
} else {
workerScript.scriptRef.log("Not enough money to purchase " + programName);
return false;
@ -2332,8 +2507,9 @@ function NetscriptFunctions(workerScript) {
if (price > 0 && Player.money.gt(price)) {
Player.loseMoney(price);
Player.getHomeComputer().programs.push(Programs.SQLInjectProgram);
workerScript.scriptRef.log("You have purchased the SQLInject.exe program. The new program " +
"can be found on your home computer.");
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.purchaseProgram == null) {
workerScript.scriptRef.log("You have purchased the SQLInject.exe program. The new program can be found on your home computer.");
}
} else {
workerScript.scriptRef.log("Not enough money to purchase " + programName);
return false;
@ -2344,8 +2520,9 @@ function NetscriptFunctions(workerScript) {
if (price > 0 && Player.money.gt(price)) {
Player.loseMoney(price);
Player.getHomeComputer().programs.push(Programs.DeepscanV1);
workerScript.scriptRef.log("You have purchased the DeepscanV1.exe program. The new program " +
"can be found on your home computer.");
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.purchaseProgram == null) {
workerScript.scriptRef.log("You have purchased the DeepscanV1.exe program. The new program can be found on your home computer.");
}
} else {
workerScript.scriptRef.log("Not enough money to purchase " + programName);
return false;
@ -2356,8 +2533,9 @@ function NetscriptFunctions(workerScript) {
if (price > 0 && Player.money.gt(price)) {
Player.loseMoney(price);
Player.getHomeComputer().programs.push(Programs.DeepscanV2);
workerScript.scriptRef.log("You have purchased the DeepscanV2.exe program. The new program " +
"can be found on your home computer.");
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.purchaseProgram == null) {
workerScript.scriptRef.log("You have purchased the DeepscanV2.exe program. The new program can be found on your home computer.");
}
} else {
workerScript.scriptRef.log("Not enough money to purchase " + programName);
return false;
@ -2429,7 +2607,9 @@ function NetscriptFunctions(workerScript) {
}
if (Player.isWorking) {
var txt = Player.singularityStopWork();
workerScript.scriptRef.log(txt);
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.stopAction == null) {
workerScript.scriptRef.log(txt);
}
return true;
}
return false;
@ -2473,7 +2653,9 @@ function NetscriptFunctions(workerScript) {
Player.loseMoney(cost);
Player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain);
workerScript.scriptRef.log("Purchased additional RAM for home computer! It now has " + homeComputer.maxRam + "GB of RAM.");
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.upgradeHomeRam == null) {
workerScript.scriptRef.log("Purchased additional RAM for home computer! It now has " + homeComputer.maxRam + "GB of RAM.");
}
return true;
},
getUpgradeHomeRamCost() {
@ -2534,7 +2716,9 @@ function NetscriptFunctions(workerScript) {
if (Player.isWorking) {
var txt = Player.singularityStopWork();
workerScript.scriptRef.log(txt);
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.workForCompany == null) {
workerScript.scriptRef.log(txt);
}
}
if (Player.companyPosition.isPartTimeJob()) {
@ -2542,7 +2726,9 @@ function NetscriptFunctions(workerScript) {
} else {
Player.startWork();
}
workerScript.scriptRef.log("Began working at " + Player.companyName + " as a " + Player.companyPosition.positionName);
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.workForCompany == null) {
workerScript.scriptRef.log("Began working at " + Player.companyName + " as a " + Player.companyPosition.positionName);
}
return true;
},
applyToCompany(companyName, field) {
@ -2620,9 +2806,13 @@ function NetscriptFunctions(workerScript) {
return false;
}
if (res) {
workerScript.scriptRef.log("You were offered a new job at " + companyName + " as a " + Player.companyPosition.positionName);
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.applyToCompany == null) {
workerScript.scriptRef.log("You were offered a new job at " + companyName + " as a " + Player.companyPosition.positionName);
}
} else {
workerScript.scriptRef.log("You failed to get a new job/promotion at " + companyName + " in the " + field + " field.");
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.applyToCompany == null) {
workerScript.scriptRef.log("You failed to get a new job/promotion at " + companyName + " in the " + field + " field.");
}
}
return res;
},
@ -2709,7 +2899,9 @@ function NetscriptFunctions(workerScript) {
var fac = Factions[name];
joinFaction(fac);
Player.gainIntelligenceExp(CONSTANTS.IntelligenceSingFnBaseExpGain);
workerScript.scriptRef.log("Joined the " + name + " faction.");
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.joinFaction == null) {
workerScript.scriptRef.log("Joined the " + name + " faction.");
}
return true;
},
workForFaction(name, type) {
@ -2747,7 +2939,9 @@ function NetscriptFunctions(workerScript) {
if (Player.isWorking) {
var txt = Player.singularityStopWork();
workerScript.scriptRef.log(txt);
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.workForFaction == null) {
workerScript.scriptRef.log(txt);
}
}
var fac = Factions[name];
@ -2856,7 +3050,9 @@ function NetscriptFunctions(workerScript) {
}
if (Player.isWorking) {
var txt = Player.singularityStopWork();
workerScript.scriptRef.log(txt);
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.createProgram == null) {
workerScript.scriptRef.log(txt);
}
}
switch(name.toLowerCase()) {
@ -2956,7 +3152,9 @@ function NetscriptFunctions(workerScript) {
}
if (Player.isWorking) {
var txt = Player.singularityStopWork();
workerScript.scriptRef.log(txt);
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.commitCrime == null) {
workerScript.scriptRef.log(txt);
}
}
//Set Location to slums

@ -19,16 +19,17 @@ function WorkerScript(runningScriptObj) {
this.serverIp = null;
this.code = runningScriptObj.scriptRef.code;
this.env = new Environment(this);
this.env.set("args", runningScriptObj.args);
this.env.set("args", runningScriptObj.args.slice());
this.output = "";
this.ramUsage = 0;
this.scriptRef = runningScriptObj;
this.errorMessage = "";
this.args = runningScriptObj.args;
this.args = runningScriptObj.args.slice();
this.delay = null;
this.fnWorker = null; //Workerscript for a function call
this.checkingRam = false;
this.loadedFns = {}; //Stores names of fns that are "loaded" by this script, thus using RAM
this.disableLogs = {}; //Stores names of fns that should have logs disabled
}
//Returns the server on which the workerScript is running

@ -1069,8 +1069,9 @@ PlayerObject.prototype.workForFaction = function(numCycles) {
}
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>" +
txt.innerHTML = "You are currently " + this.currentWorkFactionDescription + " for your faction " + faction.name +
" (Current Faction Reputation: " + formatNumber(faction.playerReputation, 0) + "). " +
"You have been doing this for " + convertTimeMsToTimeElapsedString(this.timeWorked) + "<br><br>" +
"You have earned: <br><br>" +
"$" + formatNumber(this.workMoneyGained, 2) + " (" + formatNumber(this.workMoneyGainRate * cyclesPerSec, 2) + " / sec) <br><br>" +
formatNumber(this.workRepGained, 4) + " (" + formatNumber(this.workRepGainRate * cyclesPerSec, 4) + " / sec) reputation for this faction <br><br>" +
@ -1949,21 +1950,17 @@ PlayerObject.prototype.reapplyAllAugmentations = function(resetMultipliers=true)
for (let i = 0; i < this.augmentations.length; ++i) {
//Compatibility with new version
if (typeof this.augmentations[i] === 'string' || this.augmentations[i] instanceof String) {
var newOwnedAug = new PlayerOwnedAugmentation(this.augmentations[i]);
if (this.augmentations[i] == AugmentationNames.NeuroFluxGovernor) {
newOwnedAug.level = Augmentations[AugmentationNames.NeuroFluxGovernor].level;
}
this.augmentations[i] = newOwnedAug;
if (this.augmentations[i].name === "HacknetNode NIC Architecture Neural-Upload") {
this.augmentations[i].name = "Hacknet Node NIC Architecture Neural-Upload";
}
var augName = this.augmentations[i].name;
var aug = Augmentations[augName];
aug.owned = true;
if (aug == null) {
console.log("WARNING: Invalid augmentation name");
continue;
}
aug.owned = true;
if (aug.name == AugmentationNames.NeuroFluxGovernor) {
for (let j = 0; j < aug.level; ++j) {
applyAugmentation(this.augmentations[i], true);

@ -25,6 +25,7 @@ import {initStockMarket, initSymbolToStockMap,
setStockMarketContentCreated} from "./StockMarket.js";
import {Terminal, postNetburnerText} from "./Terminal.js";
import Decimal from '../utils/decimal.js';
import {dialogBoxCreate} from "../utils/DialogBox.js";
//Prestige by purchasing augmentation
function prestigeAugmentation() {
@ -148,11 +149,8 @@ function prestigeAugmentation() {
function prestigeSourceFile() {
initBitNodeMultipliers();
//Crime statistics
Player.prestigeSourceFile();
//Delete all Worker Scripts objects
prestigeWorkerScripts();
prestigeWorkerScripts(); //Delete all Worker Scripts objects
var homeComp = Player.getHomeComputer();
@ -234,7 +232,7 @@ function prestigeSourceFile() {
//Reinitialize Bit Node flags
initSingularitySFFlags();
//Reset Stock market
//Reset Stock market, gang, and corporation
if (Player.hasWseAccount) {
initStockMarket();
initSymbolToStockMap();
@ -245,11 +243,17 @@ function prestigeSourceFile() {
stockMarketList.removeChild(stockMarketList.firstChild);
}
Player.gang = null;
Player.corporation = null;
//BitNode 3, get Handbook .lit file
homeComp.messages.push("corporation-management-handbook.lit");
dialogBoxCreate("You received a copy of the Corporation Management Handbook on your home computer. " +
"Read it if you need help getting started with Corporations!");
//Gain int exp
Player.gainIntelligenceExp(5);
//Reset gang
Player.gang = null;
}
export {prestigeAugmentation, prestigeSourceFile};

@ -41,6 +41,7 @@ function BitburnerSaveObject() {
this.StockMarketSave = "";
this.SettingsSave = "";
this.VersionSave = "";
this.AllGangsSave = "";
}
BitburnerSaveObject.prototype.saveGame = function(db) {
@ -229,6 +230,7 @@ function loadImportedGame(saveObj, saveString) {
var tempGlobalAliases = null;
var tempMessages = null;
var tempStockMarket = null;
var tempAllGangs = null;
//Check to see if the imported save file can be parsed. If any
//errors are caught it will fail
@ -280,7 +282,7 @@ function loadImportedGame(saveObj, saveString) {
}
if (saveObj.hasOwnProperty("StockMarketSave")) {
try {
tempStockMarket = JSON.parse(saveObj.StockMarketSave, Reviver);
tempStockMarket = JSON.parse(tempSaveObj.StockMarketSave, Reviver);
} catch(e) {
console.log("Parsing StockMarket save failed: " + e);
tempStockMarket = {};
@ -309,9 +311,9 @@ function loadImportedGame(saveObj, saveString) {
} else {
//createNewUpdateText();
}
if (tempPlayer.bitNodeN == 2 && tempPlayer.inGang() && saveObj.hasOwnProperty("AllGangsSave")) {
if (tempPlayer.bitNodeN == 2 && tempPlayer.inGang() && tempSaveObj.hasOwnProperty("AllGangsSave")) {
try {
AllGangs = JSON.parse(saveObj.AllGangsSave, Reviver);
loadAllGangs(tempSaveObj.AllGangsSave);
} catch(e) {
console.log("ERROR: Failed to parse AllGangsSave: " + e);
}

@ -76,7 +76,7 @@ function scriptEditorInit() {
var documentationButton = createElement("a", {
display:"inline-block", class:"a-link-button", innerText:"Netscript Documentation",
href:"https://bitburner.wikia.com/wiki/Netscript",
href:"https://bitburner.readthedocs.io/en/latest/index.html",
target:"_blank"
});

@ -689,7 +689,7 @@ function processSingleServerGrowth(server, numCycles) {
}
function prestigeHomeComputer(homeComp) {
homeComp.programs.length = 0;
homeComp.programs.length = 0; //Remove programs
homeComp.runningScripts = [];
homeComp.serversOnNetwork = [];
homeComp.isConnectedTo = true;
@ -701,7 +701,7 @@ function prestigeHomeComputer(homeComp) {
script.updateRamUsage();
});
homeComp.messages.length = 0;
homeComp.messages.length = 0; //Remove .lit and .msg files
homeComp.messages.push("hackers-starting-handbook.lit");
}

@ -506,9 +506,11 @@ function shortStock(stock, shares, workerScript=null) {
stock.playerAvgShortPx = newTotal / stock.playerShortShares;
updateStockPlayerPosition(stock);
if (tixApi) {
workerScript.scriptRef.log("Bought a short position of " + formatNumber(shares, 0) + " shares of " + stock.symbol + " at " +
numeral(stock.price).format('($0.000a)') + " per share. Paid " +
numeral(CONSTANTS.StockMarketCommission).format('($0.000a)') + " in commission fees.");
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.shortStock == null) {
workerScript.scriptRef.log("Bought a short position of " + formatNumber(shares, 0) + " shares of " + stock.symbol + " at " +
numeral(stock.price).format('($0.000a)') + " per share. Paid " +
numeral(CONSTANTS.StockMarketCommission).format('($0.000a)') + " in commission fees.");
}
} else {
dialogBoxCreate("Bought a short position of " + formatNumber(shares, 0) + " shares of " + stock.symbol + " at $" +
formatNumber(stock.price, 2) + " per share. You also paid $" +
@ -548,9 +550,11 @@ function sellShort(stock, shares, workerScript=null) {
}
updateStockPlayerPosition(stock);
if (tixApi) {
workerScript.scriptRef.log("Sold your short position of " + shares + " shares of " + stock.symbol + " at " +
numeral(stock.price).format('($0.000a)') + " per share. After commissions, you gained " +
"a total of " + numeral(origCost + profit).format('($0.000a)'));
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.sellShort == null) {
workerScript.scriptRef.log("Sold your short position of " + shares + " shares of " + stock.symbol + " at " +
numeral(stock.price).format('($0.000a)') + " per share. After commissions, you gained " +
"a total of " + numeral(origCost + profit).format('($0.000a)'));
}
} else {
dialogBoxCreate("Sold your short position of " + formatNumber(shares, 0) + " shares of " + stock.symbol + " at $" +
formatNumber(stock.price, 2) + " per share. After commissions, you gained " +

@ -328,6 +328,9 @@ function determineAllPossibilitiesForTabCompletion(input, index=0) {
allPos.push(currServ.messages[i]);
}
}
for (var i = 0; i < currServ.textFiles.length; ++i) {
allPos.push(currServ.textFiles[i].fn);
}
}
if (input.startsWith("connect ") || input.startsWith("telnet ")) {
@ -1131,16 +1134,17 @@ let Terminal = {
return;
}
var scriptname = args[0];
if (!scriptname.endsWith(".lit") && !scriptname.endsWith(".script")){
post("Error: scp only works for .script and .lit files");
if (!scriptname.endsWith(".lit") && !scriptname.endsWith(".script") &&
!scriptname.endsWith(".txt")){
post("Error: scp only works for .script, .txt, and .lit files");
return;
}
var server = getServer(args[1]);
if (server == null) {
var destServer = getServer(args[1]);
if (destServer == null) {
post("Invalid destination. " + args[1] + " not found");
return;
}
var ip = server.ip;
var ip = destServer.ip;
var currServ = Player.getCurrentServer();
//Scp for lit files
@ -1149,26 +1153,49 @@ let Terminal = {
for (var i = 0; i < currServ.messages.length; ++i) {
if (!(currServ.messages[i] instanceof Message) && currServ.messages[i] == scriptname) {
found = true;
break;
}
}
if (!found) {
post("Error: no such file exists!");
return;
}
if (!found) {return post("Error: no such file exists!");}
for (var i = 0; i < server.messages.length; ++i) {
if (server.messages[i] === scriptname) {
post(scriptname + " copied over to " + server.hostname);
for (var i = 0; i < destServer.messages.length; ++i) {
if (destServer.messages[i] === scriptname) {
post(scriptname + " copied over to " + destServer.hostname);
return; //Already exists
}
}
server.messages.push(scriptname);
post(scriptname + " copied over to " + server.hostname);
destServer.messages.push(scriptname);
post(scriptname + " copied over to " + destServer.hostname);
return;
}
//Scp for txt files
if (scriptname.endsWith(".txt")) {
var found = false, txtFile;
for (var i = 0; i < currServ.textFiles.length; ++i) {
if (currServ.textFiles[i].fn === scriptname) {
found = true;
txtFile = currServ.textFiles[i];
break;
}
}
if (!found) {return post("Error: no such file exists!");}
for (var i = 0; i < destServer.textFiles.length; ++i) {
if (destServer.textFiles[i].fn === scriptname) {
//Overwrite
destServer.textFiles[i].text = txtFile.text;
post("WARNING: " + scriptname + " already exists on " + destServer.hostname +
"and will be overwriten");
return post(scriptname + " copied over to " + destServer.hostname);
}
}
var newFile = new TextFile(txtFile.fn, txtFile.text);
destServer.textFiles.push(newFile);
return post(scriptname + " copied over to " + destServer.hostname);
}
//Get the current script
var sourceScript = null;
@ -1184,13 +1211,13 @@ let Terminal = {
}
//Overwrite script if it exists
for (var i = 0; i < server.scripts.length; ++i) {
if (scriptname == server.scripts[i].filename) {
post("WARNING: " + scriptname + " already exists on " + server.hostname + " and will be overwritten");
var oldScript = server.scripts[i];
for (var i = 0; i < destServer.scripts.length; ++i) {
if (scriptname == destServer.scripts[i].filename) {
post("WARNING: " + scriptname + " already exists on " + destServer.hostname + " and will be overwritten");
var oldScript = destServer.scripts[i];
oldScript.code = sourceScript.code;
oldScript.ramUsage = sourceScript.ramUsage;
post(scriptname + " overwriten on " + server.hostname);
post(scriptname + " overwriten on " + destServer.hostname);
return;
}
}
@ -1199,9 +1226,9 @@ let Terminal = {
newScript.filename = scriptname;
newScript.code = sourceScript.code;
newScript.ramUsage = sourceScript.ramUsage;
newScript.server = ip;
server.scripts.push(newScript);
post(scriptname + " copied over to " + server.hostname);
newScript.destServer = ip;
destServer.scripts.push(newScript);
post(scriptname + " copied over to " + destServer.hostname);
break;
case "sudov":
if (commandArray.length != 1) {

@ -21,7 +21,7 @@ TextFile.prototype.read = function() {
}
TextFile.prototype.show = function() {
dialogBoxCreate(this.fn + "<br><br>" + this.text);
dialogBoxCreate(this.fn + "<br><br>" + this.text, true);
}
TextFile.prototype.download = function() {

359
tags

@ -1,359 +0,0 @@
!_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

Binary file not shown.

@ -32,7 +32,7 @@ $(document).on('click', '.dialog-box-close-button', function( event ) {
var dialogBoxOpened = false;
function dialogBoxCreate(txt) {
function dialogBoxCreate(txt, preformatted=false) {
var container = document.createElement("div");
container.setAttribute("class", "dialog-box-container");
@ -43,8 +43,16 @@ function dialogBoxCreate(txt) {
closeButton.setAttribute("class", "dialog-box-close-button");
closeButton.innerHTML = "&times;"
var textE = document.createElement("p");
textE.innerHTML = txt.replace(/(?:\r\n|\r|\n)/g, '<br>');
var textE;
if (preformatted) {
// For text files as they are often computed data that
// shouldn't be wrapped and should retain tabstops.
textE = document.createElement("pre");
textE.innerHTML = txt;
} else {
textE = document.createElement("p");
textE.innerHTML = txt.replace(/(?:\r\n|\r|\n)/g, '<br>');
}
content.appendChild(closeButton);
content.appendChild(textE);

@ -100,6 +100,12 @@ function createElement(type, params) {
class:"tooltiptext",
innerHTML:params.tooltip
}));
} else if (params.tooltipleft) {
el.className += " tooltip";
el.appendChild(createElement("span", {
class:"tooltiptextleft",
innerHTML:params.tooltipleft
}));
}
if (params.href) {el.href = params.href;}
if (params.target) {el.target = params.target;}

@ -139,6 +139,17 @@ function isHTML(str) {
return false;
}
//Generates a random alphanumeric string with N characters
function generateRandomString(n) {
var str = "",
chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
for (var i = 0; i < n; i++)
str += chars.charAt(Math.floor(Math.random() * chars.length));
return str;
}
export {getIndicesOf, convertTimeMsToTimeElapsedString, longestCommonStart,
isString, isPositiveNumber, containsAllStrings, formatNumber,
numOccurrences, numNetscriptOperators, isHTML};
numOccurrences, numNetscriptOperators, isHTML, generateRandomString};

26
webpack.config.js Normal file

@ -0,0 +1,26 @@
var webpack = require('webpack');
module.exports = {
plugins: [
// http://stackoverflow.com/questions/29080148/expose-jquery-to-real-window-object-with-webpack
new webpack.ProvidePlugin({
// Automtically detect jQuery and $ as free var in modules
// and inject the jquery library
// This is required by many jquery plugins
jquery: "jquery",
jQuery: "jquery",
$: "jquery"
}),
],
entry: "./src/engine.js",
output: {
path: __dirname + "/dist/",
filename: "bundle.js"
},
module: {
loaders: [
{ test: /\.css$/, loader: "style!css" },
]
}
};