diff --git a/src/Corporation/ICorporation.ts b/src/Corporation/ICorporation.ts new file mode 100644 index 000000000..775774458 --- /dev/null +++ b/src/Corporation/ICorporation.ts @@ -0,0 +1,61 @@ +import { Industry } from "./Industry"; +import { IPlayer } from "../PersonObjects/IPlayer"; +import { CorporationUnlockUpgrade } from "./data/CorporationUnlockUpgrades"; +import { CorporationUpgrade } from "./data/CorporationUpgrades"; +import { CorporationState } from "./CorporationState"; + +export interface ICorporation { + name: string; + + divisions: Industry[]; + + funds: any; + revenue: any; + expenses: any; + fundingRound: number; + public: boolean; + totalShares: number; + numShares: number; + shareSalesUntilPriceUpdate: number; + shareSaleCooldown: number; + issueNewSharesCooldown: number; + dividendPercentage: number; + dividendTaxPercentage: number; + issuedShares: number; + sharePrice: number; + storedCycles: number; + + unlockUpgrades: number[]; + upgrades: number[]; + upgradeMultipliers: number[]; + + state: CorporationState; + + addFunds(amt: number): void; + getState(): string; + storeCycles(numCycles: number): void; + process(player: IPlayer): void; + determineValuation(): number; + getTargetSharePrice(): number; + updateSharePrice(): void; + immediatelyUpdateSharePrice(): void; + calculateShareSale(numShares: number): [number, number, number]; + convertCooldownToString(cd: number): string; + unlock(upgrade: CorporationUnlockUpgrade): void; + upgrade(upgrade: CorporationUpgrade): void; + getProductionMultiplier(): number; + getStorageMultiplier(): number; + getDreamSenseGain(): number; + getAdvertisingMultiplier(): number; + getEmployeeCreMultiplier(): number; + getEmployeeChaMultiplier(): number; + getEmployeeIntMultiplier(): number; + getEmployeeEffMultiplier(): number; + getSalesMultiplier(): number; + getScientificResearchMultiplier(): number; + getStarterGuide(player: IPlayer): void; + createUI(player: IPlayer): void; + rerender(player: IPlayer): void; + clearUI(): void; + toJSON(): any; +} \ No newline at end of file diff --git a/src/Corporation/ui/CityTabs.tsx b/src/Corporation/ui/CityTabs.tsx index 6e2255d8a..347d6b8e2 100644 --- a/src/Corporation/ui/CityTabs.tsx +++ b/src/Corporation/ui/CityTabs.tsx @@ -5,13 +5,15 @@ import { CityTab } from "./CityTab"; import { ExpandNewCityPopup } from "./ExpandNewCityPopup"; import { createPopup } from "../../ui/React/createPopup"; import { IDivision } from "../IDivision"; +import { ICorporation } from "../ICorporation"; +import { CorporationRouting } from "./Routing"; interface IProps { - routing: any; + routing: CorporationRouting; onClicks: {[key: string]: () => void}; city: string; // currentCity cityStateSetter: (city: string) => void; - corp: any; + corp: ICorporation; } export function CityTabs(props: IProps): React.ReactElement { diff --git a/src/Corporation/ui/HeaderTabs.tsx b/src/Corporation/ui/HeaderTabs.tsx index 28d61c6c7..3dff46d4d 100644 --- a/src/Corporation/ui/HeaderTabs.tsx +++ b/src/Corporation/ui/HeaderTabs.tsx @@ -6,16 +6,20 @@ import { HeaderTab } from "./HeaderTab"; import { IDivision } from "../IDivision"; import { NewIndustryPopup } from "./NewIndustryPopup"; import { createPopup } from "../../ui/React/createPopup"; +import { ICorporation } from "../ICorporation"; +import { CorporationRouting } from "./Routing"; +import { IPlayer } from "../../PersonObjects/IPlayer"; interface IProps { - corp: any; - routing: any; + corp: ICorporation; + routing: CorporationRouting; + player: IPlayer; } export function HeaderTabs(props: IProps): React.ReactElement { function overviewOnClick(): void { props.routing.routeToOverviewPage(); - props.corp.rerender(); + props.corp.rerender(props.player); } function openNewIndustryPopup(): void { @@ -41,7 +45,7 @@ export function HeaderTabs(props: IProps): React.ReactElement { key={division.name} onClick={() => { props.routing.routeTo(division.name); - props.corp.rerender(); + props.corp.rerender(props.player); }} text={division.name} />) diff --git a/src/Corporation/ui/Industry.tsx b/src/Corporation/ui/Industry.tsx index e68fcd2d4..5254c3676 100644 --- a/src/Corporation/ui/Industry.tsx +++ b/src/Corporation/ui/Industry.tsx @@ -5,10 +5,12 @@ import React from "react"; import { IndustryOffice } from "./IndustryOffice"; import { IndustryOverview } from "./IndustryOverview"; import { IndustryWarehouse } from "./IndustryWarehouse"; +import { ICorporation } from "../ICorporation"; +import { CorporationRouting } from "./Routing"; interface IProps { - routing: any; - corp: any; + routing: CorporationRouting; + corp: ICorporation; currentCity: string; } diff --git a/src/Corporation/ui/MainPanel.tsx b/src/Corporation/ui/MainPanel.tsx index c1ca735da..aa353291a 100644 --- a/src/Corporation/ui/MainPanel.tsx +++ b/src/Corporation/ui/MainPanel.tsx @@ -11,10 +11,12 @@ import { OfficeSpace } from "../OfficeSpace"; import { CityName } from "../../Locations/data/CityNames"; import { IPlayer } from "../../PersonObjects/IPlayer"; +import { ICorporation } from "../ICorporation"; +import { CorporationRouting } from "./Routing"; interface IProps { - corp: any; - routing: any; + corp: ICorporation; + routing: CorporationRouting; player: IPlayer; } @@ -52,7 +54,7 @@ export function MainPanel(props: IProps): React.ReactElement { if (division.offices[cityName] instanceof OfficeSpace) { onClicks[cityName] = () => { setCity(cityName); - props.corp.rerender(); + props.corp.rerender(props.player); } } } diff --git a/src/Corporation/ui/Overview.tsx b/src/Corporation/ui/Overview.tsx index bd534175d..b44e58032 100644 --- a/src/Corporation/ui/Overview.tsx +++ b/src/Corporation/ui/Overview.tsx @@ -19,9 +19,10 @@ import { numeralWrapper } from "../../ui/numeralFormat"; import { convertTimeMsToTimeElapsedString } from "../../../utils/StringHelperFunctions"; import { createPopup } from "../../ui/React/createPopup"; import { IPlayer } from "../../PersonObjects/IPlayer"; +import { ICorporation } from "../ICorporation"; interface IProps { - corp: any; + corp: ICorporation; player: IPlayer; } diff --git a/src/Corporation/ui/Root.tsx b/src/Corporation/ui/Root.tsx index f41b93a27..f253e0157 100644 --- a/src/Corporation/ui/Root.tsx +++ b/src/Corporation/ui/Root.tsx @@ -4,17 +4,19 @@ import React from "react"; import { HeaderTabs } from "./HeaderTabs"; import { MainPanel } from "./MainPanel"; import { IPlayer } from "../../PersonObjects/IPlayer"; +import { ICorporation } from "../ICorporation"; +import { CorporationRouting } from "./Routing"; interface IProps { - corp: any; - routing: any; + corp: ICorporation; + routing: CorporationRouting; player: IPlayer; } export function CorporationRoot(props: IProps): React.ReactElement { return (
- +
)