mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-08 08:43:53 +01:00
API: Change singularity.applyToCompany() to use an enum for job field (#859)
This commit is contained in:
parent
686d2e2b9b
commit
1a052a7daf
11
markdown/bitburner.companypositioninfo.field.md
Normal file
11
markdown/bitburner.companypositioninfo.field.md
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||||
|
|
||||||
|
[Home](./index.md) > [bitburner](./bitburner.md) > [CompanyPositionInfo](./bitburner.companypositioninfo.md) > [field](./bitburner.companypositioninfo.field.md)
|
||||||
|
|
||||||
|
## CompanyPositionInfo.field property
|
||||||
|
|
||||||
|
**Signature:**
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
field: JobField;
|
||||||
|
```
|
@ -16,6 +16,7 @@ export interface CompanyPositionInfo
|
|||||||
|
|
||||||
| Property | Modifiers | Type | Description |
|
| Property | Modifiers | Type | Description |
|
||||||
| --- | --- | --- | --- |
|
| --- | --- | --- | --- |
|
||||||
|
| [field](./bitburner.companypositioninfo.field.md) | | [JobField](./bitburner.jobfield.md) | |
|
||||||
| [name](./bitburner.companypositioninfo.name.md) | | [JobName](./bitburner.jobname.md) | |
|
| [name](./bitburner.companypositioninfo.name.md) | | [JobName](./bitburner.jobname.md) | |
|
||||||
| [nextPosition](./bitburner.companypositioninfo.nextposition.md) | | [JobName](./bitburner.jobname.md) \| null | |
|
| [nextPosition](./bitburner.companypositioninfo.nextposition.md) | | [JobName](./bitburner.jobname.md) \| null | |
|
||||||
| [requiredReputation](./bitburner.companypositioninfo.requiredreputation.md) | | number | |
|
| [requiredReputation](./bitburner.companypositioninfo.requiredreputation.md) | | number | |
|
||||||
|
31
markdown/bitburner.jobfield.md
Normal file
31
markdown/bitburner.jobfield.md
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||||
|
|
||||||
|
[Home](./index.md) > [bitburner](./bitburner.md) > [JobField](./bitburner.jobfield.md)
|
||||||
|
|
||||||
|
## JobField enum
|
||||||
|
|
||||||
|
|
||||||
|
**Signature:**
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
declare enum JobField
|
||||||
|
```
|
||||||
|
|
||||||
|
## Enumeration Members
|
||||||
|
|
||||||
|
| Member | Value | Description |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| agent | <code>"Agent"</code> | |
|
||||||
|
| business | <code>"Business"</code> | |
|
||||||
|
| businessConsultant | <code>"Business Consultant"</code> | |
|
||||||
|
| employee | <code>"Employee"</code> | |
|
||||||
|
| it | <code>"IT"</code> | |
|
||||||
|
| networkEngineer | <code>"Network Engineer"</code> | |
|
||||||
|
| partTimeEmployee | <code>"part-time Employee"</code> | |
|
||||||
|
| partTimeWaiter | <code>"part-time Waiter"</code> | |
|
||||||
|
| security | <code>"Security"</code> | |
|
||||||
|
| securityEngineer | <code>"Security Engineer"</code> | |
|
||||||
|
| software | <code>"Software"</code> | |
|
||||||
|
| softwareConsultant | <code>"Software Consultant"</code> | |
|
||||||
|
| waiter | <code>"Waiter"</code> | |
|
||||||
|
|
@ -13,6 +13,7 @@
|
|||||||
| [CrimeType](./bitburner.crimetype.md) | |
|
| [CrimeType](./bitburner.crimetype.md) | |
|
||||||
| [FactionWorkType](./bitburner.factionworktype.md) | |
|
| [FactionWorkType](./bitburner.factionworktype.md) | |
|
||||||
| [GymType](./bitburner.gymtype.md) | |
|
| [GymType](./bitburner.gymtype.md) | |
|
||||||
|
| [JobField](./bitburner.jobfield.md) | |
|
||||||
| [JobName](./bitburner.jobname.md) | |
|
| [JobName](./bitburner.jobname.md) | |
|
||||||
| [LocationName](./bitburner.locationname.md) | Names of all locations |
|
| [LocationName](./bitburner.locationname.md) | Names of all locations |
|
||||||
| [OrderType](./bitburner.ordertype.md) | |
|
| [OrderType](./bitburner.ordertype.md) | |
|
||||||
|
@ -14,11 +14,12 @@ export type NSEnums = {
|
|||||||
FactionWorkType: typeof FactionWorkType;
|
FactionWorkType: typeof FactionWorkType;
|
||||||
GymType: typeof GymType;
|
GymType: typeof GymType;
|
||||||
JobName: typeof JobName;
|
JobName: typeof JobName;
|
||||||
|
JobField: typeof JobField;
|
||||||
LocationName: typeof LocationName;
|
LocationName: typeof LocationName;
|
||||||
ToastVariant: typeof ToastVariant;
|
ToastVariant: typeof ToastVariant;
|
||||||
UniversityClassType: typeof UniversityClassType;
|
UniversityClassType: typeof UniversityClassType;
|
||||||
CompanyName: typeof CompanyName;
|
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)<!-- -->, [CompanyName](./bitburner.companyname.md)
|
**References:** [CityName](./bitburner.cityname.md)<!-- -->, [CrimeType](./bitburner.crimetype.md)<!-- -->, [FactionWorkType](./bitburner.factionworktype.md)<!-- -->, [GymType](./bitburner.gymtype.md)<!-- -->, [JobName](./bitburner.jobname.md)<!-- -->, [JobField](./bitburner.jobfield.md)<!-- -->, [LocationName](./bitburner.locationname.md)<!-- -->, [ToastVariant](./bitburner.toastvariant.md)<!-- -->, [UniversityClassType](./bitburner.universityclasstype.md)<!-- -->, [CompanyName](./bitburner.companyname.md)
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ Apply for a job at a company.
|
|||||||
**Signature:**
|
**Signature:**
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
applyToCompany(companyName: CompanyName | `${CompanyName}`, field: string): boolean;
|
applyToCompany(companyName: CompanyName | `${CompanyName}`, field: JobField | `${JobField}`): boolean;
|
||||||
```
|
```
|
||||||
|
|
||||||
## Parameters
|
## Parameters
|
||||||
@ -17,7 +17,7 @@ applyToCompany(companyName: CompanyName | `${CompanyName}`, field: string): bool
|
|||||||
| Parameter | Type | Description |
|
| Parameter | Type | Description |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| companyName | [CompanyName](./bitburner.companyname.md) \| \`${[CompanyName](./bitburner.companyname.md)<!-- -->}\` | 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. |
|
| field | [JobField](./bitburner.jobfield.md) \| \`${[JobField](./bitburner.jobfield.md)<!-- -->}\` | Field to which you want to apply. |
|
||||||
|
|
||||||
**Returns:**
|
**Returns:**
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { Person as IPerson } from "@nsdefs";
|
import { Person as IPerson } from "@nsdefs";
|
||||||
import { CONSTANTS } from "../Constants";
|
import { CONSTANTS } from "../Constants";
|
||||||
import { JobName } from "@enums";
|
import { JobName, JobField } from "@enums";
|
||||||
import {
|
import {
|
||||||
agentJobs,
|
agentJobs,
|
||||||
businessConsultJobs,
|
businessConsultJobs,
|
||||||
@ -14,6 +14,7 @@ import {
|
|||||||
|
|
||||||
export interface CompanyPositionCtorParams {
|
export interface CompanyPositionCtorParams {
|
||||||
nextPosition: JobName | null;
|
nextPosition: JobName | null;
|
||||||
|
field: JobField;
|
||||||
baseSalary: number;
|
baseSalary: number;
|
||||||
repMultiplier: number;
|
repMultiplier: number;
|
||||||
|
|
||||||
@ -44,6 +45,9 @@ export class CompanyPosition {
|
|||||||
/** Position title */
|
/** Position title */
|
||||||
name: JobName;
|
name: JobName;
|
||||||
|
|
||||||
|
/** Field type of the position (software, it, business, etc) */
|
||||||
|
field: JobField;
|
||||||
|
|
||||||
/** Title of next position to be promoted to */
|
/** Title of next position to be promoted to */
|
||||||
nextPosition: JobName | null;
|
nextPosition: JobName | null;
|
||||||
|
|
||||||
@ -85,6 +89,7 @@ export class CompanyPosition {
|
|||||||
|
|
||||||
constructor(name: JobName, p: CompanyPositionCtorParams) {
|
constructor(name: JobName, p: CompanyPositionCtorParams) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
this.field = p.field;
|
||||||
this.nextPosition = p.nextPosition;
|
this.nextPosition = p.nextPosition;
|
||||||
this.baseSalary = p.baseSalary;
|
this.baseSalary = p.baseSalary;
|
||||||
this.repMultiplier = p.repMultiplier;
|
this.repMultiplier = p.repMultiplier;
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
// Metadata used for constructing Company Positions
|
// Metadata used for constructing Company Positions
|
||||||
import { JobName } from "@enums";
|
import { JobName, JobField } from "@enums";
|
||||||
import { CompanyPositionCtorParams } from "../CompanyPosition";
|
import { CompanyPositionCtorParams } from "../CompanyPosition";
|
||||||
|
|
||||||
export function getCompanyPositionMetadata(): Record<JobName, CompanyPositionCtorParams> {
|
export function getCompanyPositionMetadata(): Record<JobName, CompanyPositionCtorParams> {
|
||||||
return {
|
return {
|
||||||
[JobName.software0]: {
|
[JobName.software0]: {
|
||||||
nextPosition: JobName.software1, // Junior Software Engineer
|
nextPosition: JobName.software1, // Junior Software Engineer
|
||||||
|
field: JobField.software,
|
||||||
baseSalary: 33,
|
baseSalary: 33,
|
||||||
charismaEffectiveness: 15,
|
charismaEffectiveness: 15,
|
||||||
charismaExpGain: 0.02,
|
charismaExpGain: 0.02,
|
||||||
@ -16,6 +17,7 @@ export function getCompanyPositionMetadata(): Record<JobName, CompanyPositionCto
|
|||||||
},
|
},
|
||||||
[JobName.software1]: {
|
[JobName.software1]: {
|
||||||
nextPosition: JobName.software2, // Senior Software Engineer
|
nextPosition: JobName.software2, // Senior Software Engineer
|
||||||
|
field: JobField.software,
|
||||||
baseSalary: 80,
|
baseSalary: 80,
|
||||||
charismaEffectiveness: 15,
|
charismaEffectiveness: 15,
|
||||||
charismaExpGain: 0.05,
|
charismaExpGain: 0.05,
|
||||||
@ -27,6 +29,7 @@ export function getCompanyPositionMetadata(): Record<JobName, CompanyPositionCto
|
|||||||
},
|
},
|
||||||
[JobName.software2]: {
|
[JobName.software2]: {
|
||||||
nextPosition: JobName.software3, // Lead Software Developer
|
nextPosition: JobName.software3, // Lead Software Developer
|
||||||
|
field: JobField.software,
|
||||||
baseSalary: 165,
|
baseSalary: 165,
|
||||||
charismaEffectiveness: 20,
|
charismaEffectiveness: 20,
|
||||||
charismaExpGain: 0.08,
|
charismaExpGain: 0.08,
|
||||||
@ -39,6 +42,7 @@ export function getCompanyPositionMetadata(): Record<JobName, CompanyPositionCto
|
|||||||
},
|
},
|
||||||
[JobName.software3]: {
|
[JobName.software3]: {
|
||||||
nextPosition: JobName.software4, // Head of Software
|
nextPosition: JobName.software4, // Head of Software
|
||||||
|
field: JobField.software,
|
||||||
baseSalary: 500,
|
baseSalary: 500,
|
||||||
charismaEffectiveness: 25,
|
charismaEffectiveness: 25,
|
||||||
charismaExpGain: 0.1,
|
charismaExpGain: 0.1,
|
||||||
@ -51,6 +55,7 @@ export function getCompanyPositionMetadata(): Record<JobName, CompanyPositionCto
|
|||||||
},
|
},
|
||||||
[JobName.software4]: {
|
[JobName.software4]: {
|
||||||
nextPosition: JobName.software5, // Head of Engineering
|
nextPosition: JobName.software5, // Head of Engineering
|
||||||
|
field: JobField.software,
|
||||||
baseSalary: 800,
|
baseSalary: 800,
|
||||||
charismaEffectiveness: 25,
|
charismaEffectiveness: 25,
|
||||||
charismaExpGain: 0.5,
|
charismaExpGain: 0.5,
|
||||||
@ -63,6 +68,7 @@ export function getCompanyPositionMetadata(): Record<JobName, CompanyPositionCto
|
|||||||
},
|
},
|
||||||
[JobName.software5]: {
|
[JobName.software5]: {
|
||||||
nextPosition: JobName.software6, // Vice President of Technology
|
nextPosition: JobName.software6, // Vice President of Technology
|
||||||
|
field: JobField.software,
|
||||||
baseSalary: 1650,
|
baseSalary: 1650,
|
||||||
charismaEffectiveness: 25,
|
charismaEffectiveness: 25,
|
||||||
charismaExpGain: 0.5,
|
charismaExpGain: 0.5,
|
||||||
@ -75,6 +81,7 @@ export function getCompanyPositionMetadata(): Record<JobName, CompanyPositionCto
|
|||||||
},
|
},
|
||||||
[JobName.software6]: {
|
[JobName.software6]: {
|
||||||
nextPosition: JobName.software7, // Chief Technology Officer
|
nextPosition: JobName.software7, // Chief Technology Officer
|
||||||
|
field: JobField.software,
|
||||||
baseSalary: 2310,
|
baseSalary: 2310,
|
||||||
charismaEffectiveness: 30,
|
charismaEffectiveness: 30,
|
||||||
charismaExpGain: 0.6,
|
charismaExpGain: 0.6,
|
||||||
@ -87,6 +94,7 @@ export function getCompanyPositionMetadata(): Record<JobName, CompanyPositionCto
|
|||||||
},
|
},
|
||||||
[JobName.software7]: {
|
[JobName.software7]: {
|
||||||
nextPosition: null,
|
nextPosition: null,
|
||||||
|
field: JobField.software,
|
||||||
baseSalary: 2640,
|
baseSalary: 2640,
|
||||||
charismaEffectiveness: 35,
|
charismaEffectiveness: 35,
|
||||||
charismaExpGain: 1,
|
charismaExpGain: 1,
|
||||||
@ -99,6 +107,7 @@ export function getCompanyPositionMetadata(): Record<JobName, CompanyPositionCto
|
|||||||
},
|
},
|
||||||
[JobName.IT0]: {
|
[JobName.IT0]: {
|
||||||
nextPosition: JobName.IT1, // IT Analyst
|
nextPosition: JobName.IT1, // IT Analyst
|
||||||
|
field: JobField.it,
|
||||||
baseSalary: 26,
|
baseSalary: 26,
|
||||||
charismaEffectiveness: 10,
|
charismaEffectiveness: 10,
|
||||||
charismaExpGain: 0.01,
|
charismaExpGain: 0.01,
|
||||||
@ -109,6 +118,7 @@ export function getCompanyPositionMetadata(): Record<JobName, CompanyPositionCto
|
|||||||
},
|
},
|
||||||
[JobName.IT1]: {
|
[JobName.IT1]: {
|
||||||
nextPosition: JobName.IT2, // IT Manager
|
nextPosition: JobName.IT2, // IT Manager
|
||||||
|
field: JobField.it,
|
||||||
baseSalary: 66,
|
baseSalary: 66,
|
||||||
charismaEffectiveness: 15,
|
charismaEffectiveness: 15,
|
||||||
charismaExpGain: 0.02,
|
charismaExpGain: 0.02,
|
||||||
@ -120,6 +130,7 @@ export function getCompanyPositionMetadata(): Record<JobName, CompanyPositionCto
|
|||||||
},
|
},
|
||||||
[JobName.IT2]: {
|
[JobName.IT2]: {
|
||||||
nextPosition: JobName.IT3, // Systems Administrator
|
nextPosition: JobName.IT3, // Systems Administrator
|
||||||
|
field: JobField.it,
|
||||||
baseSalary: 132,
|
baseSalary: 132,
|
||||||
charismaEffectiveness: 20,
|
charismaEffectiveness: 20,
|
||||||
charismaExpGain: 0.1,
|
charismaExpGain: 0.1,
|
||||||
@ -132,6 +143,7 @@ export function getCompanyPositionMetadata(): Record<JobName, CompanyPositionCto
|
|||||||
},
|
},
|
||||||
[JobName.IT3]: {
|
[JobName.IT3]: {
|
||||||
nextPosition: JobName.software5, // Head of Engineering
|
nextPosition: JobName.software5, // Head of Engineering
|
||||||
|
field: JobField.it,
|
||||||
baseSalary: 410,
|
baseSalary: 410,
|
||||||
charismaEffectiveness: 20,
|
charismaEffectiveness: 20,
|
||||||
charismaExpGain: 0.2,
|
charismaExpGain: 0.2,
|
||||||
@ -144,6 +156,7 @@ export function getCompanyPositionMetadata(): Record<JobName, CompanyPositionCto
|
|||||||
},
|
},
|
||||||
[JobName.securityEng]: {
|
[JobName.securityEng]: {
|
||||||
nextPosition: JobName.software5, // Head of Engineering
|
nextPosition: JobName.software5, // Head of Engineering
|
||||||
|
field: JobField.securityEngineer,
|
||||||
baseSalary: 121,
|
baseSalary: 121,
|
||||||
charismaEffectiveness: 15,
|
charismaEffectiveness: 15,
|
||||||
charismaExpGain: 0.05,
|
charismaExpGain: 0.05,
|
||||||
@ -156,6 +169,7 @@ export function getCompanyPositionMetadata(): Record<JobName, CompanyPositionCto
|
|||||||
},
|
},
|
||||||
[JobName.networkEng0]: {
|
[JobName.networkEng0]: {
|
||||||
nextPosition: JobName.networkEng1, // Network Administrator
|
nextPosition: JobName.networkEng1, // Network Administrator
|
||||||
|
field: JobField.networkEngineer,
|
||||||
baseSalary: 121,
|
baseSalary: 121,
|
||||||
charismaEffectiveness: 15,
|
charismaEffectiveness: 15,
|
||||||
charismaExpGain: 0.05,
|
charismaExpGain: 0.05,
|
||||||
@ -168,6 +182,7 @@ export function getCompanyPositionMetadata(): Record<JobName, CompanyPositionCto
|
|||||||
},
|
},
|
||||||
[JobName.networkEng1]: {
|
[JobName.networkEng1]: {
|
||||||
nextPosition: JobName.software5, // Head of Engineering
|
nextPosition: JobName.software5, // Head of Engineering
|
||||||
|
field: JobField.networkEngineer,
|
||||||
baseSalary: 410,
|
baseSalary: 410,
|
||||||
charismaEffectiveness: 20,
|
charismaEffectiveness: 20,
|
||||||
charismaExpGain: 0.1,
|
charismaExpGain: 0.1,
|
||||||
@ -180,6 +195,7 @@ export function getCompanyPositionMetadata(): Record<JobName, CompanyPositionCto
|
|||||||
},
|
},
|
||||||
[JobName.business0]: {
|
[JobName.business0]: {
|
||||||
nextPosition: JobName.business1, // Business Analyst
|
nextPosition: JobName.business1, // Business Analyst
|
||||||
|
field: JobField.business,
|
||||||
baseSalary: 46,
|
baseSalary: 46,
|
||||||
charismaEffectiveness: 90,
|
charismaEffectiveness: 90,
|
||||||
charismaExpGain: 0.08,
|
charismaExpGain: 0.08,
|
||||||
@ -191,6 +207,7 @@ export function getCompanyPositionMetadata(): Record<JobName, CompanyPositionCto
|
|||||||
},
|
},
|
||||||
[JobName.business1]: {
|
[JobName.business1]: {
|
||||||
nextPosition: JobName.business2, // Business Manager
|
nextPosition: JobName.business2, // Business Manager
|
||||||
|
field: JobField.business,
|
||||||
baseSalary: 100,
|
baseSalary: 100,
|
||||||
charismaEffectiveness: 85,
|
charismaEffectiveness: 85,
|
||||||
charismaExpGain: 0.15,
|
charismaExpGain: 0.15,
|
||||||
@ -203,6 +220,7 @@ export function getCompanyPositionMetadata(): Record<JobName, CompanyPositionCto
|
|||||||
},
|
},
|
||||||
[JobName.business2]: {
|
[JobName.business2]: {
|
||||||
nextPosition: JobName.business3, // Operations Manager
|
nextPosition: JobName.business3, // Operations Manager
|
||||||
|
field: JobField.business,
|
||||||
baseSalary: 200,
|
baseSalary: 200,
|
||||||
charismaEffectiveness: 85,
|
charismaEffectiveness: 85,
|
||||||
charismaExpGain: 0.3,
|
charismaExpGain: 0.3,
|
||||||
@ -215,6 +233,7 @@ export function getCompanyPositionMetadata(): Record<JobName, CompanyPositionCto
|
|||||||
},
|
},
|
||||||
[JobName.business3]: {
|
[JobName.business3]: {
|
||||||
nextPosition: JobName.business4, // Chief Financial Officer
|
nextPosition: JobName.business4, // Chief Financial Officer
|
||||||
|
field: JobField.business,
|
||||||
baseSalary: 660,
|
baseSalary: 660,
|
||||||
charismaEffectiveness: 85,
|
charismaEffectiveness: 85,
|
||||||
charismaExpGain: 0.4,
|
charismaExpGain: 0.4,
|
||||||
@ -227,6 +246,7 @@ export function getCompanyPositionMetadata(): Record<JobName, CompanyPositionCto
|
|||||||
},
|
},
|
||||||
[JobName.business4]: {
|
[JobName.business4]: {
|
||||||
nextPosition: JobName.business5, // Chief Executive Officer
|
nextPosition: JobName.business5, // Chief Executive Officer
|
||||||
|
field: JobField.business,
|
||||||
baseSalary: 1950,
|
baseSalary: 1950,
|
||||||
charismaEffectiveness: 90,
|
charismaEffectiveness: 90,
|
||||||
charismaExpGain: 1,
|
charismaExpGain: 1,
|
||||||
@ -239,6 +259,7 @@ export function getCompanyPositionMetadata(): Record<JobName, CompanyPositionCto
|
|||||||
},
|
},
|
||||||
[JobName.business5]: {
|
[JobName.business5]: {
|
||||||
nextPosition: null,
|
nextPosition: null,
|
||||||
|
field: JobField.business,
|
||||||
baseSalary: 3900,
|
baseSalary: 3900,
|
||||||
charismaEffectiveness: 90,
|
charismaEffectiveness: 90,
|
||||||
charismaExpGain: 1.5,
|
charismaExpGain: 1.5,
|
||||||
@ -251,6 +272,7 @@ export function getCompanyPositionMetadata(): Record<JobName, CompanyPositionCto
|
|||||||
},
|
},
|
||||||
[JobName.security0]: {
|
[JobName.security0]: {
|
||||||
nextPosition: JobName.security1, // Security Officer
|
nextPosition: JobName.security1, // Security Officer
|
||||||
|
field: JobField.security,
|
||||||
baseSalary: 50,
|
baseSalary: 50,
|
||||||
hackingEffectiveness: 5,
|
hackingEffectiveness: 5,
|
||||||
strengthEffectiveness: 20,
|
strengthEffectiveness: 20,
|
||||||
@ -273,6 +295,7 @@ export function getCompanyPositionMetadata(): Record<JobName, CompanyPositionCto
|
|||||||
},
|
},
|
||||||
[JobName.security1]: {
|
[JobName.security1]: {
|
||||||
nextPosition: JobName.security2, // Security Supervisor
|
nextPosition: JobName.security2, // Security Supervisor
|
||||||
|
field: JobField.security,
|
||||||
baseSalary: 195,
|
baseSalary: 195,
|
||||||
hackingEffectiveness: 10,
|
hackingEffectiveness: 10,
|
||||||
strengthEffectiveness: 20,
|
strengthEffectiveness: 20,
|
||||||
@ -297,6 +320,7 @@ export function getCompanyPositionMetadata(): Record<JobName, CompanyPositionCto
|
|||||||
},
|
},
|
||||||
[JobName.security2]: {
|
[JobName.security2]: {
|
||||||
nextPosition: JobName.security3, // Head of Security
|
nextPosition: JobName.security3, // Head of Security
|
||||||
|
field: JobField.security,
|
||||||
baseSalary: 660,
|
baseSalary: 660,
|
||||||
hackingEffectiveness: 10,
|
hackingEffectiveness: 10,
|
||||||
strengthEffectiveness: 15,
|
strengthEffectiveness: 15,
|
||||||
@ -321,6 +345,7 @@ export function getCompanyPositionMetadata(): Record<JobName, CompanyPositionCto
|
|||||||
},
|
},
|
||||||
[JobName.security3]: {
|
[JobName.security3]: {
|
||||||
nextPosition: null,
|
nextPosition: null,
|
||||||
|
field: JobField.security,
|
||||||
baseSalary: 1320,
|
baseSalary: 1320,
|
||||||
hackingEffectiveness: 10,
|
hackingEffectiveness: 10,
|
||||||
strengthEffectiveness: 15,
|
strengthEffectiveness: 15,
|
||||||
@ -345,6 +370,7 @@ export function getCompanyPositionMetadata(): Record<JobName, CompanyPositionCto
|
|||||||
},
|
},
|
||||||
[JobName.agent0]: {
|
[JobName.agent0]: {
|
||||||
nextPosition: JobName.agent1, // Secret Agent
|
nextPosition: JobName.agent1, // Secret Agent
|
||||||
|
field: JobField.agent,
|
||||||
baseSalary: 330,
|
baseSalary: 330,
|
||||||
hackingEffectiveness: 10,
|
hackingEffectiveness: 10,
|
||||||
strengthEffectiveness: 15,
|
strengthEffectiveness: 15,
|
||||||
@ -369,6 +395,7 @@ export function getCompanyPositionMetadata(): Record<JobName, CompanyPositionCto
|
|||||||
},
|
},
|
||||||
[JobName.agent1]: {
|
[JobName.agent1]: {
|
||||||
nextPosition: JobName.agent2, // Special Operative
|
nextPosition: JobName.agent2, // Special Operative
|
||||||
|
field: JobField.agent,
|
||||||
baseSalary: 990,
|
baseSalary: 990,
|
||||||
hackingEffectiveness: 15,
|
hackingEffectiveness: 15,
|
||||||
strengthEffectiveness: 15,
|
strengthEffectiveness: 15,
|
||||||
@ -393,6 +420,7 @@ export function getCompanyPositionMetadata(): Record<JobName, CompanyPositionCto
|
|||||||
},
|
},
|
||||||
[JobName.agent2]: {
|
[JobName.agent2]: {
|
||||||
nextPosition: null,
|
nextPosition: null,
|
||||||
|
field: JobField.agent,
|
||||||
baseSalary: 2000,
|
baseSalary: 2000,
|
||||||
hackingEffectiveness: 15,
|
hackingEffectiveness: 15,
|
||||||
strengthEffectiveness: 15,
|
strengthEffectiveness: 15,
|
||||||
@ -417,6 +445,7 @@ export function getCompanyPositionMetadata(): Record<JobName, CompanyPositionCto
|
|||||||
},
|
},
|
||||||
[JobName.waiter]: {
|
[JobName.waiter]: {
|
||||||
nextPosition: null,
|
nextPosition: null,
|
||||||
|
field: JobField.waiter,
|
||||||
baseSalary: 22,
|
baseSalary: 22,
|
||||||
strengthEffectiveness: 10,
|
strengthEffectiveness: 10,
|
||||||
dexterityEffectiveness: 10,
|
dexterityEffectiveness: 10,
|
||||||
@ -431,6 +460,7 @@ export function getCompanyPositionMetadata(): Record<JobName, CompanyPositionCto
|
|||||||
},
|
},
|
||||||
[JobName.employee]: {
|
[JobName.employee]: {
|
||||||
nextPosition: null,
|
nextPosition: null,
|
||||||
|
field: JobField.employee,
|
||||||
baseSalary: 22,
|
baseSalary: 22,
|
||||||
strengthEffectiveness: 10,
|
strengthEffectiveness: 10,
|
||||||
dexterityEffectiveness: 10,
|
dexterityEffectiveness: 10,
|
||||||
@ -445,6 +475,7 @@ export function getCompanyPositionMetadata(): Record<JobName, CompanyPositionCto
|
|||||||
},
|
},
|
||||||
[JobName.softwareConsult0]: {
|
[JobName.softwareConsult0]: {
|
||||||
nextPosition: JobName.softwareConsult1, // Senior Software Consultant
|
nextPosition: JobName.softwareConsult1, // Senior Software Consultant
|
||||||
|
field: JobField.softwareConsultant,
|
||||||
baseSalary: 66,
|
baseSalary: 66,
|
||||||
hackingEffectiveness: 80,
|
hackingEffectiveness: 80,
|
||||||
charismaEffectiveness: 20,
|
charismaEffectiveness: 20,
|
||||||
@ -455,6 +486,7 @@ export function getCompanyPositionMetadata(): Record<JobName, CompanyPositionCto
|
|||||||
},
|
},
|
||||||
[JobName.softwareConsult1]: {
|
[JobName.softwareConsult1]: {
|
||||||
nextPosition: null,
|
nextPosition: null,
|
||||||
|
field: JobField.softwareConsultant,
|
||||||
baseSalary: 132,
|
baseSalary: 132,
|
||||||
hackingEffectiveness: 75,
|
hackingEffectiveness: 75,
|
||||||
charismaEffectiveness: 25,
|
charismaEffectiveness: 25,
|
||||||
@ -466,6 +498,7 @@ export function getCompanyPositionMetadata(): Record<JobName, CompanyPositionCto
|
|||||||
},
|
},
|
||||||
[JobName.businessConsult0]: {
|
[JobName.businessConsult0]: {
|
||||||
nextPosition: JobName.businessConsult1, // Senior Business Consultant
|
nextPosition: JobName.businessConsult1, // Senior Business Consultant
|
||||||
|
field: JobField.businessConsultant,
|
||||||
baseSalary: 66,
|
baseSalary: 66,
|
||||||
hackingEffectiveness: 20,
|
hackingEffectiveness: 20,
|
||||||
charismaEffectiveness: 80,
|
charismaEffectiveness: 80,
|
||||||
@ -477,6 +510,7 @@ export function getCompanyPositionMetadata(): Record<JobName, CompanyPositionCto
|
|||||||
},
|
},
|
||||||
[JobName.businessConsult1]: {
|
[JobName.businessConsult1]: {
|
||||||
nextPosition: null,
|
nextPosition: null,
|
||||||
|
field: JobField.businessConsultant,
|
||||||
baseSalary: 525,
|
baseSalary: 525,
|
||||||
hackingEffectiveness: 15,
|
hackingEffectiveness: 15,
|
||||||
charismaEffectiveness: 85,
|
charismaEffectiveness: 85,
|
||||||
@ -488,6 +522,7 @@ export function getCompanyPositionMetadata(): Record<JobName, CompanyPositionCto
|
|||||||
},
|
},
|
||||||
[JobName.waiterPT]: {
|
[JobName.waiterPT]: {
|
||||||
nextPosition: null,
|
nextPosition: null,
|
||||||
|
field: JobField.partTimeWaiter,
|
||||||
baseSalary: 20,
|
baseSalary: 20,
|
||||||
strengthEffectiveness: 10,
|
strengthEffectiveness: 10,
|
||||||
dexterityEffectiveness: 10,
|
dexterityEffectiveness: 10,
|
||||||
@ -502,6 +537,7 @@ export function getCompanyPositionMetadata(): Record<JobName, CompanyPositionCto
|
|||||||
},
|
},
|
||||||
[JobName.employeePT]: {
|
[JobName.employeePT]: {
|
||||||
nextPosition: null,
|
nextPosition: null,
|
||||||
|
field: JobField.partTimeEmployee,
|
||||||
baseSalary: 20,
|
baseSalary: 20,
|
||||||
strengthEffectiveness: 10,
|
strengthEffectiveness: 10,
|
||||||
dexterityEffectiveness: 10,
|
dexterityEffectiveness: 10,
|
||||||
|
@ -12,7 +12,7 @@ import Box from "@mui/material/Box";
|
|||||||
import { ApplyToJobButton } from "./ApplyToJobButton";
|
import { ApplyToJobButton } from "./ApplyToJobButton";
|
||||||
|
|
||||||
import { Locations } from "../Locations";
|
import { Locations } from "../Locations";
|
||||||
import { CompanyName, JobName } from "@enums";
|
import { CompanyName, JobName, JobField } from "@enums";
|
||||||
|
|
||||||
import { Companies } from "../../Company/Companies";
|
import { Companies } from "../../Company/Companies";
|
||||||
import { CompanyPositions } from "../../Company/CompanyPositions";
|
import { CompanyPositions } from "../../Company/CompanyPositions";
|
||||||
@ -238,7 +238,7 @@ export function CompanyLocation(props: IProps): React.ReactElement {
|
|||||||
company={company}
|
company={company}
|
||||||
entryPosType={CompanyPositions[JobName.agent0]}
|
entryPosType={CompanyPositions[JobName.agent0]}
|
||||||
onClick={applyForAgentJob}
|
onClick={applyForAgentJob}
|
||||||
text={"Apply for Agent Job"}
|
text={"Apply for " + JobField.agent + " Job"}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{company.hasBusinessConsultantPositions() && (
|
{company.hasBusinessConsultantPositions() && (
|
||||||
@ -246,7 +246,7 @@ export function CompanyLocation(props: IProps): React.ReactElement {
|
|||||||
company={company}
|
company={company}
|
||||||
entryPosType={CompanyPositions[JobName.businessConsult0]}
|
entryPosType={CompanyPositions[JobName.businessConsult0]}
|
||||||
onClick={applyForBusinessConsultantJob}
|
onClick={applyForBusinessConsultantJob}
|
||||||
text={"Apply for Business Consultant Job"}
|
text={"Apply for " + JobField.businessConsultant + " Job"}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{company.hasBusinessPositions() && (
|
{company.hasBusinessPositions() && (
|
||||||
@ -254,7 +254,7 @@ export function CompanyLocation(props: IProps): React.ReactElement {
|
|||||||
company={company}
|
company={company}
|
||||||
entryPosType={CompanyPositions[JobName.business0]}
|
entryPosType={CompanyPositions[JobName.business0]}
|
||||||
onClick={applyForBusinessJob}
|
onClick={applyForBusinessJob}
|
||||||
text={"Apply for Business Job"}
|
text={"Apply for " + JobField.business + " Job"}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{company.hasEmployeePositions() && (
|
{company.hasEmployeePositions() && (
|
||||||
@ -262,7 +262,7 @@ export function CompanyLocation(props: IProps): React.ReactElement {
|
|||||||
company={company}
|
company={company}
|
||||||
entryPosType={CompanyPositions[JobName.employee]}
|
entryPosType={CompanyPositions[JobName.employee]}
|
||||||
onClick={applyForEmployeeJob}
|
onClick={applyForEmployeeJob}
|
||||||
text={"Apply to be an Employee"}
|
text={"Apply to be an " + JobField.employee}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{company.hasEmployeePositions() && (
|
{company.hasEmployeePositions() && (
|
||||||
@ -270,7 +270,7 @@ export function CompanyLocation(props: IProps): React.ReactElement {
|
|||||||
company={company}
|
company={company}
|
||||||
entryPosType={CompanyPositions[JobName.employeePT]}
|
entryPosType={CompanyPositions[JobName.employeePT]}
|
||||||
onClick={applyForPartTimeEmployeeJob}
|
onClick={applyForPartTimeEmployeeJob}
|
||||||
text={"Apply to be a part-time Employee"}
|
text={"Apply to be a " + JobField.partTimeEmployee}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{company.hasITPositions() && (
|
{company.hasITPositions() && (
|
||||||
@ -278,7 +278,7 @@ export function CompanyLocation(props: IProps): React.ReactElement {
|
|||||||
company={company}
|
company={company}
|
||||||
entryPosType={CompanyPositions[JobName.IT0]}
|
entryPosType={CompanyPositions[JobName.IT0]}
|
||||||
onClick={applyForItJob}
|
onClick={applyForItJob}
|
||||||
text={"Apply for IT Job"}
|
text={"Apply for " + JobField.it + " Job"}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{company.hasSecurityPositions() && (
|
{company.hasSecurityPositions() && (
|
||||||
@ -286,7 +286,7 @@ export function CompanyLocation(props: IProps): React.ReactElement {
|
|||||||
company={company}
|
company={company}
|
||||||
entryPosType={CompanyPositions[JobName.security0]}
|
entryPosType={CompanyPositions[JobName.security0]}
|
||||||
onClick={applyForSecurityJob}
|
onClick={applyForSecurityJob}
|
||||||
text={"Apply for Security Job"}
|
text={"Apply for " + JobField.security + " Job"}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{company.hasSoftwareConsultantPositions() && (
|
{company.hasSoftwareConsultantPositions() && (
|
||||||
@ -294,7 +294,7 @@ export function CompanyLocation(props: IProps): React.ReactElement {
|
|||||||
company={company}
|
company={company}
|
||||||
entryPosType={CompanyPositions[JobName.softwareConsult0]}
|
entryPosType={CompanyPositions[JobName.softwareConsult0]}
|
||||||
onClick={applyForSoftwareConsultantJob}
|
onClick={applyForSoftwareConsultantJob}
|
||||||
text={"Apply for Software Consultant Job"}
|
text={"Apply for " + JobField.softwareConsultant + " Job"}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{company.hasSoftwarePositions() && (
|
{company.hasSoftwarePositions() && (
|
||||||
@ -302,7 +302,7 @@ export function CompanyLocation(props: IProps): React.ReactElement {
|
|||||||
company={company}
|
company={company}
|
||||||
entryPosType={CompanyPositions[JobName.software0]}
|
entryPosType={CompanyPositions[JobName.software0]}
|
||||||
onClick={applyForSoftwareJob}
|
onClick={applyForSoftwareJob}
|
||||||
text={"Apply for Software Job"}
|
text={"Apply for " + JobField.software + " Job"}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{company.hasWaiterPositions() && (
|
{company.hasWaiterPositions() && (
|
||||||
@ -310,7 +310,7 @@ export function CompanyLocation(props: IProps): React.ReactElement {
|
|||||||
company={company}
|
company={company}
|
||||||
entryPosType={CompanyPositions[JobName.waiter]}
|
entryPosType={CompanyPositions[JobName.waiter]}
|
||||||
onClick={applyForWaiterJob}
|
onClick={applyForWaiterJob}
|
||||||
text={"Apply to be a Waiter"}
|
text={"Apply to be a " + JobField.waiter}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{company.hasWaiterPositions() && (
|
{company.hasWaiterPositions() && (
|
||||||
@ -318,7 +318,7 @@ export function CompanyLocation(props: IProps): React.ReactElement {
|
|||||||
company={company}
|
company={company}
|
||||||
entryPosType={CompanyPositions[JobName.waiterPT]}
|
entryPosType={CompanyPositions[JobName.waiterPT]}
|
||||||
onClick={applyForPartTimeWaiterJob}
|
onClick={applyForPartTimeWaiterJob}
|
||||||
text={"Apply to be a part-time Waiter"}
|
text={"Apply to be a " + JobField.partTimeWaiter}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{location.infiltrationData != null && <Button onClick={startInfiltration}>Infiltrate Company</Button>}
|
{location.infiltrationData != null && <Button onClick={startInfiltration}>Infiltrate Company</Button>}
|
||||||
|
@ -20,6 +20,7 @@ import {
|
|||||||
FactionWorkType,
|
FactionWorkType,
|
||||||
GymType,
|
GymType,
|
||||||
JobName,
|
JobName,
|
||||||
|
JobField,
|
||||||
LiteratureName,
|
LiteratureName,
|
||||||
LocationName,
|
LocationName,
|
||||||
ToastVariant,
|
ToastVariant,
|
||||||
@ -109,6 +110,7 @@ export const enums: NSEnums = {
|
|||||||
FactionWorkType,
|
FactionWorkType,
|
||||||
GymType,
|
GymType,
|
||||||
JobName,
|
JobName,
|
||||||
|
JobField,
|
||||||
LocationName,
|
LocationName,
|
||||||
ToastVariant,
|
ToastVariant,
|
||||||
UniversityClassType,
|
UniversityClassType,
|
||||||
|
@ -8,6 +8,7 @@ import {
|
|||||||
FactionName,
|
FactionName,
|
||||||
FactionWorkType,
|
FactionWorkType,
|
||||||
GymType,
|
GymType,
|
||||||
|
JobField,
|
||||||
LocationName,
|
LocationName,
|
||||||
UniversityClassType,
|
UniversityClassType,
|
||||||
} from "@enums";
|
} from "@enums";
|
||||||
@ -31,7 +32,7 @@ import { formatMoney, formatRam, formatReputation } from "../ui/formatNumber";
|
|||||||
import { currentNodeMults } from "../BitNode/BitNodeMultipliers";
|
import { currentNodeMults } from "../BitNode/BitNodeMultipliers";
|
||||||
import { Companies } from "../Company/Companies";
|
import { Companies } from "../Company/Companies";
|
||||||
import { Factions } from "../Faction/Factions";
|
import { Factions } from "../Faction/Factions";
|
||||||
import { helpers } from "../Netscript/NetscriptHelpers";
|
import { helpers, assertString } from "../Netscript/NetscriptHelpers";
|
||||||
import { convertTimeMsToTimeElapsedString } from "../utils/StringHelperFunctions";
|
import { convertTimeMsToTimeElapsedString } from "../utils/StringHelperFunctions";
|
||||||
import { getServerOnNetwork } from "../Server/ServerHelpers";
|
import { getServerOnNetwork } from "../Server/ServerHelpers";
|
||||||
import { Terminal } from "../Terminal";
|
import { Terminal } from "../Terminal";
|
||||||
@ -687,6 +688,7 @@ export function NetscriptSingularity(): InternalAPI<ISingularity> {
|
|||||||
const job = CompanyPositions[positionName];
|
const job = CompanyPositions[positionName];
|
||||||
const res = {
|
const res = {
|
||||||
name: CompanyPositions[positionName].name,
|
name: CompanyPositions[positionName].name,
|
||||||
|
field: CompanyPositions[positionName].field,
|
||||||
nextPosition: CompanyPositions[positionName].nextPosition,
|
nextPosition: CompanyPositions[positionName].nextPosition,
|
||||||
salary: CompanyPositions[positionName].baseSalary * company.salaryMultiplier,
|
salary: CompanyPositions[positionName].baseSalary * company.salaryMultiplier,
|
||||||
requiredReputation: CompanyPositions[positionName].requiredReputation,
|
requiredReputation: CompanyPositions[positionName].requiredReputation,
|
||||||
@ -736,48 +738,63 @@ export function NetscriptSingularity(): InternalAPI<ISingularity> {
|
|||||||
applyToCompany: (ctx) => (_companyName, _field) => {
|
applyToCompany: (ctx) => (_companyName, _field) => {
|
||||||
helpers.checkSingularityAccess(ctx);
|
helpers.checkSingularityAccess(ctx);
|
||||||
const companyName = getEnumHelper("CompanyName").nsGetMember(ctx, _companyName);
|
const companyName = getEnumHelper("CompanyName").nsGetMember(ctx, _companyName);
|
||||||
const field = helpers.string(ctx, "field", _field);
|
assertString(ctx, "field", _field);
|
||||||
|
|
||||||
|
// capitalize each word, except for "part-time"
|
||||||
|
function capitalizeJobField(field: string) {
|
||||||
|
return field
|
||||||
|
.toLowerCase()
|
||||||
|
.split(" ")
|
||||||
|
.map((s) => {
|
||||||
|
if (s.length == 0 || s == "part-time") return s;
|
||||||
|
if (s.length == 2) return s.toUpperCase(); // Probably an acronym
|
||||||
|
return s[0].toUpperCase() + s.slice(1);
|
||||||
|
})
|
||||||
|
.join(" ");
|
||||||
|
}
|
||||||
|
|
||||||
|
const field = getEnumHelper("JobField").nsGetMember(ctx, capitalizeJobField(_field as string), "field");
|
||||||
|
|
||||||
Player.location = companyNameAsLocationName(companyName);
|
Player.location = companyNameAsLocationName(companyName);
|
||||||
let res;
|
let res;
|
||||||
switch (field.toLowerCase()) {
|
switch (field) {
|
||||||
case "software":
|
case JobField.software:
|
||||||
res = Player.applyForSoftwareJob(true);
|
res = Player.applyForSoftwareJob(true);
|
||||||
break;
|
break;
|
||||||
case "software consultant":
|
case JobField.softwareConsultant:
|
||||||
res = Player.applyForSoftwareConsultantJob(true);
|
res = Player.applyForSoftwareConsultantJob(true);
|
||||||
break;
|
break;
|
||||||
case "it":
|
case JobField.it:
|
||||||
res = Player.applyForItJob(true);
|
res = Player.applyForItJob(true);
|
||||||
break;
|
break;
|
||||||
case "security engineer":
|
case JobField.securityEngineer:
|
||||||
res = Player.applyForSecurityEngineerJob(true);
|
res = Player.applyForSecurityEngineerJob(true);
|
||||||
break;
|
break;
|
||||||
case "network engineer":
|
case JobField.networkEngineer:
|
||||||
res = Player.applyForNetworkEngineerJob(true);
|
res = Player.applyForNetworkEngineerJob(true);
|
||||||
break;
|
break;
|
||||||
case "business":
|
case JobField.business:
|
||||||
res = Player.applyForBusinessJob(true);
|
res = Player.applyForBusinessJob(true);
|
||||||
break;
|
break;
|
||||||
case "business consultant":
|
case JobField.businessConsultant:
|
||||||
res = Player.applyForBusinessConsultantJob(true);
|
res = Player.applyForBusinessConsultantJob(true);
|
||||||
break;
|
break;
|
||||||
case "security":
|
case JobField.security:
|
||||||
res = Player.applyForSecurityJob(true);
|
res = Player.applyForSecurityJob(true);
|
||||||
break;
|
break;
|
||||||
case "agent":
|
case JobField.agent:
|
||||||
res = Player.applyForAgentJob(true);
|
res = Player.applyForAgentJob(true);
|
||||||
break;
|
break;
|
||||||
case "employee":
|
case JobField.employee:
|
||||||
res = Player.applyForEmployeeJob(true);
|
res = Player.applyForEmployeeJob(true);
|
||||||
break;
|
break;
|
||||||
case "part-time employee":
|
case JobField.partTimeEmployee:
|
||||||
res = Player.applyForPartTimeEmployeeJob(true);
|
res = Player.applyForPartTimeEmployeeJob(true);
|
||||||
break;
|
break;
|
||||||
case "waiter":
|
case JobField.waiter:
|
||||||
res = Player.applyForWaiterJob(true);
|
res = Player.applyForWaiterJob(true);
|
||||||
break;
|
break;
|
||||||
case "part-time waiter":
|
case JobField.partTimeWaiter:
|
||||||
res = Player.applyForPartTimeWaiterJob(true);
|
res = Player.applyForPartTimeWaiterJob(true);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
21
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
21
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
@ -1856,7 +1856,7 @@ export interface Singularity {
|
|||||||
* @param field - Field to which you want to apply.
|
* @param field - Field to which you want to apply.
|
||||||
* @returns True if the player successfully get a job/promotion, and false otherwise.
|
* @returns True if the player successfully get a job/promotion, and false otherwise.
|
||||||
*/
|
*/
|
||||||
applyToCompany(companyName: CompanyName | `${CompanyName}`, field: string): boolean;
|
applyToCompany(companyName: CompanyName | `${CompanyName}`, field: JobField | `${JobField}`): boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get company reputation.
|
* Get company reputation.
|
||||||
@ -2423,6 +2423,7 @@ export interface Singularity {
|
|||||||
*/
|
*/
|
||||||
export interface CompanyPositionInfo {
|
export interface CompanyPositionInfo {
|
||||||
name: JobName;
|
name: JobName;
|
||||||
|
field: JobField;
|
||||||
nextPosition: JobName | null;
|
nextPosition: JobName | null;
|
||||||
salary: number;
|
salary: number;
|
||||||
requiredReputation: number;
|
requiredReputation: number;
|
||||||
@ -6860,6 +6861,23 @@ declare enum JobName {
|
|||||||
employeePT = "Part-time Employee",
|
employeePT = "Part-time Employee",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @public */
|
||||||
|
declare enum JobField {
|
||||||
|
software = "Software",
|
||||||
|
softwareConsultant = "Software Consultant",
|
||||||
|
it = "IT",
|
||||||
|
securityEngineer = "Security Engineer",
|
||||||
|
networkEngineer = "Network Engineer",
|
||||||
|
business = "Business",
|
||||||
|
businessConsultant = "Business Consultant",
|
||||||
|
security = "Security",
|
||||||
|
agent = "Agent",
|
||||||
|
employee = "Employee",
|
||||||
|
partTimeEmployee = "part-time Employee",
|
||||||
|
waiter = "Waiter",
|
||||||
|
partTimeWaiter = "part-time Waiter",
|
||||||
|
}
|
||||||
|
|
||||||
// CORP ENUMS - Changed to types
|
// CORP ENUMS - Changed to types
|
||||||
/** @public */
|
/** @public */
|
||||||
type CorpEmployeePosition =
|
type CorpEmployeePosition =
|
||||||
@ -7021,6 +7039,7 @@ export type NSEnums = {
|
|||||||
FactionWorkType: typeof FactionWorkType;
|
FactionWorkType: typeof FactionWorkType;
|
||||||
GymType: typeof GymType;
|
GymType: typeof GymType;
|
||||||
JobName: typeof JobName;
|
JobName: typeof JobName;
|
||||||
|
JobField: typeof JobField;
|
||||||
LocationName: typeof LocationName;
|
LocationName: typeof LocationName;
|
||||||
ToastVariant: typeof ToastVariant;
|
ToastVariant: typeof ToastVariant;
|
||||||
UniversityClassType: typeof UniversityClassType;
|
UniversityClassType: typeof UniversityClassType;
|
||||||
|
@ -63,3 +63,19 @@ export enum JobName {
|
|||||||
businessConsult0 = "Business Consultant",
|
businessConsult0 = "Business Consultant",
|
||||||
businessConsult1 = "Senior Business Consultant",
|
businessConsult1 = "Senior Business Consultant",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export enum JobField {
|
||||||
|
software = "Software",
|
||||||
|
softwareConsultant = "Software Consultant",
|
||||||
|
it = "IT",
|
||||||
|
securityEngineer = "Security Engineer",
|
||||||
|
networkEngineer = "Network Engineer",
|
||||||
|
business = "Business",
|
||||||
|
businessConsultant = "Business Consultant",
|
||||||
|
security = "Security",
|
||||||
|
agent = "Agent",
|
||||||
|
employee = "Employee",
|
||||||
|
partTimeEmployee = "part-time Employee",
|
||||||
|
waiter = "Waiter",
|
||||||
|
partTimeWaiter = "part-time Waiter",
|
||||||
|
}
|
||||||
|
101
test/jest/NetscriptFunctions/Singularity.test.ts
Normal file
101
test/jest/NetscriptFunctions/Singularity.test.ts
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
import { Player, setPlayer } from "../../../src/Player";
|
||||||
|
import { getCompaniesMetadata } from "../../../src/Company/data/CompaniesMetadata";
|
||||||
|
import { getCompanyPositionMetadata } from "../../../src/Company/data/CompanyPositionsMetadata";
|
||||||
|
import { PlayerObject } from "../../../src/PersonObjects/Player/PlayerObject";
|
||||||
|
import { NetscriptSingularity } from "../../../src/NetscriptFunctions/Singularity";
|
||||||
|
import { CompanyName, JobField, JobName } from "@enums";
|
||||||
|
|
||||||
|
import { WorkerScript } from "../../../src/Netscript/WorkerScript";
|
||||||
|
import { Script } from "../../../src/Script/Script";
|
||||||
|
import { RunningScript } from "../../../src/Script/RunningScript";
|
||||||
|
import { ScriptFilePath } from "../../../src/Paths/ScriptFilePath";
|
||||||
|
import { GetServer } from "../../../src/Server/AllServers";
|
||||||
|
|
||||||
|
describe("Singularity", () => {
|
||||||
|
let ctx;
|
||||||
|
let singularity;
|
||||||
|
let positionMetadata;
|
||||||
|
let companyMetadata;
|
||||||
|
|
||||||
|
beforeAll(() => {
|
||||||
|
singularity = NetscriptSingularity();
|
||||||
|
positionMetadata = getCompanyPositionMetadata();
|
||||||
|
companyMetadata = getCompaniesMetadata();
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
setPlayer(new PlayerObject());
|
||||||
|
Player.init();
|
||||||
|
Player.sourceFiles.set(4, 3);
|
||||||
|
|
||||||
|
GetServer("home").writeToScriptFile("function.js", "");
|
||||||
|
let script = new Script("function.js", "", "home");
|
||||||
|
let runningScript = new RunningScript(script, 1, []);
|
||||||
|
let workerScript = new WorkerScript(runningScript, 1);
|
||||||
|
ctx = { workerScript: workerScript, function: "singularityTest", functionPath: "test.singularityTest" };
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
Object.values(CompanyName).forEach((k) => {
|
||||||
|
companyMetadata[k].playerReputation = 0;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("getCompanyPositionInfo", () => {
|
||||||
|
it("returns an enum for field", () => {
|
||||||
|
let companyWithPositions = Object.values(CompanyName).find(
|
||||||
|
(cn) => companyMetadata[cn].companyPositions.length > 0,
|
||||||
|
);
|
||||||
|
let company = companyMetadata[companyWithPositions];
|
||||||
|
let positionName = company.companyPositions[0];
|
||||||
|
let position = positionMetadata[positionName];
|
||||||
|
|
||||||
|
let companyPosition = singularity.getCompanyPositionInfo(ctx)(company.name, positionName);
|
||||||
|
expect(companyPosition.field).toEqual(position.field);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("applyToCompany", () => {
|
||||||
|
it("throws an error if input doesn't match an enum", () => {
|
||||||
|
let anyValidCompany = Object.values(CompanyName)[0];
|
||||||
|
expect(() => singularity.applyToCompany(ctx)(anyValidCompany, "sockware")).toThrow("should be a JobField");
|
||||||
|
expect(() => singularity.applyToCompany(ctx)(anyValidCompany, "invalid-job-field")).toThrow(
|
||||||
|
"should be a JobField",
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("accepts the JobField specified by getCompanyPositionInfo", () => {
|
||||||
|
Object.values(CompanyName).forEach((cn) => {
|
||||||
|
companyMetadata[cn].companyPositions.forEach((pn) => {
|
||||||
|
let pos = positionMetadata[pn];
|
||||||
|
expect(() => singularity.applyToCompany(ctx)(cn, pos.field)).not.toThrow();
|
||||||
|
Player.quitJob(cn);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("is case-insensitive to string inputs to the field parameter", () => {
|
||||||
|
Object.values(CompanyName).forEach((cn) => {
|
||||||
|
companyMetadata[cn].companyPositions.forEach((pn) => {
|
||||||
|
let pos = positionMetadata[pn];
|
||||||
|
let field = pos.field;
|
||||||
|
|
||||||
|
let upperCase = field.toUpperCase();
|
||||||
|
expect(() => singularity.applyToCompany(ctx)(cn, upperCase)).not.toThrow();
|
||||||
|
Player.quitJob(cn);
|
||||||
|
|
||||||
|
let lowerCase = field.toLowerCase();
|
||||||
|
expect(() => singularity.applyToCompany(ctx)(cn, lowerCase)).not.toThrow();
|
||||||
|
Player.quitJob(cn);
|
||||||
|
|
||||||
|
let brokenCasing = field
|
||||||
|
.split("")
|
||||||
|
.map((c, i) => (i % 2 == 0 ? c.toUpperCase() : c.toLowerCase()))
|
||||||
|
.join("");
|
||||||
|
expect(() => singularity.applyToCompany(ctx)(cn, brokenCasing)).not.toThrow();
|
||||||
|
Player.quitJob(cn);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue
Block a user