diff --git a/dist/bundle.js b/dist/bundle.js index 501bf7ad5..6cdb4d85e 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -3247,7 +3247,7 @@ let CONSTANTS = { "kill('foo.script', getHostname(), 1, 'foodnstuff');

" + "killall(hostname/ip)
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.

" + - "exit()
Terminates the script immediately

" + + "exit()
Terminates the script immediately

" + "scp(script, [source], destination)
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 " + "to be copied, or an array of filenames to be copied. The next two arguments are strings containing the hostname/IPs of the source and target server. " + @@ -3839,6 +3839,9 @@ let CONSTANTS = { "World Stock Exchange account and TIX API Access
", LatestUpdate: + "v0.34.1
" + + "-Added new 'secret' Terminal command. Try: run musicplayer
" + + "v0.34.0
" + "-Added clear() and exit() Netscript functions
" + "-When starting out or prestiging, you will now receive a 'Hacking Starter Guide'. It provides tips/pointers for new players
" + @@ -17377,6 +17380,12 @@ function runScriptsLoop() { var ip = workerScripts[i].serverIp; var name = workerScripts[i].name; + //Free RAM + __WEBPACK_IMPORTED_MODULE_5__Server_js__["b" /* AllServers */][ip].ramUsed -= workerScripts[i].ramUsage; + + //Delete script from Active Scripts + Object(__WEBPACK_IMPORTED_MODULE_0__ActiveScriptsUI_js__["b" /* deleteActiveScriptsItem */])(workerScripts[i]); + for (var j = 0; j < __WEBPACK_IMPORTED_MODULE_5__Server_js__["b" /* AllServers */][ip].runningScripts.length; j++) { if (__WEBPACK_IMPORTED_MODULE_5__Server_js__["b" /* AllServers */][ip].runningScripts[j].filename == name && Object(__WEBPACK_IMPORTED_MODULE_9__utils_HelperFunctions_js__["d" /* compareArrays */])(__WEBPACK_IMPORTED_MODULE_5__Server_js__["b" /* AllServers */][ip].runningScripts[j].args, workerScripts[i].args)) { @@ -17385,12 +17394,6 @@ function runScriptsLoop() { } } - //Free RAM - __WEBPACK_IMPORTED_MODULE_5__Server_js__["b" /* AllServers */][ip].ramUsed -= workerScripts[i].ramUsage; - - //Delete script from Active Scripts - Object(__WEBPACK_IMPORTED_MODULE_0__ActiveScriptsUI_js__["b" /* deleteActiveScriptsItem */])(workerScripts[i]); - //Delete script from workerScripts workerScripts.splice(i, 1); } @@ -28674,6 +28677,13 @@ let Terminal = { post("Incorrect number of arguments. Usage: run [program/script] [-t] [num threads] [arg1] [arg2]..."); } else { var executableName = commandArray[1]; + + //Music player! + if (executableName === "musicplayer") { + post('', false); + return; + } + //Check if its a script or just a program/executable if (executableName.indexOf(".script") == -1) { //Not a script @@ -28865,9 +28875,9 @@ let Terminal = { post("Theme not found"); } }else{ - inputBackgroundHex = args[0]; - inputTextHex = args[1]; - inputHighlightHex = args[2]; + var inputBackgroundHex = args[0]; + var inputTextHex = args[1]; + var inputHighlightHex = args[2]; 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)){ @@ -34534,10 +34544,9 @@ function addActiveScriptsItem(workerscript) { //Create the element itself. Each element is an accordion collapsible var itemNameArray = ["active", "scripts", server.hostname, workerscript.name]; for (var i = 0; i < workerscript.args.length; ++i) { - itemNameArray.push(workerscript.args[i].toString()); + itemNameArray.push(String(workerscript.args[i])); } var itemName = itemNameArray.join("-"); - //var itemName = "active-scripts-" + server.hostname + "-" + workerscript.name; var item = document.createElement("li"); item.setAttribute("id", itemName); @@ -34569,10 +34578,9 @@ function deleteActiveScriptsItem(workerscript) { } var itemNameArray = ["active", "scripts", server.hostname, workerscript.name]; for (var i = 0; i < workerscript.args.length; ++i) { - itemNameArray.push(workerscript.args[i].toString()); + itemNameArray.push(String(workerscript.args[i])); } var itemName = itemNameArray.join("-"); - //var itemName = "active-scripts-" + server.hostname + "-" + workerscript.name; var li = document.getElementById(itemName); if (li == null) { console.log("could not find Active scripts li element for: " + workerscript.name); @@ -34605,7 +34613,7 @@ function updateActiveScriptsItemContent(workerscript) { } var itemNameArray = ["active", "scripts", server.hostname, workerscript.name]; for (var i = 0; i < workerscript.args.length; ++i) { - itemNameArray.push(workerscript.args[i].toString()); + itemNameArray.push(String(workerscript.args[i])); } var itemName = itemNameArray.join("-"); var itemContent = document.getElementById(itemName + "-content") @@ -41355,17 +41363,21 @@ Corporation.prototype.displayCorporationOverviewContent = function() { display:"inline-block", clickListener:()=>{ var shares = Math.round(input.value); + var tempStockPrice = this.sharePrice; if (isNaN(shares)) { Object(__WEBPACK_IMPORTED_MODULE_4__utils_DialogBox_js__["a" /* dialogBoxCreate */])("ERROR: Invalid value for number of shares"); } else if (shares > this.issuedShares) { Object(__WEBPACK_IMPORTED_MODULE_4__utils_DialogBox_js__["a" /* dialogBoxCreate */])("ERROR: There are not this many oustanding shares to buy back"); + } else if (shares * tempStockPrice > __WEBPACK_IMPORTED_MODULE_2__Player_js__["a" /* Player */].money) { + Object(__WEBPACK_IMPORTED_MODULE_4__utils_DialogBox_js__["a" /* dialogBoxCreate */])("ERROR: You do not have enough money to purchase this many shares (you need " + + __WEBPACK_IMPORTED_MODULE_7__utils_numeral_min_js___default()(shares * tempStockPrice).format("$0.000a") + ")"); } else { this.numShares += shares; this.issuedShares -= shares; //TODO REMOVE from Player money Object(__WEBPACK_IMPORTED_MODULE_5__utils_HelperFunctions_js__["l" /* removeElementById */])(popupId); - return false; } + return false; } }); @@ -44258,7 +44270,8 @@ HacknetNode.prototype.updateMoneyGainRate = function() { } HacknetNode.prototype.calculateLevelUpgradeCost = function(levels=1) { - if (levels < 1) {return 0;} + levels = Math.round(levels); + if (isNaN(levels) || levels < 1) {return 0;} var mult = __WEBPACK_IMPORTED_MODULE_1__Constants_js__["a" /* CONSTANTS */].HacknetNodeUpgradeLevelMult; var totalMultiplier = 0; //Summed var currLevel = this.level; @@ -103716,7 +103729,12 @@ BitburnerSaveObject.prototype.exportGame = function() { this.AliasesSave = JSON.stringify(__WEBPACK_IMPORTED_MODULE_0__Alias_js__["a" /* Aliases */]); this.GlobalAliasesSave = JSON.stringify(__WEBPACK_IMPORTED_MODULE_0__Alias_js__["b" /* GlobalAliases */]); this.MessagesSave = JSON.stringify(__WEBPACK_IMPORTED_MODULE_7__Message_js__["b" /* Messages */]); + this.StockMarketSave = JSON.stringify(__WEBPACK_IMPORTED_MODULE_13__StockMarket_js__["c" /* StockMarket */]); + this.SettingsSave = JSON.stringify(__WEBPACK_IMPORTED_MODULE_11__Settings_js__["a" /* Settings */]); this.VersionSave = JSON.stringify(__WEBPACK_IMPORTED_MODULE_2__Constants_js__["a" /* CONSTANTS */].Version); + if (__WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].bitNodeN == 2 && __WEBPACK_IMPORTED_MODULE_8__Player_js__["a" /* Player */].inGang()) { + this.AllGangsSave = JSON.stringify(__WEBPACK_IMPORTED_MODULE_5__Gang_js__["a" /* AllGangs */]); + } var saveString = btoa(unescape(encodeURIComponent(JSON.stringify(this)))); var filename = "bitburnerSave.json"; diff --git a/doc/Makefile b/doc/Makefile new file mode 100644 index 000000000..04de3e359 --- /dev/null +++ b/doc/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = python -msphinx +SPHINXPROJ = Bitburner +SOURCEDIR = source +BUILDDIR = build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) \ No newline at end of file diff --git a/doc/build/doctrees/environment.pickle b/doc/build/doctrees/environment.pickle new file mode 100644 index 000000000..20f11dd90 Binary files /dev/null and b/doc/build/doctrees/environment.pickle differ diff --git a/doc/build/doctrees/index.doctree b/doc/build/doctrees/index.doctree new file mode 100644 index 000000000..c5a617336 Binary files /dev/null and b/doc/build/doctrees/index.doctree differ diff --git a/doc/build/doctrees/netscript.doctree b/doc/build/doctrees/netscript.doctree new file mode 100644 index 000000000..be565a86e Binary files /dev/null and b/doc/build/doctrees/netscript.doctree differ diff --git a/doc/build/doctrees/netscriptadvancedfunctions.doctree b/doc/build/doctrees/netscriptadvancedfunctions.doctree new file mode 100644 index 000000000..0a31c5c2b Binary files /dev/null and b/doc/build/doctrees/netscriptadvancedfunctions.doctree differ diff --git a/doc/build/doctrees/netscriptdatatypes.doctree b/doc/build/doctrees/netscriptdatatypes.doctree new file mode 100644 index 000000000..bd56cc2d4 Binary files /dev/null and b/doc/build/doctrees/netscriptdatatypes.doctree differ diff --git a/doc/build/doctrees/netscriptfunctions.doctree b/doc/build/doctrees/netscriptfunctions.doctree new file mode 100644 index 000000000..cdf12708a Binary files /dev/null and b/doc/build/doctrees/netscriptfunctions.doctree differ diff --git a/doc/build/doctrees/netscripthacknetnodeapi.doctree b/doc/build/doctrees/netscripthacknetnodeapi.doctree new file mode 100644 index 000000000..1fa3c7c61 Binary files /dev/null and b/doc/build/doctrees/netscripthacknetnodeapi.doctree differ diff --git a/doc/build/doctrees/netscriptixapi.doctree b/doc/build/doctrees/netscriptixapi.doctree new file mode 100644 index 000000000..837d6e810 Binary files /dev/null and b/doc/build/doctrees/netscriptixapi.doctree differ diff --git a/doc/build/doctrees/netscriptloopsandconditionals.doctree b/doc/build/doctrees/netscriptloopsandconditionals.doctree new file mode 100644 index 000000000..b697b7e03 Binary files /dev/null and b/doc/build/doctrees/netscriptloopsandconditionals.doctree differ diff --git a/doc/build/doctrees/netscriptoperators.doctree b/doc/build/doctrees/netscriptoperators.doctree new file mode 100644 index 000000000..88fdbb730 Binary files /dev/null and b/doc/build/doctrees/netscriptoperators.doctree differ diff --git a/doc/build/doctrees/netscriptscriptarguments.doctree b/doc/build/doctrees/netscriptscriptarguments.doctree new file mode 100644 index 000000000..a0793a336 Binary files /dev/null and b/doc/build/doctrees/netscriptscriptarguments.doctree differ diff --git a/doc/build/doctrees/netscriptsingularityfunctions.doctree b/doc/build/doctrees/netscriptsingularityfunctions.doctree new file mode 100644 index 000000000..1ce971da5 Binary files /dev/null and b/doc/build/doctrees/netscriptsingularityfunctions.doctree differ diff --git a/doc/build/html/.buildinfo b/doc/build/html/.buildinfo new file mode 100644 index 000000000..664bc1dd2 --- /dev/null +++ b/doc/build/html/.buildinfo @@ -0,0 +1,4 @@ +# Sphinx build info version 1 +# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. +config: 2dc85c27d5b3eafd764454e0cb5932ea +tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/doc/build/html/.nojekyll b/doc/build/html/.nojekyll new file mode 100644 index 000000000..e69de29bb diff --git a/doc/build/html/_sources/index.rst.txt b/doc/build/html/_sources/index.rst.txt new file mode 100644 index 000000000..de1170212 --- /dev/null +++ b/doc/build/html/_sources/index.rst.txt @@ -0,0 +1,31 @@ +.. Bitburner documentation master file, created by + sphinx-quickstart on Wed Oct 4 15:03:07 2017. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to Bitburner's documentation! +===================================== +Bitburner is a cyberpunk-themed `incremental game `_ that is currently in the +early beta stage of development. The game `can be played here `_. + +What is Bitburner? +------------------ +Bitburner is a cyberpunk-themed incremental RPG where you, the player, take the role of an unknown hacker in a dark, dystopian world. +When a mysterious hacker called jump3R messages you, he/she confirms your suspicions that there is something wrong with the world around you. +Now, aided by jump3R, you embark on a quest to gain money and power by any means necessary, in the hopes that this will lead to to uncover the +secrets that you've been searching for. + +.. toctree:: + :maxdepth: 5 + :caption: Contents: + + Netscript + + + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` diff --git a/doc/build/html/_sources/netscript.rst.txt b/doc/build/html/_sources/netscript.rst.txt new file mode 100644 index 000000000..f4bd2d0f9 --- /dev/null +++ b/doc/build/html/_sources/netscript.rst.txt @@ -0,0 +1,25 @@ +Netscript Documentation +======================= +Netscript is the programming language used in the world of Bitburner. + +When you write scripts in Bitburner, they are written in the Netscript language. +Netscript is simply a tiny subset of Javascript. This means that Netscript's +syntax is almost idental to Javascript's, but it does not implement many of the +features that Javascript has. + +If you have any requests or suggestions to improve the Netscript language, feel free +to reach out to the developer! + +.. toctree:: + :maxdepth: 5 + :caption: Sections: + + Data Types and Variables + Operators + Loops and Conditionals + Script Arguments + Basic Functions + Advanced Functions + Hacknet Node API + Trade Information eXchange (TIX) API + Singularity Functions diff --git a/doc/build/html/_sources/netscriptadvancedfunctions.rst.txt b/doc/build/html/_sources/netscriptadvancedfunctions.rst.txt new file mode 100644 index 000000000..e71ebd2b6 --- /dev/null +++ b/doc/build/html/_sources/netscriptadvancedfunctions.rst.txt @@ -0,0 +1,45 @@ +Netscript Advanced Functions +============================ + +These Netscript functions become relevant later on in the game. They are put on a separate page because +they contain spoilers for the game. + +getBitNodeMultipliers +^^^^^^^^^^^^^^^^^^^^^ + +.. js:function:: getBitNodeMultipliers() + + Returns an object containing the current BitNode multipliers. This function requires Source-File 5 in order + to run. The multipliers are returned in integer forms (e.g. 1.5 instead of 150%). The multipliers represent + the difference between the current BitNode and the original BitNode (BitNode-1). For example, if the + *CrimeMoney* multiplier has a value of 0.1, then that means that committing crimes in the current BitNode + will only give 10% of the money you would have received in BitNode-1. The object has the following structure, + (subject to change in the future):: + + { + ServerMaxMoney: 1, + ServerStartingMoney: 1, + ServerGrowthRate: 1, + ServerWeakenRate: 1, + ServerStartingSecurity: 1, + ManualHackMoney: 1, + ScriptHackMoney: 1, + CompanyWorkMoney: 1, + CrimeMoney: 1, + HacknetNodeMoney: 1, + CompanyWorkExpGain: 1, + ClassGymExpGain: 1, + FactionWorkExpGain: 1, + HackExpGain: 1, + CrimeExpGain: 1, + FactionWorkRepGain: 1, + FactionPassiveRepGain: 1, + AugmentationRepCost: 1, + AugmentationMoneyCost: 1, + } + + Example:: + + mults = getBitNodeMultipliers(); + print(mults.ServerMaxMoney); + print(mults.HackExpGain); diff --git a/doc/build/html/_sources/netscriptdatatypes.rst.txt b/doc/build/html/_sources/netscriptdatatypes.rst.txt new file mode 100644 index 000000000..a230fee0e --- /dev/null +++ b/doc/build/html/_sources/netscriptdatatypes.rst.txt @@ -0,0 +1,44 @@ +Netscript Data Types and Variables +================================== + + +Data Types +---------- +Netscript supports three primitive data types: + +**Numbers** - Positive numerics, such as integers and floats. Examples: 6, 0, 10.5 + +**Strings** - A sequence of characters that represents text. The characters must be encapsulated by single or +double quotes. Example: "This is a string" or equivalently 'This is a string'. +*Strings are fully functional* `Javascript strings `_, +*which means that all of the member functions of Javascript strings such as toLowerCase() and includes() are also available in Netscript!* + +**Boolean** - true or false + +**Array** - An array is a special container object that is capable of holding many different values. Arrays are simply Javascript +arrays, and most Javascript array methods can be used in Netscript as well (join(), pop(), splice(), etc.). You can read more about +`Javascript arrays here `_ + +Variables +--------- + +Variables can be thought of as named containers. Their purpose is to label and store data. The data stored in the +variable can then be accessed and changed by referring to the variable's name. The name of a variable must start with +either a letter or an underscore. The rest of the variable name can contain any alphanumeric (letters and numbers), +as well as hyphens and underscores. + +The Netscript language is untyped, meaning that any variable can hold any of the data types above. The value type of a variable +can also change. For example, if a variable initially holds a number, it can later hold a string. + +The following shows how you can declare and initialize variables:: + + i = 1; + s = "This is a string"; + b = false; + +After declaring a variable, the values in variables can be used simply by referencing the name. For example:: + + j = i + 5; + s2 = s + " Adding more letters onto the string" + +The first command above will store the value 6 in the variable j. The second command will store the string "This is a string Adding more letters onto the string" into the variable s2. diff --git a/doc/build/html/_sources/netscriptfunctions.rst.txt b/doc/build/html/_sources/netscriptfunctions.rst.txt new file mode 100644 index 000000000..4723b54fc --- /dev/null +++ b/doc/build/html/_sources/netscriptfunctions.rst.txt @@ -0,0 +1,889 @@ +Netscript Basic Functions +========================= + +This page contains the complete documentation for all functions that are available in Netscript. +This includes information such as function signatures, what they do, and their return values. + +At the end is also a section that describes how to define your own functions in Netscript. + +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 + + 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 + to that server and also have the required hacking 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. + + Example:: + + hack("foodnstuff"); + hack("10.1.2.3"); + +grow +^^^^ + +.. js:function:: grow(hostname/ip) + + :param string hostname/ip: IP or hostname of the target server to grow + :returns: The number by which the money on the server was multiplied for the growth + + Use your hacking skills to increase the amount of money available on a 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 is determined by the target server's growth rate (which varies between servers) and security level. + Generally, higher-level servers have higher growth rates. The getServerGrowth() function can be used to obtain a server's growth rate. + + Like hack(), grow() can be called on any server, regardless of where the script is running. The grow() command requires + root access to the target server, but there is no required hacking level to run the command. It also raises the security level + of the target server by 0.004. + + Example:: + + grow("foodnstuff"); + +weaken +^^^^^^ + +.. js:function:: weaken(hostname/ip) + + :param string hostname.ip: IP or hostname of the target server to weaken + :returns: The amount by which the target server's security level was decreased. This is equivalent to 0.05 multiplied + by the number of script threads + + Use your hacking skills to attack a server's security, lowering the server's security level. The runtime for this command + depends on your hacking level and the target server's security level. This function lowers the security level of the target + server by 0.05. + + Like hack() and grow(), weaken() can be called on any server, regardless of where the script is running. This command requires + root access to the target server, but there is no required hacking level to run the command. + + Example:: + + weaken("foodnstuff"); + +sleep +^^^^^ + +.. js:function:: sleep(n[, log=true]) + + :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. + +print +^^^^^ + +.. js:function:: print(x) + + :param x: Value to be printed + + Prints a value or a variable to the script's logs. + +tprint +^^^^^^ + +.. js:function:: tprint(x) + + :param x: Value to be printed + + Prints a value or a variable to the Terminal + +scan +^^^^ + +.. js:function:: scan(hostname/ip[, hostnames=true]) + + :param string hostname/ip: IP or hostname of the server to scan + :param boolean: Optional boolean specifying whether the function should output hostnames (if true) or IP addresses (if false) + + Returns an array containing the hostnames or IPs of all servers that are one node way from the specified target server. The + hostnames/IPs in the returned array are strings. + +nuke +^^^^ + +.. js:function:: nuke(hostname/ip) + + :param string hostname/ip: IP or hostname of the target server + + Runs the NUKE.exe program on the target server. NUKE.exe must exist on your home computer. + + Example:: + + nuke("foodnstuff"); + +brutessh +^^^^^^^^ + +.. js:function:: brutessh(hostname/ip) + + :param string hostname/ip: IP or hostname of the target server + + Runs the BruteSSH.exe program on the target server. BruteSSH.exe must exist on your home computer. + + Example:: + + brutessh("foodnstuff"); + +ftpcrack +^^^^^^^^ + +.. js:function:: ftpcrack(hostname/ip) + + :param string hostname/ip: IP or hostname of the target server + + Runs the FTPCrack.exe program on the target server. FTPCrack.exe must exist on your home computer. + + Example:: + + ftpcrack("foodnstuff"); + +relaysmtp +^^^^^^^^^ + +.. js:function:: relaysmtp(hostname/ip) + + :param string hostname/ip: IP or hostname of the target server + + Runs the relaySMTP.exe program on the target server. relaySMTP.exe must exist on your home computer. + + Example:: + + relaysmtp("foodnstuff"); + +httpworm +^^^^^^^^ + +.. js:function:: httpworm(hostname/ip) + + :param string hostname/ip: IP or hostname of the target server + + Runs the HTTPWorm.exe program on the target server. HTTPWorm.exe must exist on your home computer. + + Example:: + + httpworm("foodnstuff"); + +sqlinject +^^^^^^^^^ + +.. js:function:: sqlinject(hostname/ip) + + :param string hostname/ip: IP or hostname of the target server + + Runs the SQLInject.exe program on the target server. SQLInject.exe must exist on your home computer. + + Example:: + + sqlinject("foodnstuff"); + +run +^^^ + +.. js:function:: run(script, [numThreads=1], [args...]) + + :param string script: Filename of script to run + :param number numThreads: Optional thread count for new script. Set to 1 by default. Will be rounded to nearest integer + :param args...: + Additional arguments to pass into the new script that is being run. Note that if any arguments are being + passed into the new script, then the second argument *numThreads* must be filled in with a value. + + Run a script as a separate process. This function can only be used to run scripts located on the current server (the server + running the script that calls this function). + + Returns true if the script is successfully started, and false otherwise. Requires a significant amount of RAM to run this + command. + + The simplest way to use the *run* command is to call it with just the script name. The following example will run + 'foo.script' single-threaded with no arguments:: + + run("foo.script"); + + The following example will run 'foo.script' but with 5 threads instead of single-threaded:: + + run("foo.script", 5); + + This next example will run 'foo.script' single-threaded, and will pass the string 'foodnstuff' into the script + as an argument:: + + run("foo.script", 1, 'foodnstuff'); + +exec +^^^^ + +.. js:function:: exec(script, hostname/ip, [numThreads=1], [args...]) + + :param string script: Filename of script to execute + :param string hostname/ip: IP or hostname of the 'target server' on which to execute the script + :param number numThreads: Optional thread count for new script. Set to 1 by default. Will be rounded to nearest integer + :param args...: + Additional arguments to pass into the new script that is being run. Note that if any arguments are being + passed into the new script, then the third argument *numThreads* must be filled in with a value. + + Run a script as a separate process on a specified server. This is similar to the *run* function except + that it can be used to run a script on any server, instead of just the current server. + + Returns true if the script is successfully started, and false otherwise. + + The simplest way to use the *exec* command is to call it with just the script name and the target server. + The following example will try to run *generic-hack.script* on the *foodnstuff* server:: + + exec("generic-hack.script", "foodnstuff"); + + The following example will try to run the script *generic-hack.script* on the *joesguns* server with 10 threads:: + + exec("generic-hack.script", "joesguns", 10); + + This last 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:: + + exec("foo.script", "foodnstuff", 5, 1, "test"); + +kill +^^^^ + +.. js:function:: kill(script, hostname/ip, [args...]) + + :param string script: Filename of the script to kill + :param string hostname/ip: IP or hostname of the server on which to kill the script + :param args...: Arguments to identify which script to kill + + 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. + + If this function successfully kills the specified script, then it will return true. Otherwise, it will return false. + + Examples: + + The following example will try to kill a script named *foo.script* on the *foodnstuff* server that was ran with no arguments:: + + kill("foo.script", "foodnstuff"); + + The following will try to kill a script named *foo.script* on the current server that was ran with no arguments:: + + kill("foo.script", getHostname()); + + The following will try to kill a script named *foo.script* on the current server that was ran with the arguments 1 and "foodnstuff":: + + kill("foo.script", getHostname(), 1, "foodnstuff"); + +killall +^^^^^^^ + +.. js:function:: killall(hostname/ip) + + :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. + + +exit +^^^^ + +.. js:function:: exit() + + Terminates the current script immediately + +scp +^^^ + +.. js:function:: scp(files, [source], destination) + + :param string/array files: Filename or an array of filenames of script/literature files to copy + :param string source: + Hostname or IP of the source server, which is the server from which the file will be copied. + This argument is optional and if it's omitted the source will be the current server. + :param string destination: Hostname or IP of the destination server, which is the server to which the file will be copied. + + Copies a script or literature (.lit) file(s) to another server. The *files* argument can be either a string specifying a + single file to copy, or an array of strings specifying multiple files to copy. + + Returns true if the script/literature file is successfully copied over and false otherwise. If the *files* argument is an array + then this function will return true if at least one of the files in the array is successfully copied. + + Examples:: + + //Copies hack-template.script from the current server to foodnstuff + scp("hack-template.script", "foodnstuff"); + + //Copies foo.lit from the helios server to the home computer + scp("foo.lit", "helios", "home"); + + //Tries to copy three files from rothman-uni to home computer + files = ["foo1.lit", "foo2.script", "foo3.script"]; + scp(files, "rothman-uni", "home"); + +ls +^^ + +.. js:function:: ls(hostname/ip) + + :param string hostname/ip: Hostname or IP of the target server + + Returns an array with the filenames of all files on the specified server (as strings). The returned array + is sorted in alphabetic order + +hasRootAccess +^^^^^^^^^^^^^ + +.. js:function:: hasRootAccess(hostname/ip) + + :param string hostname/ip: Hostname or IP of the target server + + Returns a boolean indicating whether or not the player has root access to the specified target server. + + Example:: + + if (hasRootAccess("foodnstuff") == false) { + nuke("foodnstuff"); + } + +getHostname +^^^^^^^^^^^ + +.. js:function:: getHostname() + + Returns a string with the hostname of the server that the script is running on + +getHackingLevel +^^^^^^^^^^^^^^^ + +.. js:function:: getHackingLevel() + + Returns the player's current hacking level + +getHackingMultipliers +^^^^^^^^^^^^^^^^^^^^^ + +.. js:function:: getHackingMultipliers() + + Returns an object containing the Player's hacking related multipliers. These multipliers are + returned in integer forms, not percentages (e.g. 1.5 instead of 150%). The object has the following structure:: + + { + chance: Player's hacking chance multiplier, + speed: Player's hacking speed multiplier, + money: Player's hacking money stolen multiplier, + growth: Player's hacking growth multiplier + } + + Example of how this can be used:: + + mults = getHackingMultipliers(); + print(mults.chance); + print(mults.growth); + +getServerMoneyAvailable +^^^^^^^^^^^^^^^^^^^^^^^ + +.. js:function:: getServerMoneyAvailable(hostname/ip) + + :param string hostname/ip: Hostname or IP of target server + + Returns the amount of money available on a server. **Running this function on the home computer will return + the player's money.** + + Example:: + + getServerMoneyAvailable("foodnstuff"); + getServerMoneyAvailable("home"); //Returns player's money + +getServerMaxMoney +^^^^^^^^^^^^^^^^^ + +.. js:function:: getServerMaxMoney(hostname/ip) + + :param string hostname/ip: Hostname or IP of target server + + Returns the maximum amount of money that can be available on a server + +getServerGrowth +^^^^^^^^^^^^^^^ + +.. js:function:: getServerGrowth(hostname/ip) + + :param string hostname/ip: Hostname or IP of target server + + Returns the server's instrinsic "growth parameter". This growth parameter is a number + between 1 and 100 that represents how quickly the server's money grows. This parameter affects the + percentage by which the server's money is increased when using the *grow()* function. A higher + growth parameter will result in a higher percentage increase from *grow()*. + +getServerSecurityLevel +^^^^^^^^^^^^^^^^^^^^^^ + +.. js:function:: getServerSecurityLevel(hostname/ip) + + :param string hostname/ip: Hostname or IP of target server + + Returns the security level of the target server. A server's security level is denoted by a number, typically + between 1 and 100 (but it can go above 100). + +getServerBaseSecurityLevel +^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. js:function:: getServerBaseSecurityLevel(hostname/ip) + + :param string hostname/ip: Hostname or IP of target server + + Returns the base security level of the target server. This is the security level that the server starts out with. + This is different than *getServerSecurityLevel()* because *getServerSecurityLevel()* returns the current + security level of a server, which can constantly change due to *hack()*, *grow()*, and *weaken()*, calls on that + server. The base security level will stay the same until you reset by installing an Augmentation(s). + +getServerMinSecurityLevel +^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. js:function:: getServerMinSecurityLevel(hostname/ip) + + :param string hostname/ip: Hostname or IP of target server + + Returns the minimum security level of the target server + +getServerRequiredHackingLevel +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. js:function:: getServerRequiredHackingLevel(hostname/ip) + + :param string hostname/ip: Hostname or IP of target server + + Returns the required hacking level of the target server + +getServerNumPortsRequired +^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. js:function:: getServerNumPortsRequired(hostname/ip) + + :param string hostname/ip: Hostname or IP of target server + + Returns the number of open ports required to successfully run NUKE.exe on the specified server. + +getServerRam +^^^^^^^^^^^^ + +.. js:function:: getServerRam(hostname/ip) + + :param string hostname/ip: Hostname or IP of target server + + Returns an array with two elements that gives information about a server's memory (RAM). The first + element in the array is the amount of RAM that the server has total (in GB). The second element in + the array is the amount of RAM that is currently being used on the server (in GB). + + Example:: + + res = getServerRam("helios"); + totalRam = res[0]; + ramUsed = res[1]; + +serverExists +^^^^^^^^^^^^ + +.. js:function:: serverExists(hostname/ip) + + :param string hostname/ip: Hostname or IP of target server + + Returns a boolean denoting whether or not the specified server exists + +fileExists +^^^^^^^^^^ + +.. js:function:: fileExists(filename, [hostname/ip]) + + :param string filename: Filename of file to check + :param string hostname/ip: + Hostname or IP of target server. This is optional. If it is not specified then the + function will use the current server as the target server + + Returns a boolean indicating whether the specified file exists on the target server. The filename + for scripts is case-sensitive, but for other types of files it is not. For example, *fileExists("brutessh.exe")* + will work fine, even though the actual program is named "BruteSSH.exe". + + If the *hostname/ip* argument is omitted, then the function will search through the current server (the server + running the script that calls this function) for the file. + + Examples:: + + fileExists("foo.script", "foodnstuff"); + fileExists("ftpcrack.exe"); + + The first example above will return true if the script named *foo.script* exists on the *foodnstuff* server, and false otherwise. + The second example above will return true if the current server contains the *FTPCrack.exe* program, and false otherwise. + +isRunning +^^^^^^^^^ + +.. js:function:: isRunning(filename, hostname/ip, [args...]) + + :param string filename: Filename of script to check. This is case-sensitive. + :param string hostname/ip: Hostname or IP of target server + :param args...: Arguments to specify/identify which scripts to search for + + Returns a boolean indicating whether the specified script is running on the target server. Remember that a script is + uniquely identified by both its name and its arguments. + + **Examples:** + + In this first example below, the function call will return true if there is a script named *foo.script* with no arguments + running on the *foodnstuff* server, and false otherwise:: + + isRunning("foo.script", "foodnstuff"); + + In this second example below, the function call will return true if there is a script named *foo.script* with no arguments + running on the current server, and false otherwise:: + + isRunning("foo.script", getHostname()); + + In this next example below, the function call will return true if there is a script named *foo.script* running with the arguments + 1, 5, and "test" (in that order) on the *joesguns* server, and false otherwise:: + + isRunning("foo.script", "joesguns", 1, 5, "test"); + +getNextHacknetNodeCost +^^^^^^^^^^^^^^^^^^^^^^ + +.. js:function:: getNextHacknetNodeCost() + + Returns the cost of purchasing a new Hacknet Node + +purchaseHacknetNode +^^^^^^^^^^^^^^^^^^^ + +.. js:function:: purchaseHacknetNode() + + Purchases a new Hacknet Node. Returns a number with the index of the Hacknet Node. This index is equivalent to the number at the + end of the Hacknet Node's name (e.g The Hacknet Node named 'hacknet-node-4' will have an index of 4). If the player cannot afford + to purchase a new Hacknet Node then the function will return false. + +purchaseServer +^^^^^^^^^^^^^^ + +.. js:function:: purchaseServer(hostname, ram) + + :param string hostname: Hostname of the purchased server + :param number ram: Amount of RAM of the purchased server. Must be a power of 2 (2, 4, 8, 16, etc.) + + Purchased a server with the specified hostname and amount of RAM. + + The *hostname* argument can be any data type, but it will be converted to a string and have whitespace removed. Anything that resolves to an empty string will + cause the function to fail. If there is already a server with the specified hostname, then the function will automatically append + a number at the end of the *hostname* argument value until it finds a unique hostname. For example, if the script calls + *purchaseServer("foo", 4)* but a server named "foo" already exists, the it will automatically change the hostname to "foo-0". If there is already + a server with the hostname "foo-0", then it will change the hostname to "foo-1", and so on. + + Note that there is a maximum limit to the amount of servers you can purchase. + + Returns the hostname of the newly purchased server as a string. If the function fails to purchase a server, then it will return an + empty string. The function will fail if the arguments passed in are invalid, if the player does not have enough money to purchase + the specified server, or if the player has exceeded the maximum amount of servers. + + Example:: + + ram = 64; + hn = "pserv-"; + for (i = 0; i < 5; ++i) { + purchaseServer(hn + i, ram); + } + +deleteServer +^^^^^^^^^^^^ + +.. js:function:: deleteServer(hostname) + + :param string hostname: Hostname of the server to delete + + Deletes one of your purchased servers, which is specified by its hostname. + + The *hostname* argument can be any data type, but it will be converted to a string. Whitespace is automatically removed from + the string. This function will not delete a server that still has scripts running on it. + + Returns true if successful, and false otherwise. + +getPurchasedServers +^^^^^^^^^^^^^^^^^^^ + +.. js:function:: getPurchasedServers([hostname=true]) + + :param boolean hostname: + Specifies whether hostnames or IP addresses should be returned. If it's true then hostnames will be returned, and if false + then IPs will be returned. If this argument is omitted then it is true by default + + 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 +^^^^^ + +.. js:function:: write(port/fn, data="", mode="a") + + :param string/number port/fn: Port or text file that will be written to + :param string data: Data to write + :param string mode: Defines the write mode. Only valid when writing to text files. + + This function can be used to either write data to a port or to a text file (.txt). + + If the first argument is a number between 1 and 10, then it specifies a port and this function will write *data* to that port. Read + about how `Netscript Ports work here `_. The third argument, *mode*, is not used + when writing to a port. + + If the first argument is a string, then it specifies the name of a text file (.txt) and this function will write *data* to that text file. If the + specified text file does not exist, then it will be created. The third argument *mode, defines how the data will be written to the text file. If *mode* + is set to "w", then the data is written in "write" mode which means that it will overwrite all existing data on the text file. If *mode* is set to + any other value then the data will be written in "append" mode which means that the data will be added at the end of the text file. + +read +^^^^ + +.. js:function:: read(port/fn) + + :param string/number port/fn: Port or text file to read from + + This function is used to read data from a port or from a text file (.txt). + + If the argument *port/fn* is a number between 1 and 10, then it specifies a port and it will read data from that port. Read + about how `Netscript Ports work here `_. A port is a serialized queue. This function + will remove the first element from that queue and return it. If the queue is empty, then the string "NULL PORT DATA" will be returned. + + 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. + +clear +^^^^^ + +.. js:function:: clear(port/fn) + + :param string/number port/fn: Port or text file to clear + + This function is used to clear data in a `Netscript Ports `_ or a text file. + + If the *port/fn* argument is a number between 1 and 10, then it specifies a port and will clear it (deleting all data from the underlying queue). + + 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. + +scriptRunning +^^^^^^^^^^^^^ + +.. js:function:: scriptRunning(scriptname, hostname/ip) + + :param string scriptname: Filename of script to check. This is case-sensitive. + :param string hostname/ip: Hostname or IP of target server + + Returns a boolean indicating whether any instance of the specified script is running on the target server, regardless of + its arguments. + + This is different than the *isRunning()* function because it does not try to identify a specific instance of a running script + by its arguments. + + **Examples:** + + The example below will return true if there is any script named *foo.script* running on the *foodnstuff* server, and false otherwise:: + + scriptRunning("foo.script", "foodnstuff"); + + The example below will return true if there is any script named "foo.script" running on the current server, and false otherwise:: + + scriptRunning("foo.script", getHostname()); + +scriptKill +^^^^^^^^^^ + +.. js:function:: scriptKill(scriptname, hostname/ip) + + :param string scriptname: Filename of script to kill. This is case-sensitive. + :param string hostname/ip: Hostname or IP of target server + + Kills all scripts with the specified filename on the target server specified by *hostname/ip*, regardless of arguments. Returns + true if one or more scripts were successfully killed, and false if none were. + +getScriptRam +^^^^^^^^^^^^ + +.. js:function:: getScriptRam(scriptname, hostname/ip) + + :param string scriptname: Filename of script. This is case-sensitive. + :param string hostname/ip: Hostname or IP of target server + + Returns the amount of RAM required to run the specified script on the target server + +getHackTime +^^^^^^^^^^^ + +.. js:function:: getHackTime(hostname/ip) + + :param string hostname/ip: Hostname or IP of target server + + Returns the amount of time in seconds it takes to execute the *hack()* Netscript function on the target server. + +getGrowTime +^^^^^^^^^^^ + +.. js:function:: getGrowTime(hostname/ip) + + :param string hostname/ip: Hostname or IP of target server + + Returns the amount of time in seconds it takes to execute the *grow()* Netscript function on the target server. + +getWeakenTime +^^^^^^^^^^^^^ + +.. js:function:: getWeakenTime(hostname/ip) + + :param string hostname/ip: Hostname or IP of target server + + Returns the amount of time in seconds it takes to execute the *weaken()* Netscript function on the target server. + +getScriptIncome +^^^^^^^^^^^^^^^ + +.. js:function:: getScriptIncome([scriptname], [hostname/ip], [args...]) + + :param string scriptname: Filename of script + :param string hostname/ip: Server on which script is running + :param args...: Arguments that the script is running with + + Returns the amount of income the specified script generates while online (when the game is open, does not apply for offline income). + Remember that a script is uniquely identified by both its name and its arguments. So for example if you ran a script with the arguments + "foodnstuff" and "5" then in order to use this function to get that script's income you must specify those same arguments in the same order + in this function call. + + This function can also be called with no arguments. If called with no arguments, then this function will return an array of two values. The + first value is the total income ($ / second) of all of your active scripts (scripts that are currently running on any server). The second value + is the total income ($ / second) that you've earned from scripts since you last installed Augmentations. + +getScriptExpGain +^^^^^^^^^^^^^^^^ + +.. js:function:: getScriptExpGain([scriptname], [hostname/ip], [args...]) + + :param string scriptname: Filename of script + :param string hostname/ip: Server on which script is running + :param args...: Arguments that the script is running with + + Returns the amount of hacking experience the specified script generates while online (when the game is open, does not apply for offline experience gains). + Remember that a script is uniquely identified by both its name and its arguments. + + This function can also return the total experience gain rate of all of your active scripts by running the function with no arguments. + +getTimeSinceLastAug +^^^^^^^^^^^^^^^^^^^ + +.. js:function:: getTimeSinceLastAug() + + Returns the amount of time in milliseconds that have passed since you last installed Augmentations + +sprintf +^^^^^^^ + +.. js:function:: sprintf() + + See `this link `_ for details. + +vsprintf +^^^^^^^^ + +.. js:function:: vsprintf() + + See `this link `_ for details. + +prompt +^^^^^^ + +.. js:function:: prompt(txt) + + :param string txt: Text to appear in the prompt dialog box + + Prompts the player with a dialog box with two options: "Yes" and "No". This function will return true if the player click "Yes" and + false if the player clicks "No". The script's execution is halted until the player selects one of the options. + + +Defining your own Functions +--------------------------- + +You can define your own functions in Netscript using the following syntax:: + + function name(args...) { + function code here... + return some_value + } + +Functions should have some return value. Here is an example of defining and using a function:: + + function sum(values) { + res = 0; + for (i = 0; i < values.length; ++i) { + res += values[i]; + } + return res; + } + + print(sum([1, 2, 3, 4, 5])); + print(sum([1, 10])); + +The example above prints the following in its log:: + + 15 + 11 + +**Note about variable scope in functions:** + +Functions can access "global" variables declared outside of the function's scope. However, they cannot change the value of any "global" variables. +Any changes to "global" variables will only be applied locally to the function. This also means that any variable that is first defined inside a +function will NOT be accessible outside of the function. + +For example, the following code:: + + function sum(values) { + res = 0; + for (i = 0; i < values.length; ++i) { + res += values[i]; + } + return res; + } + print(res); + +results in the following runtime error:: + + Script runtime error: + Server Ip: 75.7.4.1 + Script name: test.script + Args:[] + variable res not defined + +The following example shows that any change to "global" variable inside a function only applies in the function's local scope:: + + function foo() { + i = 5; + return "foo"; + } + + i = 0; + print(i); + foo(); + print(i); + +Results in the following log:: + + 0 + 0 + +**Other Notes about creating your own functions:** + +Defining a function does not create a Javascript function object in the underlying game code. This means that you cannot use any function +you create in functions such as `Array.sort() `_ (not yet at least, I'll try to make it work in the future). diff --git a/doc/build/html/_sources/netscripthacknetnodeapi.rst.txt b/doc/build/html/_sources/netscripthacknetnodeapi.rst.txt new file mode 100644 index 000000000..1f3755fe0 --- /dev/null +++ b/doc/build/html/_sources/netscripthacknetnodeapi.rst.txt @@ -0,0 +1,127 @@ +Netscript Hacknet Node API +========================== + +Netscript provides the following API for accessing and upgrading your Hacknet Nodes +through scripts. + +Note that none of these functions will write to the script's logs. If you want +to see what your script is doing you will have to print to the logs yourself. + +hacknetnodes +^^^^^^^^^^^^ + + *hacknetnodes* is a special variable. It is an array that maps to the player's + Hacknet Nodes. The Hacknet Nodes are accessed through indexed. These indexes + correspond to the number at the end of the name of the Hacknet Node. For example, + the first Hacknet Node you purchase will have the name "hacknet-node-0" and can be + accessed using *hacknetnodes[0]*. The fourth Hacknet Node you purchase will have the name + "hacknet-node-3" and can be accessed using *hacknetnodes[3]*. + +Hacknet Node Member Variables +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The following is a list of member variables for a Hacknet Node object. These variables are read-only, which means you cannot assign +a value to these. + +Note that these must be called on an element inside the *hacknetnodes* array, not the array itself. + +.. js:function:: hacknetnodes[i].level + + Returns the level of the corresponding Hacknet Node + +.. js:function:: hacknetnodes[i].ram + + Returns the amount of RAM on the corresponding Hacknet Node + +.. js:function:: hacknetnodes[i].cores + + Returns the number of cores on the corresponding Hacknet Node + +.. js:function:: hacknetnodes[i].totalMoneyGenerated + + Returns the total amount of money that the corresponding Hacknet Node has earned + +.. js:function:: hacknetnodes[i].onlineTimeSeconds + + Returns the total amount of time (in seconds) that the corresponding Hacknet Node has existed + +.. js:function:: hacknetnodes[i].moneyGainRatePerSecond + + Returns the amount of income that the corresponding Hacknet Node earns + +Hacknet Node Methods +^^^^^^^^^^^^^^^^^^^^ + +The following is a list of supported functions/methods for a Hacknet Node object. + +Note that these must be called on an element inside the *hacknetnodes* array, not the +array itself. + +.. js:function:: hacknetnodes[i].upgradeLevel(n); + + :param number n: Number of levels to upgrade. Must be positive. Rounded to nearest integer + + Tries to upgrade the level of the corresponding Hacknet Node *n* times. Returns true if the + Hacknet Node's level is successfully upgraded *n* times or up to the max level (200), and false + otherwise. + +.. js:function:: hacknetnodes[i].upgradeRam() + + Tries to upgrade the amount of RAM on the corresponding Hacknet Node. Returns true if the RAM is + successfully upgraded and false otherwise. + +.. js:function:: hacknetnodes[i].upgradeCore() + + Tries to purchase an additional core for the corresponding Hacknet Node. Returns true if the + additional core is successfully purchased, and false otherwise. + +.. js:function:: hacknetnodes[i].getLevelUpgradeCost(n); + + :param number n: Number of levels to upgrade. Must be positive. Rounded to nearest integer + + Returns the cost of upgrading the specified Hacknet Node by *n* levels + +.. js:function:: hacknetnodes[i].getRamUpgradeCost() + + Returns the cost of upgrading the RAM of the specified Hacknet Node. Upgrading a Node's RAM doubles it. + +.. js:function:: hacknetnodes[i].getCoreUpgradeCost() + + Returns the cost of upgrading the number of cores of the specified Hacknet Node. Upgrading a Node's + number of cores adds one additional core. + +Example(s) +^^^^^^^^^^ + +The following is an example of one way a script can be used to automate the purchasing and upgrading of Hacknet Nodes. +This script purchases new Hacknet Nodes until the player has four. Then, it iteratively upgrades each of those four Hacknet +Nodes to a level of at least 75, RAM to at least 8GB, and number of cores to at least 2:: + + //Purchase 4 Hacknet Nodes + while(hacknetnodes.length < 4) { + purchaseHacknetNode(); + } + + //Upgrade all 4 Hacknet Nodes to at least level 75 + for (i = 0; i < 4; i = i++) { + while (hacknetnodes[i].level <= 75) { + hacknetnodes[i].upgradeLevel(5); + sleep(10000); + } + } + + //Upgrade RAM on all Hacknet Nodes to 8GB + for (i = 0; i < 4; i = i++) { + while (hacknetnodes[i].ram < 8) { + hacknetnodes[i].upgradeRam(); + sleep(10000); + } + } + + //Upgrade cores on all Hacknet Nodes to 2 + for (i = 0; i < 4; i = i++) { + while (hacknetnodes[i].cores < 2) { + hacknetnodes[i].upgradeCore(); + sleep(10000); + } + } diff --git a/doc/build/html/_sources/netscriptixapi.rst.txt b/doc/build/html/_sources/netscriptixapi.rst.txt new file mode 100644 index 000000000..8f34f99ae --- /dev/null +++ b/doc/build/html/_sources/netscriptixapi.rst.txt @@ -0,0 +1,174 @@ +Netscript Trade Information eXchange (TIX) API +============================================== + +The Trade Information eXchange (TIX) is the communications protocol supported by the World Stock Exchange (WSE). +The WESE provides an API that allows you to automatically communicate with the +`Stock Market `_. This API lets you write code using Netscript +to build automated trading systems and create your own algorithmic trading strategies. Access to this +TIX API can be purchased by visiting the World Stock Exchange in-game. + +Access to the TIX API currently costs $5 billion. After you purchase it, you will retain this +access even after you 'reset' by installing Augmentations + +getStockPrice +------------- + +.. js:function:: getStockPrice(sym) + + :param string sym: Stock symbol + + Returns the price of a stock, given its symbol (NOT the company name). The symbol is a sequence + of two to four capital letters. + + Example:: + + getStockPrice("FISG"); + +getStockPosition +---------------- + +.. js:function:: getStockPosition(sym) + + :param string sym: Stock symbol + + Returns an array of four elements that represents the player's position in a stock. + + The first element is the returned array is the number of shares the player owns of the stock in the + `Long position `_. The second + element in the array is the average price of the player's shares in the Long position. + + The third element in the array is the number of shares the player owns of the stock in the + `Short position `_. The fourth + element in the array is the average price of the player's Short position. + + All elements in the returned array are numeric. + + Example:: + + pos = getStockPosition("ECP"); + shares = pos[0]; + avgPx = pos[1]; + sharesShort = pos[2]; + avgPxShort = pos[3]; + +buyStock +-------- + +.. js:function:: buyStock(sym, shares) + + :param string sym: Symbol of stock to purchase + :param number shares: Number of shares to purchased. Must be positive. Will be rounded to nearest integer + + Attempts to purchase shares of a stock using a `Market Order `_. + + If the player does not have enough money to purchase the specified number of shares, then no shares will be purchased. Remember + that every transaction on the stock exchange costs a certain commission fee. + + If this function successfully purchases the shares, it will return the stock price at which each share was purchased. Otherwise, + it will return 0. + +sellStock +--------- + +.. js:function:: sellStock(sym, shares) + + :param string sym: Symbol of stock to sell + :param number shares: Number of shares to sell. Must be positive. Will be rounded to nearest integer + + Attempts to sell shares of a stock using a `Market Order `_. + + If the specified number of shares in the function exceeds the amount that the player actually owns, then this function will + sell all owned shares. Remember that every transaction on the stock exchange costs a certain commission fee. + + The net profit made from selling stocks with this function is reflected in the script's statistics. + This net profit is calculated as:: + + shares * (sell price - average price of purchased shares) + + If the sale is successful, this function will return the stock price at which each share was sold. Otherwise, it will return 0. + +shortStock +---------- + +.. js:function:: shortStock(sym, shares) + + :param string sym: Symbol of stock to short + :param number shares: Number of shares to short. Must be positive. Will be rounded to nearest integer + + Attempts to purchase a `short `_ position of a stock + using a `Market Order `_. + + The ability to short a stock is **not** immediately available to the player and must be unlocked later on in the game. + + If the player does not have enough money to purchase the specified number of shares, then no shares will be purchased. + Remember that every transaction on the stock exchange costs a certain commission fee. + + If the purchase is successful, this function will return the stock price at which each share was purchased. Otherwise, it will return 0. + +sellShort +--------- + +.. js:function:: sellShort(sym, shares) + + :param string sym: Symbol of stock to sell + :param number shares: Number of shares to sell. Must be positive. Will be rounded to nearest integer + + Attempts to sell a `short `_ position of a stock + using a `Market Order `_. + + The ability to short a stock is **not** immediately available to the player and must be unlocked later on in the game. + + If the specified number of shares exceeds the amount that the player actually owns, then this function will sell all owned + shares. Remember that every transaction on the stock exchange costs a certain commission fee. + + If the sale is successful, this function will return the stock price at which each share was sold. Otherwise it will return 0. + +placeOrder +---------- + +.. js:function:: placeOrder(sym, shares, price, type, pos) + + :param string sym: Symbol of stock to player order for + :param number shares: Number of shares for order. Must be positive. Will be rounded to nearest integer + :param number price: Execution price for the order + :param string type: Type of order. It must specify "limit" or "stop", and must also specify "buy" or "sell". This is NOT + case-sensitive. Here are four examples that will work: + + * limitbuy + * limitsell + * stopbuy + * stopsell + + :param string pos: + Specifies whether the order is a "Long" or "Short" position. The Values "L" or "S" can also be used. This is + NOT case-sensitive. + + Places an order on the stock market. This function only works for `Limit and Stop Orders `_. + + The ability to place limit and stop orders is **not** immediately available to the player and must be unlocked later on in the game. + + Returns true if the order is successfully placed, and false otherwise. + +cancelOrder +----------- + +.. js:function:: cancelOrder(sym, shares, price, type, pos) + + :param string sym: Symbol of stock to player order for + :param number shares: Number of shares for order. Must be positive. Will be rounded to nearest integer + :param number price: Execution price for the order + :param string type: Type of order. It must specify "limit" or "stop", and must also specify "buy" or "sell". This is NOT + case-sensitive. Here are four examples that will work: + + * limitbuy + * limitsell + * stopbuy + * stopsell + + :param string pos: + Specifies whether the order is a "Long" or "Short" position. The Values "L" or "S" can also be used. This is + NOT case-sensitive. + + Cancels an oustanding Limit or Stop order on the stock market. + + The ability to use limit and stop orders is **not** immediately available to the player and must be unlocked later on in the game. diff --git a/doc/build/html/_sources/netscriptloopsandconditionals.rst.txt b/doc/build/html/_sources/netscriptloopsandconditionals.rst.txt new file mode 100644 index 000000000..59c11280e --- /dev/null +++ b/doc/build/html/_sources/netscriptloopsandconditionals.rst.txt @@ -0,0 +1,42 @@ +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: + +`While loops `_ + +`For loops `_ + +`Conditionals (If/Else statements) `_ + +Here are some simple code examples that show the use of loops and conditionals in Netscript. + +The following is a while loop that runs the hack() Netscript function ten times:: + + i = 0; + while (i < 10) { + hack('foodnstuff'); + i = i + 1; + } + +The following is a for loop that runs the hack() Netscript function ten times:: + + for (i = 0; i < 10; ++i) { + hack("foodnstuff"); + } + +The following is a conditional that uses the getServerMoneyAvailable() Netscript function to check how much money +exists on the 'foodnstuff' server. If there is more than $200,000 on the server, then the server will be hacked. +Otherwise, the money available on the server will be grown using the grow() Netscript function:: + + if (getServerMoneyAvailable('foodnstuff') > 200000) { + hack("foodnstuff"); + } else { + grow("foodnstuff"); + } diff --git a/doc/build/html/_sources/netscriptoperators.rst.txt b/doc/build/html/_sources/netscriptoperators.rst.txt new file mode 100644 index 000000000..84ca09f3c --- /dev/null +++ b/doc/build/html/_sources/netscriptoperators.rst.txt @@ -0,0 +1,53 @@ +Netscript Operators +=================== + +Operators +--------- + +Binary Operators +^^^^^^^^^^^^^^^^ + +Binary operators require two operands and produce a result based on their values. In general, binary +operators do not change the value of the operands. + +=========== =========================== ============================================================== +Operator Name Example/Comments +=========== =========================== ============================================================== += Assignment i = 5 would assign the value 5 to the variable i +\+ Addition 5 + 12 would return 17 +\- Subtraction 20 - 8 would return 12 +\* Multiplication 4 * 5 would return 20 +\/ Division 50 / 10 would return 5 +% Modulo 50 % 9 would return 5 +&& Logical AND true && false would return false +|| Logical OR true || false would return true +< Less than 4 < 5 would return true +> Greater than 4 > 5 would return false +<= Less than or equal to 5 <= 5 would return true +>= Greater than or equal to 5 >= 4 would return true +== Equality 1 == 1 would return true +!= Inequality 4 != 5 would return true +=== Strict equality 1 === "1" would return false +!== Strict inequality 1 !== "1" would return true +=========== =========================== ============================================================== + +Unary Operators +^^^^^^^^^^^^^^^ + +Unary operators require only a single operand and produce a result based on their values. Some unary operators will +change the value of their operands. For example:: + + i = 0; + ++i; + +Running the pre-increment unary operator (++) in the code above changes the value of the variable i. + + +=============== =========================== ============================================================================================== +Operator Name Example/comments +=============== =========================== ============================================================================================== +! Logical NOT operator !true would return false, and !false would return true. Does not change operand's value +\- Negation Negates a number. Only works for numerics. Does not change operand's value +++ Pre-increment ++i or i++. WARNING: This only pre-increments, even if you put i++. Changes operand's value +-- Pre-decrement --i or i--. WARNING: This only pre-decrements, even if you put i--. Changes operand's value +=============== =========================== ============================================================================================== diff --git a/doc/build/html/_sources/netscriptscriptarguments.rst.txt b/doc/build/html/_sources/netscriptscriptarguments.rst.txt new file mode 100644 index 000000000..b52403d28 --- /dev/null +++ b/doc/build/html/_sources/netscriptscriptarguments.rst.txt @@ -0,0 +1,17 @@ +Netscript Script Arguments +========================== + +Arguments passed into a script can be accessed in Netscript using a special array called *args*. The arguments can be +accessed using a normal array using the [] operator (args[0], args[1], etc...). + +For example, let's say we want to make a generic script 'generic-run.script' and we plan to pass two arguments into that script. +The first argument will be the name of another script, and the second argument will be a number. This generic script will run the +script specified in the first argument with the amount of threads specified in the second element. The code would look like:: + + run(args[0], args[1]); + +It is also possible to get the number of arguments that was passed into a script using:: + + args.length + +WARNING: Do not try to modify the args array. This will break the game. I will do my best to prevent players from doing this. diff --git a/doc/build/html/_sources/netscriptsingularityfunctions.rst.txt b/doc/build/html/_sources/netscriptsingularityfunctions.rst.txt new file mode 100644 index 000000000..7618f7bd6 --- /dev/null +++ b/doc/build/html/_sources/netscriptsingularityfunctions.rst.txt @@ -0,0 +1,465 @@ +Netscript Singularity Functions +=============================== + +The Singularity Functions are a special set of Netscript functions. These functions allow you to control +many additional aspects of the game through scripts, such as working for factions/companies, purchasing/installing Augmentations, +and creating programs. + +The Singularity Functions are **not** immediately available to the player and must be unlocked later in the game. + +**WARNING: This page contains spoilers for the game**. + +The Singularity Functions are unlocked in BitNode-4. If you are in BitNode-4, then you will automatically have access to all of these functions. +You can use the Singularity Functions in other BitNodes if and only if you have the Source-File for BitNode-4 (aka Source-File 4). Each level of +Source-File 4 will open up additional Singularity Functions that you can use in other BitNodes. If your Source-File 4 is upgraded all the way to +level 3, then you will be able to access all of the Singularity Functions. + +Note that Singularity Functions require a lot of RAM outside of BitNode-4 (their RAM costs are multiplied by 10 if you are not in BitNode-4) + +universityCourse +---------------- + +.. js:function:: universityCourse(universityName, courseName) + + :param string universityName: + Name of university. Not case-sensitive. You must be in the correct city for whatever university you specify. + + * Summit University + * Rothman University + * ZB Institute Of Technology + :param string courseName: + Name of course. Not case-sensitive. + + * Study Computer Science + * Data Strucures + * Networks + * Algorithms + * Management + * Leadership + + If you are not in BitNode-4, then you must have Level 1 of Source-File 4 in order to use this function. + + This function will automatically set you to start taking a course at a university. If you are already in the middle of some + "working" action (such as working at a company, for a faction, or on a program), then running this function will automatically + cancel that action and give you your earnings. + + The cost and experience gains for all of these universities and classes are the same as if you were to manually visit and take these classes. + + This function will return true if you successfully start taking the course, and false otherwise. + +gymWorkout +---------- + +.. js:function:: gymWorkout(gymName, stat) + + :param string gymName: + Name of gym. Not case-sensitive. You must be in the correct city for whatever gym you specify. + + * Crush Fitness Gym + * Snap Fitness Gym + * Iron Gym + * Powerhouse Gym + * Millenium Fitness Gym + :param string stat: + The stat you want to train. Not case-sensitive. + + * strength OR str + * defense OR def + * dexterity OR dex + * agility OR agi + + If you are not in BitNode-4, then you must have Level 1 of Source-File 4 in order to use this function. + + This function will automatically set you to start working out at a gym to train a particular stat. If you are + already in the middle of some "working" action (such as working at a company, for a faction, or on a program), + then running this function will automatically cancel that action and give you your earnings. + + The cost and experience gains for all of these gyms are the same as if you were to manually visit these gyms and train + + This function will return true if you successfully start working out at the gym, and false otherwise. + +travelToCity +------------ + +.. js:function:: travelToCity(cityName) + + :param string cityName: + City to travel to. CASE-SENSITIVE. + + * Aevum + * Chongqing + * Sector-12 + * New Tokyo + * Ishima + * Volhaven + + If you are not in BitNode-4, then you must have Level 1 of Source-File 4 in order to use this function. + + This function allows the player to travel to any city. The cost for using this function is the same as the cost for traveling through the Travel Agency. + + This function will return true if you successfully travel to the specified city and false otherwise. + +purchaseTor +----------- + +.. js:function:: purchaseTor() + + If you are not in BitNode-4, then you must have Level 1 of Source-File 4 in order to use this function. + + This function allows you to automatically purchase a TOR router. The cost for purchasing a TOR router using this + function is the same as if you were to manually purchase one. + + This function will return true if it successfully purchase a TOR router and false otherwise. + +purchaseProgram +--------------- + +.. js:function:: purchaseProgram(programName) + + :param string programName: Name of program to purchase. Must include '.exe' extension. Not case-sensitive. + + If you are not in BitNode-4, then you must have Level 1 of Source-File 4 in order to use this function. + + This function allows you to automatically purchase programs. You MUST have a TOR router in order to use this function. + The cost of purchasing programs using this function is the same as if you were purchasing them through the Dark Web using the + Terminal *buy* command. + + Example:: + + purchaseProgram("brutessh.exe"); + + This function will return true if the specified program is purchased, and false otherwise. + +getStats +-------- + +.. js:function:: getStats() + + If you are not in BitNode-4, then you must have Level 1 of Source-File 4 in order to run this function. + + Returns an object with the Player's stats. The object has the following properties:: + + Player.hacking + Player.strength + Player.defense + Player.dexterity + Player.agility + Player.charisma + Player.intelligence + + Example:: + + res = getStats(); + print('My charisma level is: ' + res.charisma); + +isBusy +------ + +.. js:function:: isBusy() + + If you are not in BitNode-4, then you must have Level 1 of Source-File 4 in order to run this function. + + 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. + +upgradeHomeRam +-------------- + +.. js:function:: upgradeHomeRam() + + If you are not in BitNode-4, then you must have Level 2 of Source-File 4 in order to use this function. + + 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. + + This function will return true if the player's home computer RAM is successfully upgraded, and false otherwise. + +getUpgradeHomeRamCost +--------------------- + +.. js:function:: getUpgradeHomeRamCost() + + If you are not in BitNode-4, then you must have Level 2 of Source-File 4 in order to use this function. + + Returns the cost of upgrading the player's home computer RAM. + +workForCompany +-------------- + +.. js:function:: workForCompany() + + If you are not in BitNode-4, then you must have Level 2 of Source-File 4 in order to use this function. + + This function will automatically set you to start working at the company at which you are employed. + If you are already in the middle of some "working" action (such as working for a faction, training at + a gym, or creating a program), then running this function will automatically cancel that action and give you your earnings. + + This function will return true if the player starts working, and false otherwise. + + Note that when you are working for a company, you will not actually receive your earnings + (reputation, money, experience) until you FINISH the action. This can be an issue if, for example, + you only want to work until you get 100,000 company reputation. One small hack to get around this is to + continuously restart the action to receive your earnings:: + + while (getCompanyRep(COMPANY HERE) < VALUE) { + workForCompany(); + sleep(60000); + } + + This way, your company reputation will be updated every minute. + +applyToCompany +-------------- + +.. js:function:: applyToCompany(companyName, field) + + :param string companyName: Name of company to apply to. CASE-SENSITIVE. + :param string field: + Field to which you want to apply. Not case-sensitive + + * software + * software consultant + * it + * security engineer + * network engineer + * business + * business consultant + * security + * agent + * employee + * part-time employee + * waiter + * part-time waiter + + If you are not in BitNode-4, then you must have Level 2 of Source-File 4 in order to use this function. + + This function will automatically try to apply to the specified company for a position in the specified + field. This function can also be used to apply for promotions by specifying the company and field you + are already employed at. + + This function will return true if you successfully get a job/promotion, and false otherwise. Note that + if you are trying to use this function to apply for a promotion and you don't get one, it will return false. + +getCompanyRep +------------- + +.. js:function:: getCompanyRep(companyName) + + :param string companyName: Name of the company. CASE-SENSITIVE + + If you are not in BitNode-4, then you must have Level 2 of Source-File 4 in order to use this function. + + This function will return the amount of reputation you have at the specified company. + If the company passed in as an argument is invalid, -1 will be returned. + +checkFactionInvitations +----------------------- + +.. js:function:: checkFactionInvitations() + + If you are not in BitNode-4, then you must have Level 2 of Source-File 4 in order to use this function. + + Returns an array with the name of all Factions you currently have oustanding invitations from. + +joinFaction +----------- + +.. js:function:: joinFaction(name) + + :param string name: Name of faction to join. CASE-SENSITIVE + + If you are not in BitNode-4, then you must have Level 2 of Source-File 4 in order to use this function. + + This function will automatically accept an invitation from a faction and join it. + +workForFaction +-------------- + +.. js:function:: workForFaction(factionName, workType) + + :param string factionName: Name of faction to work for. CASE-SENSITIVE + :param string workType: + Type of work to perform for the faction + + * hacking/hacking contracts/hackingcontracts + * field/fieldwork/field work + * security/securitywork/security work + + If you are not in BitNode-4, then you must have Level 2 of Source-File 4 in order to use this function. + + This function will automatically set you to start working for the specified faction. + Obviously, you must be a member of the faction or else this function will fail. If you are already in + the middle of some "working" action (such as working for a company, training at a gym, or creating a program), + then running this function will automatically cancel that action and give you your earnings. + + This function will return true if you successfully start working for the specified faction, and false otherwise. + + Note that when you are working for a faction, you will not actually receive your earnings (reputation, experience) + until you FINISH the action. This can be an issue if, for example, you only want to work until you get 100,000 faction + reputation. One small hack to get around this is to continuously restart the action to receive your earnings:: + + while (getFactionRep(FACTION NAME) < VALUE) { + workForFaction(FACNAME, WORKTYPE); + sleep(60000); + } + + This way, your faction reputation will be updated every minute. + +getFactionRep +------------- + +.. js:function:: getFactionRep(factionName) + + :param string factionName: Name of faction. CASE-SENSITIVE + + If you are not in BitNode-4, then you must have Level 2 of Source-File 4 in order to use this function. + + This function returns the amount of reputation you have for the specified faction. + +createProgram +------------- + +.. js:function:: createProgram(programName) + + :param string programName: Name of program to create. Not case-sensitive + + If you are not in BitNode-4, then you must have Level 3 of Source-File 4 in order to use this function. + + This function will automatically set you to start working on creating the specified program. If you are + already in the middle of some "working" action (such as working for a company, training at a gym, or taking a course), + then running this function will automatically cancel that action and give you your earnings. + + Example: + + createProgram("relaysmtp.exe"); + + Note that creating a program using this function has the same hacking level requirements as it normally would. These level requirements are: + + * BruteSSH.exe: 50 + * FTPCrack.exe: 100 + * relaySMTP.exe: 250 + * HTTPWorm.exe: 500 + * SQLInject.exe: 750 + * DeepscanV1.exe: 75 + * DeepscanV2.exe: 400 + * ServerProfiler.exe: 75 + * AutoLink.exe: 25 + + This function returns true if you successfully start working on the specified program, and false otherwise. + +commitCrime +----------- + +.. js:function::commitCrime(crime) + + :param string crime: + Name of crime to attempt. Not case-sensitive. This argument is fairly lenient in terms of what inputs it accepts. + Here is a list of valid inputs for all of the crimes: + + * shoplift + * rob store + * mug + * larceny + * deal drugs + * bond forgery + * traffick arms + * homicide + * grand theft auto + * kidnap + * assassinate + * heist + + If you are not in BitNode-4, then you must have Level 3 of Source-File 4 in order to use this function. + + This function is used to automatically attempt to commit crimes. If you are already in the middle of some 'working' action + (such as working for a company or training at a gym), then running this function will automatically cancel that action and give you your earnings. + + Note that crimes committed using this function will have all of their earnings halved (this applied for both money and experience!) + + This function returns the number of seconds it takes to attempt the specified crime (e.g It takes 60 seconds to attempt the 'Rob Store' crime, + so running *commitCrime('rob store')* will return 60). + + Warning: I do not recommend using the time returned from this function to try and schedule your crime attempts. + Instead, I would use the isBusy() Singularity function to check whether you have finished attempting a crime. + This is because although the game sets a certain crime to be X amount of seconds, there is no guarantee that your + browser will follow that time limit. + +getCrimeChance +-------------- + +.. js:function:: getCrimeChance(crime) + + :param string crime: + Name of crime. Not case-sensitive. This argument is fairlyn lenient in terms of what inputs it accepts. + Check the documentation for the *commitCrime()* function for a list of example inputs. + + If you are not in BitNode-4, then you must have Level 3 of Source-File 4 in order to use this function. + + This function returns your chance of success at commiting the specified crime. The chance is returned as a decimal (i.e. 60% would be returned as 0.6). + +getOwnedAugmentations +--------------------- + +.. js:function:: getOwnedAugmentations(purchased=false) + + :param boolean purchase: + Specifies whether the returned array should include Augmentations you have purchased but not yet installed. + By default, this argument is false which means that the return value will NOT have the purchased Augmentations. + + If you are not in BitNode-4, then you must have Level 3 of Source-File 4 in order to use this function. + + This function returns an array containing the names (as strings) of all Augmentations you have. + +getAugmentationsFromFaction +--------------------------- + +.. js:function:: getAugmentationsFromFaction(facName) + + :param string facName: Name of faction. CASE-SENSITIVE + + If you are not in BitNode-4, then you must have Level 3 of Source-File 4 in order to use this function. + + Returns an array containing the names (as strings) of all Augmentations that are available from the specified faction. + +getAugmentationCost +------------------- + +.. js:function:: getAugmentationCost(augName) + + :param string augName: Name of Augmentation. CASE-SENSITIVE + + If you are not in BitNode-4, then you must have Level 3 of Source-File 4 in order to use this function. + + This function returns an array with two elements that gives the cost for the specified Augmentation. + The first element in the returned array is the reputation requirement of the Augmentation, and the second element is the money cost. + + If an invalid Augmentation name is passed in for the *augName* argument, this function will return the array [-1, -1]. + +purchaseAugmentation +-------------------- + +.. js:function:: purchaseAugmentation(factionName, augName) + + :param string factionName: Name of faction to purchase Augmentation from. CASE-SENSITIVE + :param string augName: Name of Augmentation to purchase. CASE-SENSITIVE + + + If you are not in BitNode-4, then you must have Level 3 of Source-File 4 in order to use this function. + + This function will try to purchase the specified Augmentation through the given Faction. + + This function will return true if the Augmentation is successfully purchased, and false otherwise. + +installAugmentations +-------------------- + +.. js:function:: installAugmentations(cbScript) + + :param string cbScript: + Optional callback script. This is a script that will automatically be run after Augmentations are installed (after the reset). + This script will be run with no arguments and 1 thread. It must be located on your home computer. + + If you are not in BitNode-4, then you must have Level 3 of Source-File 4 in order to use this function. + + This function will automatically install your Augmentations, resetting the game as usual. + + It will return true if successful, and false otherwise. diff --git a/doc/build/html/_static/agogo.css b/doc/build/html/_static/agogo.css new file mode 100644 index 000000000..3ff9bd04b --- /dev/null +++ b/doc/build/html/_static/agogo.css @@ -0,0 +1,541 @@ +/* + * agogo.css_t + * ~~~~~~~~~~~ + * + * Sphinx stylesheet -- agogo theme. + * + * :copyright: Copyright 2007-2017 by the Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. + * + */ + +* { + margin: 0px; + padding: 0px; +} + +body { + font-family: "Verdana", Arial, sans-serif; + line-height: 1.4em; + color: black; + background-color: #eeeeec; +} + + +/* Page layout */ + +div.header, div.content, div.footer { + width: 70em; + margin-left: auto; + margin-right: auto; +} + +div.header-wrapper { + background: #555573 url(bgtop.png) top left repeat-x; + border-bottom: 3px solid #2e3436; +} + + +/* Default body styles */ +a { + color: #ce5c00; +} + +div.bodywrapper a, div.footer a { + text-decoration: underline; +} + +.clearer { + clear: both; +} + +.left { + float: left; +} + +.right { + float: right; +} + +.line-block { + display: block; + margin-top: 1em; + margin-bottom: 1em; +} + +.line-block .line-block { + margin-top: 0; + margin-bottom: 0; + margin-left: 1.5em; +} + +h1, h2, h3, h4 { + font-family: "Georgia", "Times New Roman", serif; + font-weight: normal; + color: #3465a4; + margin-bottom: .8em; +} + +h1 { + color: #204a87; +} + +h2 { + padding-bottom: .5em; + border-bottom: 1px solid #3465a4; +} + +a.headerlink { + visibility: hidden; + color: #dddddd; + padding-left: .3em; +} + +h1:hover > a.headerlink, +h2:hover > a.headerlink, +h3:hover > a.headerlink, +h4:hover > a.headerlink, +h5:hover > a.headerlink, +h6:hover > a.headerlink, +dt:hover > a.headerlink, +caption:hover > a.headerlink, +p.caption:hover > a.headerlink, +div.code-block-caption:hover > a.headerlink { + visibility: visible; +} + +img { + border: 0; +} + +div.admonition { + margin-top: 10px; + margin-bottom: 10px; + padding: 2px 7px 1px 7px; + border-left: 0.2em solid black; +} + +p.admonition-title { + margin: 0px 10px 5px 0px; + font-weight: bold; +} + +dt:target, .highlighted { + background-color: #fbe54e; +} + +/* Header */ + +div.header { + padding-top: 10px; + padding-bottom: 10px; +} + +div.header .headertitle { + font-family: "Georgia", "Times New Roman", serif; + font-weight: normal; + font-size: 180%; + letter-spacing: .08em; + margin-bottom: .8em; +} + +div.header .headertitle a { + color: white; +} + +div.header div.rel { + margin-top: 1em; +} + +div.header div.rel a { + color: #fcaf3e; + letter-spacing: .1em; + text-transform: uppercase; +} + +p.logo { + float: right; +} + +img.logo { + border: 0; +} + + +/* Content */ +div.content-wrapper { + background-color: white; + padding-top: 20px; + padding-bottom: 20px; +} + +div.document { + width: 50em; + float: left; +} + +div.body { + padding-right: 2em; + text-align: justify; +} + +div.document h1 { + line-height: 120%; +} + +div.document ul { + margin: 1.5em; + list-style-type: square; +} + +div.document dd { + margin-left: 1.2em; + margin-top: .4em; + margin-bottom: 1em; +} + +div.document .section { + margin-top: 1.7em; +} +div.document .section:first-child { + margin-top: 0px; +} + +div.document div.highlight { + padding: 3px; + background-color: #eeeeec; + border-top: 2px solid #dddddd; + border-bottom: 2px solid #dddddd; + margin-top: .8em; + margin-bottom: .8em; +} + +div.document div.literal-block-wrapper { + margin-top: .8em; + margin-bottom: .8em; +} + +div.document div.literal-block-wrapper div.highlight { + margin: 0; +} + +div.document div.code-block-caption span.caption-number { + padding: 0.1em 0.3em; + font-style: italic; +} + +div.document div.code-block-caption span.caption-text { +} + +div.document h2 { + margin-top: .7em; +} + +div.document p { + margin-bottom: .5em; +} + +div.document li.toctree-l1 { + margin-bottom: 1em; +} + +div.document .descname { + font-weight: bold; +} + +div.document .sig-paren { + font-size: larger; +} + +div.document .docutils.literal { + background-color: #eeeeec; + padding: 1px; +} + +div.document .docutils.xref.literal { + background-color: transparent; + padding: 0px; +} + +div.document blockquote { + margin: 1em; +} + +div.document ol { + margin: 1.5em; +} + + +/* Sidebar */ + +div.sidebar { + width: 20em; + position:fixed; + right: 10%; + height:75%; + font-size: .9em; + overflow-y:auto; +} +/* +div.sidebar { + width: 20em; + float: right; + font-size: .9em; +} +*/ + +div.sidebar a, div.header a { + text-decoration: none; +} + +div.sidebar a:hover, div.header a:hover { + text-decoration: underline; +} + +div.sidebar h3 { + color: #2e3436; + text-transform: uppercase; + font-size: 130%; + letter-spacing: .1em; +} + +div.sidebar ul { + list-style-type: none; +} + +div.sidebar li.toctree-l1 a { + display: block; + padding: 1px; + border: 1px solid #dddddd; + background-color: #eeeeec; + margin-bottom: .4em; + padding-left: 3px; + color: #2e3436; +} + +div.sidebar li.toctree-l2 a { + background-color: transparent; + border: none; + margin-left: 1em; + border-bottom: 1px solid #dddddd; +} + +div.sidebar li.toctree-l3 a { + background-color: transparent; + border: none; + margin-left: 2em; + border-bottom: 1px solid #dddddd; +} + +div.sidebar li.toctree-l2:last-child a { + border-bottom: none; +} + +div.sidebar li.toctree-l1.current a { + border-right: 5px solid #fcaf3e; +} + +div.sidebar li.toctree-l1.current li.toctree-l2 a { + border-right: none; +} + +div.sidebar input[type="text"] { + width: 170px; +} + +div.sidebar input[type="submit"] { + width: 30px; +} + + +/* Footer */ + +div.footer-wrapper { + background: url(bgfooter.png) top left repeat-x; + border-top: 4px solid #babdb6; + padding-top: 10px; + padding-bottom: 10px; + min-height: 80px; +} + +div.footer, div.footer a { + color: #888a85; +} + +div.footer .right { + text-align: right; +} + +div.footer .left { + text-transform: uppercase; +} + + +/* Styles copied from basic theme */ + +img.align-left, .figure.align-left, object.align-left { + clear: left; + float: left; + margin-right: 1em; +} + +img.align-right, .figure.align-right, object.align-right { + clear: right; + float: right; + margin-left: 1em; +} + +img.align-center, .figure.align-center, object.align-center { + display: block; + margin-left: auto; + margin-right: auto; +} + +.align-left { + text-align: left; +} + +.align-center { + text-align: center; +} + +.align-right { + text-align: right; +} + +table caption span.caption-number { + font-style: italic; +} + +table caption span.caption-text { +} + +div.figure p.caption span.caption-number { + font-style: italic; +} + +div.figure p.caption span.caption-text { +} + +/* -- search page ----------------------------------------------------------- */ + +ul.search { + margin: 10px 0 0 20px; + padding: 0; +} + +ul.search li { + padding: 5px 0 5px 20px; + background-image: url(file.png); + background-repeat: no-repeat; + background-position: 0 7px; +} + +ul.search li a { + font-weight: bold; +} + +ul.search li div.context { + color: #888; + margin: 2px 0 0 30px; + text-align: left; +} + +ul.keywordmatches li.goodmatch a { + font-weight: bold; +} + +/* -- index page ------------------------------------------------------------ */ + +table.contentstable { + width: 90%; +} + +table.contentstable p.biglink { + line-height: 150%; +} + +a.biglink { + font-size: 1.3em; +} + +span.linkdescr { + font-style: italic; + padding-top: 5px; + font-size: 90%; +} + +/* -- general index --------------------------------------------------------- */ + +table.indextable td { + text-align: left; + vertical-align: top; +} + +table.indextable ul { + margin-top: 0; + margin-bottom: 0; + list-style-type: none; +} + +table.indextable > tbody > tr > td > ul { + padding-left: 0em; +} + +table.indextable tr.pcap { + height: 10px; +} + +table.indextable tr.cap { + margin-top: 10px; + background-color: #f2f2f2; +} + +img.toggler { + margin-right: 3px; + margin-top: 3px; + cursor: pointer; +} + +/* -- domain module index --------------------------------------------------- */ + +table.modindextable td { + padding: 2px; + border-collapse: collapse; +} + +/* -- viewcode extension ---------------------------------------------------- */ + +.viewcode-link { + float: right; +} + +.viewcode-back { + float: right; + font-family:: "Verdana", Arial, sans-serif; +} + +div.viewcode-block:target { + margin: -1px -3px; + padding: 0 3px; + background-color: #f4debf; + border-top: 1px solid #ac9; + border-bottom: 1px solid #ac9; +} + +div.code-block-caption { + background-color: #ddd; + color: #333; + padding: 2px 5px; + font-size: small; +} + +/* -- math display ---------------------------------------------------------- */ + +div.body div.math p { + text-align: center; +} + +span.eqno { + float: right; +} diff --git a/doc/build/html/_static/ajax-loader.gif b/doc/build/html/_static/ajax-loader.gif new file mode 100644 index 000000000..61faf8cab Binary files /dev/null and b/doc/build/html/_static/ajax-loader.gif differ diff --git a/doc/build/html/_static/basic.css b/doc/build/html/_static/basic.css new file mode 100644 index 000000000..90acfde50 --- /dev/null +++ b/doc/build/html/_static/basic.css @@ -0,0 +1,639 @@ +/* + * basic.css + * ~~~~~~~~~ + * + * Sphinx stylesheet -- basic theme. + * + * :copyright: Copyright 2007-2017 by the Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. + * + */ + +/* -- main layout ----------------------------------------------------------- */ + +div.clearer { + clear: both; +} + +/* -- relbar ---------------------------------------------------------------- */ + +div.related { + width: 100%; + font-size: 90%; +} + +div.related h3 { + display: none; +} + +div.related ul { + margin: 0; + padding: 0 0 0 10px; + list-style: none; +} + +div.related li { + display: inline; +} + +div.related li.right { + float: right; + margin-right: 5px; +} + +/* -- sidebar --------------------------------------------------------------- */ + +div.sphinxsidebarwrapper { + padding: 10px 5px 0 10px; +} + +div.sphinxsidebar { + float: left; + width: 0px; + margin-left: -100%; + font-size: 90%; + word-wrap: break-word; + overflow-wrap : break-word; +} + +div.sphinxsidebar ul { + list-style: none; +} + +div.sphinxsidebar ul ul, +div.sphinxsidebar ul.want-points { + margin-left: 20px; + list-style: square; +} + +div.sphinxsidebar ul ul { + margin-top: 0; + margin-bottom: 0; +} + +div.sphinxsidebar form { + margin-top: 10px; +} + +div.sphinxsidebar input { + border: 1px solid #98dbcc; + font-family: sans-serif; + font-size: 1em; +} + +div.sphinxsidebar #searchbox input[type="text"] { + width: 170px; +} + +img { + border: 0; + max-width: 100%; +} + +/* -- search page ----------------------------------------------------------- */ + +ul.search { + margin: 10px 0 0 20px; + padding: 0; +} + +ul.search li { + padding: 5px 0 5px 20px; + background-image: url(file.png); + background-repeat: no-repeat; + background-position: 0 7px; +} + +ul.search li a { + font-weight: bold; +} + +ul.search li div.context { + color: #888; + margin: 2px 0 0 30px; + text-align: left; +} + +ul.keywordmatches li.goodmatch a { + font-weight: bold; +} + +/* -- index page ------------------------------------------------------------ */ + +table.contentstable { + width: 90%; + margin-left: auto; + margin-right: auto; +} + +table.contentstable p.biglink { + line-height: 150%; +} + +a.biglink { + font-size: 1.3em; +} + +span.linkdescr { + font-style: italic; + padding-top: 5px; + font-size: 90%; +} + +/* -- general index --------------------------------------------------------- */ + +table.indextable { + width: 100%; +} + +table.indextable td { + text-align: left; + vertical-align: top; +} + +table.indextable ul { + margin-top: 0; + margin-bottom: 0; + list-style-type: none; +} + +table.indextable > tbody > tr > td > ul { + padding-left: 0em; +} + +table.indextable tr.pcap { + height: 10px; +} + +table.indextable tr.cap { + margin-top: 10px; + background-color: #f2f2f2; +} + +img.toggler { + margin-right: 3px; + margin-top: 3px; + cursor: pointer; +} + +div.modindex-jumpbox { + border-top: 1px solid #ddd; + border-bottom: 1px solid #ddd; + margin: 1em 0 1em 0; + padding: 0.4em; +} + +div.genindex-jumpbox { + border-top: 1px solid #ddd; + border-bottom: 1px solid #ddd; + margin: 1em 0 1em 0; + padding: 0.4em; +} + +/* -- domain module index --------------------------------------------------- */ + +table.modindextable td { + padding: 2px; + border-collapse: collapse; +} + +/* -- general body styles --------------------------------------------------- */ + +div.body p, div.body dd, div.body li, div.body blockquote { + -moz-hyphens: auto; + -ms-hyphens: auto; + -webkit-hyphens: auto; + hyphens: auto; +} + +a.headerlink { + visibility: hidden; +} + +h1:hover > a.headerlink, +h2:hover > a.headerlink, +h3:hover > a.headerlink, +h4:hover > a.headerlink, +h5:hover > a.headerlink, +h6:hover > a.headerlink, +dt:hover > a.headerlink, +caption:hover > a.headerlink, +p.caption:hover > a.headerlink, +div.code-block-caption:hover > a.headerlink { + visibility: visible; +} + +div.body p.caption { + text-align: inherit; +} + +div.body td { + text-align: left; +} + +.first { + margin-top: 0 !important; +} + +p.rubric { + margin-top: 30px; + font-weight: bold; +} + +img.align-left, .figure.align-left, object.align-left { + clear: left; + float: left; + margin-right: 1em; +} + +img.align-right, .figure.align-right, object.align-right { + clear: right; + float: right; + margin-left: 1em; +} + +img.align-center, .figure.align-center, object.align-center { + display: block; + margin-left: auto; + margin-right: auto; +} + +.align-left { + text-align: left; +} + +.align-center { + text-align: center; +} + +.align-right { + text-align: right; +} + +/* -- sidebars -------------------------------------------------------------- */ + +div.sidebar { + margin: 0 0 0.5em 1em; + border: 1px solid #ddb; + padding: 7px 7px 0 7px; + background-color: #ffe; + width: 40%; + float: right; +} + +p.sidebar-title { + font-weight: bold; +} + +/* -- topics ---------------------------------------------------------------- */ + +div.topic { + border: 1px solid #ccc; + padding: 7px 7px 0 7px; + margin: 10px 0 10px 0; +} + +p.topic-title { + font-size: 1.1em; + font-weight: bold; + margin-top: 10px; +} + +/* -- admonitions ----------------------------------------------------------- */ + +div.admonition { + margin-top: 10px; + margin-bottom: 10px; + padding: 7px; +} + +div.admonition dt { + font-weight: bold; +} + +div.admonition dl { + margin-bottom: 0; +} + +p.admonition-title { + margin: 0px 10px 5px 0px; + font-weight: bold; +} + +div.body p.centered { + text-align: center; + margin-top: 25px; +} + +/* -- tables ---------------------------------------------------------------- */ + +table.docutils { + border: 0; + border-collapse: collapse; +} + +table caption span.caption-number { + font-style: italic; +} + +table caption span.caption-text { +} + +table.docutils td, table.docutils th { + padding: 1px 8px 1px 5px; + border-top: 0; + border-left: 0; + border-right: 0; + border-bottom: 1px solid #aaa; +} + +table.footnote td, table.footnote th { + border: 0 !important; +} + +th { + text-align: left; + padding-right: 5px; +} + +table.citation { + border-left: solid 1px gray; + margin-left: 1px; +} + +table.citation td { + border-bottom: none; +} + +/* -- figures --------------------------------------------------------------- */ + +div.figure { + margin: 0.5em; + padding: 0.5em; +} + +div.figure p.caption { + padding: 0.3em; +} + +div.figure p.caption span.caption-number { + font-style: italic; +} + +div.figure p.caption span.caption-text { +} + +/* -- field list styles ----------------------------------------------------- */ + +table.field-list td, table.field-list th { + border: 0 !important; +} + +.field-list ul { + margin: 0; + padding-left: 1em; +} + +.field-list p { + margin: 0; +} + +.field-name { + -moz-hyphens: manual; + -ms-hyphens: manual; + -webkit-hyphens: manual; + hyphens: manual; +} + +/* -- other body styles ----------------------------------------------------- */ + +ol.arabic { + list-style: decimal; +} + +ol.loweralpha { + list-style: lower-alpha; +} + +ol.upperalpha { + list-style: upper-alpha; +} + +ol.lowerroman { + list-style: lower-roman; +} + +ol.upperroman { + list-style: upper-roman; +} + +dl { + margin-bottom: 15px; +} + +dd p { + margin-top: 0px; +} + +dd ul, dd table { + margin-bottom: 10px; +} + +dd { + margin-top: 3px; + margin-bottom: 10px; + margin-left: 30px; +} + +dt:target, .highlighted { + background-color: #fbe54e; +} + +dl.glossary dt { + font-weight: bold; + font-size: 1.1em; +} + +.optional { + font-size: 1.3em; +} + +.sig-paren { + font-size: larger; +} + +.versionmodified { + font-style: italic; +} + +.system-message { + background-color: #fda; + padding: 5px; + border: 3px solid red; +} + +.footnote:target { + background-color: #ffa; +} + +.line-block { + display: block; + margin-top: 1em; + margin-bottom: 1em; +} + +.line-block .line-block { + margin-top: 0; + margin-bottom: 0; + margin-left: 1.5em; +} + +.guilabel, .menuselection { + font-family: sans-serif; +} + +.accelerator { + text-decoration: underline; +} + +.classifier { + font-style: oblique; +} + +abbr, acronym { + border-bottom: dotted 1px; + cursor: help; +} + +/* -- code displays --------------------------------------------------------- */ + +pre { + overflow: auto; + overflow-y: hidden; /* fixes display issues on Chrome browsers */ +} + +span.pre { + -moz-hyphens: none; + -ms-hyphens: none; + -webkit-hyphens: none; + hyphens: none; +} + +td.linenos pre { + padding: 5px 0px; + border: 0; + background-color: transparent; + color: #aaa; +} + +table.highlighttable { + margin-left: 0.5em; +} + +table.highlighttable td { + padding: 0 0.5em 0 0.5em; +} + +div.code-block-caption { + padding: 2px 5px; + font-size: small; +} + +div.code-block-caption code { + background-color: transparent; +} + +div.code-block-caption + div > div.highlight > pre { + margin-top: 0; +} + +div.code-block-caption span.caption-number { + padding: 0.1em 0.3em; + font-style: italic; +} + +div.code-block-caption span.caption-text { +} + +div.literal-block-wrapper { + padding: 1em 1em 0; +} + +div.literal-block-wrapper div.highlight { + margin: 0; +} + +code.descname { + background-color: transparent; + font-weight: bold; + font-size: 1.2em; +} + +code.descclassname { + background-color: transparent; +} + +code.xref, a code { + background-color: transparent; + font-weight: bold; +} + +h1 code, h2 code, h3 code, h4 code, h5 code, h6 code { + background-color: transparent; +} + +.viewcode-link { + float: right; +} + +.viewcode-back { + float: right; + font-family: sans-serif; +} + +div.viewcode-block:target { + margin: -1px -10px; + padding: 0 10px; +} + +/* -- math display ---------------------------------------------------------- */ + +img.math { + vertical-align: middle; +} + +div.body div.math p { + text-align: center; +} + +span.eqno { + float: right; +} + +span.eqno a.headerlink { + position: relative; + left: 0px; + z-index: 1; +} + +div.math:hover a.headerlink { + visibility: visible; +} + +/* -- printout stylesheet --------------------------------------------------- */ + +@media print { + div.document, + div.documentwrapper, + div.bodywrapper { + margin: 0 !important; + width: 100%; + } + + div.sphinxsidebar, + div.related, + div.footer, + #top-link { + display: none; + } +} \ No newline at end of file diff --git a/doc/build/html/_static/bgfooter.png b/doc/build/html/_static/bgfooter.png new file mode 100644 index 000000000..b7c7cadd4 Binary files /dev/null and b/doc/build/html/_static/bgfooter.png differ diff --git a/doc/build/html/_static/bgtop.png b/doc/build/html/_static/bgtop.png new file mode 100644 index 000000000..05740880f Binary files /dev/null and b/doc/build/html/_static/bgtop.png differ diff --git a/doc/build/html/_static/comment-bright.png b/doc/build/html/_static/comment-bright.png new file mode 100644 index 000000000..15e27edb1 Binary files /dev/null and b/doc/build/html/_static/comment-bright.png differ diff --git a/doc/build/html/_static/comment-close.png b/doc/build/html/_static/comment-close.png new file mode 100644 index 000000000..4d91bcf57 Binary files /dev/null and b/doc/build/html/_static/comment-close.png differ diff --git a/doc/build/html/_static/comment.png b/doc/build/html/_static/comment.png new file mode 100644 index 000000000..dfbc0cbd5 Binary files /dev/null and b/doc/build/html/_static/comment.png differ diff --git a/doc/build/html/_static/doctools.js b/doc/build/html/_static/doctools.js new file mode 100644 index 000000000..565497723 --- /dev/null +++ b/doc/build/html/_static/doctools.js @@ -0,0 +1,287 @@ +/* + * doctools.js + * ~~~~~~~~~~~ + * + * Sphinx JavaScript utilities for all documentation. + * + * :copyright: Copyright 2007-2017 by the Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. + * + */ + +/** + * select a different prefix for underscore + */ +$u = _.noConflict(); + +/** + * make the code below compatible with browsers without + * an installed firebug like debugger +if (!window.console || !console.firebug) { + var names = ["log", "debug", "info", "warn", "error", "assert", "dir", + "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace", + "profile", "profileEnd"]; + window.console = {}; + for (var i = 0; i < names.length; ++i) + window.console[names[i]] = function() {}; +} + */ + +/** + * small helper function to urldecode strings + */ +jQuery.urldecode = function(x) { + return decodeURIComponent(x).replace(/\+/g, ' '); +}; + +/** + * small helper function to urlencode strings + */ +jQuery.urlencode = encodeURIComponent; + +/** + * This function returns the parsed url parameters of the + * current request. Multiple values per key are supported, + * it will always return arrays of strings for the value parts. + */ +jQuery.getQueryParameters = function(s) { + if (typeof s == 'undefined') + s = document.location.search; + var parts = s.substr(s.indexOf('?') + 1).split('&'); + var result = {}; + for (var i = 0; i < parts.length; i++) { + var tmp = parts[i].split('=', 2); + var key = jQuery.urldecode(tmp[0]); + var value = jQuery.urldecode(tmp[1]); + if (key in result) + result[key].push(value); + else + result[key] = [value]; + } + return result; +}; + +/** + * highlight a given string on a jquery object by wrapping it in + * span elements with the given class name. + */ +jQuery.fn.highlightText = function(text, className) { + function highlight(node) { + if (node.nodeType == 3) { + var val = node.nodeValue; + var pos = val.toLowerCase().indexOf(text); + if (pos >= 0 && !jQuery(node.parentNode).hasClass(className)) { + var span = document.createElement("span"); + span.className = className; + span.appendChild(document.createTextNode(val.substr(pos, text.length))); + node.parentNode.insertBefore(span, node.parentNode.insertBefore( + document.createTextNode(val.substr(pos + text.length)), + node.nextSibling)); + node.nodeValue = val.substr(0, pos); + } + } + else if (!jQuery(node).is("button, select, textarea")) { + jQuery.each(node.childNodes, function() { + highlight(this); + }); + } + } + return this.each(function() { + highlight(this); + }); +}; + +/* + * backward compatibility for jQuery.browser + * This will be supported until firefox bug is fixed. + */ +if (!jQuery.browser) { + jQuery.uaMatch = function(ua) { + ua = ua.toLowerCase(); + + var match = /(chrome)[ \/]([\w.]+)/.exec(ua) || + /(webkit)[ \/]([\w.]+)/.exec(ua) || + /(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) || + /(msie) ([\w.]+)/.exec(ua) || + ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) || + []; + + return { + browser: match[ 1 ] || "", + version: match[ 2 ] || "0" + }; + }; + jQuery.browser = {}; + jQuery.browser[jQuery.uaMatch(navigator.userAgent).browser] = true; +} + +/** + * Small JavaScript module for the documentation. + */ +var Documentation = { + + init : function() { + this.fixFirefoxAnchorBug(); + this.highlightSearchWords(); + this.initIndexTable(); + + }, + + /** + * i18n support + */ + TRANSLATIONS : {}, + PLURAL_EXPR : function(n) { return n == 1 ? 0 : 1; }, + LOCALE : 'unknown', + + // gettext and ngettext don't access this so that the functions + // can safely bound to a different name (_ = Documentation.gettext) + gettext : function(string) { + var translated = Documentation.TRANSLATIONS[string]; + if (typeof translated == 'undefined') + return string; + return (typeof translated == 'string') ? translated : translated[0]; + }, + + ngettext : function(singular, plural, n) { + var translated = Documentation.TRANSLATIONS[singular]; + if (typeof translated == 'undefined') + return (n == 1) ? singular : plural; + return translated[Documentation.PLURALEXPR(n)]; + }, + + addTranslations : function(catalog) { + for (var key in catalog.messages) + this.TRANSLATIONS[key] = catalog.messages[key]; + this.PLURAL_EXPR = new Function('n', 'return +(' + catalog.plural_expr + ')'); + this.LOCALE = catalog.locale; + }, + + /** + * add context elements like header anchor links + */ + addContextElements : function() { + $('div[id] > :header:first').each(function() { + $('\u00B6'). + attr('href', '#' + this.id). + attr('title', _('Permalink to this headline')). + appendTo(this); + }); + $('dt[id]').each(function() { + $('\u00B6'). + attr('href', '#' + this.id). + attr('title', _('Permalink to this definition')). + appendTo(this); + }); + }, + + /** + * workaround a firefox stupidity + * see: https://bugzilla.mozilla.org/show_bug.cgi?id=645075 + */ + fixFirefoxAnchorBug : function() { + if (document.location.hash) + window.setTimeout(function() { + document.location.href += ''; + }, 10); + }, + + /** + * highlight the search words provided in the url in the text + */ + highlightSearchWords : function() { + var params = $.getQueryParameters(); + var terms = (params.highlight) ? params.highlight[0].split(/\s+/) : []; + if (terms.length) { + var body = $('div.body'); + if (!body.length) { + body = $('body'); + } + window.setTimeout(function() { + $.each(terms, function() { + body.highlightText(this.toLowerCase(), 'highlighted'); + }); + }, 10); + $('') + .appendTo($('#searchbox')); + } + }, + + /** + * init the domain index toggle buttons + */ + initIndexTable : function() { + var togglers = $('img.toggler').click(function() { + var src = $(this).attr('src'); + var idnum = $(this).attr('id').substr(7); + $('tr.cg-' + idnum).toggle(); + if (src.substr(-9) == 'minus.png') + $(this).attr('src', src.substr(0, src.length-9) + 'plus.png'); + else + $(this).attr('src', src.substr(0, src.length-8) + 'minus.png'); + }).css('display', ''); + if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) { + togglers.click(); + } + }, + + /** + * helper function to hide the search marks again + */ + hideSearchWords : function() { + $('#searchbox .highlight-link').fadeOut(300); + $('span.highlighted').removeClass('highlighted'); + }, + + /** + * make the url absolute + */ + makeURL : function(relativeURL) { + return DOCUMENTATION_OPTIONS.URL_ROOT + '/' + relativeURL; + }, + + /** + * get the current relative url + */ + getCurrentURL : function() { + var path = document.location.pathname; + var parts = path.split(/\//); + $.each(DOCUMENTATION_OPTIONS.URL_ROOT.split(/\//), function() { + if (this == '..') + parts.pop(); + }); + var url = parts.join('/'); + return path.substring(url.lastIndexOf('/') + 1, path.length - 1); + }, + + initOnKeyListeners: function() { + $(document).keyup(function(event) { + var activeElementType = document.activeElement.tagName; + // don't navigate when in search box or textarea + if (activeElementType !== 'TEXTAREA' && activeElementType !== 'INPUT' && activeElementType !== 'SELECT') { + switch (event.keyCode) { + case 37: // left + var prevHref = $('link[rel="prev"]').prop('href'); + if (prevHref) { + window.location.href = prevHref; + return false; + } + case 39: // right + var nextHref = $('link[rel="next"]').prop('href'); + if (nextHref) { + window.location.href = nextHref; + return false; + } + } + } + }); + } +}; + +// quick alias for translations +_ = Documentation.gettext; + +$(document).ready(function() { + Documentation.init(); +}); \ No newline at end of file diff --git a/doc/build/html/_static/down-pressed.png b/doc/build/html/_static/down-pressed.png new file mode 100644 index 000000000..5756c8cad Binary files /dev/null and b/doc/build/html/_static/down-pressed.png differ diff --git a/doc/build/html/_static/down.png b/doc/build/html/_static/down.png new file mode 100644 index 000000000..1b3bdad2c Binary files /dev/null and b/doc/build/html/_static/down.png differ diff --git a/doc/build/html/_static/file.png b/doc/build/html/_static/file.png new file mode 100644 index 000000000..a858a410e Binary files /dev/null and b/doc/build/html/_static/file.png differ diff --git a/doc/build/html/_static/jquery-3.1.0.js b/doc/build/html/_static/jquery-3.1.0.js new file mode 100644 index 000000000..f2fc27478 --- /dev/null +++ b/doc/build/html/_static/jquery-3.1.0.js @@ -0,0 +1,10074 @@ +/*eslint-disable no-unused-vars*/ +/*! + * jQuery JavaScript Library v3.1.0 + * https://jquery.com/ + * + * Includes Sizzle.js + * https://sizzlejs.com/ + * + * Copyright jQuery Foundation and other contributors + * Released under the MIT license + * https://jquery.org/license + * + * Date: 2016-07-07T21:44Z + */ +( function( global, factory ) { + + "use strict"; + + if ( typeof module === "object" && typeof module.exports === "object" ) { + + // For CommonJS and CommonJS-like environments where a proper `window` + // is present, execute the factory and get jQuery. + // For environments that do not have a `window` with a `document` + // (such as Node.js), expose a factory as module.exports. + // This accentuates the need for the creation of a real `window`. + // e.g. var jQuery = require("jquery")(window); + // See ticket #14549 for more info. + module.exports = global.document ? + factory( global, true ) : + function( w ) { + if ( !w.document ) { + throw new Error( "jQuery requires a window with a document" ); + } + return factory( w ); + }; + } else { + factory( global ); + } + +// Pass this if window is not defined yet +} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) { + +// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1 +// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode +// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common +// enough that all such attempts are guarded in a try block. +"use strict"; + +var arr = []; + +var document = window.document; + +var getProto = Object.getPrototypeOf; + +var slice = arr.slice; + +var concat = arr.concat; + +var push = arr.push; + +var indexOf = arr.indexOf; + +var class2type = {}; + +var toString = class2type.toString; + +var hasOwn = class2type.hasOwnProperty; + +var fnToString = hasOwn.toString; + +var ObjectFunctionString = fnToString.call( Object ); + +var support = {}; + + + + function DOMEval( code, doc ) { + doc = doc || document; + + var script = doc.createElement( "script" ); + + script.text = code; + doc.head.appendChild( script ).parentNode.removeChild( script ); + } +/* global Symbol */ +// Defining this global in .eslintrc would create a danger of using the global +// unguarded in another place, it seems safer to define global only for this module + + + +var + version = "3.1.0", + + // Define a local copy of jQuery + jQuery = function( selector, context ) { + + // The jQuery object is actually just the init constructor 'enhanced' + // Need init if jQuery is called (just allow error to be thrown if not included) + return new jQuery.fn.init( selector, context ); + }, + + // Support: Android <=4.0 only + // Make sure we trim BOM and NBSP + rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, + + // Matches dashed string for camelizing + rmsPrefix = /^-ms-/, + rdashAlpha = /-([a-z])/g, + + // Used by jQuery.camelCase as callback to replace() + fcamelCase = function( all, letter ) { + return letter.toUpperCase(); + }; + +jQuery.fn = jQuery.prototype = { + + // The current version of jQuery being used + jquery: version, + + constructor: jQuery, + + // The default length of a jQuery object is 0 + length: 0, + + toArray: function() { + return slice.call( this ); + }, + + // Get the Nth element in the matched element set OR + // Get the whole matched element set as a clean array + get: function( num ) { + return num != null ? + + // Return just the one element from the set + ( num < 0 ? this[ num + this.length ] : this[ num ] ) : + + // Return all the elements in a clean array + slice.call( this ); + }, + + // Take an array of elements and push it onto the stack + // (returning the new matched element set) + pushStack: function( elems ) { + + // Build a new jQuery matched element set + var ret = jQuery.merge( this.constructor(), elems ); + + // Add the old object onto the stack (as a reference) + ret.prevObject = this; + + // Return the newly-formed element set + return ret; + }, + + // Execute a callback for every element in the matched set. + each: function( callback ) { + return jQuery.each( this, callback ); + }, + + map: function( callback ) { + return this.pushStack( jQuery.map( this, function( elem, i ) { + return callback.call( elem, i, elem ); + } ) ); + }, + + slice: function() { + return this.pushStack( slice.apply( this, arguments ) ); + }, + + first: function() { + return this.eq( 0 ); + }, + + last: function() { + return this.eq( -1 ); + }, + + eq: function( i ) { + var len = this.length, + j = +i + ( i < 0 ? len : 0 ); + return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] ); + }, + + end: function() { + return this.prevObject || this.constructor(); + }, + + // For internal use only. + // Behaves like an Array's method, not like a jQuery method. + push: push, + sort: arr.sort, + splice: arr.splice +}; + +jQuery.extend = jQuery.fn.extend = function() { + var options, name, src, copy, copyIsArray, clone, + target = arguments[ 0 ] || {}, + i = 1, + length = arguments.length, + deep = false; + + // Handle a deep copy situation + if ( typeof target === "boolean" ) { + deep = target; + + // Skip the boolean and the target + target = arguments[ i ] || {}; + i++; + } + + // Handle case when target is a string or something (possible in deep copy) + if ( typeof target !== "object" && !jQuery.isFunction( target ) ) { + target = {}; + } + + // Extend jQuery itself if only one argument is passed + if ( i === length ) { + target = this; + i--; + } + + for ( ; i < length; i++ ) { + + // Only deal with non-null/undefined values + if ( ( options = arguments[ i ] ) != null ) { + + // Extend the base object + for ( name in options ) { + src = target[ name ]; + copy = options[ name ]; + + // Prevent never-ending loop + if ( target === copy ) { + continue; + } + + // Recurse if we're merging plain objects or arrays + if ( deep && copy && ( jQuery.isPlainObject( copy ) || + ( copyIsArray = jQuery.isArray( copy ) ) ) ) { + + if ( copyIsArray ) { + copyIsArray = false; + clone = src && jQuery.isArray( src ) ? src : []; + + } else { + clone = src && jQuery.isPlainObject( src ) ? src : {}; + } + + // Never move original objects, clone them + target[ name ] = jQuery.extend( deep, clone, copy ); + + // Don't bring in undefined values + } else if ( copy !== undefined ) { + target[ name ] = copy; + } + } + } + } + + // Return the modified object + return target; +}; + +jQuery.extend( { + + // Unique for each copy of jQuery on the page + expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), + + // Assume jQuery is ready without the ready module + isReady: true, + + error: function( msg ) { + throw new Error( msg ); + }, + + noop: function() {}, + + isFunction: function( obj ) { + return jQuery.type( obj ) === "function"; + }, + + isArray: Array.isArray, + + isWindow: function( obj ) { + return obj != null && obj === obj.window; + }, + + isNumeric: function( obj ) { + + // As of jQuery 3.0, isNumeric is limited to + // strings and numbers (primitives or objects) + // that can be coerced to finite numbers (gh-2662) + var type = jQuery.type( obj ); + return ( type === "number" || type === "string" ) && + + // parseFloat NaNs numeric-cast false positives ("") + // ...but misinterprets leading-number strings, particularly hex literals ("0x...") + // subtraction forces infinities to NaN + !isNaN( obj - parseFloat( obj ) ); + }, + + isPlainObject: function( obj ) { + var proto, Ctor; + + // Detect obvious negatives + // Use toString instead of jQuery.type to catch host objects + if ( !obj || toString.call( obj ) !== "[object Object]" ) { + return false; + } + + proto = getProto( obj ); + + // Objects with no prototype (e.g., `Object.create( null )`) are plain + if ( !proto ) { + return true; + } + + // Objects with prototype are plain iff they were constructed by a global Object function + Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor; + return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString; + }, + + isEmptyObject: function( obj ) { + + /* eslint-disable no-unused-vars */ + // See https://github.com/eslint/eslint/issues/6125 + var name; + + for ( name in obj ) { + return false; + } + return true; + }, + + type: function( obj ) { + if ( obj == null ) { + return obj + ""; + } + + // Support: Android <=2.3 only (functionish RegExp) + return typeof obj === "object" || typeof obj === "function" ? + class2type[ toString.call( obj ) ] || "object" : + typeof obj; + }, + + // Evaluates a script in a global context + globalEval: function( code ) { + DOMEval( code ); + }, + + // Convert dashed to camelCase; used by the css and data modules + // Support: IE <=9 - 11, Edge 12 - 13 + // Microsoft forgot to hump their vendor prefix (#9572) + camelCase: function( string ) { + return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); + }, + + nodeName: function( elem, name ) { + return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); + }, + + each: function( obj, callback ) { + var length, i = 0; + + if ( isArrayLike( obj ) ) { + length = obj.length; + for ( ; i < length; i++ ) { + if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { + break; + } + } + } else { + for ( i in obj ) { + if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { + break; + } + } + } + + return obj; + }, + + // Support: Android <=4.0 only + trim: function( text ) { + return text == null ? + "" : + ( text + "" ).replace( rtrim, "" ); + }, + + // results is for internal usage only + makeArray: function( arr, results ) { + var ret = results || []; + + if ( arr != null ) { + if ( isArrayLike( Object( arr ) ) ) { + jQuery.merge( ret, + typeof arr === "string" ? + [ arr ] : arr + ); + } else { + push.call( ret, arr ); + } + } + + return ret; + }, + + inArray: function( elem, arr, i ) { + return arr == null ? -1 : indexOf.call( arr, elem, i ); + }, + + // Support: Android <=4.0 only, PhantomJS 1 only + // push.apply(_, arraylike) throws on ancient WebKit + merge: function( first, second ) { + var len = +second.length, + j = 0, + i = first.length; + + for ( ; j < len; j++ ) { + first[ i++ ] = second[ j ]; + } + + first.length = i; + + return first; + }, + + grep: function( elems, callback, invert ) { + var callbackInverse, + matches = [], + i = 0, + length = elems.length, + callbackExpect = !invert; + + // Go through the array, only saving the items + // that pass the validator function + for ( ; i < length; i++ ) { + callbackInverse = !callback( elems[ i ], i ); + if ( callbackInverse !== callbackExpect ) { + matches.push( elems[ i ] ); + } + } + + return matches; + }, + + // arg is for internal usage only + map: function( elems, callback, arg ) { + var length, value, + i = 0, + ret = []; + + // Go through the array, translating each of the items to their new values + if ( isArrayLike( elems ) ) { + length = elems.length; + for ( ; i < length; i++ ) { + value = callback( elems[ i ], i, arg ); + + if ( value != null ) { + ret.push( value ); + } + } + + // Go through every key on the object, + } else { + for ( i in elems ) { + value = callback( elems[ i ], i, arg ); + + if ( value != null ) { + ret.push( value ); + } + } + } + + // Flatten any nested arrays + return concat.apply( [], ret ); + }, + + // A global GUID counter for objects + guid: 1, + + // Bind a function to a context, optionally partially applying any + // arguments. + proxy: function( fn, context ) { + var tmp, args, proxy; + + if ( typeof context === "string" ) { + tmp = fn[ context ]; + context = fn; + fn = tmp; + } + + // Quick check to determine if target is callable, in the spec + // this throws a TypeError, but we will just return undefined. + if ( !jQuery.isFunction( fn ) ) { + return undefined; + } + + // Simulated bind + args = slice.call( arguments, 2 ); + proxy = function() { + return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); + }; + + // Set the guid of unique handler to the same of original handler, so it can be removed + proxy.guid = fn.guid = fn.guid || jQuery.guid++; + + return proxy; + }, + + now: Date.now, + + // jQuery.support is not used in Core but other projects attach their + // properties to it so it needs to exist. + support: support +} ); + +if ( typeof Symbol === "function" ) { + jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ]; +} + +// Populate the class2type map +jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), +function( i, name ) { + class2type[ "[object " + name + "]" ] = name.toLowerCase(); +} ); + +function isArrayLike( obj ) { + + // Support: real iOS 8.2 only (not reproducible in simulator) + // `in` check used to prevent JIT error (gh-2145) + // hasOwn isn't used here due to false negatives + // regarding Nodelist length in IE + var length = !!obj && "length" in obj && obj.length, + type = jQuery.type( obj ); + + if ( type === "function" || jQuery.isWindow( obj ) ) { + return false; + } + + return type === "array" || length === 0 || + typeof length === "number" && length > 0 && ( length - 1 ) in obj; +} +var Sizzle = +/*! + * Sizzle CSS Selector Engine v2.3.0 + * https://sizzlejs.com/ + * + * Copyright jQuery Foundation and other contributors + * Released under the MIT license + * http://jquery.org/license + * + * Date: 2016-01-04 + */ +(function( window ) { + +var i, + support, + Expr, + getText, + isXML, + tokenize, + compile, + select, + outermostContext, + sortInput, + hasDuplicate, + + // Local document vars + setDocument, + document, + docElem, + documentIsHTML, + rbuggyQSA, + rbuggyMatches, + matches, + contains, + + // Instance-specific data + expando = "sizzle" + 1 * new Date(), + preferredDoc = window.document, + dirruns = 0, + done = 0, + classCache = createCache(), + tokenCache = createCache(), + compilerCache = createCache(), + sortOrder = function( a, b ) { + if ( a === b ) { + hasDuplicate = true; + } + return 0; + }, + + // Instance methods + hasOwn = ({}).hasOwnProperty, + arr = [], + pop = arr.pop, + push_native = arr.push, + push = arr.push, + slice = arr.slice, + // Use a stripped-down indexOf as it's faster than native + // https://jsperf.com/thor-indexof-vs-for/5 + indexOf = function( list, elem ) { + var i = 0, + len = list.length; + for ( ; i < len; i++ ) { + if ( list[i] === elem ) { + return i; + } + } + return -1; + }, + + booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", + + // Regular expressions + + // http://www.w3.org/TR/css3-selectors/#whitespace + whitespace = "[\\x20\\t\\r\\n\\f]", + + // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier + identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+", + + // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors + attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + + // Operator (capture 2) + "*([*^$|!~]?=)" + whitespace + + // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" + "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + + "*\\]", + + pseudos = ":(" + identifier + ")(?:\\((" + + // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: + // 1. quoted (capture 3; capture 4 or capture 5) + "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + + // 2. simple (capture 6) + "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + + // 3. anything else (capture 2) + ".*" + + ")\\)|)", + + // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter + rwhitespace = new RegExp( whitespace + "+", "g" ), + rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), + + rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), + rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), + + rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ), + + rpseudo = new RegExp( pseudos ), + ridentifier = new RegExp( "^" + identifier + "$" ), + + matchExpr = { + "ID": new RegExp( "^#(" + identifier + ")" ), + "CLASS": new RegExp( "^\\.(" + identifier + ")" ), + "TAG": new RegExp( "^(" + identifier + "|[*])" ), + "ATTR": new RegExp( "^" + attributes ), + "PSEUDO": new RegExp( "^" + pseudos ), + "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), + "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), + // For use in libraries implementing .is() + // We use this for POS matching in `select` + "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) + }, + + rinputs = /^(?:input|select|textarea|button)$/i, + rheader = /^h\d$/i, + + rnative = /^[^{]+\{\s*\[native \w/, + + // Easily-parseable/retrievable ID or TAG or CLASS selectors + rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, + + rsibling = /[+~]/, + + // CSS escapes + // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters + runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), + funescape = function( _, escaped, escapedWhitespace ) { + var high = "0x" + escaped - 0x10000; + // NaN means non-codepoint + // Support: Firefox<24 + // Workaround erroneous numeric interpretation of +"0x" + return high !== high || escapedWhitespace ? + escaped : + high < 0 ? + // BMP codepoint + String.fromCharCode( high + 0x10000 ) : + // Supplemental Plane codepoint (surrogate pair) + String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); + }, + + // CSS string/identifier serialization + // https://drafts.csswg.org/cssom/#common-serializing-idioms + rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g, + fcssescape = function( ch, asCodePoint ) { + if ( asCodePoint ) { + + // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER + if ( ch === "\0" ) { + return "\uFFFD"; + } + + // Control characters and (dependent upon position) numbers get escaped as code points + return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; + } + + // Other potentially-special ASCII characters get backslash-escaped + return "\\" + ch; + }, + + // Used for iframes + // See setDocument() + // Removing the function wrapper causes a "Permission Denied" + // error in IE + unloadHandler = function() { + setDocument(); + }, + + disabledAncestor = addCombinator( + function( elem ) { + return elem.disabled === true; + }, + { dir: "parentNode", next: "legend" } + ); + +// Optimize for push.apply( _, NodeList ) +try { + push.apply( + (arr = slice.call( preferredDoc.childNodes )), + preferredDoc.childNodes + ); + // Support: Android<4.0 + // Detect silently failing push.apply + arr[ preferredDoc.childNodes.length ].nodeType; +} catch ( e ) { + push = { apply: arr.length ? + + // Leverage slice if possible + function( target, els ) { + push_native.apply( target, slice.call(els) ); + } : + + // Support: IE<9 + // Otherwise append directly + function( target, els ) { + var j = target.length, + i = 0; + // Can't trust NodeList.length + while ( (target[j++] = els[i++]) ) {} + target.length = j - 1; + } + }; +} + +function Sizzle( selector, context, results, seed ) { + var m, i, elem, nid, match, groups, newSelector, + newContext = context && context.ownerDocument, + + // nodeType defaults to 9, since context defaults to document + nodeType = context ? context.nodeType : 9; + + results = results || []; + + // Return early from calls with invalid selector or context + if ( typeof selector !== "string" || !selector || + nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { + + return results; + } + + // Try to shortcut find operations (as opposed to filters) in HTML documents + if ( !seed ) { + + if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { + setDocument( context ); + } + context = context || document; + + if ( documentIsHTML ) { + + // If the selector is sufficiently simple, try using a "get*By*" DOM method + // (excepting DocumentFragment context, where the methods don't exist) + if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) { + + // ID selector + if ( (m = match[1]) ) { + + // Document context + if ( nodeType === 9 ) { + if ( (elem = context.getElementById( m )) ) { + + // Support: IE, Opera, Webkit + // TODO: identify versions + // getElementById can match elements by name instead of ID + if ( elem.id === m ) { + results.push( elem ); + return results; + } + } else { + return results; + } + + // Element context + } else { + + // Support: IE, Opera, Webkit + // TODO: identify versions + // getElementById can match elements by name instead of ID + if ( newContext && (elem = newContext.getElementById( m )) && + contains( context, elem ) && + elem.id === m ) { + + results.push( elem ); + return results; + } + } + + // Type selector + } else if ( match[2] ) { + push.apply( results, context.getElementsByTagName( selector ) ); + return results; + + // Class selector + } else if ( (m = match[3]) && support.getElementsByClassName && + context.getElementsByClassName ) { + + push.apply( results, context.getElementsByClassName( m ) ); + return results; + } + } + + // Take advantage of querySelectorAll + if ( support.qsa && + !compilerCache[ selector + " " ] && + (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { + + if ( nodeType !== 1 ) { + newContext = context; + newSelector = selector; + + // qSA looks outside Element context, which is not what we want + // Thanks to Andrew Dupont for this workaround technique + // Support: IE <=8 + // Exclude object elements + } else if ( context.nodeName.toLowerCase() !== "object" ) { + + // Capture the context ID, setting it first if necessary + if ( (nid = context.getAttribute( "id" )) ) { + nid = nid.replace( rcssescape, fcssescape ); + } else { + context.setAttribute( "id", (nid = expando) ); + } + + // Prefix every selector in the list + groups = tokenize( selector ); + i = groups.length; + while ( i-- ) { + groups[i] = "#" + nid + " " + toSelector( groups[i] ); + } + newSelector = groups.join( "," ); + + // Expand context for sibling selectors + newContext = rsibling.test( selector ) && testContext( context.parentNode ) || + context; + } + + if ( newSelector ) { + try { + push.apply( results, + newContext.querySelectorAll( newSelector ) + ); + return results; + } catch ( qsaError ) { + } finally { + if ( nid === expando ) { + context.removeAttribute( "id" ); + } + } + } + } + } + } + + // All others + return select( selector.replace( rtrim, "$1" ), context, results, seed ); +} + +/** + * Create key-value caches of limited size + * @returns {function(string, object)} Returns the Object data after storing it on itself with + * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) + * deleting the oldest entry + */ +function createCache() { + var keys = []; + + function cache( key, value ) { + // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) + if ( keys.push( key + " " ) > Expr.cacheLength ) { + // Only keep the most recent entries + delete cache[ keys.shift() ]; + } + return (cache[ key + " " ] = value); + } + return cache; +} + +/** + * Mark a function for special use by Sizzle + * @param {Function} fn The function to mark + */ +function markFunction( fn ) { + fn[ expando ] = true; + return fn; +} + +/** + * Support testing using an element + * @param {Function} fn Passed the created element and returns a boolean result + */ +function assert( fn ) { + var el = document.createElement("fieldset"); + + try { + return !!fn( el ); + } catch (e) { + return false; + } finally { + // Remove from its parent by default + if ( el.parentNode ) { + el.parentNode.removeChild( el ); + } + // release memory in IE + el = null; + } +} + +/** + * Adds the same handler for all of the specified attrs + * @param {String} attrs Pipe-separated list of attributes + * @param {Function} handler The method that will be applied + */ +function addHandle( attrs, handler ) { + var arr = attrs.split("|"), + i = arr.length; + + while ( i-- ) { + Expr.attrHandle[ arr[i] ] = handler; + } +} + +/** + * Checks document order of two siblings + * @param {Element} a + * @param {Element} b + * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b + */ +function siblingCheck( a, b ) { + var cur = b && a, + diff = cur && a.nodeType === 1 && b.nodeType === 1 && + a.sourceIndex - b.sourceIndex; + + // Use IE sourceIndex if available on both nodes + if ( diff ) { + return diff; + } + + // Check if b follows a + if ( cur ) { + while ( (cur = cur.nextSibling) ) { + if ( cur === b ) { + return -1; + } + } + } + + return a ? 1 : -1; +} + +/** + * Returns a function to use in pseudos for input types + * @param {String} type + */ +function createInputPseudo( type ) { + return function( elem ) { + var name = elem.nodeName.toLowerCase(); + return name === "input" && elem.type === type; + }; +} + +/** + * Returns a function to use in pseudos for buttons + * @param {String} type + */ +function createButtonPseudo( type ) { + return function( elem ) { + var name = elem.nodeName.toLowerCase(); + return (name === "input" || name === "button") && elem.type === type; + }; +} + +/** + * Returns a function to use in pseudos for :enabled/:disabled + * @param {Boolean} disabled true for :disabled; false for :enabled + */ +function createDisabledPseudo( disabled ) { + // Known :disabled false positives: + // IE: *[disabled]:not(button, input, select, textarea, optgroup, option, menuitem, fieldset) + // not IE: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable + return function( elem ) { + + // Check form elements and option elements for explicit disabling + return "label" in elem && elem.disabled === disabled || + "form" in elem && elem.disabled === disabled || + + // Check non-disabled form elements for fieldset[disabled] ancestors + "form" in elem && elem.disabled === false && ( + // Support: IE6-11+ + // Ancestry is covered for us + elem.isDisabled === disabled || + + // Otherwise, assume any non-