mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-18 12:15:44 +01:00
allbuild commit /usr/bin/git
This commit is contained in:
parent
cbeb6d13d3
commit
f801dc6d8a
42
dist/vendor.bundle.js
vendored
42
dist/vendor.bundle.js
vendored
File diff suppressed because one or more lines are too long
2
dist/vendor.bundle.js.map
vendored
2
dist/vendor.bundle.js.map
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -8,7 +8,12 @@ import { getBuyTransactionCost, getSellTransactionGain } from "../StockMarket/St
|
|||||||
import { OrderTypes } from "../StockMarket/data/OrderTypes";
|
import { OrderTypes } from "../StockMarket/data/OrderTypes";
|
||||||
import { PositionTypes } from "../StockMarket/data/PositionTypes";
|
import { PositionTypes } from "../StockMarket/data/PositionTypes";
|
||||||
import { StockSymbols } from "../StockMarket/data/StockSymbols";
|
import { StockSymbols } from "../StockMarket/data/StockSymbols";
|
||||||
import { getStockMarket4SDataCost, getStockMarket4STixApiCost, getStockMarketWseCost, getStockMarketTixApiCost } from "../StockMarket/StockMarketCosts";
|
import {
|
||||||
|
getStockMarket4SDataCost,
|
||||||
|
getStockMarket4STixApiCost,
|
||||||
|
getStockMarketWseCost,
|
||||||
|
getStockMarketTixApiCost,
|
||||||
|
} from "../StockMarket/StockMarketCosts";
|
||||||
import { Stock } from "../StockMarket/Stock";
|
import { Stock } from "../StockMarket/Stock";
|
||||||
import { TIX } from "../ScriptEditor/NetscriptDefinitions";
|
import { TIX } from "../ScriptEditor/NetscriptDefinitions";
|
||||||
|
|
||||||
@ -40,32 +45,32 @@ export function NetscriptStockMarket(player: IPlayer, workerScript: WorkerScript
|
|||||||
return Object.values(StockSymbols);
|
return Object.values(StockSymbols);
|
||||||
},
|
},
|
||||||
getPrice: function (_symbol: unknown): number {
|
getPrice: function (_symbol: unknown): number {
|
||||||
const symbol = helper.string("getPrice", "symbol", _symbol);
|
|
||||||
helper.updateDynamicRam("getPrice", getRamCost(player, "stock", "getPrice"));
|
helper.updateDynamicRam("getPrice", getRamCost(player, "stock", "getPrice"));
|
||||||
|
const symbol = helper.string("getPrice", "symbol", _symbol);
|
||||||
checkTixApiAccess("getPrice");
|
checkTixApiAccess("getPrice");
|
||||||
const stock = getStockFromSymbol(symbol, "getPrice");
|
const stock = getStockFromSymbol(symbol, "getPrice");
|
||||||
|
|
||||||
return stock.price;
|
return stock.price;
|
||||||
},
|
},
|
||||||
getAskPrice: function (_symbol: unknown): number {
|
getAskPrice: function (_symbol: unknown): number {
|
||||||
const symbol = helper.string("getAskPrice", "symbol", _symbol);
|
|
||||||
helper.updateDynamicRam("getAskPrice", getRamCost(player, "stock", "getAskPrice"));
|
helper.updateDynamicRam("getAskPrice", getRamCost(player, "stock", "getAskPrice"));
|
||||||
|
const symbol = helper.string("getAskPrice", "symbol", _symbol);
|
||||||
checkTixApiAccess("getAskPrice");
|
checkTixApiAccess("getAskPrice");
|
||||||
const stock = getStockFromSymbol(symbol, "getAskPrice");
|
const stock = getStockFromSymbol(symbol, "getAskPrice");
|
||||||
|
|
||||||
return stock.getAskPrice();
|
return stock.getAskPrice();
|
||||||
},
|
},
|
||||||
getBidPrice: function (_symbol: unknown): number {
|
getBidPrice: function (_symbol: unknown): number {
|
||||||
const symbol = helper.string("getBidPrice", "symbol", _symbol);
|
|
||||||
helper.updateDynamicRam("getBidPrice", getRamCost(player, "stock", "getBidPrice"));
|
helper.updateDynamicRam("getBidPrice", getRamCost(player, "stock", "getBidPrice"));
|
||||||
|
const symbol = helper.string("getBidPrice", "symbol", _symbol);
|
||||||
checkTixApiAccess("getBidPrice");
|
checkTixApiAccess("getBidPrice");
|
||||||
const stock = getStockFromSymbol(symbol, "getBidPrice");
|
const stock = getStockFromSymbol(symbol, "getBidPrice");
|
||||||
|
|
||||||
return stock.getBidPrice();
|
return stock.getBidPrice();
|
||||||
},
|
},
|
||||||
getPosition: function (_symbol: unknown): [number, number, number, number] {
|
getPosition: function (_symbol: unknown): [number, number, number, number] {
|
||||||
const symbol = helper.string("getPosition", "symbol", _symbol);
|
|
||||||
helper.updateDynamicRam("getPosition", getRamCost(player, "stock", "getPosition"));
|
helper.updateDynamicRam("getPosition", getRamCost(player, "stock", "getPosition"));
|
||||||
|
const symbol = helper.string("getPosition", "symbol", _symbol);
|
||||||
checkTixApiAccess("getPosition");
|
checkTixApiAccess("getPosition");
|
||||||
const stock = SymbolToStockMap[symbol];
|
const stock = SymbolToStockMap[symbol];
|
||||||
if (stock == null) {
|
if (stock == null) {
|
||||||
@ -74,18 +79,18 @@ export function NetscriptStockMarket(player: IPlayer, workerScript: WorkerScript
|
|||||||
return [stock.playerShares, stock.playerAvgPx, stock.playerShortShares, stock.playerAvgShortPx];
|
return [stock.playerShares, stock.playerAvgPx, stock.playerShortShares, stock.playerAvgShortPx];
|
||||||
},
|
},
|
||||||
getMaxShares: function (_symbol: unknown): number {
|
getMaxShares: function (_symbol: unknown): number {
|
||||||
const symbol = helper.string("getMaxShares", "symbol", _symbol);
|
|
||||||
helper.updateDynamicRam("getMaxShares", getRamCost(player, "stock", "getMaxShares"));
|
helper.updateDynamicRam("getMaxShares", getRamCost(player, "stock", "getMaxShares"));
|
||||||
|
const symbol = helper.string("getMaxShares", "symbol", _symbol);
|
||||||
checkTixApiAccess("getMaxShares");
|
checkTixApiAccess("getMaxShares");
|
||||||
const stock = getStockFromSymbol(symbol, "getMaxShares");
|
const stock = getStockFromSymbol(symbol, "getMaxShares");
|
||||||
|
|
||||||
return stock.maxShares;
|
return stock.maxShares;
|
||||||
},
|
},
|
||||||
getPurchaseCost: function (_symbol: unknown, _shares: unknown, _posType: unknown): number {
|
getPurchaseCost: function (_symbol: unknown, _shares: unknown, _posType: unknown): number {
|
||||||
|
helper.updateDynamicRam("getPurchaseCost", getRamCost(player, "stock", "getPurchaseCost"));
|
||||||
const symbol = helper.string("getPurchaseCost", "symbol", _symbol);
|
const symbol = helper.string("getPurchaseCost", "symbol", _symbol);
|
||||||
let shares = helper.number("getPurchaseCost", "shares", _shares);
|
let shares = helper.number("getPurchaseCost", "shares", _shares);
|
||||||
const posType = helper.string("getPurchaseCost", "posType", _posType);
|
const posType = helper.string("getPurchaseCost", "posType", _posType);
|
||||||
helper.updateDynamicRam("getPurchaseCost", getRamCost(player, "stock", "getPurchaseCost"));
|
|
||||||
checkTixApiAccess("getPurchaseCost");
|
checkTixApiAccess("getPurchaseCost");
|
||||||
const stock = getStockFromSymbol(symbol, "getPurchaseCost");
|
const stock = getStockFromSymbol(symbol, "getPurchaseCost");
|
||||||
shares = Math.round(shares);
|
shares = Math.round(shares);
|
||||||
@ -108,10 +113,10 @@ export function NetscriptStockMarket(player: IPlayer, workerScript: WorkerScript
|
|||||||
return res;
|
return res;
|
||||||
},
|
},
|
||||||
getSaleGain: function (_symbol: unknown, _shares: unknown, _posType: unknown): number {
|
getSaleGain: function (_symbol: unknown, _shares: unknown, _posType: unknown): number {
|
||||||
|
helper.updateDynamicRam("getSaleGain", getRamCost(player, "stock", "getSaleGain"));
|
||||||
const symbol = helper.string("getSaleGain", "symbol", _symbol);
|
const symbol = helper.string("getSaleGain", "symbol", _symbol);
|
||||||
let shares = helper.number("getSaleGain", "shares", _shares);
|
let shares = helper.number("getSaleGain", "shares", _shares);
|
||||||
const posType = helper.string("getSaleGain", "posType", _posType);
|
const posType = helper.string("getSaleGain", "posType", _posType);
|
||||||
helper.updateDynamicRam("getSaleGain", getRamCost(player, "stock", "getSaleGain"));
|
|
||||||
checkTixApiAccess("getSaleGain");
|
checkTixApiAccess("getSaleGain");
|
||||||
const stock = getStockFromSymbol(symbol, "getSaleGain");
|
const stock = getStockFromSymbol(symbol, "getSaleGain");
|
||||||
shares = Math.round(shares);
|
shares = Math.round(shares);
|
||||||
@ -134,18 +139,18 @@ export function NetscriptStockMarket(player: IPlayer, workerScript: WorkerScript
|
|||||||
return res;
|
return res;
|
||||||
},
|
},
|
||||||
buy: function (_symbol: unknown, _shares: unknown): number {
|
buy: function (_symbol: unknown, _shares: unknown): number {
|
||||||
|
helper.updateDynamicRam("buy", getRamCost(player, "stock", "buy"));
|
||||||
const symbol = helper.string("buy", "symbol", _symbol);
|
const symbol = helper.string("buy", "symbol", _symbol);
|
||||||
const shares = helper.number("buy", "shares", _shares);
|
const shares = helper.number("buy", "shares", _shares);
|
||||||
helper.updateDynamicRam("buy", getRamCost(player, "stock", "buy"));
|
|
||||||
checkTixApiAccess("buy");
|
checkTixApiAccess("buy");
|
||||||
const stock = getStockFromSymbol(symbol, "buy");
|
const stock = getStockFromSymbol(symbol, "buy");
|
||||||
const res = buyStock(stock, shares, workerScript, {});
|
const res = buyStock(stock, shares, workerScript, {});
|
||||||
return res ? stock.getAskPrice() : 0;
|
return res ? stock.getAskPrice() : 0;
|
||||||
},
|
},
|
||||||
sell: function (_symbol: unknown, _shares: unknown): number {
|
sell: function (_symbol: unknown, _shares: unknown): number {
|
||||||
|
helper.updateDynamicRam("sell", getRamCost(player, "stock", "sell"));
|
||||||
const symbol = helper.string("sell", "symbol", _symbol);
|
const symbol = helper.string("sell", "symbol", _symbol);
|
||||||
const shares = helper.number("sell", "shares", _shares);
|
const shares = helper.number("sell", "shares", _shares);
|
||||||
helper.updateDynamicRam("sell", getRamCost(player, "stock", "sell"));
|
|
||||||
checkTixApiAccess("sell");
|
checkTixApiAccess("sell");
|
||||||
const stock = getStockFromSymbol(symbol, "sell");
|
const stock = getStockFromSymbol(symbol, "sell");
|
||||||
const res = sellStock(stock, shares, workerScript, {});
|
const res = sellStock(stock, shares, workerScript, {});
|
||||||
@ -153,9 +158,9 @@ export function NetscriptStockMarket(player: IPlayer, workerScript: WorkerScript
|
|||||||
return res ? stock.getBidPrice() : 0;
|
return res ? stock.getBidPrice() : 0;
|
||||||
},
|
},
|
||||||
short: function (_symbol: unknown, _shares: unknown): number {
|
short: function (_symbol: unknown, _shares: unknown): number {
|
||||||
|
helper.updateDynamicRam("short", getRamCost(player, "stock", "short"));
|
||||||
const symbol = helper.string("short", "symbol", _symbol);
|
const symbol = helper.string("short", "symbol", _symbol);
|
||||||
const shares = helper.number("short", "shares", _shares);
|
const shares = helper.number("short", "shares", _shares);
|
||||||
helper.updateDynamicRam("short", getRamCost(player, "stock", "short"));
|
|
||||||
checkTixApiAccess("short");
|
checkTixApiAccess("short");
|
||||||
if (player.bitNodeN !== 8) {
|
if (player.bitNodeN !== 8) {
|
||||||
if (player.sourceFileLvl(8) <= 1) {
|
if (player.sourceFileLvl(8) <= 1) {
|
||||||
@ -171,9 +176,9 @@ export function NetscriptStockMarket(player: IPlayer, workerScript: WorkerScript
|
|||||||
return res ? stock.getBidPrice() : 0;
|
return res ? stock.getBidPrice() : 0;
|
||||||
},
|
},
|
||||||
sellShort: function (_symbol: unknown, _shares: unknown): number {
|
sellShort: function (_symbol: unknown, _shares: unknown): number {
|
||||||
|
helper.updateDynamicRam("sellShort", getRamCost(player, "stock", "sellShort"));
|
||||||
const symbol = helper.string("sellShort", "symbol", _symbol);
|
const symbol = helper.string("sellShort", "symbol", _symbol);
|
||||||
const shares = helper.number("sellShort", "shares", _shares);
|
const shares = helper.number("sellShort", "shares", _shares);
|
||||||
helper.updateDynamicRam("sellShort", getRamCost(player, "stock", "sellShort"));
|
|
||||||
checkTixApiAccess("sellShort");
|
checkTixApiAccess("sellShort");
|
||||||
if (player.bitNodeN !== 8) {
|
if (player.bitNodeN !== 8) {
|
||||||
if (player.sourceFileLvl(8) <= 1) {
|
if (player.sourceFileLvl(8) <= 1) {
|
||||||
@ -189,12 +194,12 @@ export function NetscriptStockMarket(player: IPlayer, workerScript: WorkerScript
|
|||||||
return res ? stock.getAskPrice() : 0;
|
return res ? stock.getAskPrice() : 0;
|
||||||
},
|
},
|
||||||
placeOrder: function (_symbol: unknown, _shares: unknown, _price: unknown, _type: unknown, _pos: unknown): boolean {
|
placeOrder: function (_symbol: unknown, _shares: unknown, _price: unknown, _type: unknown, _pos: unknown): boolean {
|
||||||
|
helper.updateDynamicRam("placeOrder", getRamCost(player, "stock", "placeOrder"));
|
||||||
const symbol = helper.string("placeOrder", "symbol", _symbol);
|
const symbol = helper.string("placeOrder", "symbol", _symbol);
|
||||||
const shares = helper.number("placeOrder", "shares", _shares);
|
const shares = helper.number("placeOrder", "shares", _shares);
|
||||||
const price = helper.number("placeOrder", "price", _price);
|
const price = helper.number("placeOrder", "price", _price);
|
||||||
const type = helper.string("placeOrder", "type", _type);
|
const type = helper.string("placeOrder", "type", _type);
|
||||||
const pos = helper.string("placeOrder", "pos", _pos);
|
const pos = helper.string("placeOrder", "pos", _pos);
|
||||||
helper.updateDynamicRam("placeOrder", getRamCost(player, "stock", "placeOrder"));
|
|
||||||
checkTixApiAccess("placeOrder");
|
checkTixApiAccess("placeOrder");
|
||||||
if (player.bitNodeN !== 8) {
|
if (player.bitNodeN !== 8) {
|
||||||
if (player.sourceFileLvl(8) <= 2) {
|
if (player.sourceFileLvl(8) <= 2) {
|
||||||
@ -239,12 +244,12 @@ export function NetscriptStockMarket(player: IPlayer, workerScript: WorkerScript
|
|||||||
_type: unknown,
|
_type: unknown,
|
||||||
_pos: unknown,
|
_pos: unknown,
|
||||||
): boolean {
|
): boolean {
|
||||||
|
helper.updateDynamicRam("cancelOrder", getRamCost(player, "stock", "cancelOrder"));
|
||||||
const symbol = helper.string("cancelOrder", "symbol", _symbol);
|
const symbol = helper.string("cancelOrder", "symbol", _symbol);
|
||||||
const shares = helper.number("cancelOrder", "shares", _shares);
|
const shares = helper.number("cancelOrder", "shares", _shares);
|
||||||
const price = helper.number("cancelOrder", "price", _price);
|
const price = helper.number("cancelOrder", "price", _price);
|
||||||
const type = helper.string("cancelOrder", "type", _type);
|
const type = helper.string("cancelOrder", "type", _type);
|
||||||
const pos = helper.string("cancelOrder", "pos", _pos);
|
const pos = helper.string("cancelOrder", "pos", _pos);
|
||||||
helper.updateDynamicRam("cancelOrder", getRamCost(player, "stock", "cancelOrder"));
|
|
||||||
checkTixApiAccess("cancelOrder");
|
checkTixApiAccess("cancelOrder");
|
||||||
if (player.bitNodeN !== 8) {
|
if (player.bitNodeN !== 8) {
|
||||||
if (player.sourceFileLvl(8) <= 2) {
|
if (player.sourceFileLvl(8) <= 2) {
|
||||||
@ -326,8 +331,8 @@ export function NetscriptStockMarket(player: IPlayer, workerScript: WorkerScript
|
|||||||
return orders;
|
return orders;
|
||||||
},
|
},
|
||||||
getVolatility: function (_symbol: unknown): number {
|
getVolatility: function (_symbol: unknown): number {
|
||||||
const symbol = helper.string("getVolatility", "symbol", _symbol);
|
|
||||||
helper.updateDynamicRam("getVolatility", getRamCost(player, "stock", "getVolatility"));
|
helper.updateDynamicRam("getVolatility", getRamCost(player, "stock", "getVolatility"));
|
||||||
|
const symbol = helper.string("getVolatility", "symbol", _symbol);
|
||||||
if (!player.has4SDataTixApi) {
|
if (!player.has4SDataTixApi) {
|
||||||
throw helper.makeRuntimeErrorMsg("getVolatility", "You don't have 4S Market Data TIX API Access!");
|
throw helper.makeRuntimeErrorMsg("getVolatility", "You don't have 4S Market Data TIX API Access!");
|
||||||
}
|
}
|
||||||
@ -336,8 +341,8 @@ export function NetscriptStockMarket(player: IPlayer, workerScript: WorkerScript
|
|||||||
return stock.mv / 100; // Convert from percentage to decimal
|
return stock.mv / 100; // Convert from percentage to decimal
|
||||||
},
|
},
|
||||||
getForecast: function (_symbol: unknown): number {
|
getForecast: function (_symbol: unknown): number {
|
||||||
const symbol = helper.string("getForecast", "symbol", _symbol);
|
|
||||||
helper.updateDynamicRam("getForecast", getRamCost(player, "stock", "getForecast"));
|
helper.updateDynamicRam("getForecast", getRamCost(player, "stock", "getForecast"));
|
||||||
|
const symbol = helper.string("getForecast", "symbol", _symbol);
|
||||||
if (!player.has4SDataTixApi) {
|
if (!player.has4SDataTixApi) {
|
||||||
throw helper.makeRuntimeErrorMsg("getForecast", "You don't have 4S Market Data TIX API Access!");
|
throw helper.makeRuntimeErrorMsg("getForecast", "You don't have 4S Market Data TIX API Access!");
|
||||||
}
|
}
|
||||||
@ -397,10 +402,7 @@ export function NetscriptStockMarket(player: IPlayer, workerScript: WorkerScript
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (player.money < getStockMarketWseCost()) {
|
if (player.money < getStockMarketWseCost()) {
|
||||||
workerScript.log(
|
workerScript.log("stock.purchaseWseAccount", () => "Not enough money to purchase WSE Account Access");
|
||||||
"stock.purchaseWseAccount",
|
|
||||||
() => "Not enough money to purchase WSE Account Access",
|
|
||||||
);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -418,10 +420,7 @@ export function NetscriptStockMarket(player: IPlayer, workerScript: WorkerScript
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (player.money < getStockMarketTixApiCost()) {
|
if (player.money < getStockMarketTixApiCost()) {
|
||||||
workerScript.log(
|
workerScript.log("stock.purchaseTixApi", () => "Not enough money to purchase TIX API Access");
|
||||||
"stock.purchaseTixApi",
|
|
||||||
() => "Not enough money to purchase TIX API Access",
|
|
||||||
);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user