From b7ad3395ae2a51bf31be81fc320bc0274915ee9f Mon Sep 17 00:00:00 2001 From: Zelow79 <32428876+Zelow79@users.noreply.github.com> Date: Wed, 16 Aug 2023 17:31:41 -0400 Subject: [PATCH] API: Added CompanyName to NetscriptDefinitions (#731) --- markdown/bitburner.companyname.md | 57 ++++++++++++++ markdown/bitburner.md | 1 + markdown/bitburner.nsenums.md | 3 +- markdown/bitburner.player.jobs.md | 2 +- markdown/bitburner.player.md | 2 +- .../bitburner.singularity.applytocompany.md | 4 +- .../bitburner.singularity.getcompanyfavor.md | 4 +- ...tburner.singularity.getcompanyfavorgain.md | 4 +- ...rner.singularity.getcompanypositioninfo.md | 9 ++- ...tburner.singularity.getcompanypositions.md | 4 +- .../bitburner.singularity.getcompanyrep.md | 4 +- markdown/bitburner.singularity.quitjob.md | 4 +- .../bitburner.singularity.workforcompany.md | 4 +- markdown/bitburner.sleeve.settocompanywork.md | 4 +- markdown/bitburner.sleevecompanytask.md | 4 +- .../bitburner.workformulas.companygains.md | 9 ++- src/NetscriptFunctions.ts | 2 + src/ScriptEditor/NetscriptDefinitions.d.ts | 76 ++++++++++++++++--- 18 files changed, 160 insertions(+), 37 deletions(-) create mode 100644 markdown/bitburner.companyname.md diff --git a/markdown/bitburner.companyname.md b/markdown/bitburner.companyname.md new file mode 100644 index 000000000..52b4ca061 --- /dev/null +++ b/markdown/bitburner.companyname.md @@ -0,0 +1,57 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [CompanyName](./bitburner.companyname.md) + +## CompanyName enum + +Names of all companies + +**Signature:** + +```typescript +declare enum CompanyName +``` + +## Enumeration Members + +| Member | Value | Description | +| --- | --- | --- | +| AeroCorp | "AeroCorp" | | +| AlphaEnterprises | "Alpha Enterprises" | | +| BachmanAndAssociates | "Bachman & Associates" | | +| BladeIndustries | "Blade Industries" | | +| CarmichaelSecurity | "Carmichael Security" | | +| CIA | "Central Intelligence Agency" | | +| ClarkeIncorporated | "Clarke Incorporated" | | +| CompuTek | "CompuTek" | | +| DefComm | "DefComm" | | +| DeltaOne | "DeltaOne" | | +| ECorp | "ECorp" | | +| FoodNStuff | "FoodNStuff" | | +| FourSigma | "Four Sigma" | | +| FulcrumTechnologies | "Fulcrum Technologies" | | +| GalacticCybersystems | "Galactic Cybersystems" | | +| GlobalPharmaceuticals | "Global Pharmaceuticals" | | +| HeliosLabs | "Helios Labs" | | +| IcarusMicrosystems | "Icarus Microsystems" | | +| JoesGuns | "Joe's Guns" | | +| KuaiGongInternational | "KuaiGong International" | | +| LexoCorp | "LexoCorp" | | +| MegaCorp | "MegaCorp" | | +| NetLinkTechnologies | "NetLink Technologies" | | +| NoodleBar | "Noodle Bar" | | +| NovaMedical | "Nova Medical" | | +| NSA | "National Security Agency" | | +| NWO | "NWO" | | +| OmegaSoftware | "Omega Software" | | +| OmniaCybersystems | "Omnia Cybersystems" | | +| OmniTekIncorporated | "OmniTek Incorporated" | | +| Police | "Aevum Police Headquarters" | | +| RhoConstruction | "Rho Construction" | | +| SolarisSpaceSystems | "Solaris Space Systems" | | +| StormTechnologies | "Storm Technologies" | | +| SysCoreSecurities | "SysCore Securities" | | +| UniversalEnergy | "Universal Energy" | | +| VitaLife | "VitaLife" | | +| WatchdogSecurity | "Watchdog Security" | | + diff --git a/markdown/bitburner.md b/markdown/bitburner.md index 7f39c39df..c761e983d 100644 --- a/markdown/bitburner.md +++ b/markdown/bitburner.md @@ -9,6 +9,7 @@ | Enumeration | Description | | --- | --- | | [CityName](./bitburner.cityname.md) | Names of all cities | +| [CompanyName](./bitburner.companyname.md) | Names of all companies | | [CrimeType](./bitburner.crimetype.md) | | | [FactionWorkType](./bitburner.factionworktype.md) | | | [GymType](./bitburner.gymtype.md) | | diff --git a/markdown/bitburner.nsenums.md b/markdown/bitburner.nsenums.md index a7dfb431b..f1b1fe8fc 100644 --- a/markdown/bitburner.nsenums.md +++ b/markdown/bitburner.nsenums.md @@ -17,7 +17,8 @@ export type NSEnums = { LocationName: typeof LocationName; ToastVariant: typeof ToastVariant; UniversityClassType: typeof UniversityClassType; + CompanyName: typeof CompanyName; }; ``` -**References:** [CityName](./bitburner.cityname.md), [CrimeType](./bitburner.crimetype.md), [FactionWorkType](./bitburner.factionworktype.md), [GymType](./bitburner.gymtype.md), [JobName](./bitburner.jobname.md), [LocationName](./bitburner.locationname.md), [ToastVariant](./bitburner.toastvariant.md), [UniversityClassType](./bitburner.universityclasstype.md) +**References:** [CityName](./bitburner.cityname.md), [CrimeType](./bitburner.crimetype.md), [FactionWorkType](./bitburner.factionworktype.md), [GymType](./bitburner.gymtype.md), [JobName](./bitburner.jobname.md), [LocationName](./bitburner.locationname.md), [ToastVariant](./bitburner.toastvariant.md), [UniversityClassType](./bitburner.universityclasstype.md), [CompanyName](./bitburner.companyname.md) diff --git a/markdown/bitburner.player.jobs.md b/markdown/bitburner.player.jobs.md index 7d5ac16a2..459f8c7bc 100644 --- a/markdown/bitburner.player.jobs.md +++ b/markdown/bitburner.player.jobs.md @@ -7,5 +7,5 @@ **Signature:** ```typescript -jobs: Record; +jobs: Partial>; ``` diff --git a/markdown/bitburner.player.md b/markdown/bitburner.player.md index f0b28f00a..6ff90a879 100644 --- a/markdown/bitburner.player.md +++ b/markdown/bitburner.player.md @@ -18,7 +18,7 @@ interface Player extends Person | --- | --- | --- | --- | | [entropy](./bitburner.player.entropy.md) | | number | | | [factions](./bitburner.player.factions.md) | | string\[\] | | -| [jobs](./bitburner.player.jobs.md) | | Record<string, string> | | +| [jobs](./bitburner.player.jobs.md) | | Partial<Record<[CompanyName](./bitburner.companyname.md), [JobName](./bitburner.jobname.md)>> | | | [location](./bitburner.player.location.md) | | string | | | [money](./bitburner.player.money.md) | | number | | | [numPeopleKilled](./bitburner.player.numpeoplekilled.md) | | number | | diff --git a/markdown/bitburner.singularity.applytocompany.md b/markdown/bitburner.singularity.applytocompany.md index 0c897375a..ca6966c66 100644 --- a/markdown/bitburner.singularity.applytocompany.md +++ b/markdown/bitburner.singularity.applytocompany.md @@ -9,14 +9,14 @@ Apply for a job at a company. **Signature:** ```typescript -applyToCompany(companyName: string, field: string): boolean; +applyToCompany(companyName: CompanyName | `${CompanyName}`, field: string): boolean; ``` ## Parameters | Parameter | Type | Description | | --- | --- | --- | -| companyName | string | Name of company to apply to. | +| companyName | [CompanyName](./bitburner.companyname.md) \| \`${[CompanyName](./bitburner.companyname.md)}\` | Name of company to apply to. | | field | string | Field to which you want to apply. | **Returns:** diff --git a/markdown/bitburner.singularity.getcompanyfavor.md b/markdown/bitburner.singularity.getcompanyfavor.md index 1ebeece5b..4400e9458 100644 --- a/markdown/bitburner.singularity.getcompanyfavor.md +++ b/markdown/bitburner.singularity.getcompanyfavor.md @@ -9,14 +9,14 @@ Get company favor. **Signature:** ```typescript -getCompanyFavor(companyName: string): number; +getCompanyFavor(companyName: CompanyName | `${CompanyName}`): number; ``` ## Parameters | Parameter | Type | Description | | --- | --- | --- | -| companyName | string | Name of the company. | +| companyName | [CompanyName](./bitburner.companyname.md) \| \`${[CompanyName](./bitburner.companyname.md)}\` | Name of the company. | **Returns:** diff --git a/markdown/bitburner.singularity.getcompanyfavorgain.md b/markdown/bitburner.singularity.getcompanyfavorgain.md index 4beaa7b18..4170b860e 100644 --- a/markdown/bitburner.singularity.getcompanyfavorgain.md +++ b/markdown/bitburner.singularity.getcompanyfavorgain.md @@ -9,14 +9,14 @@ Get company favor gain. **Signature:** ```typescript -getCompanyFavorGain(companyName: string): number; +getCompanyFavorGain(companyName: CompanyName | `${CompanyName}`): number; ``` ## Parameters | Parameter | Type | Description | | --- | --- | --- | -| companyName | string | Name of the company. | +| companyName | [CompanyName](./bitburner.companyname.md) \| \`${[CompanyName](./bitburner.companyname.md)}\` | Name of the company. | **Returns:** diff --git a/markdown/bitburner.singularity.getcompanypositioninfo.md b/markdown/bitburner.singularity.getcompanypositioninfo.md index bf749b512..d8f97ba90 100644 --- a/markdown/bitburner.singularity.getcompanypositioninfo.md +++ b/markdown/bitburner.singularity.getcompanypositioninfo.md @@ -9,15 +9,18 @@ Get Requirements for Company Position. **Signature:** ```typescript -getCompanyPositionInfo(companyName: string, positionName: JobName): CompanyPositionInfo; +getCompanyPositionInfo( + companyName: CompanyName | `${CompanyName}`, + positionName: JobName | `${JobName}`, + ): CompanyPositionInfo; ``` ## Parameters | Parameter | Type | Description | | --- | --- | --- | -| companyName | string | Name of company to get the requirements for. Must be an exact match. | -| positionName | [JobName](./bitburner.jobname.md) | Name of position to get the requirements for. Must be an exact match. | +| companyName | [CompanyName](./bitburner.companyname.md) \| \`${[CompanyName](./bitburner.companyname.md)}\` | Name of company to get the requirements for. Must be an exact match. | +| positionName | [JobName](./bitburner.jobname.md) \| \`${[JobName](./bitburner.jobname.md)}\` | Name of position to get the requirements for. Must be an exact match. | **Returns:** diff --git a/markdown/bitburner.singularity.getcompanypositions.md b/markdown/bitburner.singularity.getcompanypositions.md index fd9bb3237..c1eff7fa5 100644 --- a/markdown/bitburner.singularity.getcompanypositions.md +++ b/markdown/bitburner.singularity.getcompanypositions.md @@ -9,14 +9,14 @@ Get List of Company Positions. **Signature:** ```typescript -getCompanyPositions(companyName: string): JobName[]; +getCompanyPositions(companyName: CompanyName | `${CompanyName}`): JobName[]; ``` ## Parameters | Parameter | Type | Description | | --- | --- | --- | -| companyName | string | Name of company to get the position list for. Must be an exact match. | +| companyName | [CompanyName](./bitburner.companyname.md) \| \`${[CompanyName](./bitburner.companyname.md)}\` | Name of company to get the position list for. Must be an exact match. | **Returns:** diff --git a/markdown/bitburner.singularity.getcompanyrep.md b/markdown/bitburner.singularity.getcompanyrep.md index 93957814e..258ca3476 100644 --- a/markdown/bitburner.singularity.getcompanyrep.md +++ b/markdown/bitburner.singularity.getcompanyrep.md @@ -9,14 +9,14 @@ Get company reputation. **Signature:** ```typescript -getCompanyRep(companyName: string): number; +getCompanyRep(companyName: CompanyName | `${CompanyName}`): number; ``` ## Parameters | Parameter | Type | Description | | --- | --- | --- | -| companyName | string | Name of the company. | +| companyName | [CompanyName](./bitburner.companyname.md) \| \`${[CompanyName](./bitburner.companyname.md)}\` | Name of the company. | **Returns:** diff --git a/markdown/bitburner.singularity.quitjob.md b/markdown/bitburner.singularity.quitjob.md index ef11e8b18..db29575fa 100644 --- a/markdown/bitburner.singularity.quitjob.md +++ b/markdown/bitburner.singularity.quitjob.md @@ -9,14 +9,14 @@ Quit jobs by company. **Signature:** ```typescript -quitJob(companyName?: string): void; +quitJob(companyName?: CompanyName | `${CompanyName}`): void; ``` ## Parameters | Parameter | Type | Description | | --- | --- | --- | -| companyName | string | _(Optional)_ Name of the company. | +| companyName | [CompanyName](./bitburner.companyname.md) \| \`${[CompanyName](./bitburner.companyname.md)}\` | _(Optional)_ Name of the company. | **Returns:** diff --git a/markdown/bitburner.singularity.workforcompany.md b/markdown/bitburner.singularity.workforcompany.md index c5bfeaf66..9164dee98 100644 --- a/markdown/bitburner.singularity.workforcompany.md +++ b/markdown/bitburner.singularity.workforcompany.md @@ -9,14 +9,14 @@ Work for a company. **Signature:** ```typescript -workForCompany(companyName: string, focus?: boolean): boolean; +workForCompany(companyName: CompanyName, focus?: boolean): boolean; ``` ## Parameters | Parameter | Type | Description | | --- | --- | --- | -| companyName | string | Name of company to work for. Must be an exact match. Optional. If not specified, this argument defaults to the last job that you worked. | +| companyName | [CompanyName](./bitburner.companyname.md) | Name of company to work for. Must be an exact match. Optional. If not specified, this argument defaults to the last job that you worked. | | focus | boolean | _(Optional)_ Acquire player focus on this work operation. Optional. Defaults to true. | **Returns:** diff --git a/markdown/bitburner.sleeve.settocompanywork.md b/markdown/bitburner.sleeve.settocompanywork.md index 1a122ba6b..aecd38c31 100644 --- a/markdown/bitburner.sleeve.settocompanywork.md +++ b/markdown/bitburner.sleeve.settocompanywork.md @@ -9,7 +9,7 @@ Set a sleeve to work for a company. **Signature:** ```typescript -setToCompanyWork(sleeveNumber: number, companyName: string): boolean; +setToCompanyWork(sleeveNumber: number, companyName: CompanyName | `${CompanyName}`): boolean; ``` ## Parameters @@ -17,7 +17,7 @@ setToCompanyWork(sleeveNumber: number, companyName: string): boolean; | Parameter | Type | Description | | --- | --- | --- | | sleeveNumber | number | Index of the sleeve to work for the company. | -| companyName | string | Name of the company to work for. | +| companyName | [CompanyName](./bitburner.companyname.md) \| \`${[CompanyName](./bitburner.companyname.md)}\` | Name of the company to work for. | **Returns:** diff --git a/markdown/bitburner.sleevecompanytask.md b/markdown/bitburner.sleevecompanytask.md index 58b869626..f41d448ba 100644 --- a/markdown/bitburner.sleevecompanytask.md +++ b/markdown/bitburner.sleevecompanytask.md @@ -8,5 +8,7 @@ **Signature:** ```typescript -type SleeveCompanyTask = { type: "COMPANY"; companyName: string }; +type SleeveCompanyTask = { type: "COMPANY"; companyName: CompanyName }; ``` +**References:** [CompanyName](./bitburner.companyname.md) + diff --git a/markdown/bitburner.workformulas.companygains.md b/markdown/bitburner.workformulas.companygains.md index c05dd06d7..bea25095a 100644 --- a/markdown/bitburner.workformulas.companygains.md +++ b/markdown/bitburner.workformulas.companygains.md @@ -7,7 +7,12 @@ **Signature:** ```typescript -companyGains(person: Person, companyName: string, workType: JobName | `${JobName}`, favor: number): WorkStats; +companyGains( + person: Person, + companyName: CompanyName | `${CompanyName}`, + workType: JobName | `${JobName}`, + favor: number, + ): WorkStats; ``` ## Parameters @@ -15,7 +20,7 @@ companyGains(person: Person, companyName: string, workType: JobName | `${JobName | Parameter | Type | Description | | --- | --- | --- | | person | [Person](./bitburner.person.md) | | -| companyName | string | | +| companyName | [CompanyName](./bitburner.companyname.md) \| \`${[CompanyName](./bitburner.companyname.md)}\` | | | workType | [JobName](./bitburner.jobname.md) \| \`${[JobName](./bitburner.jobname.md)}\` | | | favor | number | | diff --git a/src/NetscriptFunctions.ts b/src/NetscriptFunctions.ts index 276e4e7c3..e84d88a8b 100644 --- a/src/NetscriptFunctions.ts +++ b/src/NetscriptFunctions.ts @@ -24,6 +24,7 @@ import { LocationName, ToastVariant, UniversityClassType, + CompanyName, } from "@enums"; import { PromptEvent } from "./ui/React/PromptManager"; import { GetServer, DeleteServer, AddToAllServers, createUniqueRandomIp } from "./Server/AllServers"; @@ -111,6 +112,7 @@ export const enums: NSEnums = { LocationName, ToastVariant, UniversityClassType, + CompanyName, }; for (const val of Object.values(enums)) Object.freeze(val); Object.freeze(enums); diff --git a/src/ScriptEditor/NetscriptDefinitions.d.ts b/src/ScriptEditor/NetscriptDefinitions.d.ts index 7d3abb2c9..0989d17bf 100644 --- a/src/ScriptEditor/NetscriptDefinitions.d.ts +++ b/src/ScriptEditor/NetscriptDefinitions.d.ts @@ -47,7 +47,7 @@ interface Player extends Person { money: number; numPeopleKilled: number; entropy: number; - jobs: Record; + jobs: Partial>; factions: string[]; totalPlaytime: number; location: string; @@ -980,7 +980,7 @@ type SleeveClassTask = { }; /** @public */ -type SleeveCompanyTask = { type: "COMPANY"; companyName: string }; +type SleeveCompanyTask = { type: "COMPANY"; companyName: CompanyName }; /** @public */ type SleeveCrimeTask = { @@ -1759,7 +1759,10 @@ export interface Singularity { * @param positionName - Name of position to get the requirements for. Must be an exact match. * @returns CompanyPositionInfo object. */ - getCompanyPositionInfo(companyName: string, positionName: JobName): CompanyPositionInfo; + getCompanyPositionInfo( + companyName: CompanyName | `${CompanyName}`, + positionName: JobName | `${JobName}`, + ): CompanyPositionInfo; /** * Get List of Company Positions. @@ -1779,7 +1782,7 @@ export interface Singularity { * @param companyName - Name of company to get the position list for. Must be an exact match. * @returns The position list if the company name is valid. */ - getCompanyPositions(companyName: string): JobName[]; + getCompanyPositions(companyName: CompanyName | `${CompanyName}`): JobName[]; /** * Work for a company. @@ -1804,7 +1807,7 @@ export interface Singularity { * @param focus - Acquire player focus on this work operation. Optional. Defaults to true. * @returns True if the player starts working, and false otherwise. */ - workForCompany(companyName: string, focus?: boolean): boolean; + workForCompany(companyName: CompanyName, focus?: boolean): boolean; /** * Quit jobs by company. @@ -1816,7 +1819,7 @@ export interface Singularity { * * @param companyName - Name of the company. */ - quitJob(companyName?: string): void; + quitJob(companyName?: CompanyName | `${CompanyName}`): void; /** * Apply for a job at a company. @@ -1837,7 +1840,7 @@ export interface Singularity { * @param field - Field to which you want to apply. * @returns True if the player successfully get a job/promotion, and false otherwise. */ - applyToCompany(companyName: string, field: string): boolean; + applyToCompany(companyName: CompanyName | `${CompanyName}`, field: string): boolean; /** * Get company reputation. @@ -1851,7 +1854,7 @@ export interface Singularity { * @param companyName - Name of the company. * @returns Amount of reputation you have at the specified company. */ - getCompanyRep(companyName: string): number; + getCompanyRep(companyName: CompanyName | `${CompanyName}`): number; /** * Get company favor. @@ -1865,7 +1868,7 @@ export interface Singularity { * @param companyName - Name of the company. * @returns Amount of favor you have at the specified company. */ - getCompanyFavor(companyName: string): number; + getCompanyFavor(companyName: CompanyName | `${CompanyName}`): number; /** * Get company favor gain. @@ -1879,7 +1882,7 @@ export interface Singularity { * @param companyName - Name of the company. * @returns Amount of favor you gain at the specified company when you reset by installing Augmentations. */ - getCompanyFavorGain(companyName: string): number; + getCompanyFavorGain(companyName: CompanyName | `${CompanyName}`): number; /** * List all current faction invitations. @@ -3749,7 +3752,7 @@ export interface Sleeve { * @param companyName - Name of the company to work for. * @returns True if the sleeve started working for this company, false otherwise. */ - setToCompanyWork(sleeveNumber: number, companyName: string): boolean; + setToCompanyWork(sleeveNumber: number, companyName: CompanyName | `${CompanyName}`): boolean; /** * Set a sleeve to take a class at a university. @@ -3974,7 +3977,12 @@ interface WorkFormulas { /** @returns The WorkStats applied every game cycle (200ms) by performing the specified faction work. */ factionGains(person: Person, workType: FactionWorkType | `${FactionWorkType}`, favor: number): WorkStats; /** @returns The WorkStats applied every game cycle (200ms) by performing the specified company work. */ - companyGains(person: Person, companyName: string, workType: JobName | `${JobName}`, favor: number): WorkStats; + companyGains( + person: Person, + companyName: CompanyName | `${CompanyName}`, + workType: JobName | `${JobName}`, + favor: number, + ): WorkStats; } /** @@ -6895,6 +6903,49 @@ declare enum LocationName { Void = "The Void", } +/** Names of all companies + * @public */ +declare enum CompanyName { + ECorp = "ECorp", + MegaCorp = "MegaCorp", + BachmanAndAssociates = "Bachman & Associates", + BladeIndustries = "Blade Industries", + NWO = "NWO", + ClarkeIncorporated = "Clarke Incorporated", + OmniTekIncorporated = "OmniTek Incorporated", + FourSigma = "Four Sigma", + KuaiGongInternational = "KuaiGong International", + FulcrumTechnologies = "Fulcrum Technologies", + StormTechnologies = "Storm Technologies", + DefComm = "DefComm", + HeliosLabs = "Helios Labs", + VitaLife = "VitaLife", + IcarusMicrosystems = "Icarus Microsystems", + UniversalEnergy = "Universal Energy", + GalacticCybersystems = "Galactic Cybersystems", + AeroCorp = "AeroCorp", + OmniaCybersystems = "Omnia Cybersystems", + SolarisSpaceSystems = "Solaris Space Systems", + DeltaOne = "DeltaOne", + GlobalPharmaceuticals = "Global Pharmaceuticals", + NovaMedical = "Nova Medical", + CIA = "Central Intelligence Agency", + NSA = "National Security Agency", + WatchdogSecurity = "Watchdog Security", + LexoCorp = "LexoCorp", + RhoConstruction = "Rho Construction", + AlphaEnterprises = "Alpha Enterprises", + Police = "Aevum Police Headquarters", + SysCoreSecurities = "SysCore Securities", + CompuTek = "CompuTek", + NetLinkTechnologies = "NetLink Technologies", + CarmichaelSecurity = "Carmichael Security", + FoodNStuff = "FoodNStuff", + JoesGuns = "Joe's Guns", + OmegaSoftware = "Omega Software", + NoodleBar = "Noodle Bar", +} + /** @public */ export type NSEnums = { CityName: typeof CityName; @@ -6905,6 +6956,7 @@ export type NSEnums = { LocationName: typeof LocationName; ToastVariant: typeof ToastVariant; UniversityClassType: typeof UniversityClassType; + CompanyName: typeof CompanyName; }; /**