mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-08 08:43:53 +01:00
NETSCRIPT: Add ns.stock.getConstants (#692)
This commit is contained in:
parent
a85efbc4da
commit
1c6369ffa4
@ -34,12 +34,10 @@ declare enum JobName
|
||||
| IT3 | <code>"Systems Administrator"</code> | |
|
||||
| networkEng0 | <code>"Network Engineer"</code> | |
|
||||
| networkEng1 | <code>"Network Administrator"</code> | |
|
||||
| security0 | <code>"Police Officer"</code> | |
|
||||
| security1 | <code>"Police Chief"</code> | |
|
||||
| security2 | <code>"Security Guard"</code> | |
|
||||
| security3 | <code>"Security Officer"</code> | |
|
||||
| security4 | <code>"Security Supervisor"</code> | |
|
||||
| security5 | <code>"Head of Security"</code> | |
|
||||
| security0 | <code>"Security Guard"</code> | |
|
||||
| security1 | <code>"Security Officer"</code> | |
|
||||
| security2 | <code>"Security Supervisor"</code> | |
|
||||
| security3 | <code>"Head of Security"</code> | |
|
||||
| securityEng | <code>"Security Engineer"</code> | |
|
||||
| software0 | <code>"Software Engineering Intern"</code> | |
|
||||
| software1 | <code>"Junior Software Engineer"</code> | |
|
||||
|
@ -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) | <p>Return value of [getOrders](./bitburner.tix.getorders.md)</p><p>Keys are stock symbols, properties are arrays of [StockOrderObject](./bitburner.stockorderobject.md)</p> |
|
||||
| [StockOrderObject](./bitburner.stockorderobject.md) | Value in map of [StockOrder](./bitburner.stockorder.md) |
|
||||
| [TailProperties](./bitburner.tailproperties.md) | |
|
||||
|
13
markdown/bitburner.stockmarketconstants.marketdata4scost.md
Normal file
13
markdown/bitburner.stockmarketconstants.marketdata4scost.md
Normal file
@ -0,0 +1,13 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[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;
|
||||
```
|
@ -0,0 +1,13 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[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;
|
||||
```
|
27
markdown/bitburner.stockmarketconstants.md
Normal file
27
markdown/bitburner.stockmarketconstants.md
Normal file
@ -0,0 +1,27 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[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 |
|
||||
|
13
markdown/bitburner.stockmarketconstants.msperstockupdate.md
Normal file
13
markdown/bitburner.stockmarketconstants.msperstockupdate.md
Normal file
@ -0,0 +1,13 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[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;
|
||||
```
|
@ -0,0 +1,13 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[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;
|
||||
```
|
@ -0,0 +1,13 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[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;
|
||||
```
|
13
markdown/bitburner.stockmarketconstants.tickspercycle.md
Normal file
13
markdown/bitburner.stockmarketconstants.tickspercycle.md
Normal file
@ -0,0 +1,13 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[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;
|
||||
```
|
13
markdown/bitburner.stockmarketconstants.tixapicost.md
Normal file
13
markdown/bitburner.stockmarketconstants.tixapicost.md
Normal file
@ -0,0 +1,13 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[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;
|
||||
```
|
13
markdown/bitburner.stockmarketconstants.wseaccountcost.md
Normal file
13
markdown/bitburner.stockmarketconstants.wseaccountcost.md
Normal file
@ -0,0 +1,13 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[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;
|
||||
```
|
21
markdown/bitburner.tix.getconstants.md
Normal file
21
markdown/bitburner.tix.getconstants.md
Normal file
@ -0,0 +1,21 @@
|
||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[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
|
||||
|
@ -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. |
|
||||
|
@ -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)
|
||||
`,
|
||||
};
|
||||
|
@ -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,
|
||||
|
@ -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<TIX> {
|
||||
/** Checks if the player has TIX API access. Throws an error if the player does not */
|
||||
const checkTixApiAccess = function (ctx: NetscriptContext): void {
|
||||
if (!player.hasWseAccount) {
|
||||
if (!Player.hasWseAccount) {
|
||||
throw helpers.makeRuntimeErrorMsg(ctx, `You don't have WSE Access! Cannot use ${ctx.function}()`);
|
||||
}
|
||||
if (!player.hasTixApiAccess) {
|
||||
if (!Player.hasTixApiAccess) {
|
||||
throw helpers.makeRuntimeErrorMsg(ctx, `You don't have TIX API Access! Cannot use ${ctx.function}()`);
|
||||
}
|
||||
};
|
||||
@ -35,18 +37,11 @@ export function NetscriptStockMarket(): InternalAPI<TIX> {
|
||||
};
|
||||
|
||||
return {
|
||||
hasWSEAccount: () => () => {
|
||||
return player.hasWseAccount;
|
||||
},
|
||||
hasTIXAPIAccess: () => () => {
|
||||
return player.hasTixApiAccess;
|
||||
},
|
||||
has4SData: () => () => {
|
||||
return player.has4SData;
|
||||
},
|
||||
has4SDataTIXAPI: () => () => {
|
||||
return player.has4SDataTixApi;
|
||||
},
|
||||
getConstants: () => () => cloneDeep(StockMarketConstants),
|
||||
hasWSEAccount: () => () => Player.hasWseAccount,
|
||||
hasTIXAPIAccess: () => () => Player.hasTixApiAccess,
|
||||
has4SData: () => () => Player.has4SData,
|
||||
has4SDataTIXAPI: () => () => Player.has4SDataTixApi,
|
||||
getSymbols: (ctx) => () => {
|
||||
checkTixApiAccess(ctx);
|
||||
return Object.values(StockSymbol);
|
||||
@ -166,8 +161,8 @@ export function NetscriptStockMarket(): InternalAPI<TIX> {
|
||||
const symbol = helpers.string(ctx, "symbol", _symbol);
|
||||
const shares = helpers.number(ctx, "shares", _shares);
|
||||
checkTixApiAccess(ctx);
|
||||
if (player.bitNodeN !== 8) {
|
||||
if (player.sourceFileLvl(8) <= 1) {
|
||||
if (Player.bitNodeN !== 8) {
|
||||
if (Player.sourceFileLvl(8) <= 1) {
|
||||
throw helpers.makeRuntimeErrorMsg(
|
||||
ctx,
|
||||
"You must either be in BitNode-8 or you must have Source-File 8 Level 2.",
|
||||
@ -183,8 +178,8 @@ export function NetscriptStockMarket(): InternalAPI<TIX> {
|
||||
const symbol = helpers.string(ctx, "symbol", _symbol);
|
||||
const shares = helpers.number(ctx, "shares", _shares);
|
||||
checkTixApiAccess(ctx);
|
||||
if (player.bitNodeN !== 8) {
|
||||
if (player.sourceFileLvl(8) <= 1) {
|
||||
if (Player.bitNodeN !== 8) {
|
||||
if (Player.sourceFileLvl(8) <= 1) {
|
||||
throw helpers.makeRuntimeErrorMsg(
|
||||
ctx,
|
||||
"You must either be in BitNode-8 or you must have Source-File 8 Level 2.",
|
||||
@ -203,8 +198,8 @@ export function NetscriptStockMarket(): InternalAPI<TIX> {
|
||||
const type = helpers.string(ctx, "type", _type);
|
||||
const pos = helpers.string(ctx, "pos", _pos);
|
||||
checkTixApiAccess(ctx);
|
||||
if (player.bitNodeN !== 8) {
|
||||
if (player.sourceFileLvl(8) <= 2) {
|
||||
if (Player.bitNodeN !== 8) {
|
||||
if (Player.sourceFileLvl(8) <= 2) {
|
||||
throw helpers.makeRuntimeErrorMsg(
|
||||
ctx,
|
||||
"You must either be in BitNode-8 or you must have Source-File 8 Level 3.",
|
||||
@ -246,8 +241,8 @@ export function NetscriptStockMarket(): InternalAPI<TIX> {
|
||||
const type = helpers.string(ctx, "type", _type);
|
||||
const pos = helpers.string(ctx, "pos", _pos);
|
||||
checkTixApiAccess(ctx);
|
||||
if (player.bitNodeN !== 8) {
|
||||
if (player.sourceFileLvl(8) <= 2) {
|
||||
if (Player.bitNodeN !== 8) {
|
||||
if (Player.sourceFileLvl(8) <= 2) {
|
||||
throw helpers.makeRuntimeErrorMsg(
|
||||
ctx,
|
||||
"You must either be in BitNode-8 or you must have Source-File 8 Level 3.",
|
||||
@ -295,8 +290,8 @@ export function NetscriptStockMarket(): InternalAPI<TIX> {
|
||||
},
|
||||
getOrders: (ctx) => () => {
|
||||
checkTixApiAccess(ctx);
|
||||
if (player.bitNodeN !== 8) {
|
||||
if (player.sourceFileLvl(8) <= 2) {
|
||||
if (Player.bitNodeN !== 8) {
|
||||
if (Player.sourceFileLvl(8) <= 2) {
|
||||
throw helpers.makeRuntimeErrorMsg(ctx, "You must either be in BitNode-8 or have Source-File 8 Level 3.");
|
||||
}
|
||||
}
|
||||
@ -323,7 +318,7 @@ export function NetscriptStockMarket(): InternalAPI<TIX> {
|
||||
},
|
||||
getVolatility: (ctx) => (_symbol) => {
|
||||
const symbol = helpers.string(ctx, "symbol", _symbol);
|
||||
if (!player.has4SDataTixApi) {
|
||||
if (!Player.has4SDataTixApi) {
|
||||
throw helpers.makeRuntimeErrorMsg(ctx, "You don't have 4S Market Data TIX API Access!");
|
||||
}
|
||||
const stock = getStockFromSymbol(ctx, symbol);
|
||||
@ -332,7 +327,7 @@ export function NetscriptStockMarket(): InternalAPI<TIX> {
|
||||
},
|
||||
getForecast: (ctx) => (_symbol) => {
|
||||
const symbol = helpers.string(ctx, "symbol", _symbol);
|
||||
if (!player.has4SDataTixApi) {
|
||||
if (!Player.has4SDataTixApi) {
|
||||
throw helpers.makeRuntimeErrorMsg(ctx, "You don't have 4S Market Data TIX API Access!");
|
||||
}
|
||||
const stock = getStockFromSymbol(ctx, symbol);
|
||||
@ -342,69 +337,69 @@ export function NetscriptStockMarket(): InternalAPI<TIX> {
|
||||
return forecast / 100; // Convert from percentage to decimal
|
||||
},
|
||||
purchase4SMarketData: (ctx) => () => {
|
||||
if (player.has4SData) {
|
||||
if (Player.has4SData) {
|
||||
helpers.log(ctx, () => "Already purchased 4S Market Data.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (player.money < getStockMarket4SDataCost()) {
|
||||
if (Player.money < getStockMarket4SDataCost()) {
|
||||
helpers.log(ctx, () => "Not enough money to purchase 4S Market Data.");
|
||||
return false;
|
||||
}
|
||||
|
||||
player.has4SData = true;
|
||||
player.loseMoney(getStockMarket4SDataCost(), "stock");
|
||||
Player.has4SData = true;
|
||||
Player.loseMoney(getStockMarket4SDataCost(), "stock");
|
||||
helpers.log(ctx, () => "Purchased 4S Market Data");
|
||||
return true;
|
||||
},
|
||||
purchase4SMarketDataTixApi: (ctx) => () => {
|
||||
checkTixApiAccess(ctx);
|
||||
|
||||
if (player.has4SDataTixApi) {
|
||||
if (Player.has4SDataTixApi) {
|
||||
helpers.log(ctx, () => "Already purchased 4S Market Data TIX API");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (player.money < getStockMarket4STixApiCost()) {
|
||||
if (Player.money < getStockMarket4STixApiCost()) {
|
||||
helpers.log(ctx, () => "Not enough money to purchase 4S Market Data TIX API");
|
||||
return false;
|
||||
}
|
||||
|
||||
player.has4SDataTixApi = true;
|
||||
player.loseMoney(getStockMarket4STixApiCost(), "stock");
|
||||
Player.has4SDataTixApi = true;
|
||||
Player.loseMoney(getStockMarket4STixApiCost(), "stock");
|
||||
helpers.log(ctx, () => "Purchased 4S Market Data TIX API");
|
||||
return true;
|
||||
},
|
||||
purchaseWseAccount: (ctx) => () => {
|
||||
if (player.hasWseAccount) {
|
||||
if (Player.hasWseAccount) {
|
||||
helpers.log(ctx, () => "Already purchased WSE Account");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (player.money < getStockMarketWseCost()) {
|
||||
if (Player.money < getStockMarketWseCost()) {
|
||||
helpers.log(ctx, () => "Not enough money to purchase WSE Account Access");
|
||||
return false;
|
||||
}
|
||||
|
||||
player.hasWseAccount = true;
|
||||
Player.hasWseAccount = true;
|
||||
initStockMarket();
|
||||
player.loseMoney(getStockMarketWseCost(), "stock");
|
||||
Player.loseMoney(getStockMarketWseCost(), "stock");
|
||||
helpers.log(ctx, () => "Purchased WSE Account Access");
|
||||
return true;
|
||||
},
|
||||
purchaseTixApi: (ctx) => () => {
|
||||
if (player.hasTixApiAccess) {
|
||||
if (Player.hasTixApiAccess) {
|
||||
helpers.log(ctx, () => "Already purchased TIX API");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (player.money < getStockMarketTixApiCost()) {
|
||||
if (Player.money < getStockMarketTixApiCost()) {
|
||||
helpers.log(ctx, () => "Not enough money to purchase TIX API Access");
|
||||
return false;
|
||||
}
|
||||
|
||||
player.hasTixApiAccess = true;
|
||||
player.loseMoney(getStockMarketTixApiCost(), "stock");
|
||||
Player.hasTixApiAccess = true;
|
||||
Player.loseMoney(getStockMarketTixApiCost(), "stock");
|
||||
helpers.log(ctx, () => "Purchased TIX API");
|
||||
return true;
|
||||
},
|
||||
|
24
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
24
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
@ -393,6 +393,27 @@ interface StockOrder {
|
||||
[key: string]: StockOrderObject[];
|
||||
}
|
||||
|
||||
/** Constants used for the stockmarket game mechanic.
|
||||
* @public */
|
||||
interface StockMarketConstants {
|
||||
/** Normal time in ms between stock market updates */
|
||||
msPerStockUpdate: number;
|
||||
/** Minimum time in ms between stock market updates if there is stored offline/bonus time */
|
||||
msPerStockUpdateMin: number;
|
||||
/** An internal constant used while determining when to flip a stock's forecast */
|
||||
TicksPerCycle: number;
|
||||
/** Cost of the WSE account */
|
||||
WSEAccountCost: number;
|
||||
/** Cost of the TIX API */
|
||||
TIXAPICost: number;
|
||||
/** Cost of the 4S Market Data */
|
||||
MarketData4SCost: number;
|
||||
/** Cost of the 4S Market Data TIX API integration */
|
||||
MarketDataTixApi4SCost: number;
|
||||
/** Commission fee for transactions */
|
||||
StockMarketCommission: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* A single process on a server.
|
||||
* @public
|
||||
@ -1077,6 +1098,9 @@ export interface NetscriptPort {
|
||||
* @public
|
||||
*/
|
||||
export interface TIX {
|
||||
/** Get game constants for the stock market mechanic.
|
||||
* @remarks RAM cost: 0 GB */
|
||||
getConstants(): StockMarketConstants;
|
||||
/**
|
||||
* Returns true if the player has access to a WSE Account
|
||||
* @remarks RAM cost: 0.05 GB
|
||||
|
@ -1,12 +1,9 @@
|
||||
export const StockMarketConstants = {
|
||||
//stock tick times in milliseconds
|
||||
import { StockMarketConstants as ConstantsType } from "@nsdefs";
|
||||
|
||||
export const StockMarketConstants: ConstantsType = {
|
||||
msPerStockUpdate: 6e3,
|
||||
msPerStockUpdateMin: 4e3,
|
||||
|
||||
//defines the length of the flip timer in stock cycles
|
||||
TicksPerCycle: 75,
|
||||
|
||||
// Stockmarket costs Constants
|
||||
WSEAccountCost: 200e6,
|
||||
TIXAPICost: 5e9,
|
||||
MarketData4SCost: 1e9,
|
||||
|
Loading…
Reference in New Issue
Block a user