more conversion

This commit is contained in:
Olivier Gagnon 2021-08-31 03:39:04 -04:00
parent 68885ceff5
commit a2379b21ec
24 changed files with 127 additions and 73 deletions

@ -3,6 +3,7 @@ import { getRandomInt } from "../../utils/helpers/getRandomInt";
import { Generic_fromJSON, Generic_toJSON, Reviver } from "../../utils/JSONReviver";
import { createElement } from "../../utils/uiHelpers/createElement";
import { EmployeePositions } from "./EmployeePositions";
import { ICorporation } from "./ICorporation";
import { numeralWrapper } from "../ui/numeralFormat";
import { formatNumber } from "../../utils/StringHelperFunctions";
@ -86,7 +87,7 @@ export class Employee {
return salary;
}
calculateProductivity(corporation: any, industry: any): number {
calculateProductivity(corporation: ICorporation, industry: any): number {
const effCre = this.cre * corporation.getEmployeeCreMultiplier() * industry.getEmployeeCreMultiplier(),
effCha = this.cha * corporation.getEmployeeChaMultiplier() * industry.getEmployeeChaMultiplier(),
effInt = this.int * corporation.getEmployeeIntMultiplier() * industry.getEmployeeIntMultiplier(),
@ -137,7 +138,7 @@ export class Employee {
}
//'panel' is the DOM element on which to create the UI
createUI(panel: any, corporation: any, industry: any): void {
createUI(panel: any, corporation: ICorporation, industry: any): void {
const effCre = this.cre * corporation.getEmployeeCreMultiplier() * industry.getEmployeeCreMultiplier(),
effCha = this.cha * corporation.getEmployeeChaMultiplier() * industry.getEmployeeChaMultiplier(),
effInt = this.int * corporation.getEmployeeIntMultiplier() * industry.getEmployeeIntMultiplier(),

@ -19,6 +19,7 @@ import { dialogBoxCreate } from "../../utils/DialogBox";
import { isString } from "../../utils/helpers/isString";
import { MaterialSizes } from "./MaterialSizes";
import { Warehouse } from "./Warehouse";
import { ICorporation } from "./ICorporation";
import {
IndustryUpgrade,
IndustryUpgrades } from "./IndustryUpgrades";
@ -401,7 +402,7 @@ export class Industry {
}
}
process(marketCycles=1, state: string, company: any): void {
process(marketCycles=1, state: string, corporation: ICorporation): void {
this.state = state;
//At the start of a cycle, store and reset revenue/expenses
@ -426,7 +427,7 @@ export class Industry {
let employeeSalary = 0;
for (const officeLoc in this.offices) {
if (this.offices[officeLoc] instanceof OfficeSpace) {
employeeSalary += this.offices[officeLoc].process(marketCycles, {industry:this, corporation:company});
employeeSalary += this.offices[officeLoc].process(marketCycles, {industry:this, corporation:corporation});
}
}
this.thisCycleExpenses = this.thisCycleExpenses.plus(employeeSalary);
@ -440,7 +441,7 @@ export class Industry {
this.popularity = Math.max(0, this.popularity);
// Process Dreamsense gains
const popularityGain = company.getDreamSenseGain(), awarenessGain = popularityGain * 4;
const popularityGain = corporation.getDreamSenseGain(), awarenessGain = popularityGain * 4;
if (popularityGain > 0) {
this.popularity += (popularityGain * marketCycles);
this.awareness += (awarenessGain * marketCycles);
@ -450,14 +451,14 @@ export class Industry {
}
// Process production, purchase, and import/export of materials
let res = this.processMaterials(marketCycles, company);
let res = this.processMaterials(marketCycles, corporation);
if (Array.isArray(res)) {
this.thisCycleRevenue = this.thisCycleRevenue.plus(res[0]);
this.thisCycleExpenses = this.thisCycleExpenses.plus(res[1]);
}
// Process creation, production & sale of products
res = this.processProducts(marketCycles, company);
res = this.processProducts(marketCycles, corporation);
if (Array.isArray(res)) {
this.thisCycleRevenue = this.thisCycleRevenue.plus(res[0]);
this.thisCycleExpenses = this.thisCycleExpenses.plus(res[1]);
@ -518,7 +519,7 @@ export class Industry {
}
//Process production, purchase, and import/export of materials
processMaterials(marketCycles=1, company: any): [number, number] {
processMaterials(marketCycles=1, corporation: ICorporation): [number, number] {
let revenue = 0, expenses = 0;
this.calculateProductionFactors();
@ -588,7 +589,7 @@ export class Industry {
//on the office's productivity
const maxProd = this.getOfficeProductivity(office)
* this.prodMult // Multiplier from materials
* company.getProductionMultiplier()
* corporation.getProductionMultiplier()
* this.getProductionMultiplier(); // Multiplier from Research
let prod;
@ -700,7 +701,7 @@ export class Industry {
const sqrtDenominator = ((mat.qlt + .001)
* marketFactor
* businessFactor
* company.getSalesMultiplier()
* corporation.getSalesMultiplier()
* advertisingFactor
* this.getSalesMultiplier());
const denominator = Math.sqrt(sqrtNumerator / sqrtDenominator);
@ -750,7 +751,7 @@ export class Industry {
* marketFactor
* markup
* businessFactor
* company.getSalesMultiplier()
* corporation.getSalesMultiplier()
* advertisingFactor
* this.getSalesMultiplier();
let sellAmt;
@ -822,9 +823,9 @@ export class Industry {
if (amt === 0) {
break; //None left
}
for (let foo = 0; foo < company.divisions.length; ++foo) {
if (company.divisions[foo].name === exp.ind) {
const expIndustry = company.divisions[foo];
for (let foo = 0; foo < corporation.divisions.length; ++foo) {
if (corporation.divisions[foo].name === exp.ind) {
const expIndustry = corporation.divisions[foo];
const expWarehouse = expIndustry.warehouses[exp.city];
if (!(expWarehouse instanceof Warehouse)) {
console.error(`Invalid export! ${expIndustry.name} ${exp.city}`);
@ -872,7 +873,7 @@ export class Industry {
if (office instanceof OfficeSpace) {
this.sciResearch.qty += (.004
* Math.pow(office.employeeProd[EmployeePositions.RandD], 0.5)
* company.getScientificResearchMultiplier()
* corporation.getScientificResearchMultiplier()
* this.getScientificResearchMultiplier());
}
}
@ -880,7 +881,7 @@ export class Industry {
}
//Process production & sale of this industry's FINISHED products (including all of their stats)
processProducts(marketCycles=1, corporation: any): [number, number] {
processProducts(marketCycles=1, corporation: ICorporation): [number, number] {
let revenue = 0;
const expenses = 0;
@ -926,7 +927,7 @@ export class Industry {
}
//Processes FINISHED products
processProduct(marketCycles=1, product: Product, corporation: any): number {
processProduct(marketCycles=1, product: Product, corporation: ICorporation): number {
let totalProfit = 0;
for (let i = 0; i < CorporationConstants.Cities.length; ++i) {
const city = CorporationConstants.Cities[i], office = this.offices[city], warehouse = this.warehouses[city];

@ -5,10 +5,11 @@ import { CorporationConstants } from "../data/Constants";
import { numeralWrapper } from "../../ui/numeralFormat";
import { removePopup } from "../../ui/React/createPopup";
import { dialogBoxCreate } from "../../../utils/DialogBox";
import { ICorporation } from "../ICorporation";
interface IProps {
popupId: string;
corp: any;
corp: ICorporation;
player: IPlayer;
}
@ -39,7 +40,7 @@ export function BribeFactionPopup(props: IProps): React.ReactElement {
return "ERROR: Invalid value(s) entered";
} else if (props.corp.funds.lt(money)) {
return "ERROR: You do not have this much money to bribe with";
} else if (props.corp.stock > props.corp.numShares) {
} else if (stock > props.corp.numShares) {
return "ERROR: You do not have this many shares to bribe with";
} else {
return "You will gain " + numeralWrapper.formatReputation(repGain(money, stock)) +

@ -3,11 +3,12 @@ import { IPlayer } from "../../PersonObjects/IPlayer";
import { removePopup } from "../../ui/React/createPopup";
import { numeralWrapper } from "../../ui/numeralFormat";
import { dialogBoxCreate } from "../../../utils/DialogBox";
import { ICorporation } from "../ICorporation";
interface IProps {
player: IPlayer;
popupId: string;
corp: any;
corp: ICorporation;
}
// Create a popup that lets the player buyback shares
@ -39,7 +40,7 @@ export function BuybackSharesPopup(props: IProps): React.ReactElement {
if (isNaN(props.corp.issuedShares)) {
console.warn("Corporation issuedShares is NaN: " + props.corp.issuedShares);
console.warn("Converting to number now");
const res = parseInt(props.corp.issuedShares);
const res = props.corp.issuedShares;
if (isNaN(res)) {
props.corp.issuedShares = 0;
} else {
@ -49,7 +50,7 @@ export function BuybackSharesPopup(props: IProps): React.ReactElement {
props.corp.issuedShares -= shares;
props.player.loseMoney(shares * buybackPrice);
removePopup(props.popupId);
props.corp.rerender();
props.corp.rerender(props.player);
}
}

@ -1,11 +1,14 @@
import React from 'react';
import { removePopup } from "../../ui/React/createPopup";
import { ICorporation } from "../ICorporation";
import { IPlayer } from "../../PersonObjects/IPlayer";
interface IProps {
product: any;
industry: any;
corp: any;
corp: ICorporation;
popupId: string;
player: IPlayer;
}
// Create a popup that lets the player discontinue a product
@ -13,7 +16,7 @@ export function DiscontinueProductPopup(props: IProps): React.ReactElement {
function discontinue(): void {
props.industry.discontinueProduct(props.product);
removePopup(props.popupId);
props.corp.rerender();
props.corp.rerender(props.player);
}
return (<>

@ -5,10 +5,11 @@ import { CorporationConstants } from "../data/Constants";
import { removePopup } from "../../ui/React/createPopup";
import { dialogBoxCreate } from "../../../utils/DialogBox";
import { OfficeSpace } from "../OfficeSpace";
import { ICorporation } from "../ICorporation";
interface IProps {
popupId: string;
corp: any;
corp: ICorporation;
division: IDivision;
cityStateSetter: (city: string) => void;
}

@ -1,10 +1,11 @@
import React, { useState } from 'react';
import { dialogBoxCreate } from "../../../utils/DialogBox";
import { removePopup } from "../../ui/React/createPopup";
import { ICorporation } from "../ICorporation";
interface IProps {
mat: any;
corp: any;
corp: ICorporation;
popupId: string;
}

@ -2,10 +2,13 @@ import React from 'react';
import { removePopup } from "../../ui/React/createPopup";
import { numeralWrapper } from "../../ui/numeralFormat";
import { CorporationConstants } from "../data/Constants";
import { ICorporation } from "../ICorporation";
import { IPlayer } from "../../PersonObjects/IPlayer";
interface IProps {
corp: any;
corp: ICorporation;
popupId: string;
player: IPlayer;
}
// Create a popup that lets the player manage exports
@ -40,7 +43,7 @@ export function FindInvestorsPopup(props: IProps): React.ReactElement {
props.corp.fundingRound++;
props.corp.addFunds(funding);
props.corp.numShares -= investShares;
props.corp.rerender();
props.corp.rerender(props.player);
removePopup(props.popupId);
}
return (<>

@ -2,10 +2,13 @@ import React, { useState } from 'react';
import { dialogBoxCreate } from "../../../utils/DialogBox";
import { removePopup } from "../../ui/React/createPopup";
import { numeralWrapper } from "../../ui/numeralFormat";
import { ICorporation } from "../ICorporation";
import { IPlayer } from "../../PersonObjects/IPlayer";
interface IProps {
corp: any;
corp: ICorporation;
popupId: string;
player: IPlayer;
}
// Create a popup that lets the player manage exports
@ -29,7 +32,7 @@ export function GoPublicPopup(props: IProps): React.ReactElement {
props.corp.issuedShares = numShares;
props.corp.numShares -= numShares;
props.corp.addFunds(numShares * initialSharePrice);
props.corp.rerender();
props.corp.rerender(props.player);
dialogBoxCreate(`You took your ${props.corp.name} public and earned ` +
`${numeralWrapper.formatMoney(numShares * initialSharePrice)} in your IPO`);
removePopup(props.popupId);

@ -7,11 +7,13 @@ import { IndustryOverview } from "./IndustryOverview";
import { IndustryWarehouse } from "./IndustryWarehouse";
import { ICorporation } from "../ICorporation";
import { CorporationRouting } from "./Routing";
import { IPlayer } from "../../PersonObjects/IPlayer";
interface IProps {
routing: CorporationRouting;
corp: ICorporation;
currentCity: string;
player: IPlayer;
}
export function Industry(props: IProps): React.ReactElement {
@ -19,16 +21,19 @@ export function Industry(props: IProps): React.ReactElement {
<div>
<div className={"cmpy-mgmt-industry-left-panel"}>
<IndustryOverview
player={props.player}
routing={props.routing}
corp={props.corp}
currentCity={props.currentCity} />
<IndustryOffice
<IndustryOffice
player={props.player}
routing={props.routing}
corp={props.corp}
currentCity={props.currentCity} />
</div>
<div className={"cmpy-mgmt-industry-right-panel"}>
<IndustryWarehouse
player={props.player}
corp={props.corp}
routing={props.routing}
currentCity={props.currentCity} />

@ -12,11 +12,14 @@ import { getSelectText } from "../../../utils/uiHelpers/getSelectData
import { createPopup } from "../../ui/React/createPopup";
import { UpgradeOfficeSizePopup } from "./UpgradeOfficeSizePopup";
import { ThrowPartyPopup } from "./ThrowPartyPopup";
import { ICorporation } from "../ICorporation";
import { IPlayer } from "../../PersonObjects/IPlayer";
interface IProps {
routing: any;
corp: any;
corp: ICorporation;
currentCity: string;
player: IPlayer;
}
export function IndustryOffice(props: IProps): React.ReactElement {
@ -132,7 +135,7 @@ export function IndustryOffice(props: IProps): React.ReactElement {
function switchModeOnClick(): void {
setEmployeeManualAssignMode(true);
props.corp.rerender();
props.corp.rerender(props.player);
}
// Calculate average morale, happiness, and energy. Also salary
@ -189,7 +192,7 @@ export function IndustryOffice(props: IProps): React.ReactElement {
office.assignEmployeeToJob(to);
office.calculateEmployeeProductivity({ corporation: props.corp, industry:division });
props.corp.rerender();
props.corp.rerender(props.player);
}
function unassignEmployee(from: string): void {
@ -233,7 +236,7 @@ export function IndustryOffice(props: IProps): React.ReactElement {
office.unassignEmployeeFromJob(from);
office.calculateEmployeeProductivity({ corporation: props.corp, industry:division });
props.corp.rerender();
props.corp.rerender(props.player);
}
const positionHeaderStyle = {
@ -245,61 +248,61 @@ export function IndustryOffice(props: IProps): React.ReactElement {
function operationAssignButtonOnClick(): void {
assignEmployee(EmployeePositions.Operations);
props.corp.rerender();
props.corp.rerender(props.player);
}
function operationUnassignButtonOnClick(): void {
unassignEmployee(EmployeePositions.Operations);
props.corp.rerender();
props.corp.rerender(props.player);
}
const operationUnassignButtonClass = numOperations > 0 ? "std-button" : "a-link-button-inactive";
function engineerAssignButtonOnClick(): void {
assignEmployee(EmployeePositions.Engineer);
props.corp.rerender();
props.corp.rerender(props.player);
}
function engineerUnassignButtonOnClick(): void {
unassignEmployee(EmployeePositions.Engineer);
props.corp.rerender();
props.corp.rerender(props.player);
}
const engineerUnassignButtonClass = numEngineers > 0 ? "std-button" : "a-link-button-inactive";
function businessAssignButtonOnClick(): void {
assignEmployee(EmployeePositions.Business);
props.corp.rerender();
props.corp.rerender(props.player);
}
function businessUnassignButtonOnClick(): void {
unassignEmployee(EmployeePositions.Business);
props.corp.rerender();
props.corp.rerender(props.player);
}
const businessUnassignButtonClass = numBusiness > 0 ? "std-button" : "a-link-button-inactive";
function managementAssignButtonOnClick(): void {
assignEmployee(EmployeePositions.Management);
props.corp.rerender();
props.corp.rerender(props.player);
}
function managementUnassignButtonOnClick(): void {
unassignEmployee(EmployeePositions.Management);
props.corp.rerender();
props.corp.rerender(props.player);
}
const managementUnassignButtonClass = numManagement > 0 ? "std-button" : "a-link-button-inactive";
function rndAssignButtonOnClick(): void {
assignEmployee(EmployeePositions.RandD);
props.corp.rerender();
props.corp.rerender(props.player);
}
function rndUnassignButtonOnClick(): void {
unassignEmployee(EmployeePositions.RandD);
props.corp.rerender();
props.corp.rerender(props.player);
}
const rndUnassignButtonClass = numResearch > 0 ? "std-button" : "a-link-button-inactive";
function trainingAssignButtonOnClick(): void {
assignEmployee(EmployeePositions.Training);
props.corp.rerender();
props.corp.rerender(props.player);
}
function trainingUnassignButtonOnClick(): void {
unassignEmployee(EmployeePositions.Training);
props.corp.rerender();
props.corp.rerender(props.player);
}
const trainingUnassignButtonClass = numTraining > 0 ? "std-button" : "a-link-button-inactive";
@ -433,7 +436,7 @@ export function IndustryOffice(props: IProps): React.ReactElement {
function switchModeOnClick(): void {
setEmployeeManualAssignMode(false);
props.corp.rerender();
props.corp.rerender(props.player);
}
const employeeInfoDivStyle = {
@ -457,7 +460,7 @@ export function IndustryOffice(props: IProps): React.ReactElement {
}
}
corp.rerender();
corp.rerender(props.player);
}
// Employee Positions Selector
@ -477,7 +480,7 @@ export function IndustryOffice(props: IProps): React.ReactElement {
const pos = getSelectText(e.target);
employee.pos = pos;
resetEmployeeCount();
corp.rerender();
corp.rerender(props.player);
}
// Numeraljs formatter
@ -570,7 +573,7 @@ export function IndustryOffice(props: IProps): React.ReactElement {
function autohireEmployeeButtonOnClick(): void {
if (office.atCapacity()) return;
office.hireRandomEmployee();
props.corp.rerender();
props.corp.rerender(props.player);
}
function openUpgradeOfficeSizePopup(): void {
@ -579,6 +582,7 @@ export function IndustryOffice(props: IProps): React.ReactElement {
office: office,
corp: props.corp,
popupId: popupId,
player: props.player,
});
}

@ -11,11 +11,14 @@ import { createProgressBarText } from "../../../utils/helpers/createProgressB
import { MakeProductPopup } from "./MakeProductPopup";
import { ResearchPopup } from "./ResearchPopup";
import { createPopup } from "../../ui/React/createPopup";
import { ICorporation } from "../ICorporation";
import { IPlayer } from "../../PersonObjects/IPlayer";
interface IProps {
routing: any;
corp: any;
corp: ICorporation;
currentCity: string;
player: IPlayer;
}
export function IndustryOverview(props: IProps): React.ReactElement {
@ -249,7 +252,7 @@ export function IndustryOverview(props: IProps): React.ReactElement {
office: office,
});
// corp.displayDivisionContent(division, city);
corp.rerender();
corp.rerender(props.player);
}
}

@ -21,12 +21,15 @@ import { dialogBoxCreate } from "../../../utils/DialogBox";
import { createPopup } from "../../ui/React/createPopup";
import { isString } from "../../../utils/helpers/isString";
import { ICorporation } from "../ICorporation";
import { IPlayer } from "../../PersonObjects/IPlayer";
interface IProductProps {
corp: any;
corp: ICorporation;
division: any;
city: string;
product: any;
player: IPlayer;
}
// Creates the UI for a single Product type
@ -101,6 +104,7 @@ function ProductComponent(props: IProductProps): React.ReactElement {
industry: division,
corp: props.corp,
popupId: popupId,
player: props.player,
});
}
@ -404,6 +408,7 @@ interface IProps {
corp: any;
routing: any;
currentCity: string;
player: IPlayer;
}
export function IndustryWarehouse(props: IProps): React.ReactElement {
@ -439,7 +444,7 @@ export function IndustryWarehouse(props: IProps): React.ReactElement {
++warehouse.level;
warehouse.updateSize(corp, division);
corp.funds = corp.funds.minus(sizeUpgradeCost);
corp.rerender();
corp.rerender(props.player);
}
// Industry material Requirements
@ -503,7 +508,7 @@ export function IndustryWarehouse(props: IProps): React.ReactElement {
const smartSupplyCheckboxId = "cmpy-mgmt-smart-supply-checkbox";
function smartSupplyOnChange(e: React.ChangeEvent<HTMLInputElement>): void {
warehouse.smartSupplyEnabled = e.target.checked;
corp.rerender();
corp.rerender(props.player);
}
// Create React components for materials
@ -529,6 +534,7 @@ export function IndustryWarehouse(props: IProps): React.ReactElement {
for (const productName in division.products) {
if (division.products[productName] instanceof Product) {
products.push(<ProductComponent
player={props.player}
city={props.currentCity}
corp={corp}
division={division}
@ -600,7 +606,7 @@ export function IndustryWarehouse(props: IProps): React.ReactElement {
size: CorporationConstants.WarehouseInitialSize,
});
props.corp.funds = props.corp.funds.minus(CorporationConstants.WarehouseInitialCost);
props.corp.rerender();
props.corp.rerender(props.player);
}
}

@ -2,10 +2,11 @@ import React, { useState } from 'react';
import { removePopup } from "../../ui/React/createPopup";
import { dialogBoxCreate } from "../../../utils/DialogBox";
import { CorporationConstants } from "../data/Constants";
import { ICorporation } from "../ICorporation";
interface IProps {
popupId: string;
corp: any;
corp: ICorporation;
}
// Create a popup that lets the player issue & manage dividends

@ -4,9 +4,10 @@ import { dialogBoxCreate } from "../../../utils/DialogBox";
import { removePopup } from "../../ui/React/createPopup";
import { getRandomInt } from "../../../utils/helpers/getRandomInt";
import { CorporationConstants } from "../data/Constants";
import { ICorporation } from "../ICorporation";
interface IEffectTextProps {
corp: any;
corp: ICorporation;
shares: number | null;
}

@ -3,11 +3,15 @@ import React from "react";
import { numeralWrapper } from "../../ui/numeralFormat";
import { dialogBoxCreate } from "../../../utils/DialogBox";
import { ICorporation } from "../ICorporation";
import { IPlayer } from "../../PersonObjects/IPlayer";
import { CorporationUpgrade } from "../data/CorporationUpgrades";
interface IProps {
upgradeData: number[];
upgradeData: CorporationUpgrade;
upgradeLevel: number;
corp: any;
corp: ICorporation;
player: IPlayer;
}
export function LevelableUpgrade(props: IProps): React.ReactElement {
@ -26,7 +30,7 @@ export function LevelableUpgrade(props: IProps): React.ReactElement {
dialogBoxCreate("Insufficient funds");
} else {
corp.upgrade(data);
corp.rerender();
corp.rerender(props.player);
}
}

@ -3,11 +3,12 @@ import { dialogBoxCreate } from "../../../utils/DialogBox";
import { removePopup } from "../../ui/React/createPopup";
import { Industries } from "../IndustryData";
import { Product } from "../Product";
import { ICorporation } from "../ICorporation";
interface IProps {
popupText: string;
division: any;
corp: any;
corp: ICorporation;
popupId: string;
}

@ -6,9 +6,10 @@ import {
IndustryStartingCosts,
IndustryDescriptions } from "../IndustryData";
import { Industry } from "../Industry";
import { ICorporation } from "../ICorporation";
interface IProps {
corp: any;
corp: ICorporation;
popupId: string;
routing: any;
}

@ -174,6 +174,7 @@ export function Overview(props: IProps): React.ReactElement {
function openFindInvestorsPopup(): void {
const popupId = "cmpy-mgmt-find-investors-popup";
createPopup(popupId, FindInvestorsPopup, {
player: props.player,
popupId: popupId,
corp: props.corp,
});
@ -182,6 +183,7 @@ export function Overview(props: IProps): React.ReactElement {
function openGoPublicPopup(): void {
const popupId = "cmpy-mgmt-go-public-popup";
createPopup(popupId, GoPublicPopup, {
player: props.player,
popupId: popupId,
corp: props.corp,
});
@ -323,6 +325,7 @@ export function Overview(props: IProps): React.ReactElement {
Object.values(CorporationUnlockUpgrades).forEach((unlockData) => {
if (props.corp.unlockUpgrades[unlockData[0]] === 0) {
unlockUpgrades.push(<UnlockUpgrade
player={props.player}
corp={props.corp}
upgradeData={unlockData}
key={unlockData[0]}
@ -351,6 +354,7 @@ export function Overview(props: IProps): React.ReactElement {
<h1 className={"cmpy-mgmt-upgrade-header"}> Upgrades </h1>
{
levelableUpgradeProps.map((data: any) => <LevelableUpgrade
player={props.player}
corp={props.corp}
upgradeData={data.upgradeData}
upgradeLevel={data.upgradeLevel}

@ -1,6 +1,7 @@
import React, { useState } from 'react';
import { dialogBoxCreate } from "../../../utils/DialogBox";
import { removePopup } from "../../ui/React/createPopup";
import { ICorporation } from "../ICorporation";
function initialPrice(mat: any): string {
let val = mat.sCost ? mat.sCost : '';
@ -14,7 +15,7 @@ function initialPrice(mat: any): string {
interface IProps {
mat: any;
corp: any;
corp: ICorporation;
popupId: string;
}

@ -4,9 +4,10 @@ import { dialogBoxCreate } from "../../../utils/DialogBox";
import { IPlayer } from "../../PersonObjects/IPlayer";
import { removePopup } from "../../ui/React/createPopup";
import { CorporationConstants } from "../data/Constants";
import { ICorporation } from "../ICorporation";
interface IProps {
corp: any;
corp: ICorporation;
player: IPlayer;
popupId: string;
}
@ -49,7 +50,7 @@ export function SellSharesPopup(props: IProps): React.ReactElement {
props.corp.numShares -= shares;
if (isNaN(props.corp.issuedShares)) {
console.error(`Corporation issuedShares is NaN: ${props.corp.issuedShares}`);
const res = parseInt(props.corp.issuedShares);
const res = props.corp.issuedShares;
if (isNaN(res)) {
props.corp.issuedShares = 0;
} else {
@ -68,7 +69,7 @@ export function SellSharesPopup(props: IProps): React.ReactElement {
`The corporation's stock price fell to ${numeralWrapper.formatMoney(props.corp.sharePrice)} ` +
`as a result of dilution.`);
props.corp.rerender();
props.corp.rerender(props.player);
}
}

@ -3,10 +3,11 @@ import { removePopup } from "../../ui/React/createPopup";
import { numeralWrapper } from "../../ui/numeralFormat";
import { dialogBoxCreate } from "../../../utils/DialogBox";
import { IOfficeSpace } from "../IOfficeSpace";
import { ICorporation } from "../ICorporation";
interface IProps {
office: IOfficeSpace;
corp: any;
corp: ICorporation;
popupId: string;
}

@ -4,10 +4,13 @@ import React from "react";
import { numeralWrapper } from "../../ui/numeralFormat";
import { dialogBoxCreate } from "../../../utils/DialogBox";
import { CorporationUnlockUpgrade } from "../data/CorporationUnlockUpgrades";
import { ICorporation } from "../ICorporation";
import { IPlayer } from "../../PersonObjects/IPlayer";
interface IProps {
upgradeData: CorporationUnlockUpgrade;
corp: any;
corp: ICorporation;
player: IPlayer;
}
export function UnlockUpgrade(props: IProps): React.ReactElement {
@ -20,7 +23,7 @@ export function UnlockUpgrade(props: IProps): React.ReactElement {
dialogBoxCreate("Insufficient funds");
} else {
corp.unlock(data);
corp.rerender();
corp.rerender(props.player);
}
}

@ -4,11 +4,14 @@ import { numeralWrapper } from "../../ui/numeralFormat";
import { dialogBoxCreate } from "../../../utils/DialogBox";
import { CorporationConstants } from "../data/Constants";
import { IOfficeSpace } from "../IOfficeSpace";
import { ICorporation } from "../ICorporation";
import { IPlayer } from "../../PersonObjects/IPlayer";
interface IProps {
office: IOfficeSpace;
corp: any;
corp: ICorporation;
popupId: string;
player: IPlayer;
}
export function UpgradeOfficeSizePopup(props: IProps): React.ReactElement {
@ -46,7 +49,7 @@ export function UpgradeOfficeSizePopup(props: IProps): React.ReactElement {
props.office.size += size;
props.corp.funds = props.corp.funds.minus(cost);
dialogBoxCreate("Office space increased! It can now hold " + props.office.size + " employees");
props.corp.rerender();
props.corp.rerender(props.player);
}
removePopup(props.popupId);
}