mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-16 06:18:42 +02:00
UI: Clarify why you can't buy 4S when disabled (#2311)
This commit is contained in:
@@ -247,7 +247,7 @@ export function NetscriptStockMarket(): InternalAPI<TIX> {
|
||||
},
|
||||
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<TIX> {
|
||||
},
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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 <CheckIcon />
|
||||
</Typography>
|
||||
);
|
||||
} else {
|
||||
const cost = getStockMarket4STixApiCost();
|
||||
return (
|
||||
<Tooltip
|
||||
title={
|
||||
!Player.hasTixApiAccess ? (
|
||||
<Typography>Requires TIX API Access</Typography>
|
||||
) : (
|
||||
<Typography>Let you access 4S Market Data through Netscript</Typography>
|
||||
)
|
||||
}
|
||||
>
|
||||
<span>
|
||||
<Button
|
||||
disabled={!Player.hasTixApiAccess || !Player.canAfford(cost)}
|
||||
onClick={purchase4SMarketDataTixApiAccess}
|
||||
>
|
||||
Buy 4S Market Data TIX API Access -
|
||||
<Money money={cost} forPurchase={true} />
|
||||
</Button>
|
||||
</span>
|
||||
</Tooltip>
|
||||
);
|
||||
}
|
||||
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 (
|
||||
<Tooltip title={<Typography>{tooltipTitle}</Typography>}>
|
||||
<span>
|
||||
<Button
|
||||
disabled={Player.bitNodeOptions.disable4SData || !Player.hasTixApiAccess || !Player.canAfford(cost)}
|
||||
onClick={purchase4SMarketDataTixApiAccess}
|
||||
>
|
||||
Buy 4S Market Data TIX API Access -
|
||||
<Money money={cost} forPurchase={true} />
|
||||
</Button>
|
||||
</span>
|
||||
</Tooltip>
|
||||
);
|
||||
}
|
||||
|
||||
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 (
|
||||
<>
|
||||
<Typography>To begin trading, you must first purchase an account:</Typography>
|
||||
<Button disabled={!Player.canAfford(cost)} onClick={purchaseWseAccount}>
|
||||
Buy WSE Account -
|
||||
<Money money={cost} forPurchase={true} />
|
||||
</Button>
|
||||
<Tooltip title={<Typography>{tooltipTitle}</Typography>}>
|
||||
<span>
|
||||
<Button disabled={!Player.canAfford(cost)} onClick={purchaseWseAccount}>
|
||||
Buy WSE Account -
|
||||
<Money money={cost} forPurchase={true} />
|
||||
</Button>
|
||||
</span>
|
||||
</Tooltip>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
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 <CheckIcon />
|
||||
</Typography>
|
||||
);
|
||||
} else {
|
||||
const cost = StockMarketConstants.TixApiCost;
|
||||
return (
|
||||
<Button disabled={!Player.canAfford(cost) || !Player.hasWseAccount} onClick={purchaseTixApiAccess}>
|
||||
Buy Trade Information eXchange (TIX) API Access -
|
||||
<Money money={cost} forPurchase={true} />
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
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 (
|
||||
<Tooltip title={<Typography>{tooltipTitle}</Typography>}>
|
||||
<span>
|
||||
<Button disabled={!Player.hasWseAccount || !Player.canAfford(cost)} onClick={purchaseTixApiAccess}>
|
||||
Buy Trade Information eXchange (TIX) API Access -
|
||||
<Money money={cost} forPurchase={true} />
|
||||
</Button>
|
||||
</span>
|
||||
</Tooltip>
|
||||
);
|
||||
}
|
||||
|
||||
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 <CheckIcon />
|
||||
</Typography>
|
||||
);
|
||||
} else {
|
||||
const cost = getStockMarket4SDataCost();
|
||||
return (
|
||||
<Tooltip
|
||||
title={<Typography>Lets you view additional pricing and volatility information about stocks</Typography>}
|
||||
>
|
||||
<span>
|
||||
<Button disabled={!Player.canAfford(cost) || !Player.hasWseAccount} onClick={purchase4SMarketData}>
|
||||
Buy 4S Market Data Access -
|
||||
<Money money={cost} forPurchase={true} />
|
||||
</Button>
|
||||
</span>
|
||||
</Tooltip>
|
||||
);
|
||||
}
|
||||
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 (
|
||||
<Tooltip title={<Typography>{tooltipTitle}</Typography>}>
|
||||
<span>
|
||||
<Button
|
||||
disabled={Player.bitNodeOptions.disable4SData || !Player.hasWseAccount || !Player.canAfford(cost)}
|
||||
onClick={purchase4SMarketData}
|
||||
>
|
||||
Buy 4S Market Data Access -
|
||||
<Money money={cost} forPurchase={true} />
|
||||
</Button>
|
||||
</span>
|
||||
</Tooltip>
|
||||
);
|
||||
}
|
||||
|
||||
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.
|
||||
</Typography>
|
||||
<PurchaseTixApiAccessButton {...props} />
|
||||
{!Player.bitNodeOptions.disable4SData && (
|
||||
<>
|
||||
<Typography variant="h5" color="primary">
|
||||
{FactionName.FourSigma} (4S) Market Data Feed
|
||||
</Typography>
|
||||
<Typography>
|
||||
{FactionName.FourSigma}'s (4S) Market Data Feed provides information about stocks that will help your
|
||||
trading strategies.
|
||||
<IconButton onClick={() => setHelpOpen(true)}>
|
||||
<HelpIcon />
|
||||
</IconButton>
|
||||
</Typography>
|
||||
<Purchase4SMarketDataTixApiAccessButton {...props} />
|
||||
<Purchase4SMarketDataButton {...props} />
|
||||
</>
|
||||
)}
|
||||
<Typography variant="h5" color="primary">
|
||||
{FactionName.FourSigma} (4S) Market Data Feed
|
||||
</Typography>
|
||||
<Typography>
|
||||
{FactionName.FourSigma}'s (4S) Market Data Feed provides information about stocks that will help your trading
|
||||
strategies.
|
||||
<IconButton onClick={() => setHelpOpen(true)}>
|
||||
<HelpIcon />
|
||||
</IconButton>
|
||||
</Typography>
|
||||
<Purchase4SMarketDataTixApiAccessButton {...props} />
|
||||
<Purchase4SMarketDataButton {...props} />
|
||||
<Typography>
|
||||
Commission Fees: Every transaction you make has a{" "}
|
||||
<Money money={StockMarketConstants.StockMarketCommission} forPurchase={true} /> commission fee.
|
||||
|
||||
Reference in New Issue
Block a user