NETSCRIPT: Added ns.corporation.getConstants, replacing many other corporation getter functions (#260)

This commit is contained in:
Mughur
2022-12-25 10:33:13 +02:00
committed by GitHub
parent 018053d79e
commit 556fe8dd33
17 changed files with 287 additions and 180 deletions

View File

@@ -7039,6 +7039,17 @@ declare enum IndustryType {
RealEstate = "RealEstate",
}
/** Names of all cities
* @public */
declare enum CityName {
Aevum = "Aevum",
Chongqing = "Chongqing",
Sector12 = "Sector-12",
NewTokyo = "New Tokyo",
Ishima = "Ishima",
Volhaven = "Volhaven",
}
/** Names of all locations
* @public */
declare enum LocationName {
@@ -7422,11 +7433,6 @@ export interface WarehouseAPI {
* @param qty - Amount to limit to. Pass a negative value to remove the limit instead.
*/
limitProductProduction(divisionName: string, cityName: string, productName: string, qty: number): void;
/**
* Gets the cost to purchase a warehouse
* @returns cost
*/
getPurchaseWarehouseCost(): number;
/**
* Gets the cost to upgrade a warehouse to the next level
* @param divisionName - Name of the division
@@ -7483,34 +7489,13 @@ export interface Corporation extends WarehouseAPI, OfficeAPI {
* @returns cost of the upgrade */
getUpgradeLevelCost(upgradeName: string): number;
/** Gets the cost to expand into a new industry
* @param industryName - Name of the industry
* @returns cost */
getExpandIndustryCost(industryName: IndustryType | `${IndustryType}`): number;
/** Gets the cost to expand into a new city
* @returns cost */
getExpandCityCost(): number;
/** Get an offer for investment based on you companies current valuation
* @returns An offer of investment */
getInvestmentOffer(): InvestmentOffer;
/** Get list of materials
* @returns material names */
getMaterialNames(): string[];
/** Get list of one-time unlockable upgrades
* @returns unlockable upgrades names */
getUnlockables(): string[];
/** Get list of upgrade names
* @returns upgrade names */
getUpgradeNames(): string[];
/** Get list of research names
* @returns research names */
getResearchNames(): string[];
/** Get corporation related constants
* @returns corporation related constants */
getConstants(): CorpConstants;
/** Accept investment based on you companies current valuation
* @remarks
@@ -7612,6 +7597,86 @@ interface CorporationInfo {
divisions: Division[];
}
/**
* Corporation related constants
* @public
*/
interface CorpConstants {
/** Corporation cycle states */
states: string[];
/** Unlockable upgrades */
unlocks: string[];
/** Levelable upgrades */
upgrades: string[];
/** Researches, product researches are only available to product making divisions */
researches: Record<string, string[]>;
/** Amount of funds required to bribe for 1 reputation */
bribeToRepRatio: number;
/** Amount of products a division can have without researches */
baseMaxProducts: number;
/** Cost to expand to another city within a division */
cityExpandCost: number;
/** Cost to purchase a warehouse in a city */
warehousePurchaseCost: number;
/** Cost of coffee per employee in an office */
coffeeCost: number;
/** Array of all material types */
materials: Record<string, materialInfo>;
/** Array of all product types */
products: Record<string, productInfo>;
/** Array of all division types */
divisions: Record<string, divisionInfo>;
}
/**
* Corporation material information
* @public
*/
interface materialInfo {
/** Name of the material */
name: string;
/** Size of the material */
size: number;
/** Revenue per second this cycle */
prodMult: boolean;
}
/**
* Corporation product information
* @public
*/
interface productInfo {
/** Product type */
type?: string;
/** Size of the product */
size: number;
/** Materials required to make the product */
requiredMaterials: string[];
/** Division type which makes the product */
division: string;
}
/**
* Corporation division information
* @public
*/
interface divisionInfo {
/** Division type */
type: string;
/** Cost to expand to the division */
cost: number;
/** Materials required for production and their amounts */
requiredMaterials: Record<string, number>;
/** Materials produced */
producedMaterials?: string[];
/** Whether the division makes materials */
makesMaterials: boolean;
/** Whether the division makes products */
makesProducts: boolean;
/** Product type */
productType?: string;
}
/**
* Product in a warehouse
* @public