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 | | [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. | | [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. | | [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. | | [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. | | [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. | | [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 | | productName | string | Name of the product |
| amt | string | Amount to sell, can be "MAX" | | amt | string | Amount to sell, can be "MAX" |
| price | string | Price to sell, can be "MP" | | 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:** **Returns:**

@ -553,7 +553,8 @@ export class Division {
sCost = optimalPrice; sCost = optimalPrice;
} else if (mat.marketTa1) { } else if (mat.marketTa1) {
sCost = mat.marketPrice + markupLimit; 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 = mat.desiredSellPrice.replace(/MP/g, mat.marketPrice.toString());
sCost = eval(sCost); sCost = eval(sCost);
} else { } else {

@ -57,7 +57,7 @@ export class Material {
// Player inputs for sell price and amount. // Player inputs for sell price and amount.
desiredSellAmount: string | number = 0; desiredSellAmount: string | number = 0;
desiredSellPrice: string | number = 0; desiredSellPrice: string | number = "";
// Flags that signal whether automatic sale pricing through Market TA is enabled // Flags that signal whether automatic sale pricing through Market TA is enabled
marketTa1 = false; marketTa1 = false;

@ -81,7 +81,7 @@ export class Product {
/** Player input sell amount e.g. "MAX" */ /** Player input sell amount e.g. "MAX" */
desiredSellAmount: 0 as number | string, desiredSellAmount: 0 as number | string,
/** Player input sell price e.g. "MP * 5" */ /** 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 */ /** 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 { SellMaterial } from "../../Actions";
import { KEY } from "../../../utils/helpers/keyCodes"; 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 { interface IProps {
open: boolean; open: boolean;
onClose: () => void; onClose: () => void;
@ -28,8 +18,8 @@ interface IProps {
// Create a popup that let the player manage sales of a material // Create a popup that let the player manage sales of a material
export function SellMaterialModal(props: IProps): React.ReactElement { export function SellMaterialModal(props: IProps): React.ReactElement {
const [amt, setAmt] = useState<string>(props.mat.desiredSellAmount + ""); const [amt, setAmt] = useState<string>(String(props.mat.desiredSellAmount));
const [price, setPrice] = useState<string>(initialPrice(props.mat)); const [price, setPrice] = useState<string>(String(props.mat.desiredSellPrice));
function sellMaterial(): void { function sellMaterial(): void {
try { try {

@ -10,16 +10,6 @@ import { dialogBoxCreate } from "../../../ui/React/DialogBox";
import { SellProduct } from "../../Actions"; import { SellProduct } from "../../Actions";
import { KEY } from "../../../utils/helpers/keyCodes"; 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 { interface IProps {
open: boolean; open: boolean;
onClose: () => void; onClose: () => void;
@ -31,8 +21,8 @@ interface IProps {
// Create a popup that let the player manage sales of a material // Create a popup that let the player manage sales of a material
export function SellProductModal(props: IProps): React.ReactElement { export function SellProductModal(props: IProps): React.ReactElement {
const [checked, setChecked] = useState(true); const [checked, setChecked] = useState(true);
const [iQty, setQty] = useState<string>((props.product.cityData[props.city].desiredSellAmount ?? "").toString()); const [iQty, setQty] = useState<string>(String(props.product.cityData[props.city].desiredSellAmount));
const [px, setPx] = useState<string>(initialPrice(props.product, props.city)); const [px, setPx] = useState<string>(String(props.product.cityData[props.city].desiredSellPrice));
function onCheckedChange(event: React.ChangeEvent<HTMLInputElement>): void { function onCheckedChange(event: React.ChangeEvent<HTMLInputElement>): void {
setChecked(event.target.checked); setChecked(event.target.checked);