mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-19 12:45:45 +01:00
throw error when trying to pass non-string or number to other scripts
This commit is contained in:
parent
0419118fb1
commit
c4f59d4129
26
dist/vendor.bundle.js
vendored
26
dist/vendor.bundle.js
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
@ -16,7 +16,6 @@ interface IMarketTA2Props {
|
|||||||
function MarketTA2(props: IMarketTA2Props): React.ReactElement {
|
function MarketTA2(props: IMarketTA2Props): React.ReactElement {
|
||||||
const division = useDivision();
|
const division = useDivision();
|
||||||
if (!division.hasResearch("Market-TA.II")) return <></>;
|
if (!division.hasResearch("Market-TA.II")) return <></>;
|
||||||
props.mat.marketTa2 = false;
|
|
||||||
const [newCost, setNewCost] = useState<number>(props.mat.bCost);
|
const [newCost, setNewCost] = useState<number>(props.mat.bCost);
|
||||||
const setRerender = useState(false)[1];
|
const setRerender = useState(false)[1];
|
||||||
function rerender(): void {
|
function rerender(): void {
|
||||||
@ -88,7 +87,6 @@ interface IProps {
|
|||||||
|
|
||||||
// Create a popup that lets the player use the Market TA research for Materials
|
// Create a popup that lets the player use the Market TA research for Materials
|
||||||
export function MaterialMarketTaModal(props: IProps): React.ReactElement {
|
export function MaterialMarketTaModal(props: IProps): React.ReactElement {
|
||||||
const division = useDivision();
|
|
||||||
const setRerender = useState(false)[1];
|
const setRerender = useState(false)[1];
|
||||||
function rerender(): void {
|
function rerender(): void {
|
||||||
setRerender((old) => !old);
|
setRerender((old) => !old);
|
||||||
@ -102,32 +100,31 @@ export function MaterialMarketTaModal(props: IProps): React.ReactElement {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal open={props.open} onClose={props.onClose}>
|
<Modal open={props.open} onClose={props.onClose}>
|
||||||
{!division.hasResearch("Market-TA.II") && (
|
<>
|
||||||
<>
|
<Typography variant="h4">Market-TA.I</Typography>
|
||||||
<Typography variant="h4">Market-TA.I</Typography>
|
<Typography>
|
||||||
<Typography>
|
The maximum sale price you can mark this up to is {numeralWrapper.formatMoney(props.mat.bCost + markupLimit)}.
|
||||||
The maximum sale price you can mark this up to is{" "}
|
This means that if you set the sale price higher than this, you will begin to experience a loss in number of
|
||||||
{numeralWrapper.formatMoney(props.mat.bCost + markupLimit)}. This means that if you set the sale price
|
sales
|
||||||
higher than this, you will begin to experience a loss in number of sales
|
</Typography>
|
||||||
</Typography>
|
|
||||||
|
<FormControlLabel
|
||||||
|
control={<Switch checked={props.mat.marketTa1} onChange={onMarketTA1} />}
|
||||||
|
label={
|
||||||
|
<Tooltip
|
||||||
|
title={
|
||||||
|
<Typography>
|
||||||
|
If this is enabled, then this Material will automatically be sold at the price identified by
|
||||||
|
Market-TA.I (i.e. the price shown above)
|
||||||
|
</Typography>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<Typography>Use Market-TA.I for Auto-Sale Price</Typography>
|
||||||
|
</Tooltip>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
|
||||||
<FormControlLabel
|
|
||||||
control={<Switch checked={props.mat.marketTa1} onChange={onMarketTA1} />}
|
|
||||||
label={
|
|
||||||
<Tooltip
|
|
||||||
title={
|
|
||||||
<Typography>
|
|
||||||
If this is enabled, then this Material will automatically be sold at the price identified by
|
|
||||||
Market-TA.I (i.e. the price shown above)
|
|
||||||
</Typography>
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<Typography>Use Market-TA.I for Auto-Sale Price</Typography>
|
|
||||||
</Tooltip>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
<MarketTA2 mat={props.mat} />
|
<MarketTA2 mat={props.mat} />
|
||||||
</Modal>
|
</Modal>
|
||||||
);
|
);
|
||||||
|
@ -16,7 +16,6 @@ interface ITa2Props {
|
|||||||
function MarketTA2(props: ITa2Props): React.ReactElement {
|
function MarketTA2(props: ITa2Props): React.ReactElement {
|
||||||
const division = useDivision();
|
const division = useDivision();
|
||||||
if (!division.hasResearch("Market-TA.II")) return <></>;
|
if (!division.hasResearch("Market-TA.II")) return <></>;
|
||||||
props.product.marketTa1 = false;
|
|
||||||
const markupLimit = props.product.rat / props.product.mku;
|
const markupLimit = props.product.rat / props.product.mku;
|
||||||
const [value, setValue] = useState(props.product.pCost);
|
const [value, setValue] = useState(props.product.pCost);
|
||||||
const setRerender = useState(false)[1];
|
const setRerender = useState(false)[1];
|
||||||
@ -93,32 +92,31 @@ export function ProductMarketTaModal(props: IProps): React.ReactElement {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal open={props.open} onClose={props.onClose}>
|
<Modal open={props.open} onClose={props.onClose}>
|
||||||
{!division.hasResearch("Market-TA.II") && (
|
<>
|
||||||
<>
|
<Typography variant="h4">Market-TA.I</Typography>
|
||||||
<Typography variant="h4">Market-TA.I</Typography>
|
<Typography>
|
||||||
<Typography>
|
The maximum sale price you can mark this up to is{" "}
|
||||||
The maximum sale price you can mark this up to is{" "}
|
{numeralWrapper.formatMoney(props.product.pCost + markupLimit)}. This means that if you set the sale price
|
||||||
{numeralWrapper.formatMoney(props.product.pCost + markupLimit)}. This means that if you set the sale price
|
higher than this, you will begin to experience a loss in number of sales
|
||||||
higher than this, you will begin to experience a loss in number of sales
|
</Typography>
|
||||||
</Typography>
|
|
||||||
|
<FormControlLabel
|
||||||
|
control={<Switch checked={props.product.marketTa1} onChange={onChange} />}
|
||||||
|
label={
|
||||||
|
<Tooltip
|
||||||
|
title={
|
||||||
|
<Typography>
|
||||||
|
If this is enabled, then this Material will automatically be sold at the price identified by
|
||||||
|
Market-TA.I (i.e. the price shown above)
|
||||||
|
</Typography>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<Typography>Use Market-TA.I for Auto-Sale Price</Typography>
|
||||||
|
</Tooltip>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
|
||||||
<FormControlLabel
|
|
||||||
control={<Switch checked={props.product.marketTa1} onChange={onChange} />}
|
|
||||||
label={
|
|
||||||
<Tooltip
|
|
||||||
title={
|
|
||||||
<Typography>
|
|
||||||
If this is enabled, then this Material will automatically be sold at the price identified by
|
|
||||||
Market-TA.I (i.e. the price shown above)
|
|
||||||
</Typography>
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<Typography>Use Market-TA.I for Auto-Sale Price</Typography>
|
|
||||||
</Tooltip>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
<MarketTA2 product={props.product} />
|
<MarketTA2 product={props.product} />
|
||||||
</Modal>
|
</Modal>
|
||||||
);
|
);
|
||||||
|
@ -646,9 +646,9 @@ export function runScriptFromScript(
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
args = args.map((arg) => {
|
args.forEach((arg) => {
|
||||||
if (typeof arg === "number") return arg;
|
if (typeof arg !== "string" && typeof arg !== "number")
|
||||||
return arg + ""; // force cast to string
|
throw new Error("Only strings and numbers can be passed as arguments to otherscripts.");
|
||||||
});
|
});
|
||||||
|
|
||||||
// Check if the script is already running
|
// Check if the script is already running
|
||||||
|
Loading…
Reference in New Issue
Block a user