CORPORATION: Remove Market TA string in sell dialog text fields (#784)

This commit is contained in:
Caldwell 2023-09-13 01:49:51 +02:00 committed by GitHub
parent cb93f4d108
commit d914040ae7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 23 additions and 28 deletions

@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [bitburner](./bitburner.md) &gt; [BitNodeMultipliers](./bitburner.bitnodemultipliers.md) &gt; [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;
```

@ -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. |

@ -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:**

@ -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 {

@ -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;

@ -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 */

@ -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<string>(props.mat.desiredSellAmount + "");
const [price, setPrice] = useState<string>(initialPrice(props.mat));
const [amt, setAmt] = useState<string>(String(props.mat.desiredSellAmount));
const [price, setPrice] = useState<string>(String(props.mat.desiredSellPrice));
function sellMaterial(): void {
try {

@ -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<string>((props.product.cityData[props.city].desiredSellAmount ?? "").toString());
const [px, setPx] = useState<string>(initialPrice(props.product, props.city));
const [iQty, setQty] = useState<string>(String(props.product.cityData[props.city].desiredSellAmount));
const [px, setPx] = useState<string>(String(props.product.cityData[props.city].desiredSellPrice));
function onCheckedChange(event: React.ChangeEvent<HTMLInputElement>): void {
setChecked(event.target.checked);