Added hackAnalyze() functions. Fixed bug with gymWorkout() and Millenium Fitness Gym. Updated documentation for new functions

This commit is contained in:
danielyxie
2019-01-03 00:39:32 -08:00
parent d2c8de3fb0
commit 23eb6908e0
14 changed files with 1126 additions and 775 deletions

View File

@@ -74,6 +74,64 @@ weaken
weaken("foodnstuff");
hackAnalyzeThreads
^^^^^^^^^^^^^^^^
.. js:function:: hackAnalyzeThreads(hostname/ip, hackAmount)
:param string hostname/ip: IP or hostname of server to analyze
:param number hackAmount: Amount of money you want to hack from the server
:returns: The number of threads needed to hack() the server for *hackAmount* money
:RAM cost: 1 GB
This function returns the number of script threads you need when running
the `hack()` command to steal the specified amount of money from the target server.
If `hackAmount` is less than zero or greater than the amount of money available
on the server, then this function returns -1.
For example, let's say the `foodnstuff` server has $10m and you run::
hackAnalyzeThreads("foodnstuff", 1e6);
If this function returns 50, this means that if your next `hack()` call
is run on a script with 50 threads, it will steal $1m from the `foodnstuff` server.
**Warning**: The value returned by this function isn't necessarily a whole number.
hackAnalyzePercent
^^^^^^^^^^^^^^^^^^
.. js:function:: hackAnalyzePercent(hostname/ip)
:param string hostname/ip: IP or hostname of target server
:returns: The percentage of money you will steal from the target server with a single hack
:RAM cost: 1 GB
Returns the percentage of the specified server's money you will steal with a
single hack. This value is returned in **percentage form, not decimal (Netscript
functions typically return in decimal form, but not this one).**
For example, assume the following returns 1::
hackAnalyzePercent("foodnstuff");
This means that if hack the `foodnstuff` server, then you will steal 1% of its
total money. If you `hack()` using N threads, then you will steal N% of its total
money.
hackChance
^^^^^^^^^^
.. js:function:: hackChance(hostname/ip)
:param string hostname/ip: IP or hostname of target server
:returns: The chance you have of successfully hacking the target server
:RAM cost: 1 GB
Returns the chance you have of successfully hacking the specified server. This
returned value is in decimal form, not percentage.
growthAnalyze
^^^^^^^^^^^^^