From f439f960b7a0bf753fbdb85a44d012e94504d537 Mon Sep 17 00:00:00 2001 From: Tomas Pavlik Date: Thu, 24 Mar 2022 16:13:13 +0100 Subject: [PATCH 01/20] Accept valid JSON arrays in coding contracts --- src/data/codingcontracttypes.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/data/codingcontracttypes.ts b/src/data/codingcontracttypes.ts index 23235fa9a..9eb404b43 100644 --- a/src/data/codingcontracttypes.ts +++ b/src/data/codingcontracttypes.ts @@ -884,14 +884,17 @@ export const codingContractTypesMetadata: ICodingContractTypeMetadata[] = [ dfs(0, 0, left, right, data, "", res); - const sanitizedPlayerAns = removeBracketsFromArrayString(ans).replace(/\s/g, ""); - - const playerAnsArray: string[] = sanitizedPlayerAns.split(","); - if (playerAnsArray.length !== res.length) { + const sanitizedPlayerAns: string = removeBracketsFromArrayString(ans); + const sanitizedPlayerAnsArr: string[] = sanitizedPlayerAns.split(","); + for (let i = 0; i < sanitizedPlayerAnsArr.length; ++i) { + sanitizedPlayerAnsArr[i] = removeQuotesFromString(sanitizedPlayerAnsArr[i]).replace(/\s/g, ""); + } + + if (sanitizedPlayerAnsArr.length !== res.length) { return false; } for (const resultInAnswer of res) { - if (!playerAnsArray.includes(resultInAnswer)) { + if (!sanitizedPlayerAnsArr.includes(resultInAnswer)) { return false; } } From ea14646d39d3fbae3f8e1a75a77d68d9389775b0 Mon Sep 17 00:00:00 2001 From: phyzical Date: Fri, 1 Apr 2022 19:50:21 +0800 Subject: [PATCH 02/20] added check for already expanding into city fixes #3312 --- src/Corporation/Actions.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Corporation/Actions.ts b/src/Corporation/Actions.ts index 0b8e8bd69..d5162bd54 100644 --- a/src/Corporation/Actions.ts +++ b/src/Corporation/Actions.ts @@ -52,13 +52,15 @@ export function NewIndustry(corporation: ICorporation, industry: string, name: s export function NewCity(corporation: ICorporation, division: IIndustry, city: string): void { if (corporation.funds < CorporationConstants.OfficeInitialCost) { throw new Error("You don't have enough company funds to open a new office!"); - } else { - corporation.funds = corporation.funds - CorporationConstants.OfficeInitialCost; - division.offices[city] = new OfficeSpace({ - loc: city, - size: CorporationConstants.OfficeInitialSize, - }); } + if (division.offices[city]) { + throw new Error(`You have already expanded into ${city} for ${division.name}`); + } + corporation.funds = corporation.funds - CorporationConstants.OfficeInitialCost; + division.offices[city] = new OfficeSpace({ + loc: city, + size: CorporationConstants.OfficeInitialSize, + }); } export function UnlockUpgrade(corporation: ICorporation, upgrade: CorporationUnlockUpgrade): void { From a1871fb0e9ce03d12e1a13de8c6e7af39a23e634 Mon Sep 17 00:00:00 2001 From: phyzical Date: Fri, 1 Apr 2022 20:54:07 +0800 Subject: [PATCH 03/20] add logic in dev menu to support easy corp, gang and bladeburner closes #3205 --- src/DevMenu/ui/General.tsx | 41 +++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/src/DevMenu/ui/General.tsx b/src/DevMenu/ui/General.tsx index c6a2532d7..480943fa1 100644 --- a/src/DevMenu/ui/General.tsx +++ b/src/DevMenu/ui/General.tsx @@ -10,6 +10,10 @@ import Button from "@mui/material/Button"; import { Money } from "../../ui/React/Money"; import { IPlayer } from "../../PersonObjects/IPlayer"; import { IRouter } from "../../ui/Router"; +import { MenuItem, SelectChangeEvent, TextField, Select } from "@mui/material"; +import { Bladeburner } from "../../Bladeburner/Bladeburner"; +import { GangConstants } from "../../Gang/data/Constants"; +import { FactionNames } from "../../Faction/data/FactionNames"; interface IProps { player: IPlayer; @@ -18,6 +22,8 @@ interface IProps { export function General(props: IProps): React.ReactElement { const [error, setError] = useState(false); + const [corporationName, setCorporationName] = useState(""); + const [gangFaction, setGangFaction] = useState(""); function addMoney(n: number) { return function () { @@ -45,8 +51,25 @@ export function General(props: IProps): React.ReactElement { props.router.toBitVerse(false, false); } + function createCorporation(): void { + props.player.startCorporation(corporationName); + } + + function joinBladeburner(): void { + props.player.bladeburner = new Bladeburner(props.player); + } + + function startGang(): void { + const isHacking = gangFaction === FactionNames.NiteSec || gangFaction === FactionNames.TheBlackHand; + props.player.startGang(gangFaction, isHacking); + } + + function setGangFactionDropdown(event: SelectChangeEvent): void { + setGangFaction(event.target.value); + } + useEffect(() => { - if (error) throw new ReferenceError('Manually thrown error'); + if (error) throw new ReferenceError("Manually thrown error"); }, [error]); return ( @@ -82,6 +105,22 @@ export function General(props: IProps): React.ReactElement {
+ Corporation Name: + setCorporationName(x.target.value)} /> + +
+ Gang Faction: + + +
+ +
From 1eca9449a0f3f661cb218a26e49a89612fcbe2b9 Mon Sep 17 00:00:00 2001 From: phyzical Date: Fri, 1 Apr 2022 20:58:36 +0800 Subject: [PATCH 04/20] removes spaces in at start and end of product name on creation closes #3007 --- src/Corporation/Actions.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Corporation/Actions.ts b/src/Corporation/Actions.ts index d5162bd54..8855e0478 100644 --- a/src/Corporation/Actions.ts +++ b/src/Corporation/Actions.ts @@ -419,7 +419,7 @@ export function MakeProduct( } const product = new Product({ - name: productName.replace(/[<>]/g, ""), //Sanitize for HTMl elements + name: productName.replace(/[<>]/g, "").trim(), //Sanitize for HTMl elements createCity: city, designCost: designInvest, advCost: marketingInvest, From 2efa3ac35179df2b6f804299367dcdc242b16b79 Mon Sep 17 00:00:00 2001 From: phyzical Date: Fri, 1 Apr 2022 21:05:01 +0800 Subject: [PATCH 05/20] dissalow corporations when multiplier is below 0.15 closes #3003 --- src/Locations/ui/SpecialLocation.tsx | 9 +++++++-- src/NetscriptFunctions/Corporation.ts | 3 +++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Locations/ui/SpecialLocation.tsx b/src/Locations/ui/SpecialLocation.tsx index 3466d960d..778b494a1 100644 --- a/src/Locations/ui/SpecialLocation.tsx +++ b/src/Locations/ui/SpecialLocation.tsx @@ -34,6 +34,7 @@ import { HacknetServer } from "../../Hacknet/HacknetServer"; import { GetServer } from "../../Server/AllServers"; import { ArcadeRoot } from "../../Arcade/ui/ArcadeRoot"; import { FactionNames } from "../../Faction/data/FactionNames"; +import { BitNodeMultipliers } from "../../BitNode/BitNodeMultipliers"; type IProps = { loc: Location; @@ -155,7 +156,11 @@ export function SpecialLocation(props: IProps): React.ReactElement { if (!player.canAccessGrafting()) { return <>; } - return ; + return ( + + ); } function handleCotMG(): void { @@ -302,7 +307,7 @@ export function SpecialLocation(props: IProps): React.ReactElement { return renderGrafting(); } case LocationName.Sector12CityHall: { - return ; + return (BitNodeMultipliers.CorporationSoftCap >= 0.15 && <>) || ; } case LocationName.Sector12NSA: { return renderBladeburner(); diff --git a/src/NetscriptFunctions/Corporation.ts b/src/NetscriptFunctions/Corporation.ts index 95b82c99f..85114bf8e 100644 --- a/src/NetscriptFunctions/Corporation.ts +++ b/src/NetscriptFunctions/Corporation.ts @@ -64,6 +64,7 @@ import { CorporationConstants } from "../Corporation/data/Constants"; import { IndustryUpgrades } from "../Corporation/IndustryUpgrades"; import { ResearchMap } from "../Corporation/ResearchMap"; import { Factions } from "../Faction/Factions"; +import { BitNodeMultipliers } from "../BitNode/BitNodeMultipliers"; export function NetscriptCorporation( player: IPlayer, @@ -74,6 +75,8 @@ export function NetscriptCorporation( if (!player.canAccessCorporation() || player.hasCorporation()) return false; if (!corporationName) return false; if (player.bitNodeN !== 3 && !selfFund) throw new Error("cannot use seed funds outside of BitNode 3"); + if (BitNodeMultipliers.CorporationSoftCap < 0.15) + throw new Error(`You cannot create a corporation for Bitnode ${player.bitNodeN}`); if (selfFund) { if (!player.canAfford(150e9)) return false; From 60f56a55ab4c46547c13e407c66e3737af10d611 Mon Sep 17 00:00:00 2001 From: phyzical Date: Fri, 1 Apr 2022 21:55:23 +0800 Subject: [PATCH 06/20] move modals to a modals folder --- src/Corporation/ui/IndustryOffice.tsx | 4 +- src/Corporation/ui/IndustryOverview.tsx | 4 +- src/Corporation/ui/IndustryWarehouse.tsx | 42 ++++++++--- src/Corporation/ui/MaterialElem.tsx | 28 ++++---- src/Corporation/ui/Overview.tsx | 20 +++--- src/Corporation/ui/ProductElem.tsx | 8 +-- .../ui/{ => modals}/BribeFactionModal.tsx | 14 ++-- .../ui/{ => modals}/BuybackSharesModal.tsx | 19 +++-- .../{ => modals}/CreateCorporationModal.tsx | 12 ++-- .../{ => modals}/DiscontinueProductModal.tsx | 6 +- .../ui/{ => modals}/ExportModal.tsx | 22 +++--- .../ui/{ => modals}/FindInvestorsModal.tsx | 14 ++-- .../ui/{ => modals}/GoPublicModal.tsx | 10 +-- .../ui/{ => modals}/IssueDividendsModal.tsx | 12 ++-- .../ui/{ => modals}/IssueNewSharesModal.tsx | 14 ++-- .../LimitProductProductionModal.tsx | 8 +-- .../ui/{ => modals}/MakeProductModal.tsx | 12 ++-- .../ui/{ => modals}/MaterialMarketTaModal.tsx | 8 +-- .../ui/{ => modals}/ProductMarketTaModal.tsx | 8 +-- .../ui/{ => modals}/PurchaseMaterialModal.tsx | 18 ++--- .../ui/{ => modals}/ResearchModal.tsx | 71 +++++++++++-------- .../ui/{ => modals}/SellMaterialModal.tsx | 10 +-- .../ui/{ => modals}/SellProductModal.tsx | 10 +-- .../ui/{ => modals}/SellSharesModal.tsx | 21 +++--- .../ui/{ => modals}/SmartSupplyModal.tsx | 12 ++-- .../ui/{ => modals}/ThrowPartyModal.tsx | 38 +++++----- .../{ => modals}/UpgradeOfficeSizeModal.tsx | 14 ++-- src/Locations/ui/SpecialLocation.tsx | 2 +- 28 files changed, 254 insertions(+), 207 deletions(-) rename src/Corporation/ui/{ => modals}/BribeFactionModal.tsx (91%) rename src/Corporation/ui/{ => modals}/BuybackSharesModal.tsx (87%) rename src/Corporation/ui/{ => modals}/CreateCorporationModal.tsx (87%) rename src/Corporation/ui/{ => modals}/DiscontinueProductModal.tsx (87%) rename src/Corporation/ui/{ => modals}/ExportModal.tsx (90%) rename src/Corporation/ui/{ => modals}/FindInvestorsModal.tsx (79%) rename src/Corporation/ui/{ => modals}/GoPublicModal.tsx (90%) rename src/Corporation/ui/{ => modals}/IssueDividendsModal.tsx (89%) rename src/Corporation/ui/{ => modals}/IssueNewSharesModal.tsx (92%) rename src/Corporation/ui/{ => modals}/LimitProductProductionModal.tsx (87%) rename src/Corporation/ui/{ => modals}/MakeProductModal.tsx (94%) rename src/Corporation/ui/{ => modals}/MaterialMarketTaModal.tsx (95%) rename src/Corporation/ui/{ => modals}/ProductMarketTaModal.tsx (95%) rename src/Corporation/ui/{ => modals}/PurchaseMaterialModal.tsx (89%) rename src/Corporation/ui/{ => modals}/ResearchModal.tsx (67%) rename src/Corporation/ui/{ => modals}/SellMaterialModal.tsx (91%) rename src/Corporation/ui/{ => modals}/SellProductModal.tsx (93%) rename src/Corporation/ui/{ => modals}/SellSharesModal.tsx (85%) rename src/Corporation/ui/{ => modals}/SmartSupplyModal.tsx (88%) rename src/Corporation/ui/{ => modals}/ThrowPartyModal.tsx (69%) rename src/Corporation/ui/{ => modals}/UpgradeOfficeSizeModal.tsx (89%) diff --git a/src/Corporation/ui/IndustryOffice.tsx b/src/Corporation/ui/IndustryOffice.tsx index af04c7591..10bf65af8 100644 --- a/src/Corporation/ui/IndustryOffice.tsx +++ b/src/Corporation/ui/IndustryOffice.tsx @@ -8,8 +8,8 @@ import { EmployeePositions } from "../EmployeePositions"; import { numeralWrapper } from "../../ui/numeralFormat"; -import { UpgradeOfficeSizeModal } from "./UpgradeOfficeSizeModal"; -import { ThrowPartyModal } from "./ThrowPartyModal"; +import { UpgradeOfficeSizeModal } from "./modals/UpgradeOfficeSizeModal"; +import { ThrowPartyModal } from "./modals/ThrowPartyModal"; import { Money } from "../../ui/React/Money"; import { useCorporation, useDivision } from "./Context"; diff --git a/src/Corporation/ui/IndustryOverview.tsx b/src/Corporation/ui/IndustryOverview.tsx index 97633225a..60390e11e 100644 --- a/src/Corporation/ui/IndustryOverview.tsx +++ b/src/Corporation/ui/IndustryOverview.tsx @@ -7,8 +7,8 @@ import { Industries } from "../IndustryData"; import { IndustryUpgrades } from "../IndustryUpgrades"; import { numeralWrapper } from "../../ui/numeralFormat"; import { createProgressBarText } from "../../utils/helpers/createProgressBarText"; -import { MakeProductModal } from "./MakeProductModal"; -import { ResearchModal } from "./ResearchModal"; +import { MakeProductModal } from "./modals/MakeProductModal"; +import { ResearchModal } from "./modals/ResearchModal"; import { Money } from "../../ui/React/Money"; import { MoneyRate } from "../../ui/React/MoneyRate"; import { StatsTable } from "../../ui/React/StatsTable"; diff --git a/src/Corporation/ui/IndustryWarehouse.tsx b/src/Corporation/ui/IndustryWarehouse.tsx index 2ced07a72..7d40a24de 100644 --- a/src/Corporation/ui/IndustryWarehouse.tsx +++ b/src/Corporation/ui/IndustryWarehouse.tsx @@ -6,7 +6,7 @@ import { CorporationConstants } from "../data/Constants"; import { Material } from "../Material"; import { Product } from "../Product"; import { Warehouse } from "../Warehouse"; -import { SmartSupplyModal } from "./SmartSupplyModal"; +import { SmartSupplyModal } from "./modals/SmartSupplyModal"; import { ProductElem } from "./ProductElem"; import { MaterialElem } from "./MaterialElem"; import { MaterialSizes } from "../MaterialSizes"; @@ -42,9 +42,9 @@ interface IProps { const useStyles = makeStyles(() => createStyles({ retainHeight: { - minHeight: '3em', + minHeight: "3em", }, - }) + }), ); function WarehouseRoot(props: IProps): React.ReactElement { @@ -127,27 +127,53 @@ function WarehouseRoot(props: IProps): React.ReactElement { const mat = props.warehouse.materials[matName]; if (!MaterialSizes.hasOwnProperty(matName)) continue; if (mat.qty === 0) continue; - breakdownItems.push(<>{matName}: {numeralWrapper.format(mat.qty * MaterialSizes[matName], "0,0.0")}); + breakdownItems.push( + <> + {matName}: {numeralWrapper.format(mat.qty * MaterialSizes[matName], "0,0.0")} + , + ); } for (const prodName of Object.keys(division.products)) { const prod = division.products[prodName]; if (prod === undefined) continue; - breakdownItems.push(<>{prodName}: {numeralWrapper.format(prod.data[props.warehouse.loc][0] * prod.siz, "0,0.0")}); + breakdownItems.push( + <> + {prodName}: {numeralWrapper.format(prod.data[props.warehouse.loc][0] * prod.siz, "0,0.0")} + , + ); } let breakdown; if (breakdownItems && breakdownItems.length > 0) { breakdown = breakdownItems.reduce( - (previous: JSX.Element, current: JSX.Element): JSX.Element => previous && <>{previous}
{current} || <>{current}); + (previous: JSX.Element, current: JSX.Element): JSX.Element => + (previous && ( + <> + {previous} +
+ {current} + + )) || <>{current}, + ); } else { - breakdown = <>No items in storage. + breakdown = <>No items in storage.; } return ( - <>{breakdown} : ""}> + + <>{breakdown} + + ) : ( + "" + ) + } + > = props.warehouse.size ? "error" : "primary"}> Storage: {numeralWrapper.formatBigNumber(props.warehouse.sizeUsed)} /{" "} {numeralWrapper.formatBigNumber(props.warehouse.size)} diff --git a/src/Corporation/ui/MaterialElem.tsx b/src/Corporation/ui/MaterialElem.tsx index 616345cdc..3385fa110 100644 --- a/src/Corporation/ui/MaterialElem.tsx +++ b/src/Corporation/ui/MaterialElem.tsx @@ -5,10 +5,10 @@ import React, { useState } from "react"; import { OfficeSpace } from "../OfficeSpace"; import { Material } from "../Material"; import { Warehouse } from "../Warehouse"; -import { ExportModal } from "./ExportModal"; -import { MaterialMarketTaModal } from "./MaterialMarketTaModal"; -import { SellMaterialModal } from "./SellMaterialModal"; -import { PurchaseMaterialModal } from "./PurchaseMaterialModal"; +import { ExportModal } from "./modals/ExportModal"; +import { MaterialMarketTaModal } from "./modals/MaterialMarketTaModal"; +import { SellMaterialModal } from "./modals/SellMaterialModal"; +import { PurchaseMaterialModal } from "./modals/PurchaseMaterialModal"; import { numeralWrapper } from "../../ui/numeralFormat"; @@ -37,6 +37,8 @@ export function MaterialElem(props: IMaterialProps): React.ReactElement { const [exportOpen, setExportOpen] = useState(false); const [sellMaterialOpen, setSellMaterialOpen] = useState(false); const [materialMarketTaOpen, setMaterialMarketTaOpen] = useState(false); + const [limitProductionOpen, setLimitProductionOpen] = useState(false); + const warehouse = props.warehouse; const city = props.city; const mat = props.mat; @@ -112,7 +114,7 @@ export function MaterialElem(props: IMaterialProps): React.ReactElement { return ( - + - + Purchase your required materials to get production started! : ""} > - +
- + @@ -200,8 +200,8 @@ function PublicButtons({ rerender }: IPublicButtonsProps): React.ReactElement { const sellSharesTooltip = sellSharesOnCd ? "Cannot sell shares for " + corp.convertCooldownToString(corp.shareSaleCooldown) : "Sell your shares in the company. The money earned from selling your " + - "shares goes into your personal account, not the Corporation's. " + - "This is one of the only ways to profit from your business venture."; + "shares goes into your personal account, not the Corporation's. " + + "This is one of the only ways to profit from your business venture."; const issueNewSharesOnCd = corp.issueNewSharesCooldown > 0; const issueNewSharesTooltip = issueNewSharesOnCd diff --git a/src/Corporation/ui/ProductElem.tsx b/src/Corporation/ui/ProductElem.tsx index f8240b92a..21b91074c 100644 --- a/src/Corporation/ui/ProductElem.tsx +++ b/src/Corporation/ui/ProductElem.tsx @@ -2,10 +2,10 @@ import React, { useState } from "react"; import { CorporationConstants } from "../data/Constants"; import { Product } from "../Product"; -import { DiscontinueProductModal } from "./DiscontinueProductModal"; -import { LimitProductProductionModal } from "./LimitProductProductionModal"; -import { SellProductModal } from "./SellProductModal"; -import { ProductMarketTaModal } from "./ProductMarketTaModal"; +import { DiscontinueProductModal } from "./modals/DiscontinueProductModal"; +import { LimitProductProductionModal } from "./modals/LimitProductProductionModal"; +import { SellProductModal } from "./modals/SellProductModal"; +import { ProductMarketTaModal } from "./modals/ProductMarketTaModal"; import { numeralWrapper } from "../../ui/numeralFormat"; diff --git a/src/Corporation/ui/BribeFactionModal.tsx b/src/Corporation/ui/modals/BribeFactionModal.tsx similarity index 91% rename from src/Corporation/ui/BribeFactionModal.tsx rename to src/Corporation/ui/modals/BribeFactionModal.tsx index dc678a4d8..a690d74bc 100644 --- a/src/Corporation/ui/BribeFactionModal.tsx +++ b/src/Corporation/ui/modals/BribeFactionModal.tsx @@ -1,11 +1,11 @@ import React, { useState } from "react"; -import { Factions } from "../../Faction/Factions"; -import { CorporationConstants } from "../data/Constants"; -import { numeralWrapper } from "../../ui/numeralFormat"; -import { dialogBoxCreate } from "../../ui/React/DialogBox"; -import { Modal } from "../../ui/React/Modal"; -import { use } from "../../ui/Context"; -import { useCorporation } from "./Context"; +import { Factions } from "../../../Faction/Factions"; +import { CorporationConstants } from "../../data/Constants"; +import { numeralWrapper } from "../../../ui/numeralFormat"; +import { dialogBoxCreate } from "../../../ui/React/DialogBox"; +import { Modal } from "../../../ui/React/Modal"; +import { use } from "../../../ui/Context"; +import { useCorporation } from "../Context"; import Typography from "@mui/material/Typography"; import Button from "@mui/material/Button"; import MenuItem from "@mui/material/MenuItem"; diff --git a/src/Corporation/ui/BuybackSharesModal.tsx b/src/Corporation/ui/modals/BuybackSharesModal.tsx similarity index 87% rename from src/Corporation/ui/BuybackSharesModal.tsx rename to src/Corporation/ui/modals/BuybackSharesModal.tsx index 250443817..ae67656c4 100644 --- a/src/Corporation/ui/BuybackSharesModal.tsx +++ b/src/Corporation/ui/modals/BuybackSharesModal.tsx @@ -1,14 +1,14 @@ import React, { useState } from "react"; -import { Modal } from "../../ui/React/Modal"; -import { numeralWrapper } from "../../ui/numeralFormat"; -import { use } from "../../ui/Context"; -import { useCorporation } from "./Context"; +import { Modal } from "../../../ui/React/Modal"; +import { numeralWrapper } from "../../../ui/numeralFormat"; +import { use } from "../../../ui/Context"; +import { useCorporation } from "../Context"; import Typography from "@mui/material/Typography"; import Button from "@mui/material/Button"; import TextField from "@mui/material/TextField"; -import { BuyBackShares } from '../Actions'; -import { dialogBoxCreate } from '../../ui/React/DialogBox'; -import { KEY } from "../../utils/helpers/keyCodes"; +import { BuyBackShares } from "../../Actions"; +import { dialogBoxCreate } from "../../../ui/React/DialogBox"; +import { KEY } from "../../../utils/helpers/keyCodes"; interface IProps { open: boolean; @@ -40,9 +40,8 @@ export function BuybackSharesModal(props: IProps): React.ReactElement { function buy(): void { if (disabled) return; try { - BuyBackShares(corp, player, shares) - } - catch (err) { + BuyBackShares(corp, player, shares); + } catch (err) { dialogBoxCreate(err + ""); } props.onClose(); diff --git a/src/Corporation/ui/CreateCorporationModal.tsx b/src/Corporation/ui/modals/CreateCorporationModal.tsx similarity index 87% rename from src/Corporation/ui/CreateCorporationModal.tsx rename to src/Corporation/ui/modals/CreateCorporationModal.tsx index 0b79c3611..2c63baf4e 100644 --- a/src/Corporation/ui/CreateCorporationModal.tsx +++ b/src/Corporation/ui/modals/CreateCorporationModal.tsx @@ -1,8 +1,8 @@ import React, { useState } from "react"; -import { Money } from "../../ui/React/Money"; -import { Modal } from "../../ui/React/Modal"; -import { use } from "../../ui/Context"; +import { Money } from "../../../ui/React/Money"; +import { Modal } from "../../../ui/React/Modal"; +import { use } from "../../../ui/Context"; import Typography from "@mui/material/Typography"; import Button from "@mui/material/Button"; import TextField from "@mui/material/TextField"; @@ -56,9 +56,11 @@ export function CreateCorporationModal(props: IProps): React.ReactElement { return ( - Would you like to start a corporation? This will require $150b for registration and initial funding. {player.bitNodeN === 3 && (`This $150b + Would you like to start a corporation? This will require $150b for registration and initial funding.{" "} + {player.bitNodeN === 3 && + `This $150b can either be self-funded, or you can obtain the seed money from the government in exchange for 500 million - shares`)} + shares`}

If you would like to start one, please enter a name for your corporation below: diff --git a/src/Corporation/ui/DiscontinueProductModal.tsx b/src/Corporation/ui/modals/DiscontinueProductModal.tsx similarity index 87% rename from src/Corporation/ui/DiscontinueProductModal.tsx rename to src/Corporation/ui/modals/DiscontinueProductModal.tsx index 00b1b614f..4992879ad 100644 --- a/src/Corporation/ui/DiscontinueProductModal.tsx +++ b/src/Corporation/ui/modals/DiscontinueProductModal.tsx @@ -1,8 +1,8 @@ import React from "react"; -import { Product } from "../Product"; -import { Modal } from "../../ui/React/Modal"; -import { useDivision } from "./Context"; +import { Product } from "../../Product"; +import { Modal } from "../../../ui/React/Modal"; +import { useDivision } from "../Context"; import Typography from "@mui/material/Typography"; import Button from "@mui/material/Button"; diff --git a/src/Corporation/ui/ExportModal.tsx b/src/Corporation/ui/modals/ExportModal.tsx similarity index 90% rename from src/Corporation/ui/ExportModal.tsx rename to src/Corporation/ui/modals/ExportModal.tsx index 809ed4b41..947e932de 100644 --- a/src/Corporation/ui/ExportModal.tsx +++ b/src/Corporation/ui/modals/ExportModal.tsx @@ -1,12 +1,12 @@ import React, { useState } from "react"; -import { dialogBoxCreate } from "../../ui/React/DialogBox"; -import { Material } from "../Material"; -import { Export } from "../Export"; -import { IIndustry } from "../IIndustry"; -import { ExportMaterial } from "../Actions"; -import { Modal } from "../../ui/React/Modal"; -import { useCorporation } from "./Context"; -import { isRelevantMaterial } from "./Helpers"; +import { dialogBoxCreate } from "../../../ui/React/DialogBox"; +import { Material } from "../../Material"; +import { Export } from "../../Export"; +import { IIndustry } from "../../IIndustry"; +import { ExportMaterial } from "../../Actions"; +import { Modal } from "../../../ui/React/Modal"; +import { useCorporation } from "../Context"; +import { isRelevantMaterial } from "../Helpers"; import Typography from "@mui/material/Typography"; import TextField from "@mui/material/TextField"; import Button from "@mui/material/Button"; @@ -23,7 +23,9 @@ interface IProps { // Create a popup that lets the player manage exports export function ExportModal(props: IProps): React.ReactElement { const corp = useCorporation(); - const possibleDivisions = corp.divisions.filter((division: IIndustry) => isRelevantMaterial(props.mat.name, division)); + const possibleDivisions = corp.divisions.filter((division: IIndustry) => + isRelevantMaterial(props.mat.name, division), + ); if (possibleDivisions.length === 0) throw new Error("Export popup created with no divisions."); const defaultDivision = possibleDivisions[0]; if (Object.keys(defaultDivision.warehouses).length === 0) @@ -93,7 +95,7 @@ export function ExportModal(props: IProps): React.ReactElement { {division.name} - ))} + ))}