diff --git a/src/Corporation/Corporation.tsx b/src/Corporation/Corporation.tsx
index 8d615ef7b..e2de46372 100644
--- a/src/Corporation/Corporation.tsx
+++ b/src/Corporation/Corporation.tsx
@@ -14,7 +14,6 @@ import { IPlayer } from "../PersonObjects/I
import { Page, routing } from "../ui/navigationTracking";
-
import { dialogBoxCreate } from "../../utils/DialogBox";
import { Reviver,
Generic_toJSON,
diff --git a/src/Corporation/Employee.ts b/src/Corporation/Employee.ts
index d5053ff24..2750a6c0c 100644
--- a/src/Corporation/Employee.ts
+++ b/src/Corporation/Employee.ts
@@ -6,6 +6,8 @@ import { EmployeePositions } from "./EmployeePositions";
import { ICorporation } from "./ICorporation";
import { numeralWrapper } from "../ui/numeralFormat";
import { formatNumber } from "../../utils/StringHelperFunctions";
+import { OfficeSpace } from "./OfficeSpace";
+import { IIndustry } from "./IIndustry";
interface IParams {
name?: string;
@@ -57,7 +59,7 @@ export class Employee {
}
//Returns the amount the employee needs to be paid
- process(marketCycles = 1, office: any): number {
+ process(marketCycles = 1, office: OfficeSpace): number {
const gain = 0.003 * marketCycles,
det = gain * Math.random();
this.exp += gain;
@@ -87,7 +89,7 @@ export class Employee {
return salary;
}
- calculateProductivity(corporation: ICorporation, industry: any): number {
+ calculateProductivity(corporation: ICorporation, industry: IIndustry): number {
const effCre = this.cre * corporation.getEmployeeCreMultiplier() * industry.getEmployeeCreMultiplier(),
effCha = this.cha * corporation.getEmployeeChaMultiplier() * industry.getEmployeeChaMultiplier(),
effInt = this.int * corporation.getEmployeeIntMultiplier() * industry.getEmployeeIntMultiplier(),
@@ -138,7 +140,7 @@ export class Employee {
}
//'panel' is the DOM element on which to create the UI
- createUI(panel: any, corporation: ICorporation, industry: any): void {
+ createUI(panel: HTMLElement, corporation: ICorporation, industry: IIndustry): void {
const effCre = this.cre * corporation.getEmployeeCreMultiplier() * industry.getEmployeeCreMultiplier(),
effCha = this.cha * corporation.getEmployeeChaMultiplier() * industry.getEmployeeChaMultiplier(),
effInt = this.int * corporation.getEmployeeIntMultiplier() * industry.getEmployeeIntMultiplier(),
diff --git a/src/Corporation/Export.ts b/src/Corporation/Export.ts
new file mode 100644
index 000000000..ff4ae9ec6
--- /dev/null
+++ b/src/Corporation/Export.ts
@@ -0,0 +1,5 @@
+export interface Export {
+ ind: string;
+ city: string;
+ amt: string;
+}
\ No newline at end of file
diff --git a/src/Corporation/IIndustry.ts b/src/Corporation/IIndustry.ts
new file mode 100644
index 000000000..37368f464
--- /dev/null
+++ b/src/Corporation/IIndustry.ts
@@ -0,0 +1,78 @@
+import { Material } from "./Material";
+import { Warehouse } from "./Warehouse";
+import { ICorporation } from "./ICorporation";
+import { OfficeSpace } from "./OfficeSpace";
+import { Product } from "./Product";
+import { IndustryUpgrade } from "./IndustryUpgrades";
+
+export interface IIndustry {
+ name: string;
+ type: string;
+ sciResearch: Material;
+ researched: any;
+ reqMats: any;
+
+ prodMats: string[];
+
+ products: any;
+ makesProducts: boolean;
+
+ awareness: number;
+ popularity: number;
+ startingCost: number;
+
+ reFac: number;
+ sciFac: number;
+ hwFac: number;
+ robFac: number;
+ aiFac: number;
+ advFac: number;
+
+ prodMult: number;
+
+ // Decimal
+ lastCycleRevenue: any;
+ lastCycleExpenses: any;
+ thisCycleRevenue: any;
+ thisCycleExpenses: any;
+
+ upgrades: number[];
+
+ state: string;
+ newInd: boolean;
+ warehouses: any;
+ offices: any;
+
+
+ init(): void;
+ getProductDescriptionText(): string;
+ getMaximumNumberProducts(): number;
+ hasMaximumNumberProducts(): boolean;
+ calculateProductionFactors(): void;
+ updateWarehouseSizeUsed(warehouse: Warehouse): void;
+ process(marketCycles: number, state: string, corporation: ICorporation): void;
+ processMaterialMarket(): void;
+ processProductMarket(marketCycles: number): void;
+ processMaterials(marketCycles: number, corporation: ICorporation): [number, number];
+ processProducts(marketCycles: number, corporation: ICorporation): [number, number];
+ processProduct(marketCycles: number, product: Product, corporation: ICorporation): number;
+ discontinueProduct(product: Product): void;
+ upgrade(upgrade: IndustryUpgrade, refs: {corporation: any; office: OfficeSpace}): void;
+ getOfficeProductivity(office: OfficeSpace, params?: any): number;
+ getBusinessFactor(office: OfficeSpace): number;
+ getAdvertisingFactors(): [number, number, number, number];
+ getMarketFactor(mat: {dmd: number; cmp: number}): number;
+ hasResearch(name: string): boolean;
+ updateResearchTree(): void;
+ getAdvertisingMultiplier(): number;
+ getEmployeeChaMultiplier(): number;
+ getEmployeeCreMultiplier(): number;
+ getEmployeeEffMultiplier(): number;
+ getEmployeeIntMultiplier(): number;
+ getProductionMultiplier(): number;
+ getProductProductionMultiplier(): number;
+ getSalesMultiplier(): number;
+ getScientificResearchMultiplier(): number;
+ getStorageMultiplier(): number;
+ toJSON(): any;
+}
\ No newline at end of file
diff --git a/src/Corporation/Material.ts b/src/Corporation/Material.ts
index 29a165dd7..7ce69dc43 100644
--- a/src/Corporation/Material.ts
+++ b/src/Corporation/Material.ts
@@ -1,6 +1,7 @@
import { Generic_fromJSON,
Generic_toJSON,
Reviver } from "../../utils/JSONReviver";
+import { Export } from "./Export";
interface IConstructorParams {
name?: string;
@@ -43,7 +44,7 @@ export class Material {
imp = 0;
// Exports of this material to another warehouse/industry
- exp: any[] = [];
+ exp: Export[] = [];
// Total amount of this material exported in the last cycle
totalExp = 0;
@@ -52,7 +53,7 @@ export class Material {
bCost = 0;
// Cost / sec to sell this material
- sCost = 0;
+ sCost: string | number = 0;
// Flags to keep track of whether production and/or sale of this material is limited
// [Whether production/sale is limited, limit amount]
diff --git a/src/Corporation/OfficeSpace.ts b/src/Corporation/OfficeSpace.ts
index 7262ce348..299156ee5 100644
--- a/src/Corporation/OfficeSpace.ts
+++ b/src/Corporation/OfficeSpace.ts
@@ -14,6 +14,9 @@ import { removeElementById } from "../../utils/uiHelpers/removeElementById";
import { createElement } from "../../utils/uiHelpers/createElement";
import { numeralWrapper } from "../ui/numeralFormat";
import { Employee } from "./Employee";
+import { IIndustry } from "./IIndustry";
+import { ICorporation } from './ICorporation';
+import { IPlayer } from "../PersonObjects/IPlayer";
interface IParams {
loc?: string;
@@ -58,7 +61,7 @@ export class OfficeSpace {
return (this.employees.length) >= this.size;
}
- process(marketCycles = 1, parentRefs: any): number {
+ process(marketCycles = 1, parentRefs: {industry: IIndustry; corporation: ICorporation}): number {
const industry = parentRefs.industry;
// HRBuddy AutoRecruitment and training
@@ -85,9 +88,9 @@ export class OfficeSpace {
// Calculate changes in Morale/Happiness/Energy for Employees
let perfMult=1; //Multiplier for employee morale/happiness/energy based on company performance
- if (industry.funds < 0 && industry.lastCycleRevenue < 0) {
+ if (parentRefs.corporation.funds < 0 && industry.lastCycleRevenue < 0) {
perfMult = Math.pow(0.99, marketCycles);
- } else if (industry.funds > 0 && industry.lastCycleRevenue > 0) {
+ } else if (parentRefs.corporation.funds > 0 && industry.lastCycleRevenue > 0) {
perfMult = Math.pow(1.01, marketCycles);
}
@@ -122,7 +125,7 @@ export class OfficeSpace {
return salaryPaid;
}
- calculateEmployeeProductivity(parentRefs: any): void {
+ calculateEmployeeProductivity(parentRefs: {corporation: ICorporation; industry: IIndustry}): void {
const company = parentRefs.corporation, industry = parentRefs.industry;
//Reset
@@ -141,7 +144,7 @@ export class OfficeSpace {
}
//Takes care of UI as well
- findEmployees(parentRefs: any): void {
+ findEmployees(player: IPlayer, parentRefs: {corporation: ICorporation}): void {
if (this.atCapacity()) { return; }
if (document.getElementById("cmpy-mgmt-hire-employee-popup") != null) {return;}
@@ -197,7 +200,7 @@ export class OfficeSpace {
"Efficiency: " + formatNumber(employee.eff, 1) + "
" +
"Salary: " + numeralWrapper.format(employee.sal, '$0.000a') + " \ s
",
clickListener: () => {
- office.hireEmployee(employee, parentRefs);
+ office.hireEmployee(player, employee, parentRefs);
removeElementById("cmpy-mgmt-hire-employee-popup");
return false;
},
@@ -224,8 +227,8 @@ export class OfficeSpace {
createPopup("cmpy-mgmt-hire-employee-popup", elems);
}
- hireEmployee(employee: Employee, parentRefs: any): void {
- const company = parentRefs.corporation;
+ hireEmployee(player: IPlayer, employee: Employee, parentRefs: {corporation: ICorporation}): void {
+ const corporation = parentRefs.corporation;
const yesBtn = yesNoTxtInpBoxGetYesButton(),
noBtn = yesNoTxtInpBoxGetNoButton();
yesBtn.innerHTML = "Hire";
@@ -240,7 +243,7 @@ export class OfficeSpace {
}
employee.name = name;
this.employees.push(employee);
- company.rerender();
+ corporation.rerender(player);
return yesNoTxtInpBoxClose();
});
noBtn.addEventListener("click", () => {
@@ -285,7 +288,7 @@ export class OfficeSpace {
}
//Finds the first unassigned employee and assigns its to the specified job
- assignEmployeeToJob(job: any): boolean {
+ assignEmployeeToJob(job: string): boolean {
for (let i = 0; i < this.employees.length; ++i) {
if (this.employees[i].pos === EmployeePositions.Unassigned) {
this.employees[i].pos = job;
@@ -296,7 +299,7 @@ export class OfficeSpace {
}
//Finds the first employee with the given job and unassigns it
- unassignEmployeeFromJob(job: any): boolean {
+ unassignEmployeeFromJob(job: string): boolean {
for (let i = 0; i < this.employees.length; ++i) {
if (this.employees[i].pos === job) {
this.employees[i].pos = EmployeePositions.Unassigned;
diff --git a/src/Corporation/ui/DiscontinueProductPopup.tsx b/src/Corporation/ui/DiscontinueProductPopup.tsx
index bc81a7567..41c803f01 100644
--- a/src/Corporation/ui/DiscontinueProductPopup.tsx
+++ b/src/Corporation/ui/DiscontinueProductPopup.tsx
@@ -1,11 +1,13 @@
import React from 'react';
import { removePopup } from "../../ui/React/createPopup";
import { ICorporation } from "../ICorporation";
+import { Product } from "../Product";
+import { IIndustry } from "../IIndustry";
import { IPlayer } from "../../PersonObjects/IPlayer";
interface IProps {
- product: any;
- industry: any;
+ product: Product;
+ industry: IIndustry;
corp: ICorporation;
popupId: string;
player: IPlayer;
diff --git a/src/Corporation/ui/ExportPopup.tsx b/src/Corporation/ui/ExportPopup.tsx
index 39e5936be..7ff9f5a89 100644
--- a/src/Corporation/ui/ExportPopup.tsx
+++ b/src/Corporation/ui/ExportPopup.tsx
@@ -2,9 +2,12 @@ import React, { useState } from 'react';
import { dialogBoxCreate } from "../../../utils/DialogBox";
import { removePopup } from "../../ui/React/createPopup";
import { ICorporation } from "../ICorporation";
+import { Material } from "../Material";
+import { Export } from "../Export";
+import { IIndustry } from "../IIndustry";
interface IProps {
- mat: any;
+ mat: Material;
corp: ICorporation;
popupId: string;
}
@@ -64,7 +67,7 @@ export function ExportPopup(props: IProps): React.ReactElement {
removePopup(props.popupId);
}
- function removeExport(exp: any): void {
+ function removeExport(exp: Export): void {
for (let i = 0; i < props.mat.exp.length; ++i) {
if(props.mat.exp[i].ind !== exp.ind ||
props.mat.exp[i].city !== exp.city ||
@@ -75,7 +78,7 @@ export function ExportPopup(props: IProps): React.ReactElement {
rerender();
}
- const currentDivision = props.corp.divisions.find((division: any) => division.name === industry);
+ const currentDivision = props.corp.divisions.find((division: IIndustry) => division.name === industry);
return (<>
@@ -85,12 +88,12 @@ amount to 'MAX' to export all of the materials in this warehouse.