Merge pull request #192 from danielyxie/dev

Dev
This commit is contained in:
danielyxie 2018-02-14 22:42:51 -06:00 committed by GitHub
commit 2e6c1b73bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
38 changed files with 3615 additions and 2942 deletions

@ -609,61 +609,6 @@ div.faction-clear {
padding: 6px;
}
.gang-member-header {
background-color: #444;
font-size: 20px;
color: white;
margin: 6px 6px 0px 6px;
padding: 6px;
cursor: pointer;
width: 80%;
text-align: left;
border: none;
outline: none;
}
.gang-member-header.active,
.gang-member-header:hover {
background-color: #555;
}
.gang-member-header.active:hover {
background-color: #666;
}
.gang-member-header:after {
content: '\02795'; /* "plus" sign (+) */
font-size: 13px;
color: white;
float: right;
margin-left: 5px;
}
.gang-member-header.active:after {
content: "\2796"; /* "minus" sign (-) */
font-size: 13px;
color: white;
float: right;
margin-left: 5px;
}
.gang-member-panel {
margin: 0px 6px 6px 6px;
padding: 0px 6px 6px 6px;
width: 75%;
margin-left: 5%;
display: none;
background-color: #555;
overflow:auto;
}
.gang-member-panel div,
.gang-member-panel ul,
.gang-member-panel p,
.gang-member-panel ul > li {
background-color: #555;
}
#gang-management-subpage > p {
padding: 4px;
}

