Merge pull request #1586 from danielyxie/dev

v0.58.0 - Road to Steam
This commit is contained in:
hydroflame 2021-10-27 15:24:21 -04:00 committed by GitHub
commit 288987a93d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 519 additions and 413 deletions

@ -3,6 +3,65 @@
Changelog
=========
v0.58.0 - 2021-10-27 Road to Steam (hydroflame & community)
-------------------------------------------
** Announcement **
* To prepare for Steam we will fix some inconsistencies in the Netscript API. Ideally we can also write a
save file migration that will automatically convert all breaking changes in your scripts without any
player input.
** BREAKING (kindof) **
* All stock market functions are now under the 'stock' namespace, like 'hacknet'
However when you load your game with v0.58.0 for the first time it should automatically convert everything.
** SF -1 **
* new SF -1: Reality Alteration
** Gang **
* Ascension formula now better
* Karma requirement now much lower in most nodes
* Territory heavily penalizes gains
* T.R.P. not available outside BN2.
** Netscript **
* It is no longer possible to send anything but strings or numbers to other scripts. (prevents exploits)
* Improve code for some netscript functions (@omuretsu)
** Script Editor **
* Added Solarized light/dark as theme (@CalvinTrops)
* Fixed sleeve namespace smart autocomplete.
** Hacknet Servers **
* Cores affect grow/weaken like they do on home computer
** Infiltration **
* Slash game modified to be easier.
** Misc. **
* Fix typo in corp (@Saynt_Garmo)
* Fixed a bug where corp wouldn't let you buyback shares. (@Saynt_Garmo)
* Fixed a bug where sleeves couldn't perform some crimes. (@Saynt_Garmo)
* Hospitalization and Eating noodles are now toasts (@Saynt_Garmo)
* Fixed some repeated code (@omuretsu)
* Fixed Character Overview preventing clicks underneath it even when hidden. (@omuretsu)
* Fixed typo in tutorial. (@omuretsu)
* Create Programs and Factions invitation badges now dissapear when you open their respective pages.
* Add killall script in character overview.
* Fixed bug in corp that made last city production be the production for all cities for newly created product.
* Fix bug that allowed reputation to transfer to new jobs.
* Fixed memory leak with ns2.
* nerf noodle bar
v0.57.0 - 2021-10-16 It was too cheap! (hydroflame & community)
-------------------------------------------

@ -64,9 +64,9 @@ documentation_title = '{0} Documentation'.format(project)
# built documents.
#
# The short X.Y version.
version = '0.57'
version = '0.58'
# The full version, including alpha/beta/rc tags.
release = '0.57.0'
release = '0.58.0'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.

@ -13,25 +13,27 @@ TIX API can be purchased by visiting the World Stock Exchange in-game.
Access to the TIX API currently costs $5 billion. After you purchase it, you will retain this
access even after you 'reset' by installing Augmentations
**TIX API functions must be accessed through the stock namespace**
.. toctree::
:caption: API Functions:
getStockSymbols() <tixapi/getStockSymbols>
getStockPrice() <tixapi/getStockPrice>
getStockAskPrice() <tixapi/getStockAskPrice>
getStockBidPrice() <tixapi/getStockBidPrice>
getStockPosition() <tixapi/getStockPosition>
getStockMaxShares() <tixapi/getStockMaxShares>
getStockPurchaseCost() <tixapi/getStockPurchaseCost>
getStockSaleGain() <tixapi/getStockSaleGain>
buyStock() <tixapi/buyStock>
sellStock() <tixapi/sellStock>
shortStock() <tixapi/shortStock>
getSymbols() <tixapi/getSymbols>
getPrice() <tixapi/getPrice>
getAskPrice() <tixapi/getAskPrice>
getBidPrice() <tixapi/getBidPrice>
getPosition() <tixapi/getPosition>
getMaxShares() <tixapi/getMaxShares>
getPurchaseCost() <tixapi/getPurchaseCost>
getSaleGain() <tixapi/getSaleGain>
buy() <tixapi/buy>
sell() <tixapi/sell>
short() <tixapi/short>
sellShort() <tixapi/sellShort>
placeOrder() <tixapi/placeOrder>
cancelOrder() <tixapi/cancelOrder>
getOrders() <tixapi/getOrders>
getStockVolatility() <tixapi/getStockVolatility>
getStockForecast() <tixapi/getStockForecast>
getVolatility() <tixapi/getVolatility>
getForecast() <tixapi/getForecast>
purchase4SMarketData() <tixapi/purchase4SMarketData>
purchase4SMarketDataTixApi() <tixapi/purchase4SMarketDataTixApi>

@ -1,7 +1,7 @@
buyStock() Netscript Function
buy() Netscript Function
=============================
.. js:function:: buyStock(sym, shares)
.. js:function:: buy(sym, shares)
:RAM cost: 2.5 GB
:param string sym: Symbol of stock to purchase

@ -1,7 +1,7 @@
getStockAskPrice() Netscript Function
getAskPrice() Netscript Function
=====================================
.. js:function:: getStockAskPrice(sym)
.. js:function:: getAskPrice(sym)
:RAM cost: 2 GB
:param string sym: Stock symbol

@ -1,7 +1,7 @@
getStockBidPrice() Netscript Function
getBidPrice() Netscript Function
=====================================
.. js:function:: getStockBidPrice(sym)
.. js:function:: getBidPrice(sym)
:RAM cost: 2 GB
:param string sym: Stock symbol

@ -1,7 +1,7 @@
getStockForecast() Netscript Function
getForecast() Netscript Function
=====================================
.. js:function:: getStockForecast(sym)
.. js:function:: getForecast(sym)
:RAM cost: 2.5 GB
:param string sym: Symbol of stock

@ -1,7 +1,7 @@
getStockMaxShares() Netscript Function
getMaxShares() Netscript Function
======================================
.. js:function:: getStockMaxShares(sym)
.. js:function:: getMaxShares(sym)
:RAM cost: 2 GB
:param string sym: Stock symbol

@ -1,7 +1,7 @@
getStockPosition() Netscript Function
getPosition() Netscript Function
=====================================
.. js:function:: getStockPosition(sym)
.. js:function:: getPosition(sym)
:RAM cost: 2 GB
:param string sym: Stock symbol
@ -21,7 +21,7 @@ getStockPosition() Netscript Function
Example::
pos = getStockPosition("ECP");
pos = getPosition("ECP");
shares = pos[0];
avgPx = pos[1];
sharesShort = pos[2];

@ -1,7 +1,7 @@
getStockPrice() Netscript Function
getPrice() Netscript Function
==================================
.. js:function:: getStockPrice(sym)
.. js:function:: getPrice(sym)
:RAM cost: 2 GB
:param string sym: Stock symbol
@ -15,4 +15,4 @@ getStockPrice() Netscript Function
Example::
getStockPrice("FSIG");
getPrice("FSIG");

@ -1,7 +1,7 @@
getStockPurchaseCost() Netscript Function
getPurchaseCost() Netscript Function
=========================================
.. js:function:: getStockPurchaseCost(sym, shares, posType)
.. js:function:: getPurchaseCost(sym, shares, posType)
:RAM cost: 2 GB
:param string sym: Stock symbol

@ -1,7 +1,7 @@
getStockSaleGain() Netscript Function
getSaleGain() Netscript Function
=====================================
.. js:function:: getStockSaleGain(sym, shares, posType)
.. js:function:: getSaleGain(sym, shares, posType)
:RAM cost: 2 GB
:param string sym: Stock symbol

@ -1,7 +1,7 @@
getStockSymbols() Netscript Function()
getSymbols() Netscript Function()
======================================
.. js:function:: getStockSymbols()
.. js:function:: getSymbols()
:RAM cost: 2 GB

@ -1,7 +1,7 @@
sellStock() Netscript Function
sell() Netscript Function
==============================
.. js:function:: sellStock(sym, shares)
.. js:function:: sell(sym, shares)
:RAM cost: 2.5 GB
:param string sym: Symbol of stock to sell

