mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-05-06 15:47:52 +02:00
CODEBASE: Remove duplicate getStockFromSymbol function (#2725)
This commit is contained in:
@@ -26,6 +26,15 @@ import { getEnumHelper } from "../utils/EnumHelper";
|
||||
import { CONSTANTS } from "../Constants";
|
||||
import { getDarknetVolatilityMult } from "../DarkNet/effects/effects";
|
||||
|
||||
export const getStockFromSymbol = function (ctx: NetscriptContext, symbol: string): Stock {
|
||||
const stock = SymbolToStockMap[symbol];
|
||||
if (stock == null) {
|
||||
throw helpers.errorMessage(ctx, `Invalid stock symbol: '${symbol}'`);
|
||||
}
|
||||
|
||||
return stock;
|
||||
};
|
||||
|
||||
export function NetscriptStockMarket(): InternalAPI<StockAPI> {
|
||||
/** Checks if the player has TIX API access. Throws an error if the player does not */
|
||||
const checkTixApiAccess = function (ctx: NetscriptContext): void {
|
||||
@@ -34,15 +43,6 @@ export function NetscriptStockMarket(): InternalAPI<StockAPI> {
|
||||
}
|
||||
};
|
||||
|
||||
const getStockFromSymbol = function (ctx: NetscriptContext, symbol: string): Stock {
|
||||
const stock = SymbolToStockMap[symbol];
|
||||
if (stock == null) {
|
||||
throw helpers.errorMessage(ctx, `Invalid stock symbol: '${symbol}'`);
|
||||
}
|
||||
|
||||
return stock;
|
||||
};
|
||||
|
||||
const stockFunctions: InternalAPI<StockAPI> = {
|
||||
getConstants: () => () => structuredClone(StockMarketConstants),
|
||||
hasWseAccount: () => () => Player.hasWseAccount,
|
||||
@@ -353,12 +353,3 @@ export function NetscriptStockMarket(): InternalAPI<StockAPI> {
|
||||
|
||||
return stockFunctions;
|
||||
}
|
||||
|
||||
export const getStockFromSymbol = function (ctx: NetscriptContext, symbol: string): Stock {
|
||||
const stock = SymbolToStockMap[symbol];
|
||||
if (stock == null) {
|
||||
throw helpers.errorMessage(ctx, `Invalid stock symbol: '${symbol}'`);
|
||||
}
|
||||
|
||||
return stock;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user