diff --git a/markdown/bitburner.companyworktask.companyname.md b/markdown/bitburner.companyworktask.companyname.md new file mode 100644 index 000000000..83ce57cb7 --- /dev/null +++ b/markdown/bitburner.companyworktask.companyname.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [CompanyWorkTask](./bitburner.companyworktask.md) > [companyName](./bitburner.companyworktask.companyname.md) + +## CompanyWorkTask.companyName property + +**Signature:** + +```typescript +companyName: CompanyName; +``` diff --git a/markdown/bitburner.companyworktask.cyclesworked.md b/markdown/bitburner.companyworktask.cyclesworked.md new file mode 100644 index 000000000..fded2478d --- /dev/null +++ b/markdown/bitburner.companyworktask.cyclesworked.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [CompanyWorkTask](./bitburner.companyworktask.md) > [cyclesWorked](./bitburner.companyworktask.cyclesworked.md) + +## CompanyWorkTask.cyclesWorked property + +**Signature:** + +```typescript +cyclesWorked: number; +``` diff --git a/markdown/bitburner.companyworktask.md b/markdown/bitburner.companyworktask.md new file mode 100644 index 000000000..93f333250 --- /dev/null +++ b/markdown/bitburner.companyworktask.md @@ -0,0 +1,26 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [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" | | + diff --git a/markdown/bitburner.companyworktask.type.md b/markdown/bitburner.companyworktask.type.md new file mode 100644 index 000000000..0da12ed05 --- /dev/null +++ b/markdown/bitburner.companyworktask.type.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [CompanyWorkTask](./bitburner.companyworktask.md) > [type](./bitburner.companyworktask.type.md) + +## CompanyWorkTask.type property + +**Signature:** + +```typescript +type: "COMPANY"; +``` diff --git a/markdown/bitburner.createprogramworktask.cyclesworked.md b/markdown/bitburner.createprogramworktask.cyclesworked.md new file mode 100644 index 000000000..fb9219eea --- /dev/null +++ b/markdown/bitburner.createprogramworktask.cyclesworked.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [CreateProgramWorkTask](./bitburner.createprogramworktask.md) > [cyclesWorked](./bitburner.createprogramworktask.cyclesworked.md) + +## CreateProgramWorkTask.cyclesWorked property + +**Signature:** + +```typescript +cyclesWorked: number; +``` diff --git a/markdown/bitburner.createprogramworktask.md b/markdown/bitburner.createprogramworktask.md new file mode 100644 index 000000000..87761c013 --- /dev/null +++ b/markdown/bitburner.createprogramworktask.md @@ -0,0 +1,26 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [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" | | + diff --git a/markdown/bitburner.createprogramworktask.programname.md b/markdown/bitburner.createprogramworktask.programname.md new file mode 100644 index 000000000..92b50755a --- /dev/null +++ b/markdown/bitburner.createprogramworktask.programname.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [CreateProgramWorkTask](./bitburner.createprogramworktask.md) > [programName](./bitburner.createprogramworktask.programname.md) + +## CreateProgramWorkTask.programName property + +**Signature:** + +```typescript +programName: string; +``` diff --git a/markdown/bitburner.createprogramworktask.type.md b/markdown/bitburner.createprogramworktask.type.md new file mode 100644 index 000000000..129d303ae --- /dev/null +++ b/markdown/bitburner.createprogramworktask.type.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [CreateProgramWorkTask](./bitburner.createprogramworktask.md) > [type](./bitburner.createprogramworktask.type.md) + +## CreateProgramWorkTask.type property + +**Signature:** + +```typescript +type: "CREATE_PROGRAM"; +``` diff --git a/markdown/bitburner.crimetask.crimetype.md b/markdown/bitburner.crimetask.crimetype.md new file mode 100644 index 000000000..0f97b8532 --- /dev/null +++ b/markdown/bitburner.crimetask.crimetype.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [CrimeTask](./bitburner.crimetask.md) > [crimeType](./bitburner.crimetask.crimetype.md) + +## CrimeTask.crimeType property + +**Signature:** + +```typescript +crimeType: CrimeType; +``` diff --git a/markdown/bitburner.crimetask.cyclesworked.md b/markdown/bitburner.crimetask.cyclesworked.md new file mode 100644 index 000000000..85f3fb4fb --- /dev/null +++ b/markdown/bitburner.crimetask.cyclesworked.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [CrimeTask](./bitburner.crimetask.md) > [cyclesWorked](./bitburner.crimetask.cyclesworked.md) + +## CrimeTask.cyclesWorked property + +**Signature:** + +```typescript +cyclesWorked: number; +``` diff --git a/markdown/bitburner.crimetask.md b/markdown/bitburner.crimetask.md new file mode 100644 index 000000000..3a1e09daa --- /dev/null +++ b/markdown/bitburner.crimetask.md @@ -0,0 +1,26 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [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" | | + diff --git a/markdown/bitburner.crimetask.type.md b/markdown/bitburner.crimetask.type.md new file mode 100644 index 000000000..19b77cc0a --- /dev/null +++ b/markdown/bitburner.crimetask.type.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [CrimeTask](./bitburner.crimetask.md) > [type](./bitburner.crimetask.type.md) + +## CrimeTask.type property + +**Signature:** + +```typescript +type: "CRIME"; +``` diff --git a/markdown/bitburner.factionworktask.cyclesworked.md b/markdown/bitburner.factionworktask.cyclesworked.md new file mode 100644 index 000000000..a2efbe5a1 --- /dev/null +++ b/markdown/bitburner.factionworktask.cyclesworked.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [FactionWorkTask](./bitburner.factionworktask.md) > [cyclesWorked](./bitburner.factionworktask.cyclesworked.md) + +## FactionWorkTask.cyclesWorked property + +**Signature:** + +```typescript +cyclesWorked: number; +``` diff --git a/markdown/bitburner.factionworktask.factionname.md b/markdown/bitburner.factionworktask.factionname.md new file mode 100644 index 000000000..a9da361eb --- /dev/null +++ b/markdown/bitburner.factionworktask.factionname.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [FactionWorkTask](./bitburner.factionworktask.md) > [factionName](./bitburner.factionworktask.factionname.md) + +## FactionWorkTask.factionName property + +**Signature:** + +```typescript +factionName: string; +``` diff --git a/markdown/bitburner.factionworktask.factionworktype.md b/markdown/bitburner.factionworktask.factionworktype.md new file mode 100644 index 000000000..d43c1b3ab --- /dev/null +++ b/markdown/bitburner.factionworktask.factionworktype.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [FactionWorkTask](./bitburner.factionworktask.md) > [factionWorkType](./bitburner.factionworktask.factionworktype.md) + +## FactionWorkTask.factionWorkType property + +**Signature:** + +```typescript +factionWorkType: FactionWorkType; +``` diff --git a/markdown/bitburner.factionworktask.md b/markdown/bitburner.factionworktask.md new file mode 100644 index 000000000..93ed97e6a --- /dev/null +++ b/markdown/bitburner.factionworktask.md @@ -0,0 +1,27 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [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" | | + diff --git a/markdown/bitburner.factionworktask.type.md b/markdown/bitburner.factionworktask.type.md new file mode 100644 index 000000000..e429947c4 --- /dev/null +++ b/markdown/bitburner.factionworktask.type.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [FactionWorkTask](./bitburner.factionworktask.md) > [type](./bitburner.factionworktask.type.md) + +## FactionWorkTask.type property + +**Signature:** + +```typescript +type: "FACTION"; +``` diff --git a/markdown/bitburner.graftingtask.augmentation.md b/markdown/bitburner.graftingtask.augmentation.md new file mode 100644 index 000000000..8d165142d --- /dev/null +++ b/markdown/bitburner.graftingtask.augmentation.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [GraftingTask](./bitburner.graftingtask.md) > [augmentation](./bitburner.graftingtask.augmentation.md) + +## GraftingTask.augmentation property + +**Signature:** + +```typescript +augmentation: string; +``` diff --git a/markdown/bitburner.graftingtask.cyclesworked.md b/markdown/bitburner.graftingtask.cyclesworked.md new file mode 100644 index 000000000..0fff6658f --- /dev/null +++ b/markdown/bitburner.graftingtask.cyclesworked.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [GraftingTask](./bitburner.graftingtask.md) > [cyclesWorked](./bitburner.graftingtask.cyclesworked.md) + +## GraftingTask.cyclesWorked property + +**Signature:** + +```typescript +cyclesWorked: number; +``` diff --git a/markdown/bitburner.graftingtask.md b/markdown/bitburner.graftingtask.md new file mode 100644 index 000000000..0044f7c21 --- /dev/null +++ b/markdown/bitburner.graftingtask.md @@ -0,0 +1,26 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [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" | | + diff --git a/markdown/bitburner.graftingtask.type.md b/markdown/bitburner.graftingtask.type.md new file mode 100644 index 000000000..76b86ab50 --- /dev/null +++ b/markdown/bitburner.graftingtask.type.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [GraftingTask](./bitburner.graftingtask.md) > [type](./bitburner.graftingtask.type.md) + +## GraftingTask.type property + +**Signature:** + +```typescript +type: "GRAFTING"; +``` diff --git a/markdown/bitburner.md b/markdown/bitburner.md index d014d379c..e14eaea8b 100644 --- a/markdown/bitburner.md +++ b/markdown/bitburner.md @@ -39,18 +39,22 @@ | [CodingContract](./bitburner.codingcontract.md) | Coding Contract API | | [CompanyPositionInfo](./bitburner.companypositioninfo.md) | Company position requirements and salary. | | [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 | | [CorpIndustryData](./bitburner.corpindustrydata.md) | Data for an individual industry | | [CorpMaterialConstantData](./bitburner.corpmaterialconstantdata.md) | Corporation material information | | [Corporation](./bitburner.corporation.md) | Corporation API | | [CorporationInfo](./bitburner.corporationinfo.md) | General info about a corporation | | [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. | +| [CrimeTask](./bitburner.crimetask.md) | Crime | | [Division](./bitburner.division.md) | Corporation division | | [EmployedByRequirement](./bitburner.employedbyrequirement.md) | Player must be working for this company. | | [EquipmentStats](./bitburner.equipmentstats.md) | Object representing data representing a gang member equipment. | | [EveryRequirement](./bitburner.everyrequirement.md) | All sub-conditions must be satisfied. | | [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. | | [Formulas](./bitburner.formulas.md) | Formulas API | | [Fragment](./bitburner.fragment.md) | | @@ -66,6 +70,7 @@ | [GangTerritory](./bitburner.gangterritory.md) | | | [Go](./bitburner.go.md) | IPvGO api | | [Grafting](./bitburner.grafting.md) | Grafting API | +| [GraftingTask](./bitburner.graftingtask.md) | Faction Work | | [HackingFormulas](./bitburner.hackingformulas.md) | Hacking formulas | | [HackingMultipliers](./bitburner.hackingmultipliers.md) | Hack related multipliers. | | [Hacknet](./bitburner.hacknet.md) | Hacknet API | @@ -127,6 +132,7 @@ | [StockMarketConstants](./bitburner.stockmarketconstants.md) | Constants used for the stockmarket game mechanic. | | [StockOrder](./bitburner.stockorder.md) |

