diff --git a/markdown/bitburner.jobname.md b/markdown/bitburner.jobname.md
index 14cdc4cef..0bb063a89 100644
--- a/markdown/bitburner.jobname.md
+++ b/markdown/bitburner.jobname.md
@@ -34,12 +34,10 @@ declare enum JobName
| IT3 | "Systems Administrator"
| |
| networkEng0 | "Network Engineer"
| |
| networkEng1 | "Network Administrator"
| |
-| security0 | "Police Officer"
| |
-| security1 | "Police Chief"
| |
-| security2 | "Security Guard"
| |
-| security3 | "Security Officer"
| |
-| security4 | "Security Supervisor"
| |
-| security5 | "Head of Security"
| |
+| security0 | "Security Guard"
| |
+| security1 | "Security Officer"
| |
+| security2 | "Security Supervisor"
| |
+| security3 | "Head of Security"
| |
| securityEng | "Security Engineer"
| |
| software0 | "Software Engineering Intern"
| |
| software1 | "Junior Software Engineer"
| |
diff --git a/markdown/bitburner.md b/markdown/bitburner.md
index c655ca2a3..7f39c39df 100644
--- a/markdown/bitburner.md
+++ b/markdown/bitburner.md
@@ -98,6 +98,7 @@
| [SleevePerson](./bitburner.sleeveperson.md) | |
| [SourceFileLvl](./bitburner.sourcefilelvl.md) | |
| [Stanek](./bitburner.stanek.md) | Stanek's Gift API. |
+| [StockMarketConstants](./bitburner.stockmarketconstants.md) | Constants used for the stockmarket game mechanic. |
| [StockOrder](./bitburner.stockorder.md) |
Return value of [getOrders](./bitburner.tix.getorders.md)
Keys are stock symbols, properties are arrays of [StockOrderObject](./bitburner.stockorderobject.md)
| | [StockOrderObject](./bitburner.stockorderobject.md) | Value in map of [StockOrder](./bitburner.stockorder.md) | | [TailProperties](./bitburner.tailproperties.md) | | diff --git a/markdown/bitburner.stockmarketconstants.marketdata4scost.md b/markdown/bitburner.stockmarketconstants.marketdata4scost.md new file mode 100644 index 000000000..d483fc9bb --- /dev/null +++ b/markdown/bitburner.stockmarketconstants.marketdata4scost.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [StockMarketConstants](./bitburner.stockmarketconstants.md) > [MarketData4SCost](./bitburner.stockmarketconstants.marketdata4scost.md) + +## StockMarketConstants.MarketData4SCost property + +Cost of the 4S Market Data + +**Signature:** + +```typescript +MarketData4SCost: number; +``` diff --git a/markdown/bitburner.stockmarketconstants.marketdatatixapi4scost.md b/markdown/bitburner.stockmarketconstants.marketdatatixapi4scost.md new file mode 100644 index 000000000..78867d7cc --- /dev/null +++ b/markdown/bitburner.stockmarketconstants.marketdatatixapi4scost.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [StockMarketConstants](./bitburner.stockmarketconstants.md) > [MarketDataTixApi4SCost](./bitburner.stockmarketconstants.marketdatatixapi4scost.md) + +## StockMarketConstants.MarketDataTixApi4SCost property + +Cost of the 4S Market Data TIX API integration + +**Signature:** + +```typescript +MarketDataTixApi4SCost: number; +``` diff --git a/markdown/bitburner.stockmarketconstants.md b/markdown/bitburner.stockmarketconstants.md new file mode 100644 index 000000000..19a1c03c4 --- /dev/null +++ b/markdown/bitburner.stockmarketconstants.md @@ -0,0 +1,27 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [StockMarketConstants](./bitburner.stockmarketconstants.md) + +## StockMarketConstants interface + +Constants used for the stockmarket game mechanic. + +**Signature:** + +```typescript +interface StockMarketConstants +``` + +## Properties + +| Property | Modifiers | Type | Description | +| --- | --- | --- | --- | +| [MarketData4SCost](./bitburner.stockmarketconstants.marketdata4scost.md) | | number | Cost of the 4S Market Data | +| [MarketDataTixApi4SCost](./bitburner.stockmarketconstants.marketdatatixapi4scost.md) | | number | Cost of the 4S Market Data TIX API integration | +| [msPerStockUpdate](./bitburner.stockmarketconstants.msperstockupdate.md) | | number | Normal time in ms between stock market updates | +| [msPerStockUpdateMin](./bitburner.stockmarketconstants.msperstockupdatemin.md) | | number | Minimum time in ms between stock market updates if there is stored offline/bonus time | +| [StockMarketCommission](./bitburner.stockmarketconstants.stockmarketcommission.md) | | number | Commission fee for transactions | +| [TicksPerCycle](./bitburner.stockmarketconstants.tickspercycle.md) | | number | An internal constant used while determining when to flip a stock's forecast | +| [TIXAPICost](./bitburner.stockmarketconstants.tixapicost.md) | | number | Cost of the TIX API | +| [WSEAccountCost](./bitburner.stockmarketconstants.wseaccountcost.md) | | number | Cost of the WSE account | + diff --git a/markdown/bitburner.stockmarketconstants.msperstockupdate.md b/markdown/bitburner.stockmarketconstants.msperstockupdate.md new file mode 100644 index 000000000..b617902f2 --- /dev/null +++ b/markdown/bitburner.stockmarketconstants.msperstockupdate.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [StockMarketConstants](./bitburner.stockmarketconstants.md) > [msPerStockUpdate](./bitburner.stockmarketconstants.msperstockupdate.md) + +## StockMarketConstants.msPerStockUpdate property + +Normal time in ms between stock market updates + +**Signature:** + +```typescript +msPerStockUpdate: number; +``` diff --git a/markdown/bitburner.stockmarketconstants.msperstockupdatemin.md b/markdown/bitburner.stockmarketconstants.msperstockupdatemin.md new file mode 100644 index 000000000..4e928161f --- /dev/null +++ b/markdown/bitburner.stockmarketconstants.msperstockupdatemin.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [StockMarketConstants](./bitburner.stockmarketconstants.md) > [msPerStockUpdateMin](./bitburner.stockmarketconstants.msperstockupdatemin.md) + +## StockMarketConstants.msPerStockUpdateMin property + +Minimum time in ms between stock market updates if there is stored offline/bonus time + +**Signature:** + +```typescript +msPerStockUpdateMin: number; +``` diff --git a/markdown/bitburner.stockmarketconstants.stockmarketcommission.md b/markdown/bitburner.stockmarketconstants.stockmarketcommission.md new file mode 100644 index 000000000..c01434225 --- /dev/null +++ b/markdown/bitburner.stockmarketconstants.stockmarketcommission.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [StockMarketConstants](./bitburner.stockmarketconstants.md) > [StockMarketCommission](./bitburner.stockmarketconstants.stockmarketcommission.md) + +## StockMarketConstants.StockMarketCommission property + +Commission fee for transactions + +**Signature:** + +```typescript +StockMarketCommission: number; +``` diff --git a/markdown/bitburner.stockmarketconstants.tickspercycle.md b/markdown/bitburner.stockmarketconstants.tickspercycle.md new file mode 100644 index 000000000..6a51a3aeb --- /dev/null +++ b/markdown/bitburner.stockmarketconstants.tickspercycle.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [StockMarketConstants](./bitburner.stockmarketconstants.md) > [TicksPerCycle](./bitburner.stockmarketconstants.tickspercycle.md) + +## StockMarketConstants.TicksPerCycle property + +An internal constant used while determining when to flip a stock's forecast + +**Signature:** + +```typescript +TicksPerCycle: number; +``` diff --git a/markdown/bitburner.stockmarketconstants.tixapicost.md b/markdown/bitburner.stockmarketconstants.tixapicost.md new file mode 100644 index 000000000..7723581d5 --- /dev/null +++ b/markdown/bitburner.stockmarketconstants.tixapicost.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [StockMarketConstants](./bitburner.stockmarketconstants.md) > [TIXAPICost](./bitburner.stockmarketconstants.tixapicost.md) + +## StockMarketConstants.TIXAPICost property + +Cost of the TIX API + +**Signature:** + +```typescript +TIXAPICost: number; +``` diff --git a/markdown/bitburner.stockmarketconstants.wseaccountcost.md b/markdown/bitburner.stockmarketconstants.wseaccountcost.md new file mode 100644 index 000000000..c0318da9f --- /dev/null +++ b/markdown/bitburner.stockmarketconstants.wseaccountcost.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [StockMarketConstants](./bitburner.stockmarketconstants.md) > [WSEAccountCost](./bitburner.stockmarketconstants.wseaccountcost.md) + +## StockMarketConstants.WSEAccountCost property + +Cost of the WSE account + +**Signature:** + +```typescript +WSEAccountCost: number; +``` diff --git a/markdown/bitburner.tix.getconstants.md b/markdown/bitburner.tix.getconstants.md new file mode 100644 index 000000000..49c6bc211 --- /dev/null +++ b/markdown/bitburner.tix.getconstants.md @@ -0,0 +1,21 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [TIX](./bitburner.tix.md) > [getConstants](./bitburner.tix.getconstants.md) + +## TIX.getConstants() method + +Get game constants for the stock market mechanic. + +**Signature:** + +```typescript +getConstants(): StockMarketConstants; +``` +**Returns:** + +[StockMarketConstants](./bitburner.stockmarketconstants.md) + +## Remarks + +RAM cost: 0 GB + diff --git a/markdown/bitburner.tix.md b/markdown/bitburner.tix.md index 8c418eed2..d63d7d7d8 100644 --- a/markdown/bitburner.tix.md +++ b/markdown/bitburner.tix.md @@ -21,6 +21,7 @@ export interface TIX | [cancelOrder(sym, shares, price, type, pos)](./bitburner.tix.cancelorder.md) | Cancel order for stocks. | | [getAskPrice(sym)](./bitburner.tix.getaskprice.md) | Returns the ask price of that stock. | | [getBidPrice(sym)](./bitburner.tix.getbidprice.md) | Returns the bid price of that stock. | +| [getConstants()](./bitburner.tix.getconstants.md) | Get game constants for the stock market mechanic. | | [getForecast(sym)](./bitburner.tix.getforecast.md) | Returns the probability that the specified stock’s price will increase (as opposed to decrease) during the next tick. | | [getMaxShares(sym)](./bitburner.tix.getmaxshares.md) | Returns the maximum number of shares of a stock. | | [getOrders()](./bitburner.tix.getorders.md) | Returns your order book for the stock market. | diff --git a/src/Constants.ts b/src/Constants.ts index 90ebde8fc..9b480317c 100644 --- a/src/Constants.ts +++ b/src/Constants.ts @@ -228,6 +228,11 @@ Changes below include spoilers. ### NETSCRIPT: +* Added ns.stock.getConstants (@Snarling) * ns.sleeve.setToFactionWork no longer allows working for factions the player has not joined. (@Snarling) + +### Internal Code Refactors + +* Reorganize game constants (@zerbosh) `, }; diff --git a/src/Netscript/RamCostGenerator.ts b/src/Netscript/RamCostGenerator.ts index 65a0d6cc1..365faab99 100644 --- a/src/Netscript/RamCostGenerator.ts +++ b/src/Netscript/RamCostGenerator.ts @@ -118,6 +118,7 @@ const hacknet = { // Stock API const stock = { + getConstants: 0, hasWSEAccount: 0.05, hasTIXAPIAccess: 0.05, has4SData: 0.05, @@ -348,7 +349,7 @@ const grafting = { const corporation = { hasCorporation: 0, // This one is free - getConstants: RamCostConstants.Corporation, + getConstants: 0, getIndustryData: RamCostConstants.Corporation, getMaterialData: RamCostConstants.Corporation, issueNewShares: RamCostConstants.Corporation, diff --git a/src/NetscriptFunctions/StockMarket.ts b/src/NetscriptFunctions/StockMarket.ts index 33cbef034..9d4bda3f5 100644 --- a/src/NetscriptFunctions/StockMarket.ts +++ b/src/NetscriptFunctions/StockMarket.ts @@ -1,4 +1,4 @@ -import { Player as player } from "../Player"; +import { Player } from "../Player"; import { buyStock, sellStock, shortStock, sellShort } from "../StockMarket/BuyingAndSelling"; import { StockMarket, SymbolToStockMap, placeOrder, cancelOrder, initStockMarket } from "../StockMarket/StockMarket"; import { getBuyTransactionCost, getSellTransactionGain } from "../StockMarket/StockMarketHelpers"; @@ -13,14 +13,16 @@ import { Stock } from "../StockMarket/Stock"; import { StockOrder, TIX } from "@nsdefs"; import { InternalAPI, NetscriptContext } from "../Netscript/APIWrapper"; import { helpers } from "../Netscript/NetscriptHelpers"; +import { cloneDeep } from "lodash"; +import { StockMarketConstants } from "../StockMarket/data/Constants"; export function NetscriptStockMarket(): InternalAPI