diff --git a/src/Corporation/Corporation.ts b/src/Corporation/Corporation.ts index d793cf180..6d54658d0 100644 --- a/src/Corporation/Corporation.ts +++ b/src/Corporation/Corporation.ts @@ -21,9 +21,10 @@ import { createEnumKeyedRecord, getRecordValues } from "../Types/Record"; export const CorporationResolvers: ((prevState: CorpStateName) => void)[] = []; -interface IParams { +interface ICorporationParams { name?: string; seedFunded?: boolean; + shareSaleCooldown?: number; } export class Corporation { @@ -70,9 +71,10 @@ export class Corporation { state = new CorporationState(); - constructor(params: IParams = {}) { + constructor(params: ICorporationParams = {}) { this.name = params.name || "The Corporation"; this.seedFunded = params.seedFunded ?? false; + this.shareSaleCooldown = params.shareSaleCooldown ?? 0; } addFunds(amt: number): void { diff --git a/src/Corporation/ui/Overview.tsx b/src/Corporation/ui/Overview.tsx index 652361fc9..97bce0bcb 100644 --- a/src/Corporation/ui/Overview.tsx +++ b/src/Corporation/ui/Overview.tsx @@ -319,22 +319,13 @@ function SellDivisionButton(): React.ReactElement { function RestartButton(): React.ReactElement { const [open, setOpen] = useState(false); - const corp = useCorporation(); - const sellSharesOnCd = corp.shareSaleCooldown > 0; - function restart(): void { setOpen(true); } return ( <> - + Sell CEO position setOpen(false)} /> diff --git a/src/Corporation/ui/modals/SellSharesModal.tsx b/src/Corporation/ui/modals/SellSharesModal.tsx index 83a18059d..6ffdc0d0b 100644 --- a/src/Corporation/ui/modals/SellSharesModal.tsx +++ b/src/Corporation/ui/modals/SellSharesModal.tsx @@ -61,7 +61,7 @@ export function SellSharesModal(props: IProps): React.ReactElement {
  • Selling shares will cause stock price to fall due to market forces.
  • The money from selling your shares will go directly to you (NOT your Corporation).
  • - You will not be able to sell shares again (or dissolve the corporation) for{" "} + You will not be able to sell shares again for{" "} {corp.convertCooldownToString(corpConstants.sellSharesCooldown)}.
  • diff --git a/src/PersonObjects/Player/PlayerObjectCorporationMethods.ts b/src/PersonObjects/Player/PlayerObjectCorporationMethods.ts index a92c3f98c..e7cd4b7f1 100644 --- a/src/PersonObjects/Player/PlayerObjectCorporationMethods.ts +++ b/src/PersonObjects/Player/PlayerObjectCorporationMethods.ts @@ -12,6 +12,7 @@ export function startCorporation(this: PlayerObject, corpName: string, seedFunde this.corporation = new Corporation({ name: corpName, seedFunded: seedFunded, + shareSaleCooldown: this.corporation?.shareSaleCooldown, }); //reset the research tree in case the corporation was restarted resetIndustryResearchTrees();