@ -1,6 +1,3 @@
/** This removes all padding and margins as well as
setting a default font size and family for the page **/
:root{
--my-font-color: #66ff33;
--my-background-color: #000000;

3597
dist/bundle.js vendored

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -248,6 +248,26 @@ exec
exec("foo.script", "foodnstuff", 5, 1, "test");
spawn
^^^^^
.. js:function:: spawn(script, numThreads, [args...])
:param string script: Filename of script to execute
:param number numThreads: Number of threads to spawn new script with. Will be rounded to nearest integer
:param args...:
Additional arguments to pass into the new script that is being run.
Terminates the current script, and then after a delay of about 20 seconds it will execute the newly-specified script.
The purpose of this function is to execute a new script without being constrained by the RAM usage of the current one.
This function can only be used to run scripts on the local server.
Because this function immediately terminates the script, it does not have a return value.
The following example will execute the script 'foo.script' with 10 threads and the arguments 'foodnstuff' and 90::
spawn('foo.script', 10, 'foodnstuff', 90);
kill
^^^^

@ -162,6 +162,25 @@ isBusy
Returns a boolean indicating whether or not the player is currently performing an 'action'. These actions include
working for a company/faction, studying at a univeristy, working out at a gym, creating a program, or committing a crime.
stopAction
----------
.. js:function:: stopAction()
If you are not in BitNode-4, then you must have Level 1 of Source-File 4 in order to run this function.
This function is used to end whatever 'action' the player is currently performing. The player
will receive whatever money/experience/etc. he has earned from that action.
The actions that can be stopped with this function are:
* Studying at a university
* Working for a company/faction
* Creating a program
* Committing a Crime
This function will return true if the player's action was ended. It will return false if the player was not
performing an action when this function was called.
upgradeHomeRam
--------------

@ -367,19 +367,23 @@
</li>
<li><a href="netscriptixapi.html#sellShort">sellShort() (built-in function)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="netscriptixapi.html#sellStock">sellStock() (built-in function)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="netscriptfunctions.html#serverExists">serverExists() (built-in function)</a>
</li>
<li><a href="netscriptixapi.html#shortStock">shortStock() (built-in function)</a>
</li>
<li><a href="netscriptfunctions.html#sleep">sleep() (built-in function)</a>
</li>
<li><a href="netscriptfunctions.html#spawn">spawn() (built-in function)</a>
</li>
<li><a href="netscriptfunctions.html#sprintf">sprintf() (built-in function)</a>
</li>
<li><a href="netscriptfunctions.html#sqlinject">sqlinject() (built-in function)</a>
</li>
<li><a href="netscriptsingularityfunctions.html#stopAction">stopAction() (built-in function)</a>
</li>
</ul></td>
</tr></table>

@ -96,6 +96,7 @@ secrets that you've been searching for.</p>
<li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#sqlinject">sqlinject</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#run">run</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#exec">exec</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#spawn">spawn</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#kill">kill</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#killall">killall</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptfunctions.html#exit">exit</a></li>
@ -173,6 +174,7 @@ secrets that you've been searching for.</p>
<li class="toctree-l3"><a class="reference internal" href="netscriptsingularityfunctions.html#purchaseprogram">purchaseProgram</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptsingularityfunctions.html#getstats">getStats</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptsingularityfunctions.html#isbusy">isBusy</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptsingularityfunctions.html#stopaction">stopAction</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptsingularityfunctions.html#upgradehomeram">upgradeHomeRam</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptsingularityfunctions.html#getupgradehomeramcost">getUpgradeHomeRamCost</a></li>
<li class="toctree-l3"><a class="reference internal" href="netscriptsingularityfunctions.html#workforcompany">workForCompany</a></li>

@ -97,6 +97,7 @@ to reach out to the developer!</p>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#sqlinject">sqlinject</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#run">run</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#exec">exec</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#spawn">spawn</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#kill">kill</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#killall">killall</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html#exit">exit</a></li>
@ -174,6 +175,7 @@ to reach out to the developer!</p>
<li class="toctree-l2"><a class="reference internal" href="netscriptsingularityfunctions.html#purchaseprogram">purchaseProgram</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptsingularityfunctions.html#getstats">getStats</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptsingularityfunctions.html#isbusy">isBusy</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptsingularityfunctions.html#stopaction">stopAction</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptsingularityfunctions.html#upgradehomeram">upgradeHomeRam</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptsingularityfunctions.html#getupgradehomeramcost">getUpgradeHomeRamCost</a></li>
<li class="toctree-l2"><a class="reference internal" href="netscriptsingularityfunctions.html#workforcompany">workForCompany</a></li>

@ -460,6 +460,35 @@ the number 1 and the string &quot;test&quot; in as arguments to the script:</p>
</div>
</dd></dl>
</div>
<div class="section" id="spawn">
<h2>spawn<a class="headerlink" href="#spawn" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt>
<code class="descname">spawn</code><span class="sig-paren">(</span><em>script</em>, <em>numThreads</em><span class="optional">[</span>, <em>args...</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>script</strong> (<em>string</em>) -- Filename of script to execute</li>
<li><strong>numThreads</strong> (<em>number</em>) -- Number of threads to spawn new script with. Will be rounded to nearest integer</li>
<li><strong>args...</strong> -- Additional arguments to pass into the new script that is being run.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>Terminates the current script, and then after a delay of about 20 seconds it will execute the newly-specified script.
The purpose of this function is to execute a new script without being constrained by the RAM usage of the current one.
This function can only be used to run scripts on the local server.</p>
<p>Because this function immediately terminates the script, it does not have a return value.</p>
<p>The following example will execute the script 'foo.script' with 10 threads and the arguments 'foodnstuff' and 90:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">spawn</span><span class="p">(</span><span class="s1">&#39;foo.script&#39;</span><span class="p">,</span> <span class="mi">10</span><span class="p">,</span> <span class="s1">&#39;foodnstuff&#39;</span><span class="p">,</span> <span class="mi">90</span><span class="p">);</span>
</pre></div>
</div>
</dd></dl>
</div>
<div class="section" id="kill">
<h2>kill<a class="headerlink" href="#kill" title="Permalink to this headline"></a></h2>
@ -1485,6 +1514,7 @@ you create in functions such as <a class="reference external" href="https://deve
<li class="toctree-l3"><a class="reference internal" href="#sqlinject">sqlinject</a></li>
<li class="toctree-l3"><a class="reference internal" href="#run">run</a></li>
<li class="toctree-l3"><a class="reference internal" href="#exec">exec</a></li>
<li class="toctree-l3"><a class="reference internal" href="#spawn">spawn</a></li>
<li class="toctree-l3"><a class="reference internal" href="#kill">kill</a></li>
<li class="toctree-l3"><a class="reference internal" href="#killall">killall</a></li>
<li class="toctree-l3"><a class="reference internal" href="#exit">exit</a></li>

@ -247,6 +247,26 @@ Terminal <em>buy</em> command.</p>
working for a company/faction, studying at a univeristy, working out at a gym, creating a program, or committing a crime.</p>
</dd></dl>
</div>
<div class="section" id="stopaction">
<h2>stopAction<a class="headerlink" href="#stopaction" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt id="stopAction">
<code class="descname">stopAction</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#stopAction" title="Permalink to this definition"></a></dt>
<dd><p>If you are not in BitNode-4, then you must have Level 1 of Source-File 4 in order to run this function.
This function is used to end whatever 'action' the player is currently performing. The player
will receive whatever money/experience/etc. he has earned from that action.</p>
<p>The actions that can be stopped with this function are:</p>
<ul class="simple">
<li>Studying at a university</li>
<li>Working for a company/faction</li>
<li>Creating a program</li>
<li>Committing a Crime</li>
</ul>
<p>This function will return true if the player's action was ended. It will return false if the player was not
performing an action when this function was called.</p>
</dd></dl>
</div>
<div class="section" id="upgradehomeram">
<h2>upgradeHomeRam<a class="headerlink" href="#upgradehomeram" title="Permalink to this headline"></a></h2>
@ -656,6 +676,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="#purchaseprogram">purchaseProgram</a></li>
<li class="toctree-l3"><a class="reference internal" href="#getstats">getStats</a></li>
<li class="toctree-l3"><a class="reference internal" href="#isbusy">isBusy</a></li>
<li class="toctree-l3"><a class="reference internal" href="#stopaction">stopAction</a></li>
<li class="toctree-l3"><a class="reference internal" href="#upgradehomeram">upgradeHomeRam</a></li>
<li class="toctree-l3"><a class="reference internal" href="#getupgradehomeramcost">getUpgradeHomeRamCost</a></li>
<li class="toctree-l3"><a class="reference internal" href="#workforcompany">workForCompany</a></li>

Binary file not shown.

File diff suppressed because one or more lines are too long

@ -248,6 +248,26 @@ exec
exec("foo.script", "foodnstuff", 5, 1, "test");
spawn
^^^^^
.. js:function:: spawn(script, numThreads, [args...])
:param string script: Filename of script to execute
:param number numThreads: Number of threads to spawn new script with. Will be rounded to nearest integer
:param args...:
Additional arguments to pass into the new script that is being run.
Terminates the current script, and then after a delay of about 20 seconds it will execute the newly-specified script.
The purpose of this function is to execute a new script without being constrained by the RAM usage of the current one.
This function can only be used to run scripts on the local server.
Because this function immediately terminates the script, it does not have a return value.
The following example will execute the script 'foo.script' with 10 threads and the arguments 'foodnstuff' and 90::
spawn('foo.script', 10, 'foodnstuff', 90);
kill
^^^^

@ -162,6 +162,25 @@ isBusy
Returns a boolean indicating whether or not the player is currently performing an 'action'. These actions include
working for a company/faction, studying at a univeristy, working out at a gym, creating a program, or committing a crime.
stopAction
----------
.. js:function:: stopAction()
If you are not in BitNode-4, then you must have Level 1 of Source-File 4 in order to run this function.
This function is used to end whatever 'action' the player is currently performing. The player
will receive whatever money/experience/etc. he has earned from that action.
The actions that can be stopped with this function are:
* Studying at a university
* Working for a company/faction
* Creating a program
* Committing a Crime
This function will return true if the player's action was ended. It will return false if the player was not
performing an action when this function was called.
upgradeHomeRam
--------------

@ -135,14 +135,22 @@
</fieldset>
<fieldset>
<label for="script-editor-option-showinvisibles">Show Invisibles</label></td>
<label for="script-editor-option-showinvisibles">Show Invisibles</label>
<input type="checkbox" name="script-editor-option-showinvisibles" id="script-editor-option-showinvisibles">
</fieldset>
<fieldset>
<label for="script-editor-option-usesofttab">Use Soft Tab</label></td>
<label for="script-editor-option-usesofttab">Use Soft Tab</label>
<input type="checkbox" name="script-editor-option-usesofttab" id="script-editor-option-usesofttab" checked>
</fieldset>
<fieldset>
<label for="script-editor-option-maxerr" class="tooltip">Max Error Count</label>
<input type="range" max="1000" min="50" value="200"
step="1" name="script-editor-option-maxerr" id="script-editor-option-maxerr"
</input>
<em id="script-editor-option-maxerror-value-label" style="font-style: normal;"></em>
</fieldset>
</div> <!-- End script editor options panel -->
</div>

File diff suppressed because it is too large Load Diff

@ -537,7 +537,7 @@ var IndustryUpgrades = {
"AdVert.Inc", "Hire AdVert.Inc to advertise your company. Each level of " +
"this upgrade grants your company a static increase of 4 and 1 to its awareness and " +
"popularity, respectively. It will then increase your company's awareness by 1%, and its popularity " +
"by a random percentage between 5% and 15%. These effects are increased by other upgrades " +
"by a random percentage between 5% and 10%. These effects are increased by other upgrades " +
"that increase the power of your advertising."]
}
@ -1436,7 +1436,7 @@ Industry.prototype.upgrade = function(upgrade, refs) {
this.awareness += (4 * advMult);
this.popularity += (1 * advMult);
this.awareness *= (1.01 * advMult);
this.popularity *= ((1 + Math.random(5, 15) / 100) * advMult);
this.popularity *= ((1 + getRandomInt(5, 10) / 100) * advMult);
break;
default:
console.log("ERROR: Un-implemented function index: " + upgN);

@ -1,5 +1,5 @@
let CONSTANTS = {
Version: "0.34.3",
Version: "0.34.4",
//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
@ -49,6 +49,7 @@ let CONSTANTS = {
ScriptPortProgramRamCost: 0.05,
ScriptRunRamCost: 1.0,
ScriptExecRamCost: 1.3,
ScriptSpawnRamCost: 2.0,
ScriptScpRamCost: 0.6,
ScriptKillRamCost: 0.5, //Kill and killall
ScriptHasRootAccessRamCost: 0.05,
@ -502,7 +503,15 @@ let CONSTANTS = {
"The following example will try to run the script 'foo.script' on the 'foodnstuff' server with 5 threads. It will also pass the number 1 and the string 'test' in as arguments " +
"to the script.<br><br>" +
"exec('foo.script', 'foodnstuff', 5, 1, 'test');<br><br>" +
"<i><u>kill(script, hostname/ip, [args...])</u></i><br> Kills the script on the target server specified by the script's name and arguments. Remember that " +
"<i><u>spawn(script, numThreads, [args...])</u></i><br>Terminates the current script, and then after a delay of about 20 seconds " +
"it will execute the newly specified script. The purpose of this function is to execute a new script without being constrained " +
"by the RAM usage of the current one. This function can only be used to run scripts on the local server.<br><br>" +
"The first argument must be a string with the name of the script. The second argument must be an integer specifying the number " +
"of threads to run the script with. Any additional arguments will specify arguments to pass into the 'newly-spawned' script." +
"Because this function immediately terminates the script, it does not have a return value.<br><br>" +
"The following example will execute the script 'foo.script' with 10 threads and the arguments 'foodnstuff' and 90:<br><br>" +
"spawn('foo.script', 10, 'foodnstuff', 90);<br><br>" +
"<i><u>kill(script, hostname/ip, [args...])</u></i><br>Kills the script on the target server specified by the script's name and arguments. Remember that " +
"scripts are uniquely identified by both their name and arguments. For example, if 'foo.script' is run with the argument 1, then this is not the " +
"same as 'foo.script' run with the argument 2, even though they have the same code. <br><br>" +
"The first argument must be a string with the name of the script. The name is case-sensitive. " +
@ -902,6 +911,13 @@ let CONSTANTS = {
"function.<br><br>Returns a boolean indicating whether or not the player is currently performing an 'action'. " +
"These actions include working for a company/faction, studying at a univeristy, working out at a gym, " +
"creating a program, or committing a crime.<br><br>" +
"<i><u>stopAction()</u></i><br>If you are not in BitNode-4, then you must have Level 1 of Source-File 4 in order to " +
"run this function.<br><br>This function is used to end whatever 'action' the player is currently performing. The player " +
"will receive whatever money/experience/etc. he has earned from that action. The actions that can be stopped with this function " +
"are:<br><br> " +
"-Studying at a university<br>-Working for a company/faction<br>-Creating a program<br>-Committing a Crime<br><br> " +
"This function will return true if the player's action was ended. It will return false if the player was not " +
"performing an action when this function was called.<br><br>" +
"<i><u>upgradeHomeRam()</u></i><br>" +
"If you are not in BitNode-4, then you must have Level 2 of Source-File 4 in order to use this function.<br><br>" +
"This function will upgrade amount of RAM on the player's home computer. The cost is the same as if you were to do it manually.<br><br>" +
@ -1113,39 +1129,20 @@ let CONSTANTS = {
"World Stock Exchange account and TIX API Access<br>",
LatestUpdate:
"v0.34.2<br>" +
"-Corporation Management Changes:<br>" +
"---Added advertising mechanics<br>" +
"---Added Industry-specific purchases<br>" +
"---Re-designed employee management UI<br>" +
"---Rebalancing: Made many upgrades/purchases cheaper. Receive more money from investors in early stage. Company valuation is higher after going public<br>" +
"---Multiple bug fixes<br>" +
"-Added rm() Netscript function<br>" +
"-Updated the way script RAM usage is calculated. Now, a function only increases RAM usage the first time it is called. i.e. even if you call hack() multiple times in a script, it only counts against RAM usage once. The same change applies for while/for loops and if conditionals.<br>" +
"-The RAM cost of the following were increased:<br>" +
"---If statements: increased by 0.05GB<br>" +
"---run() and exec(): increased by 0.2GB<br>" +
"---scp(): increased by 0.1GB<br>" +
"---purchaseServer(): increased by 0.25GB<br>" +
"-Note: You may need to re-save all of your scripts in order to re-calculate their RAM usages. Otherwise, it should automatically be re-calculated when you reset/prestige<br>" +
"-The cost to upgrade your home computer's RAM has been increased (both the base cost and the exponential upgrade multiplier)<br>" +
"-The cost of purchasing a server was increased by 10% (it is now $55k per RAM)<br>" +
"-Bug fix: (Hopefully) removed an exploit where you could avoid RAM usage for Netscript function calls by assigning functions to a variable (foo = hack(); foo('helios');)<br>" +
"-Bug fix: (Hopefully) removed an exploit where you could run arbitrary Javascript code using the constructor() method<br>" +
"-Thanks to Github user mateon1 and Reddit users havoc_mayhem and spaceglace for notifying me of the above exploits<br>" +
"-The fileExists() Netscript function now works on text files (.txt). Thanks to Github user devoidfury for this<br><br>" +
"v0.34.3<br>" +
"-Minor balance changes to Corporations: <br>" +
"---Upgrades are generally cheaper and/or have more powerful effects.<br>" +
"---You will receive more funding while your are a private company.<br>" +
"---Product demand decreases at a slower rate.<br>" +
"---Production multiplier for Industries (receives for owning real estate/hardware/robots/etc.) is slightly higher<br>" +
"-Accessing the hacknetnodes array in Netscript now costs 4.0GB of RAM (only counts against RAM usage once)<br>" +
"-Bug Fix: Corporation oustanding shares should now be numeric rather than a string<br>" +
"-Bug Fix: Corporation production now properly calculated for industries that dont produce materials.<br>" +
"-Bug Fix: Gangs should now properly reset when switching BitNodes<br>" +
"-Bug Fix: Corporation UI should now properly reset when you go public<br>"
"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>"
}
export {CONSTANTS};

@ -846,7 +846,12 @@ function displayFactionAugmentations(factionName) {
var pElem = document.createElement("p");
aElem.setAttribute("href", "#");
var req = aug.baseRepRequirement * faction.augmentationRepRequirementMult;
if (aug.name != AugmentationNames.NeuroFluxGovernor && (aug.owned || owned)) {
var hasPrereqs = hasAugmentationPrereqs(aug);
if (!hasPrereqs) {
aElem.setAttribute("class", "a-link-button-inactive");
pElem.innerHTML = "LOCKED (Requires " + aug.prereqs.join(",") + " as prerequisite(s))";
pElem.style.color = "red";
} else if (aug.name != AugmentationNames.NeuroFluxGovernor && (aug.owned || owned)) {
aElem.setAttribute("class", "a-link-button-inactive");
pElem.innerHTML = "ALREADY OWNED";
} else if (faction.playerReputation >= req) {
@ -901,57 +906,38 @@ function purchaseAugmentationBoxCreate(aug, fac) {
formatNumber(aug.baseCost * fac.augmentationPriceMult, 2) + "?");
}
//Returns a boolean indicating whether the player has the prerequisites for the
//specified Augmentation
function hasAugmentationPrereqs(aug) {
var hasPrereqs = true;
if (aug.prereqs && aug.prereqs.length > 0) {
for (var i = 0; i < aug.prereqs.length; ++i) {
var prereqAug = Augmentations[aug.prereqs[i]];
if (prereqAug == null) {
console.log("ERROR: Invalid prereq Augmentation: " + aug.prereqs[i]);
continue;
}
if (prereqAug.owned === false) {
hasPrereqs = false;
//Check if the aug is purchased
for (var j = 0; j < Player.queuedAugmentations.length; ++j) {
if (Player.queuedAugmentations[j].name === prereqAug.name) {
hasPrereqs = true;
break;
}
}
}
}
}
return hasPrereqs;
}
function purchaseAugmentation(aug, fac, sing=false) {
if (aug.name == AugmentationNames.Targeting2 &&
Augmentations[AugmentationNames.Targeting1].owned == false) {
var txt = "You must first install Augmented Targeting I before you can upgrade it to Augmented Targeting II";
if (sing) {return txt;} else {dialogBoxCreate(txt);}
} else if (aug.name == AugmentationNames.Targeting3 &&
Augmentations[AugmentationNames.Targeting2].owned == false) {
var txt = "You must first install Augmented Targeting II before you can upgrade it to Augmented Targeting III";
if (sing) {return txt;} else {dialogBoxCreate(txt);}
} else if (aug.name == AugmentationNames.CombatRib2 &&
Augmentations[AugmentationNames.CombatRib1].owned == false) {
var txt = "You must first install Combat Rib I before you can upgrade it to Combat Rib II";
if (sing) {return txt;} else {dialogBoxCreate(txt);}
} else if (aug.name == AugmentationNames.CombatRib3 &&
Augmentations[AugmentationNames.CombatRib2].owned == false) {
var txt = "You must first install Combat Rib II before you can upgrade it to Combat Rib III";
if (sing) {return txt;} else {dialogBoxCreate(txt);}
} else if (aug.name == AugmentationNames.GrapheneBionicSpine &&
Augmentations[AugmentationNames.BionicSpine].owned == false) {
var txt = "You must first install a Bionic Spine before you can upgrade it to a Graphene Bionic Spine";
if (sing) {return txt;} else {dialogBoxCreate(txt);}
} else if (aug.name == AugmentationNames.GrapheneBionicLegs &&
Augmentations[AugmentationNames.BionicLegs].owned == false) {
var txt = "You must first install Bionic Legs before you can upgrade it to Graphene Bionic Legs";
if (sing) {return txt;} else {dialogBoxCreate(txt);}
} else if (aug.name == AugmentationNames.ENMCoreV2 &&
Augmentations[AugmentationNames.ENMCore].owned == false) {
var txt = "You must first install Embedded Netburner Module Core Implant before you can upgrade it to V2";
if (sing) {return txt;} else {dialogBoxCreate(txt);}
} else if (aug.name == AugmentationNames.ENMCoreV3 &&
Augmentations[AugmentationNames.ENMCoreV2].owned == false) {
var txt = "You must first install Embedded Netburner Module Core V2 Upgrade before you can upgrade it to V3";
if (sing) {return txt;} else {dialogBoxCreate(txt);}
} else if ((aug.name == AugmentationNames.ENMCore ||
aug.name == AugmentationNames.ENMAnalyzeEngine ||
aug.name == AugmentationNames.ENMDMA) &&
Augmentations[AugmentationNames.ENM].owned == false) {
var txt = "You must first install the Embedded Netburner Module before installing any upgrades to it";
if (sing) {return txt;} else {dialogBoxCreate(txt);}
} else if ((aug.name == AugmentationNames.PCDNIOptimizer ||
aug.name == AugmentationNames.PCDNINeuralNetwork) &&
Augmentations[AugmentationNames.PCDNI].owned == false) {
var txt = "You must first install the Pc Direct-Neural Interface before installing this upgrade";
if (sing) {return txt;} else {dialogBoxCreate(txt);}
} else if (aug.name == AugmentationNames.GrapheneBrachiBlades &&
Augmentations[AugmentationNames.BrachiBlades].owned == false) {
var txt = "You must first install the Brachi Blades augmentation before installing this upgrade";
if (sing) {return txt;} else {dialogBoxCreate(txt);}
} else if (aug.name == AugmentationNames.GrapheneBionicArms &&
Augmentations[AugmentationNames.BionicArms].owned == false) {
var txt = "You must first install the Bionic Arms augmentation before installing this upgrade";
var hasPrereqs = hasAugmentationPrereqs(aug);
if (!hasPrereqs) {
var txt = "You must first purchase or install " + aug.prereqs.join(",") + " before you can " +
"purchase this one.";
if (sing) {return txt;} else {dialogBoxCreate(txt);}
} else if (Player.money.gte(aug.baseCost * fac.augmentationPriceMult)) {
if (Player.firstAugPurchased === false) {
@ -974,7 +960,8 @@ function purchaseAugmentation(aug, fac, sing=false) {
var nextLevel = getNextNeurofluxLevel();
--nextLevel;
var mult = Math.pow(CONSTANTS.NeuroFluxGovernorLevelMult, nextLevel);
aug.setRequirements(500 * mult, 750000 * mult);
aug.baseRepRequirement = 500 * mult * CONSTANTS.AugmentationRepMultiplier * BitNodeMultipliers.AugmentationRepCost;
aug.baseCost = 750e3 * mult * CONSTANTS.AugmentationCostMultiplier * BitNodeMultipliers.AugmentationMoneyCost;
for (var i = 0; i < Player.queuedAugmentations.length-1; ++i) {
aug.baseCost *= CONSTANTS.MultipleAugMultiplier;

File diff suppressed because it is too large Load Diff

@ -9,7 +9,7 @@ let TerminalHelpText =
"clear Clear all text on the terminal <br>" +
"cls See 'clear' command <br>" +
"connect [ip/hostname] Connects to a remote server<br>" +
"download [text file] Downloads a text (.txt) file to your computer<br>" +
"download [script/text file] Downloads a script or text file to your computer<br>" +
"free Check the machine's memory (RAM) usage<br>" +
"hack Hack the current machine<br>" +
"help [command] Display this help text, or the help text for a command<br>" +
@ -86,9 +86,8 @@ let HelpTexts = {
"Connect to a remote server. The hostname or IP address of the remote server must be given as the argument " +
"to this command. Note that only servers that are immediately adjacent to the current server in the network can be connected to. To " +
"see which servers can be connected to, use the 'scan' command.",
download: "download [text file]<br>" +
"Downloads a text file to your computer (like your real life computer). Only works on text files, " +
"which are the ones with a .txt extension.",
download: "download [script/text file]<br>" +
"Downloads a script or text file to your computer (like your real life computer).",
free: "free<br>" +
"Display's the memory usage on the current machine. Print the amount of RAM that is available on the current server as well as " +
"how much of it is being used.",

@ -559,6 +559,24 @@ function NetscriptFunctions(workerScript) {
}
return runScriptFromScript(server, scriptname, argsForNewScript, workerScript, threads);
},
spawn : function(scriptname, threads) {
if (workerScript.checkingRam) {
if (workerScript.loadedFns.spawn) {
return 0;
} else {
workerScript.loadedFns.spawn = true;
return CONSTANTS.ScriptSpawnRamCost;
}
}
if (scriptname == null || threads == 1) {
throw makeRuntimeRejectMsg(workerScript, "Invalid scriptname or numThreads argument passed to spawn()");
}
setTimeout(()=>{
NetscriptFunctions(workerScript).run.apply(this, arguments);
}, 20000);
workerScript.scriptRef.log("spawn() will execute " + scriptname + " in 20 seconds");
NetscriptFunctions(workerScript).exit();
},
kill : function(filename,ip) {
if (workerScript.checkingRam) {
if (workerScript.loadedFns.kill) {
@ -2398,6 +2416,24 @@ function NetscriptFunctions(workerScript) {
}
return Player.isWorking;
},
stopAction : function() {
if (workerScript.checkingRam) {
if (workerScript.loadedFns.stopAction) {
return 0;
} else {
workerScript.loadedFns.stopAction = true;
var ramCost = CONSTANTS.ScriptSingularityFn1RamCost;
if (Player.bitNodeN !== 4) {ramCost *= 10;}
return ramCost;
}
}
if (Player.isWorking) {
var txt = Player.singularityStopWork();
workerScript.scriptRef.log(txt);
return true;
}
return false;
},
upgradeHomeRam() {
if (workerScript.checkingRam) {
if (workerScript.loadedFns.upgradeHomeRam) {

@ -128,6 +128,15 @@ function scriptEditorInit() {
editor.getSession().setUseSoftTabs(softTabChkBox.checked);
};
//Jshint Maxerr
var maxerr = document.getElementById("script-editor-option-maxerr");
var maxerrLabel = document.getElementById("script-editor-option-maxerror-value-label");
maxerrLabel.innerHTML = maxerr.value;
maxerr.onchange = function() {
editor.getSession().$worker.send("changeOptions", [{maxerr:maxerr.value}]);
maxerrLabel.innerHTML = maxerr.value;
}
//Configure some of the VIM keybindings
ace.config.loadModule('ace/keyboard/vim', function(module) {
var VimApi = module.CodeMirror.Vim;
@ -367,6 +376,25 @@ function calculateRamUsage(codeCopy) {
return ramUsage;
}
Script.prototype.download = function() {
var filename = this.filename;
var file = new Blob([this.code], {type: 'text/plain'});
if (window.navigator.msSaveOrOpenBlob) {// IE10+
window.navigator.msSaveOrOpenBlob(file, filename);
} else { // Others
var a = document.createElement("a"),
url = URL.createObjectURL(file);
a.href = url;
a.download = this.filename;
document.body.appendChild(a);
a.click();
setTimeout(function() {
document.body.removeChild(a);
window.URL.revokeObjectURL(url);
}, 0);
}
}
Script.prototype.toJSON = function() {
return Generic_toJSON("Script", this);
}

@ -8,6 +8,9 @@ let Settings = {
SuppressMessages: false,
SuppressFactionInvites: false,
AutosaveInterval: 60,
ThemeHighlightColor: "#ffffff",
ThemeFontColor: "#66ff33",
ThemeBackgroundColor: "#000000",
}
function loadSettings(saveString) {
@ -81,6 +84,19 @@ function setSettingsLabels() {
document.getElementById("settingsSuppressFactionInvites").onclick = function() {
Settings.SuppressFactionInvites = this.checked;
};
//Theme
if (Settings.ThemeHighlightColor == null || Settings.ThemeFontColor == null || Settings.ThemeBackgroundColor == null) {
console.log("ERROR: Cannot find Theme Settings");
return;
}
if (/^#[0-9a-f]{3}(?:[0-9a-f]{3})?$/i.test(Settings.ThemeHighlightColor) &&
/^#[0-9a-f]{3}(?:[0-9a-f]{3})?$/i.test(Settings.ThemeFontColor) &&
/^#[0-9a-f]{3}(?:[0-9a-f]{3})?$/i.test(Settings.ThemeBackgroundColor)) {
document.body.style.setProperty('--my-highlight-color', Settings.ThemeHighlightColor);
document.body.style.setProperty('--my-font-color', Settings.ThemeFontColor);
document.body.style.setProperty('--my-background-color', Settings.ThemeBackgroundColor);
}
}
export {Settings, initSettings, setSettingsLabels, loadSettings};

@ -23,6 +23,7 @@ import {findRunningScript, RunningScript,
AllServersMap, Script} from "./Script.js";
import {AllServers, GetServerByHostname,
getServer, Server} from "./Server.js";
import {Settings} from "./Settings.js";
import {SpecialServerIps,
SpecialServerNames} from "./SpecialServerIps.js";
import {TextFile, getTextFile,
@ -401,6 +402,9 @@ function determineAllPossibilitiesForTabCompletion(input, index=0) {
for (var i = 0; i < currServ.textFiles.length; ++i) {
allPos.push(currServ.textFiles[i].fn);
}
for (var i = 0; i < currServ.scripts.length; ++i) {
allPos.push(currServ.scripts[i].filename);
}
}
return allPos;
}
@ -828,12 +832,19 @@ let Terminal = {
return;
}
var fn = commandArray[1];
var txtFile = getTextFile(fn, s);
if (txtFile !== null) {
txtFile.download();
} else {
post("Error: " + fn + " does not exist");
if (fn.endsWith(".script")) {
for (var i = 0; i < s.scripts.length; ++i) {
if (s.scripts[i].filename === fn) {
return s.scripts[i].download();
}
}
} else if (fn.endsWith(".txt")) {
var txtFile = getTextFile(fn, s);
if (txtFile !== null) {
return txtFile.download();
}
}
post("Error: " + fn + " does not exist");
break;
case "free":
Terminal.executeFreeCommand(commandArray);
@ -1055,7 +1066,7 @@ let Terminal = {
} else {
var executableName = commandArray[1];
//Music player!
//Secret Music player!
if (executableName === "musicplayer") {
post('<iframe src="https://open.spotify.com/embed/user/danielyxie/playlist/1ORnnL6YNvXOracUaUV2kh" width="300" height="380" frameborder="0" allowtransparency="true"></iframe>', false);
return;
@ -1231,38 +1242,44 @@ let Terminal = {
case "theme":
//todo support theme saving
var args = commandArray[1] ? commandArray[1].split(" ") : [];
if(args.length != 1 && args.length != 3) {
if (args.length != 1 && args.length != 3) {
post("Incorrect number of arguments.");
post("Usage: theme [default|muted|solarized] | #[background color hex] #[text color hex] #[highlight color hex]");
}else if(args.length == 1){
} else if(args.length == 1){
var themeName = args[0];
if(themeName == "default"){
if (themeName == "default"){
document.body.style.setProperty('--my-highlight-color',"#ffffff");
document.body.style.setProperty('--my-font-color',"#66ff33");
document.body.style.setProperty('--my-background-color',"#000000");
}else if(themeName == "muted"){
} else if (themeName == "muted"){
document.body.style.setProperty('--my-highlight-color',"#ffffff");
document.body.style.setProperty('--my-font-color',"#66ff33");
document.body.style.setProperty('--my-background-color',"#252527");
}else if(themeName == "solarized"){
} else if (themeName == "solarized"){
document.body.style.setProperty('--my-highlight-color',"#6c71c4");
document.body.style.setProperty('--my-font-color',"#839496");
document.body.style.setProperty('--my-background-color',"#002b36");
}else{
post("Theme not found");
} else {
return post("Theme not found");
}
}else{
Settings.ThemeHighlightColor = document.body.style.getPropertyValue("--my-highlight-color");
Settings.ThemeFontColor = document.body.style.getPropertyValue("--my-font-color");
Settings.ThemeBackgroundColor = document.body.style.getPropertyValue("--my-background-color");
} else {
var inputBackgroundHex = args[0];
var inputTextHex = args[1];
var inputHighlightHex = args[2];
if(/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(inputBackgroundHex) &&
if (/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(inputBackgroundHex) &&
/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(inputTextHex) &&
/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(inputHighlightHex)){
document.body.style.setProperty('--my-highlight-color',inputHighlightHex);
document.body.style.setProperty('--my-font-color',inputTextHex);
document.body.style.setProperty('--my-background-color',inputBackgroundHex);
}else{
post("Invalid Hex Input for theme");
Settings.ThemeHighlightColor = document.body.style.getPropertyValue("--my-highlight-color");
Settings.ThemeFontColor = document.body.style.getPropertyValue("--my-font-color");
Settings.ThemeBackgroundColor = document.body.style.getPropertyValue("--my-background-color");
} else {
return post("Invalid Hex Input for theme");
}
}
break;

@ -47,6 +47,12 @@ function removeElementById(id) {
elem.parentNode.removeChild(elem);
}
function removeElement(elem) {
if (elem == null) {return;}
while(elem.firstChild) {elem.removeChild(elem.firstChild);}
elem.parentNode.removeChild(elem);
}
function removeChildrenFromElement(el) {
if (isString(el)) {
el = document.getElementById(el);
@ -106,6 +112,9 @@ function createElement(type, params) {
if (params.changeListener) {
el.addEventListener("change", params.changeListener);
}
if (params.onkeyup) {
el.addEventListener("keyup", params.onkeyup);
}
return el;
}
@ -117,6 +126,7 @@ function createPopup(id, elems) {
}),
content = createElement("div", {
class:"popup-box-content",
id:id + "-content",
});
for (var i = 0; i < elems.length; ++i) {
@ -124,10 +134,10 @@ function createPopup(id, elems) {
}
container.appendChild(content);
document.getElementById("entire-game-container").appendChild(container);
return container;
}
//Creates both the header and panel element of an accordion and sets the click handler
//Returns the 'li' element that contains the hedaer and panel
function createAccordionElement(params) {
var li = document.createElement("li"),
hdr = document.createElement("button"),
@ -153,7 +163,7 @@ function createAccordionElement(params) {
tmpPanel.style.display = "block";
}
}
return li;
return [li, hdr, panel];
}
function clearSelector(selector) {
@ -192,5 +202,5 @@ function powerOfTwo(n) {
export {sizeOfObject, addOffset, clearEventListeners, getRandomInt,
compareArrays, printArray, powerOfTwo, clearEventListenersEl,
removeElementById, createElement, createAccordionElement,
removeElementById, removeElement, createElement, createAccordionElement,
removeChildrenFromElement, createPopup, clearSelector};