mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-10 01:33:54 +01:00
Merge branch 'dev' into eslint
This commit is contained in:
commit
f372f1e693
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 is a cyberpunk hacking-themed incremental game. The game can be
|
||||
played [here](https://danielyxie.github.io/bitburner).
|
||||
Bitburner is a cyberpunk hacking-themed incremental game. The game can be
|
||||
played at https://danielyxie.github.io/bitburner.
|
||||
|
||||
# Documentation
|
||||
The game's official documentation can be found [here](http://bitburner.readthedocs.io/en/latest/index.html). Please note that
|
||||
this is still a work-in-progress and is in its early stages.
|
||||
The game's official documentation can be found on [Read The
|
||||
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
|
||||
in /doc/ and then making a pull request with your changes/contributions.
|
||||
Anyone is welcome to contribute to the documentation by editing the [source
|
||||
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
|
||||
The game's wiki can be found [here](http://bitburner.wikia.com/wiki/Bitburner_Wiki).
|
||||
Please note that the wiki is in the process of being deprecated. Eventually all of the
|
||||
wiki content will be moved into the Read The Docs documentation.
|
||||
The game's wiki can be found on [Wikia](http://bitburner.wikia.com/). Please
|
||||
note that the wiki is in the process of being deprecated. Eventually all of
|
||||
the wiki content will be moved into the Read The Docs documentation.
|
||||
|
||||
# Contributing
|
||||
If you would like to make any small change or addition to the game, you may go ahead
|
||||
and do so by submitting a pull request.
|
||||
# Contribution
|
||||
There are many ways to contribute to the game. It can be as simple as fixing
|
||||
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,
|
||||
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,
|
||||
transferable, royalty-free, and irrevocable rights to use, publish, and distribute
|
||||
your contributions to the project. A formal Contributor's License Agreement
|
||||
will be drawn up in the future.
|
||||
submitting a pull request you agree to grant me perpetual, worldwide,
|
||||
non-exclusive, transferable, royalty-free, and irrevocable rights to use,
|
||||
publish, and distribute your contributions to the project. A formal
|
||||
Contributor's License Agreement will be drawn up in the future.
|
||||
|
||||
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
|
||||
=========
|
||||
|
||||
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
|
||||
-------------------
|
||||
* 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>
|
||||
Trade Information eXchange (TIX) API <netscriptixapi>
|
||||
Singularity Functions <netscriptsingularityfunctions>
|
||||
Bladeburner API <netscriptbladeburnerapi>
|
||||
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
|
||||
---------------------------
|
||||
|
||||
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 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">
|
||||
<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">
|
||||
<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">
|
||||
@ -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="shortcuts.html"> Keyboard Shortcuts</a></li>
|
||||
<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-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>
|
||||
|
54
doc/build/html/genindex.html
vendored
54
doc/build/html/genindex.html
vendored
@ -153,21 +153,39 @@
|
||||
<h2 id="G">G</h2>
|
||||
<table style="width: 100%" class="indextable genindextable"><tr>
|
||||
<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>
|
||||
<li><a href="netscriptsingularityfunctions.html#getAugmentationsFromFaction">getAugmentationsFromFaction() (built-in function)</a>
|
||||
</li>
|
||||
<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><a href="netscriptsingularityfunctions.html#getCompanyFavor">getCompanyFavor() (built-in function)</a>
|
||||
</li>
|
||||
<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><a href="netscriptsingularityfunctions.html#getCrimeChance">getCrimeChance() (built-in function)</a>
|
||||
</li>
|
||||
<li><a href="netscriptsingularityfunctions.html#getFactionFavor">getFactionFavor() (built-in function)</a>
|
||||
</li>
|
||||
<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><a href="netscriptfunctions.html#getGrowTime">getGrowTime() (built-in function)</a>
|
||||
</li>
|
||||
@ -182,17 +200,21 @@
|
||||
<li><a href="netscriptfunctions.html#getHostname">getHostname() (built-in function)</a>
|
||||
</li>
|
||||
<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><a href="netscriptsingularityfunctions.html#getOwnedAugmentations">getOwnedAugmentations() (built-in function)</a>
|
||||
</li>
|
||||
<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><a href="netscriptfunctions.html#getScriptExpGain">getScriptExpGain() (built-in function)</a>
|
||||
</li>
|
||||
<li><a href="netscriptfunctions.html#getScriptIncome">getScriptIncome() (built-in function)</a>
|
||||
</li>
|
||||
</ul></td>
|
||||
<td style="width: 33%; vertical-align: top;"><ul>
|
||||
<li><a href="netscriptfunctions.html#getScriptName">getScriptName() (built-in function)</a>
|
||||
</li>
|
||||
<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>
|
||||
<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><a href="netscriptsingularityfunctions.html#getStats">getStats() (built-in function)</a>
|
||||
</li>
|
||||
<li><a href="netscriptixapi.html#getStockPosition">getStockPosition() (built-in function)</a>
|
||||
</li>
|
||||
<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><a href="netscriptfunctions.html#getTimeSinceLastAug">getTimeSinceLastAug() (built-in function)</a>
|
||||
</li>
|
||||
@ -278,6 +310,10 @@
|
||||
|
||||
<h2 id="J">J</h2>
|
||||
<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>
|
||||
<li><a href="netscriptsingularityfunctions.html#joinFaction">joinFaction() (built-in function)</a>
|
||||
</li>
|
||||
@ -375,10 +411,12 @@
|
||||
</li>
|
||||
<li><a href="netscriptixapi.html#sellStock">sellStock() (built-in function)</a>
|
||||
</li>
|
||||
</ul></td>
|
||||
<td style="width: 33%; vertical-align: top;"><ul>
|
||||
<li><a href="netscriptfunctions.html#serverExists">serverExists() (built-in function)</a>
|
||||
</li>
|
||||
<li><a href="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>
|
||||
<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>
|
||||
<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><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>
|
||||
</ul></td>
|
||||
</tr></table>
|
||||
@ -414,6 +458,8 @@
|
||||
</ul></td>
|
||||
<td style="width: 33%; vertical-align: top;"><ul>
|
||||
<li><a href="netscriptsingularityfunctions.html#upgradeHomeRam">upgradeHomeRam() (built-in function)</a>
|
||||
</li>
|
||||
<li><a href="netscriptbladeburnerapi.html#upgradeSkill">upgradeSkill() (built-in function)</a>
|
||||
</li>
|
||||
</ul></td>
|
||||
</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>
|
||||
</ul>
|
||||
</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-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>
|
||||
@ -269,6 +296,8 @@ secrets that you've been searching for.</p>
|
||||
</ul>
|
||||
</li>
|
||||
<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-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>
|
||||
|
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>
|
||||
</ul>
|
||||
</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-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>
|
||||
@ -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="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="netscriptbladeburnerapi.html"> Bladeburner API</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="netscriptmisc.html"> Miscellaneous</a></li>
|
||||
</ul>
|
||||
</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">
|
||||
<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>
|
||||
<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>
|
||||
@ -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="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="netscriptbladeburnerapi.html"> Bladeburner API</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="netscriptmisc.html"> Miscellaneous</a></li>
|
||||
</ul>
|
||||
</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
|
||||
=========
|
||||
|
||||
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
|
||||
@ -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: Sever's security level should now properly increase when its money is grown to max value
|
||||
|
||||
|
||||
v0.38.0 - 6/12/2018
|
||||
-------------------
|
||||
* 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>
|
||||
Trade Information eXchange (TIX) API <netscriptixapi>
|
||||
Singularity Functions <netscriptsingularityfunctions>
|
||||
Bladeburner API <netscriptbladeburnerapi>
|
||||
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
|
||||
---------------------------
|
||||
|
||||
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 code here...
|
||||
|
11
index.html
11
index.html
@ -886,6 +886,17 @@
|
||||
<input type="checkbox" name="settingsSuppressTravelConfirmation" id="settingsSuppressTravelConfirmation">
|
||||
</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 -->
|
||||
<fieldset>
|
||||
<label for="settingsDisableHotkeys" class="tooltip">Disable Hotkeys:
|
||||
|
11
netscript.js
11
netscript.js
@ -86,7 +86,16 @@ let NetscriptFunctions =
|
||||
"installAugmentations|hacknetnodes|upgradeLevel|upgradeRam|upgradeCore|" +
|
||||
"getLevelUpgradeCost|getRamUpgradeCost|getCoreUpgradeCost|" +
|
||||
"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 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",
|
||||
"source-map": "^0.7.3",
|
||||
"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",
|
||||
"tslint": "^5.10.0",
|
||||
"typescript": "^2.9.2",
|
||||
@ -84,11 +87,11 @@
|
||||
"url": "git+https://github.com/danielyxie/bitburner.git"
|
||||
},
|
||||
"scripts": {
|
||||
"lint:js": "eslint *.js src utils tests",
|
||||
"start:dev": "webpack-dev-server",
|
||||
"build": "webpack --mode production",
|
||||
"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",
|
||||
"watch": "webpack --watch --mode production",
|
||||
"watch:dev": "webpack --watch --mode development"
|
||||
|
@ -1,16 +1,16 @@
|
||||
import {Engine} from "./engine.js";
|
||||
import {Engine} from "./engine";
|
||||
import {workerScripts,
|
||||
addWorkerScript,
|
||||
killWorkerScript} from "./NetscriptWorker.js";
|
||||
import {Player} from "./Player.js";
|
||||
import {getServer} from "./Server.js";
|
||||
import {dialogBoxCreate} from "../utils/DialogBox.js";
|
||||
killWorkerScript} from "./NetscriptWorker";
|
||||
import {Player} from "./Player";
|
||||
import {getServer} from "./Server";
|
||||
import {dialogBoxCreate} from "../utils/DialogBox";
|
||||
import {printArray, createElement,
|
||||
createAccordionElement, removeElement,
|
||||
removeChildrenFromElement, exceptionAlert} from "../utils/HelperFunctions.js";
|
||||
import {logBoxCreate} from "../utils/LogBox.js";
|
||||
removeChildrenFromElement, exceptionAlert} from "../utils/HelperFunctions";
|
||||
import {logBoxCreate} from "../utils/LogBox";
|
||||
import numeral from "numeral/min/numeral.min";
|
||||
import {formatNumber} from "../utils/StringHelperFunctions.js";
|
||||
import {formatNumber} from "../utils/StringHelperFunctions";
|
||||
|
||||
/* {
|
||||
* serverName: {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {post} from "./Terminal.js";
|
||||
import {post} from "./Terminal";
|
||||
|
||||
let Aliases = {};
|
||||
let GlobalAliases = {};
|
||||
|
@ -1,22 +1,22 @@
|
||||
import {BitNodeMultipliers} from "./BitNode.js";
|
||||
import {CONSTANTS} from "./Constants.js";
|
||||
import {Engine} from "./engine.js";
|
||||
import {BitNodeMultipliers} from "./BitNode";
|
||||
import {CONSTANTS} from "./Constants";
|
||||
import {Engine} from "./engine";
|
||||
import {Factions, getNextNeurofluxLevel,
|
||||
factionExists} from "./Faction.js";
|
||||
import {hasBladeburnerSF} from "./NetscriptFunctions.js";
|
||||
import {addWorkerScript} from "./NetscriptWorker.js";
|
||||
import {Player} from "./Player.js";
|
||||
import {prestigeAugmentation} from "./Prestige.js";
|
||||
import {saveObject} from "./SaveObject.js";
|
||||
import {Script, RunningScript} from "./Script.js";
|
||||
import {Server} from "./Server.js";
|
||||
import {SourceFiles} from "./SourceFile.js";
|
||||
import {dialogBoxCreate} from "../utils/DialogBox.js";
|
||||
factionExists} from "./Faction";
|
||||
import {hasBladeburnerSF} from "./NetscriptFunctions";
|
||||
import {addWorkerScript} from "./NetscriptWorker";
|
||||
import {Player} from "./Player";
|
||||
import {prestigeAugmentation} from "./Prestige";
|
||||
import {saveObject} from "./SaveObject";
|
||||
import {Script, RunningScript} from "./Script";
|
||||
import {Server} from "./Server";
|
||||
import {SourceFiles} from "./SourceFile";
|
||||
import {dialogBoxCreate} from "../utils/DialogBox";
|
||||
import {createElement, createAccordionElement,
|
||||
removeChildrenFromElement, clearObject} from "../utils/HelperFunctions.js";
|
||||
removeChildrenFromElement, clearObject} from "../utils/HelperFunctions";
|
||||
import {Reviver, Generic_toJSON,
|
||||
Generic_fromJSON} from "../utils/JSONReviver.js";
|
||||
import {isString} from "../utils/StringHelperFunctions.js";
|
||||
Generic_fromJSON} from "../utils/JSONReviver";
|
||||
import {isString} from "../utils/StringHelperFunctions";
|
||||
|
||||
//Augmentations
|
||||
function Augmentation(params) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {Player} from "./Player.js";
|
||||
import {Player} from "./Player";
|
||||
|
||||
function BitNode(n, name, desc="", info="") {
|
||||
this.number = n;
|
||||
@ -132,7 +132,7 @@ function initBitNodes() {
|
||||
"Corporations have 80% lower valuations and are therefore less profitable<br>" +
|
||||
"Working for companies is 50% less profitable<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 " +
|
||||
"BitNodes. In addition, this Source-File will increase all of your Bladeburner multipliers by:<br><br>" +
|
||||
"Level 1: 8%<br>" +
|
||||
|
@ -1,24 +1,24 @@
|
||||
import {Augmentations, AugmentationNames} from "./Augmentations.js";
|
||||
import {BitNodeMultipliers} from "./BitNode.js";
|
||||
import {CONSTANTS} from "./Constants.js";
|
||||
import {Engine} from "./engine.js";
|
||||
import {Augmentations, AugmentationNames} from "./Augmentations";
|
||||
import {BitNodeMultipliers} from "./BitNode";
|
||||
import {CONSTANTS} from "./Constants";
|
||||
import {Engine} from "./engine";
|
||||
import {Faction, Factions, factionExists,
|
||||
joinFaction, displayFactionContent} from "./Faction.js";
|
||||
import {Locations} from "./Location.js";
|
||||
import {Player} from "./Player.js";
|
||||
import {hackWorldDaemon, redPillFlag} from "./RedPill.js";
|
||||
import {KEY} from "./Terminal.js";
|
||||
joinFaction, displayFactionContent} from "./Faction";
|
||||
import {Locations} from "./Location";
|
||||
import {Player} from "./Player";
|
||||
import {hackWorldDaemon, redPillFlag} from "./RedPill";
|
||||
import {KEY} from "./Terminal";
|
||||
|
||||
import {dialogBoxCreate} from "../utils/DialogBox.js";
|
||||
import {dialogBoxCreate} from "../utils/DialogBox";
|
||||
import {getRandomInt, addOffset, clearObject,
|
||||
createElement, removeChildrenFromElement,
|
||||
exceptionAlert, createPopup, appendLineBreaks,
|
||||
removeElementById, removeElement,
|
||||
createProgressBarText} from "../utils/HelperFunctions.js";
|
||||
createProgressBarText} from "../utils/HelperFunctions";
|
||||
import {Reviver, Generic_toJSON,
|
||||
Generic_fromJSON} from "../utils/JSONReviver.js";
|
||||
Generic_fromJSON} from "../utils/JSONReviver";
|
||||
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"];
|
||||
@ -3208,6 +3208,7 @@ Bladeburner.prototype.getActionIdFromTypeAndName = function(type="", name="") {
|
||||
switch (convertedType) {
|
||||
case "contract":
|
||||
case "contracts":
|
||||
case "contr":
|
||||
action.type = ActionTypes["Contract"];
|
||||
if (this.contracts.hasOwnProperty(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);
|
||||
}
|
||||
|
||||
Bladeburner.prototype.getOperationNamesNetscriptFn = function(name) {
|
||||
Bladeburner.prototype.getOperationNamesNetscriptFn = function() {
|
||||
return Object.keys(this.operations);
|
||||
}
|
||||
|
||||
Bladeburner.prototype.getBlackOpNamesNetscriptFn = function(name) {
|
||||
Bladeburner.prototype.getBlackOpNamesNetscriptFn = function() {
|
||||
return Object.keys(BlackOperations);
|
||||
}
|
||||
|
||||
Bladeburner.prototype.getGeneralActionNamesNetscriptFn = function(name) {
|
||||
Bladeburner.prototype.getGeneralActionNamesNetscriptFn = function() {
|
||||
return Object.keys(GeneralActions);
|
||||
}
|
||||
|
||||
Bladeburner.prototype.getSkillNamesNetscriptFn = function(name) {
|
||||
return Skills.hasOwnProperty(name);
|
||||
Bladeburner.prototype.getSkillNamesNetscriptFn = function() {
|
||||
return Object.keys(Skills);
|
||||
}
|
||||
|
||||
@ -3428,7 +3428,11 @@ Bladeburner.prototype.getSkillLevelNetscriptFn = function(skillName, workerScrip
|
||||
return -1;
|
||||
}
|
||||
|
||||
return Skills[skillName];
|
||||
if (this.skills[skillName] == null) {
|
||||
return 0;
|
||||
} else {
|
||||
return this.skills[skillName];
|
||||
}
|
||||
}
|
||||
|
||||
Bladeburner.prototype.upgradeSkillNetscriptFn = function(skillName, workerScript) {
|
||||
@ -3506,8 +3510,8 @@ Bladeburner.prototype.setTeamSizeNetscriptFn = function(type, name, size, worker
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (actionId.type !== ActionTypes["Operation"] ||
|
||||
actionId.type !== ActionTypes["BlackOp"] ||
|
||||
if (actionId.type !== ActionTypes["Operation"] &&
|
||||
actionId.type !== ActionTypes["BlackOp"] &&
|
||||
actionId.type !== ActionTypes["BlackOperation"]) {
|
||||
workerScript.log("ERROR: Bladeburner.setTeamSize() failed. This function " +
|
||||
"only works for Operations and BlackOps");
|
||||
|
@ -1,8 +1,8 @@
|
||||
import {Engine} from "./engine.js";
|
||||
import {Engine} from "./engine";
|
||||
|
||||
import {removeChildrenFromElement,
|
||||
createElement, exceptionAlert} from "../utils/HelperFunctions.js";
|
||||
import {isString} from "../utils/StringHelperFunctions.js";
|
||||
createElement, exceptionAlert} from "../utils/HelperFunctions";
|
||||
import {isString} from "../utils/StringHelperFunctions";
|
||||
|
||||
var cinematicTextFlag = false;
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
import {CONSTANTS} from "./Constants.js";
|
||||
import {Locations} from "./Location.js";
|
||||
import {Player} from "./Player.js";
|
||||
import {CONSTANTS} from "./Constants";
|
||||
import {Locations} from "./Location";
|
||||
import {Player} from "./Player";
|
||||
|
||||
import {Reviver, Generic_toJSON,
|
||||
Generic_fromJSON} from "../utils/JSONReviver.js";
|
||||
Generic_fromJSON} from "../utils/JSONReviver";
|
||||
|
||||
//Netburner Company class
|
||||
// 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 {Engine} from "./engine.js";
|
||||
import {Factions} from "./Faction.js";
|
||||
import {showLiterature} from "./Literature.js";
|
||||
import {Locations} from "./Location.js";
|
||||
import {Player} from "./Player.js";
|
||||
import {BitNodeMultipliers} from "./BitNode";
|
||||
import {Engine} from "./engine";
|
||||
import {Factions} from "./Faction";
|
||||
import {showLiterature} from "./Literature";
|
||||
import {Locations} from "./Location";
|
||||
import {Player} from "./Player";
|
||||
|
||||
import Decimal from "decimal.js";
|
||||
import {dialogBoxCreate} from "../utils/DialogBox.js";
|
||||
import {dialogBoxCreate} from "../utils/DialogBox";
|
||||
import {getRandomInt, removeElementById,
|
||||
createElement, createAccordionElement,
|
||||
removeChildrenFromElement, createPopup,
|
||||
clearSelector} from "../utils/HelperFunctions.js";
|
||||
clearSelector} from "../utils/HelperFunctions";
|
||||
import {Reviver, Generic_toJSON,
|
||||
Generic_fromJSON} from "../utils/JSONReviver.js";
|
||||
Generic_fromJSON} from "../utils/JSONReviver";
|
||||
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,
|
||||
yesNoBoxGetYesButton, yesNoBoxGetNoButton,
|
||||
yesNoTxtInpBoxGetYesButton, yesNoTxtInpBoxGetNoButton,
|
||||
yesNoTxtInpBoxGetInput, yesNoBoxClose,
|
||||
yesNoTxtInpBoxClose, yesNoBoxOpen} from "../utils/YesNoBox.js";
|
||||
yesNoTxtInpBoxClose, yesNoBoxOpen} from "../utils/YesNoBox";
|
||||
|
||||
/* State */
|
||||
var companyStates = ["START", "PURCHASE", "PRODUCTION", "SALE", "EXPORT"];
|
||||
|
@ -1,5 +1,5 @@
|
||||
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
|
||||
//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,
|
||||
|
||||
//Infiltration constants
|
||||
InfiltrationBribeBaseAmount: 100000, //Amount per clearance level
|
||||
InfiltrationMoneyValue: 2500, //Convert "secret" value to money
|
||||
InfiltrationBribeBaseAmount: 100e3, //Amount per clearance level
|
||||
InfiltrationMoneyValue: 3e3, //Convert "secret" value to money
|
||||
InfiltrationRepValue: 1.4, //Convert "secret" value to faction reputation
|
||||
|
||||
//Stock market constants
|
||||
@ -489,15 +489,8 @@ let CONSTANTS = {
|
||||
"World Stock Exchange account and TIX API Access<br>",
|
||||
|
||||
LatestUpdate:
|
||||
"v0.38.1<br>" +
|
||||
"* Added 'var' declarations in Netscript 1.0 (only works with 'var', not 'let' or 'const')<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)"
|
||||
"v0.39.1<br>" +
|
||||
"* The setting to suppress the confirmation box when purchasing Augmentations was moved into the main Options menu (by Github user hydroflame)<br>"
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,139 +1,128 @@
|
||||
import {CONSTANTS} from "./Constants.js";
|
||||
import {Player} from "./Player.js";
|
||||
import {createElement} from "../utils/HelperFunctions.js";
|
||||
import {CONSTANTS} from "./Constants";
|
||||
import {Player} from "./Player";
|
||||
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 */
|
||||
let Programs = {
|
||||
NukeProgram: "NUKE.exe",
|
||||
BruteSSHProgram: "BruteSSH.exe",
|
||||
FTPCrackProgram: "FTPCrack.exe",
|
||||
RelaySMTPProgram: "relaySMTP.exe",
|
||||
HTTPWormProgram: "HTTPWorm.exe",
|
||||
SQLInjectProgram: "SQLInject.exe",
|
||||
DeepscanV1: "DeepscanV1.exe",
|
||||
DeepscanV2: "DeepscanV2.exe",
|
||||
ServerProfiler: "ServerProfiler.exe",
|
||||
AutoLink: "AutoLink.exe",
|
||||
Flight: "fl1ght.exe",
|
||||
BitFlume: "b1t_flum3.exe"
|
||||
const Programs = {
|
||||
NukeProgram: new Program("NUKE.exe", {
|
||||
level: 1,
|
||||
tooltip:"This virus is used to gain root access to a machine if enough ports are opened.",
|
||||
req: requireLevel(1),
|
||||
time: CONSTANTS.MillisecondsPerFiveMinutes,
|
||||
}),
|
||||
BruteSSHProgram: new Program("BruteSSH.exe", {
|
||||
level: 50,
|
||||
tooltip:"This program executes a brute force attack that opens SSH ports",
|
||||
req: requireLevel(50),
|
||||
time: CONSTANTS.MillisecondsPerFiveMinutes * 2,
|
||||
}),
|
||||
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,
|
||||
deepscanv1ALink, deepscanv2ALink, servProfilerALink, autolinkALink, bitFlumeALink;
|
||||
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";
|
||||
// this has the same key as 'Programs', not program names
|
||||
const aLinks = {};
|
||||
|
||||
//NUKE.exe (in case you delete it lol)
|
||||
if (Player.getHomeComputer().programs.indexOf(Programs.NukeProgram) == -1) {
|
||||
nukeALink.style.display = "inline-block";
|
||||
}
|
||||
//BruteSSH
|
||||
if (Player.getHomeComputer().programs.indexOf(Programs.BruteSSHProgram) == -1 &&
|
||||
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";
|
||||
function displayCreateProgramContent() {
|
||||
for(const key in aLinks) {
|
||||
const p = Programs[key]
|
||||
aLinks[key].style.display = "none";
|
||||
if(!Player.hasProgram(p.name) && p.create.req()){
|
||||
aLinks[key].style.display = "inline-block";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Returns the number of programs that are currently available to be created
|
||||
function getNumAvailableCreateProgram() {
|
||||
var count = 0;
|
||||
//PortHack.exe (in case you delete it lol)
|
||||
if (Player.getHomeComputer().programs.indexOf(Programs.NukeProgram) == -1) {
|
||||
++count;
|
||||
}
|
||||
//BruteSSH
|
||||
if (Player.getHomeComputer().programs.indexOf(Programs.BruteSSHProgram) == -1 &&
|
||||
Player.hacking_skill >= 50) {
|
||||
++count;
|
||||
}
|
||||
//FTPCrack
|
||||
if (Player.getHomeComputer().programs.indexOf(Programs.FTPCrackProgram) == -1 &&
|
||||
Player.hacking_skill >= 100) {
|
||||
++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;
|
||||
for(const key in Programs) {
|
||||
if(Programs[key].create === undefined) { // a program we can't create
|
||||
continue
|
||||
}
|
||||
if(Player.hasProgram(Programs[key].name)) { // can't create it twice
|
||||
continue
|
||||
}
|
||||
|
||||
if(!Programs[key].create.req()) { // if you don't fullfill the creation requirement
|
||||
continue
|
||||
}
|
||||
|
||||
count++;
|
||||
}
|
||||
|
||||
if (Player.firstProgramAvailable === false && count > 0) {
|
||||
Player.firstProgramAvailable = true;
|
||||
document.getElementById("create-program-tab").style.display = "list-item";
|
||||
@ -145,116 +134,25 @@ function getNumAvailableCreateProgram() {
|
||||
|
||||
function initCreateProgramButtons() {
|
||||
var createProgramList = document.getElementById("create-program-list");
|
||||
nukeALink = createElement("a", {
|
||||
class:"a-link-button", id:"create-program-nuke", innerText:Programs.NukeProgram,
|
||||
tooltip:"This virus is used to gain root access to a machine if enough ports are opened.",
|
||||
});
|
||||
createProgramList.appendChild(nukeALink);
|
||||
for(const key in Programs) {
|
||||
if(Programs[key].create === undefined) {
|
||||
continue
|
||||
}
|
||||
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", {
|
||||
class:"a-link-button", id:"create-program-brutessh", innerText:Programs.BruteSSHProgram,
|
||||
tooltip:"This program executes a brute force attack that opens SSH ports"
|
||||
});
|
||||
createProgramList.appendChild(bruteSshALink);
|
||||
|
||||
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;
|
||||
});
|
||||
for(const key in aLinks) {
|
||||
const p = Programs[key]
|
||||
aLinks[key].addEventListener("click", function() {
|
||||
Player.startCreateProgramWork(p.name, p.create.time, p.create.level);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export {Programs, displayCreateProgramContent, getNumAvailableCreateProgram,
|
||||
|
@ -1,6 +1,6 @@
|
||||
import {CONSTANTS} from "./Constants.js";
|
||||
import {Player} from "./Player.js";
|
||||
import {dialogBoxCreate} from "../utils/DialogBox.js";
|
||||
import {CONSTANTS} from "./Constants";
|
||||
import {Player} from "./Player";
|
||||
import {dialogBoxCreate} from "../utils/DialogBox";
|
||||
|
||||
|
||||
function Crime(name, type, time, money, difficulty, karma, params) {
|
||||
|
@ -1,10 +1,10 @@
|
||||
import {Programs} from "./CreateProgram.js";
|
||||
import {Player} from "./Player.js";
|
||||
import {SpecialServerIps} from "./SpecialServerIps.js";
|
||||
import {post} from "./Terminal.js";
|
||||
import {Programs} from "./CreateProgram";
|
||||
import {Player} from "./Player";
|
||||
import {SpecialServerIps} from "./SpecialServerIps";
|
||||
import {post} from "./Terminal";
|
||||
|
||||
import {isValidIPAddress} from "../utils/IPAddress.js";
|
||||
import {formatNumber} from "../utils/StringHelperFunctions.js";
|
||||
import {isValidIPAddress} from "../utils/IPAddress";
|
||||
import {formatNumber} from "../utils/StringHelperFunctions";
|
||||
|
||||
|
||||
/* DarkWeb.js */
|
||||
@ -102,14 +102,14 @@ DarkWebItem.prototype.toString = function() {
|
||||
}
|
||||
|
||||
const DarkWebItems = {
|
||||
BruteSSHProgram: new DarkWebItem(Programs.BruteSSHProgram, 500000, "Opens up SSH Ports"),
|
||||
FTPCrackProgram: new DarkWebItem(Programs.FTPCrackProgram, 1500000, "Opens up FTP Ports"),
|
||||
RelaySMTPProgram: new DarkWebItem(Programs.RelaySMTPProgram, 5000000, "Opens up SMTP Ports"),
|
||||
HTTPWormProgram: new DarkWebItem(Programs.HTTPWormProgram, 30000000, "Opens up HTTP Ports"),
|
||||
SQLInjectProgram: new DarkWebItem(Programs.SQLInjectProgram, 250000000, "Opens up SQL Ports"),
|
||||
DeepscanV1: new DarkWebItem(Programs.DeepscanV1, 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"),
|
||||
AutolinkProgram: new DarkWebItem(Programs.AutoLink, 1000000, "Enables direct connect via 'scan-analyze'"),
|
||||
BruteSSHProgram: new DarkWebItem(Programs.BruteSSHProgram.name, 500000, "Opens up SSH Ports"),
|
||||
FTPCrackProgram: new DarkWebItem(Programs.FTPCrackProgram.name, 1500000, "Opens up FTP Ports"),
|
||||
RelaySMTPProgram: new DarkWebItem(Programs.RelaySMTPProgram.name, 5000000, "Opens up SMTP Ports"),
|
||||
HTTPWormProgram: new DarkWebItem(Programs.HTTPWormProgram.name, 30000000, "Opens up HTTP Ports"),
|
||||
SQLInjectProgram: new DarkWebItem(Programs.SQLInjectProgram.name, 250000000, "Opens up SQL Ports"),
|
||||
DeepscanV1: new DarkWebItem(Programs.DeepscanV1.name, 500000, "Enables 'scan-analyze' with a depth up to 5"),
|
||||
DeepscanV2: new DarkWebItem(Programs.DeepscanV2.name, 25000000, "Enables 'scan-analyze' with a depth up to 10"),
|
||||
AutolinkProgram: new DarkWebItem(Programs.AutoLink.name, 1000000, "Enables direct connect via 'scan-analyze'"),
|
||||
};
|
||||
|
||||
|
||||
|
@ -1,24 +1,24 @@
|
||||
import {Augmentations, AugmentationNames,
|
||||
PlayerOwnedAugmentation} from "./Augmentations.js";
|
||||
import {BitNodeMultipliers} from "./BitNode.js";
|
||||
import {CONSTANTS} from "./Constants.js";
|
||||
import {Engine} from "./engine.js";
|
||||
import {FactionInfos} from "./FactionInfo.js";
|
||||
import {Locations} from "./Location.js";
|
||||
import {HackingMission, setInMission} from "./Missions.js";
|
||||
import {Player} from "./Player.js";
|
||||
import {Settings} from "./Settings.js";
|
||||
PlayerOwnedAugmentation} from "./Augmentations";
|
||||
import {BitNodeMultipliers} from "./BitNode";
|
||||
import {CONSTANTS} from "./Constants";
|
||||
import {Engine} from "./engine";
|
||||
import {FactionInfos} from "./FactionInfo";
|
||||
import {Locations} from "./Location";
|
||||
import {HackingMission, setInMission} from "./Missions";
|
||||
import {Player} from "./Player";
|
||||
import {Settings} from "./Settings";
|
||||
|
||||
import {dialogBoxCreate} from "../utils/DialogBox.js";
|
||||
import {factionInvitationBoxCreate} from "../utils/FactionInvitationBox.js";
|
||||
import {dialogBoxCreate} from "../utils/DialogBox";
|
||||
import {factionInvitationBoxCreate} from "../utils/FactionInvitationBox";
|
||||
import {clearEventListeners, createElement,
|
||||
removeChildrenFromElement} from "../utils/HelperFunctions.js";
|
||||
removeChildrenFromElement} from "../utils/HelperFunctions";
|
||||
import {Reviver, Generic_toJSON,
|
||||
Generic_fromJSON} from "../utils/JSONReviver.js";
|
||||
Generic_fromJSON} from "../utils/JSONReviver";
|
||||
import numeral from "numeral/min/numeral.min";
|
||||
import {formatNumber} from "../utils/StringHelperFunctions.js";
|
||||
import {formatNumber} from "../utils/StringHelperFunctions";
|
||||
import {yesNoBoxCreate, yesNoBoxGetYesButton,
|
||||
yesNoBoxGetNoButton, yesNoBoxClose} from "../utils/YesNoBox.js";
|
||||
yesNoBoxGetNoButton, yesNoBoxClose} from "../utils/YesNoBox";
|
||||
|
||||
function Faction(name="") {
|
||||
this.name = name;
|
||||
@ -439,7 +439,6 @@ function displayFactionContent(factionName) {
|
||||
}
|
||||
}
|
||||
|
||||
var confirmingPurchases = true;
|
||||
var sortOption = null;
|
||||
function displayFactionAugmentations(factionName) {
|
||||
var faction = Factions[factionName];
|
||||
@ -468,19 +467,6 @@ function displayFactionAugmentations(factionName) {
|
||||
"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"));
|
||||
|
||||
@ -585,7 +571,8 @@ function createFactionAugmentationDisplayElements(augmentationsList, augs, facti
|
||||
var aElem = createElement("a", {
|
||||
innerText:aug.name, display:"inline",
|
||||
clickListener:()=>{
|
||||
if (confirmingPurchases) {
|
||||
console.log('sup buy in fac: '+Settings.SuppressBuyAugmentationConfirmation);
|
||||
if (!Settings.SuppressBuyAugmentationConfirmation) {
|
||||
purchaseAugmentationBoxCreate(aug, faction);
|
||||
} else {
|
||||
purchaseAugmentation(aug, faction);
|
||||
@ -723,10 +710,12 @@ function purchaseAugmentation(aug, fac, sing=false) {
|
||||
if (sing) {
|
||||
return "You purchased " + aug.name;
|
||||
} else {
|
||||
dialogBoxCreate("You purchased " + aug.name + ". It's enhancements will not take " +
|
||||
"effect until they are installed. To install your augmentations, go to the " +
|
||||
"'Augmentations' tab on the left-hand navigation menu. Purchasing additional " +
|
||||
"augmentations will now be more expensive.");
|
||||
if(!Settings.SuppressBuyAugmentationConfirmation){
|
||||
dialogBoxCreate("You purchased " + aug.name + ". It's enhancements will not take " +
|
||||
"effect until they are installed. To install your augmentations, go to the " +
|
||||
"'Augmentations' tab on the left-hand navigation menu. Purchasing additional " +
|
||||
"augmentations will now be more expensive.");
|
||||
}
|
||||
}
|
||||
|
||||
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 = {
|
||||
ENABLE_BASH_HOTKEYS: false,
|
||||
|
18
src/Gang.js
18
src/Gang.js
@ -1,22 +1,22 @@
|
||||
import {CONSTANTS} from "./Constants.js";
|
||||
import {Engine} from "./engine.js";
|
||||
import {CONSTANTS} from "./Constants";
|
||||
import {Engine} from "./engine";
|
||||
import {Faction, Factions,
|
||||
displayFactionContent} from "./Faction.js";
|
||||
import {Player} from "./Player.js";
|
||||
import {dialogBoxCreate} from "../utils/DialogBox.js";
|
||||
displayFactionContent} from "./Faction";
|
||||
import {Player} from "./Player";
|
||||
import {dialogBoxCreate} from "../utils/DialogBox";
|
||||
import {Reviver, Generic_toJSON,
|
||||
Generic_fromJSON} from "../utils/JSONReviver.js";
|
||||
Generic_fromJSON} from "../utils/JSONReviver";
|
||||
import {getRandomInt, createElement,
|
||||
removeChildrenFromElement,
|
||||
createAccordionElement, createPopup,
|
||||
removeElementById, removeElement} from "../utils/HelperFunctions.js";
|
||||
removeElementById, removeElement} from "../utils/HelperFunctions";
|
||||
import numeral from "numeral/min/numeral.min";
|
||||
import {formatNumber} from "../utils/StringHelperFunctions.js";
|
||||
import {formatNumber} from "../utils/StringHelperFunctions";
|
||||
import {yesNoBoxCreate, yesNoTxtInpBoxCreate,
|
||||
yesNoBoxGetYesButton, yesNoBoxGetNoButton,
|
||||
yesNoTxtInpBoxGetYesButton, yesNoTxtInpBoxGetNoButton,
|
||||
yesNoTxtInpBoxGetInput, yesNoBoxClose,
|
||||
yesNoTxtInpBoxClose, yesNoBoxOpen} from "../utils/YesNoBox.js";
|
||||
yesNoTxtInpBoxClose, yesNoBoxOpen} from "../utils/YesNoBox";
|
||||
|
||||
/* Gang.js */
|
||||
//Switch between territory and management screen with 1 and 2
|
||||
|
@ -1,15 +1,15 @@
|
||||
import {BitNodeMultipliers} from "./BitNode.js";
|
||||
import {CONSTANTS} from "./Constants.js";
|
||||
import {Engine} from "./engine.js";
|
||||
import {BitNodeMultipliers} from "./BitNode";
|
||||
import {CONSTANTS} from "./Constants";
|
||||
import {Engine} from "./engine";
|
||||
import {iTutorialSteps, iTutorialNextStep,
|
||||
iTutorialIsRunning, currITutorialStep} from "./InteractiveTutorial.js";
|
||||
import {Player} from "./Player.js";
|
||||
import {dialogBoxCreate} from "../utils/DialogBox.js";
|
||||
iTutorialIsRunning, currITutorialStep} from "./InteractiveTutorial";
|
||||
import {Player} from "./Player";
|
||||
import {dialogBoxCreate} from "../utils/DialogBox";
|
||||
import {clearEventListeners, createElement,
|
||||
getElementById} from "../utils/HelperFunctions.js";
|
||||
getElementById} from "../utils/HelperFunctions";
|
||||
import {Reviver, Generic_toJSON,
|
||||
Generic_fromJSON} from "../utils/JSONReviver.js";
|
||||
import {formatNumber} from "../utils/StringHelperFunctions.js";
|
||||
Generic_fromJSON} from "../utils/JSONReviver";
|
||||
import {formatNumber} from "../utils/StringHelperFunctions";
|
||||
|
||||
/**
|
||||
* 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 {CONSTANTS} from "./Constants.js";
|
||||
import {Engine} from "./engine.js";
|
||||
import {Player} from "./Player.js";
|
||||
import {dialogBoxCreate} from "../utils/DialogBox.js";
|
||||
import {clearEventListeners, getRandomInt} from "../utils/HelperFunctions.js";
|
||||
import {infiltrationBoxCreate} from "../utils/InfiltrationBox.js";
|
||||
import {formatNumber} from "../utils/StringHelperFunctions.js";
|
||||
import {BitNodeMultipliers} from "./BitNode";
|
||||
import {CONSTANTS} from "./Constants";
|
||||
import {Engine} from "./engine";
|
||||
import {Player} from "./Player";
|
||||
import {dialogBoxCreate} from "../utils/DialogBox";
|
||||
import {clearEventListeners, getRandomInt} from "../utils/HelperFunctions";
|
||||
import {infiltrationBoxCreate} from "../utils/InfiltrationBox";
|
||||
import {formatNumber} from "../utils/StringHelperFunctions";
|
||||
|
||||
/* Infiltration.js
|
||||
*
|
||||
@ -594,10 +594,10 @@ let intWgt = CONSTANTS.IntelligenceInfiltrationWeight;
|
||||
//Success: 5%, Failure 10%, -Karma
|
||||
function attemptInfiltrationKill(inst) {
|
||||
var chance = getInfiltrationKillChance(inst);
|
||||
inst.gainStrengthExp(inst.securityLevel / 85) * Player.strength_exp_mult;
|
||||
inst.gainDefenseExp(inst.securityLevel / 85) * Player.defense_exp_mult;
|
||||
inst.gainDexterityExp(inst.securityLevel / 85) * Player.dexterity_exp_mult;
|
||||
inst.gainAgilityExp(inst.securityLevel / 85) * Player.agility_exp_mult;
|
||||
inst.gainStrengthExp(inst.securityLevel / 75) * Player.strength_exp_mult;
|
||||
inst.gainDefenseExp(inst.securityLevel / 75) * Player.defense_exp_mult;
|
||||
inst.gainDexterityExp(inst.securityLevel / 75) * Player.dexterity_exp_mult;
|
||||
inst.gainAgilityExp(inst.securityLevel / 75) * Player.agility_exp_mult;
|
||||
if (Math.random() <= chance) {
|
||||
inst.securityLevel *= 1.05;
|
||||
return [true, 1.05];
|
||||
@ -620,10 +620,10 @@ function getInfiltrationKillChance(inst) {
|
||||
//Success: 3%, Failure: 10%
|
||||
function attemptInfiltrationKnockout(inst) {
|
||||
var chance = getInfiltrationKnockoutChance(inst);
|
||||
inst.gainStrengthExp(inst.securityLevel / 80) * Player.strength_exp_mult;
|
||||
inst.gainDefenseExp(inst.securityLevel / 80) * Player.defense_exp_mult;
|
||||
inst.gainDexterityExp(inst.securityLevel / 80) * Player.dexterity_exp_mult;
|
||||
inst.gainAgilityExp(inst.securityLevel / 80) * Player.agility_exp_mult;
|
||||
inst.gainStrengthExp(inst.securityLevel / 70) * Player.strength_exp_mult;
|
||||
inst.gainDefenseExp(inst.securityLevel / 70) * Player.defense_exp_mult;
|
||||
inst.gainDexterityExp(inst.securityLevel / 70) * Player.dexterity_exp_mult;
|
||||
inst.gainAgilityExp(inst.securityLevel / 70) * Player.agility_exp_mult;
|
||||
if (Math.random() <= chance) {
|
||||
inst.securityLevel *= 1.03;
|
||||
return [true, 1.03];
|
||||
@ -645,9 +645,9 @@ function getInfiltrationKnockoutChance(inst) {
|
||||
//Success: 0%, Failure: 10%
|
||||
function attemptInfiltrationStealthKnockout(inst) {
|
||||
var chance = getInfiltrationStealthKnockoutChance(inst);
|
||||
inst.gainStrengthExp(inst.securityLevel / 85) * Player.strength_exp_mult;
|
||||
inst.gainDexterityExp(inst.securityLevel / 65) * Player.dexterity_exp_mult;
|
||||
inst.gainAgilityExp(inst.securityLevel / 65) * Player.agility_exp_mult;
|
||||
inst.gainStrengthExp(inst.securityLevel / 75) * Player.strength_exp_mult;
|
||||
inst.gainDexterityExp(inst.securityLevel / 60) * Player.dexterity_exp_mult;
|
||||
inst.gainAgilityExp(inst.securityLevel / 60) * Player.agility_exp_mult;
|
||||
if (Math.random() <= chance) {
|
||||
return [true, 1];
|
||||
} else {
|
||||
@ -669,9 +669,9 @@ function getInfiltrationStealthKnockoutChance(inst) {
|
||||
//Success: 0%, Failure: 5%, -Karma
|
||||
function attemptInfiltrationAssassinate(inst) {
|
||||
var chance = getInfiltrationAssassinateChance(inst);
|
||||
inst.gainStrengthExp(inst.securityLevel / 85) * Player.strength_exp_mult;
|
||||
inst.gainDexterityExp(inst.securityLevel / 65) * Player.dexterity_exp_mult;
|
||||
inst.gainAgilityExp(inst.securityLevel / 65) * Player.agility_exp_mult;
|
||||
inst.gainStrengthExp(inst.securityLevel / 75) * Player.strength_exp_mult;
|
||||
inst.gainDexterityExp(inst.securityLevel / 55) * Player.dexterity_exp_mult;
|
||||
inst.gainAgilityExp(inst.securityLevel / 55) * Player.agility_exp_mult;
|
||||
if (Math.random() <= chance) {
|
||||
return [true, 1];
|
||||
} else {
|
||||
@ -693,10 +693,10 @@ function getInfiltrationAssassinateChance(inst) {
|
||||
//Success: 5%, Failure: 10%
|
||||
function attemptInfiltrationDestroySecurity(inst) {
|
||||
var chance = getInfiltrationDestroySecurityChance(inst);
|
||||
inst.gainStrengthExp(inst.securityLevel / 85) * Player.strength_exp_mult;
|
||||
inst.gainDefenseExp(inst.securityLevel / 85) * Player.defense_exp_mult;
|
||||
inst.gainDexterityExp(inst.securityLevel / 85) * Player.dexterity_exp_mult;
|
||||
inst.gainAgilityExp(inst.securityLevel / 85) * Player.agility_exp_mult;
|
||||
inst.gainStrengthExp(inst.securityLevel / 75) * Player.strength_exp_mult;
|
||||
inst.gainDefenseExp(inst.securityLevel / 75) * Player.defense_exp_mult;
|
||||
inst.gainDexterityExp(inst.securityLevel / 75) * Player.dexterity_exp_mult;
|
||||
inst.gainAgilityExp(inst.securityLevel / 75) * Player.agility_exp_mult;
|
||||
if (Math.random() <= chance) {
|
||||
inst.securityLevel *= 1.05;
|
||||
return [true, 1.05];
|
||||
@ -720,8 +720,8 @@ function getInfiltrationDestroySecurityChance(inst) {
|
||||
//Success: 3%, Failure: 5%
|
||||
function attemptInfiltrationHack(inst) {
|
||||
var chance = getInfiltrationHackChance(inst);
|
||||
inst.gainHackingExp(inst.securityLevel / 40) * Player.hacking_exp_mult;
|
||||
inst.gainIntelligenceExp(inst.securityLevel / 690);
|
||||
inst.gainHackingExp(inst.securityLevel / 30) * Player.hacking_exp_mult;
|
||||
inst.gainIntelligenceExp(inst.securityLevel / 680);
|
||||
if (Math.random() <= chance) {
|
||||
inst.securityLevel *= 1.03;
|
||||
return [true, 1.03];
|
||||
@ -743,7 +743,7 @@ function getInfiltrationHackChance(inst) {
|
||||
//Success: 0%, Failure: 8%
|
||||
function attemptInfiltrationSneak(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) {
|
||||
return [true, 1];
|
||||
} else {
|
||||
@ -764,7 +764,7 @@ function getInfiltrationSneakChance(inst) {
|
||||
//Success: 1%, Failure: 3%
|
||||
function attemptInfiltrationPickLockedDoor(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) {
|
||||
inst.securityLevel *= 1.01;
|
||||
return [true, 1.01];
|
||||
@ -785,7 +785,7 @@ function getInfiltrationPickLockedDoorChance(inst) {
|
||||
//Success: 0%, Failure: 15%,
|
||||
function attemptInfiltrationBribe(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) {
|
||||
return [true, 1];
|
||||
} else {
|
||||
@ -804,8 +804,8 @@ function getInfiltrationBribeChance(inst) {
|
||||
//Failure: 5%
|
||||
function attemptInfiltrationEscape(inst) {
|
||||
var chance = getInfiltrationEscapeChance(inst);
|
||||
inst.gainAgilityExp(inst.securityLevel / 35) * Player.agility_exp_mult;
|
||||
inst.gainDexterityExp(inst.securityLevel / 35) * Player.dexterity_exp_mult;
|
||||
inst.gainAgilityExp(inst.securityLevel / 30) * Player.agility_exp_mult;
|
||||
inst.gainDexterityExp(inst.securityLevel / 30) * Player.dexterity_exp_mult;
|
||||
if (Math.random() <= chance) {
|
||||
return [true, 1];
|
||||
} else {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import {Engine} from "./engine.js";
|
||||
import {Player} from "./Player.js";
|
||||
import {dialogBoxCreate} from "../utils/DialogBox.js";
|
||||
import {clearEventListeners} from "../utils/HelperFunctions.js";
|
||||
import {Engine} from "./engine";
|
||||
import {Player} from "./Player";
|
||||
import {dialogBoxCreate} from "../utils/DialogBox";
|
||||
import {clearEventListeners} from "../utils/HelperFunctions";
|
||||
|
||||
/* InteractiveTutorial.js */
|
||||
let iTutorialSteps = {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {dialogBoxCreate} from "../utils/DialogBox.js";
|
||||
import {dialogBoxCreate} from "../utils/DialogBox";
|
||||
|
||||
/* Literature.js
|
||||
* 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,
|
||||
Companies, getJobRequirementText} from "./Company.js";
|
||||
import {Corporation} from "./CompanyManagement.js";
|
||||
import {CONSTANTS} from "./Constants.js";
|
||||
import {Crimes} from "./Crimes.js";
|
||||
import {Engine} from "./engine.js";
|
||||
import {beginInfiltration} from "./Infiltration.js";
|
||||
import {hasBladeburnerSF} from "./NetscriptFunctions.js";
|
||||
import {Player} from "./Player.js";
|
||||
import {Server, AllServers, AddToAllServers} from "./Server.js";
|
||||
Companies, getJobRequirementText} from "./Company";
|
||||
import {Corporation} from "./CompanyManagement";
|
||||
import {CONSTANTS} from "./Constants";
|
||||
import {Crimes} from "./Crimes";
|
||||
import {Engine} from "./engine";
|
||||
import {beginInfiltration} from "./Infiltration";
|
||||
import {hasBladeburnerSF} from "./NetscriptFunctions";
|
||||
import {Player} from "./Player";
|
||||
import {Server, AllServers, AddToAllServers} from "./Server";
|
||||
import {purchaseServer,
|
||||
purchaseRamForHomeComputer} from "./ServerPurchases.js";
|
||||
import {Settings} from "./Settings.js";
|
||||
import {SpecialServerNames, SpecialServerIps} from "./SpecialServerIps.js";
|
||||
purchaseRamForHomeComputer} from "./ServerPurchases";
|
||||
import {Settings} from "./Settings";
|
||||
import {SpecialServerNames, SpecialServerIps} from "./SpecialServerIps";
|
||||
|
||||
import {dialogBoxCreate} from "../utils/DialogBox.js";
|
||||
import {clearEventListeners, createElement} from "../utils/HelperFunctions.js";
|
||||
import {createRandomIp} from "../utils/IPAddress.js";
|
||||
import {dialogBoxCreate} from "../utils/DialogBox";
|
||||
import {clearEventListeners, createElement} from "../utils/HelperFunctions";
|
||||
import {createRandomIp} from "../utils/IPAddress";
|
||||
import numeral from "numeral/min/numeral.min";
|
||||
import {formatNumber} from "../utils/StringHelperFunctions.js";
|
||||
import {formatNumber} from "../utils/StringHelperFunctions";
|
||||
import {yesNoBoxCreate, yesNoTxtInpBoxCreate,
|
||||
yesNoBoxGetYesButton, yesNoBoxGetNoButton,
|
||||
yesNoTxtInpBoxGetYesButton, yesNoTxtInpBoxGetNoButton,
|
||||
yesNoTxtInpBoxGetInput, yesNoBoxClose,
|
||||
yesNoTxtInpBoxClose} from "../utils/YesNoBox.js";
|
||||
yesNoTxtInpBoxClose} from "../utils/YesNoBox";
|
||||
|
||||
/* Display Location Content when visiting somewhere in the World*/
|
||||
var Locations = {
|
||||
@ -280,7 +280,13 @@ function displayLocationContent() {
|
||||
purchase512gb.innerHTML = "Purchase 512GB Server - $" + formatNumber(512*CONSTANTS.BaseCostFor1GBOfRamServer, 2);
|
||||
purchase1tb.innerHTML = "Purchase 1TB Server - $" + formatNumber(1024*CONSTANTS.BaseCostFor1GBOfRamServer, 2);
|
||||
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);
|
||||
} 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";
|
||||
purchaseHomeCores.style.display = "block";
|
||||
setInfiltrateButton(infiltrate, Locations.AevumECorp,
|
||||
6000, 116, 150, 8.5);
|
||||
5400, 116, 150, 6);
|
||||
break;
|
||||
|
||||
case Locations.AevumBachmanAndAssociates:
|
||||
@ -445,7 +451,7 @@ function displayLocationContent() {
|
||||
businessJob.style.display = "block";
|
||||
securityJob.style.display = "block";
|
||||
setInfiltrateButton(infiltrate, Locations.AevumBachmanAndAssociates,
|
||||
1500, 42, 60, 5.75);
|
||||
1500, 42, 60, 4.1);
|
||||
break;
|
||||
|
||||
case Locations.AevumClarkeIncorporated:
|
||||
@ -458,7 +464,7 @@ function displayLocationContent() {
|
||||
businessJob.style.display = "block";
|
||||
securityJob.style.display = "block";
|
||||
setInfiltrateButton(infiltrate, Locations.AevumClarkeIncorporated,
|
||||
2400, 34, 75, 5.4);
|
||||
2000, 34, 75, 3.6);
|
||||
break;
|
||||
|
||||
case Locations.AevumFulcrumTechnologies:
|
||||
@ -478,7 +484,7 @@ function displayLocationContent() {
|
||||
purchaseHomeRam.style.display = "block";
|
||||
purchaseHomeCores.style.display = "block";
|
||||
setInfiltrateButton(infiltrate, Locations.AevumFulcrumTechnologies,
|
||||
6000, 96, 100, 9);
|
||||
4600, 96, 100, 6.2);
|
||||
break;
|
||||
|
||||
case Locations.AevumAeroCorp:
|
||||
@ -490,7 +496,7 @@ function displayLocationContent() {
|
||||
networkEngineerJob.style.display = "block";
|
||||
securityJob.style.display = "block";
|
||||
setInfiltrateButton(infiltrate, Locations.AevumAeroCorp,
|
||||
2000, 32, 50, 6.3);
|
||||
1500, 32, 50, 4.4);
|
||||
break;
|
||||
|
||||
case Locations.AevumGalacticCybersystems:
|
||||
@ -503,7 +509,7 @@ function displayLocationContent() {
|
||||
networkEngineerJob.style.display = "block";
|
||||
businessJob.style.display = "block";
|
||||
setInfiltrateButton(infiltrate, Locations.AevumGalacticCybersystems,
|
||||
1400, 30, 50, 5.3);
|
||||
1400, 30, 50, 3.95);
|
||||
break;
|
||||
|
||||
case Locations.AevumWatchdogSecurity:
|
||||
@ -517,7 +523,7 @@ function displayLocationContent() {
|
||||
securityJob.style.display = "block";
|
||||
agentJob.style.display = "block";
|
||||
setInfiltrateButton(infiltrate, Locations.AevumWatchdogSecurity,
|
||||
850, 16, 30, 4.5);
|
||||
765, 20, 30, 3);
|
||||
break;
|
||||
|
||||
case Locations.AevumRhoConstruction:
|
||||
@ -526,7 +532,7 @@ function displayLocationContent() {
|
||||
softwareJob.style.display = "block";
|
||||
businessJob.style.display = "block";
|
||||
setInfiltrateButton(infiltrate, Locations.AevumRhoConstruction,
|
||||
600, 12, 20, 2.7);
|
||||
540, 16, 20, 1.9);
|
||||
break;
|
||||
|
||||
case Locations.AevumPolice:
|
||||
@ -535,7 +541,7 @@ function displayLocationContent() {
|
||||
softwareJob.style.display = "block";
|
||||
securityJob.style.display = "block";
|
||||
setInfiltrateButton(infiltrate, Locations.AevumPolice,
|
||||
700, 14, 25, 3.2);
|
||||
630, 18, 25, 2.2);
|
||||
break;
|
||||
|
||||
case Locations.AevumNetLinkTechnologies:
|
||||
@ -554,7 +560,7 @@ function displayLocationContent() {
|
||||
purchaseHomeRam.style.display = "block";
|
||||
purchaseHomeCores.style.display = "block";
|
||||
setInfiltrateButton(infiltrate, Locations.AevumNetLinkTechnologies,
|
||||
160, 10, 15, 1.8);
|
||||
144, 10, 15, 1.4);
|
||||
break;
|
||||
|
||||
case Locations.AevumCrushFitnessGym:
|
||||
@ -588,7 +594,7 @@ function displayLocationContent() {
|
||||
businessJob.style.display = "block";
|
||||
securityJob.style.display = "block";
|
||||
setInfiltrateButton(infiltrate, Locations.ChongqingKuaiGongInternational,
|
||||
5500, 48, 100, 9);
|
||||
4950, 100, 100, 6.1);
|
||||
break;
|
||||
|
||||
case Locations.ChongqingSolarisSpaceSystems:
|
||||
@ -600,7 +606,7 @@ function displayLocationContent() {
|
||||
networkEngineerJob.style.display = "block";
|
||||
securityJob.style.display = "block";
|
||||
setInfiltrateButton(infiltrate, Locations.ChongqingSolarisSpaceSystems,
|
||||
3600, 26, 75, 8.6);
|
||||
3240, 52, 75, 6);
|
||||
break;
|
||||
|
||||
|
||||
@ -629,7 +635,7 @@ function displayLocationContent() {
|
||||
businessJob.style.display = "block";
|
||||
securityJob.style.display = "block";
|
||||
setInfiltrateButton(infiltrate, Locations.Sector12MegaCorp,
|
||||
6000, 114, 125, 9.8);
|
||||
5000, 114, 125, 6.75);
|
||||
break;
|
||||
|
||||
case Locations.Sector12BladeIndustries:
|
||||
@ -642,7 +648,7 @@ function displayLocationContent() {
|
||||
businessJob.style.display = "block";
|
||||
securityJob.style.display = "block";
|
||||
setInfiltrateButton(infiltrate, Locations.Sector12BladeIndustries,
|
||||
3000, 46, 100, 6.7);
|
||||
2400, 46, 100, 4.2);
|
||||
break;
|
||||
|
||||
case Locations.Sector12FourSigma:
|
||||
@ -655,7 +661,7 @@ function displayLocationContent() {
|
||||
businessJob.style.display = "block";
|
||||
securityJob.style.display = "block";
|
||||
setInfiltrateButton(infiltrate, Locations.Sector12FourSigma,
|
||||
1500, 58, 100, 10.2);
|
||||
1500, 58, 100, 7);
|
||||
break;
|
||||
|
||||
case Locations.Sector12IcarusMicrosystems:
|
||||
@ -668,7 +674,7 @@ function displayLocationContent() {
|
||||
networkEngineerJob.style.display = "block";
|
||||
businessJob.style.display = "block";
|
||||
setInfiltrateButton(infiltrate, Locations.Sector12IcarusMicrosystems,
|
||||
900, 32, 70, 7.8);
|
||||
810, 32, 70, 5.4);
|
||||
break;
|
||||
|
||||
case Locations.Sector12UniversalEnergy:
|
||||
@ -681,7 +687,7 @@ function displayLocationContent() {
|
||||
networkEngineerJob.style.display = "block";
|
||||
businessJob.style.display = "block";
|
||||
setInfiltrateButton(infiltrate, Locations.Sector12UniversalEnergy,
|
||||
775, 24, 50, 6.3);
|
||||
775, 24, 50, 4.3);
|
||||
break;
|
||||
|
||||
case Locations.Sector12DeltaOne:
|
||||
@ -693,7 +699,7 @@ function displayLocationContent() {
|
||||
networkEngineerJob.style.display = "block";
|
||||
securityJob.style.display = "block";
|
||||
setInfiltrateButton(infiltrate, Locations.Sector12DeltaOne,
|
||||
1200, 38, 75, 6.3);
|
||||
1080, 38, 75, 4.5);
|
||||
break;
|
||||
|
||||
case Locations.Sector12CIA:
|
||||
@ -706,7 +712,7 @@ function displayLocationContent() {
|
||||
securityJob.style.display = "block";
|
||||
agentJob.style.display = "block";
|
||||
setInfiltrateButton(infiltrate, Locations.Sector12CIA,
|
||||
1450, 44, 80, 7.6);
|
||||
1305, 44, 80, 4.6);
|
||||
break;
|
||||
|
||||
case Locations.Sector12NSA:
|
||||
@ -725,13 +731,13 @@ function displayLocationContent() {
|
||||
nsaBladeburner.innerText = "Enter Bladeburner Headquarters";
|
||||
} else {
|
||||
setInfiltrateButton(infiltrate, Locations.Sector12NSA,
|
||||
1400, 40, 80, 7.2);
|
||||
1260, 40, 80, 5);
|
||||
nsaBladeburner.innerText = "Apply to Bladeburner Division";
|
||||
}
|
||||
nsaBladeburner.style.display = "block";
|
||||
} else {
|
||||
setInfiltrateButton(infiltrate, Locations.Sector12NSA,
|
||||
1400, 40, 80, 7.2);
|
||||
1260, 40, 80, 5);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -747,7 +753,7 @@ function displayLocationContent() {
|
||||
purchaseHomeRam.style.display = "block";
|
||||
purchaseHomeCores.style.display = "block";
|
||||
setInfiltrateButton(infiltrate, Locations.Sector12AlphaEnterprises,
|
||||
250, 14, 40, 2.7);
|
||||
225, 14, 40, 2.25);
|
||||
break;
|
||||
|
||||
case Locations.Sector12CarmichaelSecurity:
|
||||
@ -761,7 +767,7 @@ function displayLocationContent() {
|
||||
securityJob.style.display = "block";
|
||||
agentJob.style.display = "block";
|
||||
setInfiltrateButton(infiltrate, Locations.Sector12CarmichaelSecurity,
|
||||
500, 18, 60, 2.7);
|
||||
450, 18, 60, 2.5);
|
||||
break;
|
||||
|
||||
case Locations.Sector12FoodNStuff:
|
||||
@ -777,7 +783,7 @@ function displayLocationContent() {
|
||||
employeeJob.style.display = "block";
|
||||
employeePartTimeJob.style.display = "block";
|
||||
setInfiltrateButton(infiltrate, Locations.Sector12JoesGuns,
|
||||
120, 8, 20, 2.2);
|
||||
120, 8, 20, 1.8);
|
||||
break;
|
||||
|
||||
case Locations.Sector12IronGym:
|
||||
@ -819,7 +825,7 @@ function displayLocationContent() {
|
||||
securityEngineerJob.style.display = "block";
|
||||
networkEngineerJob.style.display = "block";
|
||||
setInfiltrateButton(infiltrate, Locations.NewTokyoDefComm,
|
||||
1300, 28, 70, 5.4);
|
||||
1170, 28, 70, 4);
|
||||
break;
|
||||
|
||||
case Locations.NewTokyoVitaLife:
|
||||
@ -832,7 +838,7 @@ function displayLocationContent() {
|
||||
networkEngineerJob.style.display = "block";
|
||||
businessJob.style.display = "block";
|
||||
setInfiltrateButton(infiltrate, Locations.NewTokyoVitaLife,
|
||||
750, 22, 100, 5);
|
||||
675, 22, 100, 3.5);
|
||||
break;
|
||||
|
||||
case Locations.NewTokyoGlobalPharmaceuticals:
|
||||
@ -846,7 +852,7 @@ function displayLocationContent() {
|
||||
businessJob.style.display = "block";
|
||||
securityJob.style.display = "block";
|
||||
setInfiltrateButton(infiltrate, Locations.NewTokyoGlobalPharmaceuticals,
|
||||
900, 24, 80, 5.4);
|
||||
775, 24, 80, 3.8);
|
||||
break;
|
||||
|
||||
case Locations.NewTokyoNoodleBar:
|
||||
@ -886,7 +892,7 @@ function displayLocationContent() {
|
||||
purchaseHomeRam.style.display = "block";
|
||||
purchaseHomeCores.style.display = "block";
|
||||
setInfiltrateButton(infiltrate, Locations.IshimaStormTechnologies,
|
||||
700, 24, 100, 5.9);
|
||||
630, 24, 100, 4.1);
|
||||
break;
|
||||
|
||||
case Locations.IshimaNovaMedical:
|
||||
@ -899,7 +905,7 @@ function displayLocationContent() {
|
||||
networkEngineerJob.style.display = "block";
|
||||
businessJob.style.display = "block";
|
||||
setInfiltrateButton(infiltrate, Locations.IshimaNovaMedical,
|
||||
600, 20, 50, 4.5);
|
||||
540, 20, 50, 3.2);
|
||||
break;
|
||||
|
||||
case Locations.IshimaOmegaSoftware:
|
||||
@ -918,7 +924,7 @@ function displayLocationContent() {
|
||||
purchaseHomeRam.style.display = "block";
|
||||
purchaseHomeCores.style.display = "block";
|
||||
setInfiltrateButton(infiltrate, Locations.IshimaOmegaSoftware,
|
||||
200, 10, 40, 2.3);
|
||||
130, 10, 40, 1.6);
|
||||
break;
|
||||
|
||||
case Locations.VolhavenTravelAgency:
|
||||
@ -951,7 +957,7 @@ function displayLocationContent() {
|
||||
purchase512gb.style.display = "block";
|
||||
purchase1tb.style.display = "block";
|
||||
setInfiltrateButton(infiltrate, Locations.VolhavenOmniTekIncorporated,
|
||||
1500, 44, 100, 6.3);
|
||||
1350, 44, 100, 4.4);
|
||||
break;
|
||||
|
||||
case Locations.VolhavenNWO:
|
||||
@ -964,7 +970,7 @@ function displayLocationContent() {
|
||||
businessJob.style.display = "block";
|
||||
securityJob.style.display = "block";
|
||||
setInfiltrateButton(infiltrate, Locations.VolhavenNWO,
|
||||
1800, 56, 200, 7.2);
|
||||
1620, 56, 200, 6.8);
|
||||
break;
|
||||
|
||||
case Locations.VolhavenHeliosLabs:
|
||||
@ -976,7 +982,7 @@ function displayLocationContent() {
|
||||
securityEngineerJob.style.display = "block";
|
||||
networkEngineerJob.style.display = "block";
|
||||
setInfiltrateButton(infiltrate, Locations.VolhavenHeliosLabs,
|
||||
1200, 28, 75, 5.4);
|
||||
1200, 28, 75, 3);
|
||||
break;
|
||||
|
||||
case Locations.VolhavenOmniaCybersystems:
|
||||
@ -988,7 +994,7 @@ function displayLocationContent() {
|
||||
networkEngineerJob.style.display = "block";
|
||||
securityJob.style.display = "block";
|
||||
setInfiltrateButton(infiltrate, Locations.VolhavenOmniaCybersystems,
|
||||
900, 28, 90, 5.8);
|
||||
810, 28, 90, 4.9);
|
||||
break;
|
||||
|
||||
case Locations.VolhavenLexoCorp:
|
||||
@ -1002,7 +1008,7 @@ function displayLocationContent() {
|
||||
businessJob.style.display = "block";
|
||||
securityJob.style.display = "block";
|
||||
setInfiltrateButton(infiltrate, Locations.VolhavenLexoCorp,
|
||||
500, 14, 40, 3.1);
|
||||
375, 14, 60, 2);
|
||||
break;
|
||||
|
||||
case Locations.VolhavenSysCoreSecurities:
|
||||
@ -1013,7 +1019,7 @@ function displayLocationContent() {
|
||||
securityEngineerJob.style.display = "block";
|
||||
networkEngineerJob.style.display = "block";
|
||||
setInfiltrateButton(infiltrate, Locations.VolhavenSysCoreSecurities,
|
||||
600, 16, 50, 3.6);
|
||||
480, 18, 75, 2.4);
|
||||
break;
|
||||
|
||||
case Locations.VolhavenCompuTek:
|
||||
@ -1035,7 +1041,7 @@ function displayLocationContent() {
|
||||
purchaseHomeRam.style.display = "block";
|
||||
purchaseHomeCores.style.display = "block";
|
||||
setInfiltrateButton(infiltrate, Locations.VolhavenCompuTek,
|
||||
300, 12, 35, 3.1);
|
||||
215, 12, 60, 2.1);
|
||||
break;
|
||||
|
||||
case Locations.VolhavenMilleniumFitnessGym:
|
||||
|
@ -1,14 +1,14 @@
|
||||
import {Augmentations, Augmentation,
|
||||
AugmentationNames} from "./Augmentations.js";
|
||||
import {Programs} from "./CreateProgram.js";
|
||||
import {inMission} from "./Missions.js";
|
||||
import {Player} from "./Player.js";
|
||||
import {redPillFlag} from "./RedPill.js";
|
||||
import {GetServerByHostname} from "./Server.js";
|
||||
import {Settings} from "./Settings.js";
|
||||
import {dialogBoxCreate, dialogBoxOpened} from "../utils/DialogBox.js";
|
||||
AugmentationNames} from "./Augmentations";
|
||||
import {Programs} from "./CreateProgram";
|
||||
import {inMission} from "./Missions";
|
||||
import {Player} from "./Player";
|
||||
import {redPillFlag} from "./RedPill";
|
||||
import {GetServerByHostname} from "./Server";
|
||||
import {Settings} from "./Settings";
|
||||
import {dialogBoxCreate, dialogBoxOpened} from "../utils/DialogBox";
|
||||
import {Reviver, Generic_toJSON,
|
||||
Generic_fromJSON} from "../utils/JSONReviver.js";
|
||||
Generic_fromJSON} from "../utils/JSONReviver";
|
||||
|
||||
/* Message.js */
|
||||
function Message(filename="", msg="") {
|
||||
@ -88,7 +88,7 @@ function checkForMessagesToSend() {
|
||||
}
|
||||
} else if (jumper0 && !jumper0.recvd && Player.hacking_skill >= 25) {
|
||||
sendMessage(jumper0);
|
||||
Player.getHomeComputer().programs.push(Programs.Flight);
|
||||
Player.getHomeComputer().programs.push(Programs.Flight.name);
|
||||
} else if (jumper1 && !jumper1.recvd && Player.hacking_skill >= 40) {
|
||||
sendMessage(jumper1);
|
||||
} else if (cybersecTest && !cybersecTest.recvd && Player.hacking_skill >= 50) {
|
||||
|
@ -1,12 +1,12 @@
|
||||
import {CONSTANTS} from "./Constants.js";
|
||||
import {Engine} from "./engine.js";
|
||||
import {displayFactionContent} from "./Faction.js";
|
||||
import {Player} from "./Player.js";
|
||||
import {dialogBoxCreate} from "../utils/DialogBox.js";
|
||||
import {CONSTANTS} from "./Constants";
|
||||
import {Engine} from "./engine";
|
||||
import {displayFactionContent} from "./Faction";
|
||||
import {Player} from "./Player";
|
||||
import {dialogBoxCreate} from "../utils/DialogBox";
|
||||
import {addOffset, getRandomInt,
|
||||
clearEventListenersEl,
|
||||
clearEventListeners} from "../utils/HelperFunctions.js";
|
||||
import {formatNumber, isString} from "../utils/StringHelperFunctions.js";
|
||||
clearEventListeners} from "../utils/HelperFunctions";
|
||||
import {formatNumber, isString} from "../utils/StringHelperFunctions";
|
||||
import jsplumb from 'jsplumb'
|
||||
|
||||
let inMission = false; //Flag to denote whether a mission is running
|
||||
|
@ -1,6 +1,6 @@
|
||||
import {HacknetNode} from "./HacknetNode.js";
|
||||
import {NetscriptFunctions} from "./NetscriptFunctions.js";
|
||||
import {NetscriptPort} from "./NetscriptPort.js";
|
||||
import {HacknetNode} from "./HacknetNode";
|
||||
import {NetscriptFunctions} from "./NetscriptFunctions";
|
||||
import {NetscriptPort} from "./NetscriptPort";
|
||||
|
||||
/* Environment
|
||||
* NetScript program environment
|
||||
|
@ -1,17 +1,17 @@
|
||||
import {BitNodeMultipliers} from "./BitNode.js";
|
||||
import {CONSTANTS} from "./Constants.js";
|
||||
import {Player} from "./Player.js";
|
||||
import {Environment} from "./NetscriptEnvironment.js";
|
||||
import {WorkerScript, addWorkerScript} from "./NetscriptWorker.js";
|
||||
import {Server, getServer} from "./Server.js";
|
||||
import {Settings} from "./Settings.js";
|
||||
import {BitNodeMultipliers} from "./BitNode";
|
||||
import {CONSTANTS} from "./Constants";
|
||||
import {Player} from "./Player";
|
||||
import {Environment} from "./NetscriptEnvironment";
|
||||
import {WorkerScript, addWorkerScript} from "./NetscriptWorker";
|
||||
import {Server, getServer} from "./Server";
|
||||
import {Settings} from "./Settings";
|
||||
import {Script, findRunningScript,
|
||||
RunningScript} from "./Script.js";
|
||||
RunningScript} from "./Script";
|
||||
|
||||
import {parse, Node} from "../utils/acorn.js";
|
||||
import {printArray} from "../utils/HelperFunctions.js";
|
||||
import {isValidIPAddress} from "../utils/IPAddress.js";
|
||||
import {isString} from "../utils/StringHelperFunctions.js";
|
||||
import {parse, Node} from "../utils/acorn";
|
||||
import {printArray} from "../utils/HelperFunctions";
|
||||
import {isValidIPAddress} from "../utils/IPAddress";
|
||||
import {isString} from "../utils/StringHelperFunctions";
|
||||
|
||||
var Promise = require("bluebird");
|
||||
|
||||
|
@ -1,60 +1,60 @@
|
||||
var sprintf = require('sprintf-js').sprintf,
|
||||
vsprintf = require('sprintf-js').vsprintf
|
||||
|
||||
import {updateActiveScriptsItems} from "./ActiveScriptsUI.js";
|
||||
import {updateActiveScriptsItems} from "./ActiveScriptsUI";
|
||||
import {Augmentations, Augmentation,
|
||||
augmentationExists, installAugmentations,
|
||||
AugmentationNames} from "./Augmentations.js";
|
||||
import {BitNodeMultipliers} from "./BitNode.js";
|
||||
import {determineCrimeSuccess, findCrime} from "./Crimes.js";
|
||||
import {Bladeburner} from "./Bladeburner.js";
|
||||
AugmentationNames} from "./Augmentations";
|
||||
import {BitNodeMultipliers} from "./BitNode";
|
||||
import {determineCrimeSuccess, findCrime} from "./Crimes";
|
||||
import {Bladeburner} from "./Bladeburner";
|
||||
import {Companies, Company, CompanyPosition,
|
||||
CompanyPositions, companyExists} from "./Company.js";
|
||||
import {CONSTANTS} from "./Constants.js";
|
||||
import {Programs} from "./CreateProgram.js";
|
||||
import {DarkWebItems} from "./DarkWeb.js";
|
||||
import {Engine} from "./engine.js";
|
||||
import {AllGangs} from "./Gang.js";
|
||||
CompanyPositions, companyExists} from "./Company";
|
||||
import {CONSTANTS} from "./Constants";
|
||||
import {Programs} from "./CreateProgram";
|
||||
import {DarkWebItems} from "./DarkWeb";
|
||||
import {Engine} from "./engine";
|
||||
import {AllGangs} from "./Gang";
|
||||
import {Factions, Faction, joinFaction,
|
||||
factionExists, purchaseAugmentation} from "./Faction.js";
|
||||
import {getCostOfNextHacknetNode, purchaseHacknet} from "./HacknetNode.js";
|
||||
import {Locations} from "./Location.js";
|
||||
import {Message, Messages} from "./Message.js";
|
||||
import {inMission} from "./Missions.js";
|
||||
import {Player} from "./Player.js";
|
||||
factionExists, purchaseAugmentation} from "./Faction";
|
||||
import {getCostOfNextHacknetNode, purchaseHacknet} from "./HacknetNode";
|
||||
import {Locations} from "./Location";
|
||||
import {Message, Messages} from "./Message";
|
||||
import {inMission} from "./Missions";
|
||||
import {Player} from "./Player";
|
||||
import {Script, findRunningScript, RunningScript,
|
||||
isScriptFilename} from "./Script.js";
|
||||
isScriptFilename} from "./Script";
|
||||
import {Server, getServer, AddToAllServers,
|
||||
AllServers, processSingleServerGrowth,
|
||||
GetServerByHostname} from "./Server.js";
|
||||
import {Settings} from "./Settings.js";
|
||||
import {SpecialServerIps} from "./SpecialServerIps.js";
|
||||
GetServerByHostname} from "./Server";
|
||||
import {Settings} from "./Settings";
|
||||
import {SpecialServerIps} from "./SpecialServerIps";
|
||||
import {StockMarket, StockSymbols, SymbolToStockMap, initStockSymbols,
|
||||
initStockMarket, initSymbolToStockMap, stockMarketCycle, buyStock,
|
||||
sellStock, updateStockPrices, displayStockMarketContent,
|
||||
updateStockTicker, updateStockPlayerPosition,
|
||||
Stock, shortStock, sellShort, OrderTypes,
|
||||
PositionTypes, placeOrder, cancelOrder} from "./StockMarket.js";
|
||||
import {post} from "./Terminal.js";
|
||||
PositionTypes, placeOrder, cancelOrder} from "./StockMarket";
|
||||
import {post} from "./Terminal";
|
||||
import {TextFile, getTextFile, createTextFile} from "./TextFile";
|
||||
|
||||
import {WorkerScript, workerScripts,
|
||||
killWorkerScript, NetscriptPorts} from "./NetscriptWorker.js";
|
||||
killWorkerScript, NetscriptPorts} from "./NetscriptWorker";
|
||||
import {makeRuntimeRejectMsg, netscriptDelay, runScriptFromScript,
|
||||
scriptCalculateHackingChance, scriptCalculateHackingTime,
|
||||
scriptCalculateExpGain, scriptCalculatePercentMoneyHacked,
|
||||
scriptCalculateGrowTime, scriptCalculateWeakenTime} from "./NetscriptEvaluator.js";
|
||||
import {Environment} from "./NetscriptEnvironment.js";
|
||||
import {NetscriptPort} from "./NetscriptPort.js";
|
||||
scriptCalculateGrowTime, scriptCalculateWeakenTime} from "./NetscriptEvaluator";
|
||||
import {Environment} from "./NetscriptEnvironment";
|
||||
import {NetscriptPort} from "./NetscriptPort";
|
||||
|
||||
import Decimal from "decimal.js";
|
||||
import {dialogBoxCreate} from "../utils/DialogBox.js";
|
||||
import {printArray, powerOfTwo} from "../utils/HelperFunctions.js";
|
||||
import {createRandomIp} from "../utils/IPAddress.js";
|
||||
import {formatNumber, isString, isHTML} from "../utils/StringHelperFunctions.js";
|
||||
import {dialogBoxCreate} from "../utils/DialogBox";
|
||||
import {printArray, powerOfTwo} from "../utils/HelperFunctions";
|
||||
import {createRandomIp} from "../utils/IPAddress";
|
||||
import {formatNumber, isString, isHTML} from "../utils/StringHelperFunctions";
|
||||
import {yesNoBoxClose, yesNoBoxGetYesButton,
|
||||
yesNoBoxGetNoButton, yesNoBoxCreate,
|
||||
yesNoBoxOpen} from "../utils/YesNoBox.js";
|
||||
yesNoBoxOpen} from "../utils/YesNoBox";
|
||||
|
||||
var hasCorporationSF = false, //Source-File 3
|
||||
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);
|
||||
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!");
|
||||
}
|
||||
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);
|
||||
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!");
|
||||
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);
|
||||
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!");
|
||||
}
|
||||
if (!server.ftpPortOpen) {
|
||||
@ -520,7 +520,7 @@ function NetscriptFunctions(workerScript) {
|
||||
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);
|
||||
}
|
||||
if (!Player.hasProgram(Programs.RelaySMTPProgram)) {
|
||||
if (!Player.hasProgram(Programs.RelaySMTPProgram.name)) {
|
||||
throw makeRuntimeRejectMsg(workerScript, "You do not have the relaySMTP.exe program!");
|
||||
}
|
||||
if (!server.smtpPortOpen) {
|
||||
@ -549,7 +549,7 @@ function NetscriptFunctions(workerScript) {
|
||||
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);
|
||||
}
|
||||
if (!Player.hasProgram(Programs.HTTPWormProgram)) {
|
||||
if (!Player.hasProgram(Programs.HTTPWormProgram.name)) {
|
||||
throw makeRuntimeRejectMsg(workerScript, "You do not have the HTTPWorm.exe program!");
|
||||
}
|
||||
if (!server.httpPortOpen) {
|
||||
@ -578,7 +578,7 @@ function NetscriptFunctions(workerScript) {
|
||||
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);
|
||||
}
|
||||
if (!Player.hasProgram(Programs.SQLInjectProgram)) {
|
||||
if (!Player.hasProgram(Programs.SQLInjectProgram.name)) {
|
||||
throw makeRuntimeRejectMsg(workerScript, "You do not have the SQLInject.exe program!");
|
||||
}
|
||||
if (!server.sqlPortOpen) {
|
||||
@ -2900,78 +2900,34 @@ function NetscriptFunctions(workerScript) {
|
||||
}
|
||||
}
|
||||
|
||||
switch(name.toLowerCase()) {
|
||||
case Programs.NukeProgram.toLowerCase():
|
||||
Player.startCreateProgramWork(Programs.NukeProgram, CONSTANTS.MillisecondsPerFiveMinutes, 1);
|
||||
break;
|
||||
case Programs.BruteSSHProgram.toLowerCase():
|
||||
if (Player.hacking_skill < 50) {
|
||||
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);
|
||||
break;
|
||||
case Programs.FTPCrackProgram.toLowerCase():
|
||||
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;
|
||||
}
|
||||
Player.startCreateProgramWork(Programs.FTPCrackProgram, CONSTANTS.MillisecondsPerHalfHour, 100);
|
||||
break;
|
||||
case Programs.RelaySMTPProgram.toLowerCase():
|
||||
if (Player.hacking_skill < 250) {
|
||||
workerScript.scriptRef.log("ERROR: createProgram() failed because hacking level is too low to create relaySMTP (level 250 req)");
|
||||
return false;
|
||||
}
|
||||
Player.startCreateProgramWork(Programs.RelaySMTPProgram, CONSTANTS.MillisecondsPer2Hours, 250);
|
||||
break;
|
||||
case Programs.HTTPWormProgram.toLowerCase():
|
||||
if (Player.hacking_skill < 500) {
|
||||
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;
|
||||
name = name.toLowerCase();
|
||||
|
||||
let p = null;
|
||||
for (const key in Programs) {
|
||||
if(Programs[key].name.toLowerCase() == name) {
|
||||
p = Programs[key];
|
||||
}
|
||||
}
|
||||
|
||||
if (p == null) {
|
||||
workerScript.scriptRef.log("ERROR: createProgram() failed because the specified program does not exist: " + name);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Player.hasProgram(p.name)) {
|
||||
workerScript.scriptRef.log('ERROR: createProgram() failed because you already have the ' + p.name + ' program');
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!p.create.req()) {
|
||||
workerScript.scriptRef.log("ERROR: createProgram() failed because hacking level is too low to create " + p.name + " (level " + p.create.level + " req)");
|
||||
return false
|
||||
}
|
||||
|
||||
Player.startCreateProgramWork(p.name, p.create.time, p.create.level);
|
||||
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.createProgram == null) {
|
||||
workerScript.scriptRef.log("Began creating program: " + name);
|
||||
}
|
||||
workerScript.scriptRef.log("Began creating program: " + name);
|
||||
return true;
|
||||
},
|
||||
commitCrime : function(crimeRoughName) {
|
||||
@ -3215,57 +3171,57 @@ function NetscriptFunctions(workerScript) {
|
||||
|
||||
//Bladeburner API
|
||||
bladeburner : {
|
||||
getContractNames : function(name) {
|
||||
getContractNames : function() {
|
||||
if (workerScript.checkingRam) {
|
||||
return updateStaticRam("getContractNames", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 10);
|
||||
}
|
||||
updateDynamicRam("getContractNames", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 10);
|
||||
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 " +
|
||||
"at the Bladeburner division or because you do not have Source-File 7");
|
||||
},
|
||||
getOperationNames : function(name) {
|
||||
getOperationNames : function() {
|
||||
if (workerScript.checkingRam) {
|
||||
return updateStaticRam("getOperationNames", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 10);
|
||||
}
|
||||
updateDynamicRam("getOperationNames", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 10);
|
||||
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 " +
|
||||
"at the Bladeburner division or because you do not have Source-File 7");
|
||||
},
|
||||
getBlackOpNames : function(name) {
|
||||
getBlackOpNames : function() {
|
||||
if (workerScript.checkingRam) {
|
||||
return updateStaticRam("getBlackOpNames", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 10);
|
||||
}
|
||||
updateDynamicRam("getBlackOpNames", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 10);
|
||||
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 " +
|
||||
"at the Bladeburner division or because you do not have Source-File 7");
|
||||
},
|
||||
getGeneralActionNames : function(name) {
|
||||
getGeneralActionNames : function() {
|
||||
if (workerScript.checkingRam) {
|
||||
return updateStaticRam("getGeneralActionNames", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 10);
|
||||
}
|
||||
updateDynamicRam("getGeneralActionNames", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 10);
|
||||
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 " +
|
||||
"at the Bladeburner division or because you do not have Source-File 7");
|
||||
},
|
||||
getSkillNames : function(name) {
|
||||
getSkillNames : function() {
|
||||
if (workerScript.checkingRam) {
|
||||
return updateStaticRam("getSkillNames", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 10);
|
||||
}
|
||||
updateDynamicRam("getSkillNames", CONSTANTS.ScriptBladeburnerApiBaseRamCost / 10);
|
||||
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 " +
|
||||
"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 {makeRuntimeRejectMsg} from "./NetscriptEvaluator.js";
|
||||
import {registerEnv, unregisterEnv, makeEnvHeader} from "./NetscriptJSPreamble";
|
||||
import {makeRuntimeRejectMsg} from "./NetscriptEvaluator";
|
||||
|
||||
// Makes a blob that contains the code of a given script.
|
||||
export function makeScriptBlob(code) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {Settings} from "./Settings.js";
|
||||
import {Settings} from "./Settings";
|
||||
|
||||
function NetscriptPort() {
|
||||
this.data = [];
|
||||
|
@ -1,20 +1,20 @@
|
||||
import {addActiveScriptsItem,
|
||||
deleteActiveScriptsItem,
|
||||
updateActiveScriptsItems} from "./ActiveScriptsUI.js";
|
||||
import {CONSTANTS} from "./Constants.js";
|
||||
import {Engine} from "./engine.js";
|
||||
import {Environment} from "./NetscriptEnvironment.js";
|
||||
updateActiveScriptsItems} from "./ActiveScriptsUI";
|
||||
import {CONSTANTS} from "./Constants";
|
||||
import {Engine} from "./engine";
|
||||
import {Environment} from "./NetscriptEnvironment";
|
||||
import {evaluate, isScriptErrorMessage,
|
||||
makeRuntimeRejectMsg,
|
||||
killNetscriptDelay} from "./NetscriptEvaluator.js";
|
||||
import {executeJSScript} from "./NetscriptJSEvaluator.js";
|
||||
import {NetscriptPort} from "./NetscriptPort.js";
|
||||
import {AllServers} from "./Server.js";
|
||||
import {Settings} from "./Settings.js";
|
||||
killNetscriptDelay} from "./NetscriptEvaluator";
|
||||
import {executeJSScript} from "./NetscriptJSEvaluator";
|
||||
import {NetscriptPort} from "./NetscriptPort";
|
||||
import {AllServers} from "./Server";
|
||||
import {Settings} from "./Settings";
|
||||
|
||||
import {parse} from "../utils/acorn.js";
|
||||
import {dialogBoxCreate} from "../utils/DialogBox.js";
|
||||
import {compareArrays, printArray} from "../utils/HelperFunctions.js";
|
||||
import {parse} from "../utils/acorn";
|
||||
import {dialogBoxCreate} from "../utils/DialogBox";
|
||||
import {compareArrays, printArray} from "../utils/HelperFunctions";
|
||||
|
||||
function WorkerScript(runningScriptObj) {
|
||||
this.name = runningScriptObj.filename;
|
||||
|
@ -1,33 +1,33 @@
|
||||
import {Augmentations, applyAugmentation,
|
||||
AugmentationNames,
|
||||
PlayerOwnedAugmentation} from "./Augmentations.js";
|
||||
import {BitNodes, BitNode, BitNodeMultipliers} from "./BitNode.js";
|
||||
PlayerOwnedAugmentation} from "./Augmentations";
|
||||
import {BitNodes, BitNode, BitNodeMultipliers} from "./BitNode";
|
||||
import {Company, Companies, getNextCompanyPosition,
|
||||
getJobRequirementText, CompanyPosition,
|
||||
CompanyPositions} from "./Company.js";
|
||||
import {CONSTANTS} from "./Constants.js";
|
||||
import {Corporation} from "./CompanyManagement.js";
|
||||
import {Programs} from "./CreateProgram.js";
|
||||
import {determineCrimeSuccess, Crimes} from "./Crimes.js";
|
||||
import {Engine} from "./engine.js";
|
||||
CompanyPositions} from "./Company";
|
||||
import {CONSTANTS} from "./Constants";
|
||||
import {Corporation} from "./CompanyManagement";
|
||||
import {Programs} from "./CreateProgram";
|
||||
import {determineCrimeSuccess, Crimes} from "./Crimes";
|
||||
import {Engine} from "./engine";
|
||||
import {Factions, Faction,
|
||||
displayFactionContent} from "./Faction.js";
|
||||
import {Gang, resetGangs} from "./Gang.js";
|
||||
import {Locations} from "./Location.js";
|
||||
import {hasBn11SF, hasWallStreetSF,hasAISF} from "./NetscriptFunctions.js";
|
||||
import {AllServers, Server, AddToAllServers} from "./Server.js";
|
||||
import {SpecialServerIps, SpecialServerNames} from "./SpecialServerIps.js";
|
||||
import {SourceFiles, applySourceFile} from "./SourceFile.js";
|
||||
displayFactionContent} from "./Faction";
|
||||
import {Gang, resetGangs} from "./Gang";
|
||||
import {Locations} from "./Location";
|
||||
import {hasBn11SF, hasWallStreetSF,hasAISF} from "./NetscriptFunctions";
|
||||
import {AllServers, Server, AddToAllServers} from "./Server";
|
||||
import {SpecialServerIps, SpecialServerNames} from "./SpecialServerIps";
|
||||
import {SourceFiles, applySourceFile} from "./SourceFile";
|
||||
|
||||
import Decimal from "decimal.js";
|
||||
import {dialogBoxCreate} from "../utils/DialogBox.js";
|
||||
import {clearEventListeners} from "../utils/HelperFunctions.js";
|
||||
import {createRandomIp} from "../utils/IPAddress.js";
|
||||
import {dialogBoxCreate} from "../utils/DialogBox";
|
||||
import {clearEventListeners} from "../utils/HelperFunctions";
|
||||
import {createRandomIp} from "../utils/IPAddress";
|
||||
import {Reviver, Generic_toJSON,
|
||||
Generic_fromJSON} from "../utils/JSONReviver.js";
|
||||
Generic_fromJSON} from "../utils/JSONReviver";
|
||||
import numeral from "numeral/min/numeral.min";
|
||||
import {formatNumber,
|
||||
convertTimeMsToTimeElapsedString} from "../utils/StringHelperFunctions.js";
|
||||
convertTimeMsToTimeElapsedString} from "../utils/StringHelperFunctions";
|
||||
|
||||
function PlayerObject() {
|
||||
//Skills and stats
|
||||
@ -220,7 +220,7 @@ PlayerObject.prototype.init = function() {
|
||||
this.currentServer = t_homeComp.ip;
|
||||
AddToAllServers(t_homeComp);
|
||||
|
||||
this.getHomeComputer().programs.push(Programs.NukeProgram);
|
||||
this.getHomeComputer().programs.push(Programs.NukeProgram.name);
|
||||
}
|
||||
|
||||
PlayerObject.prototype.prestigeAugmentation = function() {
|
||||
|
@ -1,39 +1,39 @@
|
||||
import {deleteActiveScriptsItem} from "./ActiveScriptsUI.js";
|
||||
import {deleteActiveScriptsItem} from "./ActiveScriptsUI";
|
||||
import {Augmentations, augmentationExists,
|
||||
initAugmentations, AugmentationNames} from "./Augmentations.js";
|
||||
import {initBitNodeMultipliers} from "./BitNode.js";
|
||||
import {Bladeburner} from "./Bladeburner.js";
|
||||
import {writeCinematicText} from "./CinematicText.js";
|
||||
import {Companies, Company, initCompanies} from "./Company.js";
|
||||
import {Programs} from "./CreateProgram.js";
|
||||
import {Engine} from "./engine.js";
|
||||
initAugmentations, AugmentationNames} from "./Augmentations";
|
||||
import {initBitNodeMultipliers} from "./BitNode";
|
||||
import {Bladeburner} from "./Bladeburner";
|
||||
import {writeCinematicText} from "./CinematicText";
|
||||
import {Companies, Company, initCompanies} from "./Company";
|
||||
import {Programs} from "./CreateProgram";
|
||||
import {Engine} from "./engine";
|
||||
import {Factions, Faction, initFactions,
|
||||
joinFaction} from "./Faction.js";
|
||||
import {deleteGangDisplayContent} from "./Gang.js";
|
||||
import {Locations} from "./Location.js";
|
||||
import {initMessages, Messages, Message} from "./Message.js";
|
||||
import {initSingularitySFFlags, hasWallStreetSF}from "./NetscriptFunctions.js";
|
||||
joinFaction} from "./Faction";
|
||||
import {deleteGangDisplayContent} from "./Gang";
|
||||
import {Locations} from "./Location";
|
||||
import {initMessages, Messages, Message} from "./Message";
|
||||
import {initSingularitySFFlags, hasWallStreetSF}from "./NetscriptFunctions";
|
||||
import {WorkerScript, workerScripts,
|
||||
prestigeWorkerScripts} from "./NetscriptWorker.js";
|
||||
import {Player} from "./Player.js";
|
||||
prestigeWorkerScripts} from "./NetscriptWorker";
|
||||
import {Player} from "./Player";
|
||||
|
||||
import {AllServers, AddToAllServers,
|
||||
initForeignServers, Server,
|
||||
prestigeAllServers,
|
||||
prestigeHomeComputer} from "./Server.js";
|
||||
prestigeHomeComputer} from "./Server";
|
||||
import {SpecialServerIps, SpecialServerIpsMap,
|
||||
prestigeSpecialServerIps,
|
||||
SpecialServerNames} from "./SpecialServerIps.js";
|
||||
SpecialServerNames} from "./SpecialServerIps";
|
||||
import {initStockMarket, initSymbolToStockMap,
|
||||
stockMarketContentCreated,
|
||||
setStockMarketContentCreated} from "./StockMarket.js";
|
||||
import {Terminal, postNetburnerText} from "./Terminal.js";
|
||||
setStockMarketContentCreated} from "./StockMarket";
|
||||
import {Terminal, postNetburnerText} from "./Terminal";
|
||||
import Decimal from "decimal.js";
|
||||
import {dialogBoxCreate} from "../utils/DialogBox.js";
|
||||
import {dialogBoxCreate} from "../utils/DialogBox";
|
||||
import {createPopup, createElement,
|
||||
removeElementById, exceptionAlert} from "../utils/HelperFunctions.js";
|
||||
removeElementById, exceptionAlert} from "../utils/HelperFunctions";
|
||||
import {yesNoBoxCreate, yesNoBoxGetYesButton,
|
||||
yesNoBoxGetNoButton, yesNoBoxClose} from "../utils/YesNoBox.js";
|
||||
yesNoBoxGetNoButton, yesNoBoxClose} from "../utils/YesNoBox";
|
||||
|
||||
let BitNode8StartingMoney = 250e6;
|
||||
|
||||
@ -59,13 +59,13 @@ function prestigeAugmentation() {
|
||||
|
||||
if (augmentationExists(AugmentationNames.Neurolink) &&
|
||||
Augmentations[AugmentationNames.Neurolink].owned) {
|
||||
homeComp.programs.push(Programs.FTPCrackProgram);
|
||||
homeComp.programs.push(Programs.RelaySMTPProgram);
|
||||
homeComp.programs.push(Programs.FTPCrackProgram.name);
|
||||
homeComp.programs.push(Programs.RelaySMTPProgram.name);
|
||||
}
|
||||
if (augmentationExists(AugmentationNames.CashRoot) &&
|
||||
Augmentations[AugmentationNames.CashRoot].owned) {
|
||||
Player.setMoney(new Decimal(1000000));
|
||||
homeComp.programs.push(Programs.BruteSSHProgram);
|
||||
homeComp.programs.push(Programs.BruteSSHProgram.name);
|
||||
}
|
||||
|
||||
//Re-create foreign servers
|
||||
@ -191,9 +191,6 @@ function prestigeSourceFile() {
|
||||
}
|
||||
homeComp.cpuCores = 1;
|
||||
|
||||
//Darkweb is purchase-able
|
||||
document.getElementById("location-purchase-tor").setAttribute("class", "a-link-button");
|
||||
|
||||
//Reset favor for Companies
|
||||
for (var member in Companies) {
|
||||
if (Companies.hasOwnProperty(member)) {
|
||||
|
@ -1,16 +1,16 @@
|
||||
import {BitNode, BitNodes} from "./BitNode.js";
|
||||
import {Engine} from "./engine.js";
|
||||
import {Player} from "./Player.js";
|
||||
import {prestigeSourceFile} from "./Prestige.js";
|
||||
import {BitNode, BitNodes} from "./BitNode";
|
||||
import {Engine} from "./engine";
|
||||
import {Player} from "./Player";
|
||||
import {prestigeSourceFile} from "./Prestige";
|
||||
import {SourceFiles, SourceFile,
|
||||
PlayerOwnedSourceFile} from "./SourceFile.js";
|
||||
import {Terminal} from "./Terminal.js";
|
||||
PlayerOwnedSourceFile} from "./SourceFile";
|
||||
import {Terminal} from "./Terminal";
|
||||
|
||||
import {dialogBoxCreate} from "../utils/DialogBox.js";
|
||||
import {dialogBoxCreate} from "../utils/DialogBox";
|
||||
import {clearEventListeners,
|
||||
removeChildrenFromElement} from "../utils/HelperFunctions.js";
|
||||
removeChildrenFromElement} from "../utils/HelperFunctions";
|
||||
import {yesNoBoxCreate, yesNoBoxGetYesButton,
|
||||
yesNoBoxGetNoButton, yesNoBoxClose} from "../utils/YesNoBox.js";
|
||||
yesNoBoxGetNoButton, yesNoBoxClose} from "../utils/YesNoBox";
|
||||
|
||||
/* RedPill.js
|
||||
* Implements what happens when you have Red Pill augmentation and then hack the world daemon */
|
||||
|
@ -1,29 +1,29 @@
|
||||
import {loadAliases, loadGlobalAliases,
|
||||
Aliases, GlobalAliases} from "./Alias.js";
|
||||
Aliases, GlobalAliases} from "./Alias";
|
||||
import {loadCompanies, Companies,
|
||||
CompanyPositions} from "./Company.js";
|
||||
import {CONSTANTS} from "./Constants.js";
|
||||
import {Engine} from "./engine.js";
|
||||
CompanyPositions} from "./Company";
|
||||
import {CONSTANTS} from "./Constants";
|
||||
import {Engine} from "./engine";
|
||||
import {loadFactions, Factions,
|
||||
processPassiveFactionRepGain} from "./Faction.js";
|
||||
import {FconfSettings, loadFconf} from "./Fconf.js";
|
||||
import {loadAllGangs, AllGangs} from "./Gang.js";
|
||||
processPassiveFactionRepGain} from "./Faction";
|
||||
import {FconfSettings, loadFconf} from "./Fconf";
|
||||
import {loadAllGangs, AllGangs} from "./Gang";
|
||||
import {processAllHacknetNodeEarnings,
|
||||
createPlayerHacknetNodeWrappers} from "./HacknetNode.js";
|
||||
import {loadMessages, initMessages, Messages} from "./Message.js";
|
||||
import {Player, loadPlayer} from "./Player.js";
|
||||
import {loadAllRunningScripts} from "./Script.js";
|
||||
import {AllServers, loadAllServers} from "./Server.js";
|
||||
import {loadSettings, initSettings, Settings} from "./Settings.js";
|
||||
import {loadSpecialServerIps, SpecialServerIps} from "./SpecialServerIps.js";
|
||||
import {loadStockMarket, StockMarket} from "./StockMarket.js";
|
||||
import {dialogBoxCreate} from "../utils/DialogBox.js";
|
||||
import {gameOptionsBoxClose} from "../utils/GameOptions.js";
|
||||
createPlayerHacknetNodeWrappers} from "./HacknetNode";
|
||||
import {loadMessages, initMessages, Messages} from "./Message";
|
||||
import {Player, loadPlayer} from "./Player";
|
||||
import {loadAllRunningScripts} from "./Script";
|
||||
import {AllServers, loadAllServers} from "./Server";
|
||||
import {loadSettings, initSettings, Settings} from "./Settings";
|
||||
import {loadSpecialServerIps, SpecialServerIps} from "./SpecialServerIps";
|
||||
import {loadStockMarket, StockMarket} from "./StockMarket";
|
||||
import {dialogBoxCreate} from "../utils/DialogBox";
|
||||
import {gameOptionsBoxClose} from "../utils/GameOptions";
|
||||
import {clearEventListeners, createElement,
|
||||
createPopup, removeElementById} from "../utils/HelperFunctions.js";
|
||||
createPopup, removeElementById} from "../utils/HelperFunctions";
|
||||
import {Reviver, Generic_toJSON,
|
||||
Generic_fromJSON} from "../utils/JSONReviver.js";
|
||||
import {formatNumber} from "../utils/StringHelperFunctions.js";
|
||||
Generic_fromJSON} from "../utils/JSONReviver";
|
||||
import {formatNumber} from "../utils/StringHelperFunctions";
|
||||
|
||||
import Decimal from "decimal.js";
|
||||
|
||||
|
@ -17,28 +17,28 @@ require("brace/ext/language_tools");
|
||||
// Importing this doesn't work for some reason.
|
||||
const walk = require("acorn/dist/walk");
|
||||
|
||||
import {CONSTANTS} from "./Constants.js";
|
||||
import {Engine} from "./engine.js";
|
||||
import {FconfSettings, parseFconfSettings} from "./Fconf.js";
|
||||
import {CONSTANTS} from "./Constants";
|
||||
import {Engine} from "./engine";
|
||||
import {FconfSettings, parseFconfSettings} from "./Fconf";
|
||||
import {iTutorialSteps, iTutorialNextStep,
|
||||
iTutorialIsRunning, currITutorialStep} from "./InteractiveTutorial.js";
|
||||
import {evaluateImport} from "./NetscriptEvaluator.js";
|
||||
import {NetscriptFunctions} from "./NetscriptFunctions.js";
|
||||
iTutorialIsRunning, currITutorialStep} from "./InteractiveTutorial";
|
||||
import {evaluateImport} from "./NetscriptEvaluator";
|
||||
import {NetscriptFunctions} from "./NetscriptFunctions";
|
||||
import {addWorkerScript, killWorkerScript,
|
||||
WorkerScript} from "./NetscriptWorker.js";
|
||||
import {Player} from "./Player.js";
|
||||
import {AllServers, processSingleServerGrowth} from "./Server.js";
|
||||
import {Settings} from "./Settings.js";
|
||||
import {post, Terminal} from "./Terminal.js";
|
||||
WorkerScript} from "./NetscriptWorker";
|
||||
import {Player} from "./Player";
|
||||
import {AllServers, processSingleServerGrowth} from "./Server";
|
||||
import {Settings} from "./Settings";
|
||||
import {post, Terminal} from "./Terminal";
|
||||
import {TextFile} from "./TextFile";
|
||||
|
||||
import {parse, Node} from "../utils/acorn.js";
|
||||
import {dialogBoxCreate} from "../utils/DialogBox.js";
|
||||
import {parse, Node} from "../utils/acorn";
|
||||
import {dialogBoxCreate} from "../utils/DialogBox";
|
||||
import {Reviver, Generic_toJSON,
|
||||
Generic_fromJSON} from "../utils/JSONReviver.js";
|
||||
import {compareArrays, createElement} from "../utils/HelperFunctions.js";
|
||||
Generic_fromJSON} from "../utils/JSONReviver";
|
||||
import {compareArrays, createElement} from "../utils/HelperFunctions";
|
||||
import {formatNumber, numOccurrences,
|
||||
numNetscriptOperators} from "../utils/StringHelperFunctions.js";
|
||||
numNetscriptOperators} from "../utils/StringHelperFunctions";
|
||||
|
||||
var keybindings = {
|
||||
ace: null,
|
||||
|
@ -1,13 +1,13 @@
|
||||
import {BitNodeMultipliers} from "./BitNode.js";
|
||||
import {CONSTANTS} from "./Constants.js";
|
||||
import {Programs} from "./CreateProgram.js";
|
||||
import {Player} from "./Player.js";
|
||||
import {RunningScript, Script} from "./Script.js";
|
||||
import {SpecialServerNames, SpecialServerIps} from "./SpecialServerIps.js";
|
||||
import {getRandomInt} from "../utils/HelperFunctions.js";
|
||||
import {createRandomIp, isValidIPAddress, ipExists} from "../utils/IPAddress.js";
|
||||
import {BitNodeMultipliers} from "./BitNode";
|
||||
import {CONSTANTS} from "./Constants";
|
||||
import {Programs} from "./CreateProgram";
|
||||
import {Player} from "./Player";
|
||||
import {RunningScript, Script} from "./Script";
|
||||
import {SpecialServerNames, SpecialServerIps} from "./SpecialServerIps";
|
||||
import {getRandomInt} from "../utils/HelperFunctions";
|
||||
import {createRandomIp, isValidIPAddress, ipExists} from "../utils/IPAddress";
|
||||
import {Reviver, Generic_toJSON,
|
||||
Generic_fromJSON} from "../utils/JSONReviver.js";
|
||||
Generic_fromJSON} from "../utils/JSONReviver";
|
||||
|
||||
function Server(params={ip:createRandomIp(), hostname:""}) {
|
||||
/* Properties */
|
||||
@ -93,18 +93,23 @@ Server.prototype.getScript = function(scriptName) {
|
||||
return null;
|
||||
}
|
||||
|
||||
//Strengthens a server's security level (difficulty) by the specified amount
|
||||
Server.prototype.fortify = function(amt) {
|
||||
this.hackDifficulty += amt;
|
||||
Server.prototype.capDifficulty = function() {
|
||||
if (this.hackDifficulty < this.minDifficulty) {this.hackDifficulty = this.minDifficulty;}
|
||||
if (this.hackDifficulty < 1) {this.hackDifficulty = 1;}
|
||||
//Place some arbitrarily limit that realistically should never happen unless someone is
|
||||
//screwing around with the game
|
||||
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) {
|
||||
this.hackDifficulty -= (amt * BitNodeMultipliers.ServerWeakenRate);
|
||||
if (this.hackDifficulty < this.minDifficulty) {this.hackDifficulty = this.minDifficulty;}
|
||||
if (this.hackDifficulty < 1) {this.hackDifficulty = 1;}
|
||||
this.capDifficulty();
|
||||
}
|
||||
|
||||
//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(oldMoneyAvailable !== server.moneyAvailable) {
|
||||
//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));
|
||||
}
|
||||
return server.moneyAvailable / oldMoneyAvailable;
|
||||
@ -829,7 +835,7 @@ function prestigeHomeComputer(homeComp) {
|
||||
homeComp.serversOnNetwork = [];
|
||||
homeComp.isConnectedTo = true;
|
||||
homeComp.ramUsed = 0;
|
||||
homeComp.programs.push(Programs.NukeProgram);
|
||||
homeComp.programs.push(Programs.NukeProgram.name);
|
||||
|
||||
//Update RAM usage on all scripts
|
||||
homeComp.scripts.forEach(function(script) {
|
||||
|
@ -1,9 +1,9 @@
|
||||
import {CONSTANTS} from "./Constants.js";
|
||||
import {Player} from "./Player.js";
|
||||
import {Server, AllServers, AddToAllServers} from "./Server.js";
|
||||
import {dialogBoxCreate} from "../utils/DialogBox.js";
|
||||
import {createRandomIp} from "../utils/IPAddress.js";
|
||||
import {yesNoTxtInpBoxGetInput} from "../utils/YesNoBox.js";
|
||||
import {CONSTANTS} from "./Constants";
|
||||
import {Player} from "./Player";
|
||||
import {Server, AllServers, AddToAllServers} from "./Server";
|
||||
import {dialogBoxCreate} from "../utils/DialogBox";
|
||||
import {createRandomIp} from "../utils/IPAddress";
|
||||
import {yesNoTxtInpBoxGetInput} from "../utils/YesNoBox";
|
||||
|
||||
|
||||
/* Functions to handle any server-related purchasing:
|
||||
|
@ -1,20 +1,21 @@
|
||||
import {Engine} from "./engine.js";
|
||||
import {Engine} from "./engine";
|
||||
|
||||
/* Settings.js */
|
||||
let Settings = {
|
||||
CodeInstructionRunTime: 50,
|
||||
MaxLogCapacity: 50,
|
||||
MaxPortCapacity: 50,
|
||||
SuppressMessages: false,
|
||||
SuppressFactionInvites: false,
|
||||
SuppressTravelConfirmation: false,
|
||||
AutosaveInterval: 60,
|
||||
DisableHotkeys: false,
|
||||
ThemeHighlightColor: "#ffffff",
|
||||
ThemeFontColor: "#66ff33",
|
||||
ThemeBackgroundColor: "#000000",
|
||||
EditorTheme: "Monokai",
|
||||
EditorKeybinding: "ace",
|
||||
CodeInstructionRunTime: 50,
|
||||
MaxLogCapacity: 50,
|
||||
MaxPortCapacity: 50,
|
||||
SuppressMessages: false,
|
||||
SuppressFactionInvites: false,
|
||||
SuppressTravelConfirmation: false,
|
||||
SuppressBuyAugmentationConfirmation: false,
|
||||
AutosaveInterval: 60,
|
||||
DisableHotkeys: false,
|
||||
ThemeHighlightColor: "#ffffff",
|
||||
ThemeFontColor: "#66ff33",
|
||||
ThemeBackgroundColor: "#000000",
|
||||
EditorTheme: "Monokai",
|
||||
EditorKeybinding: "ace",
|
||||
}
|
||||
|
||||
function loadSettings(saveString) {
|
||||
@ -28,6 +29,7 @@ function initSettings() {
|
||||
Settings.SuppressMessages = false;
|
||||
Settings.SuppressFactionInvites = false;
|
||||
Settings.SuppressTravelConfirmation = false;
|
||||
Settings.SuppressBuyAugmentationConfirmation = false;
|
||||
Settings.AutosaveInterval = 60;
|
||||
Settings.DisableHotkeys = false;
|
||||
}
|
||||
@ -39,6 +41,7 @@ function setSettingsLabels() {
|
||||
var suppressMsgs = document.getElementById("settingsSuppressMessages");
|
||||
var suppressFactionInv = document.getElementById("settingsSuppressFactionInvites")
|
||||
var suppressTravelConfirmation = document.getElementById("settingsSuppressTravelConfirmation");
|
||||
var suppressBuyAugmentationConfirmation = document.getElementById("settingsSuppressBuyAugmentationConfirmation");
|
||||
var autosaveInterval = document.getElementById("settingsAutosaveIntervalValLabel");
|
||||
var disableHotkeys = document.getElementById("settingsDisableHotkeys");
|
||||
|
||||
@ -49,6 +52,7 @@ function setSettingsLabels() {
|
||||
suppressMsgs.checked = Settings.SuppressMessages;
|
||||
suppressFactionInv.checked = Settings.SuppressFactionInvites;
|
||||
suppressTravelConfirmation.checked = Settings.SuppressTravelConfirmation;
|
||||
suppressBuyAugmentationConfirmation.checked = Settings.SuppressBuyAugmentationConfirmation;
|
||||
autosaveInterval.innerHTML = Settings.AutosaveInterval;
|
||||
disableHotkeys.checked = Settings.DisableHotkeys;
|
||||
|
||||
@ -99,6 +103,11 @@ function setSettingsLabels() {
|
||||
Settings.SuppressTravelConfirmation = this.checked;
|
||||
};
|
||||
|
||||
suppressBuyAugmentationConfirmation.onclick = function() {
|
||||
Settings.SuppressBuyAugmentationConfirmation = this.checked;
|
||||
console.log('sup buy: '+Settings.SuppressBuyAugmentationConfirmation);
|
||||
};
|
||||
|
||||
disableHotkeys.onclick = function() {
|
||||
Settings.DisableHotkeys = this.checked;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
import {Player} from "./Player.js";
|
||||
import {BitNode, BitNodes} from "./BitNode.js";
|
||||
import {Player} from "./Player";
|
||||
import {BitNode, BitNodes} from "./BitNode";
|
||||
|
||||
/* SourceFile.js */
|
||||
//Each SourceFile corresponds to a BitNode with the same number
|
||||
|
@ -1,5 +1,5 @@
|
||||
import {Reviver, Generic_toJSON,
|
||||
Generic_fromJSON} from "../utils/JSONReviver.js";
|
||||
Generic_fromJSON} from "../utils/JSONReviver";
|
||||
|
||||
/* Holds IP of Special Servers */
|
||||
let SpecialServerNames = {
|
||||
|
@ -1,23 +1,23 @@
|
||||
import {CONSTANTS} from "./Constants.js";
|
||||
import {Engine} from "./engine.js";
|
||||
import {Locations} from "./Location.js";
|
||||
import {hasWallStreetSF, wallStreetSFLvl} from "./NetscriptFunctions.js";
|
||||
import {WorkerScript} from "./NetscriptWorker.js";
|
||||
import {Player} from "./Player.js";
|
||||
import {CONSTANTS} from "./Constants";
|
||||
import {Engine} from "./engine";
|
||||
import {Locations} from "./Location";
|
||||
import {hasWallStreetSF, wallStreetSFLvl} from "./NetscriptFunctions";
|
||||
import {WorkerScript} from "./NetscriptWorker";
|
||||
import {Player} from "./Player";
|
||||
|
||||
import {dialogBoxCreate} from "../utils/DialogBox.js";
|
||||
import {dialogBoxCreate} from "../utils/DialogBox";
|
||||
import {clearEventListeners, getRandomInt,
|
||||
removeElementById,
|
||||
clearEventListenersEl} from "../utils/HelperFunctions.js";
|
||||
clearEventListenersEl} from "../utils/HelperFunctions";
|
||||
import {Reviver, Generic_toJSON,
|
||||
Generic_fromJSON} from "../utils/JSONReviver.js";
|
||||
Generic_fromJSON} from "../utils/JSONReviver";
|
||||
import numeral from "numeral/min/numeral.min";
|
||||
import {formatNumber} from "../utils/StringHelperFunctions.js";
|
||||
import {formatNumber} from "../utils/StringHelperFunctions";
|
||||
import {yesNoBoxCreate, yesNoTxtInpBoxCreate,
|
||||
yesNoBoxGetYesButton, yesNoBoxGetNoButton,
|
||||
yesNoTxtInpBoxGetYesButton, yesNoTxtInpBoxGetNoButton,
|
||||
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
|
||||
|
||||
|
@ -1,44 +1,45 @@
|
||||
import {substituteAliases, printAliases,
|
||||
parseAliasDeclaration,
|
||||
removeAlias, GlobalAliases,
|
||||
Aliases} from "./Alias.js";
|
||||
import {CONSTANTS} from "./Constants.js";
|
||||
import {Programs} from "./CreateProgram.js";
|
||||
Aliases} from "./Alias";
|
||||
import {CONSTANTS} from "./Constants";
|
||||
import {Programs} from "./CreateProgram";
|
||||
import {executeDarkwebTerminalCommand,
|
||||
checkIfConnectedToDarkweb,
|
||||
DarkWebItems} from "./DarkWeb.js";
|
||||
import {Engine} from "./engine.js";
|
||||
DarkWebItems} from "./DarkWeb";
|
||||
import {Engine} from "./engine";
|
||||
import {FconfSettings, parseFconfSettings,
|
||||
createFconf} from "./Fconf.js";
|
||||
createFconf} from "./Fconf";
|
||||
import {TerminalHelpText, HelpTexts} from "./HelpText";
|
||||
import {iTutorialNextStep, iTutorialSteps,
|
||||
iTutorialIsRunning,
|
||||
currITutorialStep} from "./InteractiveTutorial.js";
|
||||
import {showLiterature} from "./Literature.js";
|
||||
import {showMessage, Message} from "./Message.js";
|
||||
currITutorialStep} from "./InteractiveTutorial";
|
||||
import {showLiterature} from "./Literature";
|
||||
import {showMessage, Message} from "./Message";
|
||||
import {scriptCalculateHackingTime,
|
||||
scriptCalculateGrowTime,
|
||||
scriptCalculateWeakenTime} from "./NetscriptEvaluator.js";
|
||||
import {killWorkerScript, addWorkerScript} from "./NetscriptWorker.js";
|
||||
import {Player} from "./Player.js";
|
||||
import {hackWorldDaemon} from "./RedPill.js";
|
||||
scriptCalculateWeakenTime} from "./NetscriptEvaluator";
|
||||
import {killWorkerScript, addWorkerScript} from "./NetscriptWorker";
|
||||
import numeral from "numeral/min/numeral.min";
|
||||
import {Player} from "./Player";
|
||||
import {hackWorldDaemon} from "./RedPill";
|
||||
import {findRunningScript, RunningScript,
|
||||
AllServersMap, Script,
|
||||
isScriptFilename} from "./Script.js";
|
||||
isScriptFilename} from "./Script";
|
||||
import {AllServers, GetServerByHostname,
|
||||
getServer, Server} from "./Server.js";
|
||||
import {Settings} from "./Settings.js";
|
||||
getServer, Server} from "./Server";
|
||||
import {Settings} from "./Settings";
|
||||
import {SpecialServerIps,
|
||||
SpecialServerNames} from "./SpecialServerIps.js";
|
||||
SpecialServerNames} from "./SpecialServerIps";
|
||||
import {TextFile, getTextFile} from "./TextFile";
|
||||
|
||||
import {containsAllStrings, longestCommonStart,
|
||||
formatNumber, isString} from "../utils/StringHelperFunctions.js";
|
||||
import {addOffset, printArray} from "../utils/HelperFunctions.js";
|
||||
import {logBoxCreate} from "../utils/LogBox.js";
|
||||
formatNumber, isString} from "../utils/StringHelperFunctions";
|
||||
import {addOffset, printArray} from "../utils/HelperFunctions";
|
||||
import {logBoxCreate} from "../utils/LogBox";
|
||||
import {yesNoBoxCreate,
|
||||
yesNoBoxGetYesButton,
|
||||
yesNoBoxGetNoButton, yesNoBoxClose} from "../utils/YesNoBox.js";
|
||||
yesNoBoxGetNoButton, yesNoBoxClose} from "../utils/YesNoBox";
|
||||
|
||||
import * as JSZip from 'jszip';
|
||||
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");
|
||||
return;
|
||||
}
|
||||
if (depth > 3 && !Player.hasProgram(Programs.DeepscanV1) &&
|
||||
!Player.hasProgram(Programs.DeepscanV2)) {
|
||||
if (depth > 3 && !Player.hasProgram(Programs.DeepscanV1.name) &&
|
||||
!Player.hasProgram(Programs.DeepscanV2.name)) {
|
||||
post("You cannot scan-analyze with that high of a depth. Maximum depth is 3");
|
||||
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");
|
||||
return;
|
||||
} else if (depth > 10) {
|
||||
@ -1760,7 +1761,7 @@ let Terminal = {
|
||||
}
|
||||
if (d == 0) {continue;} //Don't print current server
|
||||
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);
|
||||
} else {
|
||||
post("<strong>" + titleDashes + ">" + s.hostname + "</strong>");
|
||||
@ -1825,7 +1826,7 @@ let Terminal = {
|
||||
programName = splitArgs[0];
|
||||
}
|
||||
switch (programName) {
|
||||
case Programs.NukeProgram:
|
||||
case Programs.NukeProgram.name:
|
||||
if (s.hasAdminRights) {
|
||||
post("You already have root access to this computer. There is no reason to run NUKE.exe");
|
||||
} else {
|
||||
@ -1838,7 +1839,7 @@ let Terminal = {
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Programs.BruteSSHProgram:
|
||||
case Programs.BruteSSHProgram.name:
|
||||
if (s.sshPortOpen) {
|
||||
post("SSH Port (22) is already open!");
|
||||
} else {
|
||||
@ -1847,7 +1848,7 @@ let Terminal = {
|
||||
++s.openPortCount;
|
||||
}
|
||||
break;
|
||||
case Programs.FTPCrackProgram:
|
||||
case Programs.FTPCrackProgram.name:
|
||||
if (s.ftpPortOpen) {
|
||||
post("FTP Port (21) is already open!");
|
||||
} else {
|
||||
@ -1856,7 +1857,7 @@ let Terminal = {
|
||||
++s.openPortCount;
|
||||
}
|
||||
break;
|
||||
case Programs.RelaySMTPProgram:
|
||||
case Programs.RelaySMTPProgram.name:
|
||||
if (s.smtpPortOpen) {
|
||||
post("SMTP Port (25) is already open!");
|
||||
} else {
|
||||
@ -1865,7 +1866,7 @@ let Terminal = {
|
||||
++s.openPortCount;
|
||||
}
|
||||
break;
|
||||
case Programs.HTTPWormProgram:
|
||||
case Programs.HTTPWormProgram.name:
|
||||
if (s.httpPortOpen) {
|
||||
post("HTTP Port (80) is already open!");
|
||||
} else {
|
||||
@ -1874,7 +1875,7 @@ let Terminal = {
|
||||
++s.openPortCount;
|
||||
}
|
||||
break;
|
||||
case Programs.SQLInjectProgram:
|
||||
case Programs.SQLInjectProgram.name:
|
||||
if (s.sqlPortOpen) {
|
||||
post("SQL Port (1433) is already open!");
|
||||
} else {
|
||||
@ -1883,7 +1884,7 @@ let Terminal = {
|
||||
++s.openPortCount;
|
||||
}
|
||||
break;
|
||||
case Programs.ServerProfiler:
|
||||
case Programs.ServerProfiler.name:
|
||||
if (splitArgs.length != 2) {
|
||||
post("Must pass a server hostname or IP as an argument for ServerProfiler.exe");
|
||||
return;
|
||||
@ -1901,22 +1902,23 @@ let Terminal = {
|
||||
post("Netscript grow() execution time: " + formatNumber(scriptCalculateGrowTime(serv)/1000, 1) + "s");
|
||||
post("Netscript weaken() execution time: " + formatNumber(scriptCalculateWeakenTime(serv)/1000, 1) + "s");
|
||||
break;
|
||||
case Programs.AutoLink:
|
||||
case Programs.AutoLink.name:
|
||||
post("This executable cannot be run.");
|
||||
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.");
|
||||
break;
|
||||
case Programs.DeepscanV1:
|
||||
case Programs.DeepscanV1.name:
|
||||
post("This executable cannot be run.");
|
||||
post("DeepscanV1.exe lets you run 'scan-analyze' with a depth up to 5.");
|
||||
break;
|
||||
case Programs.DeepscanV2:
|
||||
case Programs.DeepscanV2.name:
|
||||
post("This executable cannot be run.");
|
||||
post("DeepscanV2.exe lets you run 'scan-analyze' with a depth up to 10.");
|
||||
break;
|
||||
case Programs.Flight:
|
||||
case Programs.Flight.name:
|
||||
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("----------HACKING PATH----------");
|
||||
post("Hacking skill: " + Player.hacking_skill + " / 2500");
|
||||
@ -1926,7 +1928,7 @@ let Terminal = {
|
||||
post("Dexterity: " + Player.dexterity + " / 1500");
|
||||
post("Agility: " + Player.agility + " / 1500");
|
||||
break;
|
||||
case Programs.BitFlume:
|
||||
case Programs.BitFlume.name:
|
||||
var yesBtn = yesNoBoxGetYesButton(),
|
||||
noBtn = yesNoBoxGetNoButton();
|
||||
yesBtn.innerHTML = "Travel to BitNode Nexus";
|
||||
|
@ -1,65 +1,67 @@
|
||||
import {dialogBoxCreate} from "../utils/DialogBox.js";
|
||||
import {gameOptionsBoxOpen, gameOptionsBoxClose}from "../utils/GameOptions.js";
|
||||
import {dialogBoxCreate} from "../utils/DialogBox";
|
||||
import {gameOptionsBoxOpen, gameOptionsBoxClose}from "../utils/GameOptions";
|
||||
import {clearEventListeners, createElement,
|
||||
removeChildrenFromElement,
|
||||
exceptionAlert} from "../utils/HelperFunctions.js";
|
||||
exceptionAlert} from "../utils/HelperFunctions";
|
||||
import numeral from "numeral/min/numeral.min";
|
||||
import {formatNumber,
|
||||
convertTimeMsToTimeElapsedString} from "../utils/StringHelperFunctions.js";
|
||||
convertTimeMsToTimeElapsedString,
|
||||
replaceAt} from "../utils/StringHelperFunctions";
|
||||
import {loxBoxCreate, logBoxUpdateText,
|
||||
logBoxOpened} from "../utils/LogBox.js";
|
||||
logBoxOpened} from "../utils/LogBox";
|
||||
|
||||
import {updateActiveScriptsItems} from "./ActiveScriptsUI.js";
|
||||
import {updateActiveScriptsItems} from "./ActiveScriptsUI";
|
||||
import {Augmentations, installAugmentations,
|
||||
initAugmentations, AugmentationNames,
|
||||
displayAugmentationsContent,
|
||||
PlayerOwnedAugmentation} from "./Augmentations.js";
|
||||
PlayerOwnedAugmentation} from "./Augmentations";
|
||||
import {BitNodes, initBitNodes,
|
||||
initBitNodeMultipliers} from "./BitNode.js";
|
||||
import {Bladeburner} from "./Bladeburner.js";
|
||||
import {cinematicTextFlag} from "./CinematicText.js";
|
||||
import {CompanyPositions, initCompanies} from "./Company.js";
|
||||
import {Corporation} from "./CompanyManagement.js";
|
||||
import {CONSTANTS} from "./Constants.js";
|
||||
import {Programs, displayCreateProgramContent,
|
||||
initBitNodeMultipliers} from "./BitNode";
|
||||
import {Bladeburner} from "./Bladeburner";
|
||||
import {cinematicTextFlag} from "./CinematicText";
|
||||
import {CompanyPositions, initCompanies} from "./Company";
|
||||
import {Corporation} from "./CompanyManagement";
|
||||
import {CONSTANTS} from "./Constants";
|
||||
import {displayCreateProgramContent,
|
||||
getNumAvailableCreateProgram,
|
||||
initCreateProgramButtons} from "./CreateProgram.js";
|
||||
initCreateProgramButtons,
|
||||
Programs} from "./CreateProgram";
|
||||
import {displayFactionContent, joinFaction,
|
||||
processPassiveFactionRepGain, Factions,
|
||||
inviteToFaction, initFactions} from "./Faction.js";
|
||||
import {FconfSettings} from "./Fconf.js";
|
||||
inviteToFaction, initFactions} from "./Faction";
|
||||
import {FconfSettings} from "./Fconf";
|
||||
import {Locations, displayLocationContent,
|
||||
initLocationButtons} from "./Location.js";
|
||||
initLocationButtons} from "./Location";
|
||||
import {displayGangContent, updateGangContent,
|
||||
Gang} from "./Gang.js";
|
||||
Gang} from "./Gang";
|
||||
import {displayHacknetNodesContent, processAllHacknetNodeEarnings,
|
||||
updateHacknetNodesContent} from "./HacknetNode.js";
|
||||
import {iTutorialStart} from "./InteractiveTutorial.js";
|
||||
import {initLiterature} from "./Literature.js";
|
||||
import {checkForMessagesToSend, initMessages} from "./Message.js";
|
||||
import {inMission, currMission} from "./Missions.js";
|
||||
updateHacknetNodesContent} from "./HacknetNode";
|
||||
import {iTutorialStart} from "./InteractiveTutorial";
|
||||
import {initLiterature} from "./Literature";
|
||||
import {checkForMessagesToSend, initMessages} from "./Message";
|
||||
import {inMission, currMission} from "./Missions";
|
||||
import {initSingularitySFFlags,
|
||||
hasSingularitySF, hasCorporationSF} from "./NetscriptFunctions.js";
|
||||
hasSingularitySF, hasCorporationSF} from "./NetscriptFunctions";
|
||||
import {updateOnlineScriptTimes,
|
||||
runScriptsLoop} from "./NetscriptWorker.js";
|
||||
import {Player} from "./Player.js";
|
||||
runScriptsLoop} from "./NetscriptWorker";
|
||||
import {Player} from "./Player";
|
||||
import {prestigeAugmentation,
|
||||
prestigeSourceFile} from "./Prestige.js";
|
||||
import {redPillFlag, hackWorldDaemon} from "./RedPill.js";
|
||||
import {saveObject, loadGame} from "./SaveObject.js";
|
||||
prestigeSourceFile} from "./Prestige";
|
||||
import {redPillFlag, hackWorldDaemon} from "./RedPill";
|
||||
import {saveObject, loadGame} from "./SaveObject";
|
||||
import {loadAllRunningScripts, scriptEditorInit,
|
||||
updateScriptEditorContent} from "./Script.js";
|
||||
import {AllServers, Server, initForeignServers} from "./Server.js";
|
||||
import {Settings, setSettingsLabels} from "./Settings.js";
|
||||
updateScriptEditorContent} from "./Script";
|
||||
import {AllServers, Server, initForeignServers} from "./Server";
|
||||
import {Settings, setSettingsLabels} from "./Settings";
|
||||
import {initSourceFiles, SourceFiles,
|
||||
PlayerOwnedSourceFile} from "./SourceFile.js";
|
||||
import {SpecialServerIps, initSpecialServerIps} from "./SpecialServerIps.js";
|
||||
PlayerOwnedSourceFile} from "./SourceFile";
|
||||
import {SpecialServerIps, initSpecialServerIps} from "./SpecialServerIps";
|
||||
import {StockMarket, StockSymbols,
|
||||
SymbolToStockMap, initStockSymbols,
|
||||
initSymbolToStockMap, stockMarketCycle,
|
||||
updateStockPrices,
|
||||
displayStockMarketContent} from "./StockMarket.js";
|
||||
import {Terminal, postNetburnerText, post, KEY} from "./Terminal.js";
|
||||
displayStockMarketContent} from "./StockMarket";
|
||||
import {Terminal, postNetburnerText, post, KEY} from "./Terminal";
|
||||
|
||||
/* Shortcuts to navigate through the game
|
||||
* Alt-t - Terminal
|
||||
@ -1170,7 +1172,7 @@ let Engine = {
|
||||
|
||||
//Update progress bar
|
||||
while (Engine._actionProgressBarCount * 2 <= percent) {
|
||||
Engine._actionProgressStr = Engine._actionProgressStr.replaceAt(Engine._actionProgressBarCount, "|");
|
||||
Engine._actionProgressStr = replaceAt(Engine._actionProgressStr, Engine._actionProgressBarCount, "|");
|
||||
Engine._actionProgressBarCount += 1;
|
||||
}
|
||||
|
||||
@ -1736,13 +1738,6 @@ let Engine = {
|
||||
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 */
|
||||
|
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-inferrable-types": [
|
||||
true,
|
||||
false,
|
||||
"ignore-params",
|
||||
"ignore-properties"
|
||||
],
|
||||
|
@ -1,7 +1,7 @@
|
||||
import {Faction, joinFaction} from "../src/Faction.js";
|
||||
import {Engine} from "../src/engine.js";
|
||||
import {Player} from "../src/Player.js";
|
||||
import {clearEventListeners} from "./HelperFunctions.js";
|
||||
import {Faction, joinFaction} from "../src/Faction";
|
||||
import {Engine} from "../src/engine";
|
||||
import {Player} from "../src/Player";
|
||||
import {clearEventListeners} from "./HelperFunctions";
|
||||
|
||||
/* Faction Invitation Pop-up box */
|
||||
function factionInvitationBoxClose() {
|
||||
|
@ -1,6 +1,6 @@
|
||||
//General helper functions
|
||||
import {isString} from "./StringHelperFunctions.js";
|
||||
import {dialogBoxCreate} from "./DialogBox.js";
|
||||
import {isString} from "./StringHelperFunctions";
|
||||
import {dialogBoxCreate} from "./DialogBox";
|
||||
|
||||
//Returns the size (number of keys) of an object
|
||||
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*/
|
||||
|
||||
//Generate a random IP address
|
||||
|
@ -1,10 +1,10 @@
|
||||
import {BitNodeMultipliers} from "../src/BitNode.js";
|
||||
import {CONSTANTS} from "../src/Constants.js";
|
||||
import {Factions, Faction} from "../src/Faction.js";
|
||||
import {Player} from "../src/Player.js";
|
||||
import {dialogBoxCreate} from "./DialogBox.js";
|
||||
import {clearEventListeners} from "./HelperFunctions.js";
|
||||
import {formatNumber} from "./StringHelperFunctions.js";
|
||||
import {BitNodeMultipliers} from "../src/BitNode";
|
||||
import {CONSTANTS} from "../src/Constants";
|
||||
import {Factions, Faction} from "../src/Faction";
|
||||
import {Player} from "../src/Player";
|
||||
import {dialogBoxCreate} from "./DialogBox";
|
||||
import {clearEventListeners} from "./HelperFunctions";
|
||||
import {formatNumber} from "./StringHelperFunctions";
|
||||
|
||||
/* InfiltrationBox.js */
|
||||
function infiltrationBoxClose() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import {killWorkerScript} from "../src/NetscriptWorker.js";
|
||||
import {printArray, clearEventListeners} from "./HelperFunctions.js";
|
||||
import {killWorkerScript} from "../src/NetscriptWorker";
|
||||
import {printArray, clearEventListeners} from "./HelperFunctions";
|
||||
|
||||
$(document).keydown(function(event) {
|
||||
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
|
||||
* Can be used to create pop-up boxes that require a yes/no response from player
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user