@ -1,7 +1,7 @@
shortStock() Netscript Function
short() Netscript Function
===============================
.. js:function:: shortStock(sym, shares)
.. js:function:: short(sym, shares)
:RAM cost: 2.5 GB
:param string sym: Symbol of stock to short

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1,7 +1,7 @@
{
"name": "bitburner",
"license": "SEE LICENSE IN license.txt",
"version": "0.56.0",
"version": "0.58.0",
"main": "electron-main.js",
"author": {
"name": "Daniel Xie"

@ -114,7 +114,7 @@ export const CONSTANTS: {
TotalNumBitNodes: number;
LatestUpdate: string;
} = {
Version: "0.57.0",
Version: "0.58.0",
// Speed (in ms) at which the main loop is updated
_idleSpeed: 200,
@ -281,55 +281,64 @@ export const CONSTANTS: {
TotalNumBitNodes: 24,
LatestUpdate: `
v0.57.0 - 2021-10-16 It was too cheap! (hydroflame & community)
v0.58.0 - 2021-10-27 Road to Steam (hydroflame & community)
-------------------------------------------
** Announcement **
* To prepare for Steam we will fix some inconsistencies in the Netscript API. Ideally we can also write a
save file migration that will automatically convert all breaking changes in your scripts without any
player input.
** BREAKING (kindof) **
* purchased server cost now scales exponentially past 2^10.
I'm going to actually explain this one: Currently the cost of a 2^20GB server is 57b
Most players can get that before their first install. In an effort to nerf good players
a softcap was added. This softcap is different for every BN.
* All stock market functions are now under the 'stock' namespace, like 'hacknet'
However when you load your game with v0.58.0 for the first time it should automatically convert everything.
** Script Editor **
** SF -1 **
* Added a theme that is close to monokai. Unfortunately a full monokai is impossible because
Monaco doesn't have a very good tokenizer.
* Opening a file and connecting to a new server will still save the file on the server that the file
was opened.
* new SF -1: Reality Alteration
** Gang **
* Ascension formula now better
* Karma requirement now much lower in most nodes
* Territory heavily penalizes gains
* T.R.P. not available outside BN2.
** Netscript **
* New function: alert, which creates a textbox.
* New function: toast, creates a notification in the bottom right.
* New function: upgradeHomeCores (@Saynt_Garmo)
* New function: atExit, allows you to set a callback for when the script closes.
* New kindof function: autocomplete, this allows you to tell the game what it should
autocomplete on the terminal.
* It is no longer possible to send anything but strings or numbers to other scripts. (prevents exploits)
* Improve code for some netscript functions (@omuretsu)
** Augmentation **
** Script Editor **
* ENM Core (the Augmentation from The Black Hand with the highest rep cost) rep cost
reduced from 250 to 175. This will help new players transition from TBH to BitRunners more easily.
* Added Solarized light/dark as theme (@CalvinTrops)
* Added theme clo
* Fixed sleeve namespace smart autocomplete.
** Bladeburner **
** Hacknet Servers **
* New general action: Incite Violence. This action adds other action counts but increases chaos.
* Cores affect grow/weaken like they do on home computer
** Infiltration **
* Slash game modified to be easier.
** Misc. **
* Current bladeburner action is shown on the character overview.
* Fix blackop being #000 on #000.
* The last clicked Tail Box goes in front of the others.
* Fixed an issue where some values were loaded as 0 when they should be null.
* Implemented toasts.
* .msg are no longer saved in the text file.
* Tail boxes no longer display all the args, they use "..." after 30 characters.
* Fixed cancelation penalty bonus not being properly applied after the IP <-> hostname switch.
* Fixed an exploit where you could send non-strings or numbers to other scripts.
* Fixed issue when trying to work for a faction with a work type that doesn't exist while
already working for that faction.
* Fixed not being able to work for the CIA. (Don't ask)
* Fix typo in corp (@Saynt_Garmo)
* Fixed a bug where corp wouldn't let you buyback shares. (@Saynt_Garmo)
* Fixed a bug where sleeves couldn't perform some crimes. (@Saynt_Garmo)
* Hospitalization and Eating noodles are now toasts (@Saynt_Garmo)
* Fixed some repeated code (@omuretsu)
* Fixed Character Overview preventing clicks underneath it even when hidden. (@omuretsu)
* Fixed typo in tutorial. (@omuretsu)
* Create Programs and Factions invitation badges now dissapear when you open their respective pages.
* Add killall script in character overview.
* Fixed bug in corp that made last city production be the production for all cities for newly created product.
* Fix bug that allowed reputation to transfer to new jobs.
* Fixed memory leak with ns2.
* nerf noodle bar
`,
};

@ -58,264 +58,266 @@ export const RamCostConstants: IMap<number> = {
export const RamCosts: IMap<any> = {
hacknet: {
numNodes: () => 0,
purchaseNode: () => 0,
getPurchaseNodeCost: () => 0,
getNodeStats: () => 0,
upgradeLevel: () => 0,
upgradeRam: () => 0,
upgradeCore: () => 0,
upgradeCache: () => 0,
getLevelUpgradeCost: () => 0,
getRamUpgradeCost: () => 0,
getCoreUpgradeCost: () => 0,
getCacheUpgradeCost: () => 0,
numHashes: () => 0,
hashCost: () => 0,
spendHashes: () => 0,
numNodes: 0,
purchaseNode: 0,
getPurchaseNodeCost: 0,
getNodeStats: 0,
upgradeLevel: 0,
upgradeRam: 0,
upgradeCore: 0,
upgradeCache: 0,
getLevelUpgradeCost: 0,
getRamUpgradeCost: 0,
getCoreUpgradeCost: 0,
getCacheUpgradeCost: 0,
numHashes: 0,
hashCost: 0,
spendHashes: 0,
},
sprintf: () => 0,
vsprintf: () => 0,
scan: () => RamCostConstants.ScriptScanRamCost,
hack: () => RamCostConstants.ScriptHackRamCost,
hackAnalyzeThreads: () => RamCostConstants.ScriptHackAnalyzeRamCost,
hackAnalyzePercent: () => RamCostConstants.ScriptHackAnalyzeRamCost,
hackChance: () => RamCostConstants.ScriptHackAnalyzeRamCost,
sleep: () => 0,
grow: () => RamCostConstants.ScriptGrowRamCost,
growthAnalyze: () => RamCostConstants.ScriptGrowthAnalyzeRamCost,
weaken: () => RamCostConstants.ScriptWeakenRamCost,
print: () => 0,
tprint: () => 0,
clearLog: () => 0,
disableLog: () => 0,
enableLog: () => 0,
isLogEnabled: () => 0,
getScriptLogs: () => 0,
nuke: () => RamCostConstants.ScriptPortProgramRamCost,
brutessh: () => RamCostConstants.ScriptPortProgramRamCost,
ftpcrack: () => RamCostConstants.ScriptPortProgramRamCost,
relaysmtp: () => RamCostConstants.ScriptPortProgramRamCost,
httpworm: () => RamCostConstants.ScriptPortProgramRamCost,
sqlinject: () => RamCostConstants.ScriptPortProgramRamCost,
run: () => RamCostConstants.ScriptRunRamCost,
exec: () => RamCostConstants.ScriptExecRamCost,
spawn: () => RamCostConstants.ScriptSpawnRamCost,
kill: () => RamCostConstants.ScriptKillRamCost,
killall: () => RamCostConstants.ScriptKillRamCost,
exit: () => 0,
scp: () => RamCostConstants.ScriptScpRamCost,
ls: () => RamCostConstants.ScriptScanRamCost,
ps: () => RamCostConstants.ScriptScanRamCost,
hasRootAccess: () => RamCostConstants.ScriptHasRootAccessRamCost,
getIp: () => RamCostConstants.ScriptGetHostnameRamCost,
getHostname: () => RamCostConstants.ScriptGetHostnameRamCost,
getHackingLevel: () => RamCostConstants.ScriptGetHackingLevelRamCost,
getHackingMultipliers: () => RamCostConstants.ScriptGetMultipliersRamCost,
getHacknetMultipliers: () => RamCostConstants.ScriptGetMultipliersRamCost,
getBitNodeMultipliers: () => RamCostConstants.ScriptGetMultipliersRamCost,
getServer: () => RamCostConstants.ScriptGetMultipliersRamCost / 2,
getServerMoneyAvailable: () => RamCostConstants.ScriptGetServerRamCost,
getServerSecurityLevel: () => RamCostConstants.ScriptGetServerRamCost,
getServerBaseSecurityLevel: () => RamCostConstants.ScriptGetServerRamCost,
getServerMinSecurityLevel: () => RamCostConstants.ScriptGetServerRamCost,
getServerRequiredHackingLevel: () => RamCostConstants.ScriptGetServerRamCost,
getServerMaxMoney: () => RamCostConstants.ScriptGetServerRamCost,
getServerGrowth: () => RamCostConstants.ScriptGetServerRamCost,
getServerNumPortsRequired: () => RamCostConstants.ScriptGetServerRamCost,
getServerRam: () => RamCostConstants.ScriptGetServerRamCost,
getServerMaxRam: () => RamCostConstants.ScriptGetServerMaxRam,
getServerUsedRam: () => RamCostConstants.ScriptGetServerUsedRam,
serverExists: () => RamCostConstants.ScriptGetServerRamCost,
fileExists: () => RamCostConstants.ScriptFileExistsRamCost,
isRunning: () => RamCostConstants.ScriptIsRunningRamCost,
getStockSymbols: () => RamCostConstants.ScriptGetStockRamCost,
getStockPrice: () => RamCostConstants.ScriptGetStockRamCost,
getStockAskPrice: () => RamCostConstants.ScriptGetStockRamCost,
getStockBidPrice: () => RamCostConstants.ScriptGetStockRamCost,
getStockPosition: () => RamCostConstants.ScriptGetStockRamCost,
getStockMaxShares: () => RamCostConstants.ScriptGetStockRamCost,
getStockPurchaseCost: () => RamCostConstants.ScriptGetStockRamCost,
getStockSaleGain: () => RamCostConstants.ScriptGetStockRamCost,
buyStock: () => RamCostConstants.ScriptBuySellStockRamCost,
sellStock: () => RamCostConstants.ScriptBuySellStockRamCost,
shortStock: () => RamCostConstants.ScriptBuySellStockRamCost,
sellShort: () => RamCostConstants.ScriptBuySellStockRamCost,
placeOrder: () => RamCostConstants.ScriptBuySellStockRamCost,
cancelOrder: () => RamCostConstants.ScriptBuySellStockRamCost,
getOrders: () => RamCostConstants.ScriptBuySellStockRamCost,
getStockVolatility: () => RamCostConstants.ScriptBuySellStockRamCost,
getStockForecast: () => RamCostConstants.ScriptBuySellStockRamCost,
purchase4SMarketData: () => RamCostConstants.ScriptBuySellStockRamCost,
purchase4SMarketDataTixApi: () => RamCostConstants.ScriptBuySellStockRamCost,
getPurchasedServerLimit: () => RamCostConstants.ScriptGetPurchasedServerLimit,
getPurchasedServerMaxRam: () => RamCostConstants.ScriptGetPurchasedServerMaxRam,
getPurchasedServerCost: () => RamCostConstants.ScriptGetPurchaseServerRamCost,
purchaseServer: () => RamCostConstants.ScriptPurchaseServerRamCost,
deleteServer: () => RamCostConstants.ScriptPurchaseServerRamCost,
getPurchasedServers: () => RamCostConstants.ScriptPurchaseServerRamCost,
write: () => RamCostConstants.ScriptReadWriteRamCost,
tryWrite: () => RamCostConstants.ScriptReadWriteRamCost,
read: () => RamCostConstants.ScriptReadWriteRamCost,
peek: () => RamCostConstants.ScriptReadWriteRamCost,
clear: () => RamCostConstants.ScriptReadWriteRamCost,
getPortHandle: () => RamCostConstants.ScriptReadWriteRamCost * 10,
rm: () => RamCostConstants.ScriptReadWriteRamCost,
scriptRunning: () => RamCostConstants.ScriptArbScriptRamCost,
scriptKill: () => RamCostConstants.ScriptArbScriptRamCost,
getScriptName: () => 0,
getScriptRam: () => RamCostConstants.ScriptGetScriptRamCost,
getHackTime: () => RamCostConstants.ScriptGetHackTimeRamCost,
getGrowTime: () => RamCostConstants.ScriptGetHackTimeRamCost,
getWeakenTime: () => RamCostConstants.ScriptGetHackTimeRamCost,
getScriptIncome: () => RamCostConstants.ScriptGetScriptRamCost,
getScriptExpGain: () => RamCostConstants.ScriptGetScriptRamCost,
getRunningScript: () => RamCostConstants.ScriptGetRunningScriptRamCost,
nFormat: () => 0,
getTimeSinceLastAug: () => RamCostConstants.ScriptGetHackTimeRamCost,
prompt: () => 0,
wget: () => 0,
getFavorToDonate: () => RamCostConstants.ScriptGetFavorToDonate,
sprintf: 0,
vsprintf: 0,
scan: RamCostConstants.ScriptScanRamCost,
hack: RamCostConstants.ScriptHackRamCost,
hackAnalyzeThreads: RamCostConstants.ScriptHackAnalyzeRamCost,
hackAnalyzePercent: RamCostConstants.ScriptHackAnalyzeRamCost,
hackChance: RamCostConstants.ScriptHackAnalyzeRamCost,
sleep: 0,
grow: RamCostConstants.ScriptGrowRamCost,
growthAnalyze: RamCostConstants.ScriptGrowthAnalyzeRamCost,
weaken: RamCostConstants.ScriptWeakenRamCost,
print: 0,
tprint: 0,
clearLog: 0,
disableLog: 0,
enableLog: 0,
isLogEnabled: 0,
getScriptLogs: 0,
nuke: RamCostConstants.ScriptPortProgramRamCost,
brutessh: RamCostConstants.ScriptPortProgramRamCost,
ftpcrack: RamCostConstants.ScriptPortProgramRamCost,
relaysmtp: RamCostConstants.ScriptPortProgramRamCost,
httpworm: RamCostConstants.ScriptPortProgramRamCost,
sqlinject: RamCostConstants.ScriptPortProgramRamCost,
run: RamCostConstants.ScriptRunRamCost,
exec: RamCostConstants.ScriptExecRamCost,
spawn: RamCostConstants.ScriptSpawnRamCost,
kill: RamCostConstants.ScriptKillRamCost,
killall: RamCostConstants.ScriptKillRamCost,
exit: 0,
scp: RamCostConstants.ScriptScpRamCost,
ls: RamCostConstants.ScriptScanRamCost,
ps: RamCostConstants.ScriptScanRamCost,
hasRootAccess: RamCostConstants.ScriptHasRootAccessRamCost,
getIp: RamCostConstants.ScriptGetHostnameRamCost,
getHostname: RamCostConstants.ScriptGetHostnameRamCost,
getHackingLevel: RamCostConstants.ScriptGetHackingLevelRamCost,
getHackingMultipliers: RamCostConstants.ScriptGetMultipliersRamCost,
getHacknetMultipliers: RamCostConstants.ScriptGetMultipliersRamCost,
getBitNodeMultipliers: RamCostConstants.ScriptGetMultipliersRamCost,
getServer: RamCostConstants.ScriptGetMultipliersRamCost / 2,
getServerMoneyAvailable: RamCostConstants.ScriptGetServerRamCost,
getServerSecurityLevel: RamCostConstants.ScriptGetServerRamCost,
getServerBaseSecurityLevel: RamCostConstants.ScriptGetServerRamCost,
getServerMinSecurityLevel: RamCostConstants.ScriptGetServerRamCost,
getServerRequiredHackingLevel: RamCostConstants.ScriptGetServerRamCost,
getServerMaxMoney: RamCostConstants.ScriptGetServerRamCost,
getServerGrowth: RamCostConstants.ScriptGetServerRamCost,
getServerNumPortsRequired: RamCostConstants.ScriptGetServerRamCost,
getServerRam: RamCostConstants.ScriptGetServerRamCost,
getServerMaxRam: RamCostConstants.ScriptGetServerMaxRam,
getServerUsedRam: RamCostConstants.ScriptGetServerUsedRam,
serverExists: RamCostConstants.ScriptGetServerRamCost,
fileExists: RamCostConstants.ScriptFileExistsRamCost,
isRunning: RamCostConstants.ScriptIsRunningRamCost,
stock: {
getSymbols: RamCostConstants.ScriptGetStockRamCost,
getPrice: RamCostConstants.ScriptGetStockRamCost,
getAskPrice: RamCostConstants.ScriptGetStockRamCost,
getBidPrice: RamCostConstants.ScriptGetStockRamCost,
getPosition: RamCostConstants.ScriptGetStockRamCost,
getMaxShares: RamCostConstants.ScriptGetStockRamCost,
getPurchaseCost: RamCostConstants.ScriptGetStockRamCost,
getSaleGain: RamCostConstants.ScriptGetStockRamCost,
buy: RamCostConstants.ScriptBuySellStockRamCost,
sell: RamCostConstants.ScriptBuySellStockRamCost,
short: RamCostConstants.ScriptBuySellStockRamCost,
sellShort: RamCostConstants.ScriptBuySellStockRamCost,
placeOrder: RamCostConstants.ScriptBuySellStockRamCost,
cancelOrder: RamCostConstants.ScriptBuySellStockRamCost,
getOrders: RamCostConstants.ScriptBuySellStockRamCost,
getVolatility: RamCostConstants.ScriptBuySellStockRamCost,
getForecast: RamCostConstants.ScriptBuySellStockRamCost,
purchase4SMarketData: RamCostConstants.ScriptBuySellStockRamCost,
purchase4SMarketDataTixApi: RamCostConstants.ScriptBuySellStockRamCost,
},
getPurchasedServerLimit: RamCostConstants.ScriptGetPurchasedServerLimit,
getPurchasedServerMaxRam: RamCostConstants.ScriptGetPurchasedServerMaxRam,
getPurchasedServerCost: RamCostConstants.ScriptGetPurchaseServerRamCost,
purchaseServer: RamCostConstants.ScriptPurchaseServerRamCost,
deleteServer: RamCostConstants.ScriptPurchaseServerRamCost,
getPurchasedServers: RamCostConstants.ScriptPurchaseServerRamCost,
write: RamCostConstants.ScriptReadWriteRamCost,
tryWrite: RamCostConstants.ScriptReadWriteRamCost,
read: RamCostConstants.ScriptReadWriteRamCost,
peek: RamCostConstants.ScriptReadWriteRamCost,
clear: RamCostConstants.ScriptReadWriteRamCost,
getPortHandle: RamCostConstants.ScriptReadWriteRamCost * 10,
rm: RamCostConstants.ScriptReadWriteRamCost,
scriptRunning: RamCostConstants.ScriptArbScriptRamCost,
scriptKill: RamCostConstants.ScriptArbScriptRamCost,
getScriptName: 0,
getScriptRam: RamCostConstants.ScriptGetScriptRamCost,
getHackTime: RamCostConstants.ScriptGetHackTimeRamCost,
getGrowTime: RamCostConstants.ScriptGetHackTimeRamCost,
getWeakenTime: RamCostConstants.ScriptGetHackTimeRamCost,
getScriptIncome: RamCostConstants.ScriptGetScriptRamCost,
getScriptExpGain: RamCostConstants.ScriptGetScriptRamCost,
getRunningScript: RamCostConstants.ScriptGetRunningScriptRamCost,
nFormat: 0,
getTimeSinceLastAug: RamCostConstants.ScriptGetHackTimeRamCost,
prompt: 0,
wget: 0,
getFavorToDonate: RamCostConstants.ScriptGetFavorToDonate,
// Singularity Functions
universityCourse: () => RamCostConstants.ScriptSingularityFn1RamCost,
gymWorkout: () => RamCostConstants.ScriptSingularityFn1RamCost,
travelToCity: () => RamCostConstants.ScriptSingularityFn1RamCost,
purchaseTor: () => RamCostConstants.ScriptSingularityFn1RamCost,
purchaseProgram: () => RamCostConstants.ScriptSingularityFn1RamCost,
getCurrentServer: () => RamCostConstants.ScriptSingularityFn1RamCost,
connect: () => RamCostConstants.ScriptSingularityFn1RamCost,
manualHack: () => RamCostConstants.ScriptSingularityFn1RamCost,
installBackdoor: () => RamCostConstants.ScriptSingularityFn1RamCost,
getStats: () => RamCostConstants.ScriptSingularityFn1RamCost / 4,
getCharacterInformation: () => RamCostConstants.ScriptSingularityFn1RamCost / 4,
getPlayer: () => RamCostConstants.ScriptSingularityFn1RamCost / 4,
hospitalize: () => RamCostConstants.ScriptSingularityFn1RamCost / 4,
isBusy: () => RamCostConstants.ScriptSingularityFn1RamCost / 4,
stopAction: () => RamCostConstants.ScriptSingularityFn1RamCost / 2,
upgradeHomeRam: () => RamCostConstants.ScriptSingularityFn2RamCost,
getUpgradeHomeRamCost: () => RamCostConstants.ScriptSingularityFn2RamCost / 2,
workForCompany: () => RamCostConstants.ScriptSingularityFn2RamCost,
applyToCompany: () => RamCostConstants.ScriptSingularityFn2RamCost,
getCompanyRep: () => RamCostConstants.ScriptSingularityFn2RamCost / 3,
getCompanyFavor: () => RamCostConstants.ScriptSingularityFn2RamCost / 3,
getCompanyFavorGain: () => RamCostConstants.ScriptSingularityFn2RamCost / 4,
checkFactionInvitations: () => RamCostConstants.ScriptSingularityFn2RamCost,
joinFaction: () => RamCostConstants.ScriptSingularityFn2RamCost,
workForFaction: () => RamCostConstants.ScriptSingularityFn2RamCost,
getFactionRep: () => RamCostConstants.ScriptSingularityFn2RamCost / 3,
getFactionFavor: () => RamCostConstants.ScriptSingularityFn2RamCost / 3,
getFactionFavorGain: () => RamCostConstants.ScriptSingularityFn2RamCost / 4,
donateToFaction: () => RamCostConstants.ScriptSingularityFn3RamCost,
createProgram: () => RamCostConstants.ScriptSingularityFn3RamCost,
commitCrime: () => RamCostConstants.ScriptSingularityFn3RamCost,
getCrimeChance: () => RamCostConstants.ScriptSingularityFn3RamCost,
getCrimeStats: () => RamCostConstants.ScriptSingularityFn3RamCost,
getOwnedAugmentations: () => RamCostConstants.ScriptSingularityFn3RamCost,
getOwnedSourceFiles: () => RamCostConstants.ScriptSingularityFn3RamCost,
getAugmentationsFromFaction: () => RamCostConstants.ScriptSingularityFn3RamCost,
getAugmentationCost: () => RamCostConstants.ScriptSingularityFn3RamCost,
getAugmentationPrereq: () => RamCostConstants.ScriptSingularityFn3RamCost,
getAugmentationPrice: () => RamCostConstants.ScriptSingularityFn3RamCost / 2,
getAugmentationRepReq: () => RamCostConstants.ScriptSingularityFn3RamCost / 2,
getAugmentationStats: () => RamCostConstants.ScriptSingularityFn3RamCost,
purchaseAugmentation: () => RamCostConstants.ScriptSingularityFn3RamCost,
softReset: () => RamCostConstants.ScriptSingularityFn3RamCost,
installAugmentations: () => RamCostConstants.ScriptSingularityFn3RamCost,
universityCourse: RamCostConstants.ScriptSingularityFn1RamCost,
gymWorkout: RamCostConstants.ScriptSingularityFn1RamCost,
travelToCity: RamCostConstants.ScriptSingularityFn1RamCost,
purchaseTor: RamCostConstants.ScriptSingularityFn1RamCost,
purchaseProgram: RamCostConstants.ScriptSingularityFn1RamCost,
getCurrentServer: RamCostConstants.ScriptSingularityFn1RamCost,
connect: RamCostConstants.ScriptSingularityFn1RamCost,
manualHack: RamCostConstants.ScriptSingularityFn1RamCost,
installBackdoor: RamCostConstants.ScriptSingularityFn1RamCost,
getStats: RamCostConstants.ScriptSingularityFn1RamCost / 4,
getCharacterInformation: RamCostConstants.ScriptSingularityFn1RamCost / 4,
getPlayer: RamCostConstants.ScriptSingularityFn1RamCost / 4,
hospitalize: RamCostConstants.ScriptSingularityFn1RamCost / 4,
isBusy: RamCostConstants.ScriptSingularityFn1RamCost / 4,
stopAction: RamCostConstants.ScriptSingularityFn1RamCost / 2,
upgradeHomeRam: RamCostConstants.ScriptSingularityFn2RamCost,
getUpgradeHomeRamCost: RamCostConstants.ScriptSingularityFn2RamCost / 2,
workForCompany: RamCostConstants.ScriptSingularityFn2RamCost,
applyToCompany: RamCostConstants.ScriptSingularityFn2RamCost,
getCompanyRep: RamCostConstants.ScriptSingularityFn2RamCost / 3,
getCompanyFavor: RamCostConstants.ScriptSingularityFn2RamCost / 3,
getCompanyFavorGain: RamCostConstants.ScriptSingularityFn2RamCost / 4,
checkFactionInvitations: RamCostConstants.ScriptSingularityFn2RamCost,
joinFaction: RamCostConstants.ScriptSingularityFn2RamCost,
workForFaction: RamCostConstants.ScriptSingularityFn2RamCost,
getFactionRep: RamCostConstants.ScriptSingularityFn2RamCost / 3,
getFactionFavor: RamCostConstants.ScriptSingularityFn2RamCost / 3,
getFactionFavorGain: RamCostConstants.ScriptSingularityFn2RamCost / 4,
donateToFaction: RamCostConstants.ScriptSingularityFn3RamCost,
createProgram: RamCostConstants.ScriptSingularityFn3RamCost,
commitCrime: RamCostConstants.ScriptSingularityFn3RamCost,
getCrimeChance: RamCostConstants.ScriptSingularityFn3RamCost,
getCrimeStats: RamCostConstants.ScriptSingularityFn3RamCost,
getOwnedAugmentations: RamCostConstants.ScriptSingularityFn3RamCost,
getOwnedSourceFiles: RamCostConstants.ScriptSingularityFn3RamCost,
getAugmentationsFromFaction: RamCostConstants.ScriptSingularityFn3RamCost,
getAugmentationCost: RamCostConstants.ScriptSingularityFn3RamCost,
getAugmentationPrereq: RamCostConstants.ScriptSingularityFn3RamCost,
getAugmentationPrice: RamCostConstants.ScriptSingularityFn3RamCost / 2,
getAugmentationRepReq: RamCostConstants.ScriptSingularityFn3RamCost / 2,
getAugmentationStats: RamCostConstants.ScriptSingularityFn3RamCost,
purchaseAugmentation: RamCostConstants.ScriptSingularityFn3RamCost,
softReset: RamCostConstants.ScriptSingularityFn3RamCost,
installAugmentations: RamCostConstants.ScriptSingularityFn3RamCost,
// Gang API
gang: {
createGang: () => RamCostConstants.ScriptGangApiBaseRamCost / 4,
inGang: () => RamCostConstants.ScriptGangApiBaseRamCost / 4,
getMemberNames: () => RamCostConstants.ScriptGangApiBaseRamCost / 4,
getGangInformation: () => RamCostConstants.ScriptGangApiBaseRamCost / 2,
getOtherGangInformation: () => RamCostConstants.ScriptGangApiBaseRamCost / 2,
getMemberInformation: () => RamCostConstants.ScriptGangApiBaseRamCost / 2,
canRecruitMember: () => RamCostConstants.ScriptGangApiBaseRamCost / 4,
recruitMember: () => RamCostConstants.ScriptGangApiBaseRamCost / 2,
getTaskNames: () => RamCostConstants.ScriptGangApiBaseRamCost / 4,
getTaskStats: () => RamCostConstants.ScriptGangApiBaseRamCost / 4,
setMemberTask: () => RamCostConstants.ScriptGangApiBaseRamCost / 2,
getEquipmentNames: () => RamCostConstants.ScriptGangApiBaseRamCost / 4,
getEquipmentCost: () => RamCostConstants.ScriptGangApiBaseRamCost / 2,
getEquipmentType: () => RamCostConstants.ScriptGangApiBaseRamCost / 2,
getEquipmentStats: () => RamCostConstants.ScriptGangApiBaseRamCost / 2,
purchaseEquipment: () => RamCostConstants.ScriptGangApiBaseRamCost,
ascendMember: () => RamCostConstants.ScriptGangApiBaseRamCost,
setTerritoryWarfare: () => RamCostConstants.ScriptGangApiBaseRamCost / 2,
getChanceToWinClash: () => RamCostConstants.ScriptGangApiBaseRamCost,
getBonusTime: () => 0,
createGang: RamCostConstants.ScriptGangApiBaseRamCost / 4,
inGang: RamCostConstants.ScriptGangApiBaseRamCost / 4,
getMemberNames: RamCostConstants.ScriptGangApiBaseRamCost / 4,
getGangInformation: RamCostConstants.ScriptGangApiBaseRamCost / 2,
getOtherGangInformation: RamCostConstants.ScriptGangApiBaseRamCost / 2,
getMemberInformation: RamCostConstants.ScriptGangApiBaseRamCost / 2,
canRecruitMember: RamCostConstants.ScriptGangApiBaseRamCost / 4,
recruitMember: RamCostConstants.ScriptGangApiBaseRamCost / 2,
getTaskNames: RamCostConstants.ScriptGangApiBaseRamCost / 4,
getTaskStats: RamCostConstants.ScriptGangApiBaseRamCost / 4,
setMemberTask: RamCostConstants.ScriptGangApiBaseRamCost / 2,
getEquipmentNames: RamCostConstants.ScriptGangApiBaseRamCost / 4,
getEquipmentCost: RamCostConstants.ScriptGangApiBaseRamCost / 2,
getEquipmentType: RamCostConstants.ScriptGangApiBaseRamCost / 2,
getEquipmentStats: RamCostConstants.ScriptGangApiBaseRamCost / 2,
purchaseEquipment: RamCostConstants.ScriptGangApiBaseRamCost,
ascendMember: RamCostConstants.ScriptGangApiBaseRamCost,
setTerritoryWarfare: RamCostConstants.ScriptGangApiBaseRamCost / 2,
getChanceToWinClash: RamCostConstants.ScriptGangApiBaseRamCost,
getBonusTime: 0,
},
// Bladeburner API
bladeburner: {
getContractNames: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost / 10,
getOperationNames: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost / 10,
getBlackOpNames: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost / 10,
getBlackOpRank: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost / 2,
getGeneralActionNames: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost / 10,
getSkillNames: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost / 10,
startAction: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost,
stopBladeburnerAction: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost / 2,
getCurrentAction: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost / 4,
getActionTime: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost,
getActionEstimatedSuccessChance: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost,
getActionRepGain: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost,
getActionCountRemaining: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost,
getActionMaxLevel: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost,
getActionCurrentLevel: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost,
getActionAutolevel: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost,
setActionAutolevel: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost,
setActionLevel: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost,
getRank: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost,
getSkillPoints: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost,
getSkillLevel: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost,
getSkillUpgradeCost: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost,
upgradeSkill: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost,
getTeamSize: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost,
setTeamSize: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost,
getCityEstimatedPopulation: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost,
getCityEstimatedCommunities: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost,
getCityChaos: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost,
getCity: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost,
switchCity: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost,
getStamina: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost,
joinBladeburnerFaction: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost,
joinBladeburnerDivision: () => RamCostConstants.ScriptBladeburnerApiBaseRamCost,
getBonusTime: () => 0,
getContractNames: RamCostConstants.ScriptBladeburnerApiBaseRamCost / 10,
getOperationNames: RamCostConstants.ScriptBladeburnerApiBaseRamCost / 10,
getBlackOpNames: RamCostConstants.ScriptBladeburnerApiBaseRamCost / 10,
getBlackOpRank: RamCostConstants.ScriptBladeburnerApiBaseRamCost / 2,
getGeneralActionNames: RamCostConstants.ScriptBladeburnerApiBaseRamCost / 10,
getSkillNames: RamCostConstants.ScriptBladeburnerApiBaseRamCost / 10,
startAction: RamCostConstants.ScriptBladeburnerApiBaseRamCost,
stopBladeburnerAction: RamCostConstants.ScriptBladeburnerApiBaseRamCost / 2,
getCurrentAction: RamCostConstants.ScriptBladeburnerApiBaseRamCost / 4,
getActionTime: RamCostConstants.ScriptBladeburnerApiBaseRamCost,
getActionEstimatedSuccessChance: RamCostConstants.ScriptBladeburnerApiBaseRamCost,
getActionRepGain: RamCostConstants.ScriptBladeburnerApiBaseRamCost,
getActionCountRemaining: RamCostConstants.ScriptBladeburnerApiBaseRamCost,
getActionMaxLevel: RamCostConstants.ScriptBladeburnerApiBaseRamCost,
getActionCurrentLevel: RamCostConstants.ScriptBladeburnerApiBaseRamCost,
getActionAutolevel: RamCostConstants.ScriptBladeburnerApiBaseRamCost,
setActionAutolevel: RamCostConstants.ScriptBladeburnerApiBaseRamCost,
setActionLevel: RamCostConstants.ScriptBladeburnerApiBaseRamCost,
getRank: RamCostConstants.ScriptBladeburnerApiBaseRamCost,
getSkillPoints: RamCostConstants.ScriptBladeburnerApiBaseRamCost,
getSkillLevel: RamCostConstants.ScriptBladeburnerApiBaseRamCost,
getSkillUpgradeCost: RamCostConstants.ScriptBladeburnerApiBaseRamCost,
upgradeSkill: RamCostConstants.ScriptBladeburnerApiBaseRamCost,
getTeamSize: RamCostConstants.ScriptBladeburnerApiBaseRamCost,
setTeamSize: RamCostConstants.ScriptBladeburnerApiBaseRamCost,
getCityEstimatedPopulation: RamCostConstants.ScriptBladeburnerApiBaseRamCost,
getCityEstimatedCommunities: RamCostConstants.ScriptBladeburnerApiBaseRamCost,
getCityChaos: RamCostConstants.ScriptBladeburnerApiBaseRamCost,
getCity: RamCostConstants.ScriptBladeburnerApiBaseRamCost,
switchCity: RamCostConstants.ScriptBladeburnerApiBaseRamCost,
getStamina: RamCostConstants.ScriptBladeburnerApiBaseRamCost,
joinBladeburnerFaction: RamCostConstants.ScriptBladeburnerApiBaseRamCost,
joinBladeburnerDivision: RamCostConstants.ScriptBladeburnerApiBaseRamCost,
getBonusTime: 0,
},
// Coding Contract API
codingcontract: {
attempt: () => RamCostConstants.ScriptCodingContractBaseRamCost,
getContractType: () => RamCostConstants.ScriptCodingContractBaseRamCost / 2,
getData: () => RamCostConstants.ScriptCodingContractBaseRamCost / 2,
getDescription: () => RamCostConstants.ScriptCodingContractBaseRamCost / 2,
getNumTriesRemaining: () => RamCostConstants.ScriptCodingContractBaseRamCost / 5,
attempt: RamCostConstants.ScriptCodingContractBaseRamCost,
getContractType: RamCostConstants.ScriptCodingContractBaseRamCost / 2,
getData: RamCostConstants.ScriptCodingContractBaseRamCost / 2,
getDescription: RamCostConstants.ScriptCodingContractBaseRamCost / 2,
getNumTriesRemaining: RamCostConstants.ScriptCodingContractBaseRamCost / 5,
},
// Duplicate Sleeve API
sleeve: {
getNumSleeves: () => RamCostConstants.ScriptSleeveBaseRamCost,
setToShockRecovery: () => RamCostConstants.ScriptSleeveBaseRamCost,
setToSynchronize: () => RamCostConstants.ScriptSleeveBaseRamCost,
setToCommitCrime: () => RamCostConstants.ScriptSleeveBaseRamCost,
setToUniversityCourse: () => RamCostConstants.ScriptSleeveBaseRamCost,
travel: () => RamCostConstants.ScriptSleeveBaseRamCost,
setToCompanyWork: () => RamCostConstants.ScriptSleeveBaseRamCost,
setToFactionWork: () => RamCostConstants.ScriptSleeveBaseRamCost,
setToGymWorkout: () => RamCostConstants.ScriptSleeveBaseRamCost,
getSleeveStats: () => RamCostConstants.ScriptSleeveBaseRamCost,
getTask: () => RamCostConstants.ScriptSleeveBaseRamCost,
getInformation: () => RamCostConstants.ScriptSleeveBaseRamCost,
getSleeveAugmentations: () => RamCostConstants.ScriptSleeveBaseRamCost,
getSleevePurchasableAugs: () => RamCostConstants.ScriptSleeveBaseRamCost,
purchaseSleeveAug: () => RamCostConstants.ScriptSleeveBaseRamCost,
getNumSleeves: RamCostConstants.ScriptSleeveBaseRamCost,
setToShockRecovery: RamCostConstants.ScriptSleeveBaseRamCost,
setToSynchronize: RamCostConstants.ScriptSleeveBaseRamCost,
setToCommitCrime: RamCostConstants.ScriptSleeveBaseRamCost,
setToUniversityCourse: RamCostConstants.ScriptSleeveBaseRamCost,
travel: RamCostConstants.ScriptSleeveBaseRamCost,
setToCompanyWork: RamCostConstants.ScriptSleeveBaseRamCost,
setToFactionWork: RamCostConstants.ScriptSleeveBaseRamCost,
setToGymWorkout: RamCostConstants.ScriptSleeveBaseRamCost,
getSleeveStats: RamCostConstants.ScriptSleeveBaseRamCost,
getTask: RamCostConstants.ScriptSleeveBaseRamCost,
getInformation: RamCostConstants.ScriptSleeveBaseRamCost,
getSleeveAugmentations: RamCostConstants.ScriptSleeveBaseRamCost,
getSleevePurchasableAugs: RamCostConstants.ScriptSleeveBaseRamCost,
purchaseSleeveAug: RamCostConstants.ScriptSleeveBaseRamCost,
},
heart: {
// Easter egg function
break: () => 0,
break: 0,
},
};
@ -340,15 +342,10 @@ export function getRamCost(...args: string[]): number {
curr = curr[args[i]];
}
const currType = typeof curr;
if (currType === "function") {
return curr();
}
if (currType === "number") {
if (typeof curr === "number") {
return curr;
}
console.warn(`Unexpected type (${currType}) for value [${args}]`);
console.warn(`Unexpected type (${curr}) for value [${args}]`);
return 0;
}

@ -89,7 +89,7 @@ import { SnackbarEvents } from "./ui/React/Snackbar";
import { Locations } from "./Locations/Locations";
import { Flags } from "./NetscriptFunctions/Flags";
interface NS extends INetscriptExtra, INetscriptAugmentations, INetscriptStockMarket {
interface NS extends INetscriptExtra, INetscriptAugmentations {
[key: string]: any;
hacknet: INetscriptHacknet;
gang: INetscriptGang;
@ -98,6 +98,7 @@ interface NS extends INetscriptExtra, INetscriptAugmentations, INetscriptStockMa
codingcontract: INetscriptCodingContract;
corporation: INetscriptCorporation;
formulas: INetscriptFormulas;
stock: INetscriptStockMarket;
}
function NetscriptFunctions(workerScript: WorkerScript): NS {
@ -1482,7 +1483,7 @@ function NetscriptFunctions(workerScript: WorkerScript): NS {
return getRunningScript(fn, hostname, "isRunning", scriptArgs) != null;
}
},
...stockmarket,
stock: stockmarket,
getPurchasedServerLimit: function (): any {
updateDynamicRam("getPurchasedServerLimit", getRamCost("getPurchasedServerLimit"));

@ -12,23 +12,23 @@ import { getStockMarket4SDataCost, getStockMarket4STixApiCost } from "../StockMa
import { Stock } from "../StockMarket/Stock";
export interface INetscriptStockMarket {
getStockSymbols(): any;
getStockPrice(symbol: any): any;
getStockAskPrice(symbol: any): any;
getStockBidPrice(symbol: any): any;
getStockPosition(symbol: any): any;
getStockMaxShares(symbol: any): any;
getStockPurchaseCost(symbol: any, shares: any, posType: any): any;
getStockSaleGain(symbol: any, shares: any, posType: any): any;
buyStock(symbol: any, shares: any): any;
sellStock(symbol: any, shares: any): any;
shortStock(symbol: any, shares: any): any;
getSymbols(): any;
getPrice(symbol: any): any;
getAskPrice(symbol: any): any;
getBidPrice(symbol: any): any;
getPosition(symbol: any): any;
getMaxShares(symbol: any): any;
getPurchaseCost(symbol: any, shares: any, posType: any): any;
getSaleGain(symbol: any, shares: any, posType: any): any;
buy(symbol: any, shares: any): any;
sell(symbol: any, shares: any): any;
short(symbol: any, shares: any): any;
sellShort(symbol: any, shares: any): any;
placeOrder(symbol: any, shares: any, price: any, type: any, pos: any): any;
cancelOrder(symbol: any, shares: any, price: any, type: any, pos: any): any;
getOrders(): any;
getStockVolatility(symbol: any): any;
getStockForecast(symbol: any): any;
getVolatility(symbol: any): any;
getForecast(symbol: any): any;
purchase4SMarketData(): void;
purchase4SMarketDataTixApi(): void;
}
@ -59,52 +59,52 @@ export function NetscriptStockMarket(
return stock;
};
return {
getStockSymbols: function (): any {
helper.updateDynamicRam("getStockSymbols", getRamCost("getStockSymbols"));
checkTixApiAccess("getStockSymbols");
getSymbols: function (): any {
helper.updateDynamicRam("getSymbols", getRamCost("stock", "getSymbols"));
checkTixApiAccess("getSymbols");
return Object.values(StockSymbols);
},
getStockPrice: function (symbol: any): any {
helper.updateDynamicRam("getStockPrice", getRamCost("getStockPrice"));
checkTixApiAccess("getStockPrice");
const stock = getStockFromSymbol(symbol, "getStockPrice");
getPrice: function (symbol: any): any {
helper.updateDynamicRam("getPrice", getRamCost("stock", "getPrice"));
checkTixApiAccess("getPrice");
const stock = getStockFromSymbol(symbol, "getPrice");
return stock.price;
},
getStockAskPrice: function (symbol: any): any {
helper.updateDynamicRam("getStockAskPrice", getRamCost("getStockAskPrice"));
checkTixApiAccess("getStockAskPrice");
const stock = getStockFromSymbol(symbol, "getStockAskPrice");
getAskPrice: function (symbol: any): any {
helper.updateDynamicRam("getAskPrice", getRamCost("stock", "getAskPrice"));
checkTixApiAccess("getAskPrice");
const stock = getStockFromSymbol(symbol, "getAskPrice");
return stock.getAskPrice();
},
getStockBidPrice: function (symbol: any): any {
helper.updateDynamicRam("getStockBidPrice", getRamCost("getStockBidPrice"));
checkTixApiAccess("getStockBidPrice");
const stock = getStockFromSymbol(symbol, "getStockBidPrice");
getBidPrice: function (symbol: any): any {
helper.updateDynamicRam("getBidPrice", getRamCost("stock", "getBidPrice"));
checkTixApiAccess("getBidPrice");
const stock = getStockFromSymbol(symbol, "getBidPrice");
return stock.getBidPrice();
},
getStockPosition: function (symbol: any): any {
helper.updateDynamicRam("getStockPosition", getRamCost("getStockPosition"));
checkTixApiAccess("getStockPosition");
getPosition: function (symbol: any): any {
helper.updateDynamicRam("getPosition", getRamCost("stock", "getPosition"));
checkTixApiAccess("getPosition");
const stock = SymbolToStockMap[symbol];
if (stock == null) {
throw helper.makeRuntimeErrorMsg("getStockPosition", `Invalid stock symbol: ${symbol}`);
throw helper.makeRuntimeErrorMsg("getPosition", `Invalid stock symbol: ${symbol}`);
}
return [stock.playerShares, stock.playerAvgPx, stock.playerShortShares, stock.playerAvgShortPx];
},
getStockMaxShares: function (symbol: any): any {
helper.updateDynamicRam("getStockMaxShares", getRamCost("getStockMaxShares"));
checkTixApiAccess("getStockMaxShares");
const stock = getStockFromSymbol(symbol, "getStockMaxShares");
getMaxShares: function (symbol: any): any {
helper.updateDynamicRam("getMaxShares", getRamCost("stock", "getMaxShares"));
checkTixApiAccess("getMaxShares");
const stock = getStockFromSymbol(symbol, "getMaxShares");
return stock.maxShares;
},
getStockPurchaseCost: function (symbol: any, shares: any, posType: any): any {
helper.updateDynamicRam("getStockPurchaseCost", getRamCost("getStockPurchaseCost"));
checkTixApiAccess("getStockPurchaseCost");
const stock = getStockFromSymbol(symbol, "getStockPurchaseCost");
getPurchaseCost: function (symbol: any, shares: any, posType: any): any {
helper.updateDynamicRam("getPurchaseCost", getRamCost("stock", "getPurchaseCost"));
checkTixApiAccess("getPurchaseCost");
const stock = getStockFromSymbol(symbol, "getPurchaseCost");
shares = Math.round(shares);
let pos;
@ -124,10 +124,10 @@ export function NetscriptStockMarket(
return res;
},
getStockSaleGain: function (symbol: any, shares: any, posType: any): any {
helper.updateDynamicRam("getStockSaleGain", getRamCost("getStockSaleGain"));
checkTixApiAccess("getStockSaleGain");
const stock = getStockFromSymbol(symbol, "getStockSaleGain");
getSaleGain: function (symbol: any, shares: any, posType: any): any {
helper.updateDynamicRam("getSaleGain", getRamCost("stock", "getSaleGain"));
checkTixApiAccess("getSaleGain");
const stock = getStockFromSymbol(symbol, "getSaleGain");
shares = Math.round(shares);
let pos;
@ -147,39 +147,39 @@ export function NetscriptStockMarket(
return res;
},
buyStock: function (symbol: any, shares: any): any {
helper.updateDynamicRam("buyStock", getRamCost("buyStock"));
checkTixApiAccess("buyStock");
const stock = getStockFromSymbol(symbol, "buyStock");
buy: function (symbol: any, shares: any): any {
helper.updateDynamicRam("buy", getRamCost("stock", "buy"));
checkTixApiAccess("buy");
const stock = getStockFromSymbol(symbol, "buy");
const res = buyStock(stock, shares, workerScript, {});
return res ? stock.price : 0;
},
sellStock: function (symbol: any, shares: any): any {
helper.updateDynamicRam("sellStock", getRamCost("sellStock"));
checkTixApiAccess("sellStock");
const stock = getStockFromSymbol(symbol, "sellStock");
sell: function (symbol: any, shares: any): any {
helper.updateDynamicRam("sell", getRamCost("stock", "sell"));
checkTixApiAccess("sell");
const stock = getStockFromSymbol(symbol, "sell");
const res = sellStock(stock, shares, workerScript, {});
return res ? stock.price : 0;
},
shortStock: function (symbol: any, shares: any): any {
helper.updateDynamicRam("shortStock", getRamCost("shortStock"));
checkTixApiAccess("shortStock");
short: function (symbol: any, shares: any): any {
helper.updateDynamicRam("short", getRamCost("stock", "short"));
checkTixApiAccess("short");
if (player.bitNodeN !== 8) {
if (player.sourceFileLvl(8) <= 1) {
throw helper.makeRuntimeErrorMsg(
"shortStock",
"short",
"You must either be in BitNode-8 or you must have Source-File 8 Level 2.",
);
}
}
const stock = getStockFromSymbol(symbol, "shortStock");
const stock = getStockFromSymbol(symbol, "short");
const res = shortStock(stock, shares, workerScript, {});
return res ? stock.price : 0;
},
sellShort: function (symbol: any, shares: any): any {
helper.updateDynamicRam("sellShort", getRamCost("sellShort"));
helper.updateDynamicRam("sellShort", getRamCost("stock", "sellShort"));
checkTixApiAccess("sellShort");
if (player.bitNodeN !== 8) {
if (player.sourceFileLvl(8) <= 1) {
@ -195,7 +195,7 @@ export function NetscriptStockMarket(
return res ? stock.price : 0;
},
placeOrder: function (symbol: any, shares: any, price: any, type: any, pos: any): any {
helper.updateDynamicRam("placeOrder", getRamCost("placeOrder"));
helper.updateDynamicRam("placeOrder", getRamCost("stock", "placeOrder"));
checkTixApiAccess("placeOrder");
if (player.bitNodeN !== 8) {
if (player.sourceFileLvl(8) <= 2) {
@ -234,7 +234,7 @@ export function NetscriptStockMarket(
return placeOrder(stock, shares, price, orderType, orderPos, workerScript);
},
cancelOrder: function (symbol: any, shares: any, price: any, type: any, pos: any): any {
helper.updateDynamicRam("cancelOrder", getRamCost("cancelOrder"));
helper.updateDynamicRam("cancelOrder", getRamCost("stock", "cancelOrder"));
checkTixApiAccess("cancelOrder");
if (player.bitNodeN !== 8) {
if (player.sourceFileLvl(8) <= 2) {
@ -284,7 +284,7 @@ export function NetscriptStockMarket(
return cancelOrder(params, workerScript);
},
getOrders: function (): any {
helper.updateDynamicRam("getOrders", getRamCost("getOrders"));
helper.updateDynamicRam("getOrders", getRamCost("stock", "getOrders"));
checkTixApiAccess("getOrders");
if (player.bitNodeN !== 8) {
if (player.sourceFileLvl(8) <= 2) {
@ -315,28 +315,28 @@ export function NetscriptStockMarket(
return orders;
},
getStockVolatility: function (symbol: any): any {
helper.updateDynamicRam("getStockVolatility", getRamCost("getStockVolatility"));
getVolatility: function (symbol: any): any {
helper.updateDynamicRam("getVolatility", getRamCost("stock", "getVolatility"));
if (!player.has4SDataTixApi) {
throw helper.makeRuntimeErrorMsg("getStockVolatility", "You don't have 4S Market Data TIX API Access!");
throw helper.makeRuntimeErrorMsg("getVolatility", "You don't have 4S Market Data TIX API Access!");
}
const stock = getStockFromSymbol(symbol, "getStockVolatility");
const stock = getStockFromSymbol(symbol, "getVolatility");
return stock.mv / 100; // Convert from percentage to decimal
},
getStockForecast: function (symbol: any): any {
helper.updateDynamicRam("getStockForecast", getRamCost("getStockForecast"));
getForecast: function (symbol: any): any {
helper.updateDynamicRam("getForecast", getRamCost("stock", "getForecast"));
if (!player.has4SDataTixApi) {
throw helper.makeRuntimeErrorMsg("getStockForecast", "You don't have 4S Market Data TIX API Access!");
throw helper.makeRuntimeErrorMsg("getForecast", "You don't have 4S Market Data TIX API Access!");
}
const stock = getStockFromSymbol(symbol, "getStockForecast");
const stock = getStockFromSymbol(symbol, "getForecast");
let forecast = 50;
stock.b ? (forecast += stock.otlkMag) : (forecast -= stock.otlkMag);
return forecast / 100; // Convert from percentage to decimal
},
purchase4SMarketData: function () {
helper.updateDynamicRam("purchase4SMarketData", getRamCost("purchase4SMarketData"));
helper.updateDynamicRam("purchase4SMarketData", getRamCost("stock", "purchase4SMarketData"));
checkTixApiAccess("purchase4SMarketData");
if (player.has4SData) {
@ -355,7 +355,7 @@ export function NetscriptStockMarket(
return true;
},
purchase4SMarketDataTixApi: function () {
helper.updateDynamicRam("purchase4SMarketDataTixApi", getRamCost("purchase4SMarketDataTixApi"));
helper.updateDynamicRam("purchase4SMarketDataTixApi", getRamCost("stock", "purchase4SMarketDataTixApi"));
checkTixApiAccess("purchase4SMarketDataTixApi");
if (player.has4SDataTixApi) {

@ -5,7 +5,7 @@ import { Factions, loadFactions } from "./Faction/Factions";
import { loadAllGangs, AllGangs } from "./Gang/AllGangs";
import { loadMessages, initMessages, Messages } from "./Message/MessageHelpers";
import { Player, loadPlayer } from "./Player";
import { saveAllServers, loadAllServers } from "./Server/AllServers";
import { saveAllServers, loadAllServers, GetAllServers } from "./Server/AllServers";
import { Settings } from "./Settings/Settings";
import { SourceFileFlags } from "./SourceFile/SourceFileFlags";
import { loadStockMarket, StockMarket } from "./StockMarket/StockMarket";
@ -172,6 +172,40 @@ function evaluateVersionCompatibility(ver: string): void {
}
}
}
if (ver < "0.58.0") {
const changes: [RegExp, string][] = [
[/getStockSymbols/g, "stock.getSymbols"],
[/getStockPrice/g, "stock.getPrice"],
[/getStockAskPrice/g, "stock.getAskPrice"],
[/getStockBidPrice/g, "stock.getBidPrice"],
[/getStockPosition/g, "stock.getPosition"],
[/getStockMaxShares/g, "stock.getMaxShares"],
[/getStockPurchaseCost/g, "stock.getPurchaseCost"],
[/getStockSaleGain/g, "stock.getSaleGain"],
[/buyStock/g, "stock.buy"],
[/sellStock/g, "stock.sell"],
[/shortStock/g, "stock.short"],
[/sellShort/g, "stock.sellShort"],
[/placeOrder/g, "stock.placeOrder"],
[/cancelOrder/g, "stock.cancelOrder"],
[/getOrders/g, "stock.getOrders"],
[/getStockVolatility/g, "stock.getVolatility"],
[/getStockForecast/g, "stock.getForecast"],
[/purchase4SMarketData/g, "stock.purchase4SMarketData"],
[/purchase4SMarketDataTixApi/g, "stock.purchase4SMarketDataTixApi"],
];
function convert(code: string): string {
for (const change of changes) {
code = code.replace(change[0], change[1]);
}
return code;
}
for (const server of GetAllServers()) {
for (const script of server.scripts) {
script.code = convert(script.code);
}
}
}
}
function loadGame(saveString: string): boolean {

@ -1096,7 +1096,7 @@ interface TIX {
* @ramCost 2 GB
* @returns {string[]} Array of the symbols of the tradable stocks.
*/
getStockSymbols (): StockSymbol[];
getSymbols (): StockSymbol[];
/**
* Returns the price of a stock, given its symbol (NOT the company name).
@ -1106,13 +1106,13 @@ interface TIX {
*
* @example
* \`\`\`js
* getStockPrice("FISG");
* getPrice("FISG");
* \`\`\`
* @ramCost 2 GB
* @param {string} sym Stock symbol.
* @returns {number} The price of a stock.
*/
getStockPrice (sym: StockSymbol): number;
getPrice (sym: StockSymbol): number;
/**
* Given a stocks symbol (NOT the company name), returns the ask price of that stock.
@ -1122,7 +1122,7 @@ interface TIX {
* @param {string} sym Stock symbol.
* @returns {number} The ask price of a stock.
*/
getStockAskPrice (sym: StockSymbol): number;
getAskPrice (sym: StockSymbol): number;
/**
* Given a stocks symbol (NOT the company name), returns the bid price of that stock.
@ -1132,7 +1132,7 @@ interface TIX {
* @param {string} sym Stock symbol.
* @returns {number} The bid price of a stock.
*/
getStockBidPrice (sym: StockSymbol): number;
getBidPrice (sym: StockSymbol): number;
/**
* Returns an array of four elements that represents the players position in a stock.
@ -1149,7 +1149,7 @@ interface TIX {
*
* @example
* \`\`\`js
* pos = getStockPosition("ECP");
* pos = getPosition("ECP");
* shares = pos[0];
* avgPx = pos[1];
* sharesShort = pos[2];
@ -1159,7 +1159,7 @@ interface TIX {
* @param {string} sym Stock symbol.
* @returns {[number,number,number,number]} Array of four elements that represents the players position in a stock.
*/
getStockPosition (sym: StockSymbol): [number, number, number, number];
getPosition (sym: StockSymbol): [number, number, number, number];
/**
* Returns the maximum number of shares that the stock has.
@ -1170,7 +1170,7 @@ interface TIX {
* @param {string} sym Stock symbol.
* @returns {number} Maximum number of shares that the stock has.
*/
getStockMaxShares (sym: StockSymbol): number;
getMaxShares (sym: StockSymbol): number;
/**
* Calculates and returns how much it would cost to buy a given number of shares of a stock.
@ -1182,7 +1182,7 @@ interface TIX {
* @param {string} posType Specifies whether the order is a Long or Short position.
* @returns {number} Cost to buy a given number of shares of a stock.
*/
getStockPurchaseCost (sym: StockSymbol, shares: Number, posType: OrderPos): number;
getPurchaseCost (sym: StockSymbol, shares: Number, posType: OrderPos): number;
/**
* Calculates and returns how much you would gain from selling a given number of shares of a stock.
@ -1194,7 +1194,7 @@ interface TIX {
* @param {string} posType Specifies whether the order is a Long or Short position.
* @returns {number} Gain from selling a given number of shares of a stock.
*/
getStockSaleGain (sym: StockSymbol, shares: Number, posType: OrderPos): number;
getSaleGain (sym: StockSymbol, shares: Number, posType: OrderPos): number;
/**
@ -1212,7 +1212,7 @@ interface TIX {
* @param {number} shares Number of shares to purchased. Must be positive. Will be rounded to nearest integer.
* @returns {number} The stock price at which each share was purchased, otherwise 0 if the shares weren't purchased.
*/
buyStock (sym: StockSymbol, shares: number): number;
buy (sym: StockSymbol, shares: number): number;
/**
* Attempts to sell shares of a stock using a Market Order.
@ -1234,7 +1234,7 @@ interface TIX {
* @param {number} shares Number of shares to sell. Must be positive. Will be rounded to nearest integer.
* @returns {number} The stock price at which each share was sold, otherwise 0 if the shares weren't sold.
*/
sellStock (sym: StockSymbol, shares: number): number;
sell (sym: StockSymbol, shares: number): number;
/**
* Attempts to purchase a short position of a stock using a Market Order.
@ -1254,7 +1254,7 @@ interface TIX {
* @param {number} shares Number of shares to short. Must be positive. Will be rounded to nearest integer.
* @returns {number} The stock price at which each share was purchased, otherwise 0 if the shares weren't purchased.
*/
shortStock (sym: StockSymbol, shares: number): number;
short (sym: StockSymbol, shares: number): number;
/**
* Attempts to sell a short position of a stock using a Market Order.
@ -1400,7 +1400,7 @@ interface TIX {
* @param {string} sym Stock symbol.
* @returns {number} Volatility of the specified stock.
*/
getStockVolatility (sym: StockSymbol): number;
getVolatility (sym: StockSymbol): number;
/**
* Returns the probability that the specified stocks price will increase (as opposed to decrease) during the next tick.
@ -1417,7 +1417,7 @@ interface TIX {
* @param {string} sym Stock symbol.
* @returns {number} Probability that the specified stocks price will increase (as opposed to decrease) during the next tick.
*/
getStockForecast (sym: StockSymbol): number;
getForecast (sym: StockSymbol): number;
/**
* Purchase 4S Market Data Access.
@ -3187,7 +3187,7 @@ interface Sleeve {
purchaseSleeveAug (sleeveNumber: number, augName: AugmentName): boolean;
}
interface NS extends TIX, Singularity {
interface NS extends Singularity {
/**
* Not all functions in the Hacknet Node API are immediately available.
@ -3215,6 +3215,10 @@ interface NS extends TIX, Singularity {
* @ramCost 0 GB
*/
readonly sleeve: Sleeve;
/**
* @ramCost 0 GB
*/
readonly stock: TIX;
/**
* Arguments passed into a script can be accessed using a normal

@ -53,7 +53,7 @@ export function SetupTextEditor(): void {
}
symbols = populate(ns);
const exclude = ["heart", "break", "exploit", "bypass", "corporation"];
const exclude = ["heart", "break", "exploit", "bypass", "corporation", "alterReality"];
symbols = symbols.filter((symbol: string) => !exclude.includes(symbol)).sort();
}