Added option to suppress TIX limit/stop orders

This commit is contained in:
Olivier Gagnon
2021-12-08 20:21:44 -05:00
parent c915cd06d8
commit d195b00ab6
5 changed files with 41 additions and 21 deletions

View File

@@ -17,6 +17,7 @@ import { numeralWrapper } from "../ui/numeralFormat";
import { Money } from "../ui/React/Money";
import { dialogBoxCreate } from "../ui/React/DialogBox";
import { Settings } from "../Settings/Settings";
import * as React from "react";
@@ -150,12 +151,14 @@ function executeOrder(order: Order, refs: IProcessOrderRefs): void {
for (let i = 0; i < stockOrders.length; ++i) {
if (order == stockOrders[i]) {
stockOrders.splice(i, 1);
dialogBoxCreate(
<>
{order.type} for {stock.symbol} @ <Money money={order.price} /> ({pos}) was filled (
{numeralWrapper.formatShares(Math.round(order.shares))} shares)
</>,
);
if (!Settings.SuppressTIXPopup) {
dialogBoxCreate(
<>
{order.type} for {stock.symbol} @ <Money money={order.price} /> ({pos}) was filled (
{numeralWrapper.formatShares(Math.round(order.shares))} shares)
</>,
);
}
return;
}
}

View File

@@ -68,7 +68,7 @@ export function GameOptionsRoot(props: IProps): React.ReactElement {
const [suppressBuyAugmentationConfirmation, setSuppressBuyAugmentationConfirmation] = useState(
Settings.SuppressBuyAugmentationConfirmation,
);
const [suppressTIXPopup, setSuppressTIXPopup] = useState(Settings.SuppressTIXPopup);
const [suppressBladeburnerPopup, setSuppressBladeburnerPopup] = useState(Settings.SuppressBladeburnerPopup);
const [disableHotkeys, setDisableHotkeys] = useState(Settings.DisableHotkeys);
@@ -128,6 +128,11 @@ export function GameOptionsRoot(props: IProps): React.ReactElement {
Settings.SuppressBuyAugmentationConfirmation = event.target.checked;
}
function handleSuppressTIXPopupChange(event: React.ChangeEvent<HTMLInputElement>): void {
setSuppressTIXPopup(event.target.checked);
Settings.SuppressTIXPopup = event.target.checked;
}
function handleSuppressBladeburnerPopupChange(event: React.ChangeEvent<HTMLInputElement>): void {
setSuppressBladeburnerPopup(event.target.checked);
Settings.SuppressBladeburnerPopup = event.target.checked;
@@ -382,6 +387,18 @@ export function GameOptionsRoot(props: IProps): React.ReactElement {
}
/>
</ListItem>
<ListItem>
<FormControlLabel
control={<Switch checked={suppressTIXPopup} onChange={handleSuppressTIXPopupChange} />}
label={
<Tooltip
title={<Typography>If this is set, the stock market will never create any popup.</Typography>}
>
<Typography>Suppress TIX messages</Typography>
</Tooltip>
}
/>
</ListItem>
{!!props.player.bladeburner && (
<ListItem>
<FormControlLabel