From d914040ae7c097daf944440f6ecf71a57e29e482 Mon Sep 17 00:00:00 2001 From: Caldwell <115591472+Caldwell-74@users.noreply.github.com> Date: Wed, 13 Sep 2023 01:49:51 +0200 Subject: [PATCH] CORPORATION: Remove Market TA string in sell dialog text fields (#784) --- ...rner.bitnodemultipliers.corporationdivisions.md | 13 +++++++++++++ markdown/bitburner.bitnodemultipliers.md | 1 + markdown/bitburner.warehouseapi.sellproduct.md | 2 +- src/Corporation/Division.ts | 3 ++- src/Corporation/Material.ts | 2 +- src/Corporation/Product.ts | 2 +- src/Corporation/ui/modals/SellMaterialModal.tsx | 14 ++------------ src/Corporation/ui/modals/SellProductModal.tsx | 14 ++------------ 8 files changed, 23 insertions(+), 28 deletions(-) create mode 100644 markdown/bitburner.bitnodemultipliers.corporationdivisions.md diff --git a/markdown/bitburner.bitnodemultipliers.corporationdivisions.md b/markdown/bitburner.bitnodemultipliers.corporationdivisions.md new file mode 100644 index 000000000..702d9263a --- /dev/null +++ b/markdown/bitburner.bitnodemultipliers.corporationdivisions.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [BitNodeMultipliers](./bitburner.bitnodemultipliers.md) > [CorporationDivisions](./bitburner.bitnodemultipliers.corporationdivisions.md) + +## BitNodeMultipliers.CorporationDivisions property + +Influences the amount of divisions a corporation can have have at the same time + +**Signature:** + +```typescript +CorporationDivisions: number; +``` diff --git a/markdown/bitburner.bitnodemultipliers.md b/markdown/bitburner.bitnodemultipliers.md index 68cedb90a..e50713cd1 100644 --- a/markdown/bitburner.bitnodemultipliers.md +++ b/markdown/bitburner.bitnodemultipliers.md @@ -26,6 +26,7 @@ interface BitNodeMultipliers | [CodingContractMoney](./bitburner.bitnodemultipliers.codingcontractmoney.md) | | number | Influences the amount of money gained from completing Coding Contracts | | [CompanyWorkExpGain](./bitburner.bitnodemultipliers.companyworkexpgain.md) | | number | Influences the experience gained for each ability when the player completes working their job. | | [CompanyWorkMoney](./bitburner.bitnodemultipliers.companyworkmoney.md) | | number | Influences how much money the player earns when completing working their job. | +| [CorporationDivisions](./bitburner.bitnodemultipliers.corporationdivisions.md) | | number | Influences the amount of divisions a corporation can have have at the same time | | [CorporationSoftcap](./bitburner.bitnodemultipliers.corporationsoftcap.md) | | number | Influences the money gain from dividends of corporations created by the player. | | [CorporationValuation](./bitburner.bitnodemultipliers.corporationvaluation.md) | | number | Influences the valuation of corporations created by the player. | | [CrimeExpGain](./bitburner.bitnodemultipliers.crimeexpgain.md) | | number | Influences the base experience gained for each ability when the player commits a crime. | diff --git a/markdown/bitburner.warehouseapi.sellproduct.md b/markdown/bitburner.warehouseapi.sellproduct.md index 280997e9e..9444a4874 100644 --- a/markdown/bitburner.warehouseapi.sellproduct.md +++ b/markdown/bitburner.warehouseapi.sellproduct.md @@ -28,7 +28,7 @@ sellProduct( | productName | string | Name of the product | | amt | string | Amount to sell, can be "MAX" | | price | string | Price to sell, can be "MP" | -| all | boolean | Sell in all city | +| all | boolean | Set sell amount and price in all cities | **Returns:** diff --git a/src/Corporation/Division.ts b/src/Corporation/Division.ts index 0bc5d1e2c..bd84301e0 100644 --- a/src/Corporation/Division.ts +++ b/src/Corporation/Division.ts @@ -553,7 +553,8 @@ export class Division { sCost = optimalPrice; } else if (mat.marketTa1) { sCost = mat.marketPrice + markupLimit; - } else if (isString(mat.desiredSellPrice)) { + // check truthyness to avoid unnecessary eval + } else if (isString(mat.desiredSellPrice) && mat.desiredSellPrice) { sCost = mat.desiredSellPrice.replace(/MP/g, mat.marketPrice.toString()); sCost = eval(sCost); } else { diff --git a/src/Corporation/Material.ts b/src/Corporation/Material.ts index e87eaba7b..574233c6a 100644 --- a/src/Corporation/Material.ts +++ b/src/Corporation/Material.ts @@ -57,7 +57,7 @@ export class Material { // Player inputs for sell price and amount. desiredSellAmount: string | number = 0; - desiredSellPrice: string | number = 0; + desiredSellPrice: string | number = ""; // Flags that signal whether automatic sale pricing through Market TA is enabled marketTa1 = false; diff --git a/src/Corporation/Product.ts b/src/Corporation/Product.ts index 1959492d5..ff6593d79 100644 --- a/src/Corporation/Product.ts +++ b/src/Corporation/Product.ts @@ -81,7 +81,7 @@ export class Product { /** Player input sell amount e.g. "MAX" */ desiredSellAmount: 0 as number | string, /** Player input sell price e.g. "MP * 5" */ - desiredSellPrice: 0 as number | string, + desiredSellPrice: "" as string | number, })); /** How much warehouse space is occupied per unit of this product */ diff --git a/src/Corporation/ui/modals/SellMaterialModal.tsx b/src/Corporation/ui/modals/SellMaterialModal.tsx index b2a5ab035..e6c321421 100644 --- a/src/Corporation/ui/modals/SellMaterialModal.tsx +++ b/src/Corporation/ui/modals/SellMaterialModal.tsx @@ -9,16 +9,6 @@ import { dialogBoxCreate } from "../../../ui/React/DialogBox"; import { SellMaterial } from "../../Actions"; import { KEY } from "../../../utils/helpers/keyCodes"; -function initialPrice(mat: Material): string { - let val = mat.desiredSellPrice ? mat.desiredSellPrice + "" : ""; - if (mat.marketTa2) { - val += " (Market-TA.II)"; - } else if (mat.marketTa1) { - val += " (Market-TA.I)"; - } - return val; -} - interface IProps { open: boolean; onClose: () => void; @@ -28,8 +18,8 @@ interface IProps { // Create a popup that let the player manage sales of a material export function SellMaterialModal(props: IProps): React.ReactElement { - const [amt, setAmt] = useState(props.mat.desiredSellAmount + ""); - const [price, setPrice] = useState(initialPrice(props.mat)); + const [amt, setAmt] = useState(String(props.mat.desiredSellAmount)); + const [price, setPrice] = useState(String(props.mat.desiredSellPrice)); function sellMaterial(): void { try { diff --git a/src/Corporation/ui/modals/SellProductModal.tsx b/src/Corporation/ui/modals/SellProductModal.tsx index 13af8c6b1..954a13a68 100644 --- a/src/Corporation/ui/modals/SellProductModal.tsx +++ b/src/Corporation/ui/modals/SellProductModal.tsx @@ -10,16 +10,6 @@ import { dialogBoxCreate } from "../../../ui/React/DialogBox"; import { SellProduct } from "../../Actions"; import { KEY } from "../../../utils/helpers/keyCodes"; -function initialPrice(product: Product, city: CityName): string { - let val = String(product.cityData[city].desiredSellPrice || ""); - if (product.marketTa2) { - val += " (Market-TA.II)"; - } else if (product.marketTa1) { - val += " (Market-TA.I)"; - } - return val; -} - interface IProps { open: boolean; onClose: () => void; @@ -31,8 +21,8 @@ interface IProps { // Create a popup that let the player manage sales of a material export function SellProductModal(props: IProps): React.ReactElement { const [checked, setChecked] = useState(true); - const [iQty, setQty] = useState((props.product.cityData[props.city].desiredSellAmount ?? "").toString()); - const [px, setPx] = useState(initialPrice(props.product, props.city)); + const [iQty, setQty] = useState(String(props.product.cityData[props.city].desiredSellAmount)); + const [px, setPx] = useState(String(props.product.cityData[props.city].desiredSellPrice)); function onCheckedChange(event: React.ChangeEvent): void { setChecked(event.target.checked);