API: Updating typing for ns.singularity.getCurrentWork() (#989)

This commit is contained in:
Rinne 2023-12-27 08:06:45 -03:00 committed by GitHub
parent 550829a1c3
commit eba840dcd3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
47 changed files with 514 additions and 29 deletions

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [bitburner](./bitburner.md) &gt; [CompanyWorkTask](./bitburner.companyworktask.md) &gt; [companyName](./bitburner.companyworktask.companyname.md)
## CompanyWorkTask.companyName property
**Signature:**
```typescript
companyName: CompanyName;
```

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [bitburner](./bitburner.md) &gt; [CompanyWorkTask](./bitburner.companyworktask.md) &gt; [cyclesWorked](./bitburner.companyworktask.cyclesworked.md)
## CompanyWorkTask.cyclesWorked property
**Signature:**
```typescript
cyclesWorked: number;
```

@ -0,0 +1,26 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [bitburner](./bitburner.md) &gt; [CompanyWorkTask](./bitburner.companyworktask.md)
## CompanyWorkTask interface
Company Work
**Signature:**
```typescript
export interface CompanyWorkTask
```
## Remarks
An object representing the current work for a company
## Properties
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [companyName](./bitburner.companyworktask.companyname.md) | | [CompanyName](./bitburner.companyname.md) | |
| [cyclesWorked](./bitburner.companyworktask.cyclesworked.md) | | number | |
| [type](./bitburner.companyworktask.type.md) | | "COMPANY" | |

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [bitburner](./bitburner.md) &gt; [CompanyWorkTask](./bitburner.companyworktask.md) &gt; [type](./bitburner.companyworktask.type.md)
## CompanyWorkTask.type property
**Signature:**
```typescript
type: "COMPANY";
```

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [bitburner](./bitburner.md) &gt; [CreateProgramWorkTask](./bitburner.createprogramworktask.md) &gt; [cyclesWorked](./bitburner.createprogramworktask.cyclesworked.md)
## CreateProgramWorkTask.cyclesWorked property
**Signature:**
```typescript
cyclesWorked: number;
```

@ -0,0 +1,26 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [bitburner](./bitburner.md) &gt; [CreateProgramWorkTask](./bitburner.createprogramworktask.md)
## CreateProgramWorkTask interface
Create Program
**Signature:**
```typescript
export interface CreateProgramWorkTask
```
## Remarks
An object representing the status of the program being created
## Properties
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [cyclesWorked](./bitburner.createprogramworktask.cyclesworked.md) | | number | |
| [programName](./bitburner.createprogramworktask.programname.md) | | string | |
| [type](./bitburner.createprogramworktask.type.md) | | "CREATE\_PROGRAM" | |

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [bitburner](./bitburner.md) &gt; [CreateProgramWorkTask](./bitburner.createprogramworktask.md) &gt; [programName](./bitburner.createprogramworktask.programname.md)
## CreateProgramWorkTask.programName property
**Signature:**
```typescript
programName: string;
```

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [bitburner](./bitburner.md) &gt; [CreateProgramWorkTask](./bitburner.createprogramworktask.md) &gt; [type](./bitburner.createprogramworktask.type.md)
## CreateProgramWorkTask.type property
**Signature:**
```typescript
type: "CREATE_PROGRAM";
```

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [bitburner](./bitburner.md) &gt; [CrimeTask](./bitburner.crimetask.md) &gt; [crimeType](./bitburner.crimetask.crimetype.md)
## CrimeTask.crimeType property
**Signature:**
```typescript
crimeType: CrimeType;
```

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [bitburner](./bitburner.md) &gt; [CrimeTask](./bitburner.crimetask.md) &gt; [cyclesWorked](./bitburner.crimetask.cyclesworked.md)
## CrimeTask.cyclesWorked property
**Signature:**
```typescript
cyclesWorked: number;
```

@ -0,0 +1,26 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [bitburner](./bitburner.md) &gt; [CrimeTask](./bitburner.crimetask.md)
## CrimeTask interface
Crime
**Signature:**
```typescript
export interface CrimeTask
```
## Remarks
An object representing the crime being commited
## Properties
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [crimeType](./bitburner.crimetask.crimetype.md) | | [CrimeType](./bitburner.crimetype.md) | |
| [cyclesWorked](./bitburner.crimetask.cyclesworked.md) | | number | |
| [type](./bitburner.crimetask.type.md) | | "CRIME" | |

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [bitburner](./bitburner.md) &gt; [CrimeTask](./bitburner.crimetask.md) &gt; [type](./bitburner.crimetask.type.md)
## CrimeTask.type property
**Signature:**
```typescript
type: "CRIME";
```

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [bitburner](./bitburner.md) &gt; [FactionWorkTask](./bitburner.factionworktask.md) &gt; [cyclesWorked](./bitburner.factionworktask.cyclesworked.md)
## FactionWorkTask.cyclesWorked property
**Signature:**
```typescript
cyclesWorked: number;
```

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [bitburner](./bitburner.md) &gt; [FactionWorkTask](./bitburner.factionworktask.md) &gt; [factionName](./bitburner.factionworktask.factionname.md)
## FactionWorkTask.factionName property
**Signature:**
```typescript
factionName: string;
```

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [bitburner](./bitburner.md) &gt; [FactionWorkTask](./bitburner.factionworktask.md) &gt; [factionWorkType](./bitburner.factionworktask.factionworktype.md)
## FactionWorkTask.factionWorkType property
**Signature:**
```typescript
factionWorkType: FactionWorkType;
```

@ -0,0 +1,27 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [bitburner](./bitburner.md) &gt; [FactionWorkTask](./bitburner.factionworktask.md)
## FactionWorkTask interface
Faction Work
**Signature:**
```typescript
export interface FactionWorkTask
```
## Remarks
An object representing the current work for a faction
## Properties
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [cyclesWorked](./bitburner.factionworktask.cyclesworked.md) | | number | |
| [factionName](./bitburner.factionworktask.factionname.md) | | string | |
| [factionWorkType](./bitburner.factionworktask.factionworktype.md) | | [FactionWorkType](./bitburner.factionworktype.md) | |
| [type](./bitburner.factionworktask.type.md) | | "FACTION" | |

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [bitburner](./bitburner.md) &gt; [FactionWorkTask](./bitburner.factionworktask.md) &gt; [type](./bitburner.factionworktask.type.md)
## FactionWorkTask.type property
**Signature:**
```typescript
type: "FACTION";
```

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [bitburner](./bitburner.md) &gt; [GraftingTask](./bitburner.graftingtask.md) &gt; [augmentation](./bitburner.graftingtask.augmentation.md)
## GraftingTask.augmentation property
**Signature:**
```typescript
augmentation: string;
```

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [bitburner](./bitburner.md) &gt; [GraftingTask](./bitburner.graftingtask.md) &gt; [cyclesWorked](./bitburner.graftingtask.cyclesworked.md)
## GraftingTask.cyclesWorked property
**Signature:**
```typescript
cyclesWorked: number;
```

@ -0,0 +1,26 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [bitburner](./bitburner.md) &gt; [GraftingTask](./bitburner.graftingtask.md)
## GraftingTask interface
Faction Work
**Signature:**
```typescript
export interface GraftingTask
```
## Remarks
An object representing the current grafting status
## Properties
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [augmentation](./bitburner.graftingtask.augmentation.md) | | string | |
| [cyclesWorked](./bitburner.graftingtask.cyclesworked.md) | | number | |
| [type](./bitburner.graftingtask.type.md) | | "GRAFTING" | |

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [bitburner](./bitburner.md) &gt; [GraftingTask](./bitburner.graftingtask.md) &gt; [type](./bitburner.graftingtask.type.md)
## GraftingTask.type property
**Signature:**
```typescript
type: "GRAFTING";
```

@ -39,18 +39,22 @@
| [CodingContract](./bitburner.codingcontract.md) | Coding Contract API | | [CodingContract](./bitburner.codingcontract.md) | Coding Contract API |
| [CompanyPositionInfo](./bitburner.companypositioninfo.md) | Company position requirements and salary. | | [CompanyPositionInfo](./bitburner.companypositioninfo.md) | Company position requirements and salary. |
| [CompanyReputationRequirement](./bitburner.companyreputationrequirement.md) | Player must have at least this much reputation with this company. | | [CompanyReputationRequirement](./bitburner.companyreputationrequirement.md) | Player must have at least this much reputation with this company. |
| [CompanyWorkTask](./bitburner.companyworktask.md) | Company Work |
| [CorpConstants](./bitburner.corpconstants.md) | Corporation related constants | | [CorpConstants](./bitburner.corpconstants.md) | Corporation related constants |
| [CorpIndustryData](./bitburner.corpindustrydata.md) | Data for an individual industry | | [CorpIndustryData](./bitburner.corpindustrydata.md) | Data for an individual industry |
| [CorpMaterialConstantData](./bitburner.corpmaterialconstantdata.md) | Corporation material information | | [CorpMaterialConstantData](./bitburner.corpmaterialconstantdata.md) | Corporation material information |
| [Corporation](./bitburner.corporation.md) | Corporation API | | [Corporation](./bitburner.corporation.md) | Corporation API |
| [CorporationInfo](./bitburner.corporationinfo.md) | General info about a corporation | | [CorporationInfo](./bitburner.corporationinfo.md) | General info about a corporation |
| [CorpProductData](./bitburner.corpproductdata.md) | Product rating information | | [CorpProductData](./bitburner.corpproductdata.md) | Product rating information |
| [CreateProgramWorkTask](./bitburner.createprogramworktask.md) | Create Program |
| [CrimeStats](./bitburner.crimestats.md) | Data representing the internal values of a crime. | | [CrimeStats](./bitburner.crimestats.md) | Data representing the internal values of a crime. |
| [CrimeTask](./bitburner.crimetask.md) | Crime |
| [Division](./bitburner.division.md) | Corporation division | | [Division](./bitburner.division.md) | Corporation division |
| [EmployedByRequirement](./bitburner.employedbyrequirement.md) | Player must be working for this company. | | [EmployedByRequirement](./bitburner.employedbyrequirement.md) | Player must be working for this company. |
| [EquipmentStats](./bitburner.equipmentstats.md) | Object representing data representing a gang member equipment. | | [EquipmentStats](./bitburner.equipmentstats.md) | Object representing data representing a gang member equipment. |
| [EveryRequirement](./bitburner.everyrequirement.md) | All sub-conditions must be satisfied. | | [EveryRequirement](./bitburner.everyrequirement.md) | All sub-conditions must be satisfied. |
| [Export](./bitburner.export.md) | Export order for a material | | [Export](./bitburner.export.md) | Export order for a material |
| [FactionWorkTask](./bitburner.factionworktask.md) | Faction Work |
| [FileRequirement](./bitburner.filerequirement.md) | Player must have a specific Literature or Message file on their home computer. | | [FileRequirement](./bitburner.filerequirement.md) | Player must have a specific Literature or Message file on their home computer. |
| [Formulas](./bitburner.formulas.md) | Formulas API | | [Formulas](./bitburner.formulas.md) | Formulas API |
| [Fragment](./bitburner.fragment.md) | | | [Fragment](./bitburner.fragment.md) | |
@ -66,6 +70,7 @@
| [GangTerritory](./bitburner.gangterritory.md) | | | [GangTerritory](./bitburner.gangterritory.md) | |
| [Go](./bitburner.go.md) | IPvGO api | | [Go](./bitburner.go.md) | IPvGO api |
| [Grafting](./bitburner.grafting.md) | Grafting API | | [Grafting](./bitburner.grafting.md) | Grafting API |
| [GraftingTask](./bitburner.graftingtask.md) | Faction Work |
| [HackingFormulas](./bitburner.hackingformulas.md) | Hacking formulas | | [HackingFormulas](./bitburner.hackingformulas.md) | Hacking formulas |
| [HackingMultipliers](./bitburner.hackingmultipliers.md) | Hack related multipliers. | | [HackingMultipliers](./bitburner.hackingmultipliers.md) | Hack related multipliers. |
| [Hacknet](./bitburner.hacknet.md) | Hacknet API | | [Hacknet](./bitburner.hacknet.md) | Hacknet API |
@ -127,6 +132,7 @@
| [StockMarketConstants](./bitburner.stockmarketconstants.md) | Constants used for the stockmarket game mechanic. | | [StockMarketConstants](./bitburner.stockmarketconstants.md) | Constants used for the stockmarket game mechanic. |
| [StockOrder](./bitburner.stockorder.md) | <p>Return value of [getOrders](./bitburner.tix.getorders.md)</p><p>Keys are stock symbols, properties are arrays of [StockOrderObject](./bitburner.stockorderobject.md)</p> | | [StockOrder](./bitburner.stockorder.md) | <p>Return value of [getOrders](./bitburner.tix.getorders.md)</p><p>Keys are stock symbols, properties are arrays of [StockOrderObject](./bitburner.stockorderobject.md)</p> |
| [StockOrderObject](./bitburner.stockorderobject.md) | Value in map of [StockOrder](./bitburner.stockorder.md) | | [StockOrderObject](./bitburner.stockorderobject.md) | Value in map of [StockOrder](./bitburner.stockorder.md) |
| [StudyTask](./bitburner.studytask.md) | Study |
| [TailProperties](./bitburner.tailproperties.md) | | | [TailProperties](./bitburner.tailproperties.md) | |
| [TIX](./bitburner.tix.md) | Stock market API | | [TIX](./bitburner.tix.md) | Stock market API |
| [UserInterface](./bitburner.userinterface.md) | User Interface API. | | [UserInterface](./bitburner.userinterface.md) | User Interface API. |
@ -166,4 +172,5 @@
| [SleeveSupportTask](./bitburner.sleevesupporttask.md) | | | [SleeveSupportTask](./bitburner.sleevesupporttask.md) | |
| [SleeveSynchroTask](./bitburner.sleevesynchrotask.md) | | | [SleeveSynchroTask](./bitburner.sleevesynchrotask.md) | |
| [SleeveTask](./bitburner.sleevetask.md) | Object representing a sleeve current task. | | [SleeveTask](./bitburner.sleevetask.md) | Object representing a sleeve current task. |
| [Task](./bitburner.task.md) | Task |

@ -9,11 +9,11 @@ Get the current work the player is doing.
**Signature:** **Signature:**
```typescript ```typescript
getCurrentWork(): any | null; getCurrentWork(): Task | null;
``` ```
**Returns:** **Returns:**
any \| null [Task](./bitburner.task.md) \| null
- An object representing the current work. Fields depend on the kind of work. - An object representing the current work. Fields depend on the kind of work.

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [bitburner](./bitburner.md) &gt; [StudyTask](./bitburner.studytask.md) &gt; [classType](./bitburner.studytask.classtype.md)
## StudyTask.classType property
**Signature:**
```typescript
classType: string;
```

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [bitburner](./bitburner.md) &gt; [StudyTask](./bitburner.studytask.md) &gt; [cyclesWorked](./bitburner.studytask.cyclesworked.md)
## StudyTask.cyclesWorked property
**Signature:**
```typescript
cyclesWorked: number;
```

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [bitburner](./bitburner.md) &gt; [StudyTask](./bitburner.studytask.md) &gt; [location](./bitburner.studytask.location.md)
## StudyTask.location property
**Signature:**
```typescript
location: string;
```

@ -0,0 +1,27 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [bitburner](./bitburner.md) &gt; [StudyTask](./bitburner.studytask.md)
## StudyTask interface
Study
**Signature:**
```typescript
export interface StudyTask
```
## Remarks
An object representing the current study task
## Properties
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [classType](./bitburner.studytask.classtype.md) | | string | |
| [cyclesWorked](./bitburner.studytask.cyclesworked.md) | | number | |
| [location](./bitburner.studytask.location.md) | | string | |
| [type](./bitburner.studytask.type.md) | | "CLASS" | |

@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [bitburner](./bitburner.md) &gt; [StudyTask](./bitburner.studytask.md) &gt; [type](./bitburner.studytask.type.md)
## StudyTask.type property
**Signature:**
```typescript
type: "CLASS";
```

@ -0,0 +1,19 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) &gt; [bitburner](./bitburner.md) &gt; [Task](./bitburner.task.md)
## Task type
Task
**Signature:**
```typescript
export type Task = StudyTask | CompanyWorkTask | CreateProgramWorkTask | CrimeTask | FactionWorkTask | GraftingTask;
```
**References:** [StudyTask](./bitburner.studytask.md)<!-- -->, [CompanyWorkTask](./bitburner.companyworktask.md)<!-- -->, [CreateProgramWorkTask](./bitburner.createprogramworktask.md)<!-- -->, [CrimeTask](./bitburner.crimetask.md)<!-- -->, [FactionWorkTask](./bitburner.factionworktask.md)<!-- -->, [GraftingTask](./bitburner.graftingtask.md)
## Remarks
Represents any task, such as studying, working for a faction etc.