Return value of [getOrders](./bitburner.tix.getorders.md)

Keys are stock symbols, properties are arrays of [StockOrderObject](./bitburner.stockorderobject.md)

| | [StockOrderObject](./bitburner.stockorderobject.md) | Value in map of [StockOrder](./bitburner.stockorder.md) | +| [StudyTask](./bitburner.studytask.md) | Study | | [TailProperties](./bitburner.tailproperties.md) | | | [TIX](./bitburner.tix.md) | Stock market API | | [UserInterface](./bitburner.userinterface.md) | User Interface API. | @@ -166,4 +172,5 @@ | [SleeveSupportTask](./bitburner.sleevesupporttask.md) | | | [SleeveSynchroTask](./bitburner.sleevesynchrotask.md) | | | [SleeveTask](./bitburner.sleevetask.md) | Object representing a sleeve current task. | +| [Task](./bitburner.task.md) | Task | diff --git a/markdown/bitburner.singularity.getcurrentwork.md b/markdown/bitburner.singularity.getcurrentwork.md index 8bf524a46..11673c094 100644 --- a/markdown/bitburner.singularity.getcurrentwork.md +++ b/markdown/bitburner.singularity.getcurrentwork.md @@ -9,11 +9,11 @@ Get the current work the player is doing. **Signature:** ```typescript -getCurrentWork(): any | null; +getCurrentWork(): Task | null; ``` **Returns:** -any \| null +[Task](./bitburner.task.md) \| null - An object representing the current work. Fields depend on the kind of work. diff --git a/markdown/bitburner.studytask.classtype.md b/markdown/bitburner.studytask.classtype.md new file mode 100644 index 000000000..c29d83115 --- /dev/null +++ b/markdown/bitburner.studytask.classtype.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [StudyTask](./bitburner.studytask.md) > [classType](./bitburner.studytask.classtype.md) + +## StudyTask.classType property + +**Signature:** + +```typescript +classType: string; +``` diff --git a/markdown/bitburner.studytask.cyclesworked.md b/markdown/bitburner.studytask.cyclesworked.md new file mode 100644 index 000000000..68ccbb8a6 --- /dev/null +++ b/markdown/bitburner.studytask.cyclesworked.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [StudyTask](./bitburner.studytask.md) > [cyclesWorked](./bitburner.studytask.cyclesworked.md) + +## StudyTask.cyclesWorked property + +**Signature:** + +```typescript +cyclesWorked: number; +``` diff --git a/markdown/bitburner.studytask.location.md b/markdown/bitburner.studytask.location.md new file mode 100644 index 000000000..387fd9b2f --- /dev/null +++ b/markdown/bitburner.studytask.location.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [StudyTask](./bitburner.studytask.md) > [location](./bitburner.studytask.location.md) + +## StudyTask.location property + +**Signature:** + +```typescript +location: string; +``` diff --git a/markdown/bitburner.studytask.md b/markdown/bitburner.studytask.md new file mode 100644 index 000000000..2511b8f05 --- /dev/null +++ b/markdown/bitburner.studytask.md @@ -0,0 +1,27 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [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" | | + diff --git a/markdown/bitburner.studytask.type.md b/markdown/bitburner.studytask.type.md new file mode 100644 index 000000000..173d940bc --- /dev/null +++ b/markdown/bitburner.studytask.type.md @@ -0,0 +1,11 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [StudyTask](./bitburner.studytask.md) > [type](./bitburner.studytask.type.md) + +## StudyTask.type property + +**Signature:** + +```typescript +type: "CLASS"; +``` diff --git a/markdown/bitburner.task.md b/markdown/bitburner.task.md new file mode 100644 index 000000000..4ef68ec48 --- /dev/null +++ b/markdown/bitburner.task.md @@ -0,0 +1,19 @@ + + +[Home](./index.md) > [bitburner](./bitburner.md) > [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. + diff --git a/src/NetscriptFunctions/Singularity.ts b/src/NetscriptFunctions/Singularity.ts index c0a89863d..6a2efb32b 100644 --- a/src/NetscriptFunctions/Singularity.ts +++ b/src/NetscriptFunctions/Singularity.ts @@ -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 { @@ -1137,7 +1137,7 @@ export function NetscriptSingularity(): InternalAPI { getCurrentWork: (ctx) => () => { helpers.checkSingularityAccess(ctx); if (!Player.currentWork) return null; - return Player.currentWork.APICopy(); + return Player.currentWork.APICopy() as ITask; }, exportGame: (ctx) => () => { helpers.checkSingularityAccess(ctx); diff --git a/src/PersonObjects/Sleeve/Work/SleeveBladeburnerWork.ts b/src/PersonObjects/Sleeve/Work/SleeveBladeburnerWork.ts index 096b06990..ce87bea28 100644 --- a/src/PersonObjects/Sleeve/Work/SleeveBladeburnerWork.ts +++ b/src/PersonObjects/Sleeve/Work/SleeveBladeburnerWork.ts @@ -81,7 +81,7 @@ export class SleeveBladeburnerWork extends SleeveWorkClass { APICopy(sleeve: Sleeve) { return { - type: SleeveWorkType.BLADEBURNER as "BLADEBURNER", + type: SleeveWorkType.BLADEBURNER as const, actionType: this.actionType, actionName: this.actionName, tasksCompleted: this.tasksCompleted, diff --git a/src/PersonObjects/Sleeve/Work/SleeveClassWork.ts b/src/PersonObjects/Sleeve/Work/SleeveClassWork.ts index 273616446..91c4a9c78 100644 --- a/src/PersonObjects/Sleeve/Work/SleeveClassWork.ts +++ b/src/PersonObjects/Sleeve/Work/SleeveClassWork.ts @@ -42,7 +42,7 @@ export class SleeveClassWork extends SleeveWorkClass { APICopy() { return { - type: SleeveWorkType.CLASS as "CLASS", + type: SleeveWorkType.CLASS as const, classType: this.classType, location: this.location, }; diff --git a/src/PersonObjects/Sleeve/Work/SleeveCompanyWork.ts b/src/PersonObjects/Sleeve/Work/SleeveCompanyWork.ts index 5bfae23c8..4918bfb2c 100644 --- a/src/PersonObjects/Sleeve/Work/SleeveCompanyWork.ts +++ b/src/PersonObjects/Sleeve/Work/SleeveCompanyWork.ts @@ -49,7 +49,7 @@ export class SleeveCompanyWork extends SleeveWorkClass { APICopy() { return { - type: SleeveWorkType.COMPANY as "COMPANY", + type: SleeveWorkType.COMPANY as const, companyName: this.companyName, }; } diff --git a/src/PersonObjects/Sleeve/Work/SleeveCrimeWork.ts b/src/PersonObjects/Sleeve/Work/SleeveCrimeWork.ts index 18fba3e94..4d0a086d8 100644 --- a/src/PersonObjects/Sleeve/Work/SleeveCrimeWork.ts +++ b/src/PersonObjects/Sleeve/Work/SleeveCrimeWork.ts @@ -55,7 +55,7 @@ export class SleeveCrimeWork extends SleeveWorkClass { APICopy() { return { - type: SleeveWorkType.CRIME as "CRIME", + type: SleeveWorkType.CRIME as const, crimeType: this.crimeType, tasksCompleted: this.tasksCompleted, cyclesWorked: this.cyclesWorked, diff --git a/src/PersonObjects/Sleeve/Work/SleeveFactionWork.ts b/src/PersonObjects/Sleeve/Work/SleeveFactionWork.ts index 22f33848e..15b24b334 100644 --- a/src/PersonObjects/Sleeve/Work/SleeveFactionWork.ts +++ b/src/PersonObjects/Sleeve/Work/SleeveFactionWork.ts @@ -53,7 +53,7 @@ export class SleeveFactionWork extends SleeveWorkClass { APICopy() { return { - type: SleeveWorkType.FACTION as "FACTION", + type: SleeveWorkType.FACTION as const, factionWorkType: this.factionWorkType, factionName: this.factionName, }; diff --git a/src/PersonObjects/Sleeve/Work/SleeveInfiltrateWork.ts b/src/PersonObjects/Sleeve/Work/SleeveInfiltrateWork.ts index dbf6ef8f8..dc505dc64 100644 --- a/src/PersonObjects/Sleeve/Work/SleeveInfiltrateWork.ts +++ b/src/PersonObjects/Sleeve/Work/SleeveInfiltrateWork.ts @@ -28,7 +28,7 @@ export class SleeveInfiltrateWork extends SleeveWorkClass { APICopy() { return { - type: SleeveWorkType.INFILTRATE as "INFILTRATE", + type: SleeveWorkType.INFILTRATE as const, cyclesWorked: this.cyclesWorked, cyclesNeeded: this.cyclesNeeded(), }; diff --git a/src/PersonObjects/Sleeve/Work/SleeveRecoveryWork.ts b/src/PersonObjects/Sleeve/Work/SleeveRecoveryWork.ts index 717d4006b..99f0e26fb 100644 --- a/src/PersonObjects/Sleeve/Work/SleeveRecoveryWork.ts +++ b/src/PersonObjects/Sleeve/Work/SleeveRecoveryWork.ts @@ -18,7 +18,7 @@ export class SleeveRecoveryWork extends SleeveWorkClass { } APICopy() { - return { type: SleeveWorkType.RECOVERY as "RECOVERY" }; + return { type: SleeveWorkType.RECOVERY as const }; } /** Serialize the current object to a JSON save state. */ diff --git a/src/PersonObjects/Sleeve/Work/SleeveSupportWork.ts b/src/PersonObjects/Sleeve/Work/SleeveSupportWork.ts index d20f363e5..8cb1091c7 100644 --- a/src/PersonObjects/Sleeve/Work/SleeveSupportWork.ts +++ b/src/PersonObjects/Sleeve/Work/SleeveSupportWork.ts @@ -21,7 +21,7 @@ export class SleeveSupportWork extends SleeveWorkClass { } APICopy() { - return { type: SleeveWorkType.SUPPORT as "SUPPORT" }; + return { type: SleeveWorkType.SUPPORT as const }; } /** Serialize the current object to a JSON save state. */ diff --git a/src/PersonObjects/Sleeve/Work/SleeveSynchroWork.ts b/src/PersonObjects/Sleeve/Work/SleeveSynchroWork.ts index 7543137b1..c348ba2cb 100644 --- a/src/PersonObjects/Sleeve/Work/SleeveSynchroWork.ts +++ b/src/PersonObjects/Sleeve/Work/SleeveSynchroWork.ts @@ -19,7 +19,7 @@ export class SleeveSynchroWork extends SleeveWorkClass { } APICopy() { - return { type: SleeveWorkType.SYNCHRO as "SYNCHRO" }; + return { type: SleeveWorkType.SYNCHRO as const }; } /** Serialize the current object to a JSON save state. */ diff --git a/src/ScriptEditor/NetscriptDefinitions.d.ts b/src/ScriptEditor/NetscriptDefinitions.d.ts index bbbe6f873..06bb9c4b8 100644 --- a/src/ScriptEditor/NetscriptDefinitions.d.ts +++ b/src/ScriptEditor/NetscriptDefinitions.d.ts @@ -1579,6 +1579,87 @@ export interface TIX { nextUpdate(): Promise; } +/** + * 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 * @remarks @@ -2487,7 +2568,7 @@ export interface Singularity { * * @returns - An object representing the current work. Fields depend on the kind of work. */ - getCurrentWork(): any | null; + getCurrentWork(): Task | null; } /** diff --git a/src/Work/ClassWork.tsx b/src/Work/ClassWork.tsx index da3fc1e4e..1a8920ca1 100644 --- a/src/Work/ClassWork.tsx +++ b/src/Work/ClassWork.tsx @@ -79,7 +79,6 @@ interface ClassWorkParams { } export const isClassWork = (w: Work | null): w is ClassWork => w !== null && w.type === WorkType.CLASS; - export class ClassWork extends Work { classType: ClassType; location: LocationName; @@ -132,9 +131,9 @@ export class ClassWork extends Work { } } - APICopy(): Record { + APICopy() { return { - type: this.type, + type: WorkType.CLASS as const, cyclesWorked: this.cyclesWorked, classType: this.classType, location: this.location, diff --git a/src/Work/CompanyWork.tsx b/src/Work/CompanyWork.tsx index 3e8679e38..b2e27fd18 100644 --- a/src/Work/CompanyWork.tsx +++ b/src/Work/CompanyWork.tsx @@ -61,9 +61,9 @@ export class CompanyWork extends Work { } } - APICopy(): Record { + APICopy() { return { - type: this.type, + type: WorkType.COMPANY as const, cyclesWorked: this.cyclesWorked, companyName: this.companyName, }; diff --git a/src/Work/CreateProgramWork.ts b/src/Work/CreateProgramWork.ts index cf8c6d18e..c4b3d1e6e 100644 --- a/src/Work/CreateProgramWork.ts +++ b/src/Work/CreateProgramWork.ts @@ -96,9 +96,9 @@ export class CreateProgramWork extends Work { } } - APICopy(): Record { + APICopy() { return { - type: this.type, + type: WorkType.CREATE_PROGRAM as const, cyclesWorked: this.cyclesWorked, programName: this.programName, }; diff --git a/src/Work/CrimeWork.ts b/src/Work/CrimeWork.ts index 1c6cbcf8f..6dc980b75 100644 --- a/src/Work/CrimeWork.ts +++ b/src/Work/CrimeWork.ts @@ -82,9 +82,9 @@ export class CrimeWork extends Work { /** nothing to do */ } - APICopy(): Record { + APICopy() { return { - type: this.type, + type: WorkType.CRIME as const, cyclesWorked: this.cyclesWorked, crimeType: this.crimeType, }; diff --git a/src/Work/FactionWork.tsx b/src/Work/FactionWork.tsx index 1e1bdafc6..5af6390e9 100644 --- a/src/Work/FactionWork.tsx +++ b/src/Work/FactionWork.tsx @@ -67,9 +67,9 @@ export class FactionWork extends Work { } } - APICopy(): Record { + APICopy() { return { - type: this.type, + type: WorkType.FACTION as const, cyclesWorked: this.cyclesWorked, factionWorkType: this.factionWorkType, factionName: this.factionName, diff --git a/src/Work/GraftingWork.tsx b/src/Work/GraftingWork.tsx index 87fa8a902..260a4c561 100644 --- a/src/Work/GraftingWork.tsx +++ b/src/Work/GraftingWork.tsx @@ -79,9 +79,9 @@ export class GraftingWork extends Work { } } - APICopy(): Record { + APICopy() { return { - type: this.type, + type: WorkType.GRAFTING as const, cyclesWorked: this.cyclesWorked, augmentation: this.augmentation, }; diff --git a/src/Work/Work.ts b/src/Work/Work.ts index b08c95aab..9d00d82ee 100644 --- a/src/Work/Work.ts +++ b/src/Work/Work.ts @@ -1,4 +1,5 @@ -import { IReviverValue } from "../utils/JSONReviver"; +import type { IReviverValue } from "../utils/JSONReviver"; +import type { Task } from "@nsdefs"; export abstract class Work { type: WorkType; @@ -13,7 +14,7 @@ export abstract class Work { abstract process(cycles: number): boolean; abstract finish(cancelled: boolean, suppressDialog?: boolean): void; - abstract APICopy(): Record; + abstract APICopy(): Task; abstract toJSON(): IReviverValue; }