mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2025-02-18 10:53:43 +01:00
Merge branch 'dev' into eslint
This commit is contained in:
104
CONTRIBUTING.md
Normal file
104
CONTRIBUTING.md
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
# Contributing to Bitburner
|
||||||
|
|
||||||
|
## In General
|
||||||
|
The game is made better because the community as a whole speaks up about
|
||||||
|
ways to improve the game. Here's some of the ways you can make your voice
|
||||||
|
heard:
|
||||||
|
- [Discord](https://discordapp.com)
|
||||||
|
There is a dedicated Discord instance set up for more free-form chats
|
||||||
|
between all members of the community. Regular players, heavy scripters,
|
||||||
|
Bitburner contributors, and everyone in between can be found on the
|
||||||
|
server.
|
||||||
|
- [Github Issues](https://github.com/danielyxie/bitburner/issues)
|
||||||
|
Although the term "issues" can have a negative connotation, they are a
|
||||||
|
means of communicating with the community. A new Issue can be a
|
||||||
|
interesting new feature that you feel would improve the game. It could be
|
||||||
|
an unexpected behavior within the game. Or because the game is about
|
||||||
|
scripting perhaps there is something that is conflicting with the
|
||||||
|
browser's Javascript interaction. So please do not be afraid to open a
|
||||||
|
[new issue](https://github.com/danielyxie/bitburner/issues/new).
|
||||||
|
|
||||||
|
## Reporting Bugs
|
||||||
|
The recommended method for reporting a bug is by opening a
|
||||||
|
[Github Issue](https://github.com/danielyxie/bitburner/issues).
|
||||||
|
|
||||||
|
Before submitting a bug report, please check to make sure the bug has not
|
||||||
|
already been reported as an [Issue](https://github.com/danielyxie/bitburner/issues).
|
||||||
|
|
||||||
|
#### How to Submit a Good Bug Report
|
||||||
|
|
||||||
|
* **Use a clear and descriptive title** for the issue
|
||||||
|
* **State your browser, your browser's version, and your computer's OS**
|
||||||
|
* **Provide instructions on how to reproduce the bug** in as much detail
|
||||||
|
as possible. If you cannot reliably reproduce the bug, then just try
|
||||||
|
your best to explain what was happening when the bug occurred
|
||||||
|
* **Provide any scripts** that triggered the bug if the issue is Netscript-related
|
||||||
|
* **Open your browser's Dev Console and report any error-related output**
|
||||||
|
that may be printed there. The Dev Console can be opened on most modern
|
||||||
|
browsers by pressing F12
|
||||||
|
|
||||||
|
## As a Developer
|
||||||
|
Anyone is welcome to contribute to Bitburner code. However, please read
|
||||||
|
the [license](https://github.com/danielyxie/bitburner/blob/dev/license.txt)
|
||||||
|
and the [readme](https://github.com/danielyxie/bitburner/blob/dev/README.md)
|
||||||
|
before doing so.
|
||||||
|
|
||||||
|
To contribute to Bitburner code, you will need to have
|
||||||
|
[NodeJS](https://nodejs.org) installed. When installing NodeJS, a utility
|
||||||
|
called `npm` is installed as well.
|
||||||
|
|
||||||
|
#### What are you Allowed to Contribute?
|
||||||
|
Not all code contributions will be accepted. The safest way to ensure
|
||||||
|
that you don't waste time working on something that gets rejected is to
|
||||||
|
run your idea(s)/plan(s) past [danielyxie](https://github.com/danielyxie) first.
|
||||||
|
You can contact him through:
|
||||||
|
|
||||||
|
* Github
|
||||||
|
* Discord
|
||||||
|
* [Reddit](https://www.reddit.com/user/chapt3r/)
|
||||||
|
|
||||||
|
Otherwise, here are some general guidelines for determining what types of changes
|
||||||
|
are okay to contribute:
|
||||||
|
|
||||||
|
##### Contributions that Will Most Likely Be Accepted
|
||||||
|
* Bug Fixes
|
||||||
|
* Quality-of-Life Changes
|
||||||
|
* Adding a new, commonly-requested Netscript function
|
||||||
|
* Fixing or improving UI elements
|
||||||
|
* Adding game settings/options
|
||||||
|
* Adding a new Terminal command
|
||||||
|
* Code Refactors that conform to good/standard practices
|
||||||
|
|
||||||
|
##### Contributions that will not be Accepted without prior approval
|
||||||
|
* Changes that directly affect the game's balance
|
||||||
|
* New gameplay mechanics
|
||||||
|
|
||||||
|
#### Submitting a Pull Request
|
||||||
|
When submitting a pull request with your code contributions, please abide by
|
||||||
|
the following rules:
|
||||||
|
|
||||||
|
- Work in a branch forked from `dev` to isolate the new code
|
||||||
|
- Ensure you have latest from the [game's main
|
||||||
|
repository](danielyxie/bitburner@dev)
|
||||||
|
- Rebase your branch if necessary
|
||||||
|
- Run the game locally to test out your changes
|
||||||
|
- When submitting the pull request, make sure that the base fork is
|
||||||
|
_danielyxie/bitburner_ and the base is _dev_.
|
||||||
|
- If your changes affect the game's UI, attach some screenshots or GIFs showing
|
||||||
|
the changes to the UI
|
||||||
|
- If your changes affect Netscript, provide some
|
||||||
|
scripts that can be used to test the Netscript changes.
|
||||||
|
- Do not check in the bundled engine (dist\engine.bundle.js)
|
||||||
|
|
||||||
|
## As a Documentor
|
||||||
|
To contribute to BitBurner documentation, you will need to have Python
|
||||||
|
installed, along with [Sphinx](http://www.sphinx-doc.org).
|
||||||
|
|
||||||
|
Before submitting your code for a pull request, please try to follow these
|
||||||
|
rules:
|
||||||
|
- Work in a branch forked from `dev` to isolate the new code
|
||||||
|
- Ensure you have latest from the [game's main
|
||||||
|
repository](danielyxie/bitburner@dev)
|
||||||
|
- Rebase your branch if necessary
|
||||||
|
- When submitting the pull request, make sure that the base fork is
|
||||||
|
_danielyxie/bitburner_ and the base is _dev_.
|
40
README.md
40
README.md
@ -1,31 +1,35 @@
|
|||||||
# Bitburner
|
# Bitburner
|
||||||
Bitburner is a cyberpunk hacking-themed incremental game. The game can be
|
Bitburner is a cyberpunk hacking-themed incremental game. The game can be
|
||||||
played [here](https://danielyxie.github.io/bitburner).
|
played at https://danielyxie.github.io/bitburner.
|
||||||
|
|
||||||
# Documentation
|
# Documentation
|
||||||
The game's official documentation can be found [here](http://bitburner.readthedocs.io/en/latest/index.html). Please note that
|
The game's official documentation can be found on [Read The
|
||||||
this is still a work-in-progress and is in its early stages.
|
Docs](http://bitburner.readthedocs.io/). Please note that this is still a
|
||||||
|
work-in-progress and is in its early stages.
|
||||||
|
|
||||||
The documentation is created using Sphinx and is hosted on Read The Docs.
|
The documentation is created using [Sphinx](http://www.sphinx-doc.org).
|
||||||
|
|
||||||
Anyone is welcome to contribute to the documentation by editing the source files
|
Anyone is welcome to contribute to the documentation by editing the [source
|
||||||
in /doc/ and then making a pull request with your changes/contributions.
|
files](/doc/source) and then making a pull request with your contributions.
|
||||||
|
For further guidance, please refer to the "As A Documentor" section of
|
||||||
|
[CONTRIBUTING](CONTRIBUTING.md).
|
||||||
|
|
||||||
# Wiki
|
# Wiki
|
||||||
The game's wiki can be found [here](http://bitburner.wikia.com/wiki/Bitburner_Wiki).
|
The game's wiki can be found on [Wikia](http://bitburner.wikia.com/). Please
|
||||||
Please note that the wiki is in the process of being deprecated. Eventually all of the
|
note that the wiki is in the process of being deprecated. Eventually all of
|
||||||
wiki content will be moved into the Read The Docs documentation.
|
the wiki content will be moved into the Read The Docs documentation.
|
||||||
|
|
||||||
# Contributing
|
# Contribution
|
||||||
If you would like to make any small change or addition to the game, you may go ahead
|
There are many ways to contribute to the game. It can be as simple as fixing
|
||||||
and do so by submitting a pull request.
|
a typo, correcting a bug, or improving the UI. For guidance on doing so,
|
||||||
|
please refer to the [CONTRIBUTING](CONTRIBUTING.md) document.
|
||||||
|
|
||||||
You will retain all ownership of the Copyright of any contributions you make,
|
You will retain all ownership of the Copyright of any contributions you make,
|
||||||
and will have the same rights to use or license your contributions. By
|
and will have the same rights to use or license your contributions. By
|
||||||
submitting a pull request you agree to grant me perpetual, worldwide, non-exclusive,
|
submitting a pull request you agree to grant me perpetual, worldwide,
|
||||||
transferable, royalty-free, and irrevocable rights to use, publish, and distribute
|
non-exclusive, transferable, royalty-free, and irrevocable rights to use,
|
||||||
your contributions to the project. A formal Contributor's License Agreement
|
publish, and distribute your contributions to the project. A formal
|
||||||
will be drawn up in the future.
|
Contributor's License Agreement will be drawn up in the future.
|
||||||
|
|
||||||
If you would like to make significant contributions to the project as a
|
If you would like to make significant contributions to the project as a
|
||||||
collaborator, please message me privately.
|
collaborator, please reach out to @danielyxie to help coordinate the effort.
|
49564
dist/engine.bundle.js
vendored
49564
dist/engine.bundle.js
vendored
File diff suppressed because one or more lines are too long
BIN
doc/build/doctrees/changelog.doctree
vendored
BIN
doc/build/doctrees/changelog.doctree
vendored
Binary file not shown.
BIN
doc/build/doctrees/environment.pickle
vendored
BIN
doc/build/doctrees/environment.pickle
vendored
Binary file not shown.
BIN
doc/build/doctrees/netscript.doctree
vendored
BIN
doc/build/doctrees/netscript.doctree
vendored
Binary file not shown.
BIN
doc/build/doctrees/netscriptbladeburnerapi.doctree
vendored
Normal file
BIN
doc/build/doctrees/netscriptbladeburnerapi.doctree
vendored
Normal file
Binary file not shown.
BIN
doc/build/doctrees/netscriptfunctions.doctree
vendored
BIN
doc/build/doctrees/netscriptfunctions.doctree
vendored
Binary file not shown.
30
doc/build/html/_sources/changelog.rst.txt
vendored
30
doc/build/html/_sources/changelog.rst.txt
vendored
@ -3,6 +3,36 @@
|
|||||||
Changelog
|
Changelog
|
||||||
=========
|
=========
|
||||||
|
|
||||||
|
v0.39.0 - 6/25/2018
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
* Added BitNode-7: Bladeburner 2079
|
||||||
|
* Infiltration base difficulty decreased by 10% for most locations
|
||||||
|
* Experience gains from Infiltration slightly increased
|
||||||
|
* Money gained from Infiltration increased by 20%
|
||||||
|
* Added 'var' declarations in Netscript 1.0 (only works with 'var', not 'let' or 'const')
|
||||||
|
* Script base RAM cost is now 1.6 GB (increased from 1.4 GB)
|
||||||
|
* While/for loops and if statements no longer cost RAM in scripts
|
||||||
|
* Made short-circuit evaluation logic more consistent in Netscript 1.0 (see https://github.com/danielyxie/bitburner/issues/308)
|
||||||
|
* Changelog button in the Options menu now links to the new Changelog URL (by Github user thePalindrome)
|
||||||
|
* Skill level calculation is now 'smoother' (by Github user hydroflame)
|
||||||
|
* Added a button to 'beautify' scripts in the text editor (by Github user hydroflame)
|
||||||
|
* Added favicon (by Github user kopelli)
|
||||||
|
|
||||||
|
v0.38.1 - 6/15/2018
|
||||||
|
-------------------
|
||||||
|
* Bug Fix: Using 'Object.prototype' functions like toLocaleString() or toString() should no longer cause errors in NetscriptJS
|
||||||
|
* Implemented by Github user hydroflame:
|
||||||
|
* Accessing the 'window' and 'document' objects in Netscript JS now requires a large amount of RAM (100 GB)
|
||||||
|
* Added game option to suppress travel confirmation
|
||||||
|
* Text on buttons can no longer be highlighted
|
||||||
|
* Bug Fix: Fixed an issue that caused NaN values when exporting Real Estate in Corporations
|
||||||
|
* Bug Fix: Competition and Demand displays in Corporation are now correct (were reversed before)
|
||||||
|
* Added ps() Netscript function
|
||||||
|
* Bug Fix: grow() should no longer return/log a negative value when it runs on a server that's already at max money
|
||||||
|
* Bug Fix: serverExists() Netscript function should now properly return false for non-existent hostname/ips
|
||||||
|
* Bug Fix: Sever's security level should now properly increase when its money is grown to max value
|
||||||
|
|
||||||
v0.38.0 - 6/12/2018
|
v0.38.0 - 6/12/2018
|
||||||
-------------------
|
-------------------
|
||||||
* New BitNode: BN-12 The Recursion - Implemented by Github user hydroflame
|
* New BitNode: BN-12 The Recursion - Implemented by Github user hydroflame
|
||||||
|
1
doc/build/html/_sources/netscript.rst.txt
vendored
1
doc/build/html/_sources/netscript.rst.txt
vendored
@ -24,4 +24,5 @@ to reach out to the developer!
|
|||||||
Hacknet Node API <netscripthacknetnodeapi>
|
Hacknet Node API <netscripthacknetnodeapi>
|
||||||
Trade Information eXchange (TIX) API <netscriptixapi>
|
Trade Information eXchange (TIX) API <netscriptixapi>
|
||||||
Singularity Functions <netscriptsingularityfunctions>
|
Singularity Functions <netscriptsingularityfunctions>
|
||||||
|
Bladeburner API <netscriptbladeburnerapi>
|
||||||
Miscellaneous <netscriptmisc>
|
Miscellaneous <netscriptmisc>
|
||||||
|
446
doc/build/html/_sources/netscriptbladeburnerapi.rst.txt
vendored
Normal file
446
doc/build/html/_sources/netscriptbladeburnerapi.rst.txt
vendored
Normal file
@ -0,0 +1,446 @@
|
|||||||
|
Netscript Bladeburner API
|
||||||
|
=========================
|
||||||
|
|
||||||
|
Netscript provides the following API for interacting with the game's Bladeburner mechanic.
|
||||||
|
|
||||||
|
The Bladeburner API is **not** immediately available to the palyer and must be unlocked
|
||||||
|
later in the game
|
||||||
|
|
||||||
|
**WARNING: This page contains spoilers for the game**
|
||||||
|
|
||||||
|
The Bladeburner API is unlocked in BitNode-7. If you are in BitNode-7, you will
|
||||||
|
automatically gain access to this API. Otherwise, you must have Source-File 7 in
|
||||||
|
order to use this API in other BitNodes
|
||||||
|
|
||||||
|
**Bladeburner API functions must be accessed through the bladeburner namespace**
|
||||||
|
|
||||||
|
In Netscript 1.0::
|
||||||
|
|
||||||
|
bladeburner.getContractNames();
|
||||||
|
bladeburner.startAction("general", "Training");
|
||||||
|
|
||||||
|
In :ref:`netscriptjs`::
|
||||||
|
|
||||||
|
ns.bladeburner.getContractNames();
|
||||||
|
ns.bladeburner.startAction("general", "Training");
|
||||||
|
|
||||||
|
.. _bladeburner_action_types:
|
||||||
|
|
||||||
|
Bladeburner Action Types
|
||||||
|
------------------------
|
||||||
|
|
||||||
|
Several functions in the Bladeburner API require you to specify an action using
|
||||||
|
its type and name. The following are valid values when specifying the action's type:
|
||||||
|
|
||||||
|
**Contracts**
|
||||||
|
* contract
|
||||||
|
* contracts
|
||||||
|
* contr
|
||||||
|
|
||||||
|
**Operations**
|
||||||
|
* operation
|
||||||
|
* operations
|
||||||
|
* op
|
||||||
|
* ops
|
||||||
|
|
||||||
|
**Black Ops**
|
||||||
|
* blackoperation
|
||||||
|
* black operation
|
||||||
|
* black operations
|
||||||
|
* black op
|
||||||
|
* black ops
|
||||||
|
* blackop
|
||||||
|
* blackops
|
||||||
|
|
||||||
|
**General Actions (Training, Field Analysis, Recruitment)**
|
||||||
|
* general
|
||||||
|
* general action
|
||||||
|
* gen
|
||||||
|
|
||||||
|
getContractNames
|
||||||
|
----------------
|
||||||
|
|
||||||
|
.. js:function:: getContractNames()
|
||||||
|
|
||||||
|
Returns an array of strings containing the names of all Bladeburner contracts
|
||||||
|
|
||||||
|
getOperationNames
|
||||||
|
-----------------
|
||||||
|
|
||||||
|
.. js:function:: getOperationNames()
|
||||||
|
|
||||||
|
Returns an array of strings containing the names of all Bladeburner operations
|
||||||
|
|
||||||
|
getBlackOpNames
|
||||||
|
---------------
|
||||||
|
|
||||||
|
.. js:function:: getBlackOpNames()
|
||||||
|
|
||||||
|
Returns an array of strings containing the names of all Bladeburner Black Ops
|
||||||
|
|
||||||
|
getGeneralActionNames
|
||||||
|
---------------------
|
||||||
|
|
||||||
|
.. js:function:: getGeneralActionNames()
|
||||||
|
|
||||||
|
Returns an array of strings containing the names of all general Bladeburner actions
|
||||||
|
|
||||||
|
getSkillNames
|
||||||
|
-------------
|
||||||
|
|
||||||
|
.. js:function:: getSkillNames()
|
||||||
|
|
||||||
|
Returns an array of strings containing the names of all Bladeburner skills
|
||||||
|
|
||||||
|
startAction
|
||||||
|
-----------
|
||||||
|
|
||||||
|
.. js:function:: startAction(type, name)
|
||||||
|
|
||||||
|
:param string type: Type of action. See :ref:`bladeburner_action_types`
|
||||||
|
:param string name: Name of action. Must be an exact match
|
||||||
|
|
||||||
|
Attempts to start the specified Bladeburner action. Returns true if the action
|
||||||
|
was started successfully, and false otherwise.
|
||||||
|
|
||||||
|
stopBladeburnerAction
|
||||||
|
---------------------
|
||||||
|
|
||||||
|
.. js:function:: stopBladeburnerAction()
|
||||||
|
|
||||||
|
Stops the current Bladeburner action
|
||||||
|
|
||||||
|
getActionTime
|
||||||
|
-------------
|
||||||
|
|
||||||
|
.. js:function:: getActionTime(type, name)
|
||||||
|
|
||||||
|
:param string type: Type of action. See :ref:`bladeburner_action_types`
|
||||||
|
:param string name: Name of action. Must be an exact match
|
||||||
|
|
||||||
|
Returns the number of seconds it takes to complete the specified action
|
||||||
|
|
||||||
|
getActionEstimatedSuccessChance
|
||||||
|
-------------------------------
|
||||||
|
|
||||||
|
.. js:function:: getActionEstimatedSuccessChance(type, name)
|
||||||
|
|
||||||
|
:param string type: Type of action. See :ref:`bladeburner_action_types`
|
||||||
|
:param string name: Name of action. Must be an exact match
|
||||||
|
|
||||||
|
Returns the estimated success chance for the specified action
|
||||||
|
|
||||||
|
getActionCountRemaining
|
||||||
|
-----------------------
|
||||||
|
|
||||||
|
.. js:function:: getActionCountRemaining(type, name)
|
||||||
|
|
||||||
|
:param string type: Type of action. See :ref:`bladeburner_action_types`
|
||||||
|
:param string name: Name of action. Must be an exact match
|
||||||
|
|
||||||
|
Returns the remaining count of the specified action.
|
||||||
|
|
||||||
|
Note that this is meant to be used for Contracts and Operations.
|
||||||
|
This function will return 'Infinity' for actions such as Training and Field Analysis.
|
||||||
|
|
||||||
|
getRank
|
||||||
|
-------
|
||||||
|
|
||||||
|
.. js:function:: getRank()
|
||||||
|
|
||||||
|
Returns the player's Bladeburner Rank
|
||||||
|
|
||||||
|
getSkillPoints
|
||||||
|
--------------
|
||||||
|
|
||||||
|
.. js:function:: getSkillPoints()
|
||||||
|
|
||||||
|
Returns the number of Bladeburner skill points you have
|
||||||
|
|
||||||
|
getSkillLevel
|
||||||
|
-------------
|
||||||
|
|
||||||
|
.. js:function:: getSkillLevel(skillName="")
|
||||||
|
|
||||||
|
:param string skillName: Optional name of Skill. Empty string by default
|
||||||
|
|
||||||
|
If no argument or an empty string is passed in, this function returns
|
||||||
|
an object with your level for all Bladeburner Skills (only for skills that
|
||||||
|
have at least one level). In the object, the name of the Bladeburner Skills
|
||||||
|
are the keys and your skill levels are the values. For example::
|
||||||
|
|
||||||
|
{
|
||||||
|
"Blade's Intuition": 10,
|
||||||
|
"Cloak": 5,
|
||||||
|
"Evasive System": 6
|
||||||
|
}
|
||||||
|
|
||||||
|
If the name of a skill is passed in as an argument, then this function
|
||||||
|
returns your level in the specified skill.
|
||||||
|
|
||||||
|
The function returns -1 if an invalid skill name is passed in
|
||||||
|
|
||||||
|
upgradeSkill
|
||||||
|
------------
|
||||||
|
|
||||||
|
.. js:function:: upgradeSkill(skillName)
|
||||||
|
|
||||||
|
:param string skillName: Name of Skill to be upgraded. Must be an exact match
|
||||||
|
|
||||||
|
Attempts to upgrade the specified Bladeburner skill. Returns true if the
|
||||||
|
skill is successfully upgraded, and false otherwise
|
||||||
|
|
||||||
|
getTeamSize
|
||||||
|
-----------
|
||||||
|
|
||||||
|
.. js:function:: getTeamSize(type, name)
|
||||||
|
|
||||||
|
:param string type: Type of action. See :ref:`bladeburner_action_types`
|
||||||
|
:param string name: Name of action. Must be an exact match
|
||||||
|
|
||||||
|
Returns the number of Bladeburner team members you have assigned to the
|
||||||
|
specified action.
|
||||||
|
|
||||||
|
Setting a team is only applicable for Operations and BlackOps. This function
|
||||||
|
will return 0 for other action types.
|
||||||
|
|
||||||
|
setTeamSize
|
||||||
|
-----------
|
||||||
|
|
||||||
|
.. js:function:: setTeamSize(type, name, size)
|
||||||
|
|
||||||
|
:param string type: Type of action. See :ref:`bladeburner_action_types`
|
||||||
|
:param string name: Name of action. Must be an exact match
|
||||||
|
:param int size: Number of team members to set. Will be converted using Math.round()
|
||||||
|
|
||||||
|
Set the team size for the specified Bladeburner action.
|
||||||
|
|
||||||
|
Returns the team size that was set, or -1 if the function failed.
|
||||||
|
|
||||||
|
getCityEstimatedPopulation
|
||||||
|
--------------------------
|
||||||
|
|
||||||
|
.. js:function:: getCityEstimatedPopulation(cityName)
|
||||||
|
|
||||||
|
:param string cityName: Name of city. Case-sensitive
|
||||||
|
|
||||||
|
Returns the estimated number of Synthoids in the specified city, or -1
|
||||||
|
if an invalid city was specified.
|
||||||
|
|
||||||
|
getCityEstimatedCommunities
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
.. js:function:: getCityEstimatedCommunities(cityName)
|
||||||
|
|
||||||
|
:param string cityName: Name of city. Case-sensitive
|
||||||
|
|
||||||
|
Returns the estimated number of Synthoid communities in the specified city,
|
||||||
|
or -1 if an invalid city was specified.
|
||||||
|
|
||||||
|
getCityChaos
|
||||||
|
------------
|
||||||
|
|
||||||
|
.. js:function:: getCityChaos(cityName)
|
||||||
|
|
||||||
|
:param string cityName: Name of city. Case-sensitive
|
||||||
|
|
||||||
|
Returns the chaos in the specified city, or -1 if an invalid city was specified
|
||||||
|
|
||||||
|
switchCity
|
||||||
|
----------
|
||||||
|
|
||||||
|
.. js:function:: switchCity(cityName)
|
||||||
|
|
||||||
|
:param string cityName: Name of city
|
||||||
|
|
||||||
|
Attempts to switch to the specified city (for Bladeburner only).
|
||||||
|
|
||||||
|
Returns true if successful, and false otherwise
|
||||||
|
|
||||||
|
getStamina
|
||||||
|
----------
|
||||||
|
|
||||||
|
.. js:function:: getStamina()
|
||||||
|
|
||||||
|
Returns an array with two elements:
|
||||||
|
|
||||||
|
[Current stamina, Max stamina]
|
||||||
|
|
||||||
|
Example usage::
|
||||||
|
|
||||||
|
function getStaminaPercentage() {
|
||||||
|
let res = bladeburner.getStamina();
|
||||||
|
return res[0] / res[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
joinBladeburnerFaction
|
||||||
|
----------------------
|
||||||
|
|
||||||
|
.. js:function:: joinBladeburnerFaction()
|
||||||
|
|
||||||
|
Attempts to join the Bladeburner faction.
|
||||||
|
|
||||||
|
Returns true if you successfully join the Bladeburner faction, or if
|
||||||
|
you are already a member.
|
||||||
|
|
||||||
|
Returns false otherwise.
|
||||||
|
|
||||||
|
Examples
|
||||||
|
--------
|
||||||
|
|
||||||
|
**Basic example usage**::
|
||||||
|
|
||||||
|
tprint(bladeburner.getContractNames());
|
||||||
|
tprint(bladeburner.getOperationNames());
|
||||||
|
tprint(bladeburner.getBlackOpNames());
|
||||||
|
tprint(bladeburner.getGeneralActionNames());
|
||||||
|
tprint(bladeburner.getSkillNames());
|
||||||
|
tprint(bladeburner.getActionTime("contract", "Tracking"));
|
||||||
|
tprint("Rank: " + bladeburner.getRank());
|
||||||
|
tprint("Skill Points: " + bladeburner.getSkillPoints());
|
||||||
|
tprint("Cloak Skill Level: " + bladeburner.getSkillLevel("Cloak"));
|
||||||
|
tprint("Trying to upgradeSkill: " + bladeburner.upgradeSkill("Cloak"));
|
||||||
|
tprint("Skill Points remaining: " + bladeburner.getSkillPoints());
|
||||||
|
|
||||||
|
tprint("Trying to switch to a nonexistent city: " + bladeburner.switchCity("lskgns"));
|
||||||
|
|
||||||
|
var chongqing = "Chongqing";
|
||||||
|
tprint("Trying to switch to Chongqing: " + bladeburner.switchCity(chongqing));
|
||||||
|
tprint("Chongqing chaos: " + bladeburner.getCityChaos(chongqing));
|
||||||
|
tprint("Chongqing estimated pop: " + bladeburner.getCityEstimatedPopulation(chongqing));
|
||||||
|
tprint("Chonqging estimated communities: " + bladeburner.getCityEstimatedCommunities(chongqing));
|
||||||
|
|
||||||
|
**Bladeburner handler example**. Note that this avoids the need of using the *bladeburner* namespace
|
||||||
|
identifier by attaching the Bladeburner API functions to an object::
|
||||||
|
|
||||||
|
const FIELD_ANALYSIS_INTERVAL = 10; //Number of minutes between field analysis states
|
||||||
|
const FIELD_ANALYSIS_DURATION = 5; //Duration in minutes
|
||||||
|
|
||||||
|
function BladeburnerHandler(ns, params) {
|
||||||
|
//Netscript environment becomes part of the instance
|
||||||
|
this.ns = ns;
|
||||||
|
|
||||||
|
//Netscript bladeburner API becomes part of this instance
|
||||||
|
for (var bladeburnerFn in ns.bladeburner) {
|
||||||
|
this[bladeburnerFn] = ns.bladeburner[bladeburnerFn];
|
||||||
|
}
|
||||||
|
|
||||||
|
this.fieldAnalysis = {
|
||||||
|
inProgress: params.startFieldAnalysis ? true : false,
|
||||||
|
cyclesRemaining: FIELD_ANALYSIS_DURATION,
|
||||||
|
cyclesSince: FIELD_ANALYSIS_INTERVAL
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BladeburnerHandler.prototype.getStaminaPercentage = function() {
|
||||||
|
var res = this.getStamina();
|
||||||
|
return 100 * (res[0] / res[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
BladeburnerHandler.prototype.hasSimulacrum = function() {
|
||||||
|
var augs = this.ns.getOwnedAugmentations();
|
||||||
|
return augs.includes("The Blade's Simulacrum");
|
||||||
|
}
|
||||||
|
|
||||||
|
BladeburnerHandler.prototype.handle = function() {
|
||||||
|
//If we're doing something else manually (without Simlacrum),
|
||||||
|
//it overrides Bladeburner stuff
|
||||||
|
if (!this.hasSimulacrum() && this.ns.isBusy()) {
|
||||||
|
this.ns.print("Idling bc player is busy with some other action");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.fieldAnalysis.inProgress) {
|
||||||
|
--(this.fieldAnalysis.cyclesRemaining);
|
||||||
|
if (this.fieldAnalysis.cyclesRemaining < 0) {
|
||||||
|
this.fieldAnalysis.inProgress = false;
|
||||||
|
this.fieldAnalysis.cyclesSince = 0;
|
||||||
|
return this.handle();
|
||||||
|
} else {
|
||||||
|
this.startAction("general", "Field Analysis");
|
||||||
|
this.ns.print("handler is doing field analyis for " +
|
||||||
|
(this.fieldAnalysis.cyclesRemaining+1) + " more mins");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
++(this.fieldAnalysis.cyclesSince);
|
||||||
|
if (this.fieldAnalysis.cyclesSince > FIELD_ANALYSIS_INTERVAL) {
|
||||||
|
this.fieldAnalysis.inProgress = true;
|
||||||
|
this.fieldAnalysis.cyclesRemaining = FIELD_ANALYSIS_DURATION;
|
||||||
|
return this.handle();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.stopBladeburnerAction();
|
||||||
|
|
||||||
|
var staminaPerc = this.getStaminaPercentage();
|
||||||
|
if (staminaPerc < 55) {
|
||||||
|
this.ns.print("handler is starting training due to low stamina percentage");
|
||||||
|
this.startAction("general", "Training");
|
||||||
|
} else {
|
||||||
|
var action = this.chooseAction();
|
||||||
|
this.ns.print("handler chose " + action.name + " " + action.type + " through chooseAction()");
|
||||||
|
this.startAction(action.type, action.name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BladeburnerHandler.prototype.chooseAction = function() {
|
||||||
|
//Array of all Operations
|
||||||
|
var ops = this.getOperationNames();
|
||||||
|
|
||||||
|
//Sort Operations in order of increasing success chance
|
||||||
|
ops.sort((a, b)=>{
|
||||||
|
return this.getActionEstimatedSuccessChance("operation", a) -
|
||||||
|
this.getActionEstimatedSuccessChance("operation", b);
|
||||||
|
});
|
||||||
|
|
||||||
|
//Loop through until you find one with 99+% success chance
|
||||||
|
for (let i = 0; i < ops.length; ++i) {
|
||||||
|
let successChance = this.getActionEstimatedSuccessChance("operation", ops[i]);
|
||||||
|
let count = this.getActionCountRemaining("operation", ops[i]);
|
||||||
|
if (successChance >= 0.99 && count > 10) {
|
||||||
|
return {type: "operation", name: ops[i]};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Repeat for Contracts
|
||||||
|
var contracts = this.getContractNames();
|
||||||
|
contracts.sort((a, b)=>{
|
||||||
|
return this.getActionEstimatedSuccessChance("contract", a) -
|
||||||
|
this.getActionEstimatedSuccessChance("contract", b);
|
||||||
|
});
|
||||||
|
|
||||||
|
for (let i = 0; i < contracts.length; ++i) {
|
||||||
|
let successChance = this.getActionEstimatedSuccessChance("contract", contracts[i]);
|
||||||
|
let count = this.getActionCountRemaining("contract", contracts[i]);
|
||||||
|
if (successChance >= 0.80 && count > 10) {
|
||||||
|
return {type: "contract", name: contracts[i]};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {type:"general", name:"Training"};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BladeburnerHandler.prototype.process = async function() {
|
||||||
|
this.handle();
|
||||||
|
await this.ns.sleep(60000);
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function main(ns) {
|
||||||
|
ns.disableLog("sleep");
|
||||||
|
//Check if Bladeburner is available. This'll throw a runtime error if it's not
|
||||||
|
ns.bladeburner.getContractNames();
|
||||||
|
|
||||||
|
var startFieldAnalysis = true;
|
||||||
|
if (ns.args.length >= 1 && ns.args[0] == "false") {
|
||||||
|
startFieldAnalysis = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var handler = new BladeburnerHandler(ns, {
|
||||||
|
startFieldAnalysis: startFieldAnalysis
|
||||||
|
});
|
||||||
|
while(true) {
|
||||||
|
await handler.process();
|
||||||
|
}
|
||||||
|
}
|
@ -942,7 +942,11 @@ prompt
|
|||||||
Defining your own Functions
|
Defining your own Functions
|
||||||
---------------------------
|
---------------------------
|
||||||
|
|
||||||
You can define your own functions in Netscript using the following syntax::
|
Note that the following information is only applicable for Netscript 1.0.
|
||||||
|
:doc:`netscriptjs` allows you to define your functions using native Javascript
|
||||||
|
techniques.
|
||||||
|
|
||||||
|
You can define your own functions in Netscript 1.0 using the following syntax::
|
||||||
|
|
||||||
function name(args...) {
|
function name(args...) {
|
||||||
function code here...
|
function code here...
|
||||||
|
41
doc/build/html/changelog.html
vendored
41
doc/build/html/changelog.html
vendored
@ -50,6 +50,45 @@
|
|||||||
|
|
||||||
<div class="section" id="changelog">
|
<div class="section" id="changelog">
|
||||||
<span id="id1"></span><h1>Changelog<a class="headerlink" href="#changelog" title="Permalink to this headline">¶</a></h1>
|
<span id="id1"></span><h1>Changelog<a class="headerlink" href="#changelog" title="Permalink to this headline">¶</a></h1>
|
||||||
|
<div class="section" id="v0-39-0-6-25-2018">
|
||||||
|
<h2>v0.39.0 - 6/25/2018<a class="headerlink" href="#v0-39-0-6-25-2018" title="Permalink to this headline">¶</a></h2>
|
||||||
|
<ul class="simple">
|
||||||
|
<li>Added BitNode-7: Bladeburner 2079</li>
|
||||||
|
<li>Infiltration base difficulty decreased by 10% for most locations</li>
|
||||||
|
<li>Experience gains from Infiltration slightly increased</li>
|
||||||
|
<li>Money gained from Infiltration increased by 20%</li>
|
||||||
|
<li>Added 'var' declarations in Netscript 1.0 (only works with 'var', not 'let' or 'const')</li>
|
||||||
|
<li>Script base RAM cost is now 1.6 GB (increased from 1.4 GB)</li>
|
||||||
|
<li>While/for loops and if statements no longer cost RAM in scripts</li>
|
||||||
|
<li>Made short-circuit evaluation logic more consistent in Netscript 1.0 (see <a class="reference external" href="https://github.com/danielyxie/bitburner/issues/308">https://github.com/danielyxie/bitburner/issues/308</a>)</li>
|
||||||
|
<li>Changelog button in the Options menu now links to the new Changelog URL (by Github user thePalindrome)</li>
|
||||||
|
<li>Skill level calculation is now 'smoother' (by Github user hydroflame)</li>
|
||||||
|
<li>Added a button to 'beautify' scripts in the text editor (by Github user hydroflame)</li>
|
||||||
|
<li>Added favicon (by Github user kopelli)</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="section" id="v0-38-1-6-15-2018">
|
||||||
|
<h2>v0.38.1 - 6/15/2018<a class="headerlink" href="#v0-38-1-6-15-2018" title="Permalink to this headline">¶</a></h2>
|
||||||
|
<ul class="simple">
|
||||||
|
<li>Bug Fix: Using 'Object.prototype' functions like toLocaleString() or toString() should no longer cause errors in NetscriptJS</li>
|
||||||
|
<li><dl class="first docutils">
|
||||||
|
<dt>Implemented by Github user hydroflame:</dt>
|
||||||
|
<dd><ul class="first last">
|
||||||
|
<li>Accessing the 'window' and 'document' objects in Netscript JS now requires a large amount of RAM (100 GB)</li>
|
||||||
|
<li>Added game option to suppress travel confirmation</li>
|
||||||
|
<li>Text on buttons can no longer be highlighted</li>
|
||||||
|
<li>Bug Fix: Fixed an issue that caused NaN values when exporting Real Estate in Corporations</li>
|
||||||
|
<li>Bug Fix: Competition and Demand displays in Corporation are now correct (were reversed before)</li>
|
||||||
|
<li>Added ps() Netscript function</li>
|
||||||
|
<li>Bug Fix: grow() should no longer return/log a negative value when it runs on a server that's already at max money</li>
|
||||||
|
<li>Bug Fix: serverExists() Netscript function should now properly return false for non-existent hostname/ips</li>
|
||||||
|
<li>Bug Fix: Sever's security level should now properly increase when its money is grown to max value</li>
|
||||||
|
</ul>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
<div class="section" id="v0-38-0-6-12-2018">
|
<div class="section" id="v0-38-0-6-12-2018">
|
||||||
<h2>v0.38.0 - 6/12/2018<a class="headerlink" href="#v0-38-0-6-12-2018" title="Permalink to this headline">¶</a></h2>
|
<h2>v0.38.0 - 6/12/2018<a class="headerlink" href="#v0-38-0-6-12-2018" title="Permalink to this headline">¶</a></h2>
|
||||||
<ul class="simple">
|
<ul class="simple">
|
||||||
@ -1006,6 +1045,8 @@ on the difficulty of the contract.</li>
|
|||||||
<li class="toctree-l1"><a class="reference internal" href="terminal.html"> Terminal</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="terminal.html"> Terminal</a></li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="shortcuts.html"> Keyboard Shortcuts</a></li>
|
<li class="toctree-l1"><a class="reference internal" href="shortcuts.html"> Keyboard Shortcuts</a></li>
|
||||||
<li class="toctree-l1 current"><a class="current reference internal" href="#"> Changelog</a><ul>
|
<li class="toctree-l1 current"><a class="current reference internal" href="#"> Changelog</a><ul>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="#v0-39-0-6-25-2018">v0.39.0 - 6/25/2018</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="#v0-38-1-6-15-2018">v0.38.1 - 6/15/2018</a></li>
|
||||||
<li class="toctree-l2"><a class="reference internal" href="#v0-38-0-6-12-2018">v0.38.0 - 6/12/2018</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="#v0-38-0-6-12-2018">v0.38.0 - 6/12/2018</a></li>
|
||||||
<li class="toctree-l2"><a class="reference internal" href="#v0-37-2-6-2-2018">v0.37.2 - 6/2/2018</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="#v0-37-2-6-2-2018">v0.37.2 - 6/2/2018</a></li>
|
||||||
<li class="toctree-l2"><a class="reference internal" href="#v0-37-1-5-22-2018">v0.37.1 - 5/22/2018</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="#v0-37-1-5-22-2018">v0.37.1 - 5/22/2018</a></li>
|
||||||
|
54
doc/build/html/genindex.html
vendored
54
doc/build/html/genindex.html
vendored
@ -153,21 +153,39 @@
|
|||||||
<h2 id="G">G</h2>
|
<h2 id="G">G</h2>
|
||||||
<table style="width: 100%" class="indextable genindextable"><tr>
|
<table style="width: 100%" class="indextable genindextable"><tr>
|
||||||
<td style="width: 33%; vertical-align: top;"><ul>
|
<td style="width: 33%; vertical-align: top;"><ul>
|
||||||
|
<li><a href="netscriptbladeburnerapi.html#getActionCountRemaining">getActionCountRemaining() (built-in function)</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="netscriptbladeburnerapi.html#getActionEstimatedSuccessChance">getActionEstimatedSuccessChance() (built-in function)</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="netscriptbladeburnerapi.html#getActionTime">getActionTime() (built-in function)</a>
|
||||||
|
</li>
|
||||||
<li><a href="netscriptsingularityfunctions.html#getAugmentationCost">getAugmentationCost() (built-in function)</a>
|
<li><a href="netscriptsingularityfunctions.html#getAugmentationCost">getAugmentationCost() (built-in function)</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="netscriptsingularityfunctions.html#getAugmentationsFromFaction">getAugmentationsFromFaction() (built-in function)</a>
|
<li><a href="netscriptsingularityfunctions.html#getAugmentationsFromFaction">getAugmentationsFromFaction() (built-in function)</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="netscriptadvancedfunctions.html#getBitNodeMultipliers">getBitNodeMultipliers() (built-in function)</a>
|
<li><a href="netscriptadvancedfunctions.html#getBitNodeMultipliers">getBitNodeMultipliers() (built-in function)</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="netscriptbladeburnerapi.html#getBlackOpNames">getBlackOpNames() (built-in function)</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="netscriptbladeburnerapi.html#getCityChaos">getCityChaos() (built-in function)</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="netscriptbladeburnerapi.html#getCityEstimatedCommunities">getCityEstimatedCommunities() (built-in function)</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="netscriptbladeburnerapi.html#getCityEstimatedPopulation">getCityEstimatedPopulation() (built-in function)</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="netscriptsingularityfunctions.html#getCompanyFavor">getCompanyFavor() (built-in function)</a>
|
<li><a href="netscriptsingularityfunctions.html#getCompanyFavor">getCompanyFavor() (built-in function)</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="netscriptsingularityfunctions.html#getCompanyRep">getCompanyRep() (built-in function)</a>
|
<li><a href="netscriptsingularityfunctions.html#getCompanyRep">getCompanyRep() (built-in function)</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="netscriptbladeburnerapi.html#getContractNames">getContractNames() (built-in function)</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="netscriptsingularityfunctions.html#getCrimeChance">getCrimeChance() (built-in function)</a>
|
<li><a href="netscriptsingularityfunctions.html#getCrimeChance">getCrimeChance() (built-in function)</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="netscriptsingularityfunctions.html#getFactionFavor">getFactionFavor() (built-in function)</a>
|
<li><a href="netscriptsingularityfunctions.html#getFactionFavor">getFactionFavor() (built-in function)</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="netscriptsingularityfunctions.html#getFactionRep">getFactionRep() (built-in function)</a>
|
<li><a href="netscriptsingularityfunctions.html#getFactionRep">getFactionRep() (built-in function)</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="netscriptbladeburnerapi.html#getGeneralActionNames">getGeneralActionNames() (built-in function)</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="netscriptfunctions.html#getGrowTime">getGrowTime() (built-in function)</a>
|
<li><a href="netscriptfunctions.html#getGrowTime">getGrowTime() (built-in function)</a>
|
||||||
</li>
|
</li>
|
||||||
@ -182,17 +200,21 @@
|
|||||||
<li><a href="netscriptfunctions.html#getHostname">getHostname() (built-in function)</a>
|
<li><a href="netscriptfunctions.html#getHostname">getHostname() (built-in function)</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="netscriptfunctions.html#getNextHacknetNodeCost">getNextHacknetNodeCost() (built-in function)</a>, <a href="netscripthacknetnodeapi.html#getNextHacknetNodeCost">[1]</a>
|
<li><a href="netscriptfunctions.html#getNextHacknetNodeCost">getNextHacknetNodeCost() (built-in function)</a>, <a href="netscripthacknetnodeapi.html#getNextHacknetNodeCost">[1]</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="netscriptbladeburnerapi.html#getOperationNames">getOperationNames() (built-in function)</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="netscriptsingularityfunctions.html#getOwnedAugmentations">getOwnedAugmentations() (built-in function)</a>
|
<li><a href="netscriptsingularityfunctions.html#getOwnedAugmentations">getOwnedAugmentations() (built-in function)</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="netscriptfunctions.html#getPurchasedServers">getPurchasedServers() (built-in function)</a>
|
<li><a href="netscriptfunctions.html#getPurchasedServers">getPurchasedServers() (built-in function)</a>
|
||||||
|
</li>
|
||||||
|
</ul></td>
|
||||||
|
<td style="width: 33%; vertical-align: top;"><ul>
|
||||||
|
<li><a href="netscriptbladeburnerapi.html#getRank">getRank() (built-in function)</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="netscriptfunctions.html#getScriptExpGain">getScriptExpGain() (built-in function)</a>
|
<li><a href="netscriptfunctions.html#getScriptExpGain">getScriptExpGain() (built-in function)</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="netscriptfunctions.html#getScriptIncome">getScriptIncome() (built-in function)</a>
|
<li><a href="netscriptfunctions.html#getScriptIncome">getScriptIncome() (built-in function)</a>
|
||||||
</li>
|
</li>
|
||||||
</ul></td>
|
|
||||||
<td style="width: 33%; vertical-align: top;"><ul>
|
|
||||||
<li><a href="netscriptfunctions.html#getScriptName">getScriptName() (built-in function)</a>
|
<li><a href="netscriptfunctions.html#getScriptName">getScriptName() (built-in function)</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="netscriptfunctions.html#getScriptRam">getScriptRam() (built-in function)</a>
|
<li><a href="netscriptfunctions.html#getScriptRam">getScriptRam() (built-in function)</a>
|
||||||
@ -214,12 +236,22 @@
|
|||||||
<li><a href="netscriptfunctions.html#getServerRequiredHackingLevel">getServerRequiredHackingLevel() (built-in function)</a>
|
<li><a href="netscriptfunctions.html#getServerRequiredHackingLevel">getServerRequiredHackingLevel() (built-in function)</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="netscriptfunctions.html#getServerSecurityLevel">getServerSecurityLevel() (built-in function)</a>
|
<li><a href="netscriptfunctions.html#getServerSecurityLevel">getServerSecurityLevel() (built-in function)</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="netscriptbladeburnerapi.html#getSkillLevel">getSkillLevel() (built-in function)</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="netscriptbladeburnerapi.html#getSkillNames">getSkillNames() (built-in function)</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="netscriptbladeburnerapi.html#getSkillPoints">getSkillPoints() (built-in function)</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="netscriptbladeburnerapi.html#getStamina">getStamina() (built-in function)</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="netscriptsingularityfunctions.html#getStats">getStats() (built-in function)</a>
|
<li><a href="netscriptsingularityfunctions.html#getStats">getStats() (built-in function)</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="netscriptixapi.html#getStockPosition">getStockPosition() (built-in function)</a>
|
<li><a href="netscriptixapi.html#getStockPosition">getStockPosition() (built-in function)</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="netscriptixapi.html#getStockPrice">getStockPrice() (built-in function)</a>
|
<li><a href="netscriptixapi.html#getStockPrice">getStockPrice() (built-in function)</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="netscriptbladeburnerapi.html#getTeamSize">getTeamSize() (built-in function)</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="netscriptfunctions.html#getTimeSinceLastAug">getTimeSinceLastAug() (built-in function)</a>
|
<li><a href="netscriptfunctions.html#getTimeSinceLastAug">getTimeSinceLastAug() (built-in function)</a>
|
||||||
</li>
|
</li>
|
||||||
@ -278,6 +310,10 @@
|
|||||||
|
|
||||||
<h2 id="J">J</h2>
|
<h2 id="J">J</h2>
|
||||||
<table style="width: 100%" class="indextable genindextable"><tr>
|
<table style="width: 100%" class="indextable genindextable"><tr>
|
||||||
|
<td style="width: 33%; vertical-align: top;"><ul>
|
||||||
|
<li><a href="netscriptbladeburnerapi.html#joinBladeburnerFaction">joinBladeburnerFaction() (built-in function)</a>
|
||||||
|
</li>
|
||||||
|
</ul></td>
|
||||||
<td style="width: 33%; vertical-align: top;"><ul>
|
<td style="width: 33%; vertical-align: top;"><ul>
|
||||||
<li><a href="netscriptsingularityfunctions.html#joinFaction">joinFaction() (built-in function)</a>
|
<li><a href="netscriptsingularityfunctions.html#joinFaction">joinFaction() (built-in function)</a>
|
||||||
</li>
|
</li>
|
||||||
@ -375,10 +411,12 @@
|
|||||||
</li>
|
</li>
|
||||||
<li><a href="netscriptixapi.html#sellStock">sellStock() (built-in function)</a>
|
<li><a href="netscriptixapi.html#sellStock">sellStock() (built-in function)</a>
|
||||||
</li>
|
</li>
|
||||||
</ul></td>
|
|
||||||
<td style="width: 33%; vertical-align: top;"><ul>
|
|
||||||
<li><a href="netscriptfunctions.html#serverExists">serverExists() (built-in function)</a>
|
<li><a href="netscriptfunctions.html#serverExists">serverExists() (built-in function)</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li><a href="netscriptbladeburnerapi.html#setTeamSize">setTeamSize() (built-in function)</a>
|
||||||
|
</li>
|
||||||
|
</ul></td>
|
||||||
|
<td style="width: 33%; vertical-align: top;"><ul>
|
||||||
<li><a href="netscriptixapi.html#shortStock">shortStock() (built-in function)</a>
|
<li><a href="netscriptixapi.html#shortStock">shortStock() (built-in function)</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="netscriptfunctions.html#sleep">sleep() (built-in function)</a>
|
<li><a href="netscriptfunctions.html#sleep">sleep() (built-in function)</a>
|
||||||
@ -388,8 +426,14 @@
|
|||||||
<li><a href="netscriptfunctions.html#sprintf">sprintf() (built-in function)</a>
|
<li><a href="netscriptfunctions.html#sprintf">sprintf() (built-in function)</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="netscriptfunctions.html#sqlinject">sqlinject() (built-in function)</a>
|
<li><a href="netscriptfunctions.html#sqlinject">sqlinject() (built-in function)</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="netscriptbladeburnerapi.html#startAction">startAction() (built-in function)</a>
|
||||||
</li>
|
</li>
|
||||||
<li><a href="netscriptsingularityfunctions.html#stopAction">stopAction() (built-in function)</a>
|
<li><a href="netscriptsingularityfunctions.html#stopAction">stopAction() (built-in function)</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="netscriptbladeburnerapi.html#stopBladeburnerAction">stopBladeburnerAction() (built-in function)</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="netscriptbladeburnerapi.html#switchCity">switchCity() (built-in function)</a>
|
||||||
</li>
|
</li>
|
||||||
</ul></td>
|
</ul></td>
|
||||||
</tr></table>
|
</tr></table>
|
||||||
@ -414,6 +458,8 @@
|
|||||||
</ul></td>
|
</ul></td>
|
||||||
<td style="width: 33%; vertical-align: top;"><ul>
|
<td style="width: 33%; vertical-align: top;"><ul>
|
||||||
<li><a href="netscriptsingularityfunctions.html#upgradeHomeRam">upgradeHomeRam() (built-in function)</a>
|
<li><a href="netscriptsingularityfunctions.html#upgradeHomeRam">upgradeHomeRam() (built-in function)</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="netscriptbladeburnerapi.html#upgradeSkill">upgradeSkill() (built-in function)</a>
|
||||||
</li>
|
</li>
|
||||||
</ul></td>
|
</ul></td>
|
||||||
</tr></table>
|
</tr></table>
|
||||||
|
29
doc/build/html/index.html
vendored
29
doc/build/html/index.html
vendored
@ -211,6 +211,33 @@ secrets that you've been searching for.</p>
|
|||||||
<li class="toctree-l3"><a class="reference internal" href="netscriptsingularityfunctions.html#installaugmentations">installAugmentations</a></li>
|
<li class="toctree-l3"><a class="reference internal" href="netscriptsingularityfunctions.html#installaugmentations">installAugmentations</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="netscriptbladeburnerapi.html"> Bladeburner API</a><ul>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="netscriptbladeburnerapi.html#bladeburner-action-types">Bladeburner Action Types</a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="netscriptbladeburnerapi.html#getcontractnames">getContractNames</a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="netscriptbladeburnerapi.html#getoperationnames">getOperationNames</a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="netscriptbladeburnerapi.html#getblackopnames">getBlackOpNames</a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="netscriptbladeburnerapi.html#getgeneralactionnames">getGeneralActionNames</a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="netscriptbladeburnerapi.html#getskillnames">getSkillNames</a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="netscriptbladeburnerapi.html#startaction">startAction</a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="netscriptbladeburnerapi.html#stopbladeburneraction">stopBladeburnerAction</a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="netscriptbladeburnerapi.html#getactiontime">getActionTime</a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="netscriptbladeburnerapi.html#getactionestimatedsuccesschance">getActionEstimatedSuccessChance</a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="netscriptbladeburnerapi.html#getactioncountremaining">getActionCountRemaining</a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="netscriptbladeburnerapi.html#getrank">getRank</a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="netscriptbladeburnerapi.html#getskillpoints">getSkillPoints</a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="netscriptbladeburnerapi.html#getskilllevel">getSkillLevel</a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="netscriptbladeburnerapi.html#upgradeskill">upgradeSkill</a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="netscriptbladeburnerapi.html#getteamsize">getTeamSize</a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="netscriptbladeburnerapi.html#setteamsize">setTeamSize</a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="netscriptbladeburnerapi.html#getcityestimatedpopulation">getCityEstimatedPopulation</a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="netscriptbladeburnerapi.html#getcityestimatedcommunities">getCityEstimatedCommunities</a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="netscriptbladeburnerapi.html#getcitychaos">getCityChaos</a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="netscriptbladeburnerapi.html#switchcity">switchCity</a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="netscriptbladeburnerapi.html#getstamina">getStamina</a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="netscriptbladeburnerapi.html#joinbladeburnerfaction">joinBladeburnerFaction</a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="netscriptbladeburnerapi.html#examples">Examples</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
<li class="toctree-l2"><a class="reference internal" href="netscriptmisc.html"> Miscellaneous</a><ul>
|
<li class="toctree-l2"><a class="reference internal" href="netscriptmisc.html"> Miscellaneous</a><ul>
|
||||||
<li class="toctree-l3"><a class="reference internal" href="netscriptmisc.html#netscript-ports">Netscript Ports</a></li>
|
<li class="toctree-l3"><a class="reference internal" href="netscriptmisc.html#netscript-ports">Netscript Ports</a></li>
|
||||||
<li class="toctree-l3"><a class="reference internal" href="netscriptmisc.html#comments">Comments</a></li>
|
<li class="toctree-l3"><a class="reference internal" href="netscriptmisc.html#comments">Comments</a></li>
|
||||||
@ -269,6 +296,8 @@ secrets that you've been searching for.</p>
|
|||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="changelog.html"> Changelog</a><ul>
|
<li class="toctree-l1"><a class="reference internal" href="changelog.html"> Changelog</a><ul>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="changelog.html#v0-39-0-6-25-2018">v0.39.0 - 6/25/2018</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="changelog.html#v0-38-1-6-15-2018">v0.38.1 - 6/15/2018</a></li>
|
||||||
<li class="toctree-l2"><a class="reference internal" href="changelog.html#v0-38-0-6-12-2018">v0.38.0 - 6/12/2018</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="changelog.html#v0-38-0-6-12-2018">v0.38.0 - 6/12/2018</a></li>
|
||||||
<li class="toctree-l2"><a class="reference internal" href="changelog.html#v0-37-2-6-2-2018">v0.37.2 - 6/2/2018</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="changelog.html#v0-37-2-6-2-2018">v0.37.2 - 6/2/2018</a></li>
|
||||||
<li class="toctree-l2"><a class="reference internal" href="changelog.html#v0-37-1-5-22-2018">v0.37.1 - 5/22/2018</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="changelog.html#v0-37-1-5-22-2018">v0.37.1 - 5/22/2018</a></li>
|
||||||
|
28
doc/build/html/netscript.html
vendored
28
doc/build/html/netscript.html
vendored
@ -212,6 +212,33 @@ to reach out to the developer!</p>
|
|||||||
<li class="toctree-l2"><a class="reference internal" href="netscriptsingularityfunctions.html#installaugmentations">installAugmentations</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="netscriptsingularityfunctions.html#installaugmentations">installAugmentations</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="netscriptbladeburnerapi.html"> Bladeburner API</a><ul>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="netscriptbladeburnerapi.html#bladeburner-action-types">Bladeburner Action Types</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="netscriptbladeburnerapi.html#getcontractnames">getContractNames</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="netscriptbladeburnerapi.html#getoperationnames">getOperationNames</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="netscriptbladeburnerapi.html#getblackopnames">getBlackOpNames</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="netscriptbladeburnerapi.html#getgeneralactionnames">getGeneralActionNames</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="netscriptbladeburnerapi.html#getskillnames">getSkillNames</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="netscriptbladeburnerapi.html#startaction">startAction</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="netscriptbladeburnerapi.html#stopbladeburneraction">stopBladeburnerAction</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="netscriptbladeburnerapi.html#getactiontime">getActionTime</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="netscriptbladeburnerapi.html#getactionestimatedsuccesschance">getActionEstimatedSuccessChance</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="netscriptbladeburnerapi.html#getactioncountremaining">getActionCountRemaining</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="netscriptbladeburnerapi.html#getrank">getRank</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="netscriptbladeburnerapi.html#getskillpoints">getSkillPoints</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="netscriptbladeburnerapi.html#getskilllevel">getSkillLevel</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="netscriptbladeburnerapi.html#upgradeskill">upgradeSkill</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="netscriptbladeburnerapi.html#getteamsize">getTeamSize</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="netscriptbladeburnerapi.html#setteamsize">setTeamSize</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="netscriptbladeburnerapi.html#getcityestimatedpopulation">getCityEstimatedPopulation</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="netscriptbladeburnerapi.html#getcityestimatedcommunities">getCityEstimatedCommunities</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="netscriptbladeburnerapi.html#getcitychaos">getCityChaos</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="netscriptbladeburnerapi.html#switchcity">switchCity</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="netscriptbladeburnerapi.html#getstamina">getStamina</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="netscriptbladeburnerapi.html#joinbladeburnerfaction">joinBladeburnerFaction</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="netscriptbladeburnerapi.html#examples">Examples</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
<li class="toctree-l1"><a class="reference internal" href="netscriptmisc.html"> Miscellaneous</a><ul>
|
<li class="toctree-l1"><a class="reference internal" href="netscriptmisc.html"> Miscellaneous</a><ul>
|
||||||
<li class="toctree-l2"><a class="reference internal" href="netscriptmisc.html#netscript-ports">Netscript Ports</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="netscriptmisc.html#netscript-ports">Netscript Ports</a></li>
|
||||||
<li class="toctree-l2"><a class="reference internal" href="netscriptmisc.html#comments">Comments</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="netscriptmisc.html#comments">Comments</a></li>
|
||||||
@ -245,6 +272,7 @@ to reach out to the developer!</p>
|
|||||||
<li class="toctree-l2"><a class="reference internal" href="netscripthacknetnodeapi.html"> Hacknet Node API</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="netscripthacknetnodeapi.html"> Hacknet Node API</a></li>
|
||||||
<li class="toctree-l2"><a class="reference internal" href="netscriptixapi.html"> Trade Information eXchange (TIX) API</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="netscriptixapi.html"> Trade Information eXchange (TIX) API</a></li>
|
||||||
<li class="toctree-l2"><a class="reference internal" href="netscriptsingularityfunctions.html"> Singularity Functions</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="netscriptsingularityfunctions.html"> Singularity Functions</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="netscriptbladeburnerapi.html"> Bladeburner API</a></li>
|
||||||
<li class="toctree-l2"><a class="reference internal" href="netscriptmisc.html"> Miscellaneous</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="netscriptmisc.html"> Miscellaneous</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
748
doc/build/html/netscriptbladeburnerapi.html
vendored
Normal file
748
doc/build/html/netscriptbladeburnerapi.html
vendored
Normal file
@ -0,0 +1,748 @@
|
|||||||
|
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||||
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" lang="English">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<title>Netscript Bladeburner API — Bitburner 1.0 documentation</title>
|
||||||
|
<link rel="stylesheet" href="_static/agogo.css" type="text/css" />
|
||||||
|
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
||||||
|
<script type="text/javascript">
|
||||||
|
var DOCUMENTATION_OPTIONS = {
|
||||||
|
URL_ROOT: './',
|
||||||
|
VERSION: '1.0',
|
||||||
|
COLLAPSE_INDEX: false,
|
||||||
|
FILE_SUFFIX: '.html',
|
||||||
|
HAS_SOURCE: true,
|
||||||
|
SOURCELINK_SUFFIX: '.txt'
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<script type="text/javascript" src="_static/jquery.js"></script>
|
||||||
|
<script type="text/javascript" src="_static/underscore.js"></script>
|
||||||
|
<script type="text/javascript" src="_static/doctools.js"></script>
|
||||||
|
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
|
||||||
|
<link rel="index" title="Index" href="genindex.html" />
|
||||||
|
<link rel="search" title="Search" href="search.html" />
|
||||||
|
<link rel="next" title="Netscript Miscellaneous" href="netscriptmisc.html" />
|
||||||
|
<link rel="prev" title="Netscript Singularity Functions" href="netscriptsingularityfunctions.html" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="header-wrapper" role="banner">
|
||||||
|
<div class="header">
|
||||||
|
<div class="headertitle"><a
|
||||||
|
href="index.html">Bitburner 1.0 documentation</a></div>
|
||||||
|
<div class="rel" role="navigation" aria-label="related navigation">
|
||||||
|
<a href="netscriptsingularityfunctions.html" title="Netscript Singularity Functions"
|
||||||
|
accesskey="P">previous</a> |
|
||||||
|
<a href="netscriptmisc.html" title="Netscript Miscellaneous"
|
||||||
|
accesskey="N">next</a> |
|
||||||
|
<a href="genindex.html" title="General Index"
|
||||||
|
accesskey="I">index</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="content-wrapper">
|
||||||
|
<div class="content">
|
||||||
|
<div class="document">
|
||||||
|
|
||||||
|
<div class="documentwrapper">
|
||||||
|
<div class="bodywrapper">
|
||||||
|
<div class="body" role="main">
|
||||||
|
|
||||||
|
<div class="section" id="netscript-bladeburner-api">
|
||||||
|
<h1>Netscript Bladeburner API<a class="headerlink" href="#netscript-bladeburner-api" title="Permalink to this headline">¶</a></h1>
|
||||||
|
<p>Netscript provides the following API for interacting with the game's Bladeburner mechanic.</p>
|
||||||
|
<p>The Bladeburner API is <strong>not</strong> immediately available to the palyer and must be unlocked
|
||||||
|
later in the game</p>
|
||||||
|
<p><strong>WARNING: This page contains spoilers for the game</strong></p>
|
||||||
|
<p>The Bladeburner API is unlocked in BitNode-7. If you are in BitNode-7, you will
|
||||||
|
automatically gain access to this API. Otherwise, you must have Source-File 7 in
|
||||||
|
order to use this API in other BitNodes</p>
|
||||||
|
<p><strong>Bladeburner API functions must be accessed through the bladeburner namespace</strong></p>
|
||||||
|
<p>In Netscript 1.0:</p>
|
||||||
|
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">bladeburner</span><span class="o">.</span><span class="n">getContractNames</span><span class="p">();</span>
|
||||||
|
<span class="n">bladeburner</span><span class="o">.</span><span class="n">startAction</span><span class="p">(</span><span class="s2">"general"</span><span class="p">,</span> <span class="s2">"Training"</span><span class="p">);</span>
|
||||||
|
</pre></div>
|
||||||
|
</div>
|
||||||
|
<p>In <a class="reference internal" href="netscriptjs.html#netscriptjs"><span class="std std-ref">NetscriptJS (Netscript 2.0)</span></a>:</p>
|
||||||
|
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">ns</span><span class="o">.</span><span class="n">bladeburner</span><span class="o">.</span><span class="n">getContractNames</span><span class="p">();</span>
|
||||||
|
<span class="n">ns</span><span class="o">.</span><span class="n">bladeburner</span><span class="o">.</span><span class="n">startAction</span><span class="p">(</span><span class="s2">"general"</span><span class="p">,</span> <span class="s2">"Training"</span><span class="p">);</span>
|
||||||
|
</pre></div>
|
||||||
|
</div>
|
||||||
|
<div class="section" id="bladeburner-action-types">
|
||||||
|
<span id="id1"></span><h2>Bladeburner Action Types<a class="headerlink" href="#bladeburner-action-types" title="Permalink to this headline">¶</a></h2>
|
||||||
|
<p>Several functions in the Bladeburner API require you to specify an action using
|
||||||
|
its type and name. The following are valid values when specifying the action's type:</p>
|
||||||
|
<dl class="docutils">
|
||||||
|
<dt><strong>Contracts</strong></dt>
|
||||||
|
<dd><ul class="first last simple">
|
||||||
|
<li>contract</li>
|
||||||
|
<li>contracts</li>
|
||||||
|
<li>contr</li>
|
||||||
|
</ul>
|
||||||
|
</dd>
|
||||||
|
<dt><strong>Operations</strong></dt>
|
||||||
|
<dd><ul class="first last simple">
|
||||||
|
<li>operation</li>
|
||||||
|
<li>operations</li>
|
||||||
|
<li>op</li>
|
||||||
|
<li>ops</li>
|
||||||
|
</ul>
|
||||||
|
</dd>
|
||||||
|
<dt><strong>Black Ops</strong></dt>
|
||||||
|
<dd><ul class="first last simple">
|
||||||
|
<li>blackoperation</li>
|
||||||
|
<li>black operation</li>
|
||||||
|
<li>black operations</li>
|
||||||
|
<li>black op</li>
|
||||||
|
<li>black ops</li>
|
||||||
|
<li>blackop</li>
|
||||||
|
<li>blackops</li>
|
||||||
|
</ul>
|
||||||
|
</dd>
|
||||||
|
<dt><strong>General Actions (Training, Field Analysis, Recruitment)</strong></dt>
|
||||||
|
<dd><ul class="first last simple">
|
||||||
|
<li>general</li>
|
||||||
|
<li>general action</li>
|
||||||
|
<li>gen</li>
|
||||||
|
</ul>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
</div>
|
||||||
|
<div class="section" id="getcontractnames">
|
||||||
|
<h2>getContractNames<a class="headerlink" href="#getcontractnames" title="Permalink to this headline">¶</a></h2>
|
||||||
|
<dl class="function">
|
||||||
|
<dt id="getContractNames">
|
||||||
|
<code class="descname">getContractNames</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#getContractNames" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><p>Returns an array of strings containing the names of all Bladeburner contracts</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="section" id="getoperationnames">
|
||||||
|
<h2>getOperationNames<a class="headerlink" href="#getoperationnames" title="Permalink to this headline">¶</a></h2>
|
||||||
|
<dl class="function">
|
||||||
|
<dt id="getOperationNames">
|
||||||
|
<code class="descname">getOperationNames</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#getOperationNames" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><p>Returns an array of strings containing the names of all Bladeburner operations</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="section" id="getblackopnames">
|
||||||
|
<h2>getBlackOpNames<a class="headerlink" href="#getblackopnames" title="Permalink to this headline">¶</a></h2>
|
||||||
|
<dl class="function">
|
||||||
|
<dt id="getBlackOpNames">
|
||||||
|
<code class="descname">getBlackOpNames</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#getBlackOpNames" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><p>Returns an array of strings containing the names of all Bladeburner Black Ops</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="section" id="getgeneralactionnames">
|
||||||
|
<h2>getGeneralActionNames<a class="headerlink" href="#getgeneralactionnames" title="Permalink to this headline">¶</a></h2>
|
||||||
|
<dl class="function">
|
||||||
|
<dt id="getGeneralActionNames">
|
||||||
|
<code class="descname">getGeneralActionNames</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#getGeneralActionNames" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><p>Returns an array of strings containing the names of all general Bladeburner actions</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="section" id="getskillnames">
|
||||||
|
<h2>getSkillNames<a class="headerlink" href="#getskillnames" title="Permalink to this headline">¶</a></h2>
|
||||||
|
<dl class="function">
|
||||||
|
<dt id="getSkillNames">
|
||||||
|
<code class="descname">getSkillNames</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#getSkillNames" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><p>Returns an array of strings containing the names of all Bladeburner skills</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="section" id="startaction">
|
||||||
|
<h2>startAction<a class="headerlink" href="#startaction" title="Permalink to this headline">¶</a></h2>
|
||||||
|
<dl class="function">
|
||||||
|
<dt id="startAction">
|
||||||
|
<code class="descname">startAction</code><span class="sig-paren">(</span><em>type</em>, <em>name</em><span class="sig-paren">)</span><a class="headerlink" href="#startAction" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><table class="docutils field-list" frame="void" rules="none">
|
||||||
|
<col class="field-name" />
|
||||||
|
<col class="field-body" />
|
||||||
|
<tbody valign="top">
|
||||||
|
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
|
||||||
|
<li><strong>type</strong> (<em>string</em>) -- Type of action. See <a class="reference internal" href="#bladeburner-action-types"><span class="std std-ref">Bladeburner Action Types</span></a></li>
|
||||||
|
<li><strong>name</strong> (<em>string</em>) -- Name of action. Must be an exact match</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<p>Attempts to start the specified Bladeburner action. Returns true if the action
|
||||||
|
was started successfully, and false otherwise.</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="section" id="stopbladeburneraction">
|
||||||
|
<h2>stopBladeburnerAction<a class="headerlink" href="#stopbladeburneraction" title="Permalink to this headline">¶</a></h2>
|
||||||
|
<dl class="function">
|
||||||
|
<dt id="stopBladeburnerAction">
|
||||||
|
<code class="descname">stopBladeburnerAction</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#stopBladeburnerAction" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><p>Stops the current Bladeburner action</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="section" id="getactiontime">
|
||||||
|
<h2>getActionTime<a class="headerlink" href="#getactiontime" title="Permalink to this headline">¶</a></h2>
|
||||||
|
<dl class="function">
|
||||||
|
<dt id="getActionTime">
|
||||||
|
<code class="descname">getActionTime</code><span class="sig-paren">(</span><em>type</em>, <em>name</em><span class="sig-paren">)</span><a class="headerlink" href="#getActionTime" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><table class="docutils field-list" frame="void" rules="none">
|
||||||
|
<col class="field-name" />
|
||||||
|
<col class="field-body" />
|
||||||
|
<tbody valign="top">
|
||||||
|
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
|
||||||
|
<li><strong>type</strong> (<em>string</em>) -- Type of action. See <a class="reference internal" href="#bladeburner-action-types"><span class="std std-ref">Bladeburner Action Types</span></a></li>
|
||||||
|
<li><strong>name</strong> (<em>string</em>) -- Name of action. Must be an exact match</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<p>Returns the number of seconds it takes to complete the specified action</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="section" id="getactionestimatedsuccesschance">
|
||||||
|
<h2>getActionEstimatedSuccessChance<a class="headerlink" href="#getactionestimatedsuccesschance" title="Permalink to this headline">¶</a></h2>
|
||||||
|
<dl class="function">
|
||||||
|
<dt id="getActionEstimatedSuccessChance">
|
||||||
|
<code class="descname">getActionEstimatedSuccessChance</code><span class="sig-paren">(</span><em>type</em>, <em>name</em><span class="sig-paren">)</span><a class="headerlink" href="#getActionEstimatedSuccessChance" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><table class="docutils field-list" frame="void" rules="none">
|
||||||
|
<col class="field-name" />
|
||||||
|
<col class="field-body" />
|
||||||
|
<tbody valign="top">
|
||||||
|
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
|
||||||
|
<li><strong>type</strong> (<em>string</em>) -- Type of action. See <a class="reference internal" href="#bladeburner-action-types"><span class="std std-ref">Bladeburner Action Types</span></a></li>
|
||||||
|
<li><strong>name</strong> (<em>string</em>) -- Name of action. Must be an exact match</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<p>Returns the estimated success chance for the specified action</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="section" id="getactioncountremaining">
|
||||||
|
<h2>getActionCountRemaining<a class="headerlink" href="#getactioncountremaining" title="Permalink to this headline">¶</a></h2>
|
||||||
|
<dl class="function">
|
||||||
|
<dt id="getActionCountRemaining">
|
||||||
|
<code class="descname">getActionCountRemaining</code><span class="sig-paren">(</span><em>type</em>, <em>name</em><span class="sig-paren">)</span><a class="headerlink" href="#getActionCountRemaining" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><table class="docutils field-list" frame="void" rules="none">
|
||||||
|
<col class="field-name" />
|
||||||
|
<col class="field-body" />
|
||||||
|
<tbody valign="top">
|
||||||
|
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
|
||||||
|
<li><strong>type</strong> (<em>string</em>) -- Type of action. See <a class="reference internal" href="#bladeburner-action-types"><span class="std std-ref">Bladeburner Action Types</span></a></li>
|
||||||
|
<li><strong>name</strong> (<em>string</em>) -- Name of action. Must be an exact match</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<p>Returns the remaining count of the specified action.</p>
|
||||||
|
<p>Note that this is meant to be used for Contracts and Operations.
|
||||||
|
This function will return 'Infinity' for actions such as Training and Field Analysis.</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="section" id="getrank">
|
||||||
|
<h2>getRank<a class="headerlink" href="#getrank" title="Permalink to this headline">¶</a></h2>
|
||||||
|
<dl class="function">
|
||||||
|
<dt id="getRank">
|
||||||
|
<code class="descname">getRank</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#getRank" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><p>Returns the player's Bladeburner Rank</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="section" id="getskillpoints">
|
||||||
|
<h2>getSkillPoints<a class="headerlink" href="#getskillpoints" title="Permalink to this headline">¶</a></h2>
|
||||||
|
<dl class="function">
|
||||||
|
<dt id="getSkillPoints">
|
||||||
|
<code class="descname">getSkillPoints</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#getSkillPoints" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><p>Returns the number of Bladeburner skill points you have</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="section" id="getskilllevel">
|
||||||
|
<h2>getSkillLevel<a class="headerlink" href="#getskilllevel" title="Permalink to this headline">¶</a></h2>
|
||||||
|
<dl class="function">
|
||||||
|
<dt id="getSkillLevel">
|
||||||
|
<code class="descname">getSkillLevel</code><span class="sig-paren">(</span><em>skillName=""</em><span class="sig-paren">)</span><a class="headerlink" href="#getSkillLevel" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><table class="docutils field-list" frame="void" rules="none">
|
||||||
|
<col class="field-name" />
|
||||||
|
<col class="field-body" />
|
||||||
|
<tbody valign="top">
|
||||||
|
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
|
||||||
|
<li><strong>skillName</strong> (<em>string</em>) -- Optional name of Skill. Empty string by default</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<p>If no argument or an empty string is passed in, this function returns
|
||||||
|
an object with your level for all Bladeburner Skills (only for skills that
|
||||||
|
have at least one level). In the object, the name of the Bladeburner Skills
|
||||||
|
are the keys and your skill levels are the values. For example:</p>
|
||||||
|
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="p">{</span>
|
||||||
|
<span class="s2">"Blade's Intuition"</span><span class="p">:</span> <span class="mi">10</span><span class="p">,</span>
|
||||||
|
<span class="s2">"Cloak"</span><span class="p">:</span> <span class="mi">5</span><span class="p">,</span>
|
||||||
|
<span class="s2">"Evasive System"</span><span class="p">:</span> <span class="mi">6</span>
|
||||||
|
<span class="p">}</span>
|
||||||
|
</pre></div>
|
||||||
|
</div>
|
||||||
|
<p>If the name of a skill is passed in as an argument, then this function
|
||||||
|
returns your level in the specified skill.</p>
|
||||||
|
<p>The function returns -1 if an invalid skill name is passed in</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="section" id="upgradeskill">
|
||||||
|
<h2>upgradeSkill<a class="headerlink" href="#upgradeskill" title="Permalink to this headline">¶</a></h2>
|
||||||
|
<dl class="function">
|
||||||
|
<dt id="upgradeSkill">
|
||||||
|
<code class="descname">upgradeSkill</code><span class="sig-paren">(</span><em>skillName</em><span class="sig-paren">)</span><a class="headerlink" href="#upgradeSkill" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><table class="docutils field-list" frame="void" rules="none">
|
||||||
|
<col class="field-name" />
|
||||||
|
<col class="field-body" />
|
||||||
|
<tbody valign="top">
|
||||||
|
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
|
||||||
|
<li><strong>skillName</strong> (<em>string</em>) -- Name of Skill to be upgraded. Must be an exact match</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<p>Attempts to upgrade the specified Bladeburner skill. Returns true if the
|
||||||
|
skill is successfully upgraded, and false otherwise</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="section" id="getteamsize">
|
||||||
|
<h2>getTeamSize<a class="headerlink" href="#getteamsize" title="Permalink to this headline">¶</a></h2>
|
||||||
|
<dl class="function">
|
||||||
|
<dt id="getTeamSize">
|
||||||
|
<code class="descname">getTeamSize</code><span class="sig-paren">(</span><em>type</em>, <em>name</em><span class="sig-paren">)</span><a class="headerlink" href="#getTeamSize" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><table class="docutils field-list" frame="void" rules="none">
|
||||||
|
<col class="field-name" />
|
||||||
|
<col class="field-body" />
|
||||||
|
<tbody valign="top">
|
||||||
|
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
|
||||||
|
<li><strong>type</strong> (<em>string</em>) -- Type of action. See <a class="reference internal" href="#bladeburner-action-types"><span class="std std-ref">Bladeburner Action Types</span></a></li>
|
||||||
|
<li><strong>name</strong> (<em>string</em>) -- Name of action. Must be an exact match</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<p>Returns the number of Bladeburner team members you have assigned to the
|
||||||
|
specified action.</p>
|
||||||
|
<p>Setting a team is only applicable for Operations and BlackOps. This function
|
||||||
|
will return 0 for other action types.</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="section" id="setteamsize">
|
||||||
|
<h2>setTeamSize<a class="headerlink" href="#setteamsize" title="Permalink to this headline">¶</a></h2>
|
||||||
|
<dl class="function">
|
||||||
|
<dt id="setTeamSize">
|
||||||
|
<code class="descname">setTeamSize</code><span class="sig-paren">(</span><em>type</em>, <em>name</em>, <em>size</em><span class="sig-paren">)</span><a class="headerlink" href="#setTeamSize" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><table class="docutils field-list" frame="void" rules="none">
|
||||||
|
<col class="field-name" />
|
||||||
|
<col class="field-body" />
|
||||||
|
<tbody valign="top">
|
||||||
|
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
|
||||||
|
<li><strong>type</strong> (<em>string</em>) -- Type of action. See <a class="reference internal" href="#bladeburner-action-types"><span class="std std-ref">Bladeburner Action Types</span></a></li>
|
||||||
|
<li><strong>name</strong> (<em>string</em>) -- Name of action. Must be an exact match</li>
|
||||||
|
<li><strong>size</strong> (<em>int</em>) -- Number of team members to set. Will be converted using Math.round()</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<p>Set the team size for the specified Bladeburner action.</p>
|
||||||
|
<p>Returns the team size that was set, or -1 if the function failed.</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="section" id="getcityestimatedpopulation">
|
||||||
|
<h2>getCityEstimatedPopulation<a class="headerlink" href="#getcityestimatedpopulation" title="Permalink to this headline">¶</a></h2>
|
||||||
|
<dl class="function">
|
||||||
|
<dt id="getCityEstimatedPopulation">
|
||||||
|
<code class="descname">getCityEstimatedPopulation</code><span class="sig-paren">(</span><em>cityName</em><span class="sig-paren">)</span><a class="headerlink" href="#getCityEstimatedPopulation" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><table class="docutils field-list" frame="void" rules="none">
|
||||||
|
<col class="field-name" />
|
||||||
|
<col class="field-body" />
|
||||||
|
<tbody valign="top">
|
||||||
|
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
|
||||||
|
<li><strong>cityName</strong> (<em>string</em>) -- Name of city. Case-sensitive</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<p>Returns the estimated number of Synthoids in the specified city, or -1
|
||||||
|
if an invalid city was specified.</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="section" id="getcityestimatedcommunities">
|
||||||
|
<h2>getCityEstimatedCommunities<a class="headerlink" href="#getcityestimatedcommunities" title="Permalink to this headline">¶</a></h2>
|
||||||
|
<dl class="function">
|
||||||
|
<dt id="getCityEstimatedCommunities">
|
||||||
|
<code class="descname">getCityEstimatedCommunities</code><span class="sig-paren">(</span><em>cityName</em><span class="sig-paren">)</span><a class="headerlink" href="#getCityEstimatedCommunities" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><table class="docutils field-list" frame="void" rules="none">
|
||||||
|
<col class="field-name" />
|
||||||
|
<col class="field-body" />
|
||||||
|
<tbody valign="top">
|
||||||
|
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
|
||||||
|
<li><strong>cityName</strong> (<em>string</em>) -- Name of city. Case-sensitive</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<p>Returns the estimated number of Synthoid communities in the specified city,
|
||||||
|
or -1 if an invalid city was specified.</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="section" id="getcitychaos">
|
||||||
|
<h2>getCityChaos<a class="headerlink" href="#getcitychaos" title="Permalink to this headline">¶</a></h2>
|
||||||
|
<dl class="function">
|
||||||
|
<dt id="getCityChaos">
|
||||||
|
<code class="descname">getCityChaos</code><span class="sig-paren">(</span><em>cityName</em><span class="sig-paren">)</span><a class="headerlink" href="#getCityChaos" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><table class="docutils field-list" frame="void" rules="none">
|
||||||
|
<col class="field-name" />
|
||||||
|
<col class="field-body" />
|
||||||
|
<tbody valign="top">
|
||||||
|
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
|
||||||
|
<li><strong>cityName</strong> (<em>string</em>) -- Name of city. Case-sensitive</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<p>Returns the chaos in the specified city, or -1 if an invalid city was specified</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="section" id="switchcity">
|
||||||
|
<h2>switchCity<a class="headerlink" href="#switchcity" title="Permalink to this headline">¶</a></h2>
|
||||||
|
<dl class="function">
|
||||||
|
<dt id="switchCity">
|
||||||
|
<code class="descname">switchCity</code><span class="sig-paren">(</span><em>cityName</em><span class="sig-paren">)</span><a class="headerlink" href="#switchCity" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><table class="docutils field-list" frame="void" rules="none">
|
||||||
|
<col class="field-name" />
|
||||||
|
<col class="field-body" />
|
||||||
|
<tbody valign="top">
|
||||||
|
<tr class="field-odd field"><th class="field-name">Arguments:</th><td class="field-body"><ul class="first last simple">
|
||||||
|
<li><strong>cityName</strong> (<em>string</em>) -- Name of city</li>
|
||||||
|
</ul>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<p>Attempts to switch to the specified city (for Bladeburner only).</p>
|
||||||
|
<p>Returns true if successful, and false otherwise</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="section" id="getstamina">
|
||||||
|
<h2>getStamina<a class="headerlink" href="#getstamina" title="Permalink to this headline">¶</a></h2>
|
||||||
|
<dl class="function">
|
||||||
|
<dt id="getStamina">
|
||||||
|
<code class="descname">getStamina</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#getStamina" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><p>Returns an array with two elements:</p>
|
||||||
|
<blockquote>
|
||||||
|
<div>[Current stamina, Max stamina]</div></blockquote>
|
||||||
|
<p>Example usage:</p>
|
||||||
|
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">function</span> <span class="n">getStaminaPercentage</span><span class="p">()</span> <span class="p">{</span>
|
||||||
|
<span class="n">let</span> <span class="n">res</span> <span class="o">=</span> <span class="n">bladeburner</span><span class="o">.</span><span class="n">getStamina</span><span class="p">();</span>
|
||||||
|
<span class="k">return</span> <span class="n">res</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">/</span> <span class="n">res</span><span class="p">[</span><span class="mi">1</span><span class="p">];</span>
|
||||||
|
<span class="p">}</span>
|
||||||
|
</pre></div>
|
||||||
|
</div>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="section" id="joinbladeburnerfaction">
|
||||||
|
<h2>joinBladeburnerFaction<a class="headerlink" href="#joinbladeburnerfaction" title="Permalink to this headline">¶</a></h2>
|
||||||
|
<dl class="function">
|
||||||
|
<dt id="joinBladeburnerFaction">
|
||||||
|
<code class="descname">joinBladeburnerFaction</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#joinBladeburnerFaction" title="Permalink to this definition">¶</a></dt>
|
||||||
|
<dd><p>Attempts to join the Bladeburner faction.</p>
|
||||||
|
<p>Returns true if you successfully join the Bladeburner faction, or if
|
||||||
|
you are already a member.</p>
|
||||||
|
<p>Returns false otherwise.</p>
|
||||||
|
</dd></dl>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="section" id="examples">
|
||||||
|
<h2>Examples<a class="headerlink" href="#examples" title="Permalink to this headline">¶</a></h2>
|
||||||
|
<p><strong>Basic example usage</strong>:</p>
|
||||||
|
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">tprint</span><span class="p">(</span><span class="n">bladeburner</span><span class="o">.</span><span class="n">getContractNames</span><span class="p">());</span>
|
||||||
|
<span class="n">tprint</span><span class="p">(</span><span class="n">bladeburner</span><span class="o">.</span><span class="n">getOperationNames</span><span class="p">());</span>
|
||||||
|
<span class="n">tprint</span><span class="p">(</span><span class="n">bladeburner</span><span class="o">.</span><span class="n">getBlackOpNames</span><span class="p">());</span>
|
||||||
|
<span class="n">tprint</span><span class="p">(</span><span class="n">bladeburner</span><span class="o">.</span><span class="n">getGeneralActionNames</span><span class="p">());</span>
|
||||||
|
<span class="n">tprint</span><span class="p">(</span><span class="n">bladeburner</span><span class="o">.</span><span class="n">getSkillNames</span><span class="p">());</span>
|
||||||
|
<span class="n">tprint</span><span class="p">(</span><span class="n">bladeburner</span><span class="o">.</span><span class="n">getActionTime</span><span class="p">(</span><span class="s2">"contract"</span><span class="p">,</span> <span class="s2">"Tracking"</span><span class="p">));</span>
|
||||||
|
<span class="n">tprint</span><span class="p">(</span><span class="s2">"Rank: "</span> <span class="o">+</span> <span class="n">bladeburner</span><span class="o">.</span><span class="n">getRank</span><span class="p">());</span>
|
||||||
|
<span class="n">tprint</span><span class="p">(</span><span class="s2">"Skill Points: "</span> <span class="o">+</span> <span class="n">bladeburner</span><span class="o">.</span><span class="n">getSkillPoints</span><span class="p">());</span>
|
||||||
|
<span class="n">tprint</span><span class="p">(</span><span class="s2">"Cloak Skill Level: "</span> <span class="o">+</span> <span class="n">bladeburner</span><span class="o">.</span><span class="n">getSkillLevel</span><span class="p">(</span><span class="s2">"Cloak"</span><span class="p">));</span>
|
||||||
|
<span class="n">tprint</span><span class="p">(</span><span class="s2">"Trying to upgradeSkill: "</span> <span class="o">+</span> <span class="n">bladeburner</span><span class="o">.</span><span class="n">upgradeSkill</span><span class="p">(</span><span class="s2">"Cloak"</span><span class="p">));</span>
|
||||||
|
<span class="n">tprint</span><span class="p">(</span><span class="s2">"Skill Points remaining: "</span> <span class="o">+</span> <span class="n">bladeburner</span><span class="o">.</span><span class="n">getSkillPoints</span><span class="p">());</span>
|
||||||
|
|
||||||
|
<span class="n">tprint</span><span class="p">(</span><span class="s2">"Trying to switch to a nonexistent city: "</span> <span class="o">+</span> <span class="n">bladeburner</span><span class="o">.</span><span class="n">switchCity</span><span class="p">(</span><span class="s2">"lskgns"</span><span class="p">));</span>
|
||||||
|
|
||||||
|
<span class="n">var</span> <span class="n">chongqing</span> <span class="o">=</span> <span class="s2">"Chongqing"</span><span class="p">;</span>
|
||||||
|
<span class="n">tprint</span><span class="p">(</span><span class="s2">"Trying to switch to Chongqing: "</span> <span class="o">+</span> <span class="n">bladeburner</span><span class="o">.</span><span class="n">switchCity</span><span class="p">(</span><span class="n">chongqing</span><span class="p">));</span>
|
||||||
|
<span class="n">tprint</span><span class="p">(</span><span class="s2">"Chongqing chaos: "</span> <span class="o">+</span> <span class="n">bladeburner</span><span class="o">.</span><span class="n">getCityChaos</span><span class="p">(</span><span class="n">chongqing</span><span class="p">));</span>
|
||||||
|
<span class="n">tprint</span><span class="p">(</span><span class="s2">"Chongqing estimated pop: "</span> <span class="o">+</span> <span class="n">bladeburner</span><span class="o">.</span><span class="n">getCityEstimatedPopulation</span><span class="p">(</span><span class="n">chongqing</span><span class="p">));</span>
|
||||||
|
<span class="n">tprint</span><span class="p">(</span><span class="s2">"Chonqging estimated communities: "</span> <span class="o">+</span> <span class="n">bladeburner</span><span class="o">.</span><span class="n">getCityEstimatedCommunities</span><span class="p">(</span><span class="n">chongqing</span><span class="p">));</span>
|
||||||
|
</pre></div>
|
||||||
|
</div>
|
||||||
|
<p><strong>Bladeburner handler example</strong>. Note that this avoids the need of using the <em>bladeburner</em> namespace
|
||||||
|
identifier by attaching the Bladeburner API functions to an object:</p>
|
||||||
|
<div class="highlight-default"><div class="highlight"><pre><span></span>const FIELD_ANALYSIS_INTERVAL = 10; //Number of minutes between field analysis states
|
||||||
|
const FIELD_ANALYSIS_DURATION = 5; //Duration in minutes
|
||||||
|
|
||||||
|
function BladeburnerHandler(ns, params) {
|
||||||
|
//Netscript environment becomes part of the instance
|
||||||
|
this.ns = ns;
|
||||||
|
|
||||||
|
//Netscript bladeburner API becomes part of this instance
|
||||||
|
for (var bladeburnerFn in ns.bladeburner) {
|
||||||
|
this[bladeburnerFn] = ns.bladeburner[bladeburnerFn];
|
||||||
|
}
|
||||||
|
|
||||||
|
this.fieldAnalysis = {
|
||||||
|
inProgress: params.startFieldAnalysis ? true : false,
|
||||||
|
cyclesRemaining: FIELD_ANALYSIS_DURATION,
|
||||||
|
cyclesSince: FIELD_ANALYSIS_INTERVAL
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BladeburnerHandler.prototype.getStaminaPercentage = function() {
|
||||||
|
var res = this.getStamina();
|
||||||
|
return 100 * (res[0] / res[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
BladeburnerHandler.prototype.hasSimulacrum = function() {
|
||||||
|
var augs = this.ns.getOwnedAugmentations();
|
||||||
|
return augs.includes("The Blade's Simulacrum");
|
||||||
|
}
|
||||||
|
|
||||||
|
BladeburnerHandler.prototype.handle = function() {
|
||||||
|
//If we're doing something else manually (without Simlacrum),
|
||||||
|
//it overrides Bladeburner stuff
|
||||||
|
if (!this.hasSimulacrum() && this.ns.isBusy()) {
|
||||||
|
this.ns.print("Idling bc player is busy with some other action");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.fieldAnalysis.inProgress) {
|
||||||
|
--(this.fieldAnalysis.cyclesRemaining);
|
||||||
|
if (this.fieldAnalysis.cyclesRemaining < 0) {
|
||||||
|
this.fieldAnalysis.inProgress = false;
|
||||||
|
this.fieldAnalysis.cyclesSince = 0;
|
||||||
|
return this.handle();
|
||||||
|
} else {
|
||||||
|
this.startAction("general", "Field Analysis");
|
||||||
|
this.ns.print("handler is doing field analyis for " +
|
||||||
|
(this.fieldAnalysis.cyclesRemaining+1) + " more mins");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
++(this.fieldAnalysis.cyclesSince);
|
||||||
|
if (this.fieldAnalysis.cyclesSince > FIELD_ANALYSIS_INTERVAL) {
|
||||||
|
this.fieldAnalysis.inProgress = true;
|
||||||
|
this.fieldAnalysis.cyclesRemaining = FIELD_ANALYSIS_DURATION;
|
||||||
|
return this.handle();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.stopBladeburnerAction();
|
||||||
|
|
||||||
|
var staminaPerc = this.getStaminaPercentage();
|
||||||
|
if (staminaPerc < 55) {
|
||||||
|
this.ns.print("handler is starting training due to low stamina percentage");
|
||||||
|
this.startAction("general", "Training");
|
||||||
|
} else {
|
||||||
|
var action = this.chooseAction();
|
||||||
|
this.ns.print("handler chose " + action.name + " " + action.type + " through chooseAction()");
|
||||||
|
this.startAction(action.type, action.name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BladeburnerHandler.prototype.chooseAction = function() {
|
||||||
|
//Array of all Operations
|
||||||
|
var ops = this.getOperationNames();
|
||||||
|
|
||||||
|
//Sort Operations in order of increasing success chance
|
||||||
|
ops.sort((a, b)=>{
|
||||||
|
return this.getActionEstimatedSuccessChance("operation", a) -
|
||||||
|
this.getActionEstimatedSuccessChance("operation", b);
|
||||||
|
});
|
||||||
|
|
||||||
|
//Loop through until you find one with 99+% success chance
|
||||||
|
for (let i = 0; i < ops.length; ++i) {
|
||||||
|
let successChance = this.getActionEstimatedSuccessChance("operation", ops[i]);
|
||||||
|
let count = this.getActionCountRemaining("operation", ops[i]);
|
||||||
|
if (successChance >= 0.99 && count > 10) {
|
||||||
|
return {type: "operation", name: ops[i]};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Repeat for Contracts
|
||||||
|
var contracts = this.getContractNames();
|
||||||
|
contracts.sort((a, b)=>{
|
||||||
|
return this.getActionEstimatedSuccessChance("contract", a) -
|
||||||
|
this.getActionEstimatedSuccessChance("contract", b);
|
||||||
|
});
|
||||||
|
|
||||||
|
for (let i = 0; i < contracts.length; ++i) {
|
||||||
|
let successChance = this.getActionEstimatedSuccessChance("contract", contracts[i]);
|
||||||
|
let count = this.getActionCountRemaining("contract", contracts[i]);
|
||||||
|
if (successChance >= 0.80 && count > 10) {
|
||||||
|
return {type: "contract", name: contracts[i]};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {type:"general", name:"Training"};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BladeburnerHandler.prototype.process = async function() {
|
||||||
|
this.handle();
|
||||||
|
await this.ns.sleep(60000);
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function main(ns) {
|
||||||
|
ns.disableLog("sleep");
|
||||||
|
//Check if Bladeburner is available. This'll throw a runtime error if it's not
|
||||||
|
ns.bladeburner.getContractNames();
|
||||||
|
|
||||||
|
var startFieldAnalysis = true;
|
||||||
|
if (ns.args.length >= 1 && ns.args[0] == "false") {
|
||||||
|
startFieldAnalysis = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var handler = new BladeburnerHandler(ns, {
|
||||||
|
startFieldAnalysis: startFieldAnalysis
|
||||||
|
});
|
||||||
|
while(true) {
|
||||||
|
await handler.process();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</pre></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="sidebar">
|
||||||
|
<h3>Table Of Contents</h3>
|
||||||
|
<p class="caption"><span class="caption-text">Contents:</span></p>
|
||||||
|
<ul class="current">
|
||||||
|
<li class="toctree-l1 current"><a class="reference internal" href="netscript.html"> Netscript</a><ul class="current">
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="netscriptjs.html"> NetscriptJS (Netscript 2.0)</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="netscriptdatatypes.html"> Data Types and Variables</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="netscriptoperators.html"> Operators</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="netscriptloopsandconditionals.html"> Loops and Conditionals</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="netscriptscriptarguments.html"> Script Arguments</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="netscriptfunctions.html"> Basic Functions</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="netscriptadvancedfunctions.html"> Advanced Functions</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="netscripthacknetnodeapi.html"> Hacknet Node API</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="netscriptixapi.html"> Trade Information eXchange (TIX) API</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="netscriptsingularityfunctions.html"> Singularity Functions</a></li>
|
||||||
|
<li class="toctree-l2 current"><a class="current reference internal" href="#"> Bladeburner API</a><ul>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#bladeburner-action-types">Bladeburner Action Types</a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#getcontractnames">getContractNames</a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#getoperationnames">getOperationNames</a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#getblackopnames">getBlackOpNames</a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#getgeneralactionnames">getGeneralActionNames</a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#getskillnames">getSkillNames</a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#startaction">startAction</a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#stopbladeburneraction">stopBladeburnerAction</a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#getactiontime">getActionTime</a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#getactionestimatedsuccesschance">getActionEstimatedSuccessChance</a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#getactioncountremaining">getActionCountRemaining</a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#getrank">getRank</a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#getskillpoints">getSkillPoints</a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#getskilllevel">getSkillLevel</a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#upgradeskill">upgradeSkill</a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#getteamsize">getTeamSize</a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#setteamsize">setTeamSize</a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#getcityestimatedpopulation">getCityEstimatedPopulation</a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#getcityestimatedcommunities">getCityEstimatedCommunities</a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#getcitychaos">getCityChaos</a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#switchcity">switchCity</a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#getstamina">getStamina</a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#joinbladeburnerfaction">joinBladeburnerFaction</a></li>
|
||||||
|
<li class="toctree-l3"><a class="reference internal" href="#examples">Examples</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="netscriptmisc.html"> Miscellaneous</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="terminal.html"> Terminal</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="shortcuts.html"> Keyboard Shortcuts</a></li>
|
||||||
|
<li class="toctree-l1"><a class="reference internal" href="changelog.html"> Changelog</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<div role="search">
|
||||||
|
<h3 style="margin-top: 1.5em;">Search</h3>
|
||||||
|
<form class="search" action="search.html" method="get">
|
||||||
|
<input type="text" name="q" />
|
||||||
|
<input type="submit" value="Go" />
|
||||||
|
<input type="hidden" name="check_keywords" value="yes" />
|
||||||
|
<input type="hidden" name="area" value="default" />
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="clearer"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="footer-wrapper">
|
||||||
|
<div class="footer">
|
||||||
|
<div class="left">
|
||||||
|
<div role="navigation" aria-label="related navigaton">
|
||||||
|
<a href="netscriptsingularityfunctions.html" title="Netscript Singularity Functions"
|
||||||
|
>previous</a> |
|
||||||
|
<a href="netscriptmisc.html" title="Netscript Miscellaneous"
|
||||||
|
>next</a> |
|
||||||
|
<a href="genindex.html" title="General Index"
|
||||||
|
>index</a>
|
||||||
|
</div>
|
||||||
|
<div role="note" aria-label="source link">
|
||||||
|
<br/>
|
||||||
|
<a href="_sources/netscriptbladeburnerapi.rst.txt"
|
||||||
|
rel="nofollow">Show Source</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="right">
|
||||||
|
|
||||||
|
<div class="footer" role="contentinfo">
|
||||||
|
© Copyright 2017, Bitburner.
|
||||||
|
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.6.4.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="clearer"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
6
doc/build/html/netscriptfunctions.html
vendored
6
doc/build/html/netscriptfunctions.html
vendored
@ -1567,7 +1567,10 @@ false if the player clicks "No". The script's execution is halted unti
|
|||||||
|
|
||||||
<div class="section" id="defining-your-own-functions">
|
<div class="section" id="defining-your-own-functions">
|
||||||
<h3>Defining your own Functions<a class="headerlink" href="#defining-your-own-functions" title="Permalink to this headline">¶</a></h3>
|
<h3>Defining your own Functions<a class="headerlink" href="#defining-your-own-functions" title="Permalink to this headline">¶</a></h3>
|
||||||
<p>You can define your own functions in Netscript using the following syntax:</p>
|
<p>Note that the following information is only applicable for Netscript 1.0.
|
||||||
|
<a class="reference internal" href="netscriptjs.html"><span class="doc">NetscriptJS (Netscript 2.0)</span></a> allows you to define your functions using native Javascript
|
||||||
|
techniques.</p>
|
||||||
|
<p>You can define your own functions in Netscript 1.0 using the following syntax:</p>
|
||||||
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">function</span> <span class="n">name</span><span class="p">(</span><span class="n">args</span><span class="o">...</span><span class="p">)</span> <span class="p">{</span>
|
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">function</span> <span class="n">name</span><span class="p">(</span><span class="n">args</span><span class="o">...</span><span class="p">)</span> <span class="p">{</span>
|
||||||
<span class="n">function</span> <span class="n">code</span> <span class="n">here</span><span class="o">...</span>
|
<span class="n">function</span> <span class="n">code</span> <span class="n">here</span><span class="o">...</span>
|
||||||
<span class="k">return</span> <span class="n">some_value</span>
|
<span class="k">return</span> <span class="n">some_value</span>
|
||||||
@ -1738,6 +1741,7 @@ you create in functions such as <a class="reference external" href="https://deve
|
|||||||
<li class="toctree-l2"><a class="reference internal" href="netscripthacknetnodeapi.html"> Hacknet Node API</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="netscripthacknetnodeapi.html"> Hacknet Node API</a></li>
|
||||||
<li class="toctree-l2"><a class="reference internal" href="netscriptixapi.html"> Trade Information eXchange (TIX) API</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="netscriptixapi.html"> Trade Information eXchange (TIX) API</a></li>
|
||||||
<li class="toctree-l2"><a class="reference internal" href="netscriptsingularityfunctions.html"> Singularity Functions</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="netscriptsingularityfunctions.html"> Singularity Functions</a></li>
|
||||||
|
<li class="toctree-l2"><a class="reference internal" href="netscriptbladeburnerapi.html"> Bladeburner API</a></li>
|
||||||
<li class="toctree-l2"><a class="reference internal" href="netscriptmisc.html"> Miscellaneous</a></li>
|
<li class="toctree-l2"><a class="reference internal" href="netscriptmisc.html"> Miscellaneous</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
BIN
doc/build/html/objects.inv
vendored
BIN
doc/build/html/objects.inv
vendored
Binary file not shown.
2
doc/build/html/searchindex.js
vendored
2
doc/build/html/searchindex.js
vendored
File diff suppressed because one or more lines are too long
@ -3,6 +3,22 @@
|
|||||||
Changelog
|
Changelog
|
||||||
=========
|
=========
|
||||||
|
|
||||||
|
v0.39.0 - 6/25/2018
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
* Added BitNode-7: Bladeburner 2079
|
||||||
|
* Infiltration base difficulty decreased by 10% for most locations
|
||||||
|
* Experience gains from Infiltration slightly increased
|
||||||
|
* Money gained from Infiltration increased by 20%
|
||||||
|
* Added 'var' declarations in Netscript 1.0 (only works with 'var', not 'let' or 'const')
|
||||||
|
* Script base RAM cost is now 1.6 GB (increased from 1.4 GB)
|
||||||
|
* While/for loops and if statements no longer cost RAM in scripts
|
||||||
|
* Made short-circuit evaluation logic more consistent in Netscript 1.0 (see https://github.com/danielyxie/bitburner/issues/308)
|
||||||
|
* Changelog button in the Options menu now links to the new Changelog URL (by Github user thePalindrome)
|
||||||
|
* Skill level calculation is now 'smoother' (by Github user hydroflame)
|
||||||
|
* Added a button to 'beautify' scripts in the text editor (by Github user hydroflame)
|
||||||
|
* Added favicon (by Github user kopelli)
|
||||||
|
|
||||||
v0.38.1 - 6/15/2018
|
v0.38.1 - 6/15/2018
|
||||||
-------------------
|
-------------------
|
||||||
* Bug Fix: Using 'Object.prototype' functions like toLocaleString() or toString() should no longer cause errors in NetscriptJS
|
* Bug Fix: Using 'Object.prototype' functions like toLocaleString() or toString() should no longer cause errors in NetscriptJS
|
||||||
@ -17,7 +33,6 @@ v0.38.1 - 6/15/2018
|
|||||||
* Bug Fix: serverExists() Netscript function should now properly return false for non-existent hostname/ips
|
* Bug Fix: serverExists() Netscript function should now properly return false for non-existent hostname/ips
|
||||||
* Bug Fix: Sever's security level should now properly increase when its money is grown to max value
|
* Bug Fix: Sever's security level should now properly increase when its money is grown to max value
|
||||||
|
|
||||||
|
|
||||||
v0.38.0 - 6/12/2018
|
v0.38.0 - 6/12/2018
|
||||||
-------------------
|
-------------------
|
||||||
* New BitNode: BN-12 The Recursion - Implemented by Github user hydroflame
|
* New BitNode: BN-12 The Recursion - Implemented by Github user hydroflame
|
||||||
|
@ -24,4 +24,5 @@ to reach out to the developer!
|
|||||||
Hacknet Node API <netscripthacknetnodeapi>
|
Hacknet Node API <netscripthacknetnodeapi>
|
||||||
Trade Information eXchange (TIX) API <netscriptixapi>
|
Trade Information eXchange (TIX) API <netscriptixapi>
|
||||||
Singularity Functions <netscriptsingularityfunctions>
|
Singularity Functions <netscriptsingularityfunctions>
|
||||||
|
Bladeburner API <netscriptbladeburnerapi>
|
||||||
Miscellaneous <netscriptmisc>
|
Miscellaneous <netscriptmisc>
|
||||||
|
446
doc/source/netscriptbladeburnerapi.rst
Normal file
446
doc/source/netscriptbladeburnerapi.rst
Normal file
@ -0,0 +1,446 @@
|
|||||||
|
Netscript Bladeburner API
|
||||||
|
=========================
|
||||||
|
|
||||||
|
Netscript provides the following API for interacting with the game's Bladeburner mechanic.
|
||||||
|
|
||||||
|
The Bladeburner API is **not** immediately available to the palyer and must be unlocked
|
||||||
|
later in the game
|
||||||
|
|
||||||
|
**WARNING: This page contains spoilers for the game**
|
||||||
|
|
||||||
|
The Bladeburner API is unlocked in BitNode-7. If you are in BitNode-7, you will
|
||||||
|
automatically gain access to this API. Otherwise, you must have Source-File 7 in
|
||||||
|
order to use this API in other BitNodes
|
||||||
|
|
||||||
|
**Bladeburner API functions must be accessed through the bladeburner namespace**
|
||||||
|
|
||||||
|
In Netscript 1.0::
|
||||||
|
|
||||||
|
bladeburner.getContractNames();
|
||||||
|
bladeburner.startAction("general", "Training");
|
||||||
|
|
||||||
|
In :ref:`netscriptjs`::
|
||||||
|
|
||||||
|
ns.bladeburner.getContractNames();
|
||||||
|
ns.bladeburner.startAction("general", "Training");
|
||||||
|
|
||||||
|
.. _bladeburner_action_types:
|
||||||
|
|
||||||
|
Bladeburner Action Types
|
||||||
|
------------------------
|
||||||
|
|
||||||
|
Several functions in the Bladeburner API require you to specify an action using
|
||||||
|
its type and name. The following are valid values when specifying the action's type:
|
||||||
|
|
||||||
|
**Contracts**
|
||||||
|
* contract
|
||||||
|
* contracts
|
||||||
|
* contr
|
||||||
|
|
||||||
|
**Operations**
|
||||||
|
* operation
|
||||||
|
* operations
|
||||||
|
* op
|
||||||
|
* ops
|
||||||
|
|
||||||
|
**Black Ops**
|
||||||
|
* blackoperation
|
||||||
|
* black operation
|
||||||
|
* black operations
|
||||||
|
* black op
|
||||||
|
* black ops
|
||||||
|
* blackop
|
||||||
|
* blackops
|
||||||
|
|
||||||
|
**General Actions (Training, Field Analysis, Recruitment)**
|
||||||
|
* general
|
||||||
|
* general action
|
||||||
|
* gen
|
||||||
|
|
||||||
|
getContractNames
|
||||||
|
----------------
|
||||||
|
|
||||||
|
.. js:function:: getContractNames()
|
||||||
|
|
||||||
|
Returns an array of strings containing the names of all Bladeburner contracts
|
||||||
|
|
||||||
|
getOperationNames
|
||||||
|
-----------------
|
||||||
|
|
||||||
|
.. js:function:: getOperationNames()
|
||||||
|
|
||||||
|
Returns an array of strings containing the names of all Bladeburner operations
|
||||||
|
|
||||||
|
getBlackOpNames
|
||||||
|
---------------
|
||||||
|
|
||||||
|
.. js:function:: getBlackOpNames()
|
||||||
|
|
||||||
|
Returns an array of strings containing the names of all Bladeburner Black Ops
|
||||||
|
|
||||||
|
getGeneralActionNames
|
||||||
|
---------------------
|
||||||
|
|
||||||
|
.. js:function:: getGeneralActionNames()
|
||||||
|
|
||||||
|
Returns an array of strings containing the names of all general Bladeburner actions
|
||||||
|
|
||||||
|
getSkillNames
|
||||||
|
-------------
|
||||||
|
|
||||||
|
.. js:function:: getSkillNames()
|
||||||
|
|
||||||
|
Returns an array of strings containing the names of all Bladeburner skills
|
||||||
|
|
||||||
|
startAction
|
||||||
|
-----------
|
||||||
|
|
||||||
|
.. js:function:: startAction(type, name)
|
||||||
|
|
||||||
|
:param string type: Type of action. See :ref:`bladeburner_action_types`
|
||||||
|
:param string name: Name of action. Must be an exact match
|
||||||
|
|
||||||
|
Attempts to start the specified Bladeburner action. Returns true if the action
|
||||||
|
was started successfully, and false otherwise.
|
||||||
|
|
||||||
|
stopBladeburnerAction
|
||||||
|
---------------------
|
||||||
|
|
||||||
|
.. js:function:: stopBladeburnerAction()
|
||||||
|
|
||||||
|
Stops the current Bladeburner action
|
||||||
|
|
||||||
|
getActionTime
|
||||||
|
-------------
|
||||||
|
|
||||||
|
.. js:function:: getActionTime(type, name)
|
||||||
|
|
||||||
|
:param string type: Type of action. See :ref:`bladeburner_action_types`
|
||||||
|
:param string name: Name of action. Must be an exact match
|
||||||
|
|
||||||
|
Returns the number of seconds it takes to complete the specified action
|
||||||
|
|
||||||
|
getActionEstimatedSuccessChance
|
||||||
|
-------------------------------
|
||||||
|
|
||||||
|
.. js:function:: getActionEstimatedSuccessChance(type, name)
|
||||||
|
|
||||||
|
:param string type: Type of action. See :ref:`bladeburner_action_types`
|
||||||
|
:param string name: Name of action. Must be an exact match
|
||||||
|
|
||||||
|
Returns the estimated success chance for the specified action
|
||||||
|
|
||||||
|
getActionCountRemaining
|
||||||
|
-----------------------
|
||||||
|
|
||||||
|
.. js:function:: getActionCountRemaining(type, name)
|
||||||
|
|
||||||
|
:param string type: Type of action. See :ref:`bladeburner_action_types`
|
||||||
|
:param string name: Name of action. Must be an exact match
|
||||||
|
|
||||||
|
Returns the remaining count of the specified action.
|
||||||
|
|
||||||
|
Note that this is meant to be used for Contracts and Operations.
|
||||||
|
This function will return 'Infinity' for actions such as Training and Field Analysis.
|
||||||
|
|
||||||
|
getRank
|
||||||
|
-------
|
||||||
|
|
||||||
|
.. js:function:: getRank()
|
||||||
|
|
||||||
|
Returns the player's Bladeburner Rank
|
||||||
|
|
||||||
|
getSkillPoints
|
||||||
|
--------------
|
||||||
|
|
||||||
|
.. js:function:: getSkillPoints()
|
||||||
|
|
||||||
|
Returns the number of Bladeburner skill points you have
|
||||||
|
|
||||||
|
getSkillLevel
|
||||||
|
-------------
|
||||||
|
|
||||||
|
.. js:function:: getSkillLevel(skillName="")
|
||||||
|
|
||||||
|
:param string skillName: Optional name of Skill. Empty string by default
|
||||||
|
|
||||||
|
If no argument or an empty string is passed in, this function returns
|
||||||
|
an object with your level for all Bladeburner Skills (only for skills that
|
||||||
|
have at least one level). In the object, the name of the Bladeburner Skills
|
||||||
|
are the keys and your skill levels are the values. For example::
|
||||||
|
|
||||||
|
{
|
||||||
|
"Blade's Intuition": 10,
|
||||||
|
"Cloak": 5,
|
||||||
|
"Evasive System": 6
|
||||||
|
}
|
||||||
|
|
||||||
|
If the name of a skill is passed in as an argument, then this function
|
||||||
|
returns your level in the specified skill.
|
||||||
|
|
||||||
|
The function returns -1 if an invalid skill name is passed in
|
||||||
|
|
||||||
|
upgradeSkill
|
||||||
|
------------
|
||||||
|
|
||||||
|
.. js:function:: upgradeSkill(skillName)
|
||||||
|
|
||||||
|
:param string skillName: Name of Skill to be upgraded. Must be an exact match
|
||||||
|
|
||||||
|
Attempts to upgrade the specified Bladeburner skill. Returns true if the
|
||||||
|
skill is successfully upgraded, and false otherwise
|
||||||
|
|
||||||
|
getTeamSize
|
||||||
|
-----------
|
||||||
|
|
||||||
|
.. js:function:: getTeamSize(type, name)
|
||||||
|
|
||||||
|
:param string type: Type of action. See :ref:`bladeburner_action_types`
|
||||||
|
:param string name: Name of action. Must be an exact match
|
||||||
|
|
||||||
|
Returns the number of Bladeburner team members you have assigned to the
|
||||||
|
specified action.
|
||||||
|
|
||||||
|
Setting a team is only applicable for Operations and BlackOps. This function
|
||||||
|
will return 0 for other action types.
|
||||||
|
|
||||||
|
setTeamSize
|
||||||
|
-----------
|
||||||
|
|
||||||
|
.. js:function:: setTeamSize(type, name, size)
|
||||||
|
|
||||||
|
:param string type: Type of action. See :ref:`bladeburner_action_types`
|
||||||
|
:param string name: Name of action. Must be an exact match
|
||||||
|
:param int size: Number of team members to set. Will be converted using Math.round()
|
||||||
|
|
||||||
|
Set the team size for the specified Bladeburner action.
|
||||||
|
|
||||||
|
Returns the team size that was set, or -1 if the function failed.
|
||||||
|
|
||||||
|
getCityEstimatedPopulation
|
||||||
|
--------------------------
|
||||||
|
|
||||||
|
.. js:function:: getCityEstimatedPopulation(cityName)
|
||||||
|
|
||||||
|
:param string cityName: Name of city. Case-sensitive
|
||||||
|
|
||||||
|
Returns the estimated number of Synthoids in the specified city, or -1
|
||||||
|
if an invalid city was specified.
|
||||||
|
|
||||||
|
getCityEstimatedCommunities
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
.. js:function:: getCityEstimatedCommunities(cityName)
|
||||||
|
|
||||||
|
:param string cityName: Name of city. Case-sensitive
|
||||||
|
|
||||||
|
Returns the estimated number of Synthoid communities in the specified city,
|
||||||
|
or -1 if an invalid city was specified.
|
||||||
|
|
||||||
|
getCityChaos
|
||||||
|
------------
|
||||||
|
|
||||||
|
.. js:function:: getCityChaos(cityName)
|
||||||
|
|
||||||
|
:param string cityName: Name of city. Case-sensitive
|
||||||
|
|
||||||
|
Returns the chaos in the specified city, or -1 if an invalid city was specified
|
||||||
|
|
||||||
|
switchCity
|
||||||
|
----------
|
||||||
|
|
||||||
|
.. js:function:: switchCity(cityName)
|
||||||
|
|
||||||
|
:param string cityName: Name of city
|
||||||
|
|
||||||
|
Attempts to switch to the specified city (for Bladeburner only).
|
||||||
|
|
||||||
|
Returns true if successful, and false otherwise
|
||||||
|
|
||||||
|
getStamina
|
||||||
|
----------
|
||||||
|
|
||||||
|
.. js:function:: getStamina()
|
||||||
|
|
||||||
|
Returns an array with two elements:
|
||||||
|
|
||||||
|
[Current stamina, Max stamina]
|
||||||
|
|
||||||
|
Example usage::
|
||||||
|
|
||||||
|
function getStaminaPercentage() {
|
||||||
|
let res = bladeburner.getStamina();
|
||||||
|
return res[0] / res[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
joinBladeburnerFaction
|
||||||
|
----------------------
|
||||||
|
|
||||||
|
.. js:function:: joinBladeburnerFaction()
|
||||||
|
|
||||||
|
Attempts to join the Bladeburner faction.
|
||||||
|
|
||||||
|
Returns true if you successfully join the Bladeburner faction, or if
|
||||||
|
you are already a member.
|
||||||
|
|
||||||
|
Returns false otherwise.
|
||||||
|
|
||||||
|
Examples
|
||||||
|
--------
|
||||||
|
|
||||||
|
**Basic example usage**::
|
||||||
|
|
||||||
|
tprint(bladeburner.getContractNames());
|
||||||
|
tprint(bladeburner.getOperationNames());
|
||||||
|
tprint(bladeburner.getBlackOpNames());
|
||||||
|
tprint(bladeburner.getGeneralActionNames());
|
||||||
|
tprint(bladeburner.getSkillNames());
|
||||||
|
tprint(bladeburner.getActionTime("contract", "Tracking"));
|
||||||
|
tprint("Rank: " + bladeburner.getRank());
|
||||||
|
tprint("Skill Points: " + bladeburner.getSkillPoints());
|
||||||
|
tprint("Cloak Skill Level: " + bladeburner.getSkillLevel("Cloak"));
|
||||||
|
tprint("Trying to upgradeSkill: " + bladeburner.upgradeSkill("Cloak"));
|
||||||
|
tprint("Skill Points remaining: " + bladeburner.getSkillPoints());
|
||||||
|
|
||||||
|
tprint("Trying to switch to a nonexistent city: " + bladeburner.switchCity("lskgns"));
|
||||||
|
|
||||||
|
var chongqing = "Chongqing";
|
||||||
|
tprint("Trying to switch to Chongqing: " + bladeburner.switchCity(chongqing));
|
||||||
|
tprint("Chongqing chaos: " + bladeburner.getCityChaos(chongqing));
|
||||||
|
tprint("Chongqing estimated pop: " + bladeburner.getCityEstimatedPopulation(chongqing));
|
||||||
|
tprint("Chonqging estimated communities: " + bladeburner.getCityEstimatedCommunities(chongqing));
|
||||||
|
|
||||||
|
**Bladeburner handler example**. Note that this avoids the need of using the *bladeburner* namespace
|
||||||
|
identifier by attaching the Bladeburner API functions to an object::
|
||||||
|
|
||||||
|
const FIELD_ANALYSIS_INTERVAL = 10; //Number of minutes between field analysis states
|
||||||
|
const FIELD_ANALYSIS_DURATION = 5; //Duration in minutes
|
||||||
|
|
||||||
|
function BladeburnerHandler(ns, params) {
|
||||||
|
//Netscript environment becomes part of the instance
|
||||||
|
this.ns = ns;
|
||||||
|
|
||||||
|
//Netscript bladeburner API becomes part of this instance
|
||||||
|
for (var bladeburnerFn in ns.bladeburner) {
|
||||||
|
this[bladeburnerFn] = ns.bladeburner[bladeburnerFn];
|
||||||
|
}
|
||||||
|
|
||||||
|
this.fieldAnalysis = {
|
||||||
|
inProgress: params.startFieldAnalysis ? true : false,
|
||||||
|
cyclesRemaining: FIELD_ANALYSIS_DURATION,
|
||||||
|
cyclesSince: FIELD_ANALYSIS_INTERVAL
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BladeburnerHandler.prototype.getStaminaPercentage = function() {
|
||||||
|
var res = this.getStamina();
|
||||||
|
return 100 * (res[0] / res[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
BladeburnerHandler.prototype.hasSimulacrum = function() {
|
||||||
|
var augs = this.ns.getOwnedAugmentations();
|
||||||
|
return augs.includes("The Blade's Simulacrum");
|
||||||
|
}
|
||||||
|
|
||||||
|
BladeburnerHandler.prototype.handle = function() {
|
||||||
|
//If we're doing something else manually (without Simlacrum),
|
||||||
|
//it overrides Bladeburner stuff
|
||||||
|
if (!this.hasSimulacrum() && this.ns.isBusy()) {
|
||||||
|
this.ns.print("Idling bc player is busy with some other action");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.fieldAnalysis.inProgress) {
|
||||||
|
--(this.fieldAnalysis.cyclesRemaining);
|
||||||
|
if (this.fieldAnalysis.cyclesRemaining < 0) {
|
||||||
|
this.fieldAnalysis.inProgress = false;
|
||||||
|
this.fieldAnalysis.cyclesSince = 0;
|
||||||
|
return this.handle();
|
||||||
|
} else {
|
||||||
|
this.startAction("general", "Field Analysis");
|
||||||
|
this.ns.print("handler is doing field analyis for " +
|
||||||
|
(this.fieldAnalysis.cyclesRemaining+1) + " more mins");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
++(this.fieldAnalysis.cyclesSince);
|
||||||
|
if (this.fieldAnalysis.cyclesSince > FIELD_ANALYSIS_INTERVAL) {
|
||||||
|
this.fieldAnalysis.inProgress = true;
|
||||||
|
this.fieldAnalysis.cyclesRemaining = FIELD_ANALYSIS_DURATION;
|
||||||
|
return this.handle();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.stopBladeburnerAction();
|
||||||
|
|
||||||
|
var staminaPerc = this.getStaminaPercentage();
|
||||||
|
if (staminaPerc < 55) {
|
||||||
|
this.ns.print("handler is starting training due to low stamina percentage");
|
||||||
|
this.startAction("general", "Training");
|
||||||
|
} else {
|
||||||
|
var action = this.chooseAction();
|
||||||
|
this.ns.print("handler chose " + action.name + " " + action.type + " through chooseAction()");
|
||||||
|
this.startAction(action.type, action.name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BladeburnerHandler.prototype.chooseAction = function() {
|
||||||
|
//Array of all Operations
|
||||||
|
var ops = this.getOperationNames();
|
||||||
|
|
||||||
|
//Sort Operations in order of increasing success chance
|
||||||
|
ops.sort((a, b)=>{
|
||||||
|
return this.getActionEstimatedSuccessChance("operation", a) -
|
||||||
|
this.getActionEstimatedSuccessChance("operation", b);
|
||||||
|
});
|
||||||
|
|
||||||
|
//Loop through until you find one with 99+% success chance
|
||||||
|
for (let i = 0; i < ops.length; ++i) {
|
||||||
|
let successChance = this.getActionEstimatedSuccessChance("operation", ops[i]);
|
||||||
|
let count = this.getActionCountRemaining("operation", ops[i]);
|
||||||
|
if (successChance >= 0.99 && count > 10) {
|
||||||
|
return {type: "operation", name: ops[i]};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Repeat for Contracts
|
||||||
|
var contracts = this.getContractNames();
|
||||||
|
contracts.sort((a, b)=>{
|
||||||
|
return this.getActionEstimatedSuccessChance("contract", a) -
|
||||||
|
this.getActionEstimatedSuccessChance("contract", b);
|
||||||
|
});
|
||||||
|
|
||||||
|
for (let i = 0; i < contracts.length; ++i) {
|
||||||
|
let successChance = this.getActionEstimatedSuccessChance("contract", contracts[i]);
|
||||||
|
let count = this.getActionCountRemaining("contract", contracts[i]);
|
||||||
|
if (successChance >= 0.80 && count > 10) {
|
||||||
|
return {type: "contract", name: contracts[i]};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {type:"general", name:"Training"};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BladeburnerHandler.prototype.process = async function() {
|
||||||
|
this.handle();
|
||||||
|
await this.ns.sleep(60000);
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function main(ns) {
|
||||||
|
ns.disableLog("sleep");
|
||||||
|
//Check if Bladeburner is available. This'll throw a runtime error if it's not
|
||||||
|
ns.bladeburner.getContractNames();
|
||||||
|
|
||||||
|
var startFieldAnalysis = true;
|
||||||
|
if (ns.args.length >= 1 && ns.args[0] == "false") {
|
||||||
|
startFieldAnalysis = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var handler = new BladeburnerHandler(ns, {
|
||||||
|
startFieldAnalysis: startFieldAnalysis
|
||||||
|
});
|
||||||
|
while(true) {
|
||||||
|
await handler.process();
|
||||||
|
}
|
||||||
|
}
|
@ -942,7 +942,11 @@ prompt
|
|||||||
Defining your own Functions
|
Defining your own Functions
|
||||||
---------------------------
|
---------------------------
|
||||||
|
|
||||||
You can define your own functions in Netscript using the following syntax::
|
Note that the following information is only applicable for Netscript 1.0.
|
||||||
|
:doc:`netscriptjs` allows you to define your functions using native Javascript
|
||||||
|
techniques.
|
||||||
|
|
||||||
|
You can define your own functions in Netscript 1.0 using the following syntax::
|
||||||
|
|
||||||
function name(args...) {
|
function name(args...) {
|
||||||
function code here...
|
function code here...
|
||||||
|
11
index.html
11
index.html
@ -886,6 +886,17 @@
|
|||||||
<input type="checkbox" name="settingsSuppressTravelConfirmation" id="settingsSuppressTravelConfirmation">
|
<input type="checkbox" name="settingsSuppressTravelConfirmation" id="settingsSuppressTravelConfirmation">
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Suppress buy aug confirmation -->
|
||||||
|
<fieldset>
|
||||||
|
<label for="settingsSuppressBuyAugmentationConfirmation" class="tooltip">Suppress buy augmentation confirmation:
|
||||||
|
<span class="tooltiptext">
|
||||||
|
If this is set, the confirmation message before buying augmentation will not show up.
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
<input type="checkbox" name="settingsSuppressBuyAugmentationConfirmation" id="settingsSuppressBuyAugmentationConfirmation">
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
<!-- Disable Terminal and Navigation Shortcuts -->
|
<!-- Disable Terminal and Navigation Shortcuts -->
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<label for="settingsDisableHotkeys" class="tooltip">Disable Hotkeys:
|
<label for="settingsDisableHotkeys" class="tooltip">Disable Hotkeys:
|
||||||
|
11
netscript.js
11
netscript.js
@ -86,7 +86,16 @@ let NetscriptFunctions =
|
|||||||
"installAugmentations|hacknetnodes|upgradeLevel|upgradeRam|upgradeCore|" +
|
"installAugmentations|hacknetnodes|upgradeLevel|upgradeRam|upgradeCore|" +
|
||||||
"getLevelUpgradeCost|getRamUpgradeCost|getCoreUpgradeCost|" +
|
"getLevelUpgradeCost|getRamUpgradeCost|getCoreUpgradeCost|" +
|
||||||
"getStockPrice|getStockPosition|buyStock|sellStock|shortStock|sellShort|" +
|
"getStockPrice|getStockPosition|buyStock|sellStock|shortStock|sellShort|" +
|
||||||
"placeOrder|cancelOrder";
|
"placeOrder|cancelOrder|" +
|
||||||
|
|
||||||
|
//Bladeburner functions
|
||||||
|
"bladeburner|getContractNames|getOperationNames|getBlackOpNames|" +
|
||||||
|
"getGeneralActionNames|getSkillNames|startAction|stopBladeburnerAction|" +
|
||||||
|
"getActionTime|getActionEstimatedSuccessChance|getActionCountRemaining|" +
|
||||||
|
"getRank|getSkillPoints|getSkillLevel|upgradeSkill|getTeamSize|" +
|
||||||
|
"setTeamSize|getCityEstimatedPopulation|getCityEstimatedCommunities|" +
|
||||||
|
"getCityChaos|switchCity|getStamina|joinBladeburnerFaction"
|
||||||
|
;
|
||||||
|
|
||||||
var NetscriptHighlightRules = function(options) {
|
var NetscriptHighlightRules = function(options) {
|
||||||
var keywordMapper = this.createKeywordMapper({
|
var keywordMapper = this.createKeywordMapper({
|
||||||
|
1955
package-lock.json
generated
1955
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -62,6 +62,9 @@
|
|||||||
"sinon": "^2.3.2",
|
"sinon": "^2.3.2",
|
||||||
"source-map": "^0.7.3",
|
"source-map": "^0.7.3",
|
||||||
"style-loader": "^0.21.0",
|
"style-loader": "^0.21.0",
|
||||||
|
"stylelint": "^9.2.1",
|
||||||
|
"stylelint-declaration-use-variable": "^1.6.1",
|
||||||
|
"stylelint-order": "^0.8.1",
|
||||||
"ts-loader": "^4.4.1",
|
"ts-loader": "^4.4.1",
|
||||||
"tslint": "^5.10.0",
|
"tslint": "^5.10.0",
|
||||||
"typescript": "^2.9.2",
|
"typescript": "^2.9.2",
|
||||||
@ -84,11 +87,11 @@
|
|||||||
"url": "git+https://github.com/danielyxie/bitburner.git"
|
"url": "git+https://github.com/danielyxie/bitburner.git"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"lint:js": "eslint *.js src utils tests",
|
|
||||||
"start:dev": "webpack-dev-server",
|
"start:dev": "webpack-dev-server",
|
||||||
"build": "webpack --mode production",
|
"build": "webpack --mode production",
|
||||||
"build:dev": "webpack --mode development",
|
"build:dev": "webpack --mode development",
|
||||||
"lint:javascript": "eslint ./src/**/*.js ./tests/**/*.js ./utils/**/*.js",
|
"lint:javascript": "eslint *.js ./src/**/*.js ./tests/**/*.js ./utils/**/*.js",
|
||||||
|
"lint:style": "stylelint ./css/*",
|
||||||
"lint:typescript": "tslint --project . --exclude **/*.d.ts --format stylish src/**/*.ts utils/**/*.ts",
|
"lint:typescript": "tslint --project . --exclude **/*.d.ts --format stylish src/**/*.ts utils/**/*.ts",
|
||||||
"watch": "webpack --watch --mode production",
|
"watch": "webpack --watch --mode production",
|
||||||
"watch:dev": "webpack --watch --mode development"
|
"watch:dev": "webpack --watch --mode development"
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
import {Engine} from "./engine.js";
|
import {Engine} from "./engine";
|
||||||
import {workerScripts,
|
import {workerScripts,
|
||||||
addWorkerScript,
|
addWorkerScript,
|
||||||
killWorkerScript} from "./NetscriptWorker.js";
|
killWorkerScript} from "./NetscriptWorker";
|
||||||
import {Player} from "./Player.js";
|
import {Player} from "./Player";
|
||||||
import {getServer} from "./Server.js";
|
import {getServer} from "./Server";
|
||||||
import {dialogBoxCreate} from "../utils/DialogBox.js";
|
import {dialogBoxCreate} from "../utils/DialogBox";
|
||||||
import {printArray, createElement,
|
import {printArray, createElement,
|
||||||
createAccordionElement, removeElement,
|
createAccordionElement, removeElement,
|
||||||
removeChildrenFromElement, exceptionAlert} from "../utils/HelperFunctions.js";
|
removeChildrenFromElement, exceptionAlert} from "../utils/HelperFunctions";
|
||||||
import {logBoxCreate} from "../utils/LogBox.js";
|
import {logBoxCreate} from "../utils/LogBox";
|
||||||
import numeral from "numeral/min/numeral.min";
|
import numeral from "numeral/min/numeral.min";
|
||||||
import {formatNumber} from "../utils/StringHelperFunctions.js";
|
import {formatNumber} from "../utils/StringHelperFunctions";
|
||||||
|
|
||||||
/* {
|
/* {
|
||||||
* serverName: {
|
* serverName: {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import {post} from "./Terminal.js";
|
import {post} from "./Terminal";
|
||||||
|
|
||||||
let Aliases = {};
|
let Aliases = {};
|
||||||
let GlobalAliases = {};
|
let GlobalAliases = {};
|
||||||
|
@ -1,22 +1,22 @@
|
|||||||
import {BitNodeMultipliers} from "./BitNode.js";
|
import {BitNodeMultipliers} from "./BitNode";
|
||||||
import {CONSTANTS} from "./Constants.js";
|
import {CONSTANTS} from "./Constants";
|
||||||
import {Engine} from "./engine.js";
|
import {Engine} from "./engine";
|
||||||
import {Factions, getNextNeurofluxLevel,
|
import {Factions, getNextNeurofluxLevel,
|
||||||
factionExists} from "./Faction.js";
|
factionExists} from "./Faction";
|
||||||
import {hasBladeburnerSF} from "./NetscriptFunctions.js";
|
import {hasBladeburnerSF} from "./NetscriptFunctions";
|
||||||
import {addWorkerScript} from "./NetscriptWorker.js";
|
import {addWorkerScript} from "./NetscriptWorker";
|
||||||
import {Player} from "./Player.js";
|
import {Player} from "./Player";
|
||||||
import {prestigeAugmentation} from "./Prestige.js";
|
import {prestigeAugmentation} from "./Prestige";
|
||||||
import {saveObject} from "./SaveObject.js";
|
import {saveObject} from "./SaveObject";
|
||||||
import {Script, RunningScript} from "./Script.js";
|
import {Script, RunningScript} from "./Script";
|
||||||
import {Server} from "./Server.js";
|
import {Server} from "./Server";
|
||||||
import {SourceFiles} from "./SourceFile.js";
|
import {SourceFiles} from "./SourceFile";
|
||||||
import {dialogBoxCreate} from "../utils/DialogBox.js";
|
import {dialogBoxCreate} from "../utils/DialogBox";
|
||||||
import {createElement, createAccordionElement,
|
import {createElement, createAccordionElement,
|
||||||
removeChildrenFromElement, clearObject} from "../utils/HelperFunctions.js";
|
removeChildrenFromElement, clearObject} from "../utils/HelperFunctions";
|
||||||
import {Reviver, Generic_toJSON,
|
import {Reviver, Generic_toJSON,
|
||||||
Generic_fromJSON} from "../utils/JSONReviver.js";
|
Generic_fromJSON} from "../utils/JSONReviver";
|
||||||
import {isString} from "../utils/StringHelperFunctions.js";
|
import {isString} from "../utils/StringHelperFunctions";
|
||||||
|
|
||||||
//Augmentations
|
//Augmentations
|
||||||
function Augmentation(params) {
|
function Augmentation(params) {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import {Player} from "./Player.js";
|
import {Player} from "./Player";
|
||||||
|
|
||||||
function BitNode(n, name, desc="", info="") {
|
function BitNode(n, name, desc="", info="") {
|
||||||
this.number = n;
|
this.number = n;
|
||||||
@ -132,7 +132,7 @@ function initBitNodes() {
|
|||||||
"Corporations have 80% lower valuations and are therefore less profitable<br>" +
|
"Corporations have 80% lower valuations and are therefore less profitable<br>" +
|
||||||
"Working for companies is 50% less profitable<br>" +
|
"Working for companies is 50% less profitable<br>" +
|
||||||
"Crimes and Infiltration are 50% less profitable<br><br>" +
|
"Crimes and Infiltration are 50% less profitable<br><br>" +
|
||||||
"Destroying this BitNode will give you Source-File 6, or if you already have this Source-File it will upgrade " +
|
"Destroying this BitNode will give you Source-File 7, or if you already have this Source-File it will upgrade " +
|
||||||
"its level up to a maximum of 3. This Source-File allows you to access the Bladeburner Netscript API in other " +
|
"its level up to a maximum of 3. This Source-File allows you to access the Bladeburner Netscript API in other " +
|
||||||
"BitNodes. In addition, this Source-File will increase all of your Bladeburner multipliers by:<br><br>" +
|
"BitNodes. In addition, this Source-File will increase all of your Bladeburner multipliers by:<br><br>" +
|
||||||
"Level 1: 8%<br>" +
|
"Level 1: 8%<br>" +
|
||||||
|
@ -1,24 +1,24 @@
|
|||||||
import {Augmentations, AugmentationNames} from "./Augmentations.js";
|
import {Augmentations, AugmentationNames} from "./Augmentations";
|
||||||
import {BitNodeMultipliers} from "./BitNode.js";
|
import {BitNodeMultipliers} from "./BitNode";
|
||||||
import {CONSTANTS} from "./Constants.js";
|
import {CONSTANTS} from "./Constants";
|
||||||
import {Engine} from "./engine.js";
|
import {Engine} from "./engine";
|
||||||
import {Faction, Factions, factionExists,
|
import {Faction, Factions, factionExists,
|
||||||
joinFaction, displayFactionContent} from "./Faction.js";
|
joinFaction, displayFactionContent} from "./Faction";
|
||||||
import {Locations} from "./Location.js";
|
import {Locations} from "./Location";
|
||||||
import {Player} from "./Player.js";
|
import {Player} from "./Player";
|
||||||
import {hackWorldDaemon, redPillFlag} from "./RedPill.js";
|
import {hackWorldDaemon, redPillFlag} from "./RedPill";
|
||||||
import {KEY} from "./Terminal.js";
|
import {KEY} from "./Terminal";
|
||||||
|
|
||||||
import {dialogBoxCreate} from "../utils/DialogBox.js";
|
import {dialogBoxCreate} from "../utils/DialogBox";
|
||||||
import {getRandomInt, addOffset, clearObject,
|
import {getRandomInt, addOffset, clearObject,
|
||||||
createElement, removeChildrenFromElement,
|
createElement, removeChildrenFromElement,
|
||||||
exceptionAlert, createPopup, appendLineBreaks,
|
exceptionAlert, createPopup, appendLineBreaks,
|
||||||
removeElementById, removeElement,
|
removeElementById, removeElement,
|
||||||
createProgressBarText} from "../utils/HelperFunctions.js";
|
createProgressBarText} from "../utils/HelperFunctions";
|
||||||
import {Reviver, Generic_toJSON,
|
import {Reviver, Generic_toJSON,
|
||||||
Generic_fromJSON} from "../utils/JSONReviver.js";
|
Generic_fromJSON} from "../utils/JSONReviver";
|
||||||
import numeral from "numeral/min/numeral.min";
|
import numeral from "numeral/min/numeral.min";
|
||||||
import {formatNumber} from "../utils/StringHelperFunctions.js";
|
import {formatNumber} from "../utils/StringHelperFunctions";
|
||||||
|
|
||||||
|
|
||||||
var CityNames = ["Aevum", "Chongqing", "Sector-12", "New Tokyo", "Ishima", "Volhaven"];
|
var CityNames = ["Aevum", "Chongqing", "Sector-12", "New Tokyo", "Ishima", "Volhaven"];
|
||||||
@ -3208,6 +3208,7 @@ Bladeburner.prototype.getActionIdFromTypeAndName = function(type="", name="") {
|
|||||||
switch (convertedType) {
|
switch (convertedType) {
|
||||||
case "contract":
|
case "contract":
|
||||||
case "contracts":
|
case "contracts":
|
||||||
|
case "contr":
|
||||||
action.type = ActionTypes["Contract"];
|
action.type = ActionTypes["Contract"];
|
||||||
if (this.contracts.hasOwnProperty(name)) {
|
if (this.contracts.hasOwnProperty(name)) {
|
||||||
action.name = name;
|
action.name = name;
|
||||||
@ -3268,24 +3269,23 @@ Bladeburner.prototype.getActionIdFromTypeAndName = function(type="", name="") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Bladeburner.prototype.getContractNamesNetscriptFn = function(name) {
|
Bladeburner.prototype.getContractNamesNetscriptFn = function() {
|
||||||
return Object.keys(this.contracts);
|
return Object.keys(this.contracts);
|
||||||
}
|
}
|
||||||
|
|
||||||
Bladeburner.prototype.getOperationNamesNetscriptFn = function(name) {
|
Bladeburner.prototype.getOperationNamesNetscriptFn = function() {
|
||||||
return Object.keys(this.operations);
|
return Object.keys(this.operations);
|
||||||
}
|
}
|
||||||
|
|
||||||
Bladeburner.prototype.getBlackOpNamesNetscriptFn = function(name) {
|
Bladeburner.prototype.getBlackOpNamesNetscriptFn = function() {
|
||||||
return Object.keys(BlackOperations);
|
return Object.keys(BlackOperations);
|
||||||
}
|
}
|
||||||
|
|
||||||
Bladeburner.prototype.getGeneralActionNamesNetscriptFn = function(name) {
|
Bladeburner.prototype.getGeneralActionNamesNetscriptFn = function() {
|
||||||
return Object.keys(GeneralActions);
|
return Object.keys(GeneralActions);
|
||||||
}
|
}
|
||||||
|
|
||||||
Bladeburner.prototype.getSkillNamesNetscriptFn = function(name) {
|
Bladeburner.prototype.getSkillNamesNetscriptFn = function() {
|
||||||
return Skills.hasOwnProperty(name);
|
|
||||||
return Object.keys(Skills);
|
return Object.keys(Skills);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3428,7 +3428,11 @@ Bladeburner.prototype.getSkillLevelNetscriptFn = function(skillName, workerScrip
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Skills[skillName];
|
if (this.skills[skillName] == null) {
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
return this.skills[skillName];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Bladeburner.prototype.upgradeSkillNetscriptFn = function(skillName, workerScript) {
|
Bladeburner.prototype.upgradeSkillNetscriptFn = function(skillName, workerScript) {
|
||||||
@ -3506,8 +3510,8 @@ Bladeburner.prototype.setTeamSizeNetscriptFn = function(type, name, size, worker
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (actionId.type !== ActionTypes["Operation"] ||
|
if (actionId.type !== ActionTypes["Operation"] &&
|
||||||
actionId.type !== ActionTypes["BlackOp"] ||
|
actionId.type !== ActionTypes["BlackOp"] &&
|
||||||
actionId.type !== ActionTypes["BlackOperation"]) {
|
actionId.type !== ActionTypes["BlackOperation"]) {
|
||||||
workerScript.log("ERROR: Bladeburner.setTeamSize() failed. This function " +
|
workerScript.log("ERROR: Bladeburner.setTeamSize() failed. This function " +
|
||||||
"only works for Operations and BlackOps");
|
"only works for Operations and BlackOps");
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import {Engine} from "./engine.js";
|
import {Engine} from "./engine";
|
||||||
|
|
||||||
import {removeChildrenFromElement,
|
import {removeChildrenFromElement,
|
||||||
createElement, exceptionAlert} from "../utils/HelperFunctions.js";
|
createElement, exceptionAlert} from "../utils/HelperFunctions";
|
||||||
import {isString} from "../utils/StringHelperFunctions.js";
|
import {isString} from "../utils/StringHelperFunctions";
|
||||||
|
|
||||||
var cinematicTextFlag = false;
|
var cinematicTextFlag = false;
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import {CONSTANTS} from "./Constants.js";
|
import {CONSTANTS} from "./Constants";
|
||||||
import {Locations} from "./Location.js";
|
import {Locations} from "./Location";
|
||||||
import {Player} from "./Player.js";
|
import {Player} from "./Player";
|
||||||
|
|
||||||
import {Reviver, Generic_toJSON,
|
import {Reviver, Generic_toJSON,
|
||||||
Generic_fromJSON} from "../utils/JSONReviver.js";
|
Generic_fromJSON} from "../utils/JSONReviver";
|
||||||
|
|
||||||
//Netburner Company class
|
//Netburner Company class
|
||||||
// Note: Company Positions can be loaded every time with init() but Company class needs
|
// Note: Company Positions can be loaded every time with init() but Company class needs
|
||||||
|
@ -1 +0,0 @@
|
|||||||
//TODO probably just move this to whatever file needs it then delete this
|
|
@ -1,25 +1,25 @@
|
|||||||
import {BitNodeMultipliers} from "./BitNode.js";
|
import {BitNodeMultipliers} from "./BitNode";
|
||||||
import {Engine} from "./engine.js";
|
import {Engine} from "./engine";
|
||||||
import {Factions} from "./Faction.js";
|
import {Factions} from "./Faction";
|
||||||
import {showLiterature} from "./Literature.js";
|
import {showLiterature} from "./Literature";
|
||||||
import {Locations} from "./Location.js";
|
import {Locations} from "./Location";
|
||||||
import {Player} from "./Player.js";
|
import {Player} from "./Player";
|
||||||
|
|
||||||
import Decimal from "decimal.js";
|
import Decimal from "decimal.js";
|
||||||
import {dialogBoxCreate} from "../utils/DialogBox.js";
|
import {dialogBoxCreate} from "../utils/DialogBox";
|
||||||
import {getRandomInt, removeElementById,
|
import {getRandomInt, removeElementById,
|
||||||
createElement, createAccordionElement,
|
createElement, createAccordionElement,
|
||||||
removeChildrenFromElement, createPopup,
|
removeChildrenFromElement, createPopup,
|
||||||
clearSelector} from "../utils/HelperFunctions.js";
|
clearSelector} from "../utils/HelperFunctions";
|
||||||
import {Reviver, Generic_toJSON,
|
import {Reviver, Generic_toJSON,
|
||||||
Generic_fromJSON} from "../utils/JSONReviver.js";
|
Generic_fromJSON} from "../utils/JSONReviver";
|
||||||
import numeral from "numeral/min/numeral.min";
|
import numeral from "numeral/min/numeral.min";
|
||||||
import {formatNumber, isString, generateRandomString} from "../utils/StringHelperFunctions.js";
|
import {formatNumber, isString, generateRandomString} from "../utils/StringHelperFunctions";
|
||||||
import {yesNoBoxCreate, yesNoTxtInpBoxCreate,
|
import {yesNoBoxCreate, yesNoTxtInpBoxCreate,
|
||||||
yesNoBoxGetYesButton, yesNoBoxGetNoButton,
|
yesNoBoxGetYesButton, yesNoBoxGetNoButton,
|
||||||
yesNoTxtInpBoxGetYesButton, yesNoTxtInpBoxGetNoButton,
|
yesNoTxtInpBoxGetYesButton, yesNoTxtInpBoxGetNoButton,
|
||||||
yesNoTxtInpBoxGetInput, yesNoBoxClose,
|
yesNoTxtInpBoxGetInput, yesNoBoxClose,
|
||||||
yesNoTxtInpBoxClose, yesNoBoxOpen} from "../utils/YesNoBox.js";
|
yesNoTxtInpBoxClose, yesNoBoxOpen} from "../utils/YesNoBox";
|
||||||
|
|
||||||
/* State */
|
/* State */
|
||||||
var companyStates = ["START", "PURCHASE", "PRODUCTION", "SALE", "EXPORT"];
|
var companyStates = ["START", "PURCHASE", "PRODUCTION", "SALE", "EXPORT"];
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
let CONSTANTS = {
|
let CONSTANTS = {
|
||||||
Version: "0.38.1",
|
Version: "0.39.0",
|
||||||
|
|
||||||
//Max level for any skill, assuming no multipliers. Determined by max numerical value in javascript for experience
|
//Max level for any skill, assuming no multipliers. Determined by max numerical value in javascript for experience
|
||||||
//and the skill level formula in Player.js. Note that all this means it that when experience hits MAX_INT, then
|
//and the skill level formula in Player.js. Note that all this means it that when experience hits MAX_INT, then
|
||||||
@ -106,8 +106,8 @@ let CONSTANTS = {
|
|||||||
TorRouterCost: 200000,
|
TorRouterCost: 200000,
|
||||||
|
|
||||||
//Infiltration constants
|
//Infiltration constants
|
||||||
InfiltrationBribeBaseAmount: 100000, //Amount per clearance level
|
InfiltrationBribeBaseAmount: 100e3, //Amount per clearance level
|
||||||
InfiltrationMoneyValue: 2500, //Convert "secret" value to money
|
InfiltrationMoneyValue: 3e3, //Convert "secret" value to money
|
||||||
InfiltrationRepValue: 1.4, //Convert "secret" value to faction reputation
|
InfiltrationRepValue: 1.4, //Convert "secret" value to faction reputation
|
||||||
|
|
||||||
//Stock market constants
|
//Stock market constants
|
||||||
@ -489,15 +489,8 @@ let CONSTANTS = {
|
|||||||
"World Stock Exchange account and TIX API Access<br>",
|
"World Stock Exchange account and TIX API Access<br>",
|
||||||
|
|
||||||
LatestUpdate:
|
LatestUpdate:
|
||||||
"v0.38.1<br>" +
|
"v0.39.1<br>" +
|
||||||
"* Added 'var' declarations in Netscript 1.0 (only works with 'var', not 'let' or 'const')<br>" +
|
"* The setting to suppress the confirmation box when purchasing Augmentations was moved into the main Options menu (by Github user hydroflame)<br>"
|
||||||
"* Script base RAM cost is now 1.6 GB (increased from 1.4 GB)<br>" +
|
|
||||||
"* While/for loops and if statements no longer cost RAM in scripts<br>" +
|
|
||||||
"* Made short-circuit evaluation logic more consistent in Netscript 1.0 (see https://github.com/danielyxie/bitburner/issues/308)<br>" +
|
|
||||||
"* Changelog button in the Options menu now links to the new Changelog URL (by Github user thePalindrome)<br>" +
|
|
||||||
"* Skill level calculation is now 'smoother' (by Github user hydroflame)<br>" +
|
|
||||||
"* Added a button to 'beautify' scripts in the text editor (by Github user hydroflame)<br>" +
|
|
||||||
"* Added favicon (by Github user kopelli)"
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,139 +1,128 @@
|
|||||||
import {CONSTANTS} from "./Constants.js";
|
import {CONSTANTS} from "./Constants";
|
||||||
import {Player} from "./Player.js";
|
import {Player} from "./Player";
|
||||||
import {createElement} from "../utils/HelperFunctions.js";
|
import {createElement} from "../utils/HelperFunctions";
|
||||||
|
|
||||||
|
// a function that returns a requirement for a program that requires only that
|
||||||
|
// the player has at least the given skill level.
|
||||||
|
function requireLevel(lvl) {
|
||||||
|
return function() {
|
||||||
|
return Player.hacking_skill >= lvl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function Program(name, create) {
|
||||||
|
this.name = name;
|
||||||
|
this.create = create;
|
||||||
|
}
|
||||||
|
|
||||||
|
Program.prototype.htmlID = function() {
|
||||||
|
const name = this.name.endsWith('.exe') ? this.name.slice(0, -('.exe'.length)) : this.name;
|
||||||
|
return "create-program-"+name;
|
||||||
|
}
|
||||||
|
|
||||||
/* Create programs */
|
/* Create programs */
|
||||||
let Programs = {
|
const Programs = {
|
||||||
NukeProgram: "NUKE.exe",
|
NukeProgram: new Program("NUKE.exe", {
|
||||||
BruteSSHProgram: "BruteSSH.exe",
|
level: 1,
|
||||||
FTPCrackProgram: "FTPCrack.exe",
|
tooltip:"This virus is used to gain root access to a machine if enough ports are opened.",
|
||||||
RelaySMTPProgram: "relaySMTP.exe",
|
req: requireLevel(1),
|
||||||
HTTPWormProgram: "HTTPWorm.exe",
|
time: CONSTANTS.MillisecondsPerFiveMinutes,
|
||||||
SQLInjectProgram: "SQLInject.exe",
|
}),
|
||||||
DeepscanV1: "DeepscanV1.exe",
|
BruteSSHProgram: new Program("BruteSSH.exe", {
|
||||||
DeepscanV2: "DeepscanV2.exe",
|
level: 50,
|
||||||
ServerProfiler: "ServerProfiler.exe",
|
tooltip:"This program executes a brute force attack that opens SSH ports",
|
||||||
AutoLink: "AutoLink.exe",
|
req: requireLevel(50),
|
||||||
Flight: "fl1ght.exe",
|
time: CONSTANTS.MillisecondsPerFiveMinutes * 2,
|
||||||
BitFlume: "b1t_flum3.exe"
|
}),
|
||||||
|
FTPCrackProgram: new Program("FTPCrack.exe", {
|
||||||
|
level: 100,
|
||||||
|
tooltip:"This program cracks open FTP ports",
|
||||||
|
req: requireLevel(100),
|
||||||
|
time: CONSTANTS.MillisecondsPerHalfHour,
|
||||||
|
}),
|
||||||
|
RelaySMTPProgram: new Program("relaySMTP.exe", {
|
||||||
|
level: 250,
|
||||||
|
tooltip:"This program opens SMTP ports by redirecting data",
|
||||||
|
req: requireLevel(250),
|
||||||
|
time: CONSTANTS.MillisecondsPer2Hours,
|
||||||
|
}),
|
||||||
|
HTTPWormProgram: new Program("HTTPWorm.exe", {
|
||||||
|
level: 500,
|
||||||
|
tooltip:"This virus opens up HTTP ports",
|
||||||
|
req: requireLevel(500),
|
||||||
|
time: CONSTANTS.MillisecondsPer4Hours,
|
||||||
|
}),
|
||||||
|
SQLInjectProgram: new Program("SQLInject.exe", {
|
||||||
|
level: 750,
|
||||||
|
tooltip:"This virus opens SQL ports",
|
||||||
|
req: requireLevel(750),
|
||||||
|
time: CONSTANTS.MillisecondsPer8Hours,
|
||||||
|
}),
|
||||||
|
DeepscanV1: new Program("DeepscanV1.exe", {
|
||||||
|
level: 75,
|
||||||
|
tooltip:"This program allows you to use the scan-analyze command with a depth up to 5",
|
||||||
|
req: requireLevel(75),
|
||||||
|
time: CONSTANTS.MillisecondsPerQuarterHour,
|
||||||
|
}),
|
||||||
|
DeepscanV2: new Program("DeepscanV2.exe", {
|
||||||
|
level: 400,
|
||||||
|
tooltip:"This program allows you to use the scan-analyze command with a depth up to 10",
|
||||||
|
req: requireLevel(400),
|
||||||
|
time: CONSTANTS.MillisecondsPer2Hours,
|
||||||
|
}),
|
||||||
|
ServerProfiler: new Program("ServerProfiler.exe", {
|
||||||
|
level: 75,
|
||||||
|
tooltip:"This program is used to display hacking and Netscript-related information about servers",
|
||||||
|
req: requireLevel(75),
|
||||||
|
time: CONSTANTS.MillisecondsPerHalfHour,
|
||||||
|
}),
|
||||||
|
AutoLink: new Program("AutoLink.exe", {
|
||||||
|
level: 25,
|
||||||
|
tooltip:"This program allows you to directly connect to other servers through the 'scan-analyze' command",
|
||||||
|
req: requireLevel(25),
|
||||||
|
time: CONSTANTS.MillisecondsPerQuarterHour,
|
||||||
|
}),
|
||||||
|
BitFlume: new Program("b1t_flum3.exe", {
|
||||||
|
level: 5,
|
||||||
|
tooltip:"This program creates a portal to the BitNode Nexus (allows you to restart and switch BitNodes)",
|
||||||
|
req: function() {return Player.sourceFiles.length > 0 && Player.hacking_skill >= 5},
|
||||||
|
time: CONSTANTS.MillisecondsPerFiveMinutes / 5,
|
||||||
|
}),
|
||||||
|
// special because you can't create it.
|
||||||
|
Flight: new Program("fl1ght.exe"),
|
||||||
};
|
};
|
||||||
|
|
||||||
var nukeALink, bruteSshALink, ftpCrackALink, relaySmtpALink, httpWormALink, sqlInjectALink,
|
// this has the same key as 'Programs', not program names
|
||||||
deepscanv1ALink, deepscanv2ALink, servProfilerALink, autolinkALink, bitFlumeALink;
|
const aLinks = {};
|
||||||
function displayCreateProgramContent() {
|
|
||||||
nukeALink.style.display = "none";
|
|
||||||
bruteSshALink.style.display = "none";
|
|
||||||
ftpCrackALink.style.display = "none";
|
|
||||||
relaySmtpALink.style.display = "none";
|
|
||||||
httpWormALink.style.display = "none";
|
|
||||||
sqlInjectALink.style.display = "none";
|
|
||||||
deepscanv1ALink.style.display = "none";
|
|
||||||
deepscanv2ALink.style.display = "none";
|
|
||||||
servProfilerALink.style.display = "none";
|
|
||||||
autolinkALink.style.display = "none";
|
|
||||||
bitFlumeALink.style.display = "none";
|
|
||||||
|
|
||||||
//NUKE.exe (in case you delete it lol)
|
function displayCreateProgramContent() {
|
||||||
if (Player.getHomeComputer().programs.indexOf(Programs.NukeProgram) == -1) {
|
for(const key in aLinks) {
|
||||||
nukeALink.style.display = "inline-block";
|
const p = Programs[key]
|
||||||
}
|
aLinks[key].style.display = "none";
|
||||||
//BruteSSH
|
if(!Player.hasProgram(p.name) && p.create.req()){
|
||||||
if (Player.getHomeComputer().programs.indexOf(Programs.BruteSSHProgram) == -1 &&
|
aLinks[key].style.display = "inline-block";
|
||||||
Player.hacking_skill >= 50) {
|
}
|
||||||
bruteSshALink.style.display = "inline-block";
|
|
||||||
}
|
|
||||||
//FTPCrack
|
|
||||||
if (Player.getHomeComputer().programs.indexOf(Programs.FTPCrackProgram) == -1 &&
|
|
||||||
Player.hacking_skill >= 100) {
|
|
||||||
ftpCrackALink.style.display = "inline-block";
|
|
||||||
}
|
|
||||||
//relaySMTP
|
|
||||||
if (Player.getHomeComputer().programs.indexOf(Programs.RelaySMTPProgram) == -1 &&
|
|
||||||
Player.hacking_skill >= 250) {
|
|
||||||
relaySmtpALink.style.display = "inline-block";
|
|
||||||
}
|
|
||||||
//HTTPWorm
|
|
||||||
if (Player.getHomeComputer().programs.indexOf(Programs.HTTPWormProgram) == -1 &&
|
|
||||||
Player.hacking_skill >= 500) {
|
|
||||||
httpWormALink.style.display = "inline-block";
|
|
||||||
}
|
|
||||||
//SQLInject
|
|
||||||
if (Player.getHomeComputer().programs.indexOf(Programs.SQLInjectProgram) == -1 &&
|
|
||||||
Player.hacking_skill >= 750) {
|
|
||||||
sqlInjectALink.style.display = "inline-block";
|
|
||||||
}
|
|
||||||
//Deepscan V1 and V2
|
|
||||||
if (!Player.hasProgram(Programs.DeepscanV1) && Player.hacking_skill >= 75) {
|
|
||||||
deepscanv1ALink.style.display = "inline-block";
|
|
||||||
}
|
|
||||||
if (!Player.hasProgram(Programs.DeepscanV2) && Player.hacking_skill >= 400) {
|
|
||||||
deepscanv2ALink.style.display = "inline-block";
|
|
||||||
}
|
|
||||||
//Server profiler
|
|
||||||
if (!Player.hasProgram(Programs.ServerProfiler) && Player.hacking_skill >= 75) {
|
|
||||||
servProfilerALink.style.display = "inline-block";
|
|
||||||
}
|
|
||||||
//Auto Link
|
|
||||||
if (!Player.hasProgram(Programs.AutoLink) && Player.hacking_skill >= 25) {
|
|
||||||
autolinkALink.style.display = "inline-block";
|
|
||||||
}
|
|
||||||
//Bit Flume
|
|
||||||
if (!Player.hasProgram(Programs.BitFlume) && Player.sourceFiles.length > 0 && Player.hacking_skill >= 5) {
|
|
||||||
bitFlumeALink.style.display = "inline-block";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Returns the number of programs that are currently available to be created
|
//Returns the number of programs that are currently available to be created
|
||||||
function getNumAvailableCreateProgram() {
|
function getNumAvailableCreateProgram() {
|
||||||
var count = 0;
|
var count = 0;
|
||||||
//PortHack.exe (in case you delete it lol)
|
for(const key in Programs) {
|
||||||
if (Player.getHomeComputer().programs.indexOf(Programs.NukeProgram) == -1) {
|
if(Programs[key].create === undefined) { // a program we can't create
|
||||||
++count;
|
continue
|
||||||
}
|
}
|
||||||
//BruteSSH
|
if(Player.hasProgram(Programs[key].name)) { // can't create it twice
|
||||||
if (Player.getHomeComputer().programs.indexOf(Programs.BruteSSHProgram) == -1 &&
|
continue
|
||||||
Player.hacking_skill >= 50) {
|
}
|
||||||
++count;
|
|
||||||
}
|
if(!Programs[key].create.req()) { // if you don't fullfill the creation requirement
|
||||||
//FTPCrack
|
continue
|
||||||
if (Player.getHomeComputer().programs.indexOf(Programs.FTPCrackProgram) == -1 &&
|
}
|
||||||
Player.hacking_skill >= 100) {
|
|
||||||
++count;
|
count++;
|
||||||
}
|
|
||||||
//relaySMTP
|
|
||||||
if (Player.getHomeComputer().programs.indexOf(Programs.RelaySMTPProgram) == -1 &&
|
|
||||||
Player.hacking_skill >= 250) {
|
|
||||||
++count;
|
|
||||||
}
|
|
||||||
//HTTPWorm
|
|
||||||
if (Player.getHomeComputer().programs.indexOf(Programs.HTTPWormProgram) == -1 &&
|
|
||||||
Player.hacking_skill >= 500) {
|
|
||||||
++count;
|
|
||||||
}
|
|
||||||
//SQLInject
|
|
||||||
if (Player.getHomeComputer().programs.indexOf(Programs.SQLInjectProgram) == -1 &&
|
|
||||||
Player.hacking_skill >= 750) {
|
|
||||||
++count;
|
|
||||||
}
|
|
||||||
//Deepscan V1 and V2
|
|
||||||
if (!Player.hasProgram(Programs.DeepscanV1) && Player.hacking_skill >= 75) {
|
|
||||||
++count;
|
|
||||||
}
|
|
||||||
if (!Player.hasProgram(Programs.DeepscanV2) && Player.hacking_skill >= 400) {
|
|
||||||
++count;
|
|
||||||
}
|
|
||||||
//Server profiler
|
|
||||||
if (!Player.hasProgram(Programs.ServerProfiler) && Player.hacking_skill >= 75) {
|
|
||||||
++count;
|
|
||||||
}
|
|
||||||
//Auto link
|
|
||||||
if (!Player.hasProgram(Programs.AutoLink) && Player.hacking_skill >= 25) {
|
|
||||||
++count;
|
|
||||||
}
|
|
||||||
//Bit Flume
|
|
||||||
if (!Player.hasProgram(Programs.BitFlume) && Player.sourceFiles.length > 0 && Player.hacking_skill >= 5) {
|
|
||||||
++count;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Player.firstProgramAvailable === false && count > 0) {
|
if (Player.firstProgramAvailable === false && count > 0) {
|
||||||
Player.firstProgramAvailable = true;
|
Player.firstProgramAvailable = true;
|
||||||
document.getElementById("create-program-tab").style.display = "list-item";
|
document.getElementById("create-program-tab").style.display = "list-item";
|
||||||
@ -145,116 +134,25 @@ function getNumAvailableCreateProgram() {
|
|||||||
|
|
||||||
function initCreateProgramButtons() {
|
function initCreateProgramButtons() {
|
||||||
var createProgramList = document.getElementById("create-program-list");
|
var createProgramList = document.getElementById("create-program-list");
|
||||||
nukeALink = createElement("a", {
|
for(const key in Programs) {
|
||||||
class:"a-link-button", id:"create-program-nuke", innerText:Programs.NukeProgram,
|
if(Programs[key].create === undefined) {
|
||||||
tooltip:"This virus is used to gain root access to a machine if enough ports are opened.",
|
continue
|
||||||
});
|
}
|
||||||
createProgramList.appendChild(nukeALink);
|
const elem = createElement("a", {
|
||||||
|
class: "a-link-button", id: Programs[key].htmlID(), innerText: Programs[key].name,
|
||||||
|
tooltip: Programs[key].create.tooltip,
|
||||||
|
});
|
||||||
|
aLinks[key] = elem;
|
||||||
|
createProgramList.appendChild(elem);
|
||||||
|
}
|
||||||
|
|
||||||
bruteSshALink = createElement("a", {
|
for(const key in aLinks) {
|
||||||
class:"a-link-button", id:"create-program-brutessh", innerText:Programs.BruteSSHProgram,
|
const p = Programs[key]
|
||||||
tooltip:"This program executes a brute force attack that opens SSH ports"
|
aLinks[key].addEventListener("click", function() {
|
||||||
});
|
Player.startCreateProgramWork(p.name, p.create.time, p.create.level);
|
||||||
createProgramList.appendChild(bruteSshALink);
|
return false;
|
||||||
|
});
|
||||||
ftpCrackALink = createElement("a", {
|
}
|
||||||
class:"a-link-button", id:"create-program-ftpcrack", innerText:Programs.FTPCrackProgram,
|
|
||||||
tooltip:"This program cracks open FTP ports"
|
|
||||||
});
|
|
||||||
createProgramList.appendChild(ftpCrackALink);
|
|
||||||
|
|
||||||
relaySmtpALink = createElement("a", {
|
|
||||||
class:"a-link-button", id:"create-program-relaysmtp", innerText:Programs.RelaySMTPProgram,
|
|
||||||
tooltip:"This program opens SMTP ports by redirecting data"
|
|
||||||
}) ;
|
|
||||||
createProgramList.appendChild(relaySmtpALink);
|
|
||||||
|
|
||||||
httpWormALink = createElement("a", {
|
|
||||||
class:"a-link-button", id:"create-program-httpworm", innerText:Programs.HTTPWormProgram,
|
|
||||||
tooltip:"This virus opens up HTTP ports"
|
|
||||||
});
|
|
||||||
createProgramList.appendChild(httpWormALink);
|
|
||||||
|
|
||||||
sqlInjectALink = createElement("a", {
|
|
||||||
class:"a-link-button", id:"create-program-sqlinject", innerText:Programs.SQLInjectProgram,
|
|
||||||
tooltip:"This virus opens SQL ports"
|
|
||||||
});
|
|
||||||
createProgramList.appendChild(sqlInjectALink);
|
|
||||||
|
|
||||||
deepscanv1ALink = createElement("a", {
|
|
||||||
class:"a-link-button", id:"create-program-deepscanv1", innerText:Programs.DeepscanV1,
|
|
||||||
tooltip:"This program allows you to use the scan-analyze command with a depth up to 5"
|
|
||||||
});
|
|
||||||
createProgramList.appendChild(deepscanv1ALink);
|
|
||||||
|
|
||||||
deepscanv2ALink = createElement("a", {
|
|
||||||
class:"a-link-button", id:"create-program-deepscanv2", innerText:Programs.DeepscanV2,
|
|
||||||
tooltip:"This program allows you to use the scan-analyze command with a depth up to 10"
|
|
||||||
});
|
|
||||||
createProgramList.appendChild(deepscanv2ALink);
|
|
||||||
|
|
||||||
servProfilerALink = createElement("a", {
|
|
||||||
class:"a-link-button", id:"create-program-serverprofiler", innerText:Programs.ServerProfiler,
|
|
||||||
tooltip:"This program is used to display hacking and Netscript-related information about servers"
|
|
||||||
});
|
|
||||||
createProgramList.appendChild(servProfilerALink);
|
|
||||||
|
|
||||||
bitFlumeALink = createElement("a", {
|
|
||||||
class:"a-link-button", id:"create-program-bitflume", innerText:Programs.BitFlume,
|
|
||||||
tooltip:"This program creates a portal to the BitNode Nexus (allows you to restart and switch BitNodes)"
|
|
||||||
});
|
|
||||||
createProgramList.appendChild(bitFlumeALink);
|
|
||||||
|
|
||||||
autolinkALink = createElement("a", {
|
|
||||||
class:"a-link-button", id:"create-program-autolink", innerText:"AutoLink.exe",
|
|
||||||
tooltip:"This program allows you to directly connect to other servers through the 'scan-analyze' command"
|
|
||||||
});
|
|
||||||
createProgramList.appendChild(autolinkALink);
|
|
||||||
|
|
||||||
nukeALink.addEventListener("click", function() {
|
|
||||||
Player.startCreateProgramWork(Programs.NukeProgram, CONSTANTS.MillisecondsPerFiveMinutes, 1);
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
bruteSshALink.addEventListener("click", function() {
|
|
||||||
Player.startCreateProgramWork(Programs.BruteSSHProgram, CONSTANTS.MillisecondsPerFiveMinutes * 2, 50);
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
ftpCrackALink.addEventListener("click", function() {
|
|
||||||
Player.startCreateProgramWork(Programs.FTPCrackProgram, CONSTANTS.MillisecondsPerHalfHour, 100);
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
relaySmtpALink.addEventListener("click", function() {
|
|
||||||
Player.startCreateProgramWork(Programs.RelaySMTPProgram, CONSTANTS.MillisecondsPer2Hours, 250);
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
httpWormALink.addEventListener("click", function() {
|
|
||||||
Player.startCreateProgramWork(Programs.HTTPWormProgram, CONSTANTS.MillisecondsPer4Hours, 500);
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
sqlInjectALink.addEventListener("click", function() {
|
|
||||||
Player.startCreateProgramWork(Programs.SQLInjectProgram, CONSTANTS.MillisecondsPer8Hours, 750);
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
deepscanv1ALink.addEventListener("click", function() {
|
|
||||||
Player.startCreateProgramWork(Programs.DeepscanV1, CONSTANTS.MillisecondsPerQuarterHour, 75);
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
deepscanv2ALink.addEventListener("click", function() {
|
|
||||||
Player.startCreateProgramWork(Programs.DeepscanV2, CONSTANTS.MillisecondsPer2Hours, 400);
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
servProfilerALink.addEventListener("click", function() {
|
|
||||||
Player.startCreateProgramWork(Programs.ServerProfiler, CONSTANTS.MillisecondsPerHalfHour, 75);
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
autolinkALink.addEventListener("click", function() {
|
|
||||||
Player.startCreateProgramWork(Programs.AutoLink, CONSTANTS.MillisecondsPerQuarterHour, 25);
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
bitFlumeALink.addEventListener("click", function() {
|
|
||||||
Player.startCreateProgramWork(Programs.BitFlume, CONSTANTS.MillisecondsPerFiveMinutes / 5, 5);
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export {Programs, displayCreateProgramContent, getNumAvailableCreateProgram,
|
export {Programs, displayCreateProgramContent, getNumAvailableCreateProgram,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import {CONSTANTS} from "./Constants.js";
|
import {CONSTANTS} from "./Constants";
|
||||||
import {Player} from "./Player.js";
|
import {Player} from "./Player";
|
||||||
import {dialogBoxCreate} from "../utils/DialogBox.js";
|
import {dialogBoxCreate} from "../utils/DialogBox";
|
||||||
|
|
||||||
|
|
||||||
function Crime(name, type, time, money, difficulty, karma, params) {
|
function Crime(name, type, time, money, difficulty, karma, params) {
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import {Programs} from "./CreateProgram.js";
|
import {Programs} from "./CreateProgram";
|
||||||
import {Player} from "./Player.js";
|
import {Player} from "./Player";
|
||||||
import {SpecialServerIps} from "./SpecialServerIps.js";
|
import {SpecialServerIps} from "./SpecialServerIps";
|
||||||
import {post} from "./Terminal.js";
|
import {post} from "./Terminal";
|
||||||
|
|
||||||
import {isValidIPAddress} from "../utils/IPAddress.js";
|
import {isValidIPAddress} from "../utils/IPAddress";
|
||||||
import {formatNumber} from "../utils/StringHelperFunctions.js";
|
import {formatNumber} from "../utils/StringHelperFunctions";
|
||||||
|
|
||||||
|
|
||||||
/* DarkWeb.js */
|
/* DarkWeb.js */
|
||||||
@ -102,14 +102,14 @@ DarkWebItem.prototype.toString = function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const DarkWebItems = {
|
const DarkWebItems = {
|
||||||
BruteSSHProgram: new DarkWebItem(Programs.BruteSSHProgram, 500000, "Opens up SSH Ports"),
|
BruteSSHProgram: new DarkWebItem(Programs.BruteSSHProgram.name, 500000, "Opens up SSH Ports"),
|
||||||
FTPCrackProgram: new DarkWebItem(Programs.FTPCrackProgram, 1500000, "Opens up FTP Ports"),
|
FTPCrackProgram: new DarkWebItem(Programs.FTPCrackProgram.name, 1500000, "Opens up FTP Ports"),
|
||||||
RelaySMTPProgram: new DarkWebItem(Programs.RelaySMTPProgram, 5000000, "Opens up SMTP Ports"),
|
RelaySMTPProgram: new DarkWebItem(Programs.RelaySMTPProgram.name, 5000000, "Opens up SMTP Ports"),
|
||||||
HTTPWormProgram: new DarkWebItem(Programs.HTTPWormProgram, 30000000, "Opens up HTTP Ports"),
|
HTTPWormProgram: new DarkWebItem(Programs.HTTPWormProgram.name, 30000000, "Opens up HTTP Ports"),
|
||||||
SQLInjectProgram: new DarkWebItem(Programs.SQLInjectProgram, 250000000, "Opens up SQL Ports"),
|
SQLInjectProgram: new DarkWebItem(Programs.SQLInjectProgram.name, 250000000, "Opens up SQL Ports"),
|
||||||
DeepscanV1: new DarkWebItem(Programs.DeepscanV1, 500000, "Enables 'scan-analyze' with a depth up to 5"),
|
DeepscanV1: new DarkWebItem(Programs.DeepscanV1.name, 500000, "Enables 'scan-analyze' with a depth up to 5"),
|
||||||
DeepscanV2: new DarkWebItem(Programs.DeepscanV2, 25000000, "Enables 'scan-analyze' with a depth up to 10"),
|
DeepscanV2: new DarkWebItem(Programs.DeepscanV2.name, 25000000, "Enables 'scan-analyze' with a depth up to 10"),
|
||||||
AutolinkProgram: new DarkWebItem(Programs.AutoLink, 1000000, "Enables direct connect via 'scan-analyze'"),
|
AutolinkProgram: new DarkWebItem(Programs.AutoLink.name, 1000000, "Enables direct connect via 'scan-analyze'"),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,24 +1,24 @@
|
|||||||
import {Augmentations, AugmentationNames,
|
import {Augmentations, AugmentationNames,
|
||||||
PlayerOwnedAugmentation} from "./Augmentations.js";
|
PlayerOwnedAugmentation} from "./Augmentations";
|
||||||
import {BitNodeMultipliers} from "./BitNode.js";
|
import {BitNodeMultipliers} from "./BitNode";
|
||||||
import {CONSTANTS} from "./Constants.js";
|
import {CONSTANTS} from "./Constants";
|
||||||
import {Engine} from "./engine.js";
|
import {Engine} from "./engine";
|
||||||
import {FactionInfos} from "./FactionInfo.js";
|
import {FactionInfos} from "./FactionInfo";
|
||||||
import {Locations} from "./Location.js";
|
import {Locations} from "./Location";
|
||||||
import {HackingMission, setInMission} from "./Missions.js";
|
import {HackingMission, setInMission} from "./Missions";
|
||||||
import {Player} from "./Player.js";
|
import {Player} from "./Player";
|
||||||
import {Settings} from "./Settings.js";
|
import {Settings} from "./Settings";
|
||||||
|
|
||||||
import {dialogBoxCreate} from "../utils/DialogBox.js";
|
import {dialogBoxCreate} from "../utils/DialogBox";
|
||||||
import {factionInvitationBoxCreate} from "../utils/FactionInvitationBox.js";
|
import {factionInvitationBoxCreate} from "../utils/FactionInvitationBox";
|
||||||
import {clearEventListeners, createElement,
|
import {clearEventListeners, createElement,
|
||||||
removeChildrenFromElement} from "../utils/HelperFunctions.js";
|
removeChildrenFromElement} from "../utils/HelperFunctions";
|
||||||
import {Reviver, Generic_toJSON,
|
import {Reviver, Generic_toJSON,
|
||||||
Generic_fromJSON} from "../utils/JSONReviver.js";
|
Generic_fromJSON} from "../utils/JSONReviver";
|
||||||
import numeral from "numeral/min/numeral.min";
|
import numeral from "numeral/min/numeral.min";
|
||||||
import {formatNumber} from "../utils/StringHelperFunctions.js";
|
import {formatNumber} from "../utils/StringHelperFunctions";
|
||||||
import {yesNoBoxCreate, yesNoBoxGetYesButton,
|
import {yesNoBoxCreate, yesNoBoxGetYesButton,
|
||||||
yesNoBoxGetNoButton, yesNoBoxClose} from "../utils/YesNoBox.js";
|
yesNoBoxGetNoButton, yesNoBoxClose} from "../utils/YesNoBox";
|
||||||
|
|
||||||
function Faction(name="") {
|
function Faction(name="") {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
@ -439,7 +439,6 @@ function displayFactionContent(factionName) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var confirmingPurchases = true;
|
|
||||||
var sortOption = null;
|
var sortOption = null;
|
||||||
function displayFactionAugmentations(factionName) {
|
function displayFactionAugmentations(factionName) {
|
||||||
var faction = Factions[factionName];
|
var faction = Factions[factionName];
|
||||||
@ -468,19 +467,6 @@ function displayFactionAugmentations(factionName) {
|
|||||||
"Augmentations are powerful upgrades that will enhance your abilities."
|
"Augmentations are powerful upgrades that will enhance your abilities."
|
||||||
}));
|
}));
|
||||||
|
|
||||||
//Confirming not confirming button
|
|
||||||
elements.push(createElement("label", {
|
|
||||||
for:"faction-augmentations-confirming-checkbox",innerText:"Confirm Purchases",
|
|
||||||
color:"white", margin:"4px", padding:"4px",
|
|
||||||
}));
|
|
||||||
var confirmingPurchasesCheckbox = createElement("input", {
|
|
||||||
type:"checkbox", id:"faction-augmentations-confirming-checkbox", checked:confirmingPurchases,
|
|
||||||
margin:"4px", padding:"4px",
|
|
||||||
clickListener:()=>{
|
|
||||||
confirmingPurchases = confirmingPurchasesCheckbox.checked;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
elements.push(confirmingPurchasesCheckbox);
|
|
||||||
elements.push(createElement("br"));
|
elements.push(createElement("br"));
|
||||||
elements.push(createElement("br"));
|
elements.push(createElement("br"));
|
||||||
|
|
||||||
@ -585,7 +571,8 @@ function createFactionAugmentationDisplayElements(augmentationsList, augs, facti
|
|||||||
var aElem = createElement("a", {
|
var aElem = createElement("a", {
|
||||||
innerText:aug.name, display:"inline",
|
innerText:aug.name, display:"inline",
|
||||||
clickListener:()=>{
|
clickListener:()=>{
|
||||||
if (confirmingPurchases) {
|
console.log('sup buy in fac: '+Settings.SuppressBuyAugmentationConfirmation);
|
||||||
|
if (!Settings.SuppressBuyAugmentationConfirmation) {
|
||||||
purchaseAugmentationBoxCreate(aug, faction);
|
purchaseAugmentationBoxCreate(aug, faction);
|
||||||
} else {
|
} else {
|
||||||
purchaseAugmentation(aug, faction);
|
purchaseAugmentation(aug, faction);
|
||||||
@ -723,10 +710,12 @@ function purchaseAugmentation(aug, fac, sing=false) {
|
|||||||
if (sing) {
|
if (sing) {
|
||||||
return "You purchased " + aug.name;
|
return "You purchased " + aug.name;
|
||||||
} else {
|
} else {
|
||||||
dialogBoxCreate("You purchased " + aug.name + ". It's enhancements will not take " +
|
if(!Settings.SuppressBuyAugmentationConfirmation){
|
||||||
"effect until they are installed. To install your augmentations, go to the " +
|
dialogBoxCreate("You purchased " + aug.name + ". It's enhancements will not take " +
|
||||||
"'Augmentations' tab on the left-hand navigation menu. Purchasing additional " +
|
"effect until they are installed. To install your augmentations, go to the " +
|
||||||
"augmentations will now be more expensive.");
|
"'Augmentations' tab on the left-hand navigation menu. Purchasing additional " +
|
||||||
|
"augmentations will now be more expensive.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
displayFactionAugmentations(fac.name);
|
displayFactionAugmentations(fac.name);
|
||||||
|
@ -1,156 +0,0 @@
|
|||||||
//Contains the "information" property for all the Factions, which is just a description
|
|
||||||
//of each faction
|
|
||||||
function FactionInfo(infoText, enemies, offerHackingMission, offerHackingWork, offerFieldWork, offerSecurityWork) {
|
|
||||||
this.infoText = infoText;
|
|
||||||
this.enemies = enemies;
|
|
||||||
this.offerHackingMission = offerHackingMission;
|
|
||||||
this.offerHackingWork = offerHackingWork;
|
|
||||||
this.offerFieldWork = offerFieldWork;
|
|
||||||
this.offerSecurityWork = offerSecurityWork;
|
|
||||||
|
|
||||||
// these are always all 1 for now.
|
|
||||||
this.augmentationPriceMult = 1;
|
|
||||||
this.augmentationRepRequirementMult = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
const FactionInfos = {
|
|
||||||
//Endgame
|
|
||||||
"Illuminati": new FactionInfo("Humanity never changes. No matter how civilized society becomes, it will eventually fall back " +
|
|
||||||
"into chaos. And from this chaos, we are the Invisible hand that guides them to order. ", [], true, true, true, false),
|
|
||||||
|
|
||||||
"Daedalus": new FactionInfo("Yesterday we obeyed kings and bent our necks to emperors. Today we kneel only to truth.", [], true, true, true, false),
|
|
||||||
|
|
||||||
"The Covenant": new FactionInfo("Surrender yourself. Give up your empty individuality to become part of something great, something eternal. " +
|
|
||||||
"Become a slave. Submit your mind, body, and soul. Only then can you set yourself free.<br><br> " +
|
|
||||||
"Only then can you discover immortality.", [], true, true, true, false),
|
|
||||||
|
|
||||||
//Megacorporations, each forms its own faction
|
|
||||||
"ECorp": new FactionInfo("ECorp's mission is simple: to connect the world of today with the technology of tomorrow. " +
|
|
||||||
"With our wide range of Internet-related software and commercial hardware, ECorp makes the world's " +
|
|
||||||
"information universally accessible.", [], true, true, true, true),
|
|
||||||
|
|
||||||
"MegaCorp": new FactionInfo("MegaCorp does things that others don't. We imagine. We create. We invent. We build things that " +
|
|
||||||
"others have never even dreamed of. Our work fills the world's needs for food, water, power, and " +
|
|
||||||
"transporation on an unprecendented scale, in ways that no other company can.<br><br>" +
|
|
||||||
"In our labs and factories and on the ground with customers, MegaCorp is ushering in a new era for the world.", [], true, true, true, true),
|
|
||||||
|
|
||||||
"Bachman & Associates": new FactionInfo("Where Law and Business meet - thats where we are. <br><br>" +
|
|
||||||
"Legal Insight - Business Instinct - Experience Innovation", [], true, true, true, true),
|
|
||||||
|
|
||||||
"Blade Industries": new FactionInfo("Augmentation is salvation", [], true, true, true, true),
|
|
||||||
|
|
||||||
"NWO": new FactionInfo("The human being does not truly desire freedom. It wants " +
|
|
||||||
"to be observed, understood, and judged. It wants to be given purpose and " +
|
|
||||||
"direction in its life. That is why humans created God. " +
|
|
||||||
"And that is why humans created civilization - " +
|
|
||||||
"not because of willingness, " +
|
|
||||||
"but because of a need to be incorporated into higher orders of structure and meaning.", [], true, true, true, true),
|
|
||||||
|
|
||||||
"Clarke Incorporated": new FactionInfo("Unlocking the power of the genome", [], true, true, true, true),
|
|
||||||
|
|
||||||
"OmniTek Incorporated": new FactionInfo("Simply put, our mission is to design and build robots that make a difference", [], true, true, true, true),
|
|
||||||
|
|
||||||
"Four Sigma": new FactionInfo("The scientific method is the best way to approach investing. Big strategies backed up with big data. Driven by " +
|
|
||||||
"deep learning and innovative ideas. And improved by iteration. That's Four Sigma.", [], true, true, true, true),
|
|
||||||
|
|
||||||
"KuaiGong International": new FactionInfo("Dream big. Work hard. Make history.", [], true, true, true, true),
|
|
||||||
|
|
||||||
//Other Corporations
|
|
||||||
"Fulcrum Secret Technologies": new FactionInfo("The human organism has an innate desire to worship. " +
|
|
||||||
"That is why they created gods. If there were no gods, " +
|
|
||||||
"it would be necessary to create them. And now we can.", [], true, true, false, true),
|
|
||||||
|
|
||||||
//Hacker groups
|
|
||||||
"BitRunners": new FactionInfo("Our entire lives are controlled by bits. All of our actions, our thoughts, our personal information. "+
|
|
||||||
"It's all transformed into bits, stored in bits, communicated through bits. It’s impossible for any person " +
|
|
||||||
"to move, to live, to operate at any level without the use of bits. " +
|
|
||||||
"And when a person moves, lives, and operates, they leave behind their bits, mere traces of seemingly " +
|
|
||||||
"meaningless fragments of information. But these bits can be reconstructed. Transformed. Used.<br><br>" +
|
|
||||||
"Those who run the bits, run the world", [], true, true, false, false),
|
|
||||||
|
|
||||||
|
|
||||||
"The Black Hand": new FactionInfo("The world, so afraid of strong government, now has no government. Only power - Digital power. Financial power. " +
|
|
||||||
"Technological power. " +
|
|
||||||
"And those at the top rule with an invisible hand. They built a society where the rich get richer, " +
|
|
||||||
"and everyone else suffers.<br><br>" +
|
|
||||||
"So much pain. So many lives. Their darkness must end.", [], true, true, true, false),
|
|
||||||
|
|
||||||
"NiteSec": new FactionInfo(
|
|
||||||
" __..__ <br>" +
|
|
||||||
" _.nITESECNIt. <br>" +
|
|
||||||
" .-'NITESECNITESEc. <br>" +
|
|
||||||
" .' NITESECNITESECn <br>" +
|
|
||||||
" / NITESECNITESEC; <br>" +
|
|
||||||
" : :NITESECNITESEC; <br>" +
|
|
||||||
" ; $ NITESECNITESECN <br>" +
|
|
||||||
" : _, ,N'ITESECNITESEC <br>" +
|
|
||||||
" : .+^^`, : `NITESECNIT <br>" +
|
|
||||||
" ) /), `-,-=,NITESECNI <br>" +
|
|
||||||
" / ^ ,-;|NITESECN; <br>" +
|
|
||||||
" / _.' '-';NITESECN <br>" +
|
|
||||||
" ( , ,-''`^NITE' <br>" +
|
|
||||||
" )` :`. .' <br>" +
|
|
||||||
" )-- ; `- / <br>" +
|
|
||||||
" \' _.-' : <br>" +
|
|
||||||
" ( _.-' \. \ <br>" +
|
|
||||||
" \------. \ \ <br>" +
|
|
||||||
" \. \ \ <br>" +
|
|
||||||
" \ _.nIt <br>" +
|
|
||||||
" \ _.nITESECNi <br>" +
|
|
||||||
" nITESECNIT^' \ <br>" +
|
|
||||||
" NITE^' ___ \ <br>" +
|
|
||||||
" / .gP''''Tp. \ <br>" +
|
|
||||||
" : d' . `b \ <br>" +
|
|
||||||
" ; d' o `b ; <br>" +
|
|
||||||
" / d; `b| <br>" +
|
|
||||||
" /, $; @ `: <br>" +
|
|
||||||
" /' $$ ; <br>" +
|
|
||||||
" .' $$b o | <br>" +
|
|
||||||
" .' d$$$; : <br>" +
|
|
||||||
" / .d$$$$; , ; <br>" +
|
|
||||||
" d .dNITESEC $ | <br>" +
|
|
||||||
" :bp.__.gNITESEC$$ :$ ; <br>" +
|
|
||||||
" NITESECNITESECNIT $$b : <br>", [], true, true, false, false),
|
|
||||||
|
|
||||||
//City factions, essentially governments
|
|
||||||
"Chongqing": new FactionInfo("Serve the people", ["Sector-12", "Aevum", "Volhaven"], true, true, true, true),
|
|
||||||
"Sector-12": new FactionInfo("The City of the Future", ["Chongqing", "New Tokyo", "Ishima", "Volhaven"], true, true, true, true),
|
|
||||||
"New Tokyo": new FactionInfo("Asia's World City", ["Sector-12", "Aevum", "Volhaven"], true, true, true, true),
|
|
||||||
"Aevum": new FactionInfo("The Silicon City", ["Chongqing", "New Tokyo", "Ishima", "Volhaven"], true, true, true, true),
|
|
||||||
"Ishima": new FactionInfo("The East Asian Order of the Future", ["Sector-12", "Aevum", "Volhaven"], true, true, true, true),
|
|
||||||
"Volhaven": new FactionInfo("Benefit, Honour, and Glory", ["Chongqing", "Sector-12", "New Tokyo", "Aevum", "Ishima"], true, true, true, true),
|
|
||||||
|
|
||||||
//Criminal Organizations/Gangs
|
|
||||||
"Speakers for the Dead": new FactionInfo("It is better to reign in hell than to serve in heaven.", [], true, true, true, true),
|
|
||||||
|
|
||||||
"The Dark Army": new FactionInfo("The World doesn't care about right or wrong. It's all about power.", [], true, true, true, false),
|
|
||||||
|
|
||||||
"The Syndicate": new FactionInfo("Honor holds you back", [], true, true, true, true),
|
|
||||||
|
|
||||||
"Silhouette": new FactionInfo("Corporations have filled the void of power left behind by the collapse of Western government. The issue is they've become so big " +
|
|
||||||
"that you don't know who they're working for. And if you're employed at one of these corporations, you don't even know who you're working " +
|
|
||||||
"for.\n\n" +
|
|
||||||
"That's terror. Terror, fear, and corruption. All born into the system, all propagated by the system.", [], true, true, true, false),
|
|
||||||
|
|
||||||
"Tetrads": new FactionInfo("Following the Mandate of Heaven and Carrying out the Way", [], false, false, true, true),
|
|
||||||
|
|
||||||
"Slum Snakes": new FactionInfo("Slum Snakes rule!", [], false, false, true, true),
|
|
||||||
|
|
||||||
//Earlygame factions - factions the player will prestige with early on that don't
|
|
||||||
//belong in other categories
|
|
||||||
"Netburners": new FactionInfo("~~//*>H4CK|\|3T 8URN3R5**>?>\\~~", [], true, true, false, false),
|
|
||||||
|
|
||||||
"Tian Di Hui": new FactionInfo("Obey Heaven and Work Righteousness", [], true, true, false, true),
|
|
||||||
|
|
||||||
"CyberSec": new FactionInfo("The Internet is the first thing that humanity has built that humanity doesn’t understand, " +
|
|
||||||
"the largest experiment in anarchy that we have ever had. And as the world becomes increasingly " +
|
|
||||||
"dominated by the internet, society approaches the brink of total chaos. " +
|
|
||||||
"We serve only to protect society, to protect humanity, to protect the world from its imminent collapse.", [], true, true, false, false),
|
|
||||||
|
|
||||||
//Special Factions
|
|
||||||
"Bladeburners": new FactionInfo("It's too bad they won't live. But then again, who does?<br><br>" +
|
|
||||||
"Note that for this faction, reputation can only be gained through Bladeburner actions. Completing " +
|
|
||||||
"Bladeburner contracts/operations will increase your reputation.", [], false, false, false, false),
|
|
||||||
}
|
|
||||||
|
|
||||||
export {FactionInfos};
|
|
193
src/FactionInfo.ts
Normal file
193
src/FactionInfo.ts
Normal file
@ -0,0 +1,193 @@
|
|||||||
|
// Contains the "information" property for all the Factions, which is just a description of each faction
|
||||||
|
class FactionInfo {
|
||||||
|
augmentationPriceMult: number;
|
||||||
|
augmentationRepRequirementMult: number;
|
||||||
|
enemies: string[];
|
||||||
|
infoText: string;
|
||||||
|
offerFieldWork: boolean;
|
||||||
|
offerHackingMission: boolean;
|
||||||
|
offerHackingWork: boolean;
|
||||||
|
offerSecurityWork: boolean;
|
||||||
|
|
||||||
|
constructor(infoText: string, enemies: string[], offerHackingMission: boolean, offerHackingWork: boolean,
|
||||||
|
offerFieldWork: boolean, offerSecurityWork: boolean) {
|
||||||
|
this.infoText = infoText;
|
||||||
|
this.enemies = enemies;
|
||||||
|
this.offerHackingMission = offerHackingMission;
|
||||||
|
this.offerHackingWork = offerHackingWork;
|
||||||
|
this.offerFieldWork = offerFieldWork;
|
||||||
|
this.offerSecurityWork = offerSecurityWork;
|
||||||
|
|
||||||
|
// These are always all 1 for now.
|
||||||
|
this.augmentationPriceMult = 1;
|
||||||
|
this.augmentationRepRequirementMult = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const FactionInfos = {
|
||||||
|
// Endgame
|
||||||
|
Illuminati: new FactionInfo("Humanity never changes. No matter how civilized society becomes, it will eventually" +
|
||||||
|
"fall back into chaos. And from this chaos, we are the Invisible hand that guides them to order. ",
|
||||||
|
[], true, true, true, false),
|
||||||
|
|
||||||
|
Daedalus: new FactionInfo("Yesterday we obeyed kings and bent our necks to emperors. Today we kneel only to truth.",
|
||||||
|
[], true, true, true, false),
|
||||||
|
|
||||||
|
"The Covenant": new FactionInfo("Surrender yourself. Give up your empty individuality to become part of something" +
|
||||||
|
"great, something eternal. Become a slave. Submit your mind, body, and soul. Only" +
|
||||||
|
"then can you set yourself free.<br><br> Only then can you discover immortality.",
|
||||||
|
[], true, true, true, false),
|
||||||
|
|
||||||
|
// Megacorporations, each forms its own faction
|
||||||
|
ECorp: new FactionInfo("ECorp's mission is simple: to connect the world of today with the technology of tomorrow." +
|
||||||
|
"With our wide range of Internet-related software and commercial hardware, ECorp makes" +
|
||||||
|
"the world's information universally accessible.",
|
||||||
|
[], true, true, true, true),
|
||||||
|
|
||||||
|
MegaCorp: new FactionInfo("MegaCorp does things that others don't. We imagine. We create. We invent. We build" +
|
||||||
|
"things that others have never even dreamed of. Our work fills the world's needs for" +
|
||||||
|
"food, water, power, and transporation on an unprecendented scale, in ways that no" +
|
||||||
|
"other company can.<br><br>In our labs and factories and on the ground with customers," +
|
||||||
|
"MegaCorp is ushering in a new era for the world.",
|
||||||
|
[], true, true, true, true),
|
||||||
|
|
||||||
|
"Bachman & Associates": new FactionInfo("Where Law and Business meet - thats where we are. <br><br>" +
|
||||||
|
"Legal Insight - Business Instinct - Experience Innovation",
|
||||||
|
[], true, true, true, true),
|
||||||
|
|
||||||
|
"Blade Industries": new FactionInfo("Augmentation is salvation", [], true, true, true, true),
|
||||||
|
|
||||||
|
NWO: new FactionInfo("The human being does not truly desire freedom. It wants " +
|
||||||
|
"to be observed, understood, and judged. It wants to be given purpose and " +
|
||||||
|
"direction in its life. That is why humans created God. " +
|
||||||
|
"And that is why humans created civilization - " +
|
||||||
|
"not because of willingness, " +
|
||||||
|
"but because of a need to be incorporated into higher orders of structure and meaning.",
|
||||||
|
[], true, true, true, true),
|
||||||
|
|
||||||
|
"Clarke Incorporated": new FactionInfo("Unlocking the power of the genome",
|
||||||
|
[], true, true, true, true),
|
||||||
|
|
||||||
|
"OmniTek Incorporated": new FactionInfo("Simply put, our mission is to design and build robots that make a" +
|
||||||
|
"difference",
|
||||||
|
[], true, true, true, true),
|
||||||
|
|
||||||
|
"Four Sigma": new FactionInfo("The scientific method is the best way to approach investing. Big strategies backed" +
|
||||||
|
"up with big data. Driven by deep learning and innovative ideas. And improved by iteration. That's Four Sigma.",
|
||||||
|
[], true, true, true, true),
|
||||||
|
|
||||||
|
"KuaiGong International": new FactionInfo("Dream big. Work hard. Make history.",
|
||||||
|
[], true, true, true, true),
|
||||||
|
|
||||||
|
// Other Corporations
|
||||||
|
"Fulcrum Secret Technologies": new FactionInfo("The human organism has an innate desire to worship. " +
|
||||||
|
"That is why they created gods. If there were no gods, " +
|
||||||
|
"it would be necessary to create them. And now we can.",
|
||||||
|
[], true, true, false, true),
|
||||||
|
|
||||||
|
// Hacker groups
|
||||||
|
BitRunners: new FactionInfo("Our entire lives are controlled by bits. All of our actions, our thoughts, our" +
|
||||||
|
"personal information. It's all transformed into bits, stored in bits, communicated through bits." +
|
||||||
|
"It’s impossible for any person to move, to live, to operate at any level without the use of" +
|
||||||
|
"bits. And when a person moves, lives, and operates, they leave behind their bits, mere traces of" +
|
||||||
|
"seemingly meaningless fragments of information. But these bits can be reconstructed." +
|
||||||
|
"Transformed. Used.<br><br>Those who run the bits, run the world",
|
||||||
|
[], true, true, false, false),
|
||||||
|
|
||||||
|
"The Black Hand": new FactionInfo("The world, so afraid of strong government, now has no government." +
|
||||||
|
"Only power - Digital power. Financial power. Technological power. And those at the top rule with" +
|
||||||
|
"an invisible hand. They built a society where the rich get richer, and everyone else suffers." +
|
||||||
|
"<br><br>So much pain. So many lives. Their darkness must end.",
|
||||||
|
[], true, true, true, false),
|
||||||
|
|
||||||
|
NiteSec: new FactionInfo(
|
||||||
|
" __..__ <br>" +
|
||||||
|
" _.nITESECNIt. <br>" +
|
||||||
|
" .-'NITESECNITESEc. <br>" +
|
||||||
|
" .' NITESECNITESECn <br>" +
|
||||||
|
" / NITESECNITESEC; <br>" +
|
||||||
|
" : :NITESECNITESEC; <br>" +
|
||||||
|
" ; $ NITESECNITESECN <br>" +
|
||||||
|
" : _, ,N'ITESECNITESEC <br>" +
|
||||||
|
" : .+^^`, : `NITESECNIT <br>" +
|
||||||
|
" ) /), `-,-=,NITESECNI <br>" +
|
||||||
|
" / ^ ,-;|NITESECN; <br>" +
|
||||||
|
" / _.' '-';NITESECN <br>" +
|
||||||
|
" ( , ,-''`^NITE' <br>" +
|
||||||
|
" )` :`. .' <br>" +
|
||||||
|
" )-- ; `- / <br>" +
|
||||||
|
" \' _.-' : <br>" +
|
||||||
|
" ( _.-' \. \ <br>" +
|
||||||
|
" \------. \ \ <br>" +
|
||||||
|
" \. \ \ <br>" +
|
||||||
|
" \ _.nIt <br>" +
|
||||||
|
" \ _.nITESECNi <br>" +
|
||||||
|
" nITESECNIT^' \ <br>" +
|
||||||
|
" NITE^' ___ \ <br>" +
|
||||||
|
" / .gP''''Tp. \ <br>" +
|
||||||
|
" : d' . `b \ <br>" +
|
||||||
|
" ; d' o `b ; <br>" +
|
||||||
|
" / d; `b| <br>" +
|
||||||
|
" /, $; @ `: <br>" +
|
||||||
|
" /' $$ ; <br>" +
|
||||||
|
" .' $$b o | <br>" +
|
||||||
|
" .' d$$$; : <br>" +
|
||||||
|
" / .d$$$$; , ; <br>" +
|
||||||
|
" d .dNITESEC $ | <br>" +
|
||||||
|
" :bp.__.gNITESEC$$ :$ ; <br>" +
|
||||||
|
" NITESECNITESECNIT $$b : <br>",
|
||||||
|
[], true, true, false, false),
|
||||||
|
|
||||||
|
// City factions, essentially governments
|
||||||
|
Aevum: new FactionInfo("The Silicon City",
|
||||||
|
["Chongqing", "New Tokyo", "Ishima", "Volhaven"], true, true, true, true),
|
||||||
|
Chongqing: new FactionInfo("Serve the people",
|
||||||
|
["Sector-12", "Aevum", "Volhaven"], true, true, true, true),
|
||||||
|
Ishima: new FactionInfo("The East Asian Order of the Future",
|
||||||
|
["Sector-12", "Aevum", "Volhaven"], true, true, true, true),
|
||||||
|
"New Tokyo": new FactionInfo("Asia's World City",
|
||||||
|
["Sector-12", "Aevum", "Volhaven"], true, true, true, true),
|
||||||
|
"Sector-12": new FactionInfo("The City of the Future",
|
||||||
|
["Chongqing", "New Tokyo", "Ishima", "Volhaven"], true, true, true, true),
|
||||||
|
Volhaven: new FactionInfo("Benefit, Honour, and Glory",
|
||||||
|
["Chongqing", "Sector-12", "New Tokyo", "Aevum", "Ishima"], true, true, true, true),
|
||||||
|
|
||||||
|
// Criminal Organizations/Gangs
|
||||||
|
"Speakers for the Dead": new FactionInfo("It is better to reign in hell than to serve in heaven.",
|
||||||
|
[], true, true, true, true),
|
||||||
|
|
||||||
|
"The Dark Army": new FactionInfo("The World doesn't care about right or wrong. It's all about power.",
|
||||||
|
[], true, true, true, false),
|
||||||
|
|
||||||
|
"The Syndicate": new FactionInfo("Honor holds you back", [], true, true, true, true),
|
||||||
|
|
||||||
|
Silhouette: new FactionInfo("Corporations have filled the void of power left behind by the collapse of Western" +
|
||||||
|
"government. The issue is they've become so big that you don't know who they're working for. And" +
|
||||||
|
"if you're employed at one of these corporations, you don't even know who you're working for.\n\n" +
|
||||||
|
"That's terror. Terror, fear, and corruption. All born into the system, all propagated by the" +
|
||||||
|
"system.",
|
||||||
|
[], true, true, true, false),
|
||||||
|
|
||||||
|
Tetrads: new FactionInfo("Following the Mandate of Heaven and Carrying out the Way", [], false, false, true, true),
|
||||||
|
|
||||||
|
"Slum Snakes": new FactionInfo("Slum Snakes rule!", [], false, false, true, true),
|
||||||
|
|
||||||
|
// Earlygame factions - factions the player will prestige with early on that don't belong in other categories.
|
||||||
|
Netburners: new FactionInfo("~~//*>H4CK|\|3T 8URN3R5**>?>\\~~", [], true, true, false, false),
|
||||||
|
|
||||||
|
"Tian Di Hui": new FactionInfo("Obey Heaven and Work Righteousness", [], true, true, false, true),
|
||||||
|
|
||||||
|
CyberSec: new FactionInfo("The Internet is the first thing that humanity has built that humanity doesn’t" +
|
||||||
|
"understand, the largest experiment in anarchy that we have ever had. And as the world becomes" +
|
||||||
|
"increasingly dominated by the internet, society approaches the brink of total chaos. We serve only" +
|
||||||
|
"to protect society, to protect humanity, to protect the world from its imminent collapse.",
|
||||||
|
[], true, true, false, false),
|
||||||
|
|
||||||
|
// Special Factions
|
||||||
|
Bladeburners: new FactionInfo("It's too bad they won't live. But then again, who does?<br><br>Note that for this" +
|
||||||
|
"faction, reputation can only be gained through Bladeburner actions. Completing " +
|
||||||
|
"Bladeburner contracts/operations will increase your reputation.",
|
||||||
|
[], false, false, false, false),
|
||||||
|
};
|
||||||
|
|
||||||
|
export {FactionInfos};
|
@ -1,4 +1,4 @@
|
|||||||
import {parse, Node} from "../utils/acorn.js";
|
import {parse, Node} from "../utils/acorn";
|
||||||
|
|
||||||
var FconfSettings = {
|
var FconfSettings = {
|
||||||
ENABLE_BASH_HOTKEYS: false,
|
ENABLE_BASH_HOTKEYS: false,
|
||||||
|
18
src/Gang.js
18
src/Gang.js
@ -1,22 +1,22 @@
|
|||||||
import {CONSTANTS} from "./Constants.js";
|
import {CONSTANTS} from "./Constants";
|
||||||
import {Engine} from "./engine.js";
|
import {Engine} from "./engine";
|
||||||
import {Faction, Factions,
|
import {Faction, Factions,
|
||||||
displayFactionContent} from "./Faction.js";
|
displayFactionContent} from "./Faction";
|
||||||
import {Player} from "./Player.js";
|
import {Player} from "./Player";
|
||||||
import {dialogBoxCreate} from "../utils/DialogBox.js";
|
import {dialogBoxCreate} from "../utils/DialogBox";
|
||||||
import {Reviver, Generic_toJSON,
|
import {Reviver, Generic_toJSON,
|
||||||
Generic_fromJSON} from "../utils/JSONReviver.js";
|
Generic_fromJSON} from "../utils/JSONReviver";
|
||||||
import {getRandomInt, createElement,
|
import {getRandomInt, createElement,
|
||||||
removeChildrenFromElement,
|
removeChildrenFromElement,
|
||||||
createAccordionElement, createPopup,
|
createAccordionElement, createPopup,
|
||||||
removeElementById, removeElement} from "../utils/HelperFunctions.js";
|
removeElementById, removeElement} from "../utils/HelperFunctions";
|
||||||
import numeral from "numeral/min/numeral.min";
|
import numeral from "numeral/min/numeral.min";
|
||||||
import {formatNumber} from "../utils/StringHelperFunctions.js";
|
import {formatNumber} from "../utils/StringHelperFunctions";
|
||||||
import {yesNoBoxCreate, yesNoTxtInpBoxCreate,
|
import {yesNoBoxCreate, yesNoTxtInpBoxCreate,
|
||||||
yesNoBoxGetYesButton, yesNoBoxGetNoButton,
|
yesNoBoxGetYesButton, yesNoBoxGetNoButton,
|
||||||
yesNoTxtInpBoxGetYesButton, yesNoTxtInpBoxGetNoButton,
|
yesNoTxtInpBoxGetYesButton, yesNoTxtInpBoxGetNoButton,
|
||||||
yesNoTxtInpBoxGetInput, yesNoBoxClose,
|
yesNoTxtInpBoxGetInput, yesNoBoxClose,
|
||||||
yesNoTxtInpBoxClose, yesNoBoxOpen} from "../utils/YesNoBox.js";
|
yesNoTxtInpBoxClose, yesNoBoxOpen} from "../utils/YesNoBox";
|
||||||
|
|
||||||
/* Gang.js */
|
/* Gang.js */
|
||||||
//Switch between territory and management screen with 1 and 2
|
//Switch between territory and management screen with 1 and 2
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
import {BitNodeMultipliers} from "./BitNode.js";
|
import {BitNodeMultipliers} from "./BitNode";
|
||||||
import {CONSTANTS} from "./Constants.js";
|
import {CONSTANTS} from "./Constants";
|
||||||
import {Engine} from "./engine.js";
|
import {Engine} from "./engine";
|
||||||
import {iTutorialSteps, iTutorialNextStep,
|
import {iTutorialSteps, iTutorialNextStep,
|
||||||
iTutorialIsRunning, currITutorialStep} from "./InteractiveTutorial.js";
|
iTutorialIsRunning, currITutorialStep} from "./InteractiveTutorial";
|
||||||
import {Player} from "./Player.js";
|
import {Player} from "./Player";
|
||||||
import {dialogBoxCreate} from "../utils/DialogBox.js";
|
import {dialogBoxCreate} from "../utils/DialogBox";
|
||||||
import {clearEventListeners, createElement,
|
import {clearEventListeners, createElement,
|
||||||
getElementById} from "../utils/HelperFunctions.js";
|
getElementById} from "../utils/HelperFunctions";
|
||||||
import {Reviver, Generic_toJSON,
|
import {Reviver, Generic_toJSON,
|
||||||
Generic_fromJSON} from "../utils/JSONReviver.js";
|
Generic_fromJSON} from "../utils/JSONReviver";
|
||||||
import {formatNumber} from "../utils/StringHelperFunctions.js";
|
import {formatNumber} from "../utils/StringHelperFunctions";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overwrites the inner text of the specified HTML element if it is different from what currently exists.
|
* Overwrites the inner text of the specified HTML element if it is different from what currently exists.
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
import {BitNodeMultipliers} from "./BitNode.js";
|
import {BitNodeMultipliers} from "./BitNode";
|
||||||
import {CONSTANTS} from "./Constants.js";
|
import {CONSTANTS} from "./Constants";
|
||||||
import {Engine} from "./engine.js";
|
import {Engine} from "./engine";
|
||||||
import {Player} from "./Player.js";
|
import {Player} from "./Player";
|
||||||
import {dialogBoxCreate} from "../utils/DialogBox.js";
|
import {dialogBoxCreate} from "../utils/DialogBox";
|
||||||
import {clearEventListeners, getRandomInt} from "../utils/HelperFunctions.js";
|
import {clearEventListeners, getRandomInt} from "../utils/HelperFunctions";
|
||||||
import {infiltrationBoxCreate} from "../utils/InfiltrationBox.js";
|
import {infiltrationBoxCreate} from "../utils/InfiltrationBox";
|
||||||
import {formatNumber} from "../utils/StringHelperFunctions.js";
|
import {formatNumber} from "../utils/StringHelperFunctions";
|
||||||
|
|
||||||
/* Infiltration.js
|
/* Infiltration.js
|
||||||
*
|
*
|
||||||
@ -594,10 +594,10 @@ let intWgt = CONSTANTS.IntelligenceInfiltrationWeight;
|
|||||||
//Success: 5%, Failure 10%, -Karma
|
//Success: 5%, Failure 10%, -Karma
|
||||||
function attemptInfiltrationKill(inst) {
|
function attemptInfiltrationKill(inst) {
|
||||||
var chance = getInfiltrationKillChance(inst);
|
var chance = getInfiltrationKillChance(inst);
|
||||||
inst.gainStrengthExp(inst.securityLevel / 85) * Player.strength_exp_mult;
|
inst.gainStrengthExp(inst.securityLevel / 75) * Player.strength_exp_mult;
|
||||||
inst.gainDefenseExp(inst.securityLevel / 85) * Player.defense_exp_mult;
|
inst.gainDefenseExp(inst.securityLevel / 75) * Player.defense_exp_mult;
|
||||||
inst.gainDexterityExp(inst.securityLevel / 85) * Player.dexterity_exp_mult;
|
inst.gainDexterityExp(inst.securityLevel / 75) * Player.dexterity_exp_mult;
|
||||||
inst.gainAgilityExp(inst.securityLevel / 85) * Player.agility_exp_mult;
|
inst.gainAgilityExp(inst.securityLevel / 75) * Player.agility_exp_mult;
|
||||||
if (Math.random() <= chance) {
|
if (Math.random() <= chance) {
|
||||||
inst.securityLevel *= 1.05;
|
inst.securityLevel *= 1.05;
|
||||||
return [true, 1.05];
|
return [true, 1.05];
|
||||||
@ -620,10 +620,10 @@ function getInfiltrationKillChance(inst) {
|
|||||||
//Success: 3%, Failure: 10%
|
//Success: 3%, Failure: 10%
|
||||||
function attemptInfiltrationKnockout(inst) {
|
function attemptInfiltrationKnockout(inst) {
|
||||||
var chance = getInfiltrationKnockoutChance(inst);
|
var chance = getInfiltrationKnockoutChance(inst);
|
||||||
inst.gainStrengthExp(inst.securityLevel / 80) * Player.strength_exp_mult;
|
inst.gainStrengthExp(inst.securityLevel / 70) * Player.strength_exp_mult;
|
||||||
inst.gainDefenseExp(inst.securityLevel / 80) * Player.defense_exp_mult;
|
inst.gainDefenseExp(inst.securityLevel / 70) * Player.defense_exp_mult;
|
||||||
inst.gainDexterityExp(inst.securityLevel / 80) * Player.dexterity_exp_mult;
|
inst.gainDexterityExp(inst.securityLevel / 70) * Player.dexterity_exp_mult;
|
||||||
inst.gainAgilityExp(inst.securityLevel / 80) * Player.agility_exp_mult;
|
inst.gainAgilityExp(inst.securityLevel / 70) * Player.agility_exp_mult;
|
||||||
if (Math.random() <= chance) {
|
if (Math.random() <= chance) {
|
||||||
inst.securityLevel *= 1.03;
|
inst.securityLevel *= 1.03;
|
||||||
return [true, 1.03];
|
return [true, 1.03];
|
||||||
@ -645,9 +645,9 @@ function getInfiltrationKnockoutChance(inst) {
|
|||||||
//Success: 0%, Failure: 10%
|
//Success: 0%, Failure: 10%
|
||||||
function attemptInfiltrationStealthKnockout(inst) {
|
function attemptInfiltrationStealthKnockout(inst) {
|
||||||
var chance = getInfiltrationStealthKnockoutChance(inst);
|
var chance = getInfiltrationStealthKnockoutChance(inst);
|
||||||
inst.gainStrengthExp(inst.securityLevel / 85) * Player.strength_exp_mult;
|
inst.gainStrengthExp(inst.securityLevel / 75) * Player.strength_exp_mult;
|
||||||
inst.gainDexterityExp(inst.securityLevel / 65) * Player.dexterity_exp_mult;
|
inst.gainDexterityExp(inst.securityLevel / 60) * Player.dexterity_exp_mult;
|
||||||
inst.gainAgilityExp(inst.securityLevel / 65) * Player.agility_exp_mult;
|
inst.gainAgilityExp(inst.securityLevel / 60) * Player.agility_exp_mult;
|
||||||
if (Math.random() <= chance) {
|
if (Math.random() <= chance) {
|
||||||
return [true, 1];
|
return [true, 1];
|
||||||
} else {
|
} else {
|
||||||
@ -669,9 +669,9 @@ function getInfiltrationStealthKnockoutChance(inst) {
|
|||||||
//Success: 0%, Failure: 5%, -Karma
|
//Success: 0%, Failure: 5%, -Karma
|
||||||
function attemptInfiltrationAssassinate(inst) {
|
function attemptInfiltrationAssassinate(inst) {
|
||||||
var chance = getInfiltrationAssassinateChance(inst);
|
var chance = getInfiltrationAssassinateChance(inst);
|
||||||
inst.gainStrengthExp(inst.securityLevel / 85) * Player.strength_exp_mult;
|
inst.gainStrengthExp(inst.securityLevel / 75) * Player.strength_exp_mult;
|
||||||
inst.gainDexterityExp(inst.securityLevel / 65) * Player.dexterity_exp_mult;
|
inst.gainDexterityExp(inst.securityLevel / 55) * Player.dexterity_exp_mult;
|
||||||
inst.gainAgilityExp(inst.securityLevel / 65) * Player.agility_exp_mult;
|
inst.gainAgilityExp(inst.securityLevel / 55) * Player.agility_exp_mult;
|
||||||
if (Math.random() <= chance) {
|
if (Math.random() <= chance) {
|
||||||
return [true, 1];
|
return [true, 1];
|
||||||
} else {
|
} else {
|
||||||
@ -693,10 +693,10 @@ function getInfiltrationAssassinateChance(inst) {
|
|||||||
//Success: 5%, Failure: 10%
|
//Success: 5%, Failure: 10%
|
||||||
function attemptInfiltrationDestroySecurity(inst) {
|
function attemptInfiltrationDestroySecurity(inst) {
|
||||||
var chance = getInfiltrationDestroySecurityChance(inst);
|
var chance = getInfiltrationDestroySecurityChance(inst);
|
||||||
inst.gainStrengthExp(inst.securityLevel / 85) * Player.strength_exp_mult;
|
inst.gainStrengthExp(inst.securityLevel / 75) * Player.strength_exp_mult;
|
||||||
inst.gainDefenseExp(inst.securityLevel / 85) * Player.defense_exp_mult;
|
inst.gainDefenseExp(inst.securityLevel / 75) * Player.defense_exp_mult;
|
||||||
inst.gainDexterityExp(inst.securityLevel / 85) * Player.dexterity_exp_mult;
|
inst.gainDexterityExp(inst.securityLevel / 75) * Player.dexterity_exp_mult;
|
||||||
inst.gainAgilityExp(inst.securityLevel / 85) * Player.agility_exp_mult;
|
inst.gainAgilityExp(inst.securityLevel / 75) * Player.agility_exp_mult;
|
||||||
if (Math.random() <= chance) {
|
if (Math.random() <= chance) {
|
||||||
inst.securityLevel *= 1.05;
|
inst.securityLevel *= 1.05;
|
||||||
return [true, 1.05];
|
return [true, 1.05];
|
||||||
@ -720,8 +720,8 @@ function getInfiltrationDestroySecurityChance(inst) {
|
|||||||
//Success: 3%, Failure: 5%
|
//Success: 3%, Failure: 5%
|
||||||
function attemptInfiltrationHack(inst) {
|
function attemptInfiltrationHack(inst) {
|
||||||
var chance = getInfiltrationHackChance(inst);
|
var chance = getInfiltrationHackChance(inst);
|
||||||
inst.gainHackingExp(inst.securityLevel / 40) * Player.hacking_exp_mult;
|
inst.gainHackingExp(inst.securityLevel / 30) * Player.hacking_exp_mult;
|
||||||
inst.gainIntelligenceExp(inst.securityLevel / 690);
|
inst.gainIntelligenceExp(inst.securityLevel / 680);
|
||||||
if (Math.random() <= chance) {
|
if (Math.random() <= chance) {
|
||||||
inst.securityLevel *= 1.03;
|
inst.securityLevel *= 1.03;
|
||||||
return [true, 1.03];
|
return [true, 1.03];
|
||||||
@ -743,7 +743,7 @@ function getInfiltrationHackChance(inst) {
|
|||||||
//Success: 0%, Failure: 8%
|
//Success: 0%, Failure: 8%
|
||||||
function attemptInfiltrationSneak(inst) {
|
function attemptInfiltrationSneak(inst) {
|
||||||
var chance = getInfiltrationSneakChance(inst);
|
var chance = getInfiltrationSneakChance(inst);
|
||||||
inst.gainAgilityExp(inst.securityLevel / 40) * Player.agility_exp_mult;
|
inst.gainAgilityExp(inst.securityLevel / 30) * Player.agility_exp_mult;
|
||||||
if (Math.random() <= chance) {
|
if (Math.random() <= chance) {
|
||||||
return [true, 1];
|
return [true, 1];
|
||||||
} else {
|
} else {
|
||||||
@ -764,7 +764,7 @@ function getInfiltrationSneakChance(inst) {
|
|||||||
//Success: 1%, Failure: 3%
|
//Success: 1%, Failure: 3%
|
||||||
function attemptInfiltrationPickLockedDoor(inst) {
|
function attemptInfiltrationPickLockedDoor(inst) {
|
||||||
var chance = getInfiltrationPickLockedDoorChance(inst);
|
var chance = getInfiltrationPickLockedDoorChance(inst);
|
||||||
inst.gainDexterityExp(inst.securityLevel / 30) * Player.dexterity_exp_mult;
|
inst.gainDexterityExp(inst.securityLevel / 25) * Player.dexterity_exp_mult;
|
||||||
if (Math.random() <= chance) {
|
if (Math.random() <= chance) {
|
||||||
inst.securityLevel *= 1.01;
|
inst.securityLevel *= 1.01;
|
||||||
return [true, 1.01];
|
return [true, 1.01];
|
||||||
@ -785,7 +785,7 @@ function getInfiltrationPickLockedDoorChance(inst) {
|
|||||||
//Success: 0%, Failure: 15%,
|
//Success: 0%, Failure: 15%,
|
||||||
function attemptInfiltrationBribe(inst) {
|
function attemptInfiltrationBribe(inst) {
|
||||||
var chance = getInfiltrationBribeChance(inst);
|
var chance = getInfiltrationBribeChance(inst);
|
||||||
inst.gainCharismaExp(inst.securityLevel / 10) * Player.charisma_exp_mult;
|
inst.gainCharismaExp(inst.securityLevel / 8) * Player.charisma_exp_mult;
|
||||||
if (Math.random() <= chance) {
|
if (Math.random() <= chance) {
|
||||||
return [true, 1];
|
return [true, 1];
|
||||||
} else {
|
} else {
|
||||||
@ -804,8 +804,8 @@ function getInfiltrationBribeChance(inst) {
|
|||||||
//Failure: 5%
|
//Failure: 5%
|
||||||
function attemptInfiltrationEscape(inst) {
|
function attemptInfiltrationEscape(inst) {
|
||||||
var chance = getInfiltrationEscapeChance(inst);
|
var chance = getInfiltrationEscapeChance(inst);
|
||||||
inst.gainAgilityExp(inst.securityLevel / 35) * Player.agility_exp_mult;
|
inst.gainAgilityExp(inst.securityLevel / 30) * Player.agility_exp_mult;
|
||||||
inst.gainDexterityExp(inst.securityLevel / 35) * Player.dexterity_exp_mult;
|
inst.gainDexterityExp(inst.securityLevel / 30) * Player.dexterity_exp_mult;
|
||||||
if (Math.random() <= chance) {
|
if (Math.random() <= chance) {
|
||||||
return [true, 1];
|
return [true, 1];
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import {Engine} from "./engine.js";
|
import {Engine} from "./engine";
|
||||||
import {Player} from "./Player.js";
|
import {Player} from "./Player";
|
||||||
import {dialogBoxCreate} from "../utils/DialogBox.js";
|
import {dialogBoxCreate} from "../utils/DialogBox";
|
||||||
import {clearEventListeners} from "../utils/HelperFunctions.js";
|
import {clearEventListeners} from "../utils/HelperFunctions";
|
||||||
|
|
||||||
/* InteractiveTutorial.js */
|
/* InteractiveTutorial.js */
|
||||||
let iTutorialSteps = {
|
let iTutorialSteps = {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import {dialogBoxCreate} from "../utils/DialogBox.js";
|
import {dialogBoxCreate} from "../utils/DialogBox";
|
||||||
|
|
||||||
/* Literature.js
|
/* Literature.js
|
||||||
* Lore / world building literature that can be found on servers
|
* Lore / world building literature that can be found on servers
|
||||||
|
116
src/Location.js
116
src/Location.js
@ -1,29 +1,29 @@
|
|||||||
import {Bladeburner} from "./Bladeburner.js";
|
import {Bladeburner} from "./Bladeburner";
|
||||||
import {CompanyPositions, initCompanies,
|
import {CompanyPositions, initCompanies,
|
||||||
Companies, getJobRequirementText} from "./Company.js";
|
Companies, getJobRequirementText} from "./Company";
|
||||||
import {Corporation} from "./CompanyManagement.js";
|
import {Corporation} from "./CompanyManagement";
|
||||||
import {CONSTANTS} from "./Constants.js";
|
import {CONSTANTS} from "./Constants";
|
||||||
import {Crimes} from "./Crimes.js";
|
import {Crimes} from "./Crimes";
|
||||||
import {Engine} from "./engine.js";
|
import {Engine} from "./engine";
|
||||||
import {beginInfiltration} from "./Infiltration.js";
|
import {beginInfiltration} from "./Infiltration";
|
||||||
import {hasBladeburnerSF} from "./NetscriptFunctions.js";
|
import {hasBladeburnerSF} from "./NetscriptFunctions";
|
||||||
import {Player} from "./Player.js";
|
import {Player} from "./Player";
|
||||||
import {Server, AllServers, AddToAllServers} from "./Server.js";
|
import {Server, AllServers, AddToAllServers} from "./Server";
|
||||||
import {purchaseServer,
|
import {purchaseServer,
|
||||||
purchaseRamForHomeComputer} from "./ServerPurchases.js";
|
purchaseRamForHomeComputer} from "./ServerPurchases";
|
||||||
import {Settings} from "./Settings.js";
|
import {Settings} from "./Settings";
|
||||||
import {SpecialServerNames, SpecialServerIps} from "./SpecialServerIps.js";
|
import {SpecialServerNames, SpecialServerIps} from "./SpecialServerIps";
|
||||||
|
|
||||||
import {dialogBoxCreate} from "../utils/DialogBox.js";
|
import {dialogBoxCreate} from "../utils/DialogBox";
|
||||||
import {clearEventListeners, createElement} from "../utils/HelperFunctions.js";
|
import {clearEventListeners, createElement} from "../utils/HelperFunctions";
|
||||||
import {createRandomIp} from "../utils/IPAddress.js";
|
import {createRandomIp} from "../utils/IPAddress";
|
||||||
import numeral from "numeral/min/numeral.min";
|
import numeral from "numeral/min/numeral.min";
|
||||||
import {formatNumber} from "../utils/StringHelperFunctions.js";
|
import {formatNumber} from "../utils/StringHelperFunctions";
|
||||||
import {yesNoBoxCreate, yesNoTxtInpBoxCreate,
|
import {yesNoBoxCreate, yesNoTxtInpBoxCreate,
|
||||||
yesNoBoxGetYesButton, yesNoBoxGetNoButton,
|
yesNoBoxGetYesButton, yesNoBoxGetNoButton,
|
||||||
yesNoTxtInpBoxGetYesButton, yesNoTxtInpBoxGetNoButton,
|
yesNoTxtInpBoxGetYesButton, yesNoTxtInpBoxGetNoButton,
|
||||||
yesNoTxtInpBoxGetInput, yesNoBoxClose,
|
yesNoTxtInpBoxGetInput, yesNoBoxClose,
|
||||||
yesNoTxtInpBoxClose} from "../utils/YesNoBox.js";
|
yesNoTxtInpBoxClose} from "../utils/YesNoBox";
|
||||||
|
|
||||||
/* Display Location Content when visiting somewhere in the World*/
|
/* Display Location Content when visiting somewhere in the World*/
|
||||||
var Locations = {
|
var Locations = {
|
||||||
@ -280,7 +280,13 @@ function displayLocationContent() {
|
|||||||
purchase512gb.innerHTML = "Purchase 512GB Server - $" + formatNumber(512*CONSTANTS.BaseCostFor1GBOfRamServer, 2);
|
purchase512gb.innerHTML = "Purchase 512GB Server - $" + formatNumber(512*CONSTANTS.BaseCostFor1GBOfRamServer, 2);
|
||||||
purchase1tb.innerHTML = "Purchase 1TB Server - $" + formatNumber(1024*CONSTANTS.BaseCostFor1GBOfRamServer, 2);
|
purchase1tb.innerHTML = "Purchase 1TB Server - $" + formatNumber(1024*CONSTANTS.BaseCostFor1GBOfRamServer, 2);
|
||||||
if (!SpecialServerIps.hasOwnProperty("Darkweb Server")) {
|
if (!SpecialServerIps.hasOwnProperty("Darkweb Server")) {
|
||||||
|
purchaseTor.classList.add("a-link-button");
|
||||||
|
purchaseTor.classList.remove("a-link-button-bought");
|
||||||
purchaseTor.innerHTML = "Purchase TOR Router - $" + formatNumber(CONSTANTS.TorRouterCost, 2);
|
purchaseTor.innerHTML = "Purchase TOR Router - $" + formatNumber(CONSTANTS.TorRouterCost, 2);
|
||||||
|
} else {
|
||||||
|
purchaseTor.classList.remove("a-link-button");
|
||||||
|
purchaseTor.classList.add("a-link-button-bought");
|
||||||
|
purchaseTor.innerHTML = "TOR Router - Purchased";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -432,7 +438,7 @@ function displayLocationContent() {
|
|||||||
purchaseHomeRam.style.display = "block";
|
purchaseHomeRam.style.display = "block";
|
||||||
purchaseHomeCores.style.display = "block";
|
purchaseHomeCores.style.display = "block";
|
||||||
setInfiltrateButton(infiltrate, Locations.AevumECorp,
|
setInfiltrateButton(infiltrate, Locations.AevumECorp,
|
||||||
6000, 116, 150, 8.5);
|
5400, 116, 150, 6);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Locations.AevumBachmanAndAssociates:
|
case Locations.AevumBachmanAndAssociates:
|
||||||
@ -445,7 +451,7 @@ function displayLocationContent() {
|
|||||||
businessJob.style.display = "block";
|
businessJob.style.display = "block";
|
||||||
securityJob.style.display = "block";
|
securityJob.style.display = "block";
|
||||||
setInfiltrateButton(infiltrate, Locations.AevumBachmanAndAssociates,
|
setInfiltrateButton(infiltrate, Locations.AevumBachmanAndAssociates,
|
||||||
1500, 42, 60, 5.75);
|
1500, 42, 60, 4.1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Locations.AevumClarkeIncorporated:
|
case Locations.AevumClarkeIncorporated:
|
||||||
@ -458,7 +464,7 @@ function displayLocationContent() {
|
|||||||
businessJob.style.display = "block";
|
businessJob.style.display = "block";
|
||||||
securityJob.style.display = "block";
|
securityJob.style.display = "block";
|
||||||
setInfiltrateButton(infiltrate, Locations.AevumClarkeIncorporated,
|
setInfiltrateButton(infiltrate, Locations.AevumClarkeIncorporated,
|
||||||
2400, 34, 75, 5.4);
|
2000, 34, 75, 3.6);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Locations.AevumFulcrumTechnologies:
|
case Locations.AevumFulcrumTechnologies:
|
||||||
@ -478,7 +484,7 @@ function displayLocationContent() {
|
|||||||
purchaseHomeRam.style.display = "block";
|
purchaseHomeRam.style.display = "block";
|
||||||
purchaseHomeCores.style.display = "block";
|
purchaseHomeCores.style.display = "block";
|
||||||
setInfiltrateButton(infiltrate, Locations.AevumFulcrumTechnologies,
|
setInfiltrateButton(infiltrate, Locations.AevumFulcrumTechnologies,
|
||||||
6000, 96, 100, 9);
|
4600, 96, 100, 6.2);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Locations.AevumAeroCorp:
|
case Locations.AevumAeroCorp:
|
||||||
@ -490,7 +496,7 @@ function displayLocationContent() {
|
|||||||
networkEngineerJob.style.display = "block";
|
networkEngineerJob.style.display = "block";
|
||||||
securityJob.style.display = "block";
|
securityJob.style.display = "block";
|
||||||
setInfiltrateButton(infiltrate, Locations.AevumAeroCorp,
|
setInfiltrateButton(infiltrate, Locations.AevumAeroCorp,
|
||||||
2000, 32, 50, 6.3);
|
1500, 32, 50, 4.4);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Locations.AevumGalacticCybersystems:
|
case Locations.AevumGalacticCybersystems:
|
||||||
@ -503,7 +509,7 @@ function displayLocationContent() {
|
|||||||
networkEngineerJob.style.display = "block";
|
networkEngineerJob.style.display = "block";
|
||||||
businessJob.style.display = "block";
|
businessJob.style.display = "block";
|
||||||
setInfiltrateButton(infiltrate, Locations.AevumGalacticCybersystems,
|
setInfiltrateButton(infiltrate, Locations.AevumGalacticCybersystems,
|
||||||
1400, 30, 50, 5.3);
|
1400, 30, 50, 3.95);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Locations.AevumWatchdogSecurity:
|
case Locations.AevumWatchdogSecurity:
|
||||||
@ -517,7 +523,7 @@ function displayLocationContent() {
|
|||||||
securityJob.style.display = "block";
|
securityJob.style.display = "block";
|
||||||
agentJob.style.display = "block";
|
agentJob.style.display = "block";
|
||||||
setInfiltrateButton(infiltrate, Locations.AevumWatchdogSecurity,
|
setInfiltrateButton(infiltrate, Locations.AevumWatchdogSecurity,
|
||||||
850, 16, 30, 4.5);
|
765, 20, 30, 3);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Locations.AevumRhoConstruction:
|
case Locations.AevumRhoConstruction:
|
||||||
@ -526,7 +532,7 @@ function displayLocationContent() {
|
|||||||
softwareJob.style.display = "block";
|
softwareJob.style.display = "block";
|
||||||
businessJob.style.display = "block";
|
businessJob.style.display = "block";
|
||||||
setInfiltrateButton(infiltrate, Locations.AevumRhoConstruction,
|
setInfiltrateButton(infiltrate, Locations.AevumRhoConstruction,
|
||||||
600, 12, 20, 2.7);
|
540, 16, 20, 1.9);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Locations.AevumPolice:
|
case Locations.AevumPolice:
|
||||||
@ -535,7 +541,7 @@ function displayLocationContent() {
|
|||||||
softwareJob.style.display = "block";
|
softwareJob.style.display = "block";
|
||||||
securityJob.style.display = "block";
|
securityJob.style.display = "block";
|
||||||
setInfiltrateButton(infiltrate, Locations.AevumPolice,
|
setInfiltrateButton(infiltrate, Locations.AevumPolice,
|
||||||
700, 14, 25, 3.2);
|
630, 18, 25, 2.2);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Locations.AevumNetLinkTechnologies:
|
case Locations.AevumNetLinkTechnologies:
|
||||||
@ -554,7 +560,7 @@ function displayLocationContent() {
|
|||||||
purchaseHomeRam.style.display = "block";
|
purchaseHomeRam.style.display = "block";
|
||||||
purchaseHomeCores.style.display = "block";
|
purchaseHomeCores.style.display = "block";
|
||||||
setInfiltrateButton(infiltrate, Locations.AevumNetLinkTechnologies,
|
setInfiltrateButton(infiltrate, Locations.AevumNetLinkTechnologies,
|
||||||
160, 10, 15, 1.8);
|
144, 10, 15, 1.4);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Locations.AevumCrushFitnessGym:
|
case Locations.AevumCrushFitnessGym:
|
||||||
@ -588,7 +594,7 @@ function displayLocationContent() {
|
|||||||
businessJob.style.display = "block";
|
businessJob.style.display = "block";
|
||||||
securityJob.style.display = "block";
|
securityJob.style.display = "block";
|
||||||
setInfiltrateButton(infiltrate, Locations.ChongqingKuaiGongInternational,
|
setInfiltrateButton(infiltrate, Locations.ChongqingKuaiGongInternational,
|
||||||
5500, 48, 100, 9);
|
4950, 100, 100, 6.1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Locations.ChongqingSolarisSpaceSystems:
|
case Locations.ChongqingSolarisSpaceSystems:
|
||||||
@ -600,7 +606,7 @@ function displayLocationContent() {
|
|||||||
networkEngineerJob.style.display = "block";
|
networkEngineerJob.style.display = "block";
|
||||||
securityJob.style.display = "block";
|
securityJob.style.display = "block";
|
||||||
setInfiltrateButton(infiltrate, Locations.ChongqingSolarisSpaceSystems,
|
setInfiltrateButton(infiltrate, Locations.ChongqingSolarisSpaceSystems,
|
||||||
3600, 26, 75, 8.6);
|
3240, 52, 75, 6);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
@ -629,7 +635,7 @@ function displayLocationContent() {
|
|||||||
businessJob.style.display = "block";
|
businessJob.style.display = "block";
|
||||||
securityJob.style.display = "block";
|
securityJob.style.display = "block";
|
||||||
setInfiltrateButton(infiltrate, Locations.Sector12MegaCorp,
|
setInfiltrateButton(infiltrate, Locations.Sector12MegaCorp,
|
||||||
6000, 114, 125, 9.8);
|
5000, 114, 125, 6.75);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Locations.Sector12BladeIndustries:
|
case Locations.Sector12BladeIndustries:
|
||||||
@ -642,7 +648,7 @@ function displayLocationContent() {
|
|||||||
businessJob.style.display = "block";
|
businessJob.style.display = "block";
|
||||||
securityJob.style.display = "block";
|
securityJob.style.display = "block";
|
||||||
setInfiltrateButton(infiltrate, Locations.Sector12BladeIndustries,
|
setInfiltrateButton(infiltrate, Locations.Sector12BladeIndustries,
|
||||||
3000, 46, 100, 6.7);
|
2400, 46, 100, 4.2);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Locations.Sector12FourSigma:
|
case Locations.Sector12FourSigma:
|
||||||
@ -655,7 +661,7 @@ function displayLocationContent() {
|
|||||||
businessJob.style.display = "block";
|
businessJob.style.display = "block";
|
||||||
securityJob.style.display = "block";
|
securityJob.style.display = "block";
|
||||||
setInfiltrateButton(infiltrate, Locations.Sector12FourSigma,
|
setInfiltrateButton(infiltrate, Locations.Sector12FourSigma,
|
||||||
1500, 58, 100, 10.2);
|
1500, 58, 100, 7);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Locations.Sector12IcarusMicrosystems:
|
case Locations.Sector12IcarusMicrosystems:
|
||||||
@ -668,7 +674,7 @@ function displayLocationContent() {
|
|||||||
networkEngineerJob.style.display = "block";
|
networkEngineerJob.style.display = "block";
|
||||||
businessJob.style.display = "block";
|
businessJob.style.display = "block";
|
||||||
setInfiltrateButton(infiltrate, Locations.Sector12IcarusMicrosystems,
|
setInfiltrateButton(infiltrate, Locations.Sector12IcarusMicrosystems,
|
||||||
900, 32, 70, 7.8);
|
810, 32, 70, 5.4);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Locations.Sector12UniversalEnergy:
|
case Locations.Sector12UniversalEnergy:
|
||||||
@ -681,7 +687,7 @@ function displayLocationContent() {
|
|||||||
networkEngineerJob.style.display = "block";
|
networkEngineerJob.style.display = "block";
|
||||||
businessJob.style.display = "block";
|
businessJob.style.display = "block";
|
||||||
setInfiltrateButton(infiltrate, Locations.Sector12UniversalEnergy,
|
setInfiltrateButton(infiltrate, Locations.Sector12UniversalEnergy,
|
||||||
775, 24, 50, 6.3);
|
775, 24, 50, 4.3);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Locations.Sector12DeltaOne:
|
case Locations.Sector12DeltaOne:
|
||||||
@ -693,7 +699,7 @@ function displayLocationContent() {
|
|||||||
networkEngineerJob.style.display = "block";
|
networkEngineerJob.style.display = "block";
|
||||||
securityJob.style.display = "block";
|
securityJob.style.display = "block";
|
||||||
setInfiltrateButton(infiltrate, Locations.Sector12DeltaOne,
|
setInfiltrateButton(infiltrate, Locations.Sector12DeltaOne,
|
||||||
1200, 38, 75, 6.3);
|
1080, 38, 75, 4.5);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Locations.Sector12CIA:
|
case Locations.Sector12CIA:
|
||||||
@ -706,7 +712,7 @@ function displayLocationContent() {
|
|||||||
securityJob.style.display = "block";
|
securityJob.style.display = "block";
|
||||||
agentJob.style.display = "block";
|
agentJob.style.display = "block";
|
||||||
setInfiltrateButton(infiltrate, Locations.Sector12CIA,
|
setInfiltrateButton(infiltrate, Locations.Sector12CIA,
|
||||||
1450, 44, 80, 7.6);
|
1305, 44, 80, 4.6);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Locations.Sector12NSA:
|
case Locations.Sector12NSA:
|
||||||
@ -725,13 +731,13 @@ function displayLocationContent() {
|
|||||||
nsaBladeburner.innerText = "Enter Bladeburner Headquarters";
|
nsaBladeburner.innerText = "Enter Bladeburner Headquarters";
|
||||||
} else {
|
} else {
|
||||||
setInfiltrateButton(infiltrate, Locations.Sector12NSA,
|
setInfiltrateButton(infiltrate, Locations.Sector12NSA,
|
||||||
1400, 40, 80, 7.2);
|
1260, 40, 80, 5);
|
||||||
nsaBladeburner.innerText = "Apply to Bladeburner Division";
|
nsaBladeburner.innerText = "Apply to Bladeburner Division";
|
||||||
}
|
}
|
||||||
nsaBladeburner.style.display = "block";
|
nsaBladeburner.style.display = "block";
|
||||||
} else {
|
} else {
|
||||||
setInfiltrateButton(infiltrate, Locations.Sector12NSA,
|
setInfiltrateButton(infiltrate, Locations.Sector12NSA,
|
||||||
1400, 40, 80, 7.2);
|
1260, 40, 80, 5);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -747,7 +753,7 @@ function displayLocationContent() {
|
|||||||
purchaseHomeRam.style.display = "block";
|
purchaseHomeRam.style.display = "block";
|
||||||
purchaseHomeCores.style.display = "block";
|
purchaseHomeCores.style.display = "block";
|
||||||
setInfiltrateButton(infiltrate, Locations.Sector12AlphaEnterprises,
|
setInfiltrateButton(infiltrate, Locations.Sector12AlphaEnterprises,
|
||||||
250, 14, 40, 2.7);
|
225, 14, 40, 2.25);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Locations.Sector12CarmichaelSecurity:
|
case Locations.Sector12CarmichaelSecurity:
|
||||||
@ -761,7 +767,7 @@ function displayLocationContent() {
|
|||||||
securityJob.style.display = "block";
|
securityJob.style.display = "block";
|
||||||
agentJob.style.display = "block";
|
agentJob.style.display = "block";
|
||||||
setInfiltrateButton(infiltrate, Locations.Sector12CarmichaelSecurity,
|
setInfiltrateButton(infiltrate, Locations.Sector12CarmichaelSecurity,
|
||||||
500, 18, 60, 2.7);
|
450, 18, 60, 2.5);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Locations.Sector12FoodNStuff:
|
case Locations.Sector12FoodNStuff:
|
||||||
@ -777,7 +783,7 @@ function displayLocationContent() {
|
|||||||
employeeJob.style.display = "block";
|
employeeJob.style.display = "block";
|
||||||
employeePartTimeJob.style.display = "block";
|
employeePartTimeJob.style.display = "block";
|
||||||
setInfiltrateButton(infiltrate, Locations.Sector12JoesGuns,
|
setInfiltrateButton(infiltrate, Locations.Sector12JoesGuns,
|
||||||
120, 8, 20, 2.2);
|
120, 8, 20, 1.8);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Locations.Sector12IronGym:
|
case Locations.Sector12IronGym:
|
||||||
@ -819,7 +825,7 @@ function displayLocationContent() {
|
|||||||
securityEngineerJob.style.display = "block";
|
securityEngineerJob.style.display = "block";
|
||||||
networkEngineerJob.style.display = "block";
|
networkEngineerJob.style.display = "block";
|
||||||
setInfiltrateButton(infiltrate, Locations.NewTokyoDefComm,
|
setInfiltrateButton(infiltrate, Locations.NewTokyoDefComm,
|
||||||
1300, 28, 70, 5.4);
|
1170, 28, 70, 4);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Locations.NewTokyoVitaLife:
|
case Locations.NewTokyoVitaLife:
|
||||||
@ -832,7 +838,7 @@ function displayLocationContent() {
|
|||||||
networkEngineerJob.style.display = "block";
|
networkEngineerJob.style.display = "block";
|
||||||
businessJob.style.display = "block";
|
businessJob.style.display = "block";
|
||||||
setInfiltrateButton(infiltrate, Locations.NewTokyoVitaLife,
|
setInfiltrateButton(infiltrate, Locations.NewTokyoVitaLife,
|
||||||
750, 22, 100, 5);
|
675, 22, 100, 3.5);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Locations.NewTokyoGlobalPharmaceuticals:
|
case Locations.NewTokyoGlobalPharmaceuticals:
|
||||||
@ -846,7 +852,7 @@ function displayLocationContent() {
|
|||||||
businessJob.style.display = "block";
|
businessJob.style.display = "block";
|
||||||
securityJob.style.display = "block";
|
securityJob.style.display = "block";
|
||||||
setInfiltrateButton(infiltrate, Locations.NewTokyoGlobalPharmaceuticals,
|
setInfiltrateButton(infiltrate, Locations.NewTokyoGlobalPharmaceuticals,
|
||||||
900, 24, 80, 5.4);
|
775, 24, 80, 3.8);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Locations.NewTokyoNoodleBar:
|
case Locations.NewTokyoNoodleBar:
|
||||||
@ -886,7 +892,7 @@ function displayLocationContent() {
|
|||||||
purchaseHomeRam.style.display = "block";
|
purchaseHomeRam.style.display = "block";
|
||||||
purchaseHomeCores.style.display = "block";
|
purchaseHomeCores.style.display = "block";
|
||||||
setInfiltrateButton(infiltrate, Locations.IshimaStormTechnologies,
|
setInfiltrateButton(infiltrate, Locations.IshimaStormTechnologies,
|
||||||
700, 24, 100, 5.9);
|
630, 24, 100, 4.1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Locations.IshimaNovaMedical:
|
case Locations.IshimaNovaMedical:
|
||||||
@ -899,7 +905,7 @@ function displayLocationContent() {
|
|||||||
networkEngineerJob.style.display = "block";
|
networkEngineerJob.style.display = "block";
|
||||||
businessJob.style.display = "block";
|
businessJob.style.display = "block";
|
||||||
setInfiltrateButton(infiltrate, Locations.IshimaNovaMedical,
|
setInfiltrateButton(infiltrate, Locations.IshimaNovaMedical,
|
||||||
600, 20, 50, 4.5);
|
540, 20, 50, 3.2);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Locations.IshimaOmegaSoftware:
|
case Locations.IshimaOmegaSoftware:
|
||||||
@ -918,7 +924,7 @@ function displayLocationContent() {
|
|||||||
purchaseHomeRam.style.display = "block";
|
purchaseHomeRam.style.display = "block";
|
||||||
purchaseHomeCores.style.display = "block";
|
purchaseHomeCores.style.display = "block";
|
||||||
setInfiltrateButton(infiltrate, Locations.IshimaOmegaSoftware,
|
setInfiltrateButton(infiltrate, Locations.IshimaOmegaSoftware,
|
||||||
200, 10, 40, 2.3);
|
130, 10, 40, 1.6);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Locations.VolhavenTravelAgency:
|
case Locations.VolhavenTravelAgency:
|
||||||
@ -951,7 +957,7 @@ function displayLocationContent() {
|
|||||||
purchase512gb.style.display = "block";
|
purchase512gb.style.display = "block";
|
||||||
purchase1tb.style.display = "block";
|
purchase1tb.style.display = "block";
|
||||||
setInfiltrateButton(infiltrate, Locations.VolhavenOmniTekIncorporated,
|
setInfiltrateButton(infiltrate, Locations.VolhavenOmniTekIncorporated,
|
||||||
1500, 44, 100, 6.3);
|
1350, 44, 100, 4.4);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Locations.VolhavenNWO:
|
case Locations.VolhavenNWO:
|
||||||
@ -964,7 +970,7 @@ function displayLocationContent() {
|
|||||||
businessJob.style.display = "block";
|
businessJob.style.display = "block";
|
||||||
securityJob.style.display = "block";
|
securityJob.style.display = "block";
|
||||||
setInfiltrateButton(infiltrate, Locations.VolhavenNWO,
|
setInfiltrateButton(infiltrate, Locations.VolhavenNWO,
|
||||||
1800, 56, 200, 7.2);
|
1620, 56, 200, 6.8);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Locations.VolhavenHeliosLabs:
|
case Locations.VolhavenHeliosLabs:
|
||||||
@ -976,7 +982,7 @@ function displayLocationContent() {
|
|||||||
securityEngineerJob.style.display = "block";
|
securityEngineerJob.style.display = "block";
|
||||||
networkEngineerJob.style.display = "block";
|
networkEngineerJob.style.display = "block";
|
||||||
setInfiltrateButton(infiltrate, Locations.VolhavenHeliosLabs,
|
setInfiltrateButton(infiltrate, Locations.VolhavenHeliosLabs,
|
||||||
1200, 28, 75, 5.4);
|
1200, 28, 75, 3);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Locations.VolhavenOmniaCybersystems:
|
case Locations.VolhavenOmniaCybersystems:
|
||||||
@ -988,7 +994,7 @@ function displayLocationContent() {
|
|||||||
networkEngineerJob.style.display = "block";
|
networkEngineerJob.style.display = "block";
|
||||||
securityJob.style.display = "block";
|
securityJob.style.display = "block";
|
||||||
setInfiltrateButton(infiltrate, Locations.VolhavenOmniaCybersystems,
|
setInfiltrateButton(infiltrate, Locations.VolhavenOmniaCybersystems,
|
||||||
900, 28, 90, 5.8);
|
810, 28, 90, 4.9);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Locations.VolhavenLexoCorp:
|
case Locations.VolhavenLexoCorp:
|
||||||
@ -1002,7 +1008,7 @@ function displayLocationContent() {
|
|||||||
businessJob.style.display = "block";
|
businessJob.style.display = "block";
|
||||||
securityJob.style.display = "block";
|
securityJob.style.display = "block";
|
||||||
setInfiltrateButton(infiltrate, Locations.VolhavenLexoCorp,
|
setInfiltrateButton(infiltrate, Locations.VolhavenLexoCorp,
|
||||||
500, 14, 40, 3.1);
|
375, 14, 60, 2);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Locations.VolhavenSysCoreSecurities:
|
case Locations.VolhavenSysCoreSecurities:
|
||||||
@ -1013,7 +1019,7 @@ function displayLocationContent() {
|
|||||||
securityEngineerJob.style.display = "block";
|
securityEngineerJob.style.display = "block";
|
||||||
networkEngineerJob.style.display = "block";
|
networkEngineerJob.style.display = "block";
|
||||||
setInfiltrateButton(infiltrate, Locations.VolhavenSysCoreSecurities,
|
setInfiltrateButton(infiltrate, Locations.VolhavenSysCoreSecurities,
|
||||||
600, 16, 50, 3.6);
|
480, 18, 75, 2.4);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Locations.VolhavenCompuTek:
|
case Locations.VolhavenCompuTek:
|
||||||
@ -1035,7 +1041,7 @@ function displayLocationContent() {
|
|||||||
purchaseHomeRam.style.display = "block";
|
purchaseHomeRam.style.display = "block";
|
||||||
purchaseHomeCores.style.display = "block";
|
purchaseHomeCores.style.display = "block";
|
||||||
setInfiltrateButton(infiltrate, Locations.VolhavenCompuTek,
|
setInfiltrateButton(infiltrate, Locations.VolhavenCompuTek,
|
||||||
300, 12, 35, 3.1);
|
215, 12, 60, 2.1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Locations.VolhavenMilleniumFitnessGym:
|
case Locations.VolhavenMilleniumFitnessGym:
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
import {Augmentations, Augmentation,
|
import {Augmentations, Augmentation,
|
||||||
AugmentationNames} from "./Augmentations.js";
|
AugmentationNames} from "./Augmentations";
|
||||||
import {Programs} from "./CreateProgram.js";
|
import {Programs} from "./CreateProgram";
|
||||||
import {inMission} from "./Missions.js";
|
import {inMission} from "./Missions";
|
||||||
import {Player} from "./Player.js";
|
import {Player} from "./Player";
|
||||||
import {redPillFlag} from "./RedPill.js";
|
import {redPillFlag} from "./RedPill";
|
||||||
import {GetServerByHostname} from "./Server.js";
|
import {GetServerByHostname} from "./Server";
|
||||||
import {Settings} from "./Settings.js";
|
import {Settings} from "./Settings";
|
||||||
import {dialogBoxCreate, dialogBoxOpened} from "../utils/DialogBox.js";
|
import {dialogBoxCreate, dialogBoxOpened} from "../utils/DialogBox";
|
||||||
import {Reviver, Generic_toJSON,
|
import {Reviver, Generic_toJSON,
|
||||||
Generic_fromJSON} from "../utils/JSONReviver.js";
|
Generic_fromJSON} from "../utils/JSONReviver";
|
||||||
|
|
||||||
/* Message.js */
|
/* Message.js */
|
||||||
function Message(filename="", msg="") {
|
function Message(filename="", msg="") {
|
||||||
@ -88,7 +88,7 @@ function checkForMessagesToSend() {
|
|||||||
}
|
}
|
||||||
} else if (jumper0 && !jumper0.recvd && Player.hacking_skill >= 25) {
|
} else if (jumper0 && !jumper0.recvd && Player.hacking_skill >= 25) {
|
||||||
sendMessage(jumper0);
|
sendMessage(jumper0);
|
||||||
Player.getHomeComputer().programs.push(Programs.Flight);
|
Player.getHomeComputer().programs.push(Programs.Flight.name);
|
||||||
} else if (jumper1 && !jumper1.recvd && Player.hacking_skill >= 40) {
|
} else if (jumper1 && !jumper1.recvd && Player.hacking_skill >= 40) {
|
||||||
sendMessage(jumper1);
|
sendMessage(jumper1);
|
||||||
} else if (cybersecTest && !cybersecTest.recvd && Player.hacking_skill >= 50) {
|
} else if (cybersecTest && !cybersecTest.recvd && Player.hacking_skill >= 50) {
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
import {CONSTANTS} from "./Constants.js";
|
import {CONSTANTS} from "./Constants";
|
||||||
import {Engine} from "./engine.js";
|
import {Engine} from "./engine";
|
||||||
import {displayFactionContent} from "./Faction.js";
|
import {displayFactionContent} from "./Faction";
|
||||||
import {Player} from "./Player.js";
|
import {Player} from "./Player";
|
||||||
import {dialogBoxCreate} from "../utils/DialogBox.js";
|
import {dialogBoxCreate} from "../utils/DialogBox";
|
||||||
import {addOffset, getRandomInt,
|
import {addOffset, getRandomInt,
|
||||||
clearEventListenersEl,
|
clearEventListenersEl,
|
||||||
clearEventListeners} from "../utils/HelperFunctions.js";
|
clearEventListeners} from "../utils/HelperFunctions";
|
||||||
import {formatNumber, isString} from "../utils/StringHelperFunctions.js";
|
import {formatNumber, isString} from "../utils/StringHelperFunctions";
|
||||||
import jsplumb from 'jsplumb'
|
import jsplumb from 'jsplumb'
|
||||||
|
|
||||||
let inMission = false; //Flag to denote whether a mission is running
|
let inMission = false; //Flag to denote whether a mission is running
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import {HacknetNode} from "./HacknetNode.js";
|
import {HacknetNode} from "./HacknetNode";
|
||||||
import {NetscriptFunctions} from "./NetscriptFunctions.js";
|
import {NetscriptFunctions} from "./NetscriptFunctions";
|
||||||
import {NetscriptPort} from "./NetscriptPort.js";
|
import {NetscriptPort} from "./NetscriptPort";
|
||||||
|
|
||||||
/* Environment
|
/* Environment
|
||||||
* NetScript program environment
|
* NetScript program environment
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
import {BitNodeMultipliers} from "./BitNode.js";
|
import {BitNodeMultipliers} from "./BitNode";
|
||||||
import {CONSTANTS} from "./Constants.js";
|
import {CONSTANTS} from "./Constants";
|
||||||
import {Player} from "./Player.js";
|
import {Player} from "./Player";
|
||||||
import {Environment} from "./NetscriptEnvironment.js";
|
import {Environment} from "./NetscriptEnvironment";
|
||||||
import {WorkerScript, addWorkerScript} from "./NetscriptWorker.js";
|
import {WorkerScript, addWorkerScript} from "./NetscriptWorker";
|
||||||
import {Server, getServer} from "./Server.js";
|
import {Server, getServer} from "./Server";
|
||||||
import {Settings} from "./Settings.js";
|
import {Settings} from "./Settings";
|
||||||
import {Script, findRunningScript,
|
import {Script, findRunningScript,
|
||||||
RunningScript} from "./Script.js";
|
RunningScript} from "./Script";
|
||||||
|
|
||||||
import {parse, Node} from "../utils/acorn.js";
|
import {parse, Node} from "../utils/acorn";
|
||||||
import {printArray} from "../utils/HelperFunctions.js";
|
import {printArray} from "../utils/HelperFunctions";
|
||||||
import {isValidIPAddress} from "../utils/IPAddress.js";
|
import {isValidIPAddress} from "../utils/IPAddress";
|
||||||
import {isString} from "../utils/StringHelperFunctions.js";
|
import {isString} from "../utils/StringHelperFunctions";
|
||||||
|
|
||||||
var Promise = require("bluebird");
|
var Promise = require("bluebird");
|
||||||
|
|
||||||
|
@ -1,60 +1,60 @@
|
|||||||
var sprintf = require('sprintf-js').sprintf,
|
var sprintf = require('sprintf-js').sprintf,
|
||||||
vsprintf = require('sprintf-js').vsprintf
|
vsprintf = require('sprintf-js').vsprintf
|
||||||
|
|
||||||
import {updateActiveScriptsItems} from "./ActiveScriptsUI.js";
|
import {updateActiveScriptsItems} from "./ActiveScriptsUI";
|
||||||
import {Augmentations, Augmentation,
|
import {Augmentations, Augmentation,
|
||||||
augmentationExists, installAugmentations,
|
augmentationExists, installAugmentations,
|
||||||
AugmentationNames} from "./Augmentations.js";
|
AugmentationNames} from "./Augmentations";
|
||||||
import {BitNodeMultipliers} from "./BitNode.js";
|
import {BitNodeMultipliers} from "./BitNode";
|
||||||
import {determineCrimeSuccess, findCrime} from "./Crimes.js";
|
import {determineCrimeSuccess, findCrime} from "./Crimes";
|
||||||
import {Bladeburner} from "./Bladeburner.js";
|
import {Bladeburner} from "./Bladeburner";
|
||||||
import {Companies, Company, CompanyPosition,
|
import {Companies, Company, CompanyPosition,
|
||||||
CompanyPositions, companyExists} from "./Company.js";
|
CompanyPositions, companyExists} from "./Company";
|
||||||
import {CONSTANTS} from "./Constants.js";
|
import {CONSTANTS} from "./Constants";
|
||||||
import {Programs} from "./CreateProgram.js";
|
import {Programs} from "./CreateProgram";
|
||||||
import {DarkWebItems} from "./DarkWeb.js";
|
import {DarkWebItems} from "./DarkWeb";
|
||||||
import {Engine} from "./engine.js";
|
import {Engine} from "./engine";
|
||||||
import {AllGangs} from "./Gang.js";
|
import {AllGangs} from "./Gang";
|
||||||
import {Factions, Faction, joinFaction,
|
import {Factions, Faction, joinFaction,
|
||||||
factionExists, purchaseAugmentation} from "./Faction.js";
|
factionExists, purchaseAugmentation} from "./Faction";
|
||||||
import {getCostOfNextHacknetNode, purchaseHacknet} from "./HacknetNode.js";
|
import {getCostOfNextHacknetNode, purchaseHacknet} from "./HacknetNode";
|
||||||
import {Locations} from "./Location.js";
|
import {Locations} from "./Location";
|
||||||
import {Message, Messages} from "./Message.js";
|
import {Message, Messages} from "./Message";
|
||||||
import {inMission} from "./Missions.js";
|
import {inMission} from "./Missions";
|
||||||
import {Player} from "./Player.js";
|
import {Player} from "./Player";
|
||||||
import {Script, findRunningScript, RunningScript,
|
import {Script, findRunningScript, RunningScript,
|
||||||
isScriptFilename} from "./Script.js";
|
isScriptFilename} from "./Script";
|
||||||
import {Server, getServer, AddToAllServers,
|
import {Server, getServer, AddToAllServers,
|
||||||
AllServers, processSingleServerGrowth,
|
AllServers, processSingleServerGrowth,
|
||||||
GetServerByHostname} from "./Server.js";
|
GetServerByHostname} from "./Server";
|
||||||
import {Settings} from "./Settings.js";
|
import {Settings} from "./Settings";
|
||||||
import {SpecialServerIps} from "./SpecialServerIps.js";
|
import {SpecialServerIps} from "./SpecialServerIps";
|
||||||
import {StockMarket, StockSymbols, SymbolToStockMap, initStockSymbols,
|
import {StockMarket, StockSymbols, SymbolToStockMap, initStockSymbols,
|
||||||
initStockMarket, initSymbolToStockMap, stockMarketCycle, buyStock,
|
initStockMarket, initSymbolToStockMap, stockMarketCycle, buyStock,
|
||||||
sellStock, updateStockPrices, displayStockMarketContent,
|
sellStock, updateStockPrices, displayStockMarketContent,
|
||||||
updateStockTicker, updateStockPlayerPosition,
|
updateStockTicker, updateStockPlayerPosition,
|
||||||
Stock, shortStock, sellShort, OrderTypes,
|
Stock, shortStock, sellShort, OrderTypes,
|
||||||
PositionTypes, placeOrder, cancelOrder} from "./StockMarket.js";
|
PositionTypes, placeOrder, cancelOrder} from "./StockMarket";
|
||||||
import {post} from "./Terminal.js";
|
import {post} from "./Terminal";
|
||||||
import {TextFile, getTextFile, createTextFile} from "./TextFile";
|
import {TextFile, getTextFile, createTextFile} from "./TextFile";
|
||||||
|
|
||||||
import {WorkerScript, workerScripts,
|
import {WorkerScript, workerScripts,
|
||||||
killWorkerScript, NetscriptPorts} from "./NetscriptWorker.js";
|
killWorkerScript, NetscriptPorts} from "./NetscriptWorker";
|
||||||
import {makeRuntimeRejectMsg, netscriptDelay, runScriptFromScript,
|
import {makeRuntimeRejectMsg, netscriptDelay, runScriptFromScript,
|
||||||
scriptCalculateHackingChance, scriptCalculateHackingTime,
|
scriptCalculateHackingChance, scriptCalculateHackingTime,
|
||||||
scriptCalculateExpGain, scriptCalculatePercentMoneyHacked,
|
scriptCalculateExpGain, scriptCalculatePercentMoneyHacked,
|
||||||
scriptCalculateGrowTime, scriptCalculateWeakenTime} from "./NetscriptEvaluator.js";
|
scriptCalculateGrowTime, scriptCalculateWeakenTime} from "./NetscriptEvaluator";
|
||||||
import {Environment} from "./NetscriptEnvironment.js";
|
import {Environment} from "./NetscriptEnvironment";
|
||||||
import {NetscriptPort} from "./NetscriptPort.js";
|
import {NetscriptPort} from "./NetscriptPort";
|
||||||
|
|
||||||
import Decimal from "decimal.js";
|
import Decimal from "decimal.js";
|
||||||
import {dialogBoxCreate} from "../utils/DialogBox.js";
|
import {dialogBoxCreate} from "../utils/DialogBox";
|
||||||
import {printArray, powerOfTwo} from "../utils/HelperFunctions.js";
|
import {printArray, powerOfTwo} from "../utils/HelperFunctions";
|
||||||
import {createRandomIp} from "../utils/IPAddress.js";
|
import {createRandomIp} from "../utils/IPAddress";
|
||||||
import {formatNumber, isString, isHTML} from "../utils/StringHelperFunctions.js";
|
import {formatNumber, isString, isHTML} from "../utils/StringHelperFunctions";
|
||||||
import {yesNoBoxClose, yesNoBoxGetYesButton,
|
import {yesNoBoxClose, yesNoBoxGetYesButton,
|
||||||
yesNoBoxGetNoButton, yesNoBoxCreate,
|
yesNoBoxGetNoButton, yesNoBoxCreate,
|
||||||
yesNoBoxOpen} from "../utils/YesNoBox.js";
|
yesNoBoxOpen} from "../utils/YesNoBox";
|
||||||
|
|
||||||
var hasCorporationSF = false, //Source-File 3
|
var hasCorporationSF = false, //Source-File 3
|
||||||
hasSingularitySF = false, //Source-File 4
|
hasSingularitySF = false, //Source-File 4
|
||||||
@ -430,7 +430,7 @@ function NetscriptFunctions(workerScript) {
|
|||||||
workerScript.scriptRef.log("Cannot call nuke(). Invalid IP or hostname passed in: " + ip);
|
workerScript.scriptRef.log("Cannot call nuke(). Invalid IP or hostname passed in: " + ip);
|
||||||
throw makeRuntimeRejectMsg(workerScript, "Cannot call nuke(). Invalid IP or hostname passed in: " + ip);
|
throw makeRuntimeRejectMsg(workerScript, "Cannot call nuke(). Invalid IP or hostname passed in: " + ip);
|
||||||
}
|
}
|
||||||
if (!Player.hasProgram(Programs.NukeProgram)) {
|
if (!Player.hasProgram(Programs.NukeProgram.name)) {
|
||||||
throw makeRuntimeRejectMsg(workerScript, "You do not have the NUKE.exe virus!");
|
throw makeRuntimeRejectMsg(workerScript, "You do not have the NUKE.exe virus!");
|
||||||
}
|
}
|
||||||
if (server.openPortCount < server.numOpenPortsRequired) {
|
if (server.openPortCount < server.numOpenPortsRequired) {
|
||||||
@ -461,7 +461,7 @@ function NetscriptFunctions(workerScript) {
|
|||||||
workerScript.scriptRef.log("Cannot call brutessh(). Invalid IP or hostname passed in: " + ip);
|
workerScript.scriptRef.log("Cannot call brutessh(). Invalid IP or hostname passed in: " + ip);
|
||||||
throw makeRuntimeRejectMsg(workerScript, "Cannot call brutessh(). Invalid IP or hostname passed in: " + ip);
|
throw makeRuntimeRejectMsg(workerScript, "Cannot call brutessh(). Invalid IP or hostname passed in: " + ip);
|
||||||
}
|
}
|
||||||
if (!Player.hasProgram(Programs.BruteSSHProgram)) {
|
if (!Player.hasProgram(Programs.BruteSSHProgram.name)) {
|
||||||
workerScript.scriptRef.log("You do not have the BruteSSH.exe program!");
|
workerScript.scriptRef.log("You do not have the BruteSSH.exe program!");
|
||||||
throw makeRuntimeRejectMsg(workerScript, "You do not have the BruteSSH.exe program!");
|
throw makeRuntimeRejectMsg(workerScript, "You do not have the BruteSSH.exe program!");
|
||||||
}
|
}
|
||||||
@ -491,7 +491,7 @@ function NetscriptFunctions(workerScript) {
|
|||||||
workerScript.scriptRef.log("Cannot call ftpcrack(). Invalid IP or hostname passed in: " + ip);
|
workerScript.scriptRef.log("Cannot call ftpcrack(). Invalid IP or hostname passed in: " + ip);
|
||||||
throw makeRuntimeRejectMsg(workerScript, "Cannot call ftpcrack(). Invalid IP or hostname passed in: " + ip);
|
throw makeRuntimeRejectMsg(workerScript, "Cannot call ftpcrack(). Invalid IP or hostname passed in: " + ip);
|
||||||
}
|
}
|
||||||
if (!Player.hasProgram(Programs.FTPCrackProgram)) {
|
if (!Player.hasProgram(Programs.FTPCrackProgram.name)) {
|
||||||
throw makeRuntimeRejectMsg(workerScript, "You do not have the FTPCrack.exe program!");
|
throw makeRuntimeRejectMsg(workerScript, "You do not have the FTPCrack.exe program!");
|
||||||
}
|
}
|
||||||
if (!server.ftpPortOpen) {
|
if (!server.ftpPortOpen) {
|
||||||
@ -520,7 +520,7 @@ function NetscriptFunctions(workerScript) {
|
|||||||
workerScript.scriptRef.log("Cannot call relaysmtp(). Invalid IP or hostname passed in: " + ip);
|
workerScript.scriptRef.log("Cannot call relaysmtp(). Invalid IP or hostname passed in: " + ip);
|
||||||
throw makeRuntimeRejectMsg(workerScript, "Cannot call relaysmtp(). Invalid IP or hostname passed in: " + ip);
|
throw makeRuntimeRejectMsg(workerScript, "Cannot call relaysmtp(). Invalid IP or hostname passed in: " + ip);
|
||||||
}
|
}
|
||||||
if (!Player.hasProgram(Programs.RelaySMTPProgram)) {
|
if (!Player.hasProgram(Programs.RelaySMTPProgram.name)) {
|
||||||
throw makeRuntimeRejectMsg(workerScript, "You do not have the relaySMTP.exe program!");
|
throw makeRuntimeRejectMsg(workerScript, "You do not have the relaySMTP.exe program!");
|
||||||
}
|
}
|
||||||
if (!server.smtpPortOpen) {
|
if (!server.smtpPortOpen) {
|
||||||
@ -549,7 +549,7 @@ function NetscriptFunctions(workerScript) {
|
|||||||
workerScript.scriptRef.log("Cannot call httpworm(). Invalid IP or hostname passed in: " + ip);
|
workerScript.scriptRef.log("Cannot call httpworm(). Invalid IP or hostname passed in: " + ip);
|
||||||
throw makeRuntimeRejectMsg(workerScript, "Cannot call httpworm(). Invalid IP or hostname passed in: " + ip);
|
throw makeRuntimeRejectMsg(workerScript, "Cannot call httpworm(). Invalid IP or hostname passed in: " + ip);
|
||||||
}
|
}
|
||||||
if (!Player.hasProgram(Programs.HTTPWormProgram)) {
|
if (!Player.hasProgram(Programs.HTTPWormProgram.name)) {
|
||||||
throw makeRuntimeRejectMsg(workerScript, "You do not have the HTTPWorm.exe program!");
|
throw makeRuntimeRejectMsg(workerScript, "You do not have the HTTPWorm.exe program!");
|
||||||
}
|
}
|
||||||
if (!server.httpPortOpen) {
|
if (!server.httpPortOpen) {
|
||||||
@ -578,7 +578,7 @@ function NetscriptFunctions(workerScript) {
|
|||||||
workerScript.scriptRef.log("Cannot call sqlinject(). Invalid IP or hostname passed in: " + ip);
|
workerScript.scriptRef.log("Cannot call sqlinject(). Invalid IP or hostname passed in: " + ip);
|
||||||
throw makeRuntimeRejectMsg(workerScript, "Cannot call sqlinject(). Invalid IP or hostname passed in: " + ip);
|
throw makeRuntimeRejectMsg(workerScript, "Cannot call sqlinject(). Invalid IP or hostname passed in: " + ip);
|
||||||
}
|
}
|
||||||
if (!Player.hasProgram(Programs.SQLInjectProgram)) {
|
if (!Player.hasProgram(Programs.SQLInjectProgram.name)) {
|
||||||
throw makeRuntimeRejectMsg(workerScript, "You do not have the SQLInject.exe program!");
|
throw makeRuntimeRejectMsg(workerScript, "You do not have the SQLInject.exe program!");
|
||||||
}
|
}
|
||||||
if (!server.sqlPortOpen) {
|
if (!server.sqlPortOpen) {
|
||||||
@ -2900,78 +2900,34 @@ function NetscriptFunctions(workerScript) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(name.toLowerCase()) {
|
name = name.toLowerCase();
|
||||||
case Programs.NukeProgram.toLowerCase():
|
|
||||||
Player.startCreateProgramWork(Programs.NukeProgram, CONSTANTS.MillisecondsPerFiveMinutes, 1);
|
let p = null;
|
||||||
break;
|
for (const key in Programs) {
|
||||||
case Programs.BruteSSHProgram.toLowerCase():
|
if(Programs[key].name.toLowerCase() == name) {
|
||||||
if (Player.hacking_skill < 50) {
|
p = Programs[key];
|
||||||
workerScript.scriptRef.log("ERROR: createProgram() failed because hacking level is too low to create BruteSSH (level 50 req)");
|
}
|
||||||
return false;
|
}
|
||||||
}
|
|
||||||
Player.startCreateProgramWork(Programs.BruteSSHProgram, CONSTANTS.MillisecondsPerFiveMinutes * 2, 50);
|
if (p == null) {
|
||||||
break;
|
workerScript.scriptRef.log("ERROR: createProgram() failed because the specified program does not exist: " + name);
|
||||||
case Programs.FTPCrackProgram.toLowerCase():
|
return false;
|
||||||
if (Player.hacking_skill < 100) {
|
}
|
||||||
workerScript.scriptRef.log("ERROR: createProgram() failed because hacking level is too low to create FTPCrack (level 100 req)");
|
|
||||||
return false;
|
if (Player.hasProgram(p.name)) {
|
||||||
}
|
workerScript.scriptRef.log('ERROR: createProgram() failed because you already have the ' + p.name + ' program');
|
||||||
Player.startCreateProgramWork(Programs.FTPCrackProgram, CONSTANTS.MillisecondsPerHalfHour, 100);
|
return false;
|
||||||
break;
|
}
|
||||||
case Programs.RelaySMTPProgram.toLowerCase():
|
|
||||||
if (Player.hacking_skill < 250) {
|
if (!p.create.req()) {
|
||||||
workerScript.scriptRef.log("ERROR: createProgram() failed because hacking level is too low to create relaySMTP (level 250 req)");
|
workerScript.scriptRef.log("ERROR: createProgram() failed because hacking level is too low to create " + p.name + " (level " + p.create.level + " req)");
|
||||||
return false;
|
return false
|
||||||
}
|
}
|
||||||
Player.startCreateProgramWork(Programs.RelaySMTPProgram, CONSTANTS.MillisecondsPer2Hours, 250);
|
|
||||||
break;
|
Player.startCreateProgramWork(p.name, p.create.time, p.create.level);
|
||||||
case Programs.HTTPWormProgram.toLowerCase():
|
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.createProgram == null) {
|
||||||
if (Player.hacking_skill < 500) {
|
workerScript.scriptRef.log("Began creating program: " + name);
|
||||||
workerScript.scriptRef.log("ERROR: createProgram() failed because hacking level is too low to create HTTPWorm (level 500 req)");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
Player.startCreateProgramWork(Programs.HTTPWormProgram, CONSTANTS.MillisecondsPer4Hours, 500);
|
|
||||||
break;
|
|
||||||
case Programs.SQLInjectProgram.toLowerCase():
|
|
||||||
if (Player.hacking_skill < 750) {
|
|
||||||
workerScript.scriptRef.log("ERROR: createProgram() failed because hacking level is too low to create SQLInject (level 750 req)");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
Player.startCreateProgramWork(Programs.SQLInjectProgram, CONSTANTS.MillisecondsPer8Hours, 750);
|
|
||||||
break;
|
|
||||||
case Programs.DeepscanV1.toLowerCase():
|
|
||||||
if (Player.hacking_skill < 75) {
|
|
||||||
workerScript.scriptRef.log("ERROR: createProgram() failed because hacking level is too low to create DeepscanV1 (level 75 req)");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
Player.startCreateProgramWork(Programs.DeepscanV1, CONSTANTS.MillisecondsPerQuarterHour, 75);
|
|
||||||
break;
|
|
||||||
case Programs.DeepscanV2.toLowerCase():
|
|
||||||
if (Player.hacking_skill < 400) {
|
|
||||||
workerScript.scriptRef.log("ERROR: createProgram() failed because hacking level is too low to create DeepscanV2 (level 400 req)");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
Player.startCreateProgramWork(Programs.DeepscanV2, CONSTANTS.MillisecondsPer2Hours, 400);
|
|
||||||
break;
|
|
||||||
case Programs.ServerProfiler.toLowerCase():
|
|
||||||
if (Player.hacking_skill < 75) {
|
|
||||||
workerScript.scriptRef.log("ERROR: createProgram() failed because hacking level is too low to create ServerProfiler (level 75 req)");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
Player.startCreateProgramWork(Programs.ServerProfiler, CONSTANTS.MillisecondsPerHalfHour, 75);
|
|
||||||
break;
|
|
||||||
case Programs.AutoLink.toLowerCase():
|
|
||||||
if (Player.hacking_skill < 25) {
|
|
||||||
workerScript.scriptRef.log("ERROR: createProgram() failed because hacking level is too low to create AutoLink (level 25 req)");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
Player.startCreateProgramWork(Programs.AutoLink, CONSTANTS.MillisecondsPerQuarterHour, 25);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
workerScript.scriptRef.log("ERROR: createProgram() failed because the specified program does not exist: " + name);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
workerScript.scriptRef.log("Began creating program: " + name);
|
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
commitCrime : function(crimeRoughName) {
|
commitCrime : function(crimeRoughName) {
|
||||||
@ -3215,57 +3171,57 @@ function NetscriptFunctions(workerScript) {
|
|||||||
|
|
||||||
//Bladeburner API
|
//Bladeburner API
|
||||||
bladeburner : {
|
bladeburner : {
|
||||||
getContractNames : function(name) {
|
getContractNames : function() {
|
||||||
if (workerScript.checkingRam) {
|
if (workerScript.checkingRam) {
|
||||||
return updateStaticRam("getContractNames", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 10);
|
return updateStaticRam("getContractNames", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 10);
|
||||||
}
|
}
|
||||||
updateDynamicRam("getContractNames", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 10);
|
updateDynamicRam("getContractNames", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 10);
|
||||||
if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {
|
if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {
|
||||||
return Player.bladeburner.getContractNamesNetscriptFn(name);
|
return Player.bladeburner.getContractNamesNetscriptFn();
|
||||||
}
|
}
|
||||||
throw makeRuntimeRejectMsg(workerScript, "getContractNames() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed " +
|
throw makeRuntimeRejectMsg(workerScript, "getContractNames() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed " +
|
||||||
"at the Bladeburner division or because you do not have Source-File 7");
|
"at the Bladeburner division or because you do not have Source-File 7");
|
||||||
},
|
},
|
||||||
getOperationNames : function(name) {
|
getOperationNames : function() {
|
||||||
if (workerScript.checkingRam) {
|
if (workerScript.checkingRam) {
|
||||||
return updateStaticRam("getOperationNames", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 10);
|
return updateStaticRam("getOperationNames", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 10);
|
||||||
}
|
}
|
||||||
updateDynamicRam("getOperationNames", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 10);
|
updateDynamicRam("getOperationNames", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 10);
|
||||||
if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {
|
if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {
|
||||||
return Player.bladeburner.getOperationNamesNetscriptFn(name);
|
return Player.bladeburner.getOperationNamesNetscriptFn();
|
||||||
}
|
}
|
||||||
throw makeRuntimeRejectMsg(workerScript, "getOperationNames() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed " +
|
throw makeRuntimeRejectMsg(workerScript, "getOperationNames() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed " +
|
||||||
"at the Bladeburner division or because you do not have Source-File 7");
|
"at the Bladeburner division or because you do not have Source-File 7");
|
||||||
},
|
},
|
||||||
getBlackOpNames : function(name) {
|
getBlackOpNames : function() {
|
||||||
if (workerScript.checkingRam) {
|
if (workerScript.checkingRam) {
|
||||||
return updateStaticRam("getBlackOpNames", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 10);
|
return updateStaticRam("getBlackOpNames", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 10);
|
||||||
}
|
}
|
||||||
updateDynamicRam("getBlackOpNames", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 10);
|
updateDynamicRam("getBlackOpNames", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 10);
|
||||||
if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {
|
if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {
|
||||||
return Player.bladeburner.getBlackOpNamesNetscriptFn(name);
|
return Player.bladeburner.getBlackOpNamesNetscriptFn();
|
||||||
}
|
}
|
||||||
throw makeRuntimeRejectMsg(workerScript, "getBlackOpNames() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed " +
|
throw makeRuntimeRejectMsg(workerScript, "getBlackOpNames() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed " +
|
||||||
"at the Bladeburner division or because you do not have Source-File 7");
|
"at the Bladeburner division or because you do not have Source-File 7");
|
||||||
},
|
},
|
||||||
getGeneralActionNames : function(name) {
|
getGeneralActionNames : function() {
|
||||||
if (workerScript.checkingRam) {
|
if (workerScript.checkingRam) {
|
||||||
return updateStaticRam("getGeneralActionNames", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 10);
|
return updateStaticRam("getGeneralActionNames", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 10);
|
||||||
}
|
}
|
||||||
updateDynamicRam("getGeneralActionNames", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 10);
|
updateDynamicRam("getGeneralActionNames", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 10);
|
||||||
if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {
|
if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {
|
||||||
return Player.bladeburner.getGeneralActionNamesNetscriptFn(name);
|
return Player.bladeburner.getGeneralActionNamesNetscriptFn();
|
||||||
}
|
}
|
||||||
throw makeRuntimeRejectMsg(workerScript, "getGeneralActionNames() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed " +
|
throw makeRuntimeRejectMsg(workerScript, "getGeneralActionNames() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed " +
|
||||||
"at the Bladeburner division or because you do not have Source-File 7");
|
"at the Bladeburner division or because you do not have Source-File 7");
|
||||||
},
|
},
|
||||||
getSkillNames : function(name) {
|
getSkillNames : function() {
|
||||||
if (workerScript.checkingRam) {
|
if (workerScript.checkingRam) {
|
||||||
return updateStaticRam("getSkillNames", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 10);
|
return updateStaticRam("getSkillNames", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 10);
|
||||||
}
|
}
|
||||||
updateDynamicRam("getSkillNames", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 10);
|
updateDynamicRam("getSkillNames", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 10);
|
||||||
if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {
|
if (Player.bladeburner instanceof Bladeburner && (Player.bitNodeN === 7 || hasBladeburner2079SF)) {
|
||||||
return Player.bladeburner.getSkillNamesNetscriptFn(name);
|
return Player.bladeburner.getSkillNamesNetscriptFn();
|
||||||
}
|
}
|
||||||
throw makeRuntimeRejectMsg(workerScript, "getSkillNames() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed " +
|
throw makeRuntimeRejectMsg(workerScript, "getSkillNames() failed because you do not currently have access to the Bladeburner API. This is either because you are not currently employed " +
|
||||||
"at the Bladeburner division or because you do not have Source-File 7");
|
"at the Bladeburner division or because you do not have Source-File 7");
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import {registerEnv, unregisterEnv, makeEnvHeader} from "./NetscriptJSPreamble.js";
|
import {registerEnv, unregisterEnv, makeEnvHeader} from "./NetscriptJSPreamble";
|
||||||
import {makeRuntimeRejectMsg} from "./NetscriptEvaluator.js";
|
import {makeRuntimeRejectMsg} from "./NetscriptEvaluator";
|
||||||
|
|
||||||
// Makes a blob that contains the code of a given script.
|
// Makes a blob that contains the code of a given script.
|
||||||
export function makeScriptBlob(code) {
|
export function makeScriptBlob(code) {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import {Settings} from "./Settings.js";
|
import {Settings} from "./Settings";
|
||||||
|
|
||||||
function NetscriptPort() {
|
function NetscriptPort() {
|
||||||
this.data = [];
|
this.data = [];
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
import {addActiveScriptsItem,
|
import {addActiveScriptsItem,
|
||||||
deleteActiveScriptsItem,
|
deleteActiveScriptsItem,
|
||||||
updateActiveScriptsItems} from "./ActiveScriptsUI.js";
|
updateActiveScriptsItems} from "./ActiveScriptsUI";
|
||||||
import {CONSTANTS} from "./Constants.js";
|
import {CONSTANTS} from "./Constants";
|
||||||
import {Engine} from "./engine.js";
|
import {Engine} from "./engine";
|
||||||
import {Environment} from "./NetscriptEnvironment.js";
|
import {Environment} from "./NetscriptEnvironment";
|
||||||
import {evaluate, isScriptErrorMessage,
|
import {evaluate, isScriptErrorMessage,
|
||||||
makeRuntimeRejectMsg,
|
makeRuntimeRejectMsg,
|
||||||
killNetscriptDelay} from "./NetscriptEvaluator.js";
|
killNetscriptDelay} from "./NetscriptEvaluator";
|
||||||
import {executeJSScript} from "./NetscriptJSEvaluator.js";
|
import {executeJSScript} from "./NetscriptJSEvaluator";
|
||||||
import {NetscriptPort} from "./NetscriptPort.js";
|
import {NetscriptPort} from "./NetscriptPort";
|
||||||
import {AllServers} from "./Server.js";
|
import {AllServers} from "./Server";
|
||||||
import {Settings} from "./Settings.js";
|
import {Settings} from "./Settings";
|
||||||
|
|
||||||
import {parse} from "../utils/acorn.js";
|
import {parse} from "../utils/acorn";
|
||||||
import {dialogBoxCreate} from "../utils/DialogBox.js";
|
import {dialogBoxCreate} from "../utils/DialogBox";
|
||||||
import {compareArrays, printArray} from "../utils/HelperFunctions.js";
|
import {compareArrays, printArray} from "../utils/HelperFunctions";
|
||||||
|
|
||||||
function WorkerScript(runningScriptObj) {
|
function WorkerScript(runningScriptObj) {
|
||||||
this.name = runningScriptObj.filename;
|
this.name = runningScriptObj.filename;
|
||||||
|
@ -1,33 +1,33 @@
|
|||||||
import {Augmentations, applyAugmentation,
|
import {Augmentations, applyAugmentation,
|
||||||
AugmentationNames,
|
AugmentationNames,
|
||||||
PlayerOwnedAugmentation} from "./Augmentations.js";
|
PlayerOwnedAugmentation} from "./Augmentations";
|
||||||
import {BitNodes, BitNode, BitNodeMultipliers} from "./BitNode.js";
|
import {BitNodes, BitNode, BitNodeMultipliers} from "./BitNode";
|
||||||
import {Company, Companies, getNextCompanyPosition,
|
import {Company, Companies, getNextCompanyPosition,
|
||||||
getJobRequirementText, CompanyPosition,
|
getJobRequirementText, CompanyPosition,
|
||||||
CompanyPositions} from "./Company.js";
|
CompanyPositions} from "./Company";
|
||||||
import {CONSTANTS} from "./Constants.js";
|
import {CONSTANTS} from "./Constants";
|
||||||
import {Corporation} from "./CompanyManagement.js";
|
import {Corporation} from "./CompanyManagement";
|
||||||
import {Programs} from "./CreateProgram.js";
|
import {Programs} from "./CreateProgram";
|
||||||
import {determineCrimeSuccess, Crimes} from "./Crimes.js";
|
import {determineCrimeSuccess, Crimes} from "./Crimes";
|
||||||
import {Engine} from "./engine.js";
|
import {Engine} from "./engine";
|
||||||
import {Factions, Faction,
|
import {Factions, Faction,
|
||||||
displayFactionContent} from "./Faction.js";
|
displayFactionContent} from "./Faction";
|
||||||
import {Gang, resetGangs} from "./Gang.js";
|
import {Gang, resetGangs} from "./Gang";
|
||||||
import {Locations} from "./Location.js";
|
import {Locations} from "./Location";
|
||||||
import {hasBn11SF, hasWallStreetSF,hasAISF} from "./NetscriptFunctions.js";
|
import {hasBn11SF, hasWallStreetSF,hasAISF} from "./NetscriptFunctions";
|
||||||
import {AllServers, Server, AddToAllServers} from "./Server.js";
|
import {AllServers, Server, AddToAllServers} from "./Server";
|
||||||
import {SpecialServerIps, SpecialServerNames} from "./SpecialServerIps.js";
|
import {SpecialServerIps, SpecialServerNames} from "./SpecialServerIps";
|
||||||
import {SourceFiles, applySourceFile} from "./SourceFile.js";
|
import {SourceFiles, applySourceFile} from "./SourceFile";
|
||||||
|
|
||||||
import Decimal from "decimal.js";
|
import Decimal from "decimal.js";
|
||||||
import {dialogBoxCreate} from "../utils/DialogBox.js";
|
import {dialogBoxCreate} from "../utils/DialogBox";
|
||||||
import {clearEventListeners} from "../utils/HelperFunctions.js";
|
import {clearEventListeners} from "../utils/HelperFunctions";
|
||||||
import {createRandomIp} from "../utils/IPAddress.js";
|
import {createRandomIp} from "../utils/IPAddress";
|
||||||
import {Reviver, Generic_toJSON,
|
import {Reviver, Generic_toJSON,
|
||||||
Generic_fromJSON} from "../utils/JSONReviver.js";
|
Generic_fromJSON} from "../utils/JSONReviver";
|
||||||
import numeral from "numeral/min/numeral.min";
|
import numeral from "numeral/min/numeral.min";
|
||||||
import {formatNumber,
|
import {formatNumber,
|
||||||
convertTimeMsToTimeElapsedString} from "../utils/StringHelperFunctions.js";
|
convertTimeMsToTimeElapsedString} from "../utils/StringHelperFunctions";
|
||||||
|
|
||||||
function PlayerObject() {
|
function PlayerObject() {
|
||||||
//Skills and stats
|
//Skills and stats
|
||||||
@ -220,7 +220,7 @@ PlayerObject.prototype.init = function() {
|
|||||||
this.currentServer = t_homeComp.ip;
|
this.currentServer = t_homeComp.ip;
|
||||||
AddToAllServers(t_homeComp);
|
AddToAllServers(t_homeComp);
|
||||||
|
|
||||||
this.getHomeComputer().programs.push(Programs.NukeProgram);
|
this.getHomeComputer().programs.push(Programs.NukeProgram.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerObject.prototype.prestigeAugmentation = function() {
|
PlayerObject.prototype.prestigeAugmentation = function() {
|
||||||
|
@ -1,39 +1,39 @@
|
|||||||
import {deleteActiveScriptsItem} from "./ActiveScriptsUI.js";
|
import {deleteActiveScriptsItem} from "./ActiveScriptsUI";
|
||||||
import {Augmentations, augmentationExists,
|
import {Augmentations, augmentationExists,
|
||||||
initAugmentations, AugmentationNames} from "./Augmentations.js";
|
initAugmentations, AugmentationNames} from "./Augmentations";
|
||||||
import {initBitNodeMultipliers} from "./BitNode.js";
|
import {initBitNodeMultipliers} from "./BitNode";
|
||||||
import {Bladeburner} from "./Bladeburner.js";
|
import {Bladeburner} from "./Bladeburner";
|
||||||
import {writeCinematicText} from "./CinematicText.js";
|
import {writeCinematicText} from "./CinematicText";
|
||||||
import {Companies, Company, initCompanies} from "./Company.js";
|
import {Companies, Company, initCompanies} from "./Company";
|
||||||
import {Programs} from "./CreateProgram.js";
|
import {Programs} from "./CreateProgram";
|
||||||
import {Engine} from "./engine.js";
|
import {Engine} from "./engine";
|
||||||
import {Factions, Faction, initFactions,
|
import {Factions, Faction, initFactions,
|
||||||
joinFaction} from "./Faction.js";
|
joinFaction} from "./Faction";
|
||||||
import {deleteGangDisplayContent} from "./Gang.js";
|
import {deleteGangDisplayContent} from "./Gang";
|
||||||
import {Locations} from "./Location.js";
|
import {Locations} from "./Location";
|
||||||
import {initMessages, Messages, Message} from "./Message.js";
|
import {initMessages, Messages, Message} from "./Message";
|
||||||
import {initSingularitySFFlags, hasWallStreetSF}from "./NetscriptFunctions.js";
|
import {initSingularitySFFlags, hasWallStreetSF}from "./NetscriptFunctions";
|
||||||
import {WorkerScript, workerScripts,
|
import {WorkerScript, workerScripts,
|
||||||
prestigeWorkerScripts} from "./NetscriptWorker.js";
|
prestigeWorkerScripts} from "./NetscriptWorker";
|
||||||
import {Player} from "./Player.js";
|
import {Player} from "./Player";
|
||||||
|
|
||||||
import {AllServers, AddToAllServers,
|
import {AllServers, AddToAllServers,
|
||||||
initForeignServers, Server,
|
initForeignServers, Server,
|
||||||
prestigeAllServers,
|
prestigeAllServers,
|
||||||
prestigeHomeComputer} from "./Server.js";
|
prestigeHomeComputer} from "./Server";
|
||||||
import {SpecialServerIps, SpecialServerIpsMap,
|
import {SpecialServerIps, SpecialServerIpsMap,
|
||||||
prestigeSpecialServerIps,
|
prestigeSpecialServerIps,
|
||||||
SpecialServerNames} from "./SpecialServerIps.js";
|
SpecialServerNames} from "./SpecialServerIps";
|
||||||
import {initStockMarket, initSymbolToStockMap,
|
import {initStockMarket, initSymbolToStockMap,
|
||||||
stockMarketContentCreated,
|
stockMarketContentCreated,
|
||||||
setStockMarketContentCreated} from "./StockMarket.js";
|
setStockMarketContentCreated} from "./StockMarket";
|
||||||
import {Terminal, postNetburnerText} from "./Terminal.js";
|
import {Terminal, postNetburnerText} from "./Terminal";
|
||||||
import Decimal from "decimal.js";
|
import Decimal from "decimal.js";
|
||||||
import {dialogBoxCreate} from "../utils/DialogBox.js";
|
import {dialogBoxCreate} from "../utils/DialogBox";
|
||||||
import {createPopup, createElement,
|
import {createPopup, createElement,
|
||||||
removeElementById, exceptionAlert} from "../utils/HelperFunctions.js";
|
removeElementById, exceptionAlert} from "../utils/HelperFunctions";
|
||||||
import {yesNoBoxCreate, yesNoBoxGetYesButton,
|
import {yesNoBoxCreate, yesNoBoxGetYesButton,
|
||||||
yesNoBoxGetNoButton, yesNoBoxClose} from "../utils/YesNoBox.js";
|
yesNoBoxGetNoButton, yesNoBoxClose} from "../utils/YesNoBox";
|
||||||
|
|
||||||
let BitNode8StartingMoney = 250e6;
|
let BitNode8StartingMoney = 250e6;
|
||||||
|
|
||||||
@ -59,13 +59,13 @@ function prestigeAugmentation() {
|
|||||||
|
|
||||||
if (augmentationExists(AugmentationNames.Neurolink) &&
|
if (augmentationExists(AugmentationNames.Neurolink) &&
|
||||||
Augmentations[AugmentationNames.Neurolink].owned) {
|
Augmentations[AugmentationNames.Neurolink].owned) {
|
||||||
homeComp.programs.push(Programs.FTPCrackProgram);
|
homeComp.programs.push(Programs.FTPCrackProgram.name);
|
||||||
homeComp.programs.push(Programs.RelaySMTPProgram);
|
homeComp.programs.push(Programs.RelaySMTPProgram.name);
|
||||||
}
|
}
|
||||||
if (augmentationExists(AugmentationNames.CashRoot) &&
|
if (augmentationExists(AugmentationNames.CashRoot) &&
|
||||||
Augmentations[AugmentationNames.CashRoot].owned) {
|
Augmentations[AugmentationNames.CashRoot].owned) {
|
||||||
Player.setMoney(new Decimal(1000000));
|
Player.setMoney(new Decimal(1000000));
|
||||||
homeComp.programs.push(Programs.BruteSSHProgram);
|
homeComp.programs.push(Programs.BruteSSHProgram.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Re-create foreign servers
|
//Re-create foreign servers
|
||||||
@ -191,9 +191,6 @@ function prestigeSourceFile() {
|
|||||||
}
|
}
|
||||||
homeComp.cpuCores = 1;
|
homeComp.cpuCores = 1;
|
||||||
|
|
||||||
//Darkweb is purchase-able
|
|
||||||
document.getElementById("location-purchase-tor").setAttribute("class", "a-link-button");
|
|
||||||
|
|
||||||
//Reset favor for Companies
|
//Reset favor for Companies
|
||||||
for (var member in Companies) {
|
for (var member in Companies) {
|
||||||
if (Companies.hasOwnProperty(member)) {
|
if (Companies.hasOwnProperty(member)) {
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
import {BitNode, BitNodes} from "./BitNode.js";
|
import {BitNode, BitNodes} from "./BitNode";
|
||||||
import {Engine} from "./engine.js";
|
import {Engine} from "./engine";
|
||||||
import {Player} from "./Player.js";
|
import {Player} from "./Player";
|
||||||
import {prestigeSourceFile} from "./Prestige.js";
|
import {prestigeSourceFile} from "./Prestige";
|
||||||
import {SourceFiles, SourceFile,
|
import {SourceFiles, SourceFile,
|
||||||
PlayerOwnedSourceFile} from "./SourceFile.js";
|
PlayerOwnedSourceFile} from "./SourceFile";
|
||||||
import {Terminal} from "./Terminal.js";
|
import {Terminal} from "./Terminal";
|
||||||
|
|
||||||
import {dialogBoxCreate} from "../utils/DialogBox.js";
|
import {dialogBoxCreate} from "../utils/DialogBox";
|
||||||
import {clearEventListeners,
|
import {clearEventListeners,
|
||||||
removeChildrenFromElement} from "../utils/HelperFunctions.js";
|
removeChildrenFromElement} from "../utils/HelperFunctions";
|
||||||
import {yesNoBoxCreate, yesNoBoxGetYesButton,
|
import {yesNoBoxCreate, yesNoBoxGetYesButton,
|
||||||
yesNoBoxGetNoButton, yesNoBoxClose} from "../utils/YesNoBox.js";
|
yesNoBoxGetNoButton, yesNoBoxClose} from "../utils/YesNoBox";
|
||||||
|
|
||||||
/* RedPill.js
|
/* RedPill.js
|
||||||
* Implements what happens when you have Red Pill augmentation and then hack the world daemon */
|
* Implements what happens when you have Red Pill augmentation and then hack the world daemon */
|
||||||
|
@ -1,29 +1,29 @@
|
|||||||
import {loadAliases, loadGlobalAliases,
|
import {loadAliases, loadGlobalAliases,
|
||||||
Aliases, GlobalAliases} from "./Alias.js";
|
Aliases, GlobalAliases} from "./Alias";
|
||||||
import {loadCompanies, Companies,
|
import {loadCompanies, Companies,
|
||||||
CompanyPositions} from "./Company.js";
|
CompanyPositions} from "./Company";
|
||||||
import {CONSTANTS} from "./Constants.js";
|
import {CONSTANTS} from "./Constants";
|
||||||
import {Engine} from "./engine.js";
|
import {Engine} from "./engine";
|
||||||
import {loadFactions, Factions,
|
import {loadFactions, Factions,
|
||||||
processPassiveFactionRepGain} from "./Faction.js";
|
processPassiveFactionRepGain} from "./Faction";
|
||||||
import {FconfSettings, loadFconf} from "./Fconf.js";
|
import {FconfSettings, loadFconf} from "./Fconf";
|
||||||
import {loadAllGangs, AllGangs} from "./Gang.js";
|
import {loadAllGangs, AllGangs} from "./Gang";
|
||||||
import {processAllHacknetNodeEarnings,
|
import {processAllHacknetNodeEarnings,
|
||||||
createPlayerHacknetNodeWrappers} from "./HacknetNode.js";
|
createPlayerHacknetNodeWrappers} from "./HacknetNode";
|
||||||
import {loadMessages, initMessages, Messages} from "./Message.js";
|
import {loadMessages, initMessages, Messages} from "./Message";
|
||||||
import {Player, loadPlayer} from "./Player.js";
|
import {Player, loadPlayer} from "./Player";
|
||||||
import {loadAllRunningScripts} from "./Script.js";
|
import {loadAllRunningScripts} from "./Script";
|
||||||
import {AllServers, loadAllServers} from "./Server.js";
|
import {AllServers, loadAllServers} from "./Server";
|
||||||
import {loadSettings, initSettings, Settings} from "./Settings.js";
|
import {loadSettings, initSettings, Settings} from "./Settings";
|
||||||
import {loadSpecialServerIps, SpecialServerIps} from "./SpecialServerIps.js";
|
import {loadSpecialServerIps, SpecialServerIps} from "./SpecialServerIps";
|
||||||
import {loadStockMarket, StockMarket} from "./StockMarket.js";
|
import {loadStockMarket, StockMarket} from "./StockMarket";
|
||||||
import {dialogBoxCreate} from "../utils/DialogBox.js";
|
import {dialogBoxCreate} from "../utils/DialogBox";
|
||||||
import {gameOptionsBoxClose} from "../utils/GameOptions.js";
|
import {gameOptionsBoxClose} from "../utils/GameOptions";
|
||||||
import {clearEventListeners, createElement,
|
import {clearEventListeners, createElement,
|
||||||
createPopup, removeElementById} from "../utils/HelperFunctions.js";
|
createPopup, removeElementById} from "../utils/HelperFunctions";
|
||||||
import {Reviver, Generic_toJSON,
|
import {Reviver, Generic_toJSON,
|
||||||
Generic_fromJSON} from "../utils/JSONReviver.js";
|
Generic_fromJSON} from "../utils/JSONReviver";
|
||||||
import {formatNumber} from "../utils/StringHelperFunctions.js";
|
import {formatNumber} from "../utils/StringHelperFunctions";
|
||||||
|
|
||||||
import Decimal from "decimal.js";
|
import Decimal from "decimal.js";
|
||||||
|
|
||||||
|
@ -17,28 +17,28 @@ require("brace/ext/language_tools");
|
|||||||
// Importing this doesn't work for some reason.
|
// Importing this doesn't work for some reason.
|
||||||
const walk = require("acorn/dist/walk");
|
const walk = require("acorn/dist/walk");
|
||||||
|
|
||||||
import {CONSTANTS} from "./Constants.js";
|
import {CONSTANTS} from "./Constants";
|
||||||
import {Engine} from "./engine.js";
|
import {Engine} from "./engine";
|
||||||
import {FconfSettings, parseFconfSettings} from "./Fconf.js";
|
import {FconfSettings, parseFconfSettings} from "./Fconf";
|
||||||
import {iTutorialSteps, iTutorialNextStep,
|
import {iTutorialSteps, iTutorialNextStep,
|
||||||
iTutorialIsRunning, currITutorialStep} from "./InteractiveTutorial.js";
|
iTutorialIsRunning, currITutorialStep} from "./InteractiveTutorial";
|
||||||
import {evaluateImport} from "./NetscriptEvaluator.js";
|
import {evaluateImport} from "./NetscriptEvaluator";
|
||||||
import {NetscriptFunctions} from "./NetscriptFunctions.js";
|
import {NetscriptFunctions} from "./NetscriptFunctions";
|
||||||
import {addWorkerScript, killWorkerScript,
|
import {addWorkerScript, killWorkerScript,
|
||||||
WorkerScript} from "./NetscriptWorker.js";
|
WorkerScript} from "./NetscriptWorker";
|
||||||
import {Player} from "./Player.js";
|
import {Player} from "./Player";
|
||||||
import {AllServers, processSingleServerGrowth} from "./Server.js";
|
import {AllServers, processSingleServerGrowth} from "./Server";
|
||||||
import {Settings} from "./Settings.js";
|
import {Settings} from "./Settings";
|
||||||
import {post, Terminal} from "./Terminal.js";
|
import {post, Terminal} from "./Terminal";
|
||||||
import {TextFile} from "./TextFile";
|
import {TextFile} from "./TextFile";
|
||||||
|
|
||||||
import {parse, Node} from "../utils/acorn.js";
|
import {parse, Node} from "../utils/acorn";
|
||||||
import {dialogBoxCreate} from "../utils/DialogBox.js";
|
import {dialogBoxCreate} from "../utils/DialogBox";
|
||||||
import {Reviver, Generic_toJSON,
|
import {Reviver, Generic_toJSON,
|
||||||
Generic_fromJSON} from "../utils/JSONReviver.js";
|
Generic_fromJSON} from "../utils/JSONReviver";
|
||||||
import {compareArrays, createElement} from "../utils/HelperFunctions.js";
|
import {compareArrays, createElement} from "../utils/HelperFunctions";
|
||||||
import {formatNumber, numOccurrences,
|
import {formatNumber, numOccurrences,
|
||||||
numNetscriptOperators} from "../utils/StringHelperFunctions.js";
|
numNetscriptOperators} from "../utils/StringHelperFunctions";
|
||||||
|
|
||||||
var keybindings = {
|
var keybindings = {
|
||||||
ace: null,
|
ace: null,
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
import {BitNodeMultipliers} from "./BitNode.js";
|
import {BitNodeMultipliers} from "./BitNode";
|
||||||
import {CONSTANTS} from "./Constants.js";
|
import {CONSTANTS} from "./Constants";
|
||||||
import {Programs} from "./CreateProgram.js";
|
import {Programs} from "./CreateProgram";
|
||||||
import {Player} from "./Player.js";
|
import {Player} from "./Player";
|
||||||
import {RunningScript, Script} from "./Script.js";
|
import {RunningScript, Script} from "./Script";
|
||||||
import {SpecialServerNames, SpecialServerIps} from "./SpecialServerIps.js";
|
import {SpecialServerNames, SpecialServerIps} from "./SpecialServerIps";
|
||||||
import {getRandomInt} from "../utils/HelperFunctions.js";
|
import {getRandomInt} from "../utils/HelperFunctions";
|
||||||
import {createRandomIp, isValidIPAddress, ipExists} from "../utils/IPAddress.js";
|
import {createRandomIp, isValidIPAddress, ipExists} from "../utils/IPAddress";
|
||||||
import {Reviver, Generic_toJSON,
|
import {Reviver, Generic_toJSON,
|
||||||
Generic_fromJSON} from "../utils/JSONReviver.js";
|
Generic_fromJSON} from "../utils/JSONReviver";
|
||||||
|
|
||||||
function Server(params={ip:createRandomIp(), hostname:""}) {
|
function Server(params={ip:createRandomIp(), hostname:""}) {
|
||||||
/* Properties */
|
/* Properties */
|
||||||
@ -93,18 +93,23 @@ Server.prototype.getScript = function(scriptName) {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Strengthens a server's security level (difficulty) by the specified amount
|
Server.prototype.capDifficulty = function() {
|
||||||
Server.prototype.fortify = function(amt) {
|
if (this.hackDifficulty < this.minDifficulty) {this.hackDifficulty = this.minDifficulty;}
|
||||||
this.hackDifficulty += amt;
|
if (this.hackDifficulty < 1) {this.hackDifficulty = 1;}
|
||||||
//Place some arbitrarily limit that realistically should never happen unless someone is
|
//Place some arbitrarily limit that realistically should never happen unless someone is
|
||||||
//screwing around with the game
|
//screwing around with the game
|
||||||
if (this.hackDifficulty > 1000000) {this.hackDifficulty = 1000000;}
|
if (this.hackDifficulty > 1000000) {this.hackDifficulty = 1000000;}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Strengthens a server's security level (difficulty) by the specified amount
|
||||||
|
Server.prototype.fortify = function(amt) {
|
||||||
|
this.hackDifficulty += amt;
|
||||||
|
this.capDifficulty();
|
||||||
|
}
|
||||||
|
|
||||||
Server.prototype.weaken = function(amt) {
|
Server.prototype.weaken = function(amt) {
|
||||||
this.hackDifficulty -= (amt * BitNodeMultipliers.ServerWeakenRate);
|
this.hackDifficulty -= (amt * BitNodeMultipliers.ServerWeakenRate);
|
||||||
if (this.hackDifficulty < this.minDifficulty) {this.hackDifficulty = this.minDifficulty;}
|
this.capDifficulty();
|
||||||
if (this.hackDifficulty < 1) {this.hackDifficulty = 1;}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Functions for loading and saving a Server
|
//Functions for loading and saving a Server
|
||||||
@ -817,7 +822,8 @@ function processSingleServerGrowth(server, numCycles) {
|
|||||||
// if there was any growth at all, increase security
|
// if there was any growth at all, increase security
|
||||||
if(oldMoneyAvailable !== server.moneyAvailable) {
|
if(oldMoneyAvailable !== server.moneyAvailable) {
|
||||||
//Growing increases server security twice as much as hacking
|
//Growing increases server security twice as much as hacking
|
||||||
const usedCycles = numCycleForGrowth(server, server.moneyAvailable / oldMoneyAvailable);
|
let usedCycles = numCycleForGrowth(server, server.moneyAvailable / oldMoneyAvailable);
|
||||||
|
usedCycles = Math.max(0, usedCycles);
|
||||||
server.fortify(2 * CONSTANTS.ServerFortifyAmount * Math.ceil(usedCycles));
|
server.fortify(2 * CONSTANTS.ServerFortifyAmount * Math.ceil(usedCycles));
|
||||||
}
|
}
|
||||||
return server.moneyAvailable / oldMoneyAvailable;
|
return server.moneyAvailable / oldMoneyAvailable;
|
||||||
@ -829,7 +835,7 @@ function prestigeHomeComputer(homeComp) {
|
|||||||
homeComp.serversOnNetwork = [];
|
homeComp.serversOnNetwork = [];
|
||||||
homeComp.isConnectedTo = true;
|
homeComp.isConnectedTo = true;
|
||||||
homeComp.ramUsed = 0;
|
homeComp.ramUsed = 0;
|
||||||
homeComp.programs.push(Programs.NukeProgram);
|
homeComp.programs.push(Programs.NukeProgram.name);
|
||||||
|
|
||||||
//Update RAM usage on all scripts
|
//Update RAM usage on all scripts
|
||||||
homeComp.scripts.forEach(function(script) {
|
homeComp.scripts.forEach(function(script) {
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import {CONSTANTS} from "./Constants.js";
|
import {CONSTANTS} from "./Constants";
|
||||||
import {Player} from "./Player.js";
|
import {Player} from "./Player";
|
||||||
import {Server, AllServers, AddToAllServers} from "./Server.js";
|
import {Server, AllServers, AddToAllServers} from "./Server";
|
||||||
import {dialogBoxCreate} from "../utils/DialogBox.js";
|
import {dialogBoxCreate} from "../utils/DialogBox";
|
||||||
import {createRandomIp} from "../utils/IPAddress.js";
|
import {createRandomIp} from "../utils/IPAddress";
|
||||||
import {yesNoTxtInpBoxGetInput} from "../utils/YesNoBox.js";
|
import {yesNoTxtInpBoxGetInput} from "../utils/YesNoBox";
|
||||||
|
|
||||||
|
|
||||||
/* Functions to handle any server-related purchasing:
|
/* Functions to handle any server-related purchasing:
|
||||||
|
@ -1,20 +1,21 @@
|
|||||||
import {Engine} from "./engine.js";
|
import {Engine} from "./engine";
|
||||||
|
|
||||||
/* Settings.js */
|
/* Settings.js */
|
||||||
let Settings = {
|
let Settings = {
|
||||||
CodeInstructionRunTime: 50,
|
CodeInstructionRunTime: 50,
|
||||||
MaxLogCapacity: 50,
|
MaxLogCapacity: 50,
|
||||||
MaxPortCapacity: 50,
|
MaxPortCapacity: 50,
|
||||||
SuppressMessages: false,
|
SuppressMessages: false,
|
||||||
SuppressFactionInvites: false,
|
SuppressFactionInvites: false,
|
||||||
SuppressTravelConfirmation: false,
|
SuppressTravelConfirmation: false,
|
||||||
AutosaveInterval: 60,
|
SuppressBuyAugmentationConfirmation: false,
|
||||||
DisableHotkeys: false,
|
AutosaveInterval: 60,
|
||||||
ThemeHighlightColor: "#ffffff",
|
DisableHotkeys: false,
|
||||||
ThemeFontColor: "#66ff33",
|
ThemeHighlightColor: "#ffffff",
|
||||||
ThemeBackgroundColor: "#000000",
|
ThemeFontColor: "#66ff33",
|
||||||
EditorTheme: "Monokai",
|
ThemeBackgroundColor: "#000000",
|
||||||
EditorKeybinding: "ace",
|
EditorTheme: "Monokai",
|
||||||
|
EditorKeybinding: "ace",
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadSettings(saveString) {
|
function loadSettings(saveString) {
|
||||||
@ -28,6 +29,7 @@ function initSettings() {
|
|||||||
Settings.SuppressMessages = false;
|
Settings.SuppressMessages = false;
|
||||||
Settings.SuppressFactionInvites = false;
|
Settings.SuppressFactionInvites = false;
|
||||||
Settings.SuppressTravelConfirmation = false;
|
Settings.SuppressTravelConfirmation = false;
|
||||||
|
Settings.SuppressBuyAugmentationConfirmation = false;
|
||||||
Settings.AutosaveInterval = 60;
|
Settings.AutosaveInterval = 60;
|
||||||
Settings.DisableHotkeys = false;
|
Settings.DisableHotkeys = false;
|
||||||
}
|
}
|
||||||
@ -39,6 +41,7 @@ function setSettingsLabels() {
|
|||||||
var suppressMsgs = document.getElementById("settingsSuppressMessages");
|
var suppressMsgs = document.getElementById("settingsSuppressMessages");
|
||||||
var suppressFactionInv = document.getElementById("settingsSuppressFactionInvites")
|
var suppressFactionInv = document.getElementById("settingsSuppressFactionInvites")
|
||||||
var suppressTravelConfirmation = document.getElementById("settingsSuppressTravelConfirmation");
|
var suppressTravelConfirmation = document.getElementById("settingsSuppressTravelConfirmation");
|
||||||
|
var suppressBuyAugmentationConfirmation = document.getElementById("settingsSuppressBuyAugmentationConfirmation");
|
||||||
var autosaveInterval = document.getElementById("settingsAutosaveIntervalValLabel");
|
var autosaveInterval = document.getElementById("settingsAutosaveIntervalValLabel");
|
||||||
var disableHotkeys = document.getElementById("settingsDisableHotkeys");
|
var disableHotkeys = document.getElementById("settingsDisableHotkeys");
|
||||||
|
|
||||||
@ -49,6 +52,7 @@ function setSettingsLabels() {
|
|||||||
suppressMsgs.checked = Settings.SuppressMessages;
|
suppressMsgs.checked = Settings.SuppressMessages;
|
||||||
suppressFactionInv.checked = Settings.SuppressFactionInvites;
|
suppressFactionInv.checked = Settings.SuppressFactionInvites;
|
||||||
suppressTravelConfirmation.checked = Settings.SuppressTravelConfirmation;
|
suppressTravelConfirmation.checked = Settings.SuppressTravelConfirmation;
|
||||||
|
suppressBuyAugmentationConfirmation.checked = Settings.SuppressBuyAugmentationConfirmation;
|
||||||
autosaveInterval.innerHTML = Settings.AutosaveInterval;
|
autosaveInterval.innerHTML = Settings.AutosaveInterval;
|
||||||
disableHotkeys.checked = Settings.DisableHotkeys;
|
disableHotkeys.checked = Settings.DisableHotkeys;
|
||||||
|
|
||||||
@ -99,6 +103,11 @@ function setSettingsLabels() {
|
|||||||
Settings.SuppressTravelConfirmation = this.checked;
|
Settings.SuppressTravelConfirmation = this.checked;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
suppressBuyAugmentationConfirmation.onclick = function() {
|
||||||
|
Settings.SuppressBuyAugmentationConfirmation = this.checked;
|
||||||
|
console.log('sup buy: '+Settings.SuppressBuyAugmentationConfirmation);
|
||||||
|
};
|
||||||
|
|
||||||
disableHotkeys.onclick = function() {
|
disableHotkeys.onclick = function() {
|
||||||
Settings.DisableHotkeys = this.checked;
|
Settings.DisableHotkeys = this.checked;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import {Player} from "./Player.js";
|
import {Player} from "./Player";
|
||||||
import {BitNode, BitNodes} from "./BitNode.js";
|
import {BitNode, BitNodes} from "./BitNode";
|
||||||
|
|
||||||
/* SourceFile.js */
|
/* SourceFile.js */
|
||||||
//Each SourceFile corresponds to a BitNode with the same number
|
//Each SourceFile corresponds to a BitNode with the same number
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import {Reviver, Generic_toJSON,
|
import {Reviver, Generic_toJSON,
|
||||||
Generic_fromJSON} from "../utils/JSONReviver.js";
|
Generic_fromJSON} from "../utils/JSONReviver";
|
||||||
|
|
||||||
/* Holds IP of Special Servers */
|
/* Holds IP of Special Servers */
|
||||||
let SpecialServerNames = {
|
let SpecialServerNames = {
|
||||||
|
@ -1,23 +1,23 @@
|
|||||||
import {CONSTANTS} from "./Constants.js";
|
import {CONSTANTS} from "./Constants";
|
||||||
import {Engine} from "./engine.js";
|
import {Engine} from "./engine";
|
||||||
import {Locations} from "./Location.js";
|
import {Locations} from "./Location";
|
||||||
import {hasWallStreetSF, wallStreetSFLvl} from "./NetscriptFunctions.js";
|
import {hasWallStreetSF, wallStreetSFLvl} from "./NetscriptFunctions";
|
||||||
import {WorkerScript} from "./NetscriptWorker.js";
|
import {WorkerScript} from "./NetscriptWorker";
|
||||||
import {Player} from "./Player.js";
|
import {Player} from "./Player";
|
||||||
|
|
||||||
import {dialogBoxCreate} from "../utils/DialogBox.js";
|
import {dialogBoxCreate} from "../utils/DialogBox";
|
||||||
import {clearEventListeners, getRandomInt,
|
import {clearEventListeners, getRandomInt,
|
||||||
removeElementById,
|
removeElementById,
|
||||||
clearEventListenersEl} from "../utils/HelperFunctions.js";
|
clearEventListenersEl} from "../utils/HelperFunctions";
|
||||||
import {Reviver, Generic_toJSON,
|
import {Reviver, Generic_toJSON,
|
||||||
Generic_fromJSON} from "../utils/JSONReviver.js";
|
Generic_fromJSON} from "../utils/JSONReviver";
|
||||||
import numeral from "numeral/min/numeral.min";
|
import numeral from "numeral/min/numeral.min";
|
||||||
import {formatNumber} from "../utils/StringHelperFunctions.js";
|
import {formatNumber} from "../utils/StringHelperFunctions";
|
||||||
import {yesNoBoxCreate, yesNoTxtInpBoxCreate,
|
import {yesNoBoxCreate, yesNoTxtInpBoxCreate,
|
||||||
yesNoBoxGetYesButton, yesNoBoxGetNoButton,
|
yesNoBoxGetYesButton, yesNoBoxGetNoButton,
|
||||||
yesNoTxtInpBoxGetYesButton, yesNoTxtInpBoxGetNoButton,
|
yesNoTxtInpBoxGetYesButton, yesNoTxtInpBoxGetNoButton,
|
||||||
yesNoTxtInpBoxGetInput, yesNoBoxClose,
|
yesNoTxtInpBoxGetInput, yesNoBoxClose,
|
||||||
yesNoTxtInpBoxClose, yesNoBoxOpen} from "../utils/YesNoBox.js";
|
yesNoTxtInpBoxClose, yesNoBoxOpen} from "../utils/YesNoBox";
|
||||||
|
|
||||||
let StockPriceCap = 1e9; //Put a limit on how high a price can go
|
let StockPriceCap = 1e9; //Put a limit on how high a price can go
|
||||||
|
|
||||||
|
@ -1,44 +1,45 @@
|
|||||||
import {substituteAliases, printAliases,
|
import {substituteAliases, printAliases,
|
||||||
parseAliasDeclaration,
|
parseAliasDeclaration,
|
||||||
removeAlias, GlobalAliases,
|
removeAlias, GlobalAliases,
|
||||||
Aliases} from "./Alias.js";
|
Aliases} from "./Alias";
|
||||||
import {CONSTANTS} from "./Constants.js";
|
import {CONSTANTS} from "./Constants";
|
||||||
import {Programs} from "./CreateProgram.js";
|
import {Programs} from "./CreateProgram";
|
||||||
import {executeDarkwebTerminalCommand,
|
import {executeDarkwebTerminalCommand,
|
||||||
checkIfConnectedToDarkweb,
|
checkIfConnectedToDarkweb,
|
||||||
DarkWebItems} from "./DarkWeb.js";
|
DarkWebItems} from "./DarkWeb";
|
||||||
import {Engine} from "./engine.js";
|
import {Engine} from "./engine";
|
||||||
import {FconfSettings, parseFconfSettings,
|
import {FconfSettings, parseFconfSettings,
|
||||||
createFconf} from "./Fconf.js";
|
createFconf} from "./Fconf";
|
||||||
import {TerminalHelpText, HelpTexts} from "./HelpText";
|
import {TerminalHelpText, HelpTexts} from "./HelpText";
|
||||||
import {iTutorialNextStep, iTutorialSteps,
|
import {iTutorialNextStep, iTutorialSteps,
|
||||||
iTutorialIsRunning,
|
iTutorialIsRunning,
|
||||||
currITutorialStep} from "./InteractiveTutorial.js";
|
currITutorialStep} from "./InteractiveTutorial";
|
||||||
import {showLiterature} from "./Literature.js";
|
import {showLiterature} from "./Literature";
|
||||||
import {showMessage, Message} from "./Message.js";
|
import {showMessage, Message} from "./Message";
|
||||||
import {scriptCalculateHackingTime,
|
import {scriptCalculateHackingTime,
|
||||||
scriptCalculateGrowTime,
|
scriptCalculateGrowTime,
|
||||||
scriptCalculateWeakenTime} from "./NetscriptEvaluator.js";
|
scriptCalculateWeakenTime} from "./NetscriptEvaluator";
|
||||||
import {killWorkerScript, addWorkerScript} from "./NetscriptWorker.js";
|
import {killWorkerScript, addWorkerScript} from "./NetscriptWorker";
|
||||||
import {Player} from "./Player.js";
|
import numeral from "numeral/min/numeral.min";
|
||||||
import {hackWorldDaemon} from "./RedPill.js";
|
import {Player} from "./Player";
|
||||||
|
import {hackWorldDaemon} from "./RedPill";
|
||||||
import {findRunningScript, RunningScript,
|
import {findRunningScript, RunningScript,
|
||||||
AllServersMap, Script,
|
AllServersMap, Script,
|
||||||
isScriptFilename} from "./Script.js";
|
isScriptFilename} from "./Script";
|
||||||
import {AllServers, GetServerByHostname,
|
import {AllServers, GetServerByHostname,
|
||||||
getServer, Server} from "./Server.js";
|
getServer, Server} from "./Server";
|
||||||
import {Settings} from "./Settings.js";
|
import {Settings} from "./Settings";
|
||||||
import {SpecialServerIps,
|
import {SpecialServerIps,
|
||||||
SpecialServerNames} from "./SpecialServerIps.js";
|
SpecialServerNames} from "./SpecialServerIps";
|
||||||
import {TextFile, getTextFile} from "./TextFile";
|
import {TextFile, getTextFile} from "./TextFile";
|
||||||
|
|
||||||
import {containsAllStrings, longestCommonStart,
|
import {containsAllStrings, longestCommonStart,
|
||||||
formatNumber, isString} from "../utils/StringHelperFunctions.js";
|
formatNumber, isString} from "../utils/StringHelperFunctions";
|
||||||
import {addOffset, printArray} from "../utils/HelperFunctions.js";
|
import {addOffset, printArray} from "../utils/HelperFunctions";
|
||||||
import {logBoxCreate} from "../utils/LogBox.js";
|
import {logBoxCreate} from "../utils/LogBox";
|
||||||
import {yesNoBoxCreate,
|
import {yesNoBoxCreate,
|
||||||
yesNoBoxGetYesButton,
|
yesNoBoxGetYesButton,
|
||||||
yesNoBoxGetNoButton, yesNoBoxClose} from "../utils/YesNoBox.js";
|
yesNoBoxGetNoButton, yesNoBoxClose} from "../utils/YesNoBox";
|
||||||
|
|
||||||
import * as JSZip from 'jszip';
|
import * as JSZip from 'jszip';
|
||||||
import * as FileSaver from 'file-saver';
|
import * as FileSaver from 'file-saver';
|
||||||
@ -1355,11 +1356,11 @@ let Terminal = {
|
|||||||
post("Incorrect usage of scan-analyze command. depth argument must be positive numeric");
|
post("Incorrect usage of scan-analyze command. depth argument must be positive numeric");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (depth > 3 && !Player.hasProgram(Programs.DeepscanV1) &&
|
if (depth > 3 && !Player.hasProgram(Programs.DeepscanV1.name) &&
|
||||||
!Player.hasProgram(Programs.DeepscanV2)) {
|
!Player.hasProgram(Programs.DeepscanV2.name)) {
|
||||||
post("You cannot scan-analyze with that high of a depth. Maximum depth is 3");
|
post("You cannot scan-analyze with that high of a depth. Maximum depth is 3");
|
||||||
return;
|
return;
|
||||||
} else if (depth > 5 && !Player.hasProgram(Programs.DeepscanV2)) {
|
} else if (depth > 5 && !Player.hasProgram(Programs.DeepscanV2.name)) {
|
||||||
post("You cannot scan-analyze with that high of a depth. Maximum depth is 5");
|
post("You cannot scan-analyze with that high of a depth. Maximum depth is 5");
|
||||||
return;
|
return;
|
||||||
} else if (depth > 10) {
|
} else if (depth > 10) {
|
||||||
@ -1760,7 +1761,7 @@ let Terminal = {
|
|||||||
}
|
}
|
||||||
if (d == 0) {continue;} //Don't print current server
|
if (d == 0) {continue;} //Don't print current server
|
||||||
var titleDashes = Array((d-1) * 4 + 1).join("-");
|
var titleDashes = Array((d-1) * 4 + 1).join("-");
|
||||||
if (Player.hasProgram(Programs.AutoLink)) {
|
if (Player.hasProgram(Programs.AutoLink.name)) {
|
||||||
post("<strong>" + titleDashes + "> <a class='scan-analyze-link'>" + s.hostname + "</a></strong>", false);
|
post("<strong>" + titleDashes + "> <a class='scan-analyze-link'>" + s.hostname + "</a></strong>", false);
|
||||||
} else {
|
} else {
|
||||||
post("<strong>" + titleDashes + ">" + s.hostname + "</strong>");
|
post("<strong>" + titleDashes + ">" + s.hostname + "</strong>");
|
||||||
@ -1825,7 +1826,7 @@ let Terminal = {
|
|||||||
programName = splitArgs[0];
|
programName = splitArgs[0];
|
||||||
}
|
}
|
||||||
switch (programName) {
|
switch (programName) {
|
||||||
case Programs.NukeProgram:
|
case Programs.NukeProgram.name:
|
||||||
if (s.hasAdminRights) {
|
if (s.hasAdminRights) {
|
||||||
post("You already have root access to this computer. There is no reason to run NUKE.exe");
|
post("You already have root access to this computer. There is no reason to run NUKE.exe");
|
||||||
} else {
|
} else {
|
||||||
@ -1838,7 +1839,7 @@ let Terminal = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Programs.BruteSSHProgram:
|
case Programs.BruteSSHProgram.name:
|
||||||
if (s.sshPortOpen) {
|
if (s.sshPortOpen) {
|
||||||
post("SSH Port (22) is already open!");
|
post("SSH Port (22) is already open!");
|
||||||
} else {
|
} else {
|
||||||
@ -1847,7 +1848,7 @@ let Terminal = {
|
|||||||
++s.openPortCount;
|
++s.openPortCount;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Programs.FTPCrackProgram:
|
case Programs.FTPCrackProgram.name:
|
||||||
if (s.ftpPortOpen) {
|
if (s.ftpPortOpen) {
|
||||||
post("FTP Port (21) is already open!");
|
post("FTP Port (21) is already open!");
|
||||||
} else {
|
} else {
|
||||||
@ -1856,7 +1857,7 @@ let Terminal = {
|
|||||||
++s.openPortCount;
|
++s.openPortCount;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Programs.RelaySMTPProgram:
|
case Programs.RelaySMTPProgram.name:
|
||||||
if (s.smtpPortOpen) {
|
if (s.smtpPortOpen) {
|
||||||
post("SMTP Port (25) is already open!");
|
post("SMTP Port (25) is already open!");
|
||||||
} else {
|
} else {
|
||||||
@ -1865,7 +1866,7 @@ let Terminal = {
|
|||||||
++s.openPortCount;
|
++s.openPortCount;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Programs.HTTPWormProgram:
|
case Programs.HTTPWormProgram.name:
|
||||||
if (s.httpPortOpen) {
|
if (s.httpPortOpen) {
|
||||||
post("HTTP Port (80) is already open!");
|
post("HTTP Port (80) is already open!");
|
||||||
} else {
|
} else {
|
||||||
@ -1874,7 +1875,7 @@ let Terminal = {
|
|||||||
++s.openPortCount;
|
++s.openPortCount;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Programs.SQLInjectProgram:
|
case Programs.SQLInjectProgram.name:
|
||||||
if (s.sqlPortOpen) {
|
if (s.sqlPortOpen) {
|
||||||
post("SQL Port (1433) is already open!");
|
post("SQL Port (1433) is already open!");
|
||||||
} else {
|
} else {
|
||||||
@ -1883,7 +1884,7 @@ let Terminal = {
|
|||||||
++s.openPortCount;
|
++s.openPortCount;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Programs.ServerProfiler:
|
case Programs.ServerProfiler.name:
|
||||||
if (splitArgs.length != 2) {
|
if (splitArgs.length != 2) {
|
||||||
post("Must pass a server hostname or IP as an argument for ServerProfiler.exe");
|
post("Must pass a server hostname or IP as an argument for ServerProfiler.exe");
|
||||||
return;
|
return;
|
||||||
@ -1901,22 +1902,23 @@ let Terminal = {
|
|||||||
post("Netscript grow() execution time: " + formatNumber(scriptCalculateGrowTime(serv)/1000, 1) + "s");
|
post("Netscript grow() execution time: " + formatNumber(scriptCalculateGrowTime(serv)/1000, 1) + "s");
|
||||||
post("Netscript weaken() execution time: " + formatNumber(scriptCalculateWeakenTime(serv)/1000, 1) + "s");
|
post("Netscript weaken() execution time: " + formatNumber(scriptCalculateWeakenTime(serv)/1000, 1) + "s");
|
||||||
break;
|
break;
|
||||||
case Programs.AutoLink:
|
case Programs.AutoLink.name:
|
||||||
post("This executable cannot be run.");
|
post("This executable cannot be run.");
|
||||||
post("AutoLink.exe lets you automatically connect to other servers when using 'scan-analyze'.");
|
post("AutoLink.exe lets you automatically connect to other servers when using 'scan-analyze'.");
|
||||||
post("When using scan-analyze, click on a server's hostname to connect to it.");
|
post("When using scan-analyze, click on a server's hostname to connect to it.");
|
||||||
break;
|
break;
|
||||||
case Programs.DeepscanV1:
|
case Programs.DeepscanV1.name:
|
||||||
post("This executable cannot be run.");
|
post("This executable cannot be run.");
|
||||||
post("DeepscanV1.exe lets you run 'scan-analyze' with a depth up to 5.");
|
post("DeepscanV1.exe lets you run 'scan-analyze' with a depth up to 5.");
|
||||||
break;
|
break;
|
||||||
case Programs.DeepscanV2:
|
case Programs.DeepscanV2.name:
|
||||||
post("This executable cannot be run.");
|
post("This executable cannot be run.");
|
||||||
post("DeepscanV2.exe lets you run 'scan-analyze' with a depth up to 10.");
|
post("DeepscanV2.exe lets you run 'scan-analyze' with a depth up to 10.");
|
||||||
break;
|
break;
|
||||||
case Programs.Flight:
|
case Programs.Flight.name:
|
||||||
post("Augmentations: " + Player.augmentations.length + " / 30");
|
post("Augmentations: " + Player.augmentations.length + " / 30");
|
||||||
post("Money: $" + formatNumber(Player.money.toNumber(), 2) + " / $" + formatNumber(100000000000, 2));
|
|
||||||
|
post("Money: " + numeral(Player.money.toNumber()).format('($0.000a)') + " / " + numeral(1e11).format('($0.000a)'));
|
||||||
post("One path below must be fulfilled...");
|
post("One path below must be fulfilled...");
|
||||||
post("----------HACKING PATH----------");
|
post("----------HACKING PATH----------");
|
||||||
post("Hacking skill: " + Player.hacking_skill + " / 2500");
|
post("Hacking skill: " + Player.hacking_skill + " / 2500");
|
||||||
@ -1926,7 +1928,7 @@ let Terminal = {
|
|||||||
post("Dexterity: " + Player.dexterity + " / 1500");
|
post("Dexterity: " + Player.dexterity + " / 1500");
|
||||||
post("Agility: " + Player.agility + " / 1500");
|
post("Agility: " + Player.agility + " / 1500");
|
||||||
break;
|
break;
|
||||||
case Programs.BitFlume:
|
case Programs.BitFlume.name:
|
||||||
var yesBtn = yesNoBoxGetYesButton(),
|
var yesBtn = yesNoBoxGetYesButton(),
|
||||||
noBtn = yesNoBoxGetNoButton();
|
noBtn = yesNoBoxGetNoButton();
|
||||||
yesBtn.innerHTML = "Travel to BitNode Nexus";
|
yesBtn.innerHTML = "Travel to BitNode Nexus";
|
||||||
|
@ -1,65 +1,67 @@
|
|||||||
import {dialogBoxCreate} from "../utils/DialogBox.js";
|
import {dialogBoxCreate} from "../utils/DialogBox";
|
||||||
import {gameOptionsBoxOpen, gameOptionsBoxClose}from "../utils/GameOptions.js";
|
import {gameOptionsBoxOpen, gameOptionsBoxClose}from "../utils/GameOptions";
|
||||||
import {clearEventListeners, createElement,
|
import {clearEventListeners, createElement,
|
||||||
removeChildrenFromElement,
|
removeChildrenFromElement,
|
||||||
exceptionAlert} from "../utils/HelperFunctions.js";
|
exceptionAlert} from "../utils/HelperFunctions";
|
||||||
import numeral from "numeral/min/numeral.min";
|
import numeral from "numeral/min/numeral.min";
|
||||||
import {formatNumber,
|
import {formatNumber,
|
||||||
convertTimeMsToTimeElapsedString} from "../utils/StringHelperFunctions.js";
|
convertTimeMsToTimeElapsedString,
|
||||||
|
replaceAt} from "../utils/StringHelperFunctions";
|
||||||
import {loxBoxCreate, logBoxUpdateText,
|
import {loxBoxCreate, logBoxUpdateText,
|
||||||
logBoxOpened} from "../utils/LogBox.js";
|
logBoxOpened} from "../utils/LogBox";
|
||||||
|
|
||||||
import {updateActiveScriptsItems} from "./ActiveScriptsUI.js";
|
import {updateActiveScriptsItems} from "./ActiveScriptsUI";
|
||||||
import {Augmentations, installAugmentations,
|
import {Augmentations, installAugmentations,
|
||||||
initAugmentations, AugmentationNames,
|
initAugmentations, AugmentationNames,
|
||||||
displayAugmentationsContent,
|
displayAugmentationsContent,
|
||||||
PlayerOwnedAugmentation} from "./Augmentations.js";
|
PlayerOwnedAugmentation} from "./Augmentations";
|
||||||
import {BitNodes, initBitNodes,
|
import {BitNodes, initBitNodes,
|
||||||
initBitNodeMultipliers} from "./BitNode.js";
|
initBitNodeMultipliers} from "./BitNode";
|
||||||
import {Bladeburner} from "./Bladeburner.js";
|
import {Bladeburner} from "./Bladeburner";
|
||||||
import {cinematicTextFlag} from "./CinematicText.js";
|
import {cinematicTextFlag} from "./CinematicText";
|
||||||
import {CompanyPositions, initCompanies} from "./Company.js";
|
import {CompanyPositions, initCompanies} from "./Company";
|
||||||
import {Corporation} from "./CompanyManagement.js";
|
import {Corporation} from "./CompanyManagement";
|
||||||
import {CONSTANTS} from "./Constants.js";
|
import {CONSTANTS} from "./Constants";
|
||||||
import {Programs, displayCreateProgramContent,
|
import {displayCreateProgramContent,
|
||||||
getNumAvailableCreateProgram,
|
getNumAvailableCreateProgram,
|
||||||
initCreateProgramButtons} from "./CreateProgram.js";
|
initCreateProgramButtons,
|
||||||
|
Programs} from "./CreateProgram";
|
||||||
import {displayFactionContent, joinFaction,
|
import {displayFactionContent, joinFaction,
|
||||||
processPassiveFactionRepGain, Factions,
|
processPassiveFactionRepGain, Factions,
|
||||||
inviteToFaction, initFactions} from "./Faction.js";
|
inviteToFaction, initFactions} from "./Faction";
|
||||||
import {FconfSettings} from "./Fconf.js";
|
import {FconfSettings} from "./Fconf";
|
||||||
import {Locations, displayLocationContent,
|
import {Locations, displayLocationContent,
|
||||||
initLocationButtons} from "./Location.js";
|
initLocationButtons} from "./Location";
|
||||||
import {displayGangContent, updateGangContent,
|
import {displayGangContent, updateGangContent,
|
||||||
Gang} from "./Gang.js";
|
Gang} from "./Gang";
|
||||||
import {displayHacknetNodesContent, processAllHacknetNodeEarnings,
|
import {displayHacknetNodesContent, processAllHacknetNodeEarnings,
|
||||||
updateHacknetNodesContent} from "./HacknetNode.js";
|
updateHacknetNodesContent} from "./HacknetNode";
|
||||||
import {iTutorialStart} from "./InteractiveTutorial.js";
|
import {iTutorialStart} from "./InteractiveTutorial";
|
||||||
import {initLiterature} from "./Literature.js";
|
import {initLiterature} from "./Literature";
|
||||||
import {checkForMessagesToSend, initMessages} from "./Message.js";
|
import {checkForMessagesToSend, initMessages} from "./Message";
|
||||||
import {inMission, currMission} from "./Missions.js";
|
import {inMission, currMission} from "./Missions";
|
||||||
import {initSingularitySFFlags,
|
import {initSingularitySFFlags,
|
||||||
hasSingularitySF, hasCorporationSF} from "./NetscriptFunctions.js";
|
hasSingularitySF, hasCorporationSF} from "./NetscriptFunctions";
|
||||||
import {updateOnlineScriptTimes,
|
import {updateOnlineScriptTimes,
|
||||||
runScriptsLoop} from "./NetscriptWorker.js";
|
runScriptsLoop} from "./NetscriptWorker";
|
||||||
import {Player} from "./Player.js";
|
import {Player} from "./Player";
|
||||||
import {prestigeAugmentation,
|
import {prestigeAugmentation,
|
||||||
prestigeSourceFile} from "./Prestige.js";
|
prestigeSourceFile} from "./Prestige";
|
||||||
import {redPillFlag, hackWorldDaemon} from "./RedPill.js";
|
import {redPillFlag, hackWorldDaemon} from "./RedPill";
|
||||||
import {saveObject, loadGame} from "./SaveObject.js";
|
import {saveObject, loadGame} from "./SaveObject";
|
||||||
import {loadAllRunningScripts, scriptEditorInit,
|
import {loadAllRunningScripts, scriptEditorInit,
|
||||||
updateScriptEditorContent} from "./Script.js";
|
updateScriptEditorContent} from "./Script";
|
||||||
import {AllServers, Server, initForeignServers} from "./Server.js";
|
import {AllServers, Server, initForeignServers} from "./Server";
|
||||||
import {Settings, setSettingsLabels} from "./Settings.js";
|
import {Settings, setSettingsLabels} from "./Settings";
|
||||||
import {initSourceFiles, SourceFiles,
|
import {initSourceFiles, SourceFiles,
|
||||||
PlayerOwnedSourceFile} from "./SourceFile.js";
|
PlayerOwnedSourceFile} from "./SourceFile";
|
||||||
import {SpecialServerIps, initSpecialServerIps} from "./SpecialServerIps.js";
|
import {SpecialServerIps, initSpecialServerIps} from "./SpecialServerIps";
|
||||||
import {StockMarket, StockSymbols,
|
import {StockMarket, StockSymbols,
|
||||||
SymbolToStockMap, initStockSymbols,
|
SymbolToStockMap, initStockSymbols,
|
||||||
initSymbolToStockMap, stockMarketCycle,
|
initSymbolToStockMap, stockMarketCycle,
|
||||||
updateStockPrices,
|
updateStockPrices,
|
||||||
displayStockMarketContent} from "./StockMarket.js";
|
displayStockMarketContent} from "./StockMarket";
|
||||||
import {Terminal, postNetburnerText, post, KEY} from "./Terminal.js";
|
import {Terminal, postNetburnerText, post, KEY} from "./Terminal";
|
||||||
|
|
||||||
/* Shortcuts to navigate through the game
|
/* Shortcuts to navigate through the game
|
||||||
* Alt-t - Terminal
|
* Alt-t - Terminal
|
||||||
@ -1170,7 +1172,7 @@ let Engine = {
|
|||||||
|
|
||||||
//Update progress bar
|
//Update progress bar
|
||||||
while (Engine._actionProgressBarCount * 2 <= percent) {
|
while (Engine._actionProgressBarCount * 2 <= percent) {
|
||||||
Engine._actionProgressStr = Engine._actionProgressStr.replaceAt(Engine._actionProgressBarCount, "|");
|
Engine._actionProgressStr = replaceAt(Engine._actionProgressStr, Engine._actionProgressBarCount, "|");
|
||||||
Engine._actionProgressBarCount += 1;
|
Engine._actionProgressBarCount += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1736,13 +1738,6 @@ let Engine = {
|
|||||||
Player.sourceFiles[sfIndex].lvl=sfLvl;
|
Player.sourceFiles[sfIndex].lvl=sfLvl;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//If DarkWeb already purchased, disable the button
|
|
||||||
if (SpecialServerIps.hasOwnProperty("Darkweb Server")) {
|
|
||||||
const purchaseTor = document.getElementById("location-purchase-tor");
|
|
||||||
purchaseTor.setAttribute("class", "a-link-button-bought");
|
|
||||||
purchaseTor.innerHTML = "TOR Router - Purchased";
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/* Initialization */
|
/* Initialization */
|
||||||
|
323
stylelint.config.js
Normal file
323
stylelint.config.js
Normal file
@ -0,0 +1,323 @@
|
|||||||
|
/* eslint-disable spaced-comment */
|
||||||
|
module.exports = {
|
||||||
|
plugins: [
|
||||||
|
"stylelint-declaration-use-variable",
|
||||||
|
"stylelint-order" /*,
|
||||||
|
"stylelint-scss" */
|
||||||
|
],
|
||||||
|
rules: {
|
||||||
|
"at-rule-blacklist": [],
|
||||||
|
// "at-rule-empty-line-before": [
|
||||||
|
// "always",
|
||||||
|
// {
|
||||||
|
// except: [
|
||||||
|
// "inside-block", "blockless-after-same-name-blockless"
|
||||||
|
// ],
|
||||||
|
// ignore: [
|
||||||
|
// "after-comment"
|
||||||
|
// ]
|
||||||
|
// }
|
||||||
|
// ],
|
||||||
|
"at-rule-name-case": "lower",
|
||||||
|
"at-rule-name-newline-after": "always-multi-line",
|
||||||
|
"at-rule-name-space-after": "always",
|
||||||
|
// "at-rule-no-vendor-prefix": true,
|
||||||
|
"at-rule-semicolon-newline-after": "always",
|
||||||
|
"at-rule-semicolon-space-before": "never",
|
||||||
|
// "at-rule-whitelist": [
|
||||||
|
// "content",
|
||||||
|
// "else",
|
||||||
|
// "function",
|
||||||
|
// "if",
|
||||||
|
// "import",
|
||||||
|
// "include",
|
||||||
|
// "keyframes",
|
||||||
|
// "mixin",
|
||||||
|
// "return"
|
||||||
|
// ],
|
||||||
|
"block-closing-brace-empty-line-before": "never",
|
||||||
|
"block-closing-brace-newline-after": "always",
|
||||||
|
"block-closing-brace-newline-before": "always-multi-line",
|
||||||
|
"block-no-empty": true,
|
||||||
|
// "block-opening-brace-newline-after": "always",
|
||||||
|
// "block-opening-brace-newline-before": "never-single-line",
|
||||||
|
// "block-opening-brace-space-before": "always",
|
||||||
|
// "color-hex-case": "lower",
|
||||||
|
// "color-hex-length": "short",
|
||||||
|
// "color-named": "never",
|
||||||
|
//"color-no-hex": true,
|
||||||
|
"color-no-invalid-hex": true,
|
||||||
|
// "comment-empty-line-before": "always",
|
||||||
|
"comment-no-empty": true,
|
||||||
|
// "comment-whitespace-inside": "always",
|
||||||
|
"comment-word-blacklist": [],
|
||||||
|
"custom-media-pattern": ".+",
|
||||||
|
"custom-property-empty-line-before": "never",
|
||||||
|
"custom-property-pattern": "my-.+",
|
||||||
|
"declaration-bang-space-after": "never",
|
||||||
|
// "declaration-bang-space-before": "always",
|
||||||
|
// "declaration-block-no-duplicate-properties": true,
|
||||||
|
"declaration-block-no-redundant-longhand-properties": true,
|
||||||
|
"declaration-block-no-shorthand-property-overrides": true,
|
||||||
|
// "declaration-block-semicolon-newline-after": "always",
|
||||||
|
"declaration-block-semicolon-newline-before": "never-multi-line",
|
||||||
|
"declaration-block-semicolon-space-before": "never",
|
||||||
|
// "declaration-block-single-line-max-declarations": 1,
|
||||||
|
"declaration-block-trailing-semicolon": "always",
|
||||||
|
"declaration-colon-newline-after": "always-multi-line",
|
||||||
|
// "declaration-colon-space-after": "always-single-line",
|
||||||
|
"declaration-colon-space-before": "never",
|
||||||
|
// "declaration-empty-line-before": "never",
|
||||||
|
//"declaration-no-important": true,
|
||||||
|
"declaration-property-unit-blacklist": {},
|
||||||
|
"declaration-property-unit-whitelist": {},
|
||||||
|
"declaration-property-value-blacklist": {},
|
||||||
|
"declaration-property-value-whitelist": {},
|
||||||
|
// "font-family-name-quotes": "always-where-recommended",
|
||||||
|
"font-family-no-duplicate-names": true,
|
||||||
|
"font-family-no-missing-generic-family-keyword": true,
|
||||||
|
// "font-weight-notation": "numeric",
|
||||||
|
"function-blacklist": [],
|
||||||
|
"function-calc-no-unspaced-operator": true,
|
||||||
|
"function-comma-newline-after": "always-multi-line",
|
||||||
|
"function-comma-newline-before": "never-multi-line",
|
||||||
|
// "function-comma-space-after": "always-single-line",
|
||||||
|
"function-comma-space-before": "never",
|
||||||
|
"function-linear-gradient-no-nonstandard-direction": true,
|
||||||
|
"function-max-empty-lines": 1,
|
||||||
|
"function-name-case": "lower",
|
||||||
|
"function-parentheses-newline-inside": "never-multi-line",
|
||||||
|
"function-parentheses-space-inside": "never",
|
||||||
|
"function-url-no-scheme-relative": true,
|
||||||
|
"function-url-quotes": "always",
|
||||||
|
"function-url-scheme-blacklist": [],
|
||||||
|
"function-url-scheme-whitelist": [],
|
||||||
|
// "function-whitelist": [
|
||||||
|
// "box-shadow-args",
|
||||||
|
// "map-get",
|
||||||
|
// "rgba",
|
||||||
|
// "skew",
|
||||||
|
// "var"
|
||||||
|
// ],
|
||||||
|
"function-whitespace-after": "always",
|
||||||
|
// "indentation": 4,
|
||||||
|
"keyframe-declaration-no-important": true,
|
||||||
|
// "length-zero-no-unit": true,
|
||||||
|
// "max-empty-lines": 1,
|
||||||
|
"max-line-length": 160,
|
||||||
|
"max-nesting-depth": 99,
|
||||||
|
"media-feature-colon-space-after": "always",
|
||||||
|
"media-feature-colon-space-before": "never",
|
||||||
|
"media-feature-name-blacklist": [],
|
||||||
|
"media-feature-name-case": "lower",
|
||||||
|
"media-feature-name-no-unknown": true,
|
||||||
|
"media-feature-name-no-vendor-prefix": true,
|
||||||
|
"media-feature-name-whitelist": [],
|
||||||
|
"media-feature-parentheses-space-inside": "never",
|
||||||
|
"media-feature-range-operator-space-after": "always",
|
||||||
|
"media-feature-range-operator-space-before": "always",
|
||||||
|
"media-query-list-comma-newline-after": "always-multi-line",
|
||||||
|
"media-query-list-comma-newline-before": "never-multi-line",
|
||||||
|
"media-query-list-comma-space-after": "always-single-line",
|
||||||
|
"media-query-list-comma-space-before": "never",
|
||||||
|
// "no-descending-specificity": true,
|
||||||
|
"no-duplicate-at-import-rules": true,
|
||||||
|
// "no-duplicate-selectors": true,
|
||||||
|
"no-empty-source": true,
|
||||||
|
"no-eol-whitespace": true,
|
||||||
|
// "no-extra-semicolons": true,
|
||||||
|
"no-invalid-double-slash-comments": true,
|
||||||
|
// "no-missing-end-of-source-newline": true,
|
||||||
|
"no-unknown-animations": true,
|
||||||
|
"number-leading-zero": "always",
|
||||||
|
"number-max-precision": [3, { ignoreUnits: [ "%" ] }],
|
||||||
|
// "number-no-trailing-zeros": true,
|
||||||
|
"order/order": [
|
||||||
|
[
|
||||||
|
"dollar-variables",
|
||||||
|
"at-variables",
|
||||||
|
"custom-properties",
|
||||||
|
{
|
||||||
|
type: "at-rule",
|
||||||
|
name: "include"
|
||||||
|
},
|
||||||
|
"declarations",
|
||||||
|
"rules",
|
||||||
|
"at-rules",
|
||||||
|
"less-mixins"
|
||||||
|
],
|
||||||
|
{
|
||||||
|
unspecified: "bottom"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
// "order/properties-order": [
|
||||||
|
// []
|
||||||
|
// ],
|
||||||
|
// "order/properties-alphabetical-order": true,
|
||||||
|
"property-blacklist": [
|
||||||
|
"grid-area",
|
||||||
|
"grid-template",
|
||||||
|
"grid-column",
|
||||||
|
"grid-row"
|
||||||
|
],
|
||||||
|
"property-case": "lower",
|
||||||
|
"property-no-unknown": true,
|
||||||
|
// "property-no-vendor-prefix": true,
|
||||||
|
|
||||||
|
/*"property-whitelist": [
|
||||||
|
"/animation$/",
|
||||||
|
"/box-shadow$/",
|
||||||
|
"/keyframes$/",
|
||||||
|
"/transform$/",
|
||||||
|
"display",
|
||||||
|
"font-size"
|
||||||
|
], */
|
||||||
|
// "rule-empty-line-before": ["always", { except: [ "after-single-line-comment" ] }],
|
||||||
|
/*"scss/at-else-closing-brace-newline-after": "always-last-in-chain",
|
||||||
|
"scss/at-else-empty-line-before": "never",
|
||||||
|
"scss/at-else-if-parentheses-space-before": "always",
|
||||||
|
"scss/at-extend-no-missing-placeholder": true,
|
||||||
|
"scss/at-function-named-arguments": "never",
|
||||||
|
"scss/at-function-parentheses-space-before": "never",
|
||||||
|
"scss/at-function-pattern": /.+/,
|
||||||
|
"scss/at-if-closing-brace-newline-after": "always-last-in-chain",
|
||||||
|
"scss/at-import-no-partial-leading-underscore": true,
|
||||||
|
"scss/at-import-partial-extension-blacklist": [
|
||||||
|
[]
|
||||||
|
],
|
||||||
|
"scss/at-import-partial-extension-whitelist": [
|
||||||
|
[]
|
||||||
|
],
|
||||||
|
"scss/at-mixin-argumentless-call-parentheses": "always",
|
||||||
|
"scss/at-mixin-named-arguments": "never",
|
||||||
|
"scss/at-mixin-parentheses-space-before": "never",
|
||||||
|
"scss/at-mixin-pattern": /.+/,
|
||||||
|
"scss/at-rule-no-unknown": [
|
||||||
|
true,
|
||||||
|
{
|
||||||
|
ignoreAtRules: []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"scss/dollar-variable-colon-newline-after": "always-multi-line",
|
||||||
|
"scss/dollar-variable-colon-space-after": "always-single-line",
|
||||||
|
"scss/dollar-variable-colon-space-before": "never",
|
||||||
|
"scss/dollar-variable-default": [
|
||||||
|
true,
|
||||||
|
{
|
||||||
|
ignore: "local"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"scss/dollar-variable-empty-line-before": "never",
|
||||||
|
"scss/dollar-variable-no-missing-interpolation": true,
|
||||||
|
"scss/dollar-variable-pattern": /.+/,
|
||||||
|
"scss/percent-placeholder-pattern": /.+/,
|
||||||
|
"scss/double-slash-comment-inline": [
|
||||||
|
"always",
|
||||||
|
{
|
||||||
|
ignore: [
|
||||||
|
"stylelint-commands"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"scss/double-slash-comment-whitespace-inside": "always",
|
||||||
|
"scss/declaration-nested-properties": "never",
|
||||||
|
"scss/media-feature-value-dollar-variable": "always",
|
||||||
|
"scss/operator-no-newline-after": true,
|
||||||
|
"scss/operator-no-newline-before": true,
|
||||||
|
"scss/operator-no-unspaced": true,
|
||||||
|
"scss/partial-no-import": true,
|
||||||
|
"scss/selector-no-redundant-nesting-selector": true,*/
|
||||||
|
"selector-attribute-brackets-space-inside": "never",
|
||||||
|
"selector-attribute-operator-blacklist": [],
|
||||||
|
// "selector-attribute-operator-space-after": "always",
|
||||||
|
// "selector-attribute-operator-space-before": "always",
|
||||||
|
"selector-attribute-operator-whitelist": [
|
||||||
|
"="
|
||||||
|
],
|
||||||
|
"selector-attribute-quotes": "always",
|
||||||
|
"selector-class-pattern": ".+",
|
||||||
|
//"selector-combinator-blacklist": [],
|
||||||
|
// "selector-combinator-space-after": "always",
|
||||||
|
// "selector-combinator-space-before": "always",
|
||||||
|
//"selector-combinator-whitelist": [],
|
||||||
|
"selector-descendant-combinator-no-non-space": true,
|
||||||
|
"selector-id-pattern": ".+",
|
||||||
|
"selector-list-comma-newline-after": "always-multi-line",
|
||||||
|
"selector-list-comma-newline-before": "never-multi-line",
|
||||||
|
"selector-list-comma-space-after": "always-single-line",
|
||||||
|
"selector-list-comma-space-before": "never",
|
||||||
|
"selector-max-attribute": 99,
|
||||||
|
"selector-max-class": 99,
|
||||||
|
"selector-max-combinators": 99,
|
||||||
|
"selector-max-compound-selectors": 99,
|
||||||
|
"selector-max-empty-lines": 1,
|
||||||
|
"selector-max-id": 1,
|
||||||
|
//"selector-max-specificity": "0,0,0",
|
||||||
|
"selector-max-type": 99,
|
||||||
|
"selector-max-universal": 1,
|
||||||
|
"selector-nested-pattern": ".+",
|
||||||
|
"selector-no-qualifying-type": [
|
||||||
|
true,
|
||||||
|
{
|
||||||
|
ignore: [
|
||||||
|
"attribute", "class"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"selector-no-vendor-prefix": true,
|
||||||
|
"selector-pseudo-class-blacklist": [],
|
||||||
|
"selector-pseudo-class-case": "lower",
|
||||||
|
"selector-pseudo-class-no-unknown": true,
|
||||||
|
"selector-pseudo-class-parentheses-space-inside": "never",
|
||||||
|
"selector-pseudo-class-whitelist": [
|
||||||
|
"active",
|
||||||
|
"after",
|
||||||
|
"before",
|
||||||
|
"focus",
|
||||||
|
"hover",
|
||||||
|
"link",
|
||||||
|
"not",
|
||||||
|
"last-child",
|
||||||
|
"root",
|
||||||
|
"visited"
|
||||||
|
],
|
||||||
|
//"selector-pseudo-element-blacklist": [],
|
||||||
|
"selector-pseudo-element-case": "lower",
|
||||||
|
// "selector-pseudo-element-colon-notation": "double",
|
||||||
|
"selector-pseudo-element-no-unknown": true,
|
||||||
|
//"selector-pseudo-element-whitelist": [],
|
||||||
|
"selector-type-case": "lower",
|
||||||
|
"selector-type-no-unknown": true,
|
||||||
|
// "shorthand-property-no-redundant-values": true,
|
||||||
|
// "sh-waqar/declaration-use-variable": [
|
||||||
|
// [
|
||||||
|
// "color",
|
||||||
|
// "background-color",
|
||||||
|
// "font-family"
|
||||||
|
// ]
|
||||||
|
// ],
|
||||||
|
"string-no-newline": true,
|
||||||
|
// "string-quotes": "double",
|
||||||
|
"time-min-milliseconds": 50,
|
||||||
|
"unit-blacklist": [],
|
||||||
|
"unit-case": "lower",
|
||||||
|
"unit-no-unknown": true,
|
||||||
|
"unit-whitelist": [
|
||||||
|
"deg",
|
||||||
|
"fr",
|
||||||
|
"px",
|
||||||
|
"rem",
|
||||||
|
"ms",
|
||||||
|
"s",
|
||||||
|
"vw",
|
||||||
|
"%"
|
||||||
|
],
|
||||||
|
// "value-keyword-case": "lower",
|
||||||
|
"value-list-comma-newline-after": "always-multi-line",
|
||||||
|
"value-list-comma-newline-before": "never-multi-line",
|
||||||
|
"value-list-comma-space-after": "always-single-line",
|
||||||
|
"value-list-comma-space-before": "never",
|
||||||
|
"value-list-max-empty-lines": 0,
|
||||||
|
"value-no-vendor-prefix": true
|
||||||
|
}
|
||||||
|
};
|
@ -44,7 +44,7 @@
|
|||||||
],
|
],
|
||||||
"no-any": false,
|
"no-any": false,
|
||||||
"no-inferrable-types": [
|
"no-inferrable-types": [
|
||||||
true,
|
false,
|
||||||
"ignore-params",
|
"ignore-params",
|
||||||
"ignore-properties"
|
"ignore-properties"
|
||||||
],
|
],
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import {Faction, joinFaction} from "../src/Faction.js";
|
import {Faction, joinFaction} from "../src/Faction";
|
||||||
import {Engine} from "../src/engine.js";
|
import {Engine} from "../src/engine";
|
||||||
import {Player} from "../src/Player.js";
|
import {Player} from "../src/Player";
|
||||||
import {clearEventListeners} from "./HelperFunctions.js";
|
import {clearEventListeners} from "./HelperFunctions";
|
||||||
|
|
||||||
/* Faction Invitation Pop-up box */
|
/* Faction Invitation Pop-up box */
|
||||||
function factionInvitationBoxClose() {
|
function factionInvitationBoxClose() {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
//General helper functions
|
//General helper functions
|
||||||
import {isString} from "./StringHelperFunctions.js";
|
import {isString} from "./StringHelperFunctions";
|
||||||
import {dialogBoxCreate} from "./DialogBox.js";
|
import {dialogBoxCreate} from "./DialogBox";
|
||||||
|
|
||||||
//Returns the size (number of keys) of an object
|
//Returns the size (number of keys) of an object
|
||||||
function sizeOfObject(obj) {
|
function sizeOfObject(obj) {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import {AllServers} from "../src/Server.js";
|
import {AllServers} from "../src/Server";
|
||||||
/* Functions to deal with manipulating IP addresses*/
|
/* Functions to deal with manipulating IP addresses*/
|
||||||
|
|
||||||
//Generate a random IP address
|
//Generate a random IP address
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import {BitNodeMultipliers} from "../src/BitNode.js";
|
import {BitNodeMultipliers} from "../src/BitNode";
|
||||||
import {CONSTANTS} from "../src/Constants.js";
|
import {CONSTANTS} from "../src/Constants";
|
||||||
import {Factions, Faction} from "../src/Faction.js";
|
import {Factions, Faction} from "../src/Faction";
|
||||||
import {Player} from "../src/Player.js";
|
import {Player} from "../src/Player";
|
||||||
import {dialogBoxCreate} from "./DialogBox.js";
|
import {dialogBoxCreate} from "./DialogBox";
|
||||||
import {clearEventListeners} from "./HelperFunctions.js";
|
import {clearEventListeners} from "./HelperFunctions";
|
||||||
import {formatNumber} from "./StringHelperFunctions.js";
|
import {formatNumber} from "./StringHelperFunctions";
|
||||||
|
|
||||||
/* InfiltrationBox.js */
|
/* InfiltrationBox.js */
|
||||||
function infiltrationBoxClose() {
|
function infiltrationBoxClose() {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import {killWorkerScript} from "../src/NetscriptWorker.js";
|
import {killWorkerScript} from "../src/NetscriptWorker";
|
||||||
import {printArray, clearEventListeners} from "./HelperFunctions.js";
|
import {printArray, clearEventListeners} from "./HelperFunctions";
|
||||||
|
|
||||||
$(document).keydown(function(event) {
|
$(document).keydown(function(event) {
|
||||||
if (logBoxOpened && event.keyCode == 27) {
|
if (logBoxOpened && event.keyCode == 27) {
|
||||||
|
@ -1,150 +0,0 @@
|
|||||||
import {dialogBoxCreate} from "./DialogBox.js";
|
|
||||||
|
|
||||||
//Netburner String helper functions
|
|
||||||
|
|
||||||
//Searches for every occurence of searchStr within str and returns an array of the indices of
|
|
||||||
//all these occurences
|
|
||||||
function getIndicesOf(searchStr, str, caseSensitive) {
|
|
||||||
var searchStrLen = searchStr.length;
|
|
||||||
if (searchStrLen == 0) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
var startIndex = 0, index, indices = [];
|
|
||||||
if (!caseSensitive) {
|
|
||||||
str = str.toLowerCase();
|
|
||||||
searchStr = searchStr.toLowerCase();
|
|
||||||
}
|
|
||||||
while ((index = str.indexOf(searchStr, startIndex)) > -1) {
|
|
||||||
indices.push(index);
|
|
||||||
startIndex = index + searchStrLen;
|
|
||||||
}
|
|
||||||
return indices;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Replaces the character at an index with a new character
|
|
||||||
String.prototype.replaceAt=function(index, character) {
|
|
||||||
return this.substr(0, index) + character + this.substr(index+character.length);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Converts a date representing time in milliseconds to a string with the format
|
|
||||||
// H hours M minutes and S seconds
|
|
||||||
// e.g. 10000 -> "0 hours 0 minutes and 10 seconds"
|
|
||||||
// 120000 -> "0 0 hours 2 minutes and 0 seconds"
|
|
||||||
function convertTimeMsToTimeElapsedString(time) {
|
|
||||||
//Convert ms to seconds, since we only have second-level precision
|
|
||||||
time = Math.floor(time / 1000);
|
|
||||||
|
|
||||||
var days = Math.floor(time / 86400);
|
|
||||||
time %= 86400;
|
|
||||||
|
|
||||||
var hours = Math.floor(time / 3600);
|
|
||||||
time %= 3600;
|
|
||||||
|
|
||||||
var minutes = Math.floor(time / 60);
|
|
||||||
time %= 60;
|
|
||||||
|
|
||||||
var seconds = time;
|
|
||||||
|
|
||||||
var res = "";
|
|
||||||
if (days) {res += days + " days ";}
|
|
||||||
if (hours) {res += hours + " hours ";}
|
|
||||||
if (minutes) {res += minutes + " minutes ";}
|
|
||||||
res += seconds + " seconds ";
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Finds the longest common starting substring in a set of strings
|
|
||||||
function longestCommonStart(strings) {
|
|
||||||
if (!containsAllStrings(strings)) {return;}
|
|
||||||
if (strings.length == 0) {return;}
|
|
||||||
|
|
||||||
var A = strings.concat().sort(),
|
|
||||||
a1= A[0], a2= A[A.length-1], L= a1.length, i= 0;
|
|
||||||
while(i<L && a1.charAt(i).toLowerCase() === a2.charAt(i).toLowerCase()) i++;
|
|
||||||
return a1.substring(0, i);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//Returns whether a variable is a string
|
|
||||||
function isString(str) {
|
|
||||||
return (typeof str === 'string' || str instanceof String);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Returns whether an array contains entirely of string objects
|
|
||||||
function containsAllStrings(arr) {
|
|
||||||
return arr.every(isString);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Formats a number with commas and a specific number of decimal digits
|
|
||||||
function formatNumber(num, numFractionDigits) {
|
|
||||||
return num.toLocaleString(undefined, {
|
|
||||||
minimumFractionDigits: numFractionDigits,
|
|
||||||
maximumFractionDigits: numFractionDigits
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//Count the number of times a substring occurs in a string
|
|
||||||
function numOccurrences(string, subString) {
|
|
||||||
string += "";
|
|
||||||
subString += "";
|
|
||||||
if (subString.length <= 0) return (string.length + 1);
|
|
||||||
|
|
||||||
var n = 0, pos = 0, step = subString.length;
|
|
||||||
|
|
||||||
while (true) {
|
|
||||||
pos = string.indexOf(subString, pos);
|
|
||||||
if (pos >= 0) {
|
|
||||||
++n;
|
|
||||||
pos += step;
|
|
||||||
} else break;
|
|
||||||
}
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Counters the number of Netscript operators in a string
|
|
||||||
function numNetscriptOperators(string) {
|
|
||||||
var total = 0;
|
|
||||||
total += numOccurrences(string, "+");
|
|
||||||
total += numOccurrences(string, "-");
|
|
||||||
total += numOccurrences(string, "*");
|
|
||||||
total += numOccurrences(string, "/");
|
|
||||||
total += numOccurrences(string, "%");
|
|
||||||
total += numOccurrences(string, "&&");
|
|
||||||
total += numOccurrences(string, "||");
|
|
||||||
total += numOccurrences(string, "<");
|
|
||||||
total += numOccurrences(string, ">");
|
|
||||||
total += numOccurrences(string, "<=");
|
|
||||||
total += numOccurrences(string, ">=");
|
|
||||||
total += numOccurrences(string, "==");
|
|
||||||
total += numOccurrences(string, "!=");
|
|
||||||
if (isNaN(total)) {
|
|
||||||
dialogBoxCreate("ERROR in counting number of operators in script. This is a bug, please report to game developer");
|
|
||||||
total = 0;
|
|
||||||
}
|
|
||||||
return total;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Checks if a string contains HTML elements
|
|
||||||
function isHTML(str) {
|
|
||||||
var a = document.createElement('div');
|
|
||||||
a.innerHTML = str;
|
|
||||||
for (var c = a.childNodes, i = c.length; i--; ) {
|
|
||||||
if (c[i].nodeType == 1) return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Generates a random alphanumeric string with N characters
|
|
||||||
function generateRandomString(n) {
|
|
||||||
var str = "",
|
|
||||||
chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
||||||
|
|
||||||
for (var i = 0; i < n; i++)
|
|
||||||
str += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
||||||
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
|
|
||||||
export {getIndicesOf, convertTimeMsToTimeElapsedString, longestCommonStart,
|
|
||||||
isString, containsAllStrings, formatNumber,
|
|
||||||
numOccurrences, numNetscriptOperators, isHTML, generateRandomString};
|
|
151
utils/StringHelperFunctions.ts
Normal file
151
utils/StringHelperFunctions.ts
Normal file
@ -0,0 +1,151 @@
|
|||||||
|
import { dialogBoxCreate } from "./DialogBox";
|
||||||
|
|
||||||
|
// Netburner String helper functions
|
||||||
|
|
||||||
|
// Replaces the character at an index with a new character
|
||||||
|
function replaceAt(base: string, index: number, character: string): string {
|
||||||
|
return base.substr(0, index) + character + base.substr(index + character.length);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Converts a date representing time in milliseconds to a string with the format H hours M minutes and S seconds
|
||||||
|
e.g. 10000 -> "0 hours 0 minutes and 10 seconds"
|
||||||
|
120000 -> "0 0 hours 2 minutes and 0 seconds"
|
||||||
|
*/
|
||||||
|
function convertTimeMsToTimeElapsedString(time: number): string {
|
||||||
|
const millisecondsPerSecond = 1000;
|
||||||
|
const secondPerMinute = 60;
|
||||||
|
const minutesPerHours = 60;
|
||||||
|
const secondPerHours: number = secondPerMinute * minutesPerHours;
|
||||||
|
const hoursPerDays = 24;
|
||||||
|
const secondPerDay: number = secondPerHours * hoursPerDays;
|
||||||
|
|
||||||
|
// Convert ms to seconds, since we only have second-level precision
|
||||||
|
const totalSeconds: number = Math.floor(time / millisecondsPerSecond);
|
||||||
|
|
||||||
|
const days: number = Math.floor(totalSeconds / secondPerDay);
|
||||||
|
const secTruncDays: number = totalSeconds % secondPerDay;
|
||||||
|
|
||||||
|
const hours: number = Math.floor(secTruncDays / secondPerHours);
|
||||||
|
const secTruncHours: number = secTruncDays % secondPerHours;
|
||||||
|
|
||||||
|
const minutes: number = Math.floor(secTruncHours / secondPerMinute);
|
||||||
|
const secTruncMinutes: number = secTruncHours % secondPerMinute;
|
||||||
|
|
||||||
|
const seconds: number = secTruncMinutes;
|
||||||
|
|
||||||
|
let res = "";
|
||||||
|
if (days) {res += `${days} days `; }
|
||||||
|
if (hours) {res += `${hours} hours `; }
|
||||||
|
if (minutes) {res += `${minutes} minutes `; }
|
||||||
|
res += `${seconds} seconds `;
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Finds the longest common starting substring in a set of strings
|
||||||
|
function longestCommonStart(strings: string[]): string {
|
||||||
|
if (!containsAllStrings(strings)) {return ""; }
|
||||||
|
if (strings.length == 0) {return ""; }
|
||||||
|
|
||||||
|
const A: string[] = strings.concat().sort();
|
||||||
|
const a1: string = A[0];
|
||||||
|
const a2: string = A[A.length - 1];
|
||||||
|
const L: number = a1.length;
|
||||||
|
let i = 0;
|
||||||
|
while (i < L && a1.charAt(i).toLowerCase() === a2.charAt(i).toLowerCase()) { i++; }
|
||||||
|
|
||||||
|
return a1.substring(0, i);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns whether a variable is a string
|
||||||
|
function isString(str: any): boolean {
|
||||||
|
return (typeof str === "string" || str instanceof String);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns whether an array contains entirely of string objects
|
||||||
|
function containsAllStrings(arr: string[]): boolean {
|
||||||
|
return arr.every(isString);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Formats a number with commas and a specific number of decimal digits
|
||||||
|
function formatNumber(num: number, numFractionDigits: number): string {
|
||||||
|
return num.toLocaleString(undefined, {
|
||||||
|
maximumFractionDigits: numFractionDigits,
|
||||||
|
minimumFractionDigits: numFractionDigits,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Count the number of times a substring occurs in a string
|
||||||
|
function numOccurrences(text: string, subString: string): number {
|
||||||
|
text += "";
|
||||||
|
subString += "";
|
||||||
|
if (subString.length <= 0) { return (text.length + 1); }
|
||||||
|
|
||||||
|
let n = 0;
|
||||||
|
let pos = 0;
|
||||||
|
const step: number = subString.length;
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
pos = text.indexOf(subString, pos);
|
||||||
|
if (pos >= 0) {
|
||||||
|
++n;
|
||||||
|
pos += step;
|
||||||
|
} else { break; }
|
||||||
|
}
|
||||||
|
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Counters the number of Netscript operators in a string
|
||||||
|
function numNetscriptOperators(text: string): number {
|
||||||
|
const total: number = numOccurrences(text, "+") +
|
||||||
|
numOccurrences(text, "-") +
|
||||||
|
numOccurrences(text, "*") +
|
||||||
|
numOccurrences(text, "/") +
|
||||||
|
numOccurrences(text, "%") +
|
||||||
|
numOccurrences(text, "&&") +
|
||||||
|
numOccurrences(text, "||") +
|
||||||
|
numOccurrences(text, "<") +
|
||||||
|
numOccurrences(text, ">") +
|
||||||
|
numOccurrences(text, "<=") +
|
||||||
|
numOccurrences(text, ">=") +
|
||||||
|
numOccurrences(text, "==") +
|
||||||
|
numOccurrences(text, "!=");
|
||||||
|
if (isNaN(total)) {
|
||||||
|
const message = "ERROR in counting number of operators in script. This is a bug, please report to game developer";
|
||||||
|
dialogBoxCreate(message, false);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return total;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Checks if a string contains HTML elements
|
||||||
|
function isHTML(str: string): boolean {
|
||||||
|
const a = document.createElement("div");
|
||||||
|
a.innerHTML = str;
|
||||||
|
const c = a.childNodes;
|
||||||
|
for (let i = c.length; i--;) {
|
||||||
|
if (c[i].nodeType == 1) { return true; }
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generates a random alphanumeric string with N characters
|
||||||
|
function generateRandomString(n: number): string {
|
||||||
|
let str = "";
|
||||||
|
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||||
|
|
||||||
|
for (let i = 0; i < n; i++) {
|
||||||
|
str += chars.charAt(Math.floor(Math.random() * chars.length));
|
||||||
|
}
|
||||||
|
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
export {convertTimeMsToTimeElapsedString, longestCommonStart,
|
||||||
|
isString, containsAllStrings, formatNumber,
|
||||||
|
numOccurrences, numNetscriptOperators, isHTML, generateRandomString, replaceAt};
|
@ -1,4 +1,4 @@
|
|||||||
import {clearEventListeners} from "./HelperFunctions.js";
|
import {clearEventListeners} from "./HelperFunctions";
|
||||||
/* Generic Yes-No Pop-up box
|
/* Generic Yes-No Pop-up box
|
||||||
* Can be used to create pop-up boxes that require a yes/no response from player
|
* Can be used to create pop-up boxes that require a yes/no response from player
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user