From 8a2f8bb746666e400b2346ced87587ad9fee3817 Mon Sep 17 00:00:00 2001 From: Femboy Fireball <111195856+femboyfireball@users.noreply.github.com> Date: Sat, 4 Oct 2025 21:45:42 +0000 Subject: [PATCH] UI: Clarify why you can't buy 4S when disabled (#2311) --- src/NetscriptFunctions/StockMarket.ts | 4 +- src/StockMarket/ui/InfoAndPurchases.tsx | 165 ++++++++++++++---------- 2 files changed, 99 insertions(+), 70 deletions(-) diff --git a/src/NetscriptFunctions/StockMarket.ts b/src/NetscriptFunctions/StockMarket.ts index 3626ffcf7..dc4e43793 100644 --- a/src/NetscriptFunctions/StockMarket.ts +++ b/src/NetscriptFunctions/StockMarket.ts @@ -247,7 +247,7 @@ export function NetscriptStockMarket(): InternalAPI { }, purchase4SMarketData: (ctx) => () => { if (Player.bitNodeOptions.disable4SData) { - helpers.log(ctx, () => "4S Market Data is disabled."); + helpers.log(ctx, () => "4S Market Data is disabled in advanced BitNode options."); return false; } @@ -268,7 +268,7 @@ export function NetscriptStockMarket(): InternalAPI { }, purchase4SMarketDataTixApi: (ctx) => () => { if (Player.bitNodeOptions.disable4SData) { - helpers.log(ctx, () => "4S Market Data is disabled."); + helpers.log(ctx, () => "4S Market Data is disabled in advanced BitNode options."); return false; } diff --git a/src/StockMarket/ui/InfoAndPurchases.tsx b/src/StockMarket/ui/InfoAndPurchases.tsx index 5a4af1db3..c68878bc7 100644 --- a/src/StockMarket/ui/InfoAndPurchases.tsx +++ b/src/StockMarket/ui/InfoAndPurchases.tsx @@ -30,6 +30,12 @@ function Purchase4SMarketDataTixApiAccessButton(props: IProps): React.ReactEleme if (Player.has4SDataTixApi) { return; } + if (Player.bitNodeOptions.disable4SData) { + return; + } + if (!Player.hasTixApiAccess) { + return; + } if (!Player.canAfford(getStockMarket4STixApiCost())) { return; } @@ -44,30 +50,29 @@ function Purchase4SMarketDataTixApiAccessButton(props: IProps): React.ReactEleme Market Data TIX API Access ); - } else { - const cost = getStockMarket4STixApiCost(); - return ( - Requires TIX API Access - ) : ( - Let you access 4S Market Data through Netscript - ) - } - > - - - - - ); } + const cost = getStockMarket4STixApiCost(); + let tooltipTitle = "Let you access 4S Market Data through Netscript"; + if (Player.bitNodeOptions.disable4SData) { + tooltipTitle = "4S Market Data is disabled in advanced BitNode options"; + } else if (!Player.hasTixApiAccess) { + tooltipTitle = "Requires TIX API Access"; + } else if (!Player.canAfford(cost)) { + tooltipTitle = "You do not have enough money"; + } + return ( + {tooltipTitle}}> + + + + + ); } function PurchaseWseAccountButton(props: IProps): React.ReactElement { @@ -92,23 +97,31 @@ function PurchaseWseAccountButton(props: IProps): React.ReactElement { } const cost = StockMarketConstants.WseAccountCost; + let tooltipTitle = "Let you trade stock"; + if (!Player.canAfford(cost)) { + tooltipTitle = "You do not have enough money"; + } return ( <> To begin trading, you must first purchase an account: - + {tooltipTitle}}> + + + + ); } function PurchaseTixApiAccessButton(props: IProps): React.ReactElement { function purchaseTixApiAccess(): void { - if (Player.bitNodeOptions.disable4SData) { + if (Player.hasTixApiAccess) { return; } - if (Player.hasTixApiAccess) { + if (!Player.hasWseAccount) { return; } if (!Player.canAfford(StockMarketConstants.TixApiCost)) { @@ -125,23 +138,35 @@ function PurchaseTixApiAccessButton(props: IProps): React.ReactElement { TIX API Access ); - } else { - const cost = StockMarketConstants.TixApiCost; - return ( - - ); } + const cost = StockMarketConstants.TixApiCost; + let tooltipTitle = "Let you trade stock through Netscript"; + if (!Player.hasWseAccount) { + tooltipTitle = "Requires WSE Account"; + } else if (!Player.canAfford(cost)) { + tooltipTitle = "You do not have enough money"; + } + return ( + {tooltipTitle}}> + + + + + ); } function Purchase4SMarketDataButton(props: IProps): React.ReactElement { function purchase4SMarketData(): void { + if (Player.has4SData) { + return; + } if (Player.bitNodeOptions.disable4SData) { return; } - if (Player.has4SData) { + if (!Player.hasWseAccount) { return; } if (!Player.canAfford(getStockMarket4SDataCost())) { @@ -157,21 +182,29 @@ function Purchase4SMarketDataButton(props: IProps): React.ReactElement { 4S Market Data Access ); - } else { - const cost = getStockMarket4SDataCost(); - return ( - Lets you view additional pricing and volatility information about stocks} - > - - - - - ); } + const cost = getStockMarket4SDataCost(); + let tooltipTitle = "Lets you view additional pricing and volatility information about stocks"; + if (Player.bitNodeOptions.disable4SData) { + tooltipTitle = "4S Market Data is disabled in advanced BitNode options"; + } else if (!Player.hasWseAccount) { + tooltipTitle = "Requires WSE Account"; + } else if (!Player.canAfford(cost)) { + tooltipTitle = "You do not have enough money"; + } + return ( + {tooltipTitle}}> + + + + + ); } export function InfoAndPurchases(props: IProps): React.ReactElement { @@ -190,22 +223,18 @@ export function InfoAndPurchases(props: IProps): React.ReactElement { the TIX API lets you write code to create your own algorithmic/automated trading strategies. - {!Player.bitNodeOptions.disable4SData && ( - <> - - {FactionName.FourSigma} (4S) Market Data Feed - - - {FactionName.FourSigma}'s (4S) Market Data Feed provides information about stocks that will help your - trading strategies. - setHelpOpen(true)}> - - - - - - - )} + + {FactionName.FourSigma} (4S) Market Data Feed + + + {FactionName.FourSigma}'s (4S) Market Data Feed provides information about stocks that will help your trading + strategies. + setHelpOpen(true)}> + + + + + Commission Fees: Every transaction you make has a{" "} commission fee.