DOC: Add ns documentation for possible sleeve tasks (#217)

* Add specific types for sleeve tasks
* Moved LocationName enum to overall enums file
* Add LocationName enum to those provided to player
* remove trailing s on CompanyPosNames enum (now CompanyPosName, in line with LocationName)
* Also regenerated all ns documentation. This leads to an expected error when checking for generated files, because PRs should not normally touch markdown files. Also leads to a lint failure in generated file bitburner.d.ts
* also removed some exporting from NetscriptDefinitions.d.ts for anything that wasn't imported somewhere else.
This commit is contained in:
Snarling
2022-11-20 12:07:22 -05:00
committed by GitHub
parent 88d51e9a7e
commit 65cd14e33b
369 changed files with 2767 additions and 2449 deletions
@@ -7,7 +7,7 @@ import { AugmentationNames } from "../../../Augmentation/data/AugmentationNames"
import { StaticAugmentations } from "../../../Augmentation/StaticAugmentations";
import { CONSTANTS } from "../../../Constants";
import { hasAugmentationPrereqs } from "../../../Faction/FactionHelpers";
import { LocationName } from "../../../Locations/data/LocationNames";
import { LocationName } from "../../../utils/enums";
import { Locations } from "../../../Locations/Locations";
import { PurchaseAugmentationsOrderSetting } from "../../../Settings/SettingEnums";
import { Settings } from "../../../Settings/Settings";
+1 -1
View File
@@ -10,7 +10,7 @@ import { Sleeve } from "../Sleeve/Sleeve";
import { PlayerOwnedSourceFile } from "../../SourceFile/PlayerOwnedSourceFile";
import { Exploit } from "../../Exploits/Exploit";
import { LocationName } from "../../Locations/data/LocationNames";
import { LocationName } from "../../utils/enums";
import { Corporation } from "../../Corporation/Corporation";
import { Gang } from "../../Gang/Gang";
import { Bladeburner } from "../../Bladeburner/Bladeburner";
@@ -20,7 +20,7 @@ import { resetGangs } from "../../Gang/AllGangs";
import { Cities } from "../../Locations/Cities";
import { Locations } from "../../Locations/Locations";
import { CityName } from "../../Locations/data/CityNames";
import { LocationName } from "../../Locations/data/LocationNames";
import { LocationName } from "../../utils/enums";
import { Sleeve } from "../Sleeve/Sleeve";
import { isSleeveCompanyWork } from "../Sleeve/Work/SleeveCompanyWork";
import { calculateSkillProgress as calculateSkillProgressF, ISkillProgress } from "../formulas/skill";
+1 -1
View File
@@ -23,7 +23,7 @@ import { CityName } from "../../Locations/data/CityNames";
import { Factions } from "../../Faction/Factions";
import { LocationName } from "../../Locations/data/LocationNames";
import { LocationName } from "../../utils/enums";
import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../../utils/JSONReviver";
import { numeralWrapper } from "../../ui/numeralFormat";
@@ -1,13 +0,0 @@
/** Enum for different types of tasks that a Sleeve can perform */
export enum SleeveTaskType {
// Same Order as selectable order in UI
Idle,
Company,
Faction,
Crime,
Class,
Gym,
Bladeburner,
Recovery,
Synchro,
}
@@ -7,7 +7,7 @@ import { GeneralActions } from "../../../Bladeburner/data/GeneralActions";
import { scaleWorkStats } from "../../../Work/WorkStats";
interface SleeveBladeburnerWorkParams {
type: string;
type: "General" | "Contracts";
name: string;
}
@@ -16,7 +16,7 @@ export const isSleeveBladeburnerWork = (w: Work | null): w is SleeveBladeburnerW
export class SleeveBladeburnerWork extends Work {
cyclesWorked = 0;
actionType: string;
actionType: "General" | "Contracts";
actionName: string;
constructor(params?: SleeveBladeburnerWorkParams) {
@@ -62,8 +62,9 @@ export class SleeveBladeburnerWork extends Work {
}
}
APICopy(): Record<string, unknown> {
APICopy() {
return {
type: WorkType.BLADEBURNER as "BLADEBURNER",
actionType: this.actionType,
actionName: this.actionName,
};
@@ -1,7 +1,7 @@
import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../../../utils/JSONReviver";
import { applySleeveGains, Work, WorkType } from "./Work";
import { ClassType } from "../../../Work/ClassWork";
import { LocationName } from "../../../Locations/data/LocationNames";
import { LocationName } from "../../../utils/enums";
import { calculateClassEarnings } from "../../../Work/Formulas";
import { Sleeve } from "../Sleeve";
import { scaleWorkStats, WorkStats } from "../../../Work/WorkStats";
@@ -38,9 +38,9 @@ export class SleeveClassWork extends Work {
applySleeveGains(sleeve, rate, cycles);
}
APICopy(): Record<string, unknown> {
APICopy() {
return {
type: this.type,
type: WorkType.CLASS as "CLASS",
classType: this.classType,
location: this.location,
};
@@ -1,7 +1,7 @@
import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../../../utils/JSONReviver";
import { Sleeve } from "../Sleeve";
import { applySleeveGains, Work, WorkType } from "./Work";
import { LocationName } from "../../../Locations/data/LocationNames";
import { LocationName } from "../../../utils/enums";
import { Companies } from "../../../Company/Companies";
import { Company } from "../../../Company/Company";
import { calculateCompanyWorkStats } from "../../../Work/Formulas";
@@ -48,9 +48,9 @@ export class SleeveCompanyWork extends Work {
influenceStockThroughCompanyWork(company, gains.reputation, cycles);
}
APICopy(): Record<string, unknown> {
APICopy() {
return {
type: this.type,
type: WorkType.COMPANY as "COMPANY",
companyName: this.companyName,
};
}
@@ -47,9 +47,9 @@ export class SleeveCrimeWork extends Work {
this.cyclesWorked -= this.cyclesNeeded();
}
APICopy(): Record<string, unknown> {
APICopy() {
return {
type: this.type,
type: WorkType.CRIME as "CRIME",
crimeType: this.crimeType,
};
}
@@ -50,9 +50,9 @@ export class SleeveFactionWork extends Work {
this.getFaction().playerReputation += rep * cycles;
}
APICopy(): Record<string, unknown> {
APICopy() {
return {
type: this.type,
type: WorkType.FACTION as "FACTION",
factionWorkType: this.factionWorkType,
factionName: this.factionName,
};
@@ -29,9 +29,9 @@ export class SleeveInfiltrateWork extends Work {
}
}
APICopy(): Record<string, unknown> {
APICopy() {
return {
type: this.type,
type: WorkType.INFILTRATE as "INFILTRATE",
};
}
@@ -15,9 +15,9 @@ export class SleeveRecoveryWork extends Work {
if (sleeve.shock >= 100) sleeve.stopWork();
}
APICopy(): Record<string, unknown> {
APICopy() {
return {
type: this.type,
type: WorkType.RECOVERY as "RECOVERY",
};
}
@@ -19,9 +19,9 @@ export class SleeveSupportWork extends Work {
Player.bladeburner?.sleeveSupport(false);
}
APICopy(): Record<string, unknown> {
APICopy() {
return {
type: this.type,
type: WorkType.SUPPORT as "SUPPORT",
};
}
@@ -20,9 +20,9 @@ export class SleeveSynchroWork extends Work {
if (sleeve.sync >= 100) sleeve.stopWork();
}
APICopy(): Record<string, unknown> {
APICopy() {
return {
type: this.type,
type: WorkType.SYNCHRO as "SYNCHRO",
};
}
+2 -1
View File
@@ -2,6 +2,7 @@ import { Player } from "@player";
import { IReviverValue } from "../../../utils/JSONReviver";
import { Sleeve } from "../Sleeve";
import { applyWorkStatsExp, WorkStats } from "../../../Work/WorkStats";
import { SleeveTask } from "src/ScriptEditor/NetscriptDefinitions";
export const applySleeveGains = (sleeve: Sleeve, shockedStats: WorkStats, mult = 1): void => {
applyWorkStatsExp(sleeve, shockedStats, mult);
@@ -21,7 +22,7 @@ export abstract class Work {
}
abstract process(sleeve: Sleeve, cycles: number): void;
abstract APICopy(): Record<string, unknown>;
abstract APICopy(): SleeveTask;
abstract toJSON(): IReviverValue;
finish(): void {
/* left for children to implement */
+1 -1
View File
@@ -2,7 +2,7 @@ import React, { useState } from "react";
import { Sleeve } from "../Sleeve";
import { Player } from "@player";
import { Crimes } from "../../../Crime/Crimes";
import { LocationName } from "../../../Locations/data/LocationNames";
import { LocationName } from "../../../utils/enums";
import { CityName } from "../../../Locations/data/CityNames";
import { Factions } from "../../../Faction/Factions";
import Select, { SelectChangeEvent } from "@mui/material/Select";