2022-11-09 13:26:26 +01:00
|
|
|
import { Player, Player as player } from "../Player";
|
2021-10-14 09:22:02 +02:00
|
|
|
|
|
|
|
import { OfficeSpace } from "../Corporation/OfficeSpace";
|
|
|
|
import { Product } from "../Corporation/Product";
|
|
|
|
import { Material } from "../Corporation/Material";
|
|
|
|
import { Warehouse } from "../Corporation/Warehouse";
|
2023-05-16 00:06:57 +02:00
|
|
|
import { Division } from "../Corporation/Division";
|
2024-02-10 12:27:47 +01:00
|
|
|
import { Corporation, CorporationPromise } from "../Corporation/Corporation";
|
2024-02-10 10:10:19 +01:00
|
|
|
import { omit } from "lodash";
|
2023-10-23 10:48:06 +02:00
|
|
|
import { setDeprecatedProperties } from "../utils/DeprecationHelper";
|
2021-12-04 05:06:04 +01:00
|
|
|
import {
|
|
|
|
Corporation as NSCorporation,
|
|
|
|
Division as NSDivision,
|
|
|
|
WarehouseAPI,
|
|
|
|
OfficeAPI,
|
2022-12-30 02:28:53 +01:00
|
|
|
CorpResearchName,
|
|
|
|
CorpMaterialName,
|
2023-10-23 10:24:30 +02:00
|
|
|
CorpStateName,
|
2022-12-30 02:28:53 +01:00
|
|
|
} from "@nsdefs";
|
2021-10-14 09:22:02 +02:00
|
|
|
|
|
|
|
import {
|
2023-05-17 23:28:24 +02:00
|
|
|
NewDivision,
|
2023-05-16 00:06:57 +02:00
|
|
|
purchaseOffice,
|
2021-10-14 09:22:02 +02:00
|
|
|
IssueDividends,
|
2023-09-20 06:36:48 +02:00
|
|
|
GoPublic,
|
2022-12-25 09:35:18 +01:00
|
|
|
IssueNewShares,
|
2023-09-20 06:36:48 +02:00
|
|
|
AcceptInvestmentOffer,
|
2021-10-14 09:22:02 +02:00
|
|
|
SellMaterial,
|
|
|
|
SellProduct,
|
|
|
|
SetSmartSupply,
|
|
|
|
BuyMaterial,
|
|
|
|
UpgradeOfficeSize,
|
2023-05-16 00:06:57 +02:00
|
|
|
purchaseWarehouse,
|
2021-10-14 09:22:02 +02:00
|
|
|
UpgradeWarehouse,
|
2023-03-18 02:12:43 +01:00
|
|
|
BuyTea,
|
2022-06-02 00:26:32 +02:00
|
|
|
ThrowParty,
|
2021-10-14 09:22:02 +02:00
|
|
|
HireAdVert,
|
|
|
|
MakeProduct,
|
|
|
|
Research,
|
|
|
|
ExportMaterial,
|
|
|
|
CancelExportMaterial,
|
|
|
|
SetMaterialMarketTA1,
|
|
|
|
SetMaterialMarketTA2,
|
|
|
|
SetProductMarketTA1,
|
|
|
|
SetProductMarketTA2,
|
2022-01-17 11:03:29 +01:00
|
|
|
BulkPurchase,
|
|
|
|
SellShares,
|
|
|
|
BuyBackShares,
|
2023-03-18 02:12:43 +01:00
|
|
|
SetSmartSupplyOption,
|
2022-04-01 16:28:48 +02:00
|
|
|
LimitMaterialProduction,
|
|
|
|
LimitProductProduction,
|
2022-04-01 17:19:08 +02:00
|
|
|
UpgradeWarehouseCost,
|
2021-10-14 09:22:02 +02:00
|
|
|
} from "../Corporation/Actions";
|
2023-05-16 00:06:57 +02:00
|
|
|
import { CorpUnlocks } from "../Corporation/data/CorporationUnlocks";
|
|
|
|
import { CorpUpgrades } from "../Corporation/data/CorporationUpgrades";
|
2023-06-26 04:53:35 +02:00
|
|
|
import { CorpUnlockName, CorpUpgradeName, CorpEmployeeJob, CityName, FactionName } from "@enums";
|
2023-06-10 01:34:35 +02:00
|
|
|
import { IndustriesData, IndustryResearchTrees } from "../Corporation/data/IndustryData";
|
2022-12-30 02:28:53 +01:00
|
|
|
import * as corpConstants from "../Corporation/data/Constants";
|
2022-01-13 18:47:11 +01:00
|
|
|
import { ResearchMap } from "../Corporation/ResearchMap";
|
2022-01-13 22:05:06 +01:00
|
|
|
import { Factions } from "../Faction/Factions";
|
2023-06-16 23:52:42 +02:00
|
|
|
import { currentNodeMults } from "../BitNode/BitNodeMultipliers";
|
2023-08-07 08:38:38 +02:00
|
|
|
import { InternalAPI, NetscriptContext, setRemovedFunctions } from "../Netscript/APIWrapper";
|
2023-06-12 06:34:20 +02:00
|
|
|
import { helpers } from "../Netscript/NetscriptHelpers";
|
|
|
|
import { getEnumHelper } from "../utils/EnumHelper";
|
2022-12-25 09:33:13 +01:00
|
|
|
import { MaterialInfo } from "../Corporation/MaterialInfo";
|
2024-03-25 01:37:08 +01:00
|
|
|
import { calculateOfficeSizeUpgradeCost, calculateUpgradeCost } from "../Corporation/helpers";
|
2023-05-16 00:06:57 +02:00
|
|
|
import { PositiveInteger } from "../types";
|
|
|
|
import { getRecordKeys } from "../Types/Record";
|
2021-10-14 09:22:02 +02:00
|
|
|
|
2022-08-09 21:41:47 +02:00
|
|
|
export function NetscriptCorporation(): InternalAPI<NSCorporation> {
|
2022-01-11 20:43:29 +01:00
|
|
|
function createCorporation(corporationName: string, selfFund = true): boolean {
|
2022-11-09 13:26:26 +01:00
|
|
|
if (!player.canAccessCorporation() || player.corporation) return false;
|
2022-01-11 20:43:29 +01:00
|
|
|
if (!corporationName) return false;
|
2022-01-11 20:53:53 +01:00
|
|
|
if (player.bitNodeN !== 3 && !selfFund) throw new Error("cannot use seed funds outside of BitNode 3");
|
2023-06-16 23:52:42 +02:00
|
|
|
if (currentNodeMults.CorporationSoftcap < 0.15)
|
2022-04-11 15:54:50 +02:00
|
|
|
throw new Error(`You cannot create a corporation in Bitnode ${player.bitNodeN}`);
|
2022-01-11 20:43:29 +01:00
|
|
|
|
|
|
|
if (selfFund) {
|
|
|
|
if (!player.canAfford(150e9)) return false;
|
|
|
|
|
2023-03-18 02:12:43 +01:00
|
|
|
player.startCorporation(corporationName, false);
|
2022-01-11 20:43:29 +01:00
|
|
|
player.loseMoney(150e9, "corporation");
|
|
|
|
} else {
|
2023-03-18 02:12:43 +01:00
|
|
|
player.startCorporation(corporationName, true);
|
2022-01-11 20:43:29 +01:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2023-05-16 00:06:57 +02:00
|
|
|
function hasUnlock(unlockName: CorpUnlockName): boolean {
|
2022-01-12 00:47:04 +01:00
|
|
|
const corporation = getCorporation();
|
2023-05-16 00:06:57 +02:00
|
|
|
return corporation.unlocks.has(unlockName);
|
2022-01-12 00:47:04 +01:00
|
|
|
}
|
|
|
|
|
2023-05-16 00:06:57 +02:00
|
|
|
function getUnlockCost(unlockName: CorpUnlockName): number {
|
|
|
|
return CorpUnlocks[unlockName].price;
|
2022-01-12 00:47:04 +01:00
|
|
|
}
|
|
|
|
|
2023-05-16 00:06:57 +02:00
|
|
|
function getUpgradeLevel(upgradeName: CorpUpgradeName): number {
|
2022-01-12 00:47:04 +01:00
|
|
|
const corporation = getCorporation();
|
2023-05-16 00:06:57 +02:00
|
|
|
return corporation.upgrades[upgradeName].level;
|
2022-01-12 00:47:04 +01:00
|
|
|
}
|
|
|
|
|
2023-05-16 00:06:57 +02:00
|
|
|
function getUpgradeLevelCost(upgradeName: CorpUpgradeName): number {
|
2022-01-12 00:47:04 +01:00
|
|
|
const corporation = getCorporation();
|
2023-05-16 00:06:57 +02:00
|
|
|
const cost = calculateUpgradeCost(corporation, CorpUpgrades[upgradeName], 1 as PositiveInteger);
|
|
|
|
return cost;
|
2022-01-12 00:47:04 +01:00
|
|
|
}
|
|
|
|
|
2023-05-16 00:06:57 +02:00
|
|
|
function getResearchCost(division: Division, researchName: CorpResearchName): number {
|
2022-01-13 18:47:11 +01:00
|
|
|
const researchTree = IndustryResearchTrees[division.type];
|
|
|
|
if (researchTree === undefined) throw new Error(`No research tree for industry '${division.type}'`);
|
|
|
|
const allResearch = researchTree.getAllNodes();
|
|
|
|
if (!allResearch.includes(researchName)) throw new Error(`No research named '${researchName}'`);
|
|
|
|
const research = ResearchMap[researchName];
|
|
|
|
return research.cost;
|
|
|
|
}
|
|
|
|
|
2023-05-16 00:06:57 +02:00
|
|
|
function hasResearched(division: Division, researchName: CorpResearchName): boolean {
|
|
|
|
return division.researched.has(researchName);
|
2022-01-13 18:47:11 +01:00
|
|
|
}
|
|
|
|
|
2023-06-26 04:53:35 +02:00
|
|
|
function bribe(factionName: FactionName, amountCash: number): boolean {
|
2022-07-26 14:20:22 +02:00
|
|
|
if (isNaN(amountCash) || amountCash < 0)
|
2022-10-09 07:32:44 +02:00
|
|
|
throw new Error("Invalid value for amount field! Must be numeric, greater than 0.");
|
2022-03-07 23:43:29 +01:00
|
|
|
|
2022-01-13 22:05:06 +01:00
|
|
|
const corporation = getCorporation();
|
|
|
|
if (corporation.funds < amountCash) return false;
|
2022-03-30 02:24:04 +02:00
|
|
|
const faction = Factions[factionName];
|
2022-01-13 22:05:06 +01:00
|
|
|
const info = faction.getInfo();
|
|
|
|
if (!info.offersWork()) return false;
|
|
|
|
if (player.hasGangWith(factionName)) return false;
|
|
|
|
|
2022-12-30 02:28:53 +01:00
|
|
|
const repGain = amountCash / corpConstants.bribeAmountPerReputation;
|
2022-01-13 22:05:06 +01:00
|
|
|
faction.playerReputation += repGain;
|
2023-12-08 03:22:21 +01:00
|
|
|
corporation.loseFunds(amountCash, "bribery");
|
2022-01-13 22:05:06 +01:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2022-09-20 12:47:54 +02:00
|
|
|
function getCorporation(): Corporation {
|
2021-10-14 09:22:02 +02:00
|
|
|
const corporation = player.corporation;
|
|
|
|
if (corporation === null) throw new Error("cannot be called without a corporation");
|
2021-12-04 05:06:04 +01:00
|
|
|
return corporation;
|
|
|
|
}
|
|
|
|
|
2023-05-16 00:06:57 +02:00
|
|
|
function getDivision(divisionName: string): Division {
|
2021-12-04 05:06:04 +01:00
|
|
|
const corporation = getCorporation();
|
2023-05-16 00:06:57 +02:00
|
|
|
const division = corporation.divisions.get(divisionName);
|
2021-10-14 09:22:02 +02:00
|
|
|
if (division === undefined) throw new Error(`No division named '${divisionName}'`);
|
|
|
|
return division;
|
|
|
|
}
|
|
|
|
|
2023-06-12 06:34:20 +02:00
|
|
|
function getOffice(divisionName: string, cityName: CityName): OfficeSpace {
|
2021-10-14 09:22:02 +02:00
|
|
|
const division = getDivision(divisionName);
|
|
|
|
const office = division.offices[cityName];
|
2023-05-16 00:06:57 +02:00
|
|
|
if (!office) throw new Error(`${division.name} has not expanded to '${cityName}'`);
|
2021-10-14 09:22:02 +02:00
|
|
|
return office;
|
|
|
|
}
|
|
|
|
|
2023-06-12 06:34:20 +02:00
|
|
|
function getWarehouse(divisionName: string, cityName: CityName): Warehouse {
|
2021-10-14 09:22:02 +02:00
|
|
|
const division = getDivision(divisionName);
|
|
|
|
const warehouse = division.warehouses[cityName];
|
2023-05-16 00:06:57 +02:00
|
|
|
if (!warehouse) throw new Error(`${division.name} does not have a warehouse in '${cityName}'`);
|
2021-10-14 09:22:02 +02:00
|
|
|
return warehouse;
|
|
|
|
}
|
|
|
|
|
2022-12-30 02:28:53 +01:00
|
|
|
function getMaterial(divisionName: string, cityName: CityName, materialName: CorpMaterialName): Material {
|
2021-10-14 09:22:02 +02:00
|
|
|
const warehouse = getWarehouse(divisionName, cityName);
|
2022-12-30 02:28:53 +01:00
|
|
|
const material = warehouse.materials[materialName];
|
2021-10-14 09:22:02 +02:00
|
|
|
return material;
|
|
|
|
}
|
|
|
|
|
2023-05-16 00:06:57 +02:00
|
|
|
function getProduct(divisionName: string, productName: string): Product {
|
2021-10-14 09:22:02 +02:00
|
|
|
const division = getDivision(divisionName);
|
2023-05-16 00:06:57 +02:00
|
|
|
const product = division.products.get(productName);
|
2021-10-14 09:22:02 +02:00
|
|
|
if (product === undefined) throw new Error(`Invalid product name: '${productName}'`);
|
|
|
|
return product;
|
|
|
|
}
|
|
|
|
|
2023-05-16 00:06:57 +02:00
|
|
|
function checkAccess(ctx: NetscriptContext, api?: CorpUnlockName): void {
|
2024-02-26 14:05:10 +01:00
|
|
|
if (!player.corporation) throw helpers.errorMessage(ctx, "Must own a corporation.");
|
2021-12-04 05:06:04 +01:00
|
|
|
if (!api) return;
|
2023-05-16 00:06:57 +02:00
|
|
|
if (!player.corporation.unlocks.has(api)) {
|
2024-02-26 14:05:10 +01:00
|
|
|
throw helpers.errorMessage(ctx, "You do not have access to this API.");
|
2023-05-16 00:06:57 +02:00
|
|
|
}
|
2021-12-04 05:06:04 +01:00
|
|
|
}
|
|
|
|
|
2023-05-16 00:06:57 +02:00
|
|
|
function getSafeDivision(division: Division): NSDivision {
|
|
|
|
const cities = getRecordKeys(division.offices);
|
2022-04-27 06:48:22 +02:00
|
|
|
|
2022-01-17 11:03:29 +01:00
|
|
|
return {
|
|
|
|
name: division.name,
|
|
|
|
type: division.type,
|
|
|
|
awareness: division.awareness,
|
|
|
|
popularity: division.popularity,
|
2023-05-16 00:06:57 +02:00
|
|
|
productionMult: division.productionMult,
|
|
|
|
researchPoints: division.researchPoints,
|
2022-01-17 11:03:29 +01:00
|
|
|
lastCycleRevenue: division.lastCycleRevenue,
|
|
|
|
lastCycleExpenses: division.lastCycleExpenses,
|
|
|
|
thisCycleRevenue: division.thisCycleRevenue,
|
|
|
|
thisCycleExpenses: division.thisCycleExpenses,
|
2023-05-16 00:06:57 +02:00
|
|
|
numAdVerts: division.numAdVerts,
|
2022-01-17 11:03:29 +01:00
|
|
|
cities: cities,
|
2023-05-16 00:06:57 +02:00
|
|
|
products: [...division.products.keys()],
|
2022-04-27 15:37:02 +02:00
|
|
|
makesProducts: division.makesProducts,
|
2023-06-01 21:20:54 +02:00
|
|
|
maxProducts: division.maxProducts,
|
2022-01-17 11:03:29 +01:00
|
|
|
};
|
2022-01-11 21:25:23 +01:00
|
|
|
}
|
|
|
|
|
2022-05-08 01:08:07 +02:00
|
|
|
const warehouseAPI: InternalAPI<WarehouseAPI> = {
|
|
|
|
getUpgradeWarehouseCost:
|
2022-10-12 14:49:27 +02:00
|
|
|
(ctx) =>
|
|
|
|
(_divisionName, _cityName, _amt = 1) => {
|
2023-05-16 00:06:57 +02:00
|
|
|
checkAccess(ctx, CorpUnlockName.WarehouseAPI);
|
2022-08-08 19:43:41 +02:00
|
|
|
const divisionName = helpers.string(ctx, "divisionName", _divisionName);
|
2023-06-12 06:34:20 +02:00
|
|
|
const cityName = getEnumHelper("CityName").nsGetMember(ctx, _cityName);
|
2022-08-08 19:43:41 +02:00
|
|
|
const amt = helpers.number(ctx, "amount", _amt);
|
2022-05-08 01:08:07 +02:00
|
|
|
if (amt < 1) {
|
2024-02-26 14:05:10 +01:00
|
|
|
throw helpers.errorMessage(ctx, "You must provide a positive number");
|
2022-05-08 01:08:07 +02:00
|
|
|
}
|
|
|
|
const warehouse = getWarehouse(divisionName, cityName);
|
|
|
|
return UpgradeWarehouseCost(warehouse, amt);
|
|
|
|
},
|
2022-10-12 14:49:27 +02:00
|
|
|
hasWarehouse: (ctx) => (_divisionName, _cityName) => {
|
2023-05-16 00:06:57 +02:00
|
|
|
checkAccess(ctx, CorpUnlockName.WarehouseAPI);
|
2022-10-12 14:49:27 +02:00
|
|
|
const divisionName = helpers.string(ctx, "divisionName", _divisionName);
|
2023-06-12 06:34:20 +02:00
|
|
|
const cityName = getEnumHelper("CityName").nsGetMember(ctx, _cityName);
|
2022-10-12 14:49:27 +02:00
|
|
|
const division = getDivision(divisionName);
|
2023-05-16 00:06:57 +02:00
|
|
|
return cityName in division.warehouses;
|
2022-10-12 14:49:27 +02:00
|
|
|
},
|
|
|
|
getWarehouse: (ctx) => (_divisionName, _cityName) => {
|
2023-05-16 00:06:57 +02:00
|
|
|
checkAccess(ctx, CorpUnlockName.WarehouseAPI);
|
2022-10-12 14:49:27 +02:00
|
|
|
const divisionName = helpers.string(ctx, "divisionName", _divisionName);
|
2023-06-12 06:34:20 +02:00
|
|
|
const cityName = getEnumHelper("CityName").nsGetMember(ctx, _cityName);
|
2022-10-12 14:49:27 +02:00
|
|
|
const warehouse = getWarehouse(divisionName, cityName);
|
|
|
|
return {
|
|
|
|
level: warehouse.level,
|
2023-05-16 00:06:57 +02:00
|
|
|
city: warehouse.city,
|
2022-10-12 14:49:27 +02:00
|
|
|
size: warehouse.size,
|
|
|
|
sizeUsed: warehouse.sizeUsed,
|
|
|
|
smartSupplyEnabled: warehouse.smartSupplyEnabled,
|
|
|
|
};
|
|
|
|
},
|
2023-06-12 06:34:20 +02:00
|
|
|
getMaterial: (ctx) => (_divisionName, _cityName, _materialName) => {
|
2023-05-16 00:06:57 +02:00
|
|
|
checkAccess(ctx, CorpUnlockName.WarehouseAPI);
|
2022-10-12 14:49:27 +02:00
|
|
|
const divisionName = helpers.string(ctx, "divisionName", _divisionName);
|
2023-06-12 06:34:20 +02:00
|
|
|
const cityName = getEnumHelper("CityName").nsGetMember(ctx, _cityName);
|
|
|
|
const materialName = getEnumHelper("CorpMaterialName").nsGetMember(ctx, _materialName, "materialName");
|
2022-10-12 14:49:27 +02:00
|
|
|
const material = getMaterial(divisionName, cityName, materialName);
|
|
|
|
const corporation = getCorporation();
|
2024-02-10 10:10:19 +01:00
|
|
|
const exports = structuredClone(material.exports);
|
2022-10-12 14:49:27 +02:00
|
|
|
return {
|
2023-05-16 00:06:57 +02:00
|
|
|
marketPrice: material.marketPrice,
|
|
|
|
desiredSellPrice: material.desiredSellPrice,
|
|
|
|
desiredSellAmount: material.desiredSellAmount,
|
2022-10-12 14:49:27 +02:00
|
|
|
name: material.name,
|
2023-05-16 00:06:57 +02:00
|
|
|
stored: material.stored,
|
|
|
|
quality: material.quality,
|
|
|
|
demand: corporation.unlocks.has(CorpUnlockName.MarketResearchDemand) ? material.demand : undefined,
|
|
|
|
competition: corporation.unlocks.has(CorpUnlockName.MarketDataCompetition) ? material.competition : undefined,
|
|
|
|
productionAmount: material.productionAmount,
|
|
|
|
actualSellAmount: material.actualSellAmount,
|
|
|
|
exports: exports,
|
2022-10-12 14:49:27 +02:00
|
|
|
};
|
|
|
|
},
|
2023-03-18 02:12:43 +01:00
|
|
|
getProduct: (ctx) => (_divisionName, _cityName, _productName) => {
|
2023-05-16 00:06:57 +02:00
|
|
|
checkAccess(ctx, CorpUnlockName.WarehouseAPI);
|
2022-10-12 14:49:27 +02:00
|
|
|
const divisionName = helpers.string(ctx, "divisionName", _divisionName);
|
|
|
|
const productName = helpers.string(ctx, "productName", _productName);
|
2023-06-12 06:34:20 +02:00
|
|
|
const cityName = getEnumHelper("CityName").nsGetMember(ctx, _cityName);
|
2023-05-16 00:06:57 +02:00
|
|
|
const product = getProduct(divisionName, productName);
|
2022-10-12 14:49:27 +02:00
|
|
|
const corporation = getCorporation();
|
2023-05-16 00:06:57 +02:00
|
|
|
const cityData = product.cityData[cityName];
|
2022-10-12 14:49:27 +02:00
|
|
|
return {
|
|
|
|
name: product.name,
|
2023-05-16 00:06:57 +02:00
|
|
|
demand: corporation.unlocks.has(CorpUnlockName.MarketResearchDemand) ? product.demand : undefined,
|
|
|
|
competition: corporation.unlocks.has(CorpUnlockName.MarketDataCompetition) ? product.competition : undefined,
|
|
|
|
rating: product.rating,
|
|
|
|
effectiveRating: cityData.effectiveRating,
|
2024-02-10 10:10:19 +01:00
|
|
|
stats: structuredClone(product.stats),
|
2023-10-30 08:10:45 +01:00
|
|
|
productionCost: cityData.productionCost,
|
2023-05-16 00:06:57 +02:00
|
|
|
desiredSellPrice: cityData.desiredSellPrice,
|
|
|
|
desiredSellAmount: cityData.desiredSellAmount,
|
|
|
|
stored: cityData.stored,
|
|
|
|
productionAmount: cityData.productionAmount,
|
|
|
|
actualSellAmount: cityData.actualSellAmount,
|
|
|
|
developmentProgress: product.developmentProgress,
|
2023-07-06 01:50:29 +02:00
|
|
|
advertisingInvestment: product.advertisingInvestment,
|
|
|
|
designInvestment: product.designInvestment,
|
2023-10-30 08:56:54 +01:00
|
|
|
size: product.size,
|
2022-10-12 14:49:27 +02:00
|
|
|
};
|
|
|
|
},
|
|
|
|
purchaseWarehouse: (ctx) => (_divisionName, _cityName) => {
|
2023-05-16 00:06:57 +02:00
|
|
|
checkAccess(ctx, CorpUnlockName.WarehouseAPI);
|
2022-10-12 14:49:27 +02:00
|
|
|
const divisionName = helpers.string(ctx, "divisionName", _divisionName);
|
2023-06-12 06:34:20 +02:00
|
|
|
const cityName = getEnumHelper("CityName").nsGetMember(ctx, _cityName);
|
2022-10-12 14:49:27 +02:00
|
|
|
const corporation = getCorporation();
|
2023-05-16 00:06:57 +02:00
|
|
|
purchaseWarehouse(corporation, getDivision(divisionName), cityName);
|
2022-10-12 14:49:27 +02:00
|
|
|
},
|
2022-05-08 01:08:07 +02:00
|
|
|
upgradeWarehouse:
|
2022-10-12 14:49:27 +02:00
|
|
|
(ctx) =>
|
|
|
|
(_divisionName, _cityName, _amt = 1): void => {
|
2023-05-16 00:06:57 +02:00
|
|
|
checkAccess(ctx, CorpUnlockName.WarehouseAPI);
|
2022-08-08 19:43:41 +02:00
|
|
|
const divisionName = helpers.string(ctx, "divisionName", _divisionName);
|
2023-06-12 06:34:20 +02:00
|
|
|
const cityName = getEnumHelper("CityName").nsGetMember(ctx, _cityName);
|
2022-08-08 19:43:41 +02:00
|
|
|
const amt = helpers.number(ctx, "amount", _amt);
|
2022-05-08 01:08:07 +02:00
|
|
|
const corporation = getCorporation();
|
|
|
|
if (amt < 1) {
|
2024-02-26 14:05:10 +01:00
|
|
|
throw helpers.errorMessage(ctx, "You must provide a positive number");
|
2022-05-08 01:08:07 +02:00
|
|
|
}
|
|
|
|
UpgradeWarehouse(corporation, getDivision(divisionName), getWarehouse(divisionName, cityName), amt);
|
|
|
|
},
|
2023-06-12 06:34:20 +02:00
|
|
|
sellMaterial: (ctx) => (_divisionName, _cityName, _materialName, _amt, _price) => {
|
2023-05-16 00:06:57 +02:00
|
|
|
checkAccess(ctx, CorpUnlockName.WarehouseAPI);
|
2022-10-12 14:49:27 +02:00
|
|
|
const divisionName = helpers.string(ctx, "divisionName", _divisionName);
|
2023-06-12 06:34:20 +02:00
|
|
|
const cityName = getEnumHelper("CityName").nsGetMember(ctx, _cityName);
|
|
|
|
const materialName = getEnumHelper("CorpMaterialName").nsGetMember(ctx, _materialName, "materialName");
|
2022-10-12 14:49:27 +02:00
|
|
|
const amt = helpers.string(ctx, "amt", _amt);
|
|
|
|
const price = helpers.string(ctx, "price", _price);
|
|
|
|
const material = getMaterial(divisionName, cityName, materialName);
|
|
|
|
SellMaterial(material, amt, price);
|
|
|
|
},
|
2022-05-08 01:08:07 +02:00
|
|
|
sellProduct:
|
2022-10-12 14:49:27 +02:00
|
|
|
(ctx) =>
|
|
|
|
(_divisionName, _cityName, _productName, _amt, _price, _all): void => {
|
2023-05-16 00:06:57 +02:00
|
|
|
checkAccess(ctx, CorpUnlockName.WarehouseAPI);
|
2022-08-08 19:43:41 +02:00
|
|
|
const divisionName = helpers.string(ctx, "divisionName", _divisionName);
|
2023-06-12 06:34:20 +02:00
|
|
|
const cityName = getEnumHelper("CityName").nsGetMember(ctx, _cityName);
|
2022-08-08 19:43:41 +02:00
|
|
|
const productName = helpers.string(ctx, "productName", _productName);
|
|
|
|
const amt = helpers.string(ctx, "amt", _amt);
|
|
|
|
const price = helpers.string(ctx, "price", _price);
|
|
|
|
const all = !!_all;
|
2023-05-16 00:06:57 +02:00
|
|
|
const product = getProduct(divisionName, productName);
|
2022-05-08 01:08:07 +02:00
|
|
|
SellProduct(product, cityName, amt, price, all);
|
|
|
|
},
|
2022-10-12 14:49:27 +02:00
|
|
|
discontinueProduct: (ctx) => (_divisionName, _productName) => {
|
2023-05-16 00:06:57 +02:00
|
|
|
checkAccess(ctx, CorpUnlockName.WarehouseAPI);
|
2022-10-12 14:49:27 +02:00
|
|
|
const divisionName = helpers.string(ctx, "divisionName", _divisionName);
|
|
|
|
const productName = helpers.string(ctx, "productName", _productName);
|
2023-05-16 00:06:57 +02:00
|
|
|
getDivision(divisionName).discontinueProduct(productName);
|
2022-10-12 14:49:27 +02:00
|
|
|
},
|
|
|
|
setSmartSupply: (ctx) => (_divisionName, _cityName, _enabled) => {
|
2023-05-16 00:06:57 +02:00
|
|
|
checkAccess(ctx, CorpUnlockName.WarehouseAPI);
|
2022-10-12 14:49:27 +02:00
|
|
|
const divisionName = helpers.string(ctx, "divisionName", _divisionName);
|
2023-06-12 06:34:20 +02:00
|
|
|
const cityName = getEnumHelper("CityName").nsGetMember(ctx, _cityName);
|
2022-10-12 14:49:27 +02:00
|
|
|
const enabled = !!_enabled;
|
|
|
|
const warehouse = getWarehouse(divisionName, cityName);
|
2023-05-16 00:06:57 +02:00
|
|
|
if (!hasUnlock(CorpUnlockName.SmartSupply))
|
2024-02-26 14:05:10 +01:00
|
|
|
throw helpers.errorMessage(ctx, `You have not purchased the Smart Supply upgrade!`);
|
2022-10-12 14:49:27 +02:00
|
|
|
SetSmartSupply(warehouse, enabled);
|
|
|
|
},
|
2023-06-12 06:34:20 +02:00
|
|
|
setSmartSupplyOption: (ctx) => (_divisionName, _cityName, _materialName, _option) => {
|
2023-05-16 00:06:57 +02:00
|
|
|
checkAccess(ctx, CorpUnlockName.WarehouseAPI);
|
2022-10-12 14:49:27 +02:00
|
|
|
const divisionName = helpers.string(ctx, "divisionName", _divisionName);
|
2023-06-12 06:34:20 +02:00
|
|
|
const cityName = getEnumHelper("CityName").nsGetMember(ctx, _cityName);
|
|
|
|
const materialName = getEnumHelper("CorpMaterialName").nsGetMember(ctx, _materialName, "materialName");
|
2022-10-12 14:49:27 +02:00
|
|
|
const warehouse = getWarehouse(divisionName, cityName);
|
|
|
|
const material = getMaterial(divisionName, cityName, materialName);
|
2023-06-12 06:34:20 +02:00
|
|
|
const option = getEnumHelper("SmartSupplyOption").nsGetMember(ctx, _option);
|
2023-05-16 00:06:57 +02:00
|
|
|
if (!hasUnlock(CorpUnlockName.SmartSupply))
|
2024-02-26 14:05:10 +01:00
|
|
|
throw helpers.errorMessage(ctx, `You have not purchased the Smart Supply upgrade!`);
|
2023-03-18 02:12:43 +01:00
|
|
|
SetSmartSupplyOption(warehouse, material, option);
|
2022-10-12 14:49:27 +02:00
|
|
|
},
|
2023-06-12 06:34:20 +02:00
|
|
|
buyMaterial: (ctx) => (_divisionName, _cityName, _materialName, _amt) => {
|
2023-05-16 00:06:57 +02:00
|
|
|
checkAccess(ctx, CorpUnlockName.WarehouseAPI);
|
2022-10-12 14:49:27 +02:00
|
|
|
const divisionName = helpers.string(ctx, "divisionName", _divisionName);
|
2023-07-06 01:36:22 +02:00
|
|
|
const division = getCorporation().divisions.get(divisionName);
|
2024-02-26 14:05:10 +01:00
|
|
|
if (!division) throw helpers.errorMessage(ctx, `No division with provided name ${divisionName}`);
|
2023-06-12 06:34:20 +02:00
|
|
|
const cityName = getEnumHelper("CityName").nsGetMember(ctx, _cityName);
|
|
|
|
const materialName = getEnumHelper("CorpMaterialName").nsGetMember(ctx, _materialName, "materialName");
|
2022-10-12 14:49:27 +02:00
|
|
|
const amt = helpers.number(ctx, "amt", _amt);
|
2022-10-24 22:09:53 +02:00
|
|
|
if (amt < 0 || !Number.isFinite(amt))
|
|
|
|
throw new Error("Invalid value for amount field! Must be numeric and greater than 0");
|
2022-10-12 14:49:27 +02:00
|
|
|
const material = getMaterial(divisionName, cityName, materialName);
|
2023-07-06 01:36:22 +02:00
|
|
|
BuyMaterial(division, material, amt);
|
2022-10-12 14:49:27 +02:00
|
|
|
},
|
2023-06-12 06:34:20 +02:00
|
|
|
bulkPurchase: (ctx) => (_divisionName, _cityName, _materialName, _amt) => {
|
2023-05-16 00:06:57 +02:00
|
|
|
checkAccess(ctx, CorpUnlockName.WarehouseAPI);
|
2022-10-12 14:49:27 +02:00
|
|
|
const divisionName = helpers.string(ctx, "divisionName", _divisionName);
|
2023-07-06 01:36:22 +02:00
|
|
|
const division = getCorporation().divisions.get(divisionName);
|
2024-02-26 14:05:10 +01:00
|
|
|
if (!division) throw helpers.errorMessage(ctx, `No division with provided name ${divisionName}`);
|
2022-10-12 14:49:27 +02:00
|
|
|
const corporation = getCorporation();
|
2023-06-12 06:34:20 +02:00
|
|
|
const cityName = getEnumHelper("CityName").nsGetMember(ctx, _cityName);
|
|
|
|
const materialName = getEnumHelper("CorpMaterialName").nsGetMember(ctx, _materialName, "materialName");
|
2022-10-12 14:49:27 +02:00
|
|
|
const amt = helpers.number(ctx, "amt", _amt);
|
|
|
|
const warehouse = getWarehouse(divisionName, cityName);
|
|
|
|
const material = getMaterial(divisionName, cityName, materialName);
|
2023-07-06 01:36:22 +02:00
|
|
|
BulkPurchase(corporation, division, warehouse, material, amt);
|
2022-10-12 14:49:27 +02:00
|
|
|
},
|
2022-05-08 01:08:07 +02:00
|
|
|
makeProduct:
|
2022-10-12 14:49:27 +02:00
|
|
|
(ctx) =>
|
|
|
|
(_divisionName, _cityName, _productName, _designInvest, _marketingInvest): void => {
|
2023-05-16 00:06:57 +02:00
|
|
|
checkAccess(ctx, CorpUnlockName.WarehouseAPI);
|
2022-08-08 19:43:41 +02:00
|
|
|
const divisionName = helpers.string(ctx, "divisionName", _divisionName);
|
2023-06-12 06:34:20 +02:00
|
|
|
const cityName = getEnumHelper("CityName").nsGetMember(ctx, _cityName);
|
2022-08-08 19:43:41 +02:00
|
|
|
const productName = helpers.string(ctx, "productName", _productName);
|
|
|
|
const designInvest = helpers.number(ctx, "designInvest", _designInvest);
|
|
|
|
const marketingInvest = helpers.number(ctx, "marketingInvest", _marketingInvest);
|
2022-05-08 01:08:07 +02:00
|
|
|
const corporation = getCorporation();
|
|
|
|
MakeProduct(corporation, getDivision(divisionName), cityName, productName, designInvest, marketingInvest);
|
|
|
|
},
|
2022-10-12 14:49:27 +02:00
|
|
|
limitProductProduction: (ctx) => (_divisionName, _cityName, _productName, _qty) => {
|
2023-05-16 00:06:57 +02:00
|
|
|
checkAccess(ctx, CorpUnlockName.WarehouseAPI);
|
2022-10-12 14:49:27 +02:00
|
|
|
const divisionName = helpers.string(ctx, "divisionName", _divisionName);
|
2023-06-12 06:34:20 +02:00
|
|
|
const cityName = getEnumHelper("CityName").nsGetMember(ctx, _cityName);
|
2022-10-12 14:49:27 +02:00
|
|
|
const productName = helpers.string(ctx, "productName", _productName);
|
|
|
|
const qty = helpers.number(ctx, "qty", _qty);
|
2023-05-16 00:06:57 +02:00
|
|
|
LimitProductProduction(getProduct(divisionName, productName), cityName, qty);
|
2022-10-12 14:49:27 +02:00
|
|
|
},
|
2022-05-08 01:08:07 +02:00
|
|
|
exportMaterial:
|
2022-10-12 14:49:27 +02:00
|
|
|
(ctx) =>
|
2023-06-12 06:34:20 +02:00
|
|
|
(_sourceDivision, _sourceCity, _targetDivision, _targetCity, _materialName, _amt): void => {
|
2023-05-16 00:06:57 +02:00
|
|
|
checkAccess(ctx, CorpUnlockName.WarehouseAPI);
|
2022-08-08 19:43:41 +02:00
|
|
|
const sourceDivision = helpers.string(ctx, "sourceDivision", _sourceDivision);
|
2023-06-12 06:34:20 +02:00
|
|
|
const sourceCity = getEnumHelper("CityName").nsGetMember(ctx, _sourceCity, "sourceCity");
|
2023-06-07 05:50:23 +02:00
|
|
|
const targetDivision = getDivision(helpers.string(ctx, "targetDivision", _targetDivision));
|
2023-06-12 06:34:20 +02:00
|
|
|
const targetCity = getEnumHelper("CityName").nsGetMember(ctx, _targetCity, "targetCity");
|
|
|
|
const materialName = getEnumHelper("CorpMaterialName").nsGetMember(ctx, _materialName, "materialName");
|
2022-08-08 19:43:41 +02:00
|
|
|
const amt = helpers.string(ctx, "amt", _amt);
|
2023-06-12 06:34:20 +02:00
|
|
|
|
2023-06-07 05:50:23 +02:00
|
|
|
ExportMaterial(targetDivision, targetCity, getMaterial(sourceDivision, sourceCity, materialName), amt);
|
2022-05-08 01:08:07 +02:00
|
|
|
},
|
|
|
|
cancelExportMaterial:
|
2022-10-12 14:49:27 +02:00
|
|
|
(ctx) =>
|
2023-06-12 06:34:20 +02:00
|
|
|
(_sourceDivision, _sourceCity, _targetDivision, _targetCity, _materialName): void => {
|
2023-05-16 00:06:57 +02:00
|
|
|
checkAccess(ctx, CorpUnlockName.WarehouseAPI);
|
2022-08-08 19:43:41 +02:00
|
|
|
const sourceDivision = helpers.string(ctx, "sourceDivision", _sourceDivision);
|
2023-06-12 06:34:20 +02:00
|
|
|
const sourceCity = getEnumHelper("CityName").nsGetMember(ctx, _sourceCity, "sourceCity");
|
2022-08-08 19:43:41 +02:00
|
|
|
const targetDivision = helpers.string(ctx, "targetDivision", _targetDivision);
|
2023-06-12 06:34:20 +02:00
|
|
|
const targetCity = getEnumHelper("CityName").nsGetMember(ctx, _targetCity, "targetCity");
|
|
|
|
const materialName = getEnumHelper("CorpMaterialName").nsGetMember(ctx, _materialName, "materialName");
|
2023-06-07 05:50:23 +02:00
|
|
|
CancelExportMaterial(targetDivision, targetCity, getMaterial(sourceDivision, sourceCity, materialName));
|
2022-05-08 01:08:07 +02:00
|
|
|
},
|
2023-06-12 06:34:20 +02:00
|
|
|
limitMaterialProduction: (ctx) => (_divisionName, _cityName, _materialName, _qty) => {
|
2023-05-16 00:06:57 +02:00
|
|
|
checkAccess(ctx, CorpUnlockName.WarehouseAPI);
|
2022-10-12 14:49:27 +02:00
|
|
|
const divisionName = helpers.string(ctx, "divisionName", _divisionName);
|
2023-06-12 06:34:20 +02:00
|
|
|
const cityName = getEnumHelper("CityName").nsGetMember(ctx, _cityName);
|
|
|
|
const materialName = getEnumHelper("CorpMaterialName").nsGetMember(ctx, _materialName, "materialName");
|
2022-10-12 14:49:27 +02:00
|
|
|
const qty = helpers.number(ctx, "qty", _qty);
|
|
|
|
LimitMaterialProduction(getMaterial(divisionName, cityName, materialName), qty);
|
|
|
|
},
|
2023-06-12 06:34:20 +02:00
|
|
|
setMaterialMarketTA1: (ctx) => (_divisionName, _cityName, _materialName, _on) => {
|
2023-05-16 00:06:57 +02:00
|
|
|
checkAccess(ctx, CorpUnlockName.WarehouseAPI);
|
2022-10-12 14:49:27 +02:00
|
|
|
const divisionName = helpers.string(ctx, "divisionName", _divisionName);
|
2023-06-12 06:34:20 +02:00
|
|
|
const cityName = getEnumHelper("CityName").nsGetMember(ctx, _cityName);
|
|
|
|
const materialName = getEnumHelper("CorpMaterialName").nsGetMember(ctx, _materialName, "materialName");
|
2022-10-12 14:49:27 +02:00
|
|
|
const on = !!_on;
|
|
|
|
if (!getDivision(divisionName).hasResearch("Market-TA.I"))
|
2024-02-26 14:05:10 +01:00
|
|
|
throw helpers.errorMessage(ctx, `You have not researched MarketTA.I for division: ${divisionName}`);
|
2022-10-12 14:49:27 +02:00
|
|
|
SetMaterialMarketTA1(getMaterial(divisionName, cityName, materialName), on);
|
|
|
|
},
|
2023-06-12 06:34:20 +02:00
|
|
|
setMaterialMarketTA2: (ctx) => (_divisionName, _cityName, _materialName, _on) => {
|
2023-05-16 00:06:57 +02:00
|
|
|
checkAccess(ctx, CorpUnlockName.WarehouseAPI);
|
2022-10-12 14:49:27 +02:00
|
|
|
const divisionName = helpers.string(ctx, "divisionName", _divisionName);
|
2023-06-12 06:34:20 +02:00
|
|
|
const cityName = getEnumHelper("CityName").nsGetMember(ctx, _cityName);
|
|
|
|
const materialName = getEnumHelper("CorpMaterialName").nsGetMember(ctx, _materialName, "materialName");
|
2022-10-12 14:49:27 +02:00
|
|
|
const on = !!_on;
|
|
|
|
if (!getDivision(divisionName).hasResearch("Market-TA.II"))
|
2024-02-26 14:05:10 +01:00
|
|
|
throw helpers.errorMessage(ctx, `You have not researched MarketTA.II for division: ${divisionName}`);
|
2022-10-12 14:49:27 +02:00
|
|
|
SetMaterialMarketTA2(getMaterial(divisionName, cityName, materialName), on);
|
|
|
|
},
|
2023-05-16 00:06:57 +02:00
|
|
|
setProductMarketTA1: (ctx) => (_divisionName, _productName, _on) => {
|
|
|
|
checkAccess(ctx, CorpUnlockName.WarehouseAPI);
|
2022-10-12 14:49:27 +02:00
|
|
|
const divisionName = helpers.string(ctx, "divisionName", _divisionName);
|
|
|
|
const productName = helpers.string(ctx, "productName", _productName);
|
|
|
|
const on = !!_on;
|
|
|
|
if (!getDivision(divisionName).hasResearch("Market-TA.I"))
|
2024-02-26 14:05:10 +01:00
|
|
|
throw helpers.errorMessage(ctx, `You have not researched MarketTA.I for division: ${divisionName}`);
|
2023-05-16 00:06:57 +02:00
|
|
|
SetProductMarketTA1(getProduct(divisionName, productName), on);
|
2022-10-12 14:49:27 +02:00
|
|
|
},
|
2023-05-16 00:06:57 +02:00
|
|
|
setProductMarketTA2: (ctx) => (_divisionName, _productName, _on) => {
|
|
|
|
checkAccess(ctx, CorpUnlockName.WarehouseAPI);
|
2022-10-12 14:49:27 +02:00
|
|
|
const divisionName = helpers.string(ctx, "divisionName", _divisionName);
|
|
|
|
const productName = helpers.string(ctx, "productName", _productName);
|
|
|
|
const on = !!_on;
|
|
|
|
if (!getDivision(divisionName).hasResearch("Market-TA.II"))
|
2024-02-26 14:05:10 +01:00
|
|
|
throw helpers.errorMessage(ctx, `You have not researched MarketTA.II for division: ${divisionName}`);
|
2023-05-16 00:06:57 +02:00
|
|
|
SetProductMarketTA2(getProduct(divisionName, productName), on);
|
2022-10-12 14:49:27 +02:00
|
|
|
},
|
2021-12-04 05:06:04 +01:00
|
|
|
};
|
|
|
|
|
2022-05-08 01:08:07 +02:00
|
|
|
const officeAPI: InternalAPI<OfficeAPI> = {
|
2022-10-12 14:49:27 +02:00
|
|
|
getHireAdVertCost: (ctx) => (_divisionName) => {
|
2023-05-16 00:06:57 +02:00
|
|
|
checkAccess(ctx, CorpUnlockName.OfficeAPI);
|
2022-10-12 14:49:27 +02:00
|
|
|
const divisionName = helpers.string(ctx, "divisionName", _divisionName);
|
|
|
|
const division = getDivision(divisionName);
|
|
|
|
return division.getAdVertCost();
|
|
|
|
},
|
|
|
|
getHireAdVertCount: (ctx) => (_divisionName) => {
|
2023-05-16 00:06:57 +02:00
|
|
|
checkAccess(ctx, CorpUnlockName.OfficeAPI);
|
2022-10-12 14:49:27 +02:00
|
|
|
const divisionName = helpers.string(ctx, "divisionName", _divisionName);
|
|
|
|
const division = getDivision(divisionName);
|
|
|
|
return division.numAdVerts;
|
|
|
|
},
|
2023-06-12 06:34:20 +02:00
|
|
|
getResearchCost: (ctx) => (_divisionName, _researchName) => {
|
2023-05-16 00:06:57 +02:00
|
|
|
checkAccess(ctx, CorpUnlockName.OfficeAPI);
|
2022-10-12 14:49:27 +02:00
|
|
|
const divisionName = helpers.string(ctx, "divisionName", _divisionName);
|
2023-06-12 06:34:20 +02:00
|
|
|
const researchName = getEnumHelper("CorpResearchName").nsGetMember(ctx, _researchName, "researchName");
|
2022-10-12 14:49:27 +02:00
|
|
|
return getResearchCost(getDivision(divisionName), researchName);
|
|
|
|
},
|
2023-06-12 06:34:20 +02:00
|
|
|
hasResearched: (ctx) => (_divisionName, _researchName) => {
|
2023-05-16 00:06:57 +02:00
|
|
|
checkAccess(ctx, CorpUnlockName.OfficeAPI);
|
2022-10-12 14:49:27 +02:00
|
|
|
const divisionName = helpers.string(ctx, "divisionName", _divisionName);
|
2023-06-12 06:34:20 +02:00
|
|
|
const researchName = getEnumHelper("CorpResearchName").nsGetMember(ctx, _researchName, "researchName");
|
2022-10-12 14:49:27 +02:00
|
|
|
return hasResearched(getDivision(divisionName), researchName);
|
|
|
|
},
|
2024-03-25 01:37:08 +01:00
|
|
|
getOfficeSizeUpgradeCost: (ctx) => (_divisionName, _cityName, _increase) => {
|
2023-05-16 00:06:57 +02:00
|
|
|
checkAccess(ctx, CorpUnlockName.OfficeAPI);
|
2022-10-12 14:49:27 +02:00
|
|
|
const divisionName = helpers.string(ctx, "divisionName", _divisionName);
|
2023-06-12 06:34:20 +02:00
|
|
|
const cityName = getEnumHelper("CityName").nsGetMember(ctx, _cityName);
|
2024-03-25 01:37:08 +01:00
|
|
|
const increase = helpers.positiveInteger(ctx, "increase", _increase);
|
2022-10-12 14:49:27 +02:00
|
|
|
const office = getOffice(divisionName, cityName);
|
2024-03-25 01:37:08 +01:00
|
|
|
return calculateOfficeSizeUpgradeCost(office.size, increase);
|
2022-10-12 14:49:27 +02:00
|
|
|
},
|
|
|
|
setAutoJobAssignment: (ctx) => (_divisionName, _cityName, _job, _amount) => {
|
2023-05-16 00:06:57 +02:00
|
|
|
checkAccess(ctx, CorpUnlockName.OfficeAPI);
|
2022-10-12 14:49:27 +02:00
|
|
|
const divisionName = helpers.string(ctx, "divisionName", _divisionName);
|
2023-06-12 06:34:20 +02:00
|
|
|
const cityName = getEnumHelper("CityName").nsGetMember(ctx, _cityName);
|
2022-10-12 14:49:27 +02:00
|
|
|
const amount = helpers.number(ctx, "amount", _amount);
|
2023-06-12 06:34:20 +02:00
|
|
|
const job = getEnumHelper("CorpEmployeeJob").nsGetMember(ctx, _job, "job");
|
2022-06-01 19:11:33 +02:00
|
|
|
|
2023-05-16 00:06:57 +02:00
|
|
|
if (job === CorpEmployeeJob.Unassigned) return false;
|
2023-01-06 20:52:40 +01:00
|
|
|
if (amount < 0 || !Number.isInteger(amount))
|
2024-02-26 14:05:10 +01:00
|
|
|
throw helpers.errorMessage(
|
2023-01-06 20:52:40 +01:00
|
|
|
ctx,
|
|
|
|
`Invalid value for amount! Must be an integer and greater than or be 0". Amount:'${amount}'`,
|
|
|
|
);
|
|
|
|
|
2022-10-12 14:49:27 +02:00
|
|
|
const office = getOffice(divisionName, cityName);
|
2023-01-29 13:39:01 +01:00
|
|
|
|
|
|
|
const totalNewEmployees = amount - office.employeeNextJobs[job];
|
|
|
|
|
2023-05-16 00:06:57 +02:00
|
|
|
if (office.employeeNextJobs[CorpEmployeeJob.Unassigned] < totalNewEmployees)
|
2024-02-26 14:05:10 +01:00
|
|
|
throw helpers.errorMessage(
|
2023-01-06 20:52:40 +01:00
|
|
|
ctx,
|
2023-01-29 13:39:01 +01:00
|
|
|
`Unable to bring '${job} employees to ${amount}. Requires ${totalNewEmployees} unassigned employees`,
|
2023-01-06 20:52:40 +01:00
|
|
|
);
|
2023-01-29 14:14:12 +01:00
|
|
|
return office.autoAssignJob(job, amount);
|
2022-10-12 14:49:27 +02:00
|
|
|
},
|
2023-07-11 17:50:55 +02:00
|
|
|
hireEmployee: (ctx) => (_divisionName, _cityName, _position) => {
|
2023-05-16 00:06:57 +02:00
|
|
|
checkAccess(ctx, CorpUnlockName.OfficeAPI);
|
2023-07-11 17:50:55 +02:00
|
|
|
_position ??= CorpEmployeeJob.Unassigned;
|
2022-10-12 14:49:27 +02:00
|
|
|
const divisionName = helpers.string(ctx, "divisionName", _divisionName);
|
2023-06-12 06:34:20 +02:00
|
|
|
const cityName = getEnumHelper("CityName").nsGetMember(ctx, _cityName);
|
|
|
|
const position = getEnumHelper("CorpEmployeeJob").nsGetMember(ctx, _position, "position");
|
|
|
|
|
2022-10-12 14:49:27 +02:00
|
|
|
const office = getOffice(divisionName, cityName);
|
2022-10-24 14:44:01 +02:00
|
|
|
return office.hireRandomEmployee(position);
|
2022-10-12 14:49:27 +02:00
|
|
|
},
|
|
|
|
upgradeOfficeSize: (ctx) => (_divisionName, _cityName, _size) => {
|
2023-05-16 00:06:57 +02:00
|
|
|
checkAccess(ctx, CorpUnlockName.OfficeAPI);
|
2022-10-12 14:49:27 +02:00
|
|
|
const divisionName = helpers.string(ctx, "divisionName", _divisionName);
|
2023-06-12 06:34:20 +02:00
|
|
|
const cityName = getEnumHelper("CityName").nsGetMember(ctx, _cityName);
|
2024-03-25 01:37:08 +01:00
|
|
|
const size = helpers.positiveInteger(ctx, "size", _size);
|
|
|
|
|
2022-10-12 14:49:27 +02:00
|
|
|
const office = getOffice(divisionName, cityName);
|
|
|
|
const corporation = getCorporation();
|
|
|
|
UpgradeOfficeSize(corporation, office, size);
|
|
|
|
},
|
|
|
|
throwParty: (ctx) => (_divisionName, _cityName, _costPerEmployee) => {
|
2023-05-16 00:06:57 +02:00
|
|
|
checkAccess(ctx, CorpUnlockName.OfficeAPI);
|
2022-10-12 14:49:27 +02:00
|
|
|
const divisionName = helpers.string(ctx, "divisionName", _divisionName);
|
2023-06-12 06:34:20 +02:00
|
|
|
const cityName = getEnumHelper("CityName").nsGetMember(ctx, _cityName);
|
2022-10-12 14:49:27 +02:00
|
|
|
const costPerEmployee = helpers.number(ctx, "costPerEmployee", _costPerEmployee);
|
2022-06-02 00:26:32 +02:00
|
|
|
|
2022-10-12 14:49:27 +02:00
|
|
|
if (costPerEmployee < 0) {
|
|
|
|
throw new Error("Invalid value for Cost Per Employee field! Must be numeric and greater than 0");
|
|
|
|
}
|
|
|
|
const corporation = getCorporation();
|
|
|
|
const office = getOffice(divisionName, cityName);
|
2022-06-02 00:26:32 +02:00
|
|
|
|
2022-10-12 14:49:27 +02:00
|
|
|
return ThrowParty(corporation, office, costPerEmployee);
|
|
|
|
},
|
2023-03-18 02:12:43 +01:00
|
|
|
buyTea: (ctx) => (_divisionName, _cityName) => {
|
2023-05-16 00:06:57 +02:00
|
|
|
checkAccess(ctx, CorpUnlockName.OfficeAPI);
|
2022-10-12 14:49:27 +02:00
|
|
|
const divisionName = helpers.string(ctx, "divisionName", _divisionName);
|
2023-06-12 06:34:20 +02:00
|
|
|
const cityName = getEnumHelper("CityName").nsGetMember(ctx, _cityName);
|
2022-06-02 00:26:32 +02:00
|
|
|
|
2022-10-12 14:49:27 +02:00
|
|
|
const corporation = getCorporation();
|
|
|
|
const office = getOffice(divisionName, cityName);
|
2023-03-18 02:12:43 +01:00
|
|
|
return BuyTea(corporation, office);
|
2022-10-12 14:49:27 +02:00
|
|
|
},
|
|
|
|
hireAdVert: (ctx) => (_divisionName) => {
|
2023-05-16 00:06:57 +02:00
|
|
|
checkAccess(ctx, CorpUnlockName.OfficeAPI);
|
2022-10-12 14:49:27 +02:00
|
|
|
const divisionName = helpers.string(ctx, "divisionName", _divisionName);
|
|
|
|
const corporation = getCorporation();
|
|
|
|
HireAdVert(corporation, getDivision(divisionName));
|
|
|
|
},
|
2023-06-12 06:34:20 +02:00
|
|
|
research: (ctx) => (_divisionName, _researchName) => {
|
2023-05-16 00:06:57 +02:00
|
|
|
checkAccess(ctx, CorpUnlockName.OfficeAPI);
|
2022-10-12 14:49:27 +02:00
|
|
|
const divisionName = helpers.string(ctx, "divisionName", _divisionName);
|
2023-06-12 06:34:20 +02:00
|
|
|
const researchName = getEnumHelper("CorpResearchName").nsGetMember(ctx, _researchName, "researchName");
|
2022-10-12 14:49:27 +02:00
|
|
|
Research(getDivision(divisionName), researchName);
|
|
|
|
},
|
|
|
|
getOffice: (ctx) => (_divisionName, _cityName) => {
|
2023-05-16 00:06:57 +02:00
|
|
|
checkAccess(ctx, CorpUnlockName.OfficeAPI);
|
2022-10-12 14:49:27 +02:00
|
|
|
const divisionName = helpers.string(ctx, "divisionName", _divisionName);
|
2023-06-12 06:34:20 +02:00
|
|
|
const cityName = getEnumHelper("CityName").nsGetMember(ctx, _cityName);
|
2022-10-12 14:49:27 +02:00
|
|
|
const office = getOffice(divisionName, cityName);
|
|
|
|
return {
|
2023-05-16 00:06:57 +02:00
|
|
|
city: office.city,
|
2022-10-12 14:49:27 +02:00
|
|
|
size: office.size,
|
2023-05-16 00:06:57 +02:00
|
|
|
maxEnergy: office.maxEnergy,
|
|
|
|
maxMorale: office.maxMorale,
|
|
|
|
numEmployees: office.numEmployees,
|
|
|
|
avgEnergy: office.avgEnergy,
|
|
|
|
avgMorale: office.avgMorale,
|
|
|
|
totalExperience: office.totalExperience,
|
|
|
|
employeeProductionByJob: Object.assign({}, office.employeeProductionByJob),
|
2022-10-24 14:44:01 +02:00
|
|
|
employeeJobs: Object.assign({}, office.employeeJobs),
|
2022-10-12 14:49:27 +02:00
|
|
|
};
|
|
|
|
},
|
2021-12-04 05:06:04 +01:00
|
|
|
};
|
|
|
|
|
2022-12-30 02:28:53 +01:00
|
|
|
// TODO 2.2: Add removed function error dialogs for all the functions removed/replaced by getConstants.
|
|
|
|
const corpFunctions: InternalAPI<NSCorporation> = {
|
2021-12-04 05:06:04 +01:00
|
|
|
...warehouseAPI,
|
|
|
|
...officeAPI,
|
2022-11-09 13:26:26 +01:00
|
|
|
hasCorporation: () => () => !!Player.corporation,
|
2022-12-25 09:33:13 +01:00
|
|
|
getConstants: (ctx) => () => {
|
2022-08-31 11:05:36 +02:00
|
|
|
checkAccess(ctx);
|
2024-02-10 10:10:19 +01:00
|
|
|
/* TODO 2.2: possibly just rework the whole corp constants structure to be more readable, and just use
|
|
|
|
* structuredClone to provide it directly to player.
|
2022-12-30 02:28:53 +01:00
|
|
|
* TODO 2.2: Roll product information into industriesData, there's no reason to look up a product separately */
|
|
|
|
// TODO: add functions for getting materialInfo and research info
|
2024-02-10 10:10:19 +01:00
|
|
|
return structuredClone(omit(corpConstants, "fundingRoundShares", "fundingRoundMultiplier", "valuationLength"));
|
2022-12-30 02:28:53 +01:00
|
|
|
},
|
|
|
|
getIndustryData: (ctx) => (_industryName) => {
|
|
|
|
checkAccess(ctx);
|
2023-06-12 06:34:20 +02:00
|
|
|
const industryName = getEnumHelper("IndustryType").nsGetMember(ctx, _industryName, "industryName");
|
2024-02-10 10:10:19 +01:00
|
|
|
return structuredClone(IndustriesData[industryName]);
|
2022-12-30 02:28:53 +01:00
|
|
|
},
|
2023-06-12 06:34:20 +02:00
|
|
|
getMaterialData: (ctx) => (_materialName) => {
|
2022-12-30 02:28:53 +01:00
|
|
|
checkAccess(ctx);
|
2023-06-12 06:34:20 +02:00
|
|
|
const materialName = getEnumHelper("CorpMaterialName").nsGetMember(ctx, _materialName, "materialName");
|
2024-02-10 10:10:19 +01:00
|
|
|
return structuredClone(MaterialInfo[materialName]);
|
2022-08-10 00:25:02 +02:00
|
|
|
},
|
2022-10-12 14:49:27 +02:00
|
|
|
expandIndustry: (ctx) => (_industryName, _divisionName) => {
|
|
|
|
checkAccess(ctx);
|
2023-06-12 06:34:20 +02:00
|
|
|
const industryName = getEnumHelper("IndustryType").nsGetMember(ctx, _industryName, "industryName");
|
2022-10-12 14:49:27 +02:00
|
|
|
const divisionName = helpers.string(ctx, "divisionName", _divisionName);
|
|
|
|
const corporation = getCorporation();
|
2023-05-17 23:28:24 +02:00
|
|
|
NewDivision(corporation, industryName, divisionName);
|
2022-10-12 14:49:27 +02:00
|
|
|
},
|
|
|
|
expandCity: (ctx) => (_divisionName, _cityName) => {
|
|
|
|
checkAccess(ctx);
|
|
|
|
const divisionName = helpers.string(ctx, "divisionName", _divisionName);
|
2023-06-12 06:34:20 +02:00
|
|
|
const cityName = getEnumHelper("CityName").nsGetMember(ctx, _cityName);
|
2022-10-12 14:49:27 +02:00
|
|
|
const corporation = getCorporation();
|
|
|
|
const division = getDivision(divisionName);
|
2023-05-16 00:06:57 +02:00
|
|
|
purchaseOffice(corporation, division, cityName);
|
2022-10-12 14:49:27 +02:00
|
|
|
},
|
2023-05-16 00:06:57 +02:00
|
|
|
purchaseUnlock: (ctx) => (_unlockName) => {
|
2022-10-12 14:49:27 +02:00
|
|
|
checkAccess(ctx);
|
2023-06-12 06:34:20 +02:00
|
|
|
const unlockName = getEnumHelper("CorpUnlockName").nsGetMember(ctx, _unlockName, "unlockName");
|
2022-10-12 14:49:27 +02:00
|
|
|
const corporation = getCorporation();
|
2023-05-16 00:06:57 +02:00
|
|
|
const message = corporation.purchaseUnlock(unlockName);
|
|
|
|
if (message) throw new Error(`Could not unlock ${unlockName}: ${message}`);
|
2022-10-12 14:49:27 +02:00
|
|
|
},
|
|
|
|
levelUpgrade: (ctx) => (_upgradeName) => {
|
|
|
|
checkAccess(ctx);
|
2023-06-12 06:34:20 +02:00
|
|
|
const upgradeName = getEnumHelper("CorpUpgradeName").nsGetMember(ctx, _upgradeName, "upgradeName");
|
2022-10-12 14:49:27 +02:00
|
|
|
const corporation = getCorporation();
|
2023-05-16 00:06:57 +02:00
|
|
|
const message = corporation.purchaseUpgrade(upgradeName, 1);
|
|
|
|
if (message) throw new Error(`Could not upgrade ${upgradeName}: ${message}`);
|
2022-10-12 14:49:27 +02:00
|
|
|
},
|
|
|
|
issueDividends: (ctx) => (_rate) => {
|
|
|
|
checkAccess(ctx);
|
|
|
|
const rate = helpers.number(ctx, "rate", _rate);
|
2022-12-30 02:28:53 +01:00
|
|
|
const max = corpConstants.dividendMaxRate;
|
2022-10-12 14:49:27 +02:00
|
|
|
if (rate < 0 || rate > max)
|
|
|
|
throw new Error(`Invalid value for rate field! Must be numeric, greater than 0, and less than ${max}`);
|
|
|
|
const corporation = getCorporation();
|
2024-02-26 14:05:10 +01:00
|
|
|
if (!corporation.public) throw helpers.errorMessage(ctx, `Your company has not gone public!`);
|
2022-10-12 14:49:27 +02:00
|
|
|
IssueDividends(corporation, rate);
|
|
|
|
},
|
2022-12-25 09:35:18 +01:00
|
|
|
issueNewShares: (ctx) => (_amount) => {
|
|
|
|
checkAccess(ctx);
|
|
|
|
const corporation = getCorporation();
|
|
|
|
const maxNewShares = corporation.calculateMaxNewShares();
|
|
|
|
if (_amount == undefined) _amount = maxNewShares;
|
|
|
|
const amount = helpers.number(ctx, "amount", _amount);
|
|
|
|
const [funds] = IssueNewShares(corporation, amount);
|
|
|
|
return funds;
|
|
|
|
},
|
2022-10-12 14:49:27 +02:00
|
|
|
getDivision: (ctx) => (_divisionName) => {
|
|
|
|
checkAccess(ctx);
|
|
|
|
const divisionName = helpers.string(ctx, "divisionName", _divisionName);
|
|
|
|
const division = getDivision(divisionName);
|
|
|
|
return getSafeDivision(division);
|
|
|
|
},
|
|
|
|
getCorporation: (ctx) => () => {
|
2022-05-08 01:08:07 +02:00
|
|
|
checkAccess(ctx);
|
2021-12-04 05:06:04 +01:00
|
|
|
const corporation = getCorporation();
|
2023-10-23 10:48:06 +02:00
|
|
|
const data = {
|
2021-12-04 05:06:04 +01:00
|
|
|
name: corporation.name,
|
|
|
|
funds: corporation.funds,
|
|
|
|
revenue: corporation.revenue,
|
|
|
|
expenses: corporation.expenses,
|
|
|
|
public: corporation.public,
|
|
|
|
totalShares: corporation.totalShares,
|
|
|
|
numShares: corporation.numShares,
|
|
|
|
shareSaleCooldown: corporation.shareSaleCooldown,
|
2023-09-20 06:36:48 +02:00
|
|
|
investorShares: corporation.investorShares,
|
2021-12-04 05:06:04 +01:00
|
|
|
issuedShares: corporation.issuedShares,
|
2023-09-12 07:23:36 +02:00
|
|
|
issueNewSharesCooldown: corporation.issueNewSharesCooldown,
|
2021-12-04 05:06:04 +01:00
|
|
|
sharePrice: corporation.sharePrice,
|
2022-05-30 23:21:27 +02:00
|
|
|
dividendRate: corporation.dividendRate,
|
|
|
|
dividendTax: corporation.dividendTax,
|
2022-12-30 02:28:53 +01:00
|
|
|
dividendEarnings: corporation.getCycleDividends() / corpConstants.secondsPerMarketCycle,
|
2023-10-23 10:48:06 +02:00
|
|
|
nextState: corporation.state.nextName,
|
|
|
|
prevState: corporation.state.prevName,
|
2023-05-16 00:06:57 +02:00
|
|
|
divisions: [...corporation.divisions.keys()],
|
2021-12-04 05:06:04 +01:00
|
|
|
};
|
2023-10-23 10:48:06 +02:00
|
|
|
setDeprecatedProperties(data, {
|
|
|
|
state: {
|
|
|
|
identifier: "ns.corporation.getCorporation().state",
|
|
|
|
message: "Use ns.corporation.getCorporation().nextState instead.",
|
|
|
|
value: corporation.state.nextName,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
return data;
|
2021-10-14 09:22:02 +02:00
|
|
|
},
|
2022-05-08 01:08:07 +02:00
|
|
|
createCorporation:
|
2022-10-12 14:49:27 +02:00
|
|
|
(ctx) =>
|
|
|
|
(_corporationName, _selfFund = true): boolean => {
|
2022-08-08 19:43:41 +02:00
|
|
|
const corporationName = helpers.string(ctx, "corporationName", _corporationName);
|
2022-08-20 16:37:39 +02:00
|
|
|
const selfFund = !!_selfFund;
|
2022-05-08 01:08:07 +02:00
|
|
|
return createCorporation(corporationName, selfFund);
|
|
|
|
},
|
2023-05-16 00:06:57 +02:00
|
|
|
hasUnlock: (ctx) => (_unlockName) => {
|
2022-10-12 14:49:27 +02:00
|
|
|
checkAccess(ctx);
|
2023-06-12 06:34:20 +02:00
|
|
|
const unlockName = getEnumHelper("CorpUnlockName").nsGetMember(ctx, _unlockName, "unlockName");
|
2023-05-16 00:06:57 +02:00
|
|
|
return hasUnlock(unlockName);
|
2022-10-12 14:49:27 +02:00
|
|
|
},
|
2023-05-16 00:06:57 +02:00
|
|
|
getUnlockCost: (ctx) => (_unlockName) => {
|
2022-10-12 14:49:27 +02:00
|
|
|
checkAccess(ctx);
|
2023-06-12 06:34:20 +02:00
|
|
|
const unlockName = getEnumHelper("CorpUnlockName").nsGetMember(ctx, _unlockName, "unlockName");
|
2023-05-16 00:06:57 +02:00
|
|
|
return getUnlockCost(unlockName);
|
2022-10-12 14:49:27 +02:00
|
|
|
},
|
|
|
|
getUpgradeLevel: (ctx) => (_upgradeName) => {
|
|
|
|
checkAccess(ctx);
|
2023-06-12 06:34:20 +02:00
|
|
|
const upgradeName = getEnumHelper("CorpUpgradeName").nsGetMember(ctx, _upgradeName, "upgradeName");
|
2023-05-16 00:06:57 +02:00
|
|
|
return getUpgradeLevel(upgradeName);
|
2022-10-12 14:49:27 +02:00
|
|
|
},
|
|
|
|
getUpgradeLevelCost: (ctx) => (_upgradeName) => {
|
|
|
|
checkAccess(ctx);
|
2023-06-12 06:34:20 +02:00
|
|
|
const upgradeName = getEnumHelper("CorpUpgradeName").nsGetMember(ctx, _upgradeName, "upgradeName");
|
2023-05-16 00:06:57 +02:00
|
|
|
return getUpgradeLevelCost(upgradeName);
|
2022-10-12 14:49:27 +02:00
|
|
|
},
|
|
|
|
getInvestmentOffer: (ctx) => () => {
|
2022-05-08 01:08:07 +02:00
|
|
|
checkAccess(ctx);
|
2023-09-20 06:36:48 +02:00
|
|
|
const corporation = getCorporation();
|
|
|
|
return corporation.getInvestmentOffer();
|
2022-01-13 12:42:23 +01:00
|
|
|
},
|
2022-10-12 14:49:27 +02:00
|
|
|
acceptInvestmentOffer: (ctx) => () => {
|
2022-05-08 01:08:07 +02:00
|
|
|
checkAccess(ctx);
|
2023-09-20 06:36:48 +02:00
|
|
|
const corporation = getCorporation();
|
|
|
|
try {
|
|
|
|
AcceptInvestmentOffer(corporation);
|
|
|
|
return true;
|
|
|
|
} catch (err) {
|
|
|
|
return false;
|
|
|
|
}
|
2022-01-13 12:42:23 +01:00
|
|
|
},
|
2022-10-12 14:49:27 +02:00
|
|
|
goPublic: (ctx) => (_numShares) => {
|
|
|
|
checkAccess(ctx);
|
2022-11-29 14:24:04 +01:00
|
|
|
const corporation = getCorporation();
|
2024-02-26 14:05:10 +01:00
|
|
|
if (corporation.public) throw helpers.errorMessage(ctx, "corporation is already public");
|
2022-10-12 14:49:27 +02:00
|
|
|
const numShares = helpers.number(ctx, "numShares", _numShares);
|
2023-09-20 06:36:48 +02:00
|
|
|
GoPublic(corporation, numShares);
|
|
|
|
return true;
|
2022-10-12 14:49:27 +02:00
|
|
|
},
|
|
|
|
sellShares: (ctx) => (_numShares) => {
|
|
|
|
checkAccess(ctx);
|
|
|
|
const numShares = helpers.number(ctx, "numShares", _numShares);
|
|
|
|
return SellShares(getCorporation(), numShares);
|
|
|
|
},
|
|
|
|
buyBackShares: (ctx) => (_numShares) => {
|
|
|
|
checkAccess(ctx);
|
|
|
|
const numShares = helpers.number(ctx, "numShares", _numShares);
|
|
|
|
return BuyBackShares(getCorporation(), numShares);
|
|
|
|
},
|
|
|
|
bribe: (ctx) => (_factionName, _amountCash) => {
|
|
|
|
checkAccess(ctx);
|
2023-06-26 04:53:35 +02:00
|
|
|
const factionName = getEnumHelper("FactionName").nsGetMember(ctx, _factionName);
|
2022-10-12 14:49:27 +02:00
|
|
|
const amountCash = helpers.number(ctx, "amountCash", _amountCash);
|
|
|
|
return bribe(factionName, amountCash);
|
|
|
|
},
|
|
|
|
getBonusTime: (ctx) => () => {
|
2022-05-08 01:08:07 +02:00
|
|
|
checkAccess(ctx);
|
2022-03-19 21:22:29 +01:00
|
|
|
return Math.round(getCorporation().storedCycles / 5) * 1000;
|
2022-03-30 02:24:04 +02:00
|
|
|
},
|
2023-10-23 10:24:30 +02:00
|
|
|
nextUpdate: (ctx) => () => {
|
|
|
|
checkAccess(ctx);
|
2024-02-10 12:27:47 +01:00
|
|
|
if (!CorporationPromise.promise)
|
|
|
|
CorporationPromise.promise = new Promise<CorpStateName>((res) => (CorporationPromise.resolve = res));
|
|
|
|
return CorporationPromise.promise;
|
2023-10-23 10:24:30 +02:00
|
|
|
},
|
2021-10-14 09:22:02 +02:00
|
|
|
};
|
2023-01-02 19:18:02 +01:00
|
|
|
|
2023-08-07 08:38:38 +02:00
|
|
|
// Removed functions
|
|
|
|
setRemovedFunctions(corpFunctions, {
|
|
|
|
assignJob: {
|
|
|
|
version: "2.2.0",
|
|
|
|
replacement: "Removed due to employees no longer being objects. Use ns.corporation.setAutoJobAssignment instead.",
|
|
|
|
replaceMsg: true,
|
|
|
|
},
|
|
|
|
getEmployee: {
|
|
|
|
version: "2.2.0",
|
|
|
|
replacement: "Removed due to employees no longer being individual objects.",
|
|
|
|
replaceMsg: true,
|
|
|
|
},
|
|
|
|
getExpandCityCost: { version: "2.2.0", replacement: "corporation.getConstants().officeInitialCost" },
|
|
|
|
getExpandIndustryCost: { version: "2.2.0", replacement: "corporation.getIndustryData" },
|
|
|
|
getIndustryTypes: { version: "2.2.0", replacement: "corporation.getConstants().industryNames" },
|
|
|
|
getMaterialNames: { version: "2.2.0", replacement: "corporation.getConstants().materialNames" },
|
|
|
|
getPurchaseWarehouseCost: { version: "2.2.0", replacement: "corporation.getConstants().warehouseInitialCost" },
|
|
|
|
getResearchNames: { version: "2.2.0", replacement: "corporation.getConstants().researchNames" },
|
|
|
|
getUnlockables: { version: "2.2.0", replacement: "corporation.getConstants().unlockNames" },
|
|
|
|
getUpgradeNames: { version: "2.2.0", replacement: "corporation.getConstants().upgradeNames" },
|
2022-12-30 02:28:53 +01:00
|
|
|
});
|
|
|
|
return corpFunctions;
|
2021-10-14 09:22:02 +02:00
|
|
|
}
|