mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-17 06:48:42 +02:00
Added hackAnalyze() functions. Fixed bug with gymWorkout() and Millenium Fitness Gym. Updated documentation for new functions
This commit is contained in:
@@ -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
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
|
||||
@@ -31,6 +31,12 @@ purchase will have the name "hacknet-node-0" and is referenced using index 0.
|
||||
The fifth Hacknet Node you purchase will have the name "hacknet-node-4" and is
|
||||
referenced using index 4.
|
||||
|
||||
RAM Cost
|
||||
--------
|
||||
Accessing the `hacknet` namespace incurs a one time cost of 4 GB of RAM.
|
||||
In other words, using multiple Hacknet Node API functions in a script will not cost
|
||||
more than 4 GB of RAM.
|
||||
|
||||
numNodes
|
||||
--------
|
||||
.. js:function:: numNodes()
|
||||
@@ -150,7 +156,7 @@ getCoreUpgradeCost
|
||||
Returns the cost of upgrading the number of cores of the specified Hacknet Node by *n*.
|
||||
|
||||
If an invalid value for *n* is provided, then this function returns 0. If the
|
||||
specified Hacknet Node is already at the max number of cores, then Infinity is returned.
|
||||
specified Hacknet Node is already at the max number of cores, then Infinity is returned.
|
||||
|
||||
Utilities
|
||||
---------
|
||||
|
||||
@@ -15,6 +15,8 @@ getStockSymbols
|
||||
|
||||
.. js:function:: getStockSymbols()
|
||||
|
||||
:RAM cost: 2 GB
|
||||
|
||||
Returns an array of the symbols of the tradable stocks
|
||||
|
||||
getStockPrice
|
||||
@@ -23,6 +25,7 @@ getStockPrice
|
||||
.. js:function:: getStockPrice(sym)
|
||||
|
||||
:param string sym: Stock symbol
|
||||
:RAM cost: 2 GB
|
||||
|
||||
Returns the price of a stock, given its symbol (NOT the company name). The symbol is a sequence
|
||||
of two to four capital letters.
|
||||
@@ -37,6 +40,7 @@ getStockPosition
|
||||
.. js:function:: getStockPosition(sym)
|
||||
|
||||
:param string sym: Stock symbol
|
||||
:RAM cost: 2 GB
|
||||
|
||||
Returns an array of four elements that represents the player's position in a stock.
|
||||
|
||||
@@ -65,6 +69,7 @@ buyStock
|
||||
|
||||
:param string sym: Symbol of stock to purchase
|
||||
:param number shares: Number of shares to purchased. Must be positive. Will be rounded to nearest integer
|
||||
:RAM cost: 2.5 GB
|
||||
|
||||
Attempts to purchase shares of a stock using a `Market Order <http://bitburner.wikia.com/wiki/Stock_Market#Order_Types>`_.
|
||||
|
||||
@@ -81,6 +86,7 @@ sellStock
|
||||
|
||||
:param string sym: Symbol of stock to sell
|
||||
:param number shares: Number of shares to sell. Must be positive. Will be rounded to nearest integer
|
||||
:RAM cost: 2.5 GB
|
||||
|
||||
Attempts to sell shares of a stock using a `Market Order <http://bitburner.wikia.com/wiki/Stock_Market#Order_Types>`_.
|
||||
|
||||
@@ -101,6 +107,7 @@ shortStock
|
||||
|
||||
:param string sym: Symbol of stock to short
|
||||
:param number shares: Number of shares to short. Must be positive. Will be rounded to nearest integer
|
||||
:RAM cost: 2.5 GB
|
||||
|
||||
Attempts to purchase a `short <http://bitburner.wikia.com/wiki/Stock_Market#Positions:_Long_vs_Short>`_ position of a stock
|
||||
using a `Market Order <http://bitburner.wikia.com/wiki/Stock_Market#Order_Types>`_.
|
||||
@@ -119,6 +126,7 @@ sellShort
|
||||
|
||||
:param string sym: Symbol of stock to sell
|
||||
:param number shares: Number of shares to sell. Must be positive. Will be rounded to nearest integer
|
||||
:RAM cost: 2.5 GB
|
||||
|
||||
Attempts to sell a `short <http://bitburner.wikia.com/wiki/Stock_Market#Positions:_Long_vs_Short>`_ position of a stock
|
||||
using a `Market Order <http://bitburner.wikia.com/wiki/Stock_Market#Order_Types>`_.
|
||||
@@ -149,6 +157,7 @@ placeOrder
|
||||
:param string pos:
|
||||
Specifies whether the order is a "Long" or "Short" position. The Values "L" or "S" can also be used. This is
|
||||
NOT case-sensitive.
|
||||
:RAM cost: 2.5 GB
|
||||
|
||||
Places an order on the stock market. This function only works for `Limit and Stop Orders <http://bitburner.wikia.com/wiki/Stock_Market#Order_Types>`_.
|
||||
|
||||
@@ -175,17 +184,88 @@ cancelOrder
|
||||
:param string pos:
|
||||
Specifies whether the order is a "Long" or "Short" position. The Values "L" or "S" can also be used. This is
|
||||
NOT case-sensitive.
|
||||
:RAM cost: 2.5 GB
|
||||
|
||||
Cancels an oustanding Limit or Stop order on the stock market.
|
||||
|
||||
The ability to use limit and stop orders is **not** immediately available to the player and must be unlocked later on in the game.
|
||||
|
||||
getOrders
|
||||
---------
|
||||
|
||||
.. js:function:: getOrders()
|
||||
|
||||
:RAM cost: 2.5 GB
|
||||
|
||||
Returns your order book for the stock market. This is an object containing information
|
||||
for all the Limit and Stop Orders you have in the stock market.
|
||||
|
||||
The object has the following structure::
|
||||
|
||||
{
|
||||
StockSymbol1: [ // Array of orders for this stock
|
||||
{
|
||||
shares: Order quantity
|
||||
price: Order price
|
||||
type: Order type
|
||||
position: Either "L" or "S" for Long or Short position
|
||||
},
|
||||
{
|
||||
...
|
||||
},
|
||||
...
|
||||
],
|
||||
StockSymbol2: [ // Array of orders for this stock
|
||||
...
|
||||
],
|
||||
...
|
||||
}
|
||||
|
||||
The "Order type" property can have one of the following four values:
|
||||
|
||||
* "Limit Buy Order"
|
||||
* "Limit Sell Order"
|
||||
* "Stop Buy Order"
|
||||
* "Stop Sell Order"
|
||||
|
||||
**Note that the order book will only contain information for stocks that you actually
|
||||
have orders in**. For example, if you do not have orders in Nova Medical (NVMD), then the returned
|
||||
object will not have a "NVMD" property.
|
||||
|
||||
Example::
|
||||
|
||||
{
|
||||
ECP: [
|
||||
{
|
||||
shares: 5,
|
||||
price: 100,000
|
||||
type: "Stop Buy Order",
|
||||
position: "S",
|
||||
},
|
||||
{
|
||||
shares: 25,
|
||||
price: 125,000
|
||||
type: "Limit Sell Order",
|
||||
position: "L",
|
||||
},
|
||||
],
|
||||
SYSC: [
|
||||
{
|
||||
shares: 100,
|
||||
price: 10,000
|
||||
type: "Limit Buy Order",
|
||||
position: "L",
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
getStockVolatility
|
||||
------------------
|
||||
|
||||
.. js:function:: getStockVolatility(sym)
|
||||
|
||||
:param string sym: Symbol of stock
|
||||
:RAM cost: 2.5 GB
|
||||
|
||||
Returns the volatility of the specified stock.
|
||||
|
||||
@@ -203,6 +283,7 @@ getStockForecast
|
||||
.. js:function:: getStockForecast(sym)
|
||||
|
||||
:param string sym: Symbol of stock
|
||||
:RAM cost: 2.5 GB
|
||||
|
||||
Returns the probability that the specified stock's price will increase
|
||||
(as opposed to decrease) during the next tick.
|
||||
@@ -220,6 +301,8 @@ purchase4SMarketData
|
||||
|
||||
.. js:function:: purchase4SMarketData()
|
||||
|
||||
:RAM cost: 2.5 GB
|
||||
|
||||
Purchase 4S Market Data Access.
|
||||
|
||||
Returns true if you successfully purchased it or if you already have access.
|
||||
@@ -230,6 +313,8 @@ purchase4SMarketDataTixApi
|
||||
|
||||
.. js:function:: purchase4SMarketDataTixApi()
|
||||
|
||||
:RAM cost: 2.5 GB
|
||||
|
||||
Purchase 4S Market Data TIX API Access.
|
||||
|
||||
Returns true if you successfully purchased it or if you already have access.
|
||||
|
||||
Reference in New Issue
Block a user