@ -1,4 +1,4 @@
import type { Singularity as ISingularity } from "@nsdefs"; import type { Singularity as ISingularity, Task as ITask } from "@nsdefs";
import { Player } from "@player"; import { Player } from "@player";
import { import {
@ -1137,7 +1137,7 @@ export function NetscriptSingularity(): InternalAPI<ISingularity> {
getCurrentWork: (ctx) => () => { getCurrentWork: (ctx) => () => {
helpers.checkSingularityAccess(ctx); helpers.checkSingularityAccess(ctx);
if (!Player.currentWork) return null; if (!Player.currentWork) return null;
return Player.currentWork.APICopy(); return Player.currentWork.APICopy() as ITask;
}, },
exportGame: (ctx) => () => { exportGame: (ctx) => () => {
helpers.checkSingularityAccess(ctx); helpers.checkSingularityAccess(ctx);

@ -81,7 +81,7 @@ export class SleeveBladeburnerWork extends SleeveWorkClass {
APICopy(sleeve: Sleeve) { APICopy(sleeve: Sleeve) {
return { return {
type: SleeveWorkType.BLADEBURNER as "BLADEBURNER", type: SleeveWorkType.BLADEBURNER as const,
actionType: this.actionType, actionType: this.actionType,
actionName: this.actionName, actionName: this.actionName,
tasksCompleted: this.tasksCompleted, tasksCompleted: this.tasksCompleted,

@ -42,7 +42,7 @@ export class SleeveClassWork extends SleeveWorkClass {
APICopy() { APICopy() {
return { return {
type: SleeveWorkType.CLASS as "CLASS", type: SleeveWorkType.CLASS as const,
classType: this.classType, classType: this.classType,
location: this.location, location: this.location,
}; };

@ -49,7 +49,7 @@ export class SleeveCompanyWork extends SleeveWorkClass {
APICopy() { APICopy() {
return { return {
type: SleeveWorkType.COMPANY as "COMPANY", type: SleeveWorkType.COMPANY as const,
companyName: this.companyName, companyName: this.companyName,
}; };
} }

@ -55,7 +55,7 @@ export class SleeveCrimeWork extends SleeveWorkClass {
APICopy() { APICopy() {
return { return {
type: SleeveWorkType.CRIME as "CRIME", type: SleeveWorkType.CRIME as const,
crimeType: this.crimeType, crimeType: this.crimeType,
tasksCompleted: this.tasksCompleted, tasksCompleted: this.tasksCompleted,
cyclesWorked: this.cyclesWorked, cyclesWorked: this.cyclesWorked,

@ -53,7 +53,7 @@ export class SleeveFactionWork extends SleeveWorkClass {
APICopy() { APICopy() {
return { return {
type: SleeveWorkType.FACTION as "FACTION", type: SleeveWorkType.FACTION as const,
factionWorkType: this.factionWorkType, factionWorkType: this.factionWorkType,
factionName: this.factionName, factionName: this.factionName,
}; };

@ -28,7 +28,7 @@ export class SleeveInfiltrateWork extends SleeveWorkClass {
APICopy() { APICopy() {
return { return {
type: SleeveWorkType.INFILTRATE as "INFILTRATE", type: SleeveWorkType.INFILTRATE as const,
cyclesWorked: this.cyclesWorked, cyclesWorked: this.cyclesWorked,
cyclesNeeded: this.cyclesNeeded(), cyclesNeeded: this.cyclesNeeded(),
}; };

@ -18,7 +18,7 @@ export class SleeveRecoveryWork extends SleeveWorkClass {
} }
APICopy() { APICopy() {
return { type: SleeveWorkType.RECOVERY as "RECOVERY" }; return { type: SleeveWorkType.RECOVERY as const };
} }
/** Serialize the current object to a JSON save state. */ /** Serialize the current object to a JSON save state. */

@ -21,7 +21,7 @@ export class SleeveSupportWork extends SleeveWorkClass {
} }
APICopy() { APICopy() {
return { type: SleeveWorkType.SUPPORT as "SUPPORT" }; return { type: SleeveWorkType.SUPPORT as const };
} }
/** Serialize the current object to a JSON save state. */ /** Serialize the current object to a JSON save state. */

@ -19,7 +19,7 @@ export class SleeveSynchroWork extends SleeveWorkClass {
} }
APICopy() { APICopy() {
return { type: SleeveWorkType.SYNCHRO as "SYNCHRO" }; return { type: SleeveWorkType.SYNCHRO as const };
} }
/** Serialize the current object to a JSON save state. */ /** Serialize the current object to a JSON save state. */

@ -1579,6 +1579,87 @@ export interface TIX {
nextUpdate(): Promise<number>; nextUpdate(): Promise<number>;
} }
/**
* Study
* @remarks
* An object representing the current study task
* @public
*/
export interface StudyTask {
type: "CLASS";
cyclesWorked: number;
classType: string;
location: string;
}
/**
* Company Work
* @remarks
* An object representing the current work for a company
* @public
*/
export interface CompanyWorkTask {
type: "COMPANY";
cyclesWorked: number;
companyName: CompanyName;
}
/**
* Create Program
* @remarks
* An object representing the status of the program being created
* @public
*/
export interface CreateProgramWorkTask {
type: "CREATE_PROGRAM";
cyclesWorked: number;
programName: string;
}
/**
* Crime
* @remarks
* An object representing the crime being commited
* @public
*/
export interface CrimeTask {
type: "CRIME";
cyclesWorked: number;
crimeType: CrimeType;
}
/**
* Faction Work
* @remarks
* An object representing the current work for a faction
* @public
*/
export interface FactionWorkTask {
type: "FACTION";
cyclesWorked: number;
factionWorkType: FactionWorkType;
factionName: string;
}
/**
* Faction Work
* @remarks
* An object representing the current grafting status
* @public
*/
export interface GraftingTask {
type: "GRAFTING";
cyclesWorked: number;
augmentation: string;
}
/**
* Task
* @remarks
* Represents any task, such as studying, working for a faction etc.
* @public
*/
export type Task = StudyTask | CompanyWorkTask | CreateProgramWorkTask | CrimeTask | FactionWorkTask | GraftingTask;
/** /**
* Singularity API * Singularity API
* @remarks * @remarks
@ -2487,7 +2568,7 @@ export interface Singularity {
* *
* @returns - An object representing the current work. Fields depend on the kind of work. * @returns - An object representing the current work. Fields depend on the kind of work.
*/ */
getCurrentWork(): any | null; getCurrentWork(): Task | null;
} }
/** /**

@ -79,7 +79,6 @@ interface ClassWorkParams {
} }
export const isClassWork = (w: Work | null): w is ClassWork => w !== null && w.type === WorkType.CLASS; export const isClassWork = (w: Work | null): w is ClassWork => w !== null && w.type === WorkType.CLASS;
export class ClassWork extends Work { export class ClassWork extends Work {
classType: ClassType; classType: ClassType;
location: LocationName; location: LocationName;
@ -132,9 +131,9 @@ export class ClassWork extends Work {
} }
} }
APICopy(): Record<string, unknown> { APICopy() {
return { return {
type: this.type, type: WorkType.CLASS as const,
cyclesWorked: this.cyclesWorked, cyclesWorked: this.cyclesWorked,
classType: this.classType, classType: this.classType,
location: this.location, location: this.location,

@ -61,9 +61,9 @@ export class CompanyWork extends Work {
} }
} }
APICopy(): Record<string, unknown> { APICopy() {
return { return {
type: this.type, type: WorkType.COMPANY as const,
cyclesWorked: this.cyclesWorked, cyclesWorked: this.cyclesWorked,
companyName: this.companyName, companyName: this.companyName,
}; };

@ -96,9 +96,9 @@ export class CreateProgramWork extends Work {
} }
} }
APICopy(): Record<string, unknown> { APICopy() {
return { return {
type: this.type, type: WorkType.CREATE_PROGRAM as const,
cyclesWorked: this.cyclesWorked, cyclesWorked: this.cyclesWorked,
programName: this.programName, programName: this.programName,
}; };

@ -82,9 +82,9 @@ export class CrimeWork extends Work {
/** nothing to do */ /** nothing to do */
} }
APICopy(): Record<string, unknown> { APICopy() {
return { return {
type: this.type, type: WorkType.CRIME as const,
cyclesWorked: this.cyclesWorked, cyclesWorked: this.cyclesWorked,
crimeType: this.crimeType, crimeType: this.crimeType,
}; };

@ -67,9 +67,9 @@ export class FactionWork extends Work {
} }
} }
APICopy(): Record<string, unknown> { APICopy() {
return { return {
type: this.type, type: WorkType.FACTION as const,
cyclesWorked: this.cyclesWorked, cyclesWorked: this.cyclesWorked,
factionWorkType: this.factionWorkType, factionWorkType: this.factionWorkType,
factionName: this.factionName, factionName: this.factionName,

@ -79,9 +79,9 @@ export class GraftingWork extends Work {
} }
} }
APICopy(): Record<string, unknown> { APICopy() {
return { return {
type: this.type, type: WorkType.GRAFTING as const,
cyclesWorked: this.cyclesWorked, cyclesWorked: this.cyclesWorked,
augmentation: this.augmentation, augmentation: this.augmentation,
}; };

@ -1,4 +1,5 @@
import { IReviverValue } from "../utils/JSONReviver"; import type { IReviverValue } from "../utils/JSONReviver";
import type { Task } from "@nsdefs";
export abstract class Work { export abstract class Work {
type: WorkType; type: WorkType;
@ -13,7 +14,7 @@ export abstract class Work {
abstract process(cycles: number): boolean; abstract process(cycles: number): boolean;
abstract finish(cancelled: boolean, suppressDialog?: boolean): void; abstract finish(cancelled: boolean, suppressDialog?: boolean): void;
abstract APICopy(): Record<string, unknown>; abstract APICopy(): Task;
abstract toJSON(): IReviverValue; abstract toJSON(): IReviverValue;
} }