From aa80cf6451e581fd4b36c7894d110126069849ea Mon Sep 17 00:00:00 2001
From: Snarling <84951833+Snarling@users.noreply.github.com>
Date: Tue, 4 Oct 2022 06:40:10 -0400
Subject: [PATCH] See description
Reverted ToastVariant back to an enum internally. Still exposed to player as just possible strings.
Changed all 1-line documentation comments to actually be 1-line. Moved some because they were not providing documentation for the thing they were trying to.
---
src/Augmentation/ui/PlayerMultipliers.tsx | 4 +-
src/BitNode/BitNodeMultipliers.ts | 197 +++++-------------
src/Bladeburner/Bladeburner.tsx | 8 +-
src/Bladeburner/City.ts | 43 +---
src/CodingContracts.ts | 48 ++---
src/Company/Company.ts | 28 +--
src/Company/CompanyPosition.ts | 28 +--
src/Company/GetJobRequirementText.ts | 5 +-
src/Corporation/Corporation.tsx | 8 +-
src/Corporation/Industry.ts | 8 +-
src/CotMG/ActiveFragment.ts | 8 +-
src/CotMG/StaneksGift.ts | 8 +-
src/DevMenu/ui/SaveFile.tsx | 4 +-
src/Electron.tsx | 8 +-
src/Faction/Faction.ts | 32 +--
src/Faction/FactionInfo.tsx | 40 +---
src/Faction/ui/AugmentationsPage.tsx | 4 +-
src/Faction/ui/CreateGangModal.tsx | 4 +-
src/Faction/ui/DonateOption.tsx | 4 +-
src/GameOptions/ui/GameOptionsSidebar.tsx | 6 +-
src/Gang/Gang.ts | 10 +-
src/Gang/GangMember.ts | 8 +-
src/Gang/data/tasks.ts | 16 +-
src/Gang/ui/BonusTime.tsx | 4 +-
src/Gang/ui/EquipmentsSubpage.tsx | 4 +-
src/Gang/ui/GangMemberCard.tsx | 4 +-
src/Gang/ui/GangMemberList.tsx | 4 +-
src/Gang/ui/GangRoot.tsx | 4 +-
src/Gang/ui/ManagementSubpage.tsx | 4 +-
src/Gang/ui/RecruitButton.tsx | 4 +-
src/Gang/ui/RecruitModal.tsx | 4 +-
src/Gang/ui/TerritorySubpage.tsx | 4 +-
src/Hacking.ts | 16 +-
src/Hacknet/HacknetNode.ts | 8 +-
src/Hacknet/HacknetServer.ts | 4 +-
src/Hacknet/HashManager.ts | 20 +-
src/Hacknet/HashUpgrade.ts | 10 +-
src/Hacknet/ui/HacknetRoot.tsx | 4 +-
src/Hacknet/ui/HashUpgradeModal.tsx | 4 +-
src/Hacknet/ui/PurchaseButton.tsx | 4 +-
src/Locations/City.ts | 16 +-
src/Locations/Location.ts | 16 +-
src/Locations/LocationTypeEnum.ts | 4 +-
src/Locations/data/LocationNames.ts | 4 +-
src/Locations/ui/ApplyToJobButton.tsx | 4 +-
src/Locations/ui/CompanyLocation.tsx | 8 +-
src/Locations/ui/HospitalLocation.tsx | 4 +-
src/Locations/ui/PurchaseServerModal.tsx | 4 +-
src/Locations/ui/SpecialLocation.tsx | 12 +-
src/Locations/ui/TorButton.tsx | 4 +-
src/Netscript/Environment.ts | 12 +-
src/Netscript/Pid.ts | 4 +-
src/Netscript/WorkerScript.ts | 56 ++---
.../WorkerScriptStartStopEventEmitter.ts | 4 +-
src/Netscript/WorkerScripts.ts | 4 +-
src/NetscriptFunctions.ts | 12 +-
src/NetscriptFunctions/StockMarket.ts | 4 +-
src/NetscriptWorker.ts | 8 +-
src/PersonObjects/Player/PlayerObject.ts | 8 +-
.../Player/PlayerObjectAugmentationMethods.ts | 4 +-
.../Player/PlayerObjectGeneralMethods.ts | 8 +-
.../Player/PlayerObjectServerMethods.ts | 4 +-
src/PersonObjects/Sleeve/Sleeve.ts | 44 +---
src/PersonObjects/Sleeve/SleeveMethods.ts | 4 +-
.../Sleeve/SleeveTaskTypesEnum.ts | 4 +-
.../Sleeve/Work/SleeveBladeburnerWork.ts | 8 +-
.../Sleeve/Work/SleeveClassWork.ts | 8 +-
.../Sleeve/Work/SleeveCompanyWork.ts | 8 +-
.../Sleeve/Work/SleeveCrimeWork.ts | 8 +-
.../Sleeve/Work/SleeveFactionWork.ts | 8 +-
.../Sleeve/Work/SleeveInfiltrateWork.ts | 8 +-
.../Sleeve/Work/SleeveRecoveryWork.ts | 8 +-
.../Sleeve/Work/SleeveSupportWork.ts | 8 +-
.../Sleeve/Work/SleeveSynchroWork.ts | 8 +-
.../Sleeve/ui/CovenantPurchasesRoot.tsx | 8 +-
src/RedPill.tsx | 21 +-
src/RemoteFileAPI/Remote.ts | 8 +-
src/SaveObject.tsx | 4 +-
src/Script/Script.ts | 4 +-
src/ScriptEditor/NetscriptDefinitions.d.ts | 114 +++-------
src/Server/BaseServer.ts | 10 +-
src/Server/Server.ts | 16 +-
src/Server/data/servers.ts | 40 +---
src/Settings/SettingEnums.ts | 10 +-
src/StockMarket/BuyingAndSelling.tsx | 4 +-
src/StockMarket/Order.ts | 8 +-
src/StockMarket/Stock.ts | 88 ++------
src/StockMarket/StockMarketHelpers.ts | 3 -
src/StockMarket/ui/StockMarketRoot.tsx | 4 +-
src/StockMarket/ui/StockTicker.tsx | 4 +-
src/StockMarket/ui/StockTickerOrder.tsx | 4 +-
src/Terminal/DirectoryHelpers.ts | 8 +-
src/Terminal/DirectoryServerHelpers.ts | 4 +-
src/TextFile.ts | 49 ++---
src/Themes/ui/ThemeBrowser.tsx | 4 +-
src/Work/ClassWork.tsx | 8 +-
src/Work/CompanyWork.tsx | 8 +-
src/Work/CreateProgramWork.ts | 8 +-
src/Work/CrimeWork.ts | 8 +-
src/Work/FactionWork.tsx | 8 +-
src/Work/GraftingWork.tsx | 8 +-
src/engine.tsx | 12 +-
src/types.ts | 15 +-
src/ui/React/Snackbar.tsx | 7 +-
src/ui/Router.ts | 4 +-
src/utils/EventEmitter.ts | 4 +-
src/utils/helpers/createProgressBarText.ts | 16 +-
src/utils/helpers/getTimestamp.ts | 4 +-
src/utils/helpers/keyCodes.ts | 8 +-
109 files changed, 400 insertions(+), 1096 deletions(-)
diff --git a/src/Augmentation/ui/PlayerMultipliers.tsx b/src/Augmentation/ui/PlayerMultipliers.tsx
index ca7b4c58a..b78a76881 100644
--- a/src/Augmentation/ui/PlayerMultipliers.tsx
+++ b/src/Augmentation/ui/PlayerMultipliers.tsx
@@ -1,6 +1,3 @@
-/**
- * React component for displaying the player's multipliers on the Augmentation UI page
- */
import { DoubleArrow } from "@mui/icons-material";
import { List, ListItem, ListItemText, Paper, Typography } from "@mui/material";
import * as React from "react";
@@ -85,6 +82,7 @@ function MultiplierList(props: IMultiplierListProps): React.ReactElement {
return listItems.length > 0 ? {listItems}
: <>>;
}
+/** React component for displaying the player's multipliers on the Augmentation UI page */
export function PlayerMultipliers(): React.ReactElement {
const mults = calculateAugmentedStats();
diff --git a/src/BitNode/BitNodeMultipliers.ts b/src/BitNode/BitNodeMultipliers.ts
index 566d0f14d..a773f106e 100644
--- a/src/BitNode/BitNodeMultipliers.ts
+++ b/src/BitNode/BitNodeMultipliers.ts
@@ -6,129 +6,79 @@ import { defaultMultipliers } from "./BitNode";
* player toward the intended strategy. Unless they really want to play the long, slow game of waiting...
*/
export interface IBitNodeMultipliers {
- /**
- * Influences how quickly the player's agility level (not exp) scales
- */
+ /** Influences how quickly the player's agility level (not exp) scales */
AgilityLevelMultiplier: number;
- /**
- * Influences the base cost to purchase an augmentation.
- */
+ /** Influences the base cost to purchase an augmentation. */
AugmentationMoneyCost: number;
- /**
- * Influences the base rep the player must have with a faction to purchase an augmentation.
- */
+ /** Influences the base rep the player must have with a faction to purchase an augmentation. */
AugmentationRepCost: number;
- /**
- * Influences how quickly the player can gain rank within Bladeburner.
- */
+ /** Influences how quickly the player can gain rank within Bladeburner. */
BladeburnerRank: number;
- /**
- * Influences the cost of skill levels from Bladeburner.
- */
+ /** Influences the cost of skill levels from Bladeburner. */
BladeburnerSkillCost: number;
- /**
- * Influences how quickly the player's charisma level (not exp) scales
- */
+ /** Influences how quickly the player's charisma level (not exp) scales */
CharismaLevelMultiplier: number;
- /**
- * Influences the experience gained for each ability when a player completes a class.
- */
+ /** Influences the experience gained for each ability when a player completes a class. */
ClassGymExpGain: number;
- /**
- * Influences the amount of money gained from completing Coding Contracts
- **/
+ /**Influences the amount of money gained from completing Coding Contracts. */
CodingContractMoney: number;
- /**
- * Influences the experience gained for each ability when the player completes working their job.
- */
+ /** Influences the experience gained for each ability when the player completes working their job. */
CompanyWorkExpGain: number;
- /**
- * Influences how much money the player earns when completing working their job.
- */
+ /** Influences how much money the player earns when completing working their job. */
CompanyWorkMoney: number;
- /**
- * Influences the valuation of corporations created by the player.
- */
+ /** Influences the valuation of corporations created by the player. */
CorporationValuation: number;
- /**
- * Influences the base experience gained for each ability when the player commits a crime.
- */
+ /** Influences the base experience gained for each ability when the player commits a crime. */
CrimeExpGain: number;
- /**
- * Influences the base money gained when the player commits a crime.
- */
+ /** Influences the base money gained when the player commits a crime. */
CrimeMoney: number;
- /**
- * Influences how many Augmentations you need in order to get invited to the Daedalus faction
- */
+ /** Influences how many Augmentations you need in order to get invited to the Daedalus faction */
DaedalusAugsRequirement: number;
- /**
- * Influences how quickly the player's defense level (not exp) scales
- */
+ /** Influences how quickly the player's defense level (not exp) scales */
DefenseLevelMultiplier: number;
- /**
- * Influences how quickly the player's dexterity level (not exp) scales
- */
+ /** Influences how quickly the player's dexterity level (not exp) scales */
DexterityLevelMultiplier: number;
- /**
- * Influences how much rep the player gains in each faction simply by being a member.
- */
+ /** Influences how much rep the player gains in each faction simply by being a member. */
FactionPassiveRepGain: number;
- /**
- * Influences the experience gained for each ability when the player completes work for a Faction.
- */
+ /** Influences the experience gained for each ability when the player completes work for a Faction. */
FactionWorkExpGain: number;
- /**
- * Influences how much rep the player gains when performing work for a faction.
- */
+ /** Influences how much rep the player gains when performing work for a faction. */
FactionWorkRepGain: number;
- /**
- * Influences how much it costs to unlock the stock market's 4S Market Data API
- */
+ /** Influences how much it costs to unlock the stock market's 4S Market Data API */
FourSigmaMarketDataApiCost: number;
- /**
- * Influences how much it costs to unlock the stock market's 4S Market Data (NOT API)
- */
+ /** Influences how much it costs to unlock the stock market's 4S Market Data (NOT API) */
FourSigmaMarketDataCost: number;
- /**
- * Reduces gangs earning.
- */
+ /** Reduces gangs earning. */
GangSoftcap: number;
- /**
- * Percentage of unique augs that the gang has.
- */
+ /** Percentage of unique augs that the gang has. */
GangUniqueAugs: number;
- /**
- * Influences the experienced gained when hacking a server.
- */
+ /** Influences the experienced gained when hacking a server. */
HackExpGain: number;
- /**
- * Influences how quickly the player's hacking level (not experience) scales
- */
+ /** Influences how quickly the player's hacking level (not experience) scales */
HackingLevelMultiplier: number;
/**
@@ -136,55 +86,38 @@ export interface IBitNodeMultipliers {
* Influeces the hash rate of Hacknet Servers (unlocked in BitNode-9)
*/
HacknetNodeMoney: number;
-
- /**
- * Influences how much money it costs to upgrade your home computer's RAM
- */
+
+ /** Influences how much money it costs to upgrade your home computer's RAM */
HomeComputerRamCost: number;
-
- /**
- * Influences how much money is gained when the player infiltrates a company.
- */
+
+ /** Influences how much money is gained when the player infiltrates a company. */
InfiltrationMoney: number;
-
- /**
- * Influences how much rep the player can gain from factions when selling stolen documents and secrets
- */
+
+ /** Influences how much rep the player can gain from factions when selling stolen documents and secrets */
InfiltrationRep: number;
-
+
/**
* Influences how much money can be stolen from a server when the player performs a hack against it through
* the Terminal.
*/
ManualHackMoney: number;
-
- /**
- * Influence how much it costs to purchase a server
- */
+
+ /** Influence how much it costs to purchase a server */
PurchasedServerCost: number;
-
- /**
- * Influence how much it costs to purchase a server
- */
+
+ /** Influence how much it costs to purchase a server */
PurchasedServerSoftcap: number;
-
- /**
- * Influences the maximum number of purchased servers you can have
- */
+
+ /** Influences the maximum number of purchased servers you can have */
PurchasedServerLimit: number;
-
- /**
- * Influences the maximum allowed RAM for a purchased server
- */
+
+ /** Influences the maximum allowed RAM for a purchased server */
PurchasedServerMaxRam: number;
- /**
- * Influences the minimum favor the player must have with a faction before they can donate to gain rep.
- */
+
+ /** Influences the minimum favor the player must have with a faction before they can donate to gain rep. */
RepToDonateToFaction: number;
- /**
- * Influences how much money can be stolen from a server when a script performs a hack against it.
- */
+ /** Influences how much money can be stolen from a server when a script performs a hack against it. */
ScriptHackMoney: number;
/**
@@ -194,62 +127,40 @@ export interface IBitNodeMultipliers {
*/
ScriptHackMoneyGain: number;
- /**
- * Influences the growth percentage per cycle against a server.
- */
+ /** Influences the growth percentage per cycle against a server. */
ServerGrowthRate: number;
- /**
- * Influences the maxmimum money that a server can grow to.
- */
+ /** Influences the maxmimum money that a server can grow to. */
ServerMaxMoney: number;
- /**
- * Influences the initial money that a server starts with.
- */
+ /** Influences the initial money that a server starts with. */
ServerStartingMoney: number;
- /**
- * Influences the initial security level (hackDifficulty) of a server.
- */
+ /** Influences the initial security level (hackDifficulty) of a server. */
ServerStartingSecurity: number;
- /**
- * Influences the weaken amount per invocation against a server.
- */
+ /** Influences the weaken amount per invocation against a server. */
ServerWeakenRate: number;
- /**
- * Influences how quickly the player's strength level (not exp) scales
- */
+ /** Influences how quickly the player's strength level (not exp) scales */
StrengthLevelMultiplier: number;
- /**
- * Influences the power of the gift.
- */
+ /** Influences the power of the gift. */
StaneksGiftPowerMultiplier: number;
- /**
- * Influences the size of the gift.
- */
+ /** Influences the size of the gift. */
StaneksGiftExtraSize: number;
- /**
- * Influences the hacking skill required to backdoor the world daemon.
- */
+ /** Influences the hacking skill required to backdoor the world daemon. */
WorldDaemonDifficulty: number;
- /**
- * Influences corporation dividends.
- */
+ /** Influences corporation dividends. */
CorporationSoftcap: number;
// Index signature
[key: string]: number;
}
-/**
- * The multipliers that are influenced by current Bitnode progression.
- */
+/** The multipliers that are influenced by current Bitnode progression. */
// tslint:disable-next-line:variable-name
export const BitNodeMultipliers = Object.assign({}, defaultMultipliers);
diff --git a/src/Bladeburner/Bladeburner.tsx b/src/Bladeburner/Bladeburner.tsx
index 00cef4634..9f66b8a81 100644
--- a/src/Bladeburner/Bladeburner.tsx
+++ b/src/Bladeburner/Bladeburner.tsx
@@ -2377,16 +2377,12 @@ export class Bladeburner {
}
}
- /**
- * Serialize the current object to a JSON save state.
- */
+ /** Serialize the current object to a JSON save state. */
toJSON(): IReviverValue {
return Generic_toJSON("Bladeburner", this);
}
- /**
- * Initiatizes a Bladeburner object from a JSON save state.
- */
+ /** Initiatizes a Bladeburner object from a JSON save state. */
static fromJSON(value: IReviverValue): Bladeburner {
return Generic_fromJSON(Bladeburner, value.data);
}
diff --git a/src/Bladeburner/City.ts b/src/Bladeburner/City.ts
index 7ead8c7e5..21a22db8b 100644
--- a/src/Bladeburner/City.ts
+++ b/src/Bladeburner/City.ts
@@ -4,7 +4,9 @@ import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../uti
import { addOffset } from "../utils/helpers/addOffset";
interface IChangePopulationByCountParams {
+ /** How much the estimate should change by. */
estChange: number;
+ /** Add offset to estimate (offset by percentage). */
estOffset: number;
}
@@ -14,29 +16,19 @@ interface IChangePopulationByPercentageParams {
}
export class City {
- /**
- * Name of the city.
- */
+ /** Name of the city. */
name = "";
- /**
- * Population of the city.
- */
+ /** Population of the city. */
pop = 0;
- /**
- * Population estimation of the city.
- */
+ /** Population estimation of the city. */
popEst = 0;
- /**
- * Number of communities in the city.
- */
+ /** Number of communities in the city. */
comms = 0;
- /**
- * Chaos level of the city.
- */
+ /** Chaos level of the city. */
chaos = 0;
constructor(name: string = BladeburnerConstants.CityNames[2]) {
@@ -51,9 +43,7 @@ export class City {
this.chaos = 0;
}
- /**
- * p is the percentage, not the multiplier (e.g. pass in p = 5 for 5%)
- */
+ /** p is the percentage, not the multiplier (e.g. pass in p = 5 for 5%) */
changeChaosByPercentage(p: number): void {
if (isNaN(p)) {
throw new Error("NaN passed into City.chaosChaosByPercentage()");
@@ -84,9 +74,7 @@ export class City {
}
}
- /**
- * p is the percentage, not the multiplier (e.g. pass in p = 5 for 5%)
- */
+ /** p is the percentage, not the multiplier (e.g. pass in p = 5 for 5%) */
improvePopulationEstimateByPercentage(p: number, skillMult = 1): void {
p = p * skillMult;
if (isNaN(p)) {
@@ -106,11 +94,6 @@ export class City {
}
}
- /**
- * @params options:
- * estChange(int): How much the estimate should change by
- * estOffset(int): Add offset to estimate (offset by percentage)
- */
changePopulationByCount(n: number, params: IChangePopulationByCountParams = { estChange: 0, estOffset: 0 }): void {
if (isNaN(n)) {
throw new Error("NaN passed into City.changePopulationByCount()");
@@ -174,16 +157,12 @@ export class City {
}
}
- /**
- * Serialize the current object to a JSON save state.
- */
+ /** Serialize the current object to a JSON save state. */
toJSON(): IReviverValue {
return Generic_toJSON("City", this);
}
- /**
- * Initiatizes a City object from a JSON save state.
- */
+ /** Initiatizes a City object from a JSON save state. */
static fromJSON(value: IReviverValue): City {
return Generic_fromJSON(City, value.data);
}
diff --git a/src/CodingContracts.ts b/src/CodingContracts.ts
index caf8cba1d..fd19a546a 100644
--- a/src/CodingContracts.ts
+++ b/src/CodingContracts.ts
@@ -7,34 +7,22 @@ import { CodingContractEvent } from "./ui/React/CodingContractModal";
/* Represents different types of problems that a Coding Contract can have */
class CodingContractType {
- /**
- * Function that generates a description of the problem
- */
+ /** Function that generates a description of the problem */
desc: DescriptionFunc;
- /**
- * Number that generally represents the problem's difficulty. Bigger numbers = harder
- */
+ /** Number that generally represents the problem's difficulty. Bigger numbers = harder */
difficulty: number;
- /**
- * A function that randomly generates a valid 'data' for the problem
- */
+ /** A function that randomly generates a valid 'data' for the problem */
generate: GeneratorFunc;
- /**
- * Name of the type of problem
- */
+ /** Name of the type of problem */
name: string;
- /**
- * The maximum number of tries the player gets on this kind of problem before it self-destructs
- */
+ /** The maximum number of tries the player gets on this kind of problem before it self-destructs */
numTries: number;
- /**
- * Stores a function that checks if the provided answer is correct
- */
+ /** Stores a function that checks if the provided answer is correct */
solver: SolverFunc;
constructor(
@@ -70,9 +58,7 @@ for (const md of codingContractTypesMetadata) {
);
}
-/**
- * Enum representing the different types of rewards a Coding Contract can give
- */
+/** Enum representing the different types of rewards a Coding Contract can give */
export enum CodingContractRewardType {
FactionReputation,
FactionReputationAll,
@@ -80,18 +66,14 @@ export enum CodingContractRewardType {
Money, // This must always be the last reward type
}
-/**
- * Enum representing the result when trying to solve the Contract
- */
+/** Enum representing the result when trying to solve the Contract */
export enum CodingContractResult {
Success,
Failure,
Cancelled,
}
-/**
- * A class that represents the type of reward a contract gives
- */
+/** A class that represents the type of reward a contract gives */
export interface ICodingContractReward {
/* Name of Company/Faction name for reward, if applicable */
name?: string;
@@ -159,9 +141,7 @@ export class CodingContract {
return CodingContractTypes[this.type].solver(this.data, solution);
}
- /**
- * Creates a popup to prompt the player to solve the problem
- */
+ /** Creates a popup to prompt the player to solve the problem */
async prompt(): Promise {
return new Promise((resolve) => {
const props = {
@@ -181,16 +161,12 @@ export class CodingContract {
});
}
- /**
- * Serialize the current file to a JSON save state.
- */
+ /** Serialize the current file to a JSON save state. */
toJSON(): IReviverValue {
return Generic_toJSON("CodingContract", this);
}
- /**
- * Initiatizes a CodingContract from a JSON save state.
- */
+ /** Initiatizes a CodingContract from a JSON save state. */
static fromJSON(value: IReviverValue): CodingContract {
return Generic_fromJSON(CodingContract, value.data);
}
diff --git a/src/Company/Company.ts b/src/Company/Company.ts
index 70081eaf3..5c0afe0ee 100644
--- a/src/Company/Company.ts
+++ b/src/Company/Company.ts
@@ -24,19 +24,13 @@ const DefaultConstructorParams: IConstructorParams = {
};
export class Company {
- /**
- * Company name
- */
+ /** Company name */
name: string;
- /**
- * Description and general information about company
- */
+ /** Description and general information about company */
info: string;
- /**
- * Has faction associated.
- */
+ /** Has faction associated. */
isMegacorp: boolean;
/**
@@ -48,9 +42,7 @@ export class Company {
*/
companyPositions: Record;
- /**
- * Company-specific multiplier for earnings
- */
+ /** Company-specific multiplier for earnings */
expMultiplier: number;
salaryMultiplier: number;
@@ -63,9 +55,7 @@ export class Company {
*/
jobStatReqOffset: number;
- /**
- * Properties to track the player's progress in this company
- */
+ /** Properties to track the player's progress in this company */
isPlayerEmployed: boolean;
playerReputation: number;
favor: number;
@@ -142,16 +132,12 @@ export class Company {
return newFavor - this.favor;
}
- /**
- * Serialize the current object to a JSON save state.
- */
+ /** Serialize the current object to a JSON save state. */
toJSON(): IReviverValue {
return Generic_toJSON("Company", this);
}
- /**
- * Initiatizes a Company from a JSON save state.
- */
+ /** Initiatizes a Company from a JSON save state. */
static fromJSON(value: IReviverValue): Company {
return Generic_fromJSON(Company, value.data);
}
diff --git a/src/Company/CompanyPosition.ts b/src/Company/CompanyPosition.ts
index afa8a0452..0206e9639 100644
--- a/src/Company/CompanyPosition.ts
+++ b/src/Company/CompanyPosition.ts
@@ -33,14 +33,10 @@ export interface IConstructorParams {
}
export class CompanyPosition {
- /**
- * Position title
- */
+ /** Position title */
name: string;
- /**
- * Title of next position to be promoted to
- */
+ /** Title of next position to be promoted to */
nextPosition: string | null;
/**
@@ -49,14 +45,10 @@ export class CompanyPosition {
*/
baseSalary: number;
- /**
- * Reputation multiplier
- */
+ /** Reputation multiplier */
repMultiplier: number;
- /**
- * Required stats to earn this position
- */
+ /** Required stats to earn this position */
requiredAgility: number;
requiredCharisma: number;
requiredDefense: number;
@@ -64,14 +56,10 @@ export class CompanyPosition {
requiredHacking: number;
requiredStrength: number;
- /**
- * Required company reputation to earn this position
- */
+ /** Required company reputation to earn this position */
requiredReputation: number;
- /**
- * Effectiveness of each stat time for job performance
- */
+ /** Effectiveness of each stat time for job performance */
hackingEffectiveness: number;
strengthEffectiveness: number;
defenseEffectiveness: number;
@@ -79,9 +67,7 @@ export class CompanyPosition {
agilityEffectiveness: number;
charismaEffectiveness: number;
- /**
- * Experience gain for performing job (per 200ms game cycle)
- */
+ /** Experience gain for performing job (per 200ms game cycle) */
hackingExpGain: number;
strengthExpGain: number;
defenseExpGain: number;
diff --git a/src/Company/GetJobRequirementText.ts b/src/Company/GetJobRequirementText.ts
index 45bbb51cd..9fba7b87b 100644
--- a/src/Company/GetJobRequirementText.ts
+++ b/src/Company/GetJobRequirementText.ts
@@ -1,10 +1,7 @@
import { Company } from "./Company";
import { CompanyPosition } from "./CompanyPosition";
-/**
- * Returns a string with the given CompanyPosition's stat requirements
- */
-
+/** Returns a string with the given CompanyPosition's stat requirements */
export function getJobRequirementText(company: Company, pos: CompanyPosition, tooltiptext = false): string {
let reqText = "";
const offset: number = company.jobStatReqOffset;
diff --git a/src/Corporation/Corporation.tsx b/src/Corporation/Corporation.tsx
index dacb5ea24..b69a216f0 100644
--- a/src/Corporation/Corporation.tsx
+++ b/src/Corporation/Corporation.tsx
@@ -446,16 +446,12 @@ export class Corporation {
return;
}
- /**
- * Serialize the current object to a JSON save state.
- */
+ /** Serialize the current object to a JSON save state. */
toJSON(): IReviverValue {
return Generic_toJSON("Corporation", this);
}
- /**
- * Initiatizes a Corporation object from a JSON save state.
- */
+ /** Initiatizes a Corporation object from a JSON save state. */
static fromJSON(value: IReviverValue): Corporation {
return Generic_fromJSON(Corporation, value.data);
}
diff --git a/src/Corporation/Industry.ts b/src/Corporation/Industry.ts
index fe1a6d8a8..dd2c75a0f 100644
--- a/src/Corporation/Industry.ts
+++ b/src/Corporation/Industry.ts
@@ -1369,16 +1369,12 @@ export class Industry {
return researchTree.getStorageMultiplier();
}
- /**
- * Serialize the current object to a JSON save state.
- */
+ /** Serialize the current object to a JSON save state. */
toJSON(): IReviverValue {
return Generic_toJSON("Industry", this);
}
- /**
- * Initiatizes a Industry object from a JSON save state.
- */
+ /** Initiatizes a Industry object from a JSON save state. */
static fromJSON(value: IReviverValue): Industry {
return Generic_fromJSON(Industry, value.data);
}
diff --git a/src/CotMG/ActiveFragment.ts b/src/CotMG/ActiveFragment.ts
index 10bee93b4..aaea55780 100644
--- a/src/CotMG/ActiveFragment.ts
+++ b/src/CotMG/ActiveFragment.ts
@@ -71,16 +71,12 @@ export class ActiveFragment {
return Object.assign({}, this);
}
- /**
- * Serialize an active fragment to a JSON save state.
- */
+ /** Serialize an active fragment to a JSON save state. */
toJSON(): IReviverValue {
return Generic_toJSON("ActiveFragment", this);
}
- /**
- * Initializes an acive fragment from a JSON save state
- */
+ /** Initializes an acive fragment from a JSON save state */
static fromJSON(value: IReviverValue): ActiveFragment {
return Generic_fromJSON(ActiveFragment, value.data);
}
diff --git a/src/CotMG/StaneksGift.ts b/src/CotMG/StaneksGift.ts
index a914c4b6e..9bb235c1f 100644
--- a/src/CotMG/StaneksGift.ts
+++ b/src/CotMG/StaneksGift.ts
@@ -230,16 +230,12 @@ export class StaneksGift extends BaseGift {
this.storedCycles = 0;
}
- /**
- * Serialize Staneks Gift to a JSON save state.
- */
+ /** Serialize Staneks Gift to a JSON save state. */
toJSON(): IReviverValue {
return Generic_toJSON("StaneksGift", this);
}
- /**
- * Initializes Staneks Gift from a JSON save state
- */
+ /** Initializes Staneks Gift from a JSON save state */
static fromJSON(value: IReviverValue): StaneksGift {
return Generic_fromJSON(StaneksGift, value.data);
}
diff --git a/src/DevMenu/ui/SaveFile.tsx b/src/DevMenu/ui/SaveFile.tsx
index 0d2ff3391..8f7d9003b 100644
--- a/src/DevMenu/ui/SaveFile.tsx
+++ b/src/DevMenu/ui/SaveFile.tsx
@@ -7,7 +7,7 @@ import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
import Typography from "@mui/material/Typography";
import { saveObject } from "../../SaveObject";
-import { SnackbarEvents } from "../../ui/React/Snackbar";
+import { SnackbarEvents, ToastVariant } from "../../ui/React/Snackbar";
import { Upload } from "@mui/icons-material";
import { Button } from "@mui/material";
import { OptionSwitch } from "../../ui/React/OptionSwitch";
@@ -25,7 +25,7 @@ export function SaveFile(): React.ReactElement {
const save = atob(base64Save);
setSaveFile(save);
} catch (e: unknown) {
- SnackbarEvents.emit(String(e), "error", 5000);
+ SnackbarEvents.emit(String(e), ToastVariant.ERROR, 5000);
}
}
diff --git a/src/Electron.tsx b/src/Electron.tsx
index 89d61112c..6d28de1c2 100644
--- a/src/Electron.tsx
+++ b/src/Electron.tsx
@@ -151,7 +151,7 @@ function initSaveFunctions(): void {
saveObject.exportGame();
} catch (error) {
console.error(error);
- SnackbarEvents.emit("Could not export game.", "error", 2000);
+ SnackbarEvents.emit("Could not export game.", ToastVariant.ERROR, 2000);
}
},
triggerScriptsExport: (): void => exportScripts("*", Player.getHomeComputer()),
@@ -203,7 +203,7 @@ function initElectronBridge(): void {
})
.catch((error: unknown) => {
console.error(error);
- SnackbarEvents.emit("Could not save game.", "error", 2000);
+ SnackbarEvents.emit("Could not save game.", ToastVariant.ERROR, 2000);
});
});
bridge.receive("trigger-game-export", () => {
@@ -211,7 +211,7 @@ function initElectronBridge(): void {
window.appSaveFns.triggerGameExport();
} catch (error) {
console.error(error);
- SnackbarEvents.emit("Could not export game.", "error", 2000);
+ SnackbarEvents.emit("Could not export game.", ToastVariant.ERROR, 2000);
}
});
bridge.receive("trigger-scripts-export", () => {
@@ -219,7 +219,7 @@ function initElectronBridge(): void {
window.appSaveFns.triggerScriptsExport();
} catch (error) {
console.error(error);
- SnackbarEvents.emit("Could not export scripts.", "error", 2000);
+ SnackbarEvents.emit("Could not export scripts.", ToastVariant.ERROR, 2000);
}
});
}
diff --git a/src/Faction/Faction.ts b/src/Faction/Faction.ts
index 95258cba6..ee50360b6 100644
--- a/src/Faction/Faction.ts
+++ b/src/Faction/Faction.ts
@@ -9,34 +9,22 @@ export class Faction {
*/
alreadyInvited = false;
- /**
- * Holds names of all augmentations that this Faction offers
- */
+ /** Holds names of all augmentations that this Faction offers */
augmentations: string[] = [];
- /**
- * Amount of favor the player has with this faction.
- */
+ /** Amount of favor the player has with this faction. */
favor = 0;
- /**
- * Flag signalling whether player has been banned from this faction
- */
+ /** Flag signalling whether player has been banned from this faction */
isBanned = false;
- /**
- * Flag signalling whether player is a member of this faction
- */
+ /** Flag signalling whether player is a member of this faction */
isMember = false;
- /**
- * Name of faction
- */
+ /** Name of faction */
name = "";
- /**
- * Amount of reputation player has with this faction
- */
+ /** Amount of reputation player has with this faction */
playerReputation = 0;
constructor(name = "") {
@@ -72,16 +60,12 @@ export class Faction {
return newFavor - this.favor;
}
- /**
- * Serialize the current object to a JSON save state.
- */
+ /** Serialize the current object to a JSON save state. */
toJSON(): IReviverValue {
return Generic_toJSON("Faction", this);
}
- /**
- * Initiatizes a Faction object from a JSON save state.
- */
+ /** Initiatizes a Faction object from a JSON save state. */
static fromJSON(value: IReviverValue): Faction {
return Generic_fromJSON(Faction, value.data);
}
diff --git a/src/Faction/FactionInfo.tsx b/src/Faction/FactionInfo.tsx
index 1dfd62b5a..3270e2a3b 100644
--- a/src/Faction/FactionInfo.tsx
+++ b/src/Faction/FactionInfo.tsx
@@ -15,48 +15,30 @@ interface FactionInfoParams {
assignment?: () => React.ReactElement;
}
-/**
- * Contains the "information" property for all the Factions, which is just a description of each faction
- */
+/** Contains the "information" property for all the Factions, which is just a description of each faction */
export class FactionInfo {
- /**
- * The names of all other factions considered to be enemies to this faction.
- */
+ /** The names of all other factions considered to be enemies to this faction. */
enemies: string[];
- /**
- * The descriptive text to show on the faction's page.
- */
+ /** The descriptive text to show on the faction's page. */
infoText: JSX.Element;
- /**
- * A flag indicating if the faction supports field work to earn reputation.
- */
+ /** A flag indicating if the faction supports field work to earn reputation. */
offerFieldWork: boolean;
- /**
- * A flag indicating if the faction supports hacking work to earn reputation.
- */
+ /** A flag indicating if the faction supports hacking work to earn reputation. */
offerHackingWork: boolean;
- /**
- * A flag indicating if the faction supports security work to earn reputation.
- */
+ /** A flag indicating if the faction supports security work to earn reputation. */
offerSecurityWork: boolean;
- /**
- * Keep faction on install.
- */
+ /** Keep faction on install. */
keep: boolean;
- /**
- * Special faction
- */
+ /** Special faction */
special: boolean;
- /**
- * The data to display on the faction screen.
- */
+ /** The data to display on the faction screen. */
assignment?: () => React.ReactElement;
constructor(params: FactionInfoParams) {
@@ -76,9 +58,7 @@ export class FactionInfo {
}
}
-/**
- * A map of all factions and associated info to them.
- */
+/** A map of all factions and associated info to them. */
// tslint:disable-next-line:variable-name
export const FactionInfos: Record = {
// Endgame
diff --git a/src/Faction/ui/AugmentationsPage.tsx b/src/Faction/ui/AugmentationsPage.tsx
index 939ad8e0e..dfdeac079 100644
--- a/src/Faction/ui/AugmentationsPage.tsx
+++ b/src/Faction/ui/AugmentationsPage.tsx
@@ -1,6 +1,3 @@
-/**
- * Root React Component for displaying a faction's "Purchase Augmentations" page
- */
import { Box, Button, Tooltip, Typography, Paper, Container } from "@mui/material";
import React, { useState } from "react";
@@ -23,6 +20,7 @@ type IProps = {
routeToMainPage: () => void;
};
+/** Root React Component for displaying a faction's "Purchase Augmentations" page */
export function AugmentationsPage(props: IProps): React.ReactElement {
const setRerender = useState(false)[1];
diff --git a/src/Faction/ui/CreateGangModal.tsx b/src/Faction/ui/CreateGangModal.tsx
index 83064b385..2b50d08bf 100644
--- a/src/Faction/ui/CreateGangModal.tsx
+++ b/src/Faction/ui/CreateGangModal.tsx
@@ -1,6 +1,3 @@
-/**
- * React Component for the popup used to create a new gang.
- */
import React from "react";
import { Modal } from "../../ui/React/Modal";
import { Router } from "../../ui/GameRoot";
@@ -16,6 +13,7 @@ interface IProps {
facName: string;
}
+/** React Component for the popup used to create a new gang. */
export function CreateGangModal(props: IProps): React.ReactElement {
const combatGangText =
"This is a COMBAT gang. Members in this gang will have different tasks than HACKING gangs. " +
diff --git a/src/Faction/ui/DonateOption.tsx b/src/Faction/ui/DonateOption.tsx
index 052b7d397..fcfb872c6 100644
--- a/src/Faction/ui/DonateOption.tsx
+++ b/src/Faction/ui/DonateOption.tsx
@@ -1,6 +1,3 @@
-/**
- * React component for a donate option on the Faction UI
- */
import React, { useState } from "react";
import { CONSTANTS } from "../../Constants";
@@ -27,6 +24,7 @@ type IProps = {
rerender: () => void;
};
+/** React component for a donate option on the Faction UI */
export function DonateOption(props: IProps): React.ReactElement {
const [donateAmt, setDonateAmt] = useState(NaN);
const digits = (CONSTANTS.DonateMoneyToRepDivisor + "").length - 1;
diff --git a/src/GameOptions/ui/GameOptionsSidebar.tsx b/src/GameOptions/ui/GameOptionsSidebar.tsx
index 2cfc90f77..5c8d707ff 100644
--- a/src/GameOptions/ui/GameOptionsSidebar.tsx
+++ b/src/GameOptions/ui/GameOptionsSidebar.tsx
@@ -19,7 +19,7 @@ import { StyleEditorButton } from "../../Themes/ui/StyleEditorButton";
import { ThemeEditorButton } from "../../Themes/ui/ThemeEditorButton";
import { ConfirmationModal } from "../../ui/React/ConfirmationModal";
import { DeleteGameButton } from "../../ui/React/DeleteGameButton";
-import { SnackbarEvents } from "../../ui/React/Snackbar";
+import { SnackbarEvents, ToastVariant } from "../../ui/React/Snackbar";
import { SoftResetButton } from "../../ui/React/SoftResetButton";
import { Router } from "../../ui/GameRoot";
import { convertTimeMsToTimeElapsedString } from "../../utils/StringHelperFunctions";
@@ -72,7 +72,7 @@ export const GameOptionsSidebar = (props: IProps): React.ReactElement => {
setImportData(data);
setImportSaveOpen(true);
} catch (e: unknown) {
- SnackbarEvents.emit(String(e), "error", 5000);
+ SnackbarEvents.emit(String(e), ToastVariant.ERROR, 5000);
}
}
@@ -82,7 +82,7 @@ export const GameOptionsSidebar = (props: IProps): React.ReactElement => {
try {
await saveObject.importGame(importData.base64);
} catch (e: unknown) {
- SnackbarEvents.emit(String(e), "error", 5000);
+ SnackbarEvents.emit(String(e), ToastVariant.ERROR, 5000);
}
setImportSaveOpen(false);
diff --git a/src/Gang/Gang.ts b/src/Gang/Gang.ts
index 32fe4f60c..7745fcd54 100644
--- a/src/Gang/Gang.ts
+++ b/src/Gang/Gang.ts
@@ -376,7 +376,7 @@ export class Gang {
return Math.max(1, discount);
}
- // Returns only valid tasks for this gang. Excludes 'Unassigned'
+ /** Returns only valid tasks for this gang. Excludes 'Unassigned' */
getAllTaskNames(): string[] {
return Object.keys(GangMemberTasks).filter((taskName: string) => {
const task = GangMemberTasks[taskName];
@@ -394,16 +394,12 @@ export class Gang {
return upg.cost / this.getDiscount();
}
- /**
- * Serialize the current object to a JSON save state.
- */
+ /** Serialize the current object to a JSON save state. */
toJSON(): IReviverValue {
return Generic_toJSON("Gang", this);
}
- /**
- * Initiatizes a Gang object from a JSON save state.
- */
+ /** Initiatizes a Gang object from a JSON save state. */
static fromJSON(value: IReviverValue): Gang {
return Generic_fromJSON(Gang, value.data);
}
diff --git a/src/Gang/GangMember.ts b/src/Gang/GangMember.ts
index 177b10f8d..65f42576b 100644
--- a/src/Gang/GangMember.ts
+++ b/src/Gang/GangMember.ts
@@ -319,16 +319,12 @@ export class GangMember {
return true;
}
- /**
- * Serialize the current object to a JSON save state.
- */
+ /** Serialize the current object to a JSON save state. */
toJSON(): IReviverValue {
return Generic_toJSON("GangMember", this);
}
- /**
- * Initiatizes a GangMember object from a JSON save state.
- */
+ /** Initiatizes a GangMember object from a JSON save state. */
static fromJSON(value: IReviverValue): GangMember {
return Generic_fromJSON(GangMember, value.data);
}
diff --git a/src/Gang/data/tasks.ts b/src/Gang/data/tasks.ts
index 58322e913..c563302bf 100644
--- a/src/Gang/data/tasks.ts
+++ b/src/Gang/data/tasks.ts
@@ -6,24 +6,16 @@ import { ITaskParams } from "../ITaskParams";
* (defined in Gang.js)
*/
interface IGangMemberTaskMetadata {
- /**
- * Description of the task
- */
+ /** Description of the task */
desc: string;
- /**
- * Whether or not this task is meant for Combat-type gangs
- */
+ /** Whether or not this task is meant for Combat-type gangs */
isCombat: boolean;
- /**
- * Whether or not this task is for Hacking-type gangs
- */
+ /** Whether or not this task is for Hacking-type gangs */
isHacking: boolean;
- /**
- * Name of the task
- */
+ /** Name of the task */
name: string;
/**
diff --git a/src/Gang/ui/BonusTime.tsx b/src/Gang/ui/BonusTime.tsx
index 69364ed1e..a7e0af2b9 100644
--- a/src/Gang/ui/BonusTime.tsx
+++ b/src/Gang/ui/BonusTime.tsx
@@ -1,6 +1,3 @@
-/**
- * React Component for displaying the bonus time remaining.
- */
import * as React from "react";
import { Gang } from "../Gang";
import { CONSTANTS } from "../../Constants";
@@ -13,6 +10,7 @@ interface IProps {
gang: Gang;
}
+/** React Component for displaying the bonus time remaining. */
export function BonusTime(props: IProps): React.ReactElement {
const CyclerPerSecond = 1000 / CONSTANTS._idleSpeed;
if ((props.gang.storedCycles / CyclerPerSecond) * 1000 <= 5000) return <>>;
diff --git a/src/Gang/ui/EquipmentsSubpage.tsx b/src/Gang/ui/EquipmentsSubpage.tsx
index 3ab0a0850..76efd5bea 100644
--- a/src/Gang/ui/EquipmentsSubpage.tsx
+++ b/src/Gang/ui/EquipmentsSubpage.tsx
@@ -1,6 +1,3 @@
-/**
- * React Component for the popup that manages gang members upgrades
- */
import React, { useState } from "react";
import { useGang } from "./Context";
@@ -244,6 +241,7 @@ function GangMemberUpgradePanel(props: IPanelProps): React.ReactElement {
);
}
+/** React Component for the popup that manages gang members upgrades */
export function EquipmentsSubpage(): React.ReactElement {
const gang = useGang();
const [filter, setFilter] = useState("");
diff --git a/src/Gang/ui/GangMemberCard.tsx b/src/Gang/ui/GangMemberCard.tsx
index c50fb9bb6..f4ab25127 100644
--- a/src/Gang/ui/GangMemberCard.tsx
+++ b/src/Gang/ui/GangMemberCard.tsx
@@ -1,6 +1,3 @@
-/**
- * React Component for a gang member on the management subpage.
- */
import React from "react";
import { GangMember } from "../GangMember";
import { GangMemberCardContent } from "./GangMemberCardContent";
@@ -14,6 +11,7 @@ interface IProps {
member: GangMember;
}
+/** React Component for a gang member on the management subpage. */
export function GangMemberCard(props: IProps): React.ReactElement {
return (
diff --git a/src/Gang/ui/GangMemberList.tsx b/src/Gang/ui/GangMemberList.tsx
index 3effe6508..411543b73 100644
--- a/src/Gang/ui/GangMemberList.tsx
+++ b/src/Gang/ui/GangMemberList.tsx
@@ -1,6 +1,3 @@
-/**
- * React Component for the list of gang members on the management subpage.
- */
import React, { useState } from "react";
import { GangMemberCard } from "./GangMemberCard";
import { RecruitButton } from "./RecruitButton";
@@ -12,6 +9,7 @@ import SearchIcon from "@mui/icons-material/Search";
import { GangMember } from "../GangMember";
import { OptionSwitch } from "../../ui/React/OptionSwitch";
+/** React Component for the list of gang members on the management subpage. */
export function GangMemberList(): React.ReactElement {
const gang = useGang();
const setRerender = useState(false)[1];
diff --git a/src/Gang/ui/GangRoot.tsx b/src/Gang/ui/GangRoot.tsx
index a64164b1c..743e58d54 100644
--- a/src/Gang/ui/GangRoot.tsx
+++ b/src/Gang/ui/GangRoot.tsx
@@ -1,6 +1,3 @@
-/**
- * React Component for all the gang stuff.
- */
import React, { useState, useEffect } from "react";
import { ManagementSubpage } from "./ManagementSubpage";
import { TerritorySubpage } from "./TerritorySubpage";
@@ -11,6 +8,7 @@ import { Context } from "./Context";
import Tabs from "@mui/material/Tabs";
import Tab from "@mui/material/Tab";
+/** React Component for all the gang stuff. */
export function GangRoot(): React.ReactElement {
const gang = (function () {
if (Player.gang === null) throw new Error("Gang should not be null");
diff --git a/src/Gang/ui/ManagementSubpage.tsx b/src/Gang/ui/ManagementSubpage.tsx
index 6f42a1aa8..9dc2f5175 100644
--- a/src/Gang/ui/ManagementSubpage.tsx
+++ b/src/Gang/ui/ManagementSubpage.tsx
@@ -1,12 +1,10 @@
-/**
- * React Component for the subpage that manages gang members, the main page.
- */
import React from "react";
import { GangStats } from "./GangStats";
import { GangMemberList } from "./GangMemberList";
import { useGang } from "./Context";
import Typography from "@mui/material/Typography";
+/** React Component for the subpage that manages gang members, the main page. */
export function ManagementSubpage(): React.ReactElement {
const gang = useGang();
return (
diff --git a/src/Gang/ui/RecruitButton.tsx b/src/Gang/ui/RecruitButton.tsx
index 039c9de46..8fe5d9094 100644
--- a/src/Gang/ui/RecruitButton.tsx
+++ b/src/Gang/ui/RecruitButton.tsx
@@ -1,6 +1,3 @@
-/**
- * React Component for the recruitment button and text on the gang main page.
- */
import React, { useState } from "react";
import { RecruitModal } from "./RecruitModal";
import { GangConstants } from "../data/Constants";
@@ -14,6 +11,7 @@ interface IProps {
onRecruit: () => void;
}
+/** React Component for the recruitment button and text on the gang main page. */
export function RecruitButton(props: IProps): React.ReactElement {
const gang = useGang();
const [open, setOpen] = useState(false);
diff --git a/src/Gang/ui/RecruitModal.tsx b/src/Gang/ui/RecruitModal.tsx
index 4c81c36fc..c1150320f 100644
--- a/src/Gang/ui/RecruitModal.tsx
+++ b/src/Gang/ui/RecruitModal.tsx
@@ -1,6 +1,3 @@
-/**
- * React Component for the popup used to recruit new gang members.
- */
import React, { useState } from "react";
import { Modal } from "../../ui/React/Modal";
import { dialogBoxCreate } from "../../ui/React/DialogBox";
@@ -16,6 +13,7 @@ interface IRecruitPopupProps {
onRecruit: () => void;
}
+/** React Component for the popup used to recruit new gang members. */
export function RecruitModal(props: IRecruitPopupProps): React.ReactElement {
const gang = useGang();
const [name, setName] = useState("");
diff --git a/src/Gang/ui/TerritorySubpage.tsx b/src/Gang/ui/TerritorySubpage.tsx
index ea58ccbfa..6dccb8778 100644
--- a/src/Gang/ui/TerritorySubpage.tsx
+++ b/src/Gang/ui/TerritorySubpage.tsx
@@ -1,6 +1,3 @@
-/**
- * React Component for the territory subpage.
- */
import React, { useState } from "react";
import { Container, Button, Paper, Box, Tooltip, Switch, FormControlLabel, Typography } from "@mui/material";
@@ -14,6 +11,7 @@ import { AllGangs } from "../AllGangs";
import { useGang } from "./Context";
import { TerritoryInfoModal } from "./TerritoryInfoModal";
+/** React Component for the territory subpage. */
export function TerritorySubpage(): React.ReactElement {
const gang = useGang();
const gangNames = Object.keys(AllGangs).filter((g) => g != gang.facName);
diff --git a/src/Hacking.ts b/src/Hacking.ts
index d0febe357..78308ecd9 100644
--- a/src/Hacking.ts
+++ b/src/Hacking.ts
@@ -3,9 +3,7 @@ import { Person } from "./PersonObjects/Person";
import { calculateIntelligenceBonus } from "./PersonObjects/formulas/intelligence";
import { Server } from "./Server/Server";
-/**
- * Returns the chance the person has to successfully hack a server
- */
+/** Returns the chance the person has to successfully hack a server */
export function calculateHackingChance(server: Server, person: Person): number {
const hackFactor = 1.75;
const difficultyMult = (100 - server.hackDifficulty) / 100;
@@ -64,9 +62,7 @@ export function calculatePercentMoneyHacked(server: Server, person: Person): num
return percentMoneyHacked;
}
-/**
- * Returns time it takes to complete a hack on a server, in seconds
- */
+/** Returns time it takes to complete a hack on a server, in seconds */
export function calculateHackingTime(server: Server, person: Person): number {
const difficultyMult = server.requiredHackingSkill * server.hackDifficulty;
@@ -85,18 +81,14 @@ export function calculateHackingTime(server: Server, person: Person): number {
return hackingTime;
}
-/**
- * Returns time it takes to complete a grow operation on a server, in seconds
- */
+/** Returns time it takes to complete a grow operation on a server, in seconds */
export function calculateGrowTime(server: Server, person: Person): number {
const growTimeMultiplier = 3.2; // Relative to hacking time. 16/5 = 3.2
return growTimeMultiplier * calculateHackingTime(server, person);
}
-/**
- * Returns time it takes to complete a weaken operation on a server, in seconds
- */
+/** Returns time it takes to complete a weaken operation on a server, in seconds */
export function calculateWeakenTime(server: Server, person: Person): number {
const weakenTimeMultiplier = 4; // Relative to hacking time
diff --git a/src/Hacknet/HacknetNode.ts b/src/Hacknet/HacknetNode.ts
index 4ba906f3e..c27b8e030 100644
--- a/src/Hacknet/HacknetNode.ts
+++ b/src/Hacknet/HacknetNode.ts
@@ -120,16 +120,12 @@ export class HacknetNode implements IHacknetNode {
}
}
- /**
- * Serialize the current object to a JSON save state.
- */
+ /** Serialize the current object to a JSON save state. */
toJSON(): IReviverValue {
return Generic_toJSON("HacknetNode", this);
}
- /**
- * Initiatizes a HacknetNode object from a JSON save state.
- */
+ /** Initiatizes a HacknetNode object from a JSON save state. */
static fromJSON(value: IReviverValue): HacknetNode {
return Generic_fromJSON(HacknetNode, value.data);
}
diff --git a/src/Hacknet/HacknetServer.ts b/src/Hacknet/HacknetServer.ts
index e2b005dd5..8bf2276ca 100644
--- a/src/Hacknet/HacknetServer.ts
+++ b/src/Hacknet/HacknetServer.ts
@@ -1,6 +1,3 @@
-/**
- * Hacknet Servers - Reworked Hacknet Node mechanic for BitNode-9
- */
import { CONSTANTS } from "../Constants";
import { IHacknetNode } from "./IHacknetNode";
@@ -30,6 +27,7 @@ interface IConstructorParams {
organizationName?: string;
}
+/** Hacknet Servers - Reworked Hacknet Node mechanic for BitNode-9 */
export class HacknetServer extends BaseServer implements IHacknetNode {
// Cache level. Affects hash Capacity
cache = 1;
diff --git a/src/Hacknet/HashManager.ts b/src/Hacknet/HashManager.ts
index 85d3ecd0a..48b5541f6 100644
--- a/src/Hacknet/HashManager.ts
+++ b/src/Hacknet/HashManager.ts
@@ -28,9 +28,7 @@ export class HashManager {
}
}
- /**
- * Generic helper function for getting a multiplier from a HashUpgrade
- */
+ /** Generic helper function for getting a multiplier from a HashUpgrade */
getMult(upgName: string): number {
const upg = HashUpgrades[upgName];
const currLevel = this.upgrades[upgName];
@@ -42,18 +40,14 @@ export class HashManager {
return 1 + (upg.value * currLevel) / 100;
}
- /**
- * One of the Hash upgrades improves studying. This returns that multiplier
- */
+ /** One of the Hash upgrades improves studying. This returns that multiplier */
getStudyMult(): number {
const upgName = "Improve Studying";
return this.getMult(upgName);
}
- /**
- * One of the Hash upgrades improves gym training. This returns that multiplier
- */
+ /** One of the Hash upgrades improves gym training. This returns that multiplier */
getTrainingMult(): number {
const upgName = "Improve Gym Training";
@@ -69,9 +63,7 @@ export class HashManager {
return upg;
}
- /**
- * Get the cost (in hashes) of an upgrade
- */
+ /** Get the cost (in hashes) of an upgrade */
getUpgradeCost(upgName: string, count = 1): number {
const upg = this.getUpgrade(upgName);
const currLevel = this.upgrades[upgName];
@@ -93,9 +85,7 @@ export class HashManager {
this.updateCapacity(0);
}
- /**
- * Reverts an upgrade and refunds the hashes used to buy it
- */
+ /** Reverts an upgrade and refunds the hashes used to buy it */
refundUpgrade(upgName: string, count = 1): void {
const upg = HashUpgrades[upgName];
diff --git a/src/Hacknet/HashUpgrade.ts b/src/Hacknet/HashUpgrade.ts
index 9f53f333a..5b6c14ae1 100644
--- a/src/Hacknet/HashUpgrade.ts
+++ b/src/Hacknet/HashUpgrade.ts
@@ -1,6 +1,4 @@
-/**
- * Object representing an upgrade that can be purchased with hashes
- */
+/** Object representing an upgrade that can be purchased with hashes */
export interface IConstructorParams {
cost?: number;
costPerLevel: number;
@@ -26,9 +24,7 @@ export class HashUpgrade {
*/
costPerLevel = 0;
- /**
- * Description of what the upgrade does
- */
+ /** Description of what the upgrade does */
desc = "";
/**
@@ -37,7 +33,7 @@ export class HashUpgrade {
*/
hasTargetServer = false;
- // Name of upgrade
+ /** Name of upgrade */
name = "";
// Generic value used to indicate the potency/amount of this upgrade's effect
diff --git a/src/Hacknet/ui/HacknetRoot.tsx b/src/Hacknet/ui/HacknetRoot.tsx
index 16bb14612..028cd0833 100644
--- a/src/Hacknet/ui/HacknetRoot.tsx
+++ b/src/Hacknet/ui/HacknetRoot.tsx
@@ -1,6 +1,3 @@
-/**
- * Root React Component for the Hacknet Node UI
- */
import React, { useState, useEffect } from "react";
import { GeneralInfo } from "./GeneralInfo";
@@ -29,6 +26,7 @@ import Grid from "@mui/material/Grid";
import Button from "@mui/material/Button";
import { Box } from "@mui/material";
+/** Root React Component for the Hacknet Node UI */
export function HacknetRoot(): React.ReactElement {
const [open, setOpen] = useState(false);
const setRerender = useState(false)[1];
diff --git a/src/Hacknet/ui/HashUpgradeModal.tsx b/src/Hacknet/ui/HashUpgradeModal.tsx
index 83c4d68c2..93ebb86ed 100644
--- a/src/Hacknet/ui/HashUpgradeModal.tsx
+++ b/src/Hacknet/ui/HashUpgradeModal.tsx
@@ -1,6 +1,3 @@
-/**
- * Create the pop-up for purchasing upgrades with hashes
- */
import React, { useState, useEffect } from "react";
import { HashUpgrades } from "../HashUpgrades";
@@ -16,6 +13,7 @@ interface IProps {
onClose: () => void;
}
+/** Create the pop-up for purchasing upgrades with hashes */
export function HashUpgradeModal(props: IProps): React.ReactElement {
const setRerender = useState(false)[1];
function rerender(): void {
diff --git a/src/Hacknet/ui/PurchaseButton.tsx b/src/Hacknet/ui/PurchaseButton.tsx
index 7d4c4a5f4..45bfb55a3 100644
--- a/src/Hacknet/ui/PurchaseButton.tsx
+++ b/src/Hacknet/ui/PurchaseButton.tsx
@@ -1,6 +1,3 @@
-/**
- * React Component for the button that is used to purchase new Hacknet Nodes
- */
import React from "react";
import { hasHacknetServers, hasMaxNumberHacknetServers } from "../HacknetHelpers";
@@ -15,6 +12,7 @@ interface IProps {
cost: number;
}
+/** React Component for the button that is used to purchase new Hacknet Nodes */
export function PurchaseButton(props: IProps): React.ReactElement {
const cost = props.cost;
let text;
diff --git a/src/Locations/City.ts b/src/Locations/City.ts
index 089c0d869..44f69fa43 100644
--- a/src/Locations/City.ts
+++ b/src/Locations/City.ts
@@ -1,23 +1,15 @@
-/**
- * Class representing a City in the game
- */
import { CityName } from "./data/CityNames";
import { LocationName } from "./data/LocationNames";
+/** Class representing a City in the game */
export class City {
- /**
- * List of all locations in this city
- */
+ /** List of all locations in this city */
locations: LocationName[];
- /**
- * Name of this city
- */
+ /** Name of this city */
name: CityName;
- /**
- * Metro map ascii art
- */
+ /** Metro map ascii art */
asciiArt: string;
constructor(name: CityName, locations: LocationName[] = [], asciiArt = "") {
diff --git a/src/Locations/Location.ts b/src/Locations/Location.ts
index eaf06fecc..ae9ea5384 100644
--- a/src/Locations/Location.ts
+++ b/src/Locations/Location.ts
@@ -1,6 +1,3 @@
-/**
- * Class representing a visitable location in the world
- */
import { CityName } from "./data/CityNames";
import { LocationName } from "./data/LocationNames";
import { LocationType } from "./LocationTypeEnum";
@@ -21,6 +18,7 @@ export interface IConstructorParams {
techVendorMinRam?: number;
}
+/** Class representing a visitable location in the world */
export class Location {
/**
* Name of city this location is in. If this property is null, it means this i
@@ -28,14 +26,10 @@ export class Location {
*/
city: CityName | null = null;
- /**
- * Cost multiplier that influences how expensive a gym/university is
- */
+ /** Cost multiplier that influences how expensive a gym/university is */
costMult = 0;
- /**
- * Exp multiplier that influences how effective a gym/university is
- */
+ /** Exp multiplier that influences how effective a gym/university is */
expMult = 0;
/**
@@ -44,9 +38,7 @@ export class Location {
*/
infiltrationData?: IInfiltrationMetadata;
- /**
- * Identifier for location
- */
+ /** Identifier for location */
name: LocationName = LocationName.Void;
/**
diff --git a/src/Locations/LocationTypeEnum.ts b/src/Locations/LocationTypeEnum.ts
index c5cdf9bbc..eb587f19a 100644
--- a/src/Locations/LocationTypeEnum.ts
+++ b/src/Locations/LocationTypeEnum.ts
@@ -1,6 +1,4 @@
-/**
- * Enum defining the different types of possible locations
- */
+/** Enum defining the different types of possible locations */
export enum LocationType {
Company,
Gym,
diff --git a/src/Locations/data/LocationNames.ts b/src/Locations/data/LocationNames.ts
index 4a8efdc44..abb02befa 100644
--- a/src/Locations/data/LocationNames.ts
+++ b/src/Locations/data/LocationNames.ts
@@ -1,6 +1,4 @@
-/**
- * Names of all locations
- */
+/** Names of all locations */
export enum LocationName {
// Aevum Locations
AevumAeroCorp = "AeroCorp",
diff --git a/src/Locations/ui/ApplyToJobButton.tsx b/src/Locations/ui/ApplyToJobButton.tsx
index 0441c6e07..f1055c492 100644
--- a/src/Locations/ui/ApplyToJobButton.tsx
+++ b/src/Locations/ui/ApplyToJobButton.tsx
@@ -1,6 +1,3 @@
-/**
- * React Component for a button that's used to apply for a job
- */
import * as React from "react";
import { Company } from "../../Company/Company";
@@ -18,6 +15,7 @@ type IProps = {
text: string;
};
+/** React Component for a button that's used to apply for a job */
export function ApplyToJobButton(props: IProps): React.ReactElement {
function getJobRequirementTooltip(): string {
const pos = Player.getNextCompanyPosition(props.company, props.entryPosType);
diff --git a/src/Locations/ui/CompanyLocation.tsx b/src/Locations/ui/CompanyLocation.tsx
index 13a125df8..78608acc9 100644
--- a/src/Locations/ui/CompanyLocation.tsx
+++ b/src/Locations/ui/CompanyLocation.tsx
@@ -47,17 +47,13 @@ export function CompanyLocation(props: IProps): React.ReactElement {
const company = Companies[props.locName];
if (company == null) throw new Error(`CompanyLocation component constructed with invalid company: ${props.locName}`);
- /**
- * Reference to the Location that this component is being rendered for
- */
+ /** Reference to the Location that this component is being rendered for */
const location = Locations[props.locName];
if (location == null) {
throw new Error(`CompanyLocation component constructed with invalid location: ${props.locName}`);
}
- /**
- * Name of company position that player holds, if applicable
- */
+ /** Name of company position that player holds, if applicable */
const jobTitle = Player.jobs[props.locName] ? Player.jobs[props.locName] : null;
/**
diff --git a/src/Locations/ui/HospitalLocation.tsx b/src/Locations/ui/HospitalLocation.tsx
index 1268f621a..e3a6e5478 100644
--- a/src/Locations/ui/HospitalLocation.tsx
+++ b/src/Locations/ui/HospitalLocation.tsx
@@ -19,9 +19,7 @@ type IState = {
//Todo: Make this a functional component
export class HospitalLocation extends React.Component, IState> {
- /**
- * Stores button styling that sets them all to block display
- */
+ /** Stores button styling that sets them all to block display */
btnStyle = { display: "block" };
constructor() {
diff --git a/src/Locations/ui/PurchaseServerModal.tsx b/src/Locations/ui/PurchaseServerModal.tsx
index 60b1853d4..4962f2a3b 100644
--- a/src/Locations/ui/PurchaseServerModal.tsx
+++ b/src/Locations/ui/PurchaseServerModal.tsx
@@ -1,6 +1,3 @@
-/**
- * React Component for the popup used to purchase a new server.
- */
import React, { useState } from "react";
import { purchaseServer } from "../../Server/ServerPurchases";
import { numeralWrapper } from "../../ui/numeralFormat";
@@ -20,6 +17,7 @@ interface IProps {
rerender: () => void;
}
+/** React Component for the popup used to purchase a new server. */
export function PurchaseServerModal(props: IProps): React.ReactElement {
const [hostname, setHostname] = useState("");
diff --git a/src/Locations/ui/SpecialLocation.tsx b/src/Locations/ui/SpecialLocation.tsx
index e003cd1f7..3c0d5ede1 100644
--- a/src/Locations/ui/SpecialLocation.tsx
+++ b/src/Locations/ui/SpecialLocation.tsx
@@ -25,7 +25,7 @@ import { Router } from "../../ui/GameRoot";
import { Player } from "../../Player";
import { dialogBoxCreate } from "../../ui/React/DialogBox";
-import { SnackbarEvents } from "../../ui/React/Snackbar";
+import { SnackbarEvents, ToastVariant } from "../../ui/React/Snackbar";
import { N00dles } from "../../utils/helpers/N00dles";
import { Exploit } from "../../Exploits/Exploit";
import { applyAugmentation } from "../../Augmentation/AugmentationHelpers";
@@ -45,9 +45,7 @@ export function SpecialLocation(props: IProps): React.ReactElement {
const setRerender = useState(false)[1];
const inBladeburner = Player.inBladeburner();
- /**
- * Click handler for Bladeburner button at Sector-12 NSA
- */
+ /** Click handler for Bladeburner button at Sector-12 NSA */
function handleBladeburner(): void {
if (Player.inBladeburner()) {
// Enter Bladeburner division
@@ -73,9 +71,7 @@ export function SpecialLocation(props: IProps): React.ReactElement {
}
}
- /**
- * Click handler for Resleeving button at New Tokyo VitaLife
- */
+ /** Click handler for Resleeving button at New Tokyo VitaLife */
function handleGrafting(): void {
Router.toGrafting();
}
@@ -95,7 +91,7 @@ export function SpecialLocation(props: IProps): React.ReactElement {
function renderNoodleBar(): React.ReactElement {
function EatNoodles(): void {
- SnackbarEvents.emit("You ate some delicious noodles and feel refreshed", "success", 2000);
+ SnackbarEvents.emit("You ate some delicious noodles and feel refreshed", ToastVariant.SUCCESS, 2000);
N00dles(); // This is the true power of the noodles.
if (Player.sourceFiles.length > 0) Player.giveExploit(Exploit.N00dles);
if (Player.sourceFileLvl(5) > 0 || Player.bitNodeN === 5) {
diff --git a/src/Locations/ui/TorButton.tsx b/src/Locations/ui/TorButton.tsx
index 80e69671f..63c94a797 100644
--- a/src/Locations/ui/TorButton.tsx
+++ b/src/Locations/ui/TorButton.tsx
@@ -10,9 +10,7 @@ import { Player } from "../../Player";
import { Money } from "../../ui/React/Money";
-/**
- * Attempt to purchase a TOR router using the button.
- */
+/** Attempt to purchase a TOR router using the button. */
export function purchaseTorRouter(): void {
if (Player.hasTorRouter()) {
dialogBoxCreate(`You already have a TOR Router!`);
diff --git a/src/Netscript/Environment.ts b/src/Netscript/Environment.ts
index 6985ec043..3bb24bc7a 100644
--- a/src/Netscript/Environment.ts
+++ b/src/Netscript/Environment.ts
@@ -5,19 +5,13 @@ import { NS } from "../ScriptEditor/NetscriptDefinitions";
* Netscript functions and arguments for that script.
*/
export class Environment {
- /**
- * Whether or not the script that uses this Environment should stop running
- */
+ /** Whether or not the script that uses this Environment should stop running */
stopFlag = false;
- /**
- * The currently running function
- */
+ /** The currently running function */
runningFn = "";
- /**
- * Environment variables (currently only Netscript functions)
- */
+ /** Environment variables (currently only Netscript functions) */
vars: NS | null = null;
}
diff --git a/src/Netscript/Pid.ts b/src/Netscript/Pid.ts
index 77c5db17c..cd236518b 100644
--- a/src/Netscript/Pid.ts
+++ b/src/Netscript/Pid.ts
@@ -2,9 +2,7 @@ import { workerScripts } from "./WorkerScripts";
let pidCounter = 1;
-/**
- * Find and return the next availble PID for a script
- */
+/** Find and return the next availble PID for a script */
export function generateNextPid(): number {
let tempCounter = pidCounter;
diff --git a/src/Netscript/WorkerScript.ts b/src/Netscript/WorkerScript.ts
index 238b0be43..ff9ad4d99 100644
--- a/src/Netscript/WorkerScript.ts
+++ b/src/Netscript/WorkerScript.ts
@@ -18,14 +18,10 @@ import { ScriptDeath } from "./ScriptDeath";
import { ScriptArg } from "./ScriptArg";
export class WorkerScript {
- /**
- * Script's arguments
- */
+ /** Script's arguments */
args: ScriptArg[];
- /**
- * Copy of the script's code
- */
+ /** Copy of the script's code */
code = "";
/**
@@ -34,14 +30,10 @@ export class WorkerScript {
*/
delay: number | null = null;
- /**
- * Holds the Promise reject() function while the script is "blocked" by an async op
- */
+ /** Holds the Promise reject() function while the script is "blocked" by an async op */
delayReject?: (reason?: ScriptDeath) => void;
- /**
- * Stores names of all functions that have logging disabled
- */
+ /** Stores names of all functions that have logging disabled */
disableLogs: Record = {};
/**
@@ -51,19 +43,13 @@ export class WorkerScript {
*/
dynamicLoadedFns: Record = {};
- /**
- * Tracks dynamic RAM usage
- */
+ /** Tracks dynamic RAM usage */
dynamicRamUsage: number = RamCostConstants.ScriptBaseRamCost;
- /**
- * Netscript Environment for this script
- */
+ /** Netscript Environment for this script */
env: Environment;
- /**
- * Status message in case of script error.
- */
+ /** Status message in case of script error. */
errorMessage = "";
/**
@@ -72,14 +58,10 @@ export class WorkerScript {
*/
loadedFns: Record = {};
- /**
- * Filename of script
- */
+ /** Filename of script */
name: string;
- /**
- * Script's output/return value. Currently not used or implemented
- */
+ /** Script's output/return value. Currently not used or implemented */
output = "";
/**
@@ -88,24 +70,16 @@ export class WorkerScript {
*/
pid: number;
- /**
- * Script's Static RAM usage. Equivalent to underlying script's RAM usage
- */
+ /** Script's Static RAM usage. Equivalent to underlying script's RAM usage */
ramUsage = 0;
- /**
- * Reference to underlying RunningScript object
- */
+ /** Reference to underlying RunningScript object */
scriptRef: RunningScript;
- /**
- * hostname on which this script is running
- */
+ /** hostname on which this script is running */
hostname: string;
- /**
- * Function called when the script ends.
- */
+ /** Function called when the script ends. */
atExit?: () => void;
constructor(runningScriptObj: RunningScript, pid: number, nsFuncsGenerator?: (ws: WorkerScript) => NS) {
@@ -142,9 +116,7 @@ export class WorkerScript {
}
}
- /**
- * Returns the Server on which this script is running
- */
+ /** Returns the Server on which this script is running */
getServer(): BaseServer {
const server = GetServer(this.hostname);
if (server == null) throw new Error(`Script ${this.name} pid ${this.pid} is running on non-existent server?`);
diff --git a/src/Netscript/WorkerScriptStartStopEventEmitter.ts b/src/Netscript/WorkerScriptStartStopEventEmitter.ts
index ac1c2ad2b..45a703fdc 100644
--- a/src/Netscript/WorkerScriptStartStopEventEmitter.ts
+++ b/src/Netscript/WorkerScriptStartStopEventEmitter.ts
@@ -1,6 +1,4 @@
-/**
- * Event emitter that triggers when scripts are started/stopped
- */
import { EventEmitter } from "../utils/EventEmitter";
+/** Event emitter that triggers when scripts are started/stopped */
export const WorkerScriptStartStopEventEmitter = new EventEmitter<[]>();
diff --git a/src/Netscript/WorkerScripts.ts b/src/Netscript/WorkerScripts.ts
index 58c184314..24008cffe 100644
--- a/src/Netscript/WorkerScripts.ts
+++ b/src/Netscript/WorkerScripts.ts
@@ -1,6 +1,4 @@
-/**
- * Global pool of all active scripts (scripts that are currently running)
- */
import { WorkerScript } from "./WorkerScript";
+/** Global pool of all active scripts (scripts that are currently running) */
export const workerScripts: Map = new Map();
diff --git a/src/NetscriptFunctions.ts b/src/NetscriptFunctions.ts
index c15235c54..201c4a154 100644
--- a/src/NetscriptFunctions.ts
+++ b/src/NetscriptFunctions.ts
@@ -80,17 +80,11 @@ import { recentScripts } from "./Netscript/RecentScripts";
import { InternalAPI, NetscriptContext, wrapAPI } from "./Netscript/APIWrapper";
import { INetscriptExtra } from "./NetscriptFunctions/Extra";
import { ScriptDeath } from "./Netscript/ScriptDeath";
-import { TypeEquality, ValuesFrom } from "./types";
// "Enums" as object
export const enums = {
- toast: {
- SUCCESS: "success",
- WARNING: "warning",
- ERROR: "error",
- INFO: "info",
- } as const,
-};
+ toast: ToastVariant,
+} as const;
export type NSFull = NS & INetscriptExtra;
export function NetscriptFunctions(workerScript: WorkerScript): NSFull {
@@ -1796,7 +1790,7 @@ const base: InternalAPI = {
const duration = _duration === null ? null : helpers.number(ctx, "duration", _duration);
if (!checkObjContainsValue(enums.toast, variant))
throw new Error(`variant must be one of ${Object.values(enums.toast).join(", ")}`);
- SnackbarEvents.emit(message, variant, duration);
+ SnackbarEvents.emit(message, variant as ToastVariant, duration);
},
prompt:
(ctx: NetscriptContext) =>
diff --git a/src/NetscriptFunctions/StockMarket.ts b/src/NetscriptFunctions/StockMarket.ts
index 7d0712e22..273ec8a24 100644
--- a/src/NetscriptFunctions/StockMarket.ts
+++ b/src/NetscriptFunctions/StockMarket.ts
@@ -17,9 +17,7 @@ import { InternalAPI, NetscriptContext } from "../Netscript/APIWrapper";
import { helpers } from "../Netscript/NetscriptHelpers";
export function NetscriptStockMarket(): InternalAPI {
- /**
- * Checks if the player has TIX API access. Throws an error if the player does not
- */
+ /** Checks if the player has TIX API access. Throws an error if the player does not */
const checkTixApiAccess = function (ctx: NetscriptContext): void {
if (!player.hasWseAccount) {
throw helpers.makeRuntimeErrorMsg(ctx, `You don't have WSE Access! Cannot use ${ctx.function}()`);
diff --git a/src/NetscriptWorker.ts b/src/NetscriptWorker.ts
index a69548656..a0a6f992f 100644
--- a/src/NetscriptWorker.ts
+++ b/src/NetscriptWorker.ts
@@ -354,9 +354,7 @@ function createAndAddWorkerScript(runningScriptObj: RunningScript, server: BaseS
return true;
}
-/**
- * Updates the online running time stat of all running scripts
- */
+/** Updates the online running time stat of all running scripts */
export function updateOnlineScriptTimes(numCycles = 1): void {
const time = (numCycles * CONSTANTS._idleSpeed) / 1000; //seconds
for (const ws of workerScripts.values()) {
@@ -404,9 +402,7 @@ export function loadAllRunningScripts(): void {
}
}
-/**
- * Run a script from inside another script (run(), exec(), spawn(), etc.)
- */
+/** Run a script from inside another script (run(), exec(), spawn(), etc.) */
export function runScriptFromScript(
caller: string,
server: BaseServer,
diff --git a/src/PersonObjects/Player/PlayerObject.ts b/src/PersonObjects/Player/PlayerObject.ts
index faa16699d..49fb2cf28 100644
--- a/src/PersonObjects/Player/PlayerObject.ts
+++ b/src/PersonObjects/Player/PlayerObject.ts
@@ -159,16 +159,12 @@ export class PlayerObject extends Person {
return "Player";
}
- /**
- * Serialize the current object to a JSON save state.
- */
+ /** Serialize the current object to a JSON save state. */
toJSON(): IReviverValue {
return Generic_toJSON("PlayerObject", this);
}
- /**
- * Initiatizes a PlayerObject object from a JSON save state.
- */
+ /** Initiatizes a PlayerObject object from a JSON save state. */
static fromJSON(value: IReviverValue): PlayerObject {
return Generic_fromJSON(PlayerObject, value.data);
}
diff --git a/src/PersonObjects/Player/PlayerObjectAugmentationMethods.ts b/src/PersonObjects/Player/PlayerObjectAugmentationMethods.ts
index a5da1c307..e116e5240 100644
--- a/src/PersonObjects/Player/PlayerObjectAugmentationMethods.ts
+++ b/src/PersonObjects/Player/PlayerObjectAugmentationMethods.ts
@@ -1,6 +1,4 @@
-/**
- * Augmentation-related methods for the Player class (PlayerObject)
- */
+/** Augmentation-related methods for the Player class (PlayerObject) */
import { PlayerObject } from "./PlayerObject";
import { calculateEntropy } from "../Grafting/EntropyAccumulation";
diff --git a/src/PersonObjects/Player/PlayerObjectGeneralMethods.ts b/src/PersonObjects/Player/PlayerObjectGeneralMethods.ts
index bc378cfa9..3cc2e46d4 100644
--- a/src/PersonObjects/Player/PlayerObjectGeneralMethods.ts
+++ b/src/PersonObjects/Player/PlayerObjectGeneralMethods.ts
@@ -39,7 +39,7 @@ import { numeralWrapper } from "../../ui/numeralFormat";
import { MoneySourceTracker } from "../../utils/MoneySourceTracker";
import { dialogBoxCreate } from "../../ui/React/DialogBox";
-import { SnackbarEvents } from "../../ui/React/Snackbar";
+import { SnackbarEvents, ToastVariant } from "../../ui/React/Snackbar";
import { achievements } from "../../Achievements/Achievements";
import { FactionNames } from "../../Faction/data/FactionNames";
@@ -257,7 +257,7 @@ export function takeDamage(this: PlayerObject, amt: number): boolean {
export function hospitalize(this: PlayerObject): number {
const cost = getHospitalizationCost();
- SnackbarEvents.emit(`You've been Hospitalized for ${numeralWrapper.formatMoney(cost)}`, "warning", 2000);
+ SnackbarEvents.emit(`You've been Hospitalized for ${numeralWrapper.formatMoney(cost)}`, ToastVariant.SUCCESS, 2000);
this.loseMoney(cost, "hospitalization");
this.hp.current = this.hp.max;
@@ -1193,7 +1193,7 @@ export function canAccessGrafting(this: PlayerObject): boolean {
export function giveExploit(this: PlayerObject, exploit: Exploit): void {
if (!this.exploits.includes(exploit)) {
this.exploits.push(exploit);
- SnackbarEvents.emit("SF -1 acquired!", "success", 2000);
+ SnackbarEvents.emit("SF -1 acquired!", ToastVariant.SUCCESS, 2000);
}
}
@@ -1202,7 +1202,7 @@ export function giveAchievement(this: PlayerObject, achievementId: string): void
if (!achievement) return;
if (!this.achievements.map((a) => a.ID).includes(achievementId)) {
this.achievements.push({ ID: achievementId, unlockedOn: new Date().getTime() });
- SnackbarEvents.emit(`Unlocked Achievement: "${achievement.Name}"`, "success", 2000);
+ SnackbarEvents.emit(`Unlocked Achievement: "${achievement.Name}"`, ToastVariant.SUCCESS, 2000);
}
}
diff --git a/src/PersonObjects/Player/PlayerObjectServerMethods.ts b/src/PersonObjects/Player/PlayerObjectServerMethods.ts
index a8ff2c456..ea991401c 100644
--- a/src/PersonObjects/Player/PlayerObjectServerMethods.ts
+++ b/src/PersonObjects/Player/PlayerObjectServerMethods.ts
@@ -1,6 +1,4 @@
-/**
- * Server and HacknetServer-related methods for the Player class (PlayerObject)
- */
+// Server and HacknetServer-related methods for the Player class (PlayerObject)
import { PlayerObject } from "./PlayerObject";
import { CONSTANTS } from "../../Constants";
diff --git a/src/PersonObjects/Sleeve/Sleeve.ts b/src/PersonObjects/Sleeve/Sleeve.ts
index aa934b705..574337e47 100644
--- a/src/PersonObjects/Sleeve/Sleeve.ts
+++ b/src/PersonObjects/Sleeve/Sleeve.ts
@@ -48,9 +48,7 @@ import * as sleeveMethods from "./SleeveMethods";
export class Sleeve extends Person {
currentWork: Work | null = null;
- /**
- * Clone retains 'memory' synchronization (and maybe exp?) upon prestige/installing Augs
- */
+ /** Clone retains 'memory' synchronization (and maybe exp?) upon prestige/installing Augs */
memory = 1;
/**
@@ -62,9 +60,7 @@ export class Sleeve extends Person {
*/
shock = 1;
- /**
- * Stored number of game "loop" cycles
- */
+ /** Stored number of game "loop" cycles */
storedCycles = 0;
/**
@@ -100,9 +96,7 @@ export class Sleeve extends Person {
this.currentWork = null;
}
- /**
- * Commit crimes
- */
+ /** Commit crimes */
commitCrime(crimeKey: string): boolean {
const crime: Crime | null = Crimes[crimeKey] || Object.values(Crimes).find((crime) => crime.name === crimeKey);
if (!crime) {
@@ -113,9 +107,7 @@ export class Sleeve extends Person {
return true;
}
- /**
- * Returns the cost of upgrading this sleeve's memory by a certain amount
- */
+ /** Returns the cost of upgrading this sleeve's memory by a certain amount */
getMemoryUpgradeCost(n: number): number {
const amt = Math.round(n);
if (amt < 0) {
@@ -150,9 +142,7 @@ export class Sleeve extends Person {
this.updateSkillLevels();
}
- /**
- * Called on every sleeve for a Source File Prestige
- */
+ /** Called on every sleeve for a Source File Prestige */
prestige(): void {
// Reset exp
this.exp.hacking = 0;
@@ -211,9 +201,7 @@ export class Sleeve extends Person {
return true;
}
- /**
- * Take a course at a university
- */
+ /** Take a course at a university */
takeUniversityCourse(universityName: string, className: string): boolean {
// Set exp/money multipliers based on which university.
// Also check that the sleeve is in the right city
@@ -270,9 +258,7 @@ export class Sleeve extends Person {
return true;
}
- /**
- * Travel to another City. Costs money from player
- */
+ /** Travel to another City. Costs money from player */
travel(newCity: CityName): boolean {
Player.loseMoney(CONSTANTS.TravelCost, "sleeves");
this.city = newCity;
@@ -354,9 +340,7 @@ export class Sleeve extends Person {
return true;
}
- /**
- * Begin a gym workout task
- */
+ /** Begin a gym workout task */
workoutAtGym(gymName: string, stat: string): boolean {
// Set exp/money multipliers based on which university.
// Also check that the sleeve is in the right city
@@ -420,9 +404,7 @@ export class Sleeve extends Person {
return true;
}
- /**
- * Begin a bladeburner task
- */
+ /** Begin a bladeburner task */
bladeburner(action: string, contract: string): boolean {
if (!Player.bladeburner) return false;
switch (action) {
@@ -495,16 +477,12 @@ export class Sleeve extends Person {
return "Sleeve";
}
- /**
- * Serialize the current object to a JSON save state.
- */
+ /** Serialize the current object to a JSON save state. */
toJSON(): IReviverValue {
return Generic_toJSON("Sleeve", this);
}
- /**
- * Initiatizes a Sleeve object from a JSON save state.
- */
+ /** Initiatizes a Sleeve object from a JSON save state. */
static fromJSON(value: IReviverValue): Sleeve {
return Generic_fromJSON(Sleeve, value.data);
}
diff --git a/src/PersonObjects/Sleeve/SleeveMethods.ts b/src/PersonObjects/Sleeve/SleeveMethods.ts
index 2009da2f7..ae2da0958 100644
--- a/src/PersonObjects/Sleeve/SleeveMethods.ts
+++ b/src/PersonObjects/Sleeve/SleeveMethods.ts
@@ -10,9 +10,7 @@ import { mergeMultipliers, Multipliers } from "../Multipliers";
import { AugmentationNames } from "../../Augmentation/data/AugmentationNames";
import { getFactionAugmentationsFiltered } from "../../Faction/FactionHelpers";
-/**
- * Updates this object's multipliers for the given augmentation
- */
+/** Updates this object's multipliers for the given augmentation */
export function applyAugmentation(this: Sleeve, aug: Augmentation): void {
this.mults = mergeMultipliers(this.mults, aug.mults);
}
diff --git a/src/PersonObjects/Sleeve/SleeveTaskTypesEnum.ts b/src/PersonObjects/Sleeve/SleeveTaskTypesEnum.ts
index 68881383f..ab8cffd19 100644
--- a/src/PersonObjects/Sleeve/SleeveTaskTypesEnum.ts
+++ b/src/PersonObjects/Sleeve/SleeveTaskTypesEnum.ts
@@ -1,6 +1,4 @@
-/**
- * Enum for different types of tasks that a Sleeve can perform
- */
+/** Enum for different types of tasks that a Sleeve can perform */
export enum SleeveTaskType {
// Same Order as selectable order in UI
Idle,
diff --git a/src/PersonObjects/Sleeve/Work/SleeveBladeburnerWork.ts b/src/PersonObjects/Sleeve/Work/SleeveBladeburnerWork.ts
index cd4de69de..4a5bf96bd 100644
--- a/src/PersonObjects/Sleeve/Work/SleeveBladeburnerWork.ts
+++ b/src/PersonObjects/Sleeve/Work/SleeveBladeburnerWork.ts
@@ -75,16 +75,12 @@ export class SleeveBladeburnerWork extends Work {
};
}
- /**
- * Serialize the current object to a JSON save state.
- */
+ /** Serialize the current object to a JSON save state. */
toJSON(): IReviverValue {
return Generic_toJSON("SleeveBladeburnerWork", this);
}
- /**
- * Initiatizes a BladeburnerWork object from a JSON save state.
- */
+ /** Initiatizes a BladeburnerWork object from a JSON save state. */
static fromJSON(value: IReviverValue): SleeveBladeburnerWork {
return Generic_fromJSON(SleeveBladeburnerWork, value.data);
}
diff --git a/src/PersonObjects/Sleeve/Work/SleeveClassWork.ts b/src/PersonObjects/Sleeve/Work/SleeveClassWork.ts
index 1b59b78fb..ae5fac113 100644
--- a/src/PersonObjects/Sleeve/Work/SleeveClassWork.ts
+++ b/src/PersonObjects/Sleeve/Work/SleeveClassWork.ts
@@ -45,16 +45,12 @@ export class SleeveClassWork extends Work {
location: this.location,
};
}
- /**
- * Serialize the current object to a JSON save state.
- */
+ /** Serialize the current object to a JSON save state. */
toJSON(): IReviverValue {
return Generic_toJSON("SleeveClassWork", this);
}
- /**
- * Initiatizes a ClassWork object from a JSON save state.
- */
+ /** Initiatizes a ClassWork object from a JSON save state. */
static fromJSON(value: IReviverValue): SleeveClassWork {
return Generic_fromJSON(SleeveClassWork, value.data);
}
diff --git a/src/PersonObjects/Sleeve/Work/SleeveCompanyWork.ts b/src/PersonObjects/Sleeve/Work/SleeveCompanyWork.ts
index a3a53e5a3..a83967941 100644
--- a/src/PersonObjects/Sleeve/Work/SleeveCompanyWork.ts
+++ b/src/PersonObjects/Sleeve/Work/SleeveCompanyWork.ts
@@ -49,16 +49,12 @@ export class SleeveCompanyWork extends Work {
};
}
- /**
- * Serialize the current object to a JSON save state.
- */
+ /** Serialize the current object to a JSON save state. */
toJSON(): IReviverValue {
return Generic_toJSON("SleeveCompanyWork", this);
}
- /**
- * Initiatizes a CompanyWork object from a JSON save state.
- */
+ /** Initiatizes a CompanyWork object from a JSON save state. */
static fromJSON(value: IReviverValue): SleeveCompanyWork {
return Generic_fromJSON(SleeveCompanyWork, value.data);
}
diff --git a/src/PersonObjects/Sleeve/Work/SleeveCrimeWork.ts b/src/PersonObjects/Sleeve/Work/SleeveCrimeWork.ts
index 75d315452..fe2c56202 100644
--- a/src/PersonObjects/Sleeve/Work/SleeveCrimeWork.ts
+++ b/src/PersonObjects/Sleeve/Work/SleeveCrimeWork.ts
@@ -68,16 +68,12 @@ export class SleeveCrimeWork extends Work {
};
}
- /**
- * Serialize the current object to a JSON save state.
- */
+ /** Serialize the current object to a JSON save state. */
toJSON(): IReviverValue {
return Generic_toJSON("SleeveCrimeWork", this);
}
- /**
- * Initiatizes a RecoveryWork object from a JSON save state.
- */
+ /** Initiatizes a RecoveryWork object from a JSON save state. */
static fromJSON(value: IReviverValue): SleeveCrimeWork {
return Generic_fromJSON(SleeveCrimeWork, value.data);
}
diff --git a/src/PersonObjects/Sleeve/Work/SleeveFactionWork.ts b/src/PersonObjects/Sleeve/Work/SleeveFactionWork.ts
index d4df44ba5..0d4711afc 100644
--- a/src/PersonObjects/Sleeve/Work/SleeveFactionWork.ts
+++ b/src/PersonObjects/Sleeve/Work/SleeveFactionWork.ts
@@ -78,16 +78,12 @@ export class SleeveFactionWork extends Work {
};
}
- /**
- * Serialize the current object to a JSON save state.
- */
+ /** Serialize the current object to a JSON save state. */
toJSON(): IReviverValue {
return Generic_toJSON("SleeveFactionWork", this);
}
- /**
- * Initiatizes a FactionWork object from a JSON save state.
- */
+ /** Initiatizes a FactionWork object from a JSON save state. */
static fromJSON(value: IReviverValue): SleeveFactionWork {
return Generic_fromJSON(SleeveFactionWork, value.data);
}
diff --git a/src/PersonObjects/Sleeve/Work/SleeveInfiltrateWork.ts b/src/PersonObjects/Sleeve/Work/SleeveInfiltrateWork.ts
index d0cf4f217..604b9d310 100644
--- a/src/PersonObjects/Sleeve/Work/SleeveInfiltrateWork.ts
+++ b/src/PersonObjects/Sleeve/Work/SleeveInfiltrateWork.ts
@@ -36,16 +36,12 @@ export class SleeveInfiltrateWork extends Work {
};
}
- /**
- * Serialize the current object to a JSON save state.
- */
+ /** Serialize the current object to a JSON save state. */
toJSON(): IReviverValue {
return Generic_toJSON("SleeveInfiltrateWork", this);
}
- /**
- * Initiatizes a BladeburnerWork object from a JSON save state.
- */
+ /** Initiatizes a BladeburnerWork object from a JSON save state. */
static fromJSON(value: IReviverValue): SleeveInfiltrateWork {
return Generic_fromJSON(SleeveInfiltrateWork, value.data);
}
diff --git a/src/PersonObjects/Sleeve/Work/SleeveRecoveryWork.ts b/src/PersonObjects/Sleeve/Work/SleeveRecoveryWork.ts
index 98707b6fc..3a6b7bea2 100644
--- a/src/PersonObjects/Sleeve/Work/SleeveRecoveryWork.ts
+++ b/src/PersonObjects/Sleeve/Work/SleeveRecoveryWork.ts
@@ -22,16 +22,12 @@ export class SleeveRecoveryWork extends Work {
};
}
- /**
- * Serialize the current object to a JSON save state.
- */
+ /** Serialize the current object to a JSON save state. */
toJSON(): IReviverValue {
return Generic_toJSON("SleeveRecoveryWork", this);
}
- /**
- * Initiatizes a RecoveryWork object from a JSON save state.
- */
+ /** Initiatizes a RecoveryWork object from a JSON save state. */
static fromJSON(value: IReviverValue): SleeveRecoveryWork {
return Generic_fromJSON(SleeveRecoveryWork, value.data);
}
diff --git a/src/PersonObjects/Sleeve/Work/SleeveSupportWork.ts b/src/PersonObjects/Sleeve/Work/SleeveSupportWork.ts
index 86d34184a..1ce2b665c 100644
--- a/src/PersonObjects/Sleeve/Work/SleeveSupportWork.ts
+++ b/src/PersonObjects/Sleeve/Work/SleeveSupportWork.ts
@@ -25,16 +25,12 @@ export class SleeveSupportWork extends Work {
};
}
- /**
- * Serialize the current object to a JSON save state.
- */
+ /** Serialize the current object to a JSON save state. */
toJSON(): IReviverValue {
return Generic_toJSON("SleeveSupportWork", this);
}
- /**
- * Initiatizes a BladeburnerWork object from a JSON save state.
- */
+ /** Initiatizes a BladeburnerWork object from a JSON save state. */
static fromJSON(value: IReviverValue): SleeveSupportWork {
return Generic_fromJSON(SleeveSupportWork, value.data);
}
diff --git a/src/PersonObjects/Sleeve/Work/SleeveSynchroWork.ts b/src/PersonObjects/Sleeve/Work/SleeveSynchroWork.ts
index 54d52fe56..1025fb3bf 100644
--- a/src/PersonObjects/Sleeve/Work/SleeveSynchroWork.ts
+++ b/src/PersonObjects/Sleeve/Work/SleeveSynchroWork.ts
@@ -23,16 +23,12 @@ export class SleeveSynchroWork extends Work {
};
}
- /**
- * Serialize the current object to a JSON save state.
- */
+ /** Serialize the current object to a JSON save state. */
toJSON(): IReviverValue {
return Generic_toJSON("SleeveSynchroWork", this);
}
- /**
- * Initiatizes a SynchroWork object from a JSON save state.
- */
+ /** Initiatizes a SynchroWork object from a JSON save state. */
static fromJSON(value: IReviverValue): SleeveSynchroWork {
return Generic_fromJSON(SleeveSynchroWork, value.data);
}
diff --git a/src/PersonObjects/Sleeve/ui/CovenantPurchasesRoot.tsx b/src/PersonObjects/Sleeve/ui/CovenantPurchasesRoot.tsx
index c3030a06e..2b1baf7ae 100644
--- a/src/PersonObjects/Sleeve/ui/CovenantPurchasesRoot.tsx
+++ b/src/PersonObjects/Sleeve/ui/CovenantPurchasesRoot.tsx
@@ -26,16 +26,12 @@ interface IProps {
export function CovenantPurchasesRoot(props: IProps): React.ReactElement {
const [update, setUpdate] = useState(0);
- /**
- * Get the cost to purchase a new Duplicate Sleeve
- */
+ /** Get the cost to purchase a new Duplicate Sleeve */
function purchaseCost(): number {
return Math.pow(10, Player.sleevesFromCovenant) * BaseCostPerSleeve;
}
- /**
- * Force a rerender by just changing an arbitrary state value
- */
+ /** Force a rerender by just changing an arbitrary state value */
function rerender(): void {
setUpdate(update + 1);
}
diff --git a/src/RedPill.tsx b/src/RedPill.tsx
index 0bcd7a054..a1b8ea13e 100644
--- a/src/RedPill.tsx
+++ b/src/RedPill.tsx
@@ -1,6 +1,4 @@
-/**
- * Implementation for what happens when you destroy a BitNode
- */
+/** Implementation for what happens when you destroy a BitNode */
import React from "react";
import { Player } from "./Player";
import { prestigeSourceFile } from "./Prestige";
@@ -19,17 +17,9 @@ function giveSourceFile(bitNodeNumber: number): void {
}
// Check if player already has this source file
- let alreadyOwned = false;
- let ownedSourceFile = null;
- for (let i = 0; i < Player.sourceFiles.length; ++i) {
- if (Player.sourceFiles[i].n === bitNodeNumber) {
- alreadyOwned = true;
- ownedSourceFile = Player.sourceFiles[i];
- break;
- }
- }
+ const ownedSourceFile = Player.sourceFiles.find(sourceFile=>sourceFile.n === bitNodeNumber)
- if (alreadyOwned && ownedSourceFile) {
+ if (ownedSourceFile) {
if (ownedSourceFile.lvl >= 3 && ownedSourceFile.n !== 12) {
dialogBoxCreate(
`The Source-File for the BitNode you just destroyed, ${sourceFile.name}, is already at max level!`,
@@ -45,10 +35,9 @@ function giveSourceFile(bitNodeNumber: number): void {
);
}
} else {
- const playerSrcFile = new PlayerOwnedSourceFile(bitNodeNumber, 1);
- Player.sourceFiles.push(playerSrcFile);
+ const newSrcFile = new PlayerOwnedSourceFile(bitNodeNumber, 1);
+ Player.sourceFiles.push(newSrcFile);
if (bitNodeNumber === 5 && Player.skills.intelligence === 0) {
- // Artificial Intelligence
Player.skills.intelligence = 1;
}
dialogBoxCreate(
diff --git a/src/RemoteFileAPI/Remote.ts b/src/RemoteFileAPI/Remote.ts
index 5a5806a65..ed83fbc21 100644
--- a/src/RemoteFileAPI/Remote.ts
+++ b/src/RemoteFileAPI/Remote.ts
@@ -1,6 +1,6 @@
import { RFAMessage } from "./MessageDefinitions";
import { RFARequestHandler } from "./MessageHandlers";
-import { SnackbarEvents } from "../ui/React/Snackbar";
+import { SnackbarEvents, ToastVariant } from "../ui/React/Snackbar";
export class Remote {
connection?: WebSocket;
@@ -22,18 +22,18 @@ export class Remote {
this.connection = new WebSocket(address);
this.connection.addEventListener("error", (e: Event) =>
- SnackbarEvents.emit(`Error with websocket ${address}, details: ${JSON.stringify(e)}`, "error", 5000),
+ SnackbarEvents.emit(`Error with websocket ${address}, details: ${JSON.stringify(e)}`, ToastVariant.ERROR, 5000),
);
this.connection.addEventListener("message", handleMessageEvent);
this.connection.addEventListener("open", () =>
SnackbarEvents.emit(
`Remote API connection established on ${this.ipaddr}:${this.port}`,
- "success",
+ ToastVariant.SUCCESS,
2000,
),
);
this.connection.addEventListener("close", () =>
- SnackbarEvents.emit("Remote API connection closed", "warning", 2000),
+ SnackbarEvents.emit("Remote API connection closed", ToastVariant.WARNING, 2000),
);
}
}
diff --git a/src/SaveObject.tsx b/src/SaveObject.tsx
index 9b1c47faf..14120faa1 100755
--- a/src/SaveObject.tsx
+++ b/src/SaveObject.tsx
@@ -16,7 +16,7 @@ import { Settings } from "./Settings/Settings";
import { loadStockMarket, StockMarket } from "./StockMarket/StockMarket";
import { staneksGift, loadStaneksGift } from "./CotMG/Helper";
-import { SnackbarEvents } from "./ui/React/Snackbar";
+import { SnackbarEvents, ToastVariant } from "./ui/React/Snackbar";
import * as ExportBonus from "./ExportBonus";
@@ -120,7 +120,7 @@ class BitburnerSaveObject {
pushGameSaved(saveData);
if (emitToastEvent) {
- SnackbarEvents.emit("Game Saved!", "info", 2000);
+ SnackbarEvents.emit("Game Saved!", ToastVariant.INFO, 2000);
}
return resolve();
})
diff --git a/src/Script/Script.ts b/src/Script/Script.ts
index a28b81634..833b65229 100644
--- a/src/Script/Script.ts
+++ b/src/Script/Script.ts
@@ -61,9 +61,7 @@ export class Script {
}
}
- /**
- * Download the script as a file
- */
+ /** Download the script as a file */
download(): void {
const filename = this.filename;
const file = new Blob([this.code], { type: "text/plain" });
diff --git a/src/ScriptEditor/NetscriptDefinitions.d.ts b/src/ScriptEditor/NetscriptDefinitions.d.ts
index a6efb5bd4..e09ba697b 100644
--- a/src/ScriptEditor/NetscriptDefinitions.d.ts
+++ b/src/ScriptEditor/NetscriptDefinitions.d.ts
@@ -1,14 +1,12 @@
-/**
- * @public
- */
+export type ValuesFrom = T[keyof T];
+
+/** @public */
export interface HP {
current: number;
max: number;
}
-/**
- * @public
- */
+/** @public */
export interface Skills {
hacking: number;
strength: number;
@@ -19,9 +17,7 @@ export interface Skills {
intelligence: number;
}
-/**
- * @public
- */
+/** @public */
export interface PossibleInfiltrationLocation {
city: string;
name: string;
@@ -33,24 +29,16 @@ export interface PossibleInfiltrationLocation {
*/
type CodingContractData = any;
-/**
- * @public
- */
+/** @public */
type PortData = string | number;
-/**
- * @public
- */
+/** @public */
type ScriptArg = string | number | boolean;
-/**
- * @public
- */
+/** @public */
type FilenameOrPID = number | string;
-/**
- * @public
- */
+/** @public */
interface Player {
hp: HP;
skills: Skills;
@@ -72,9 +60,7 @@ interface Player {
entropy: number;
}
-/**
- * @public
- */
+/** @public */
export interface Multipliers {
/** Multiplier to hacking skill */
hacking?: number;
@@ -138,9 +124,7 @@ export interface Multipliers {
bladeburner_success_chance?: number;
}
-/**
- * @public
- */
+/** @public */
export interface RunningScript {
/** Arguments the script was called with */
args: (string | number | boolean)[];
@@ -173,9 +157,7 @@ export interface RunningScript {
threads: number;
}
-/**
- * @public
- */
+/** @public */
export interface RecentScript extends RunningScript {
/** Timestamp of when the script was killed */
timeOfDeath: Date;
@@ -259,17 +241,13 @@ export interface AugmentPair {
cost: number;
}
-/**
- * @public
- */
+/** @public */
export enum PositionTypes {
Long = "L",
Short = "S",
}
-/**
- * @public
- */
+/** @public */
export enum OrderTypes {
LimitBuy = "Limit Buy Order",
LimitSell = "Limit Sell Order",
@@ -633,9 +611,7 @@ export interface NodeStats {
totalProduction: number;
}
-/**
- * @public
- */
+/** @public */
export interface CharacterMult {
/** Agility stat */
agility: number;
@@ -673,9 +649,7 @@ export interface CharacterMult {
workMoney: number;
}
-/**
- * @public
- */
+/** @public */
export interface SleeveWorkGains {
/** Hacking exp gained from work */
workHackExpGain: number;
@@ -693,9 +667,7 @@ export interface SleeveWorkGains {
workMoneyGain: number;
}
-/**
- * @public
- */
+/** @public */
export interface SourceFileLvl {
/** The number of the source file */
n: number;
@@ -745,9 +717,7 @@ export interface GangGenInfo {
wantedPenalty: number;
}
-/**
- * @public
- */
+/** @public */
export interface GangOtherInfoObject {
/** Gang power */
power: number;
@@ -755,9 +725,7 @@ export interface GangOtherInfoObject {
territory: number;
}
-/**
- * @public
- */
+/** @public */
export interface GangOtherInfo {
[key: string]: GangOtherInfoObject;
}
@@ -818,9 +786,7 @@ export interface EquipmentStats {
hack?: number;
}
-/**
- * @public
- */
+/** @public */
export interface GangTerritory {
/** Money gain impact on task scaling */
money: number;
@@ -830,9 +796,7 @@ export interface GangTerritory {
wanted: number;
}
-/**
- * @public
- */
+/** @public */
export interface GangMemberInfo {
/** Name of the gang member */
name: string;
@@ -913,9 +877,7 @@ export interface GangMemberInfo {
moneyGain: number;
}
-/**
- * @public
- */
+/** @public */
export interface GangMemberAscension {
/** Amount of respect lost from ascending */
respect: number;
@@ -3840,9 +3802,7 @@ interface SkillsFormulas {
calculateExp(skill: number, skillMult?: number): number;
}
-/**
- * @public
- */
+/** @public */
export interface WorkStats {
money: number;
reputation: number;
@@ -4152,9 +4112,7 @@ export interface Formulas {
work: WorkFormulas;
}
-/**
- * @public
- */
+/** @public */
export interface Fragment {
id: number;
shape: boolean[][];
@@ -4163,9 +4121,7 @@ export interface Fragment {
limit: number;
}
-/**
- * @public
- */
+/** @public */
export interface ActiveFragment {
id: number;
highestCharge: number;
@@ -4287,26 +4243,20 @@ interface Stanek {
acceptGift(): boolean;
}
-/**
- * @public
- */
+/** @public */
export interface InfiltrationReward {
tradeRep: number;
sellCash: number;
SoARep: number;
}
-/**
- * @public
- */
+/** @public */
export interface ILocation {
city: string;
name: string;
}
-/**
- * @public
- */
+/** @public */
export interface InfiltrationLocation {
location: ILocation;
reward: InfiltrationReward;
@@ -6385,7 +6335,7 @@ export interface NS {
* @param variant - Type of toast, must be one of success, info, warning, error. Defaults to success.
* @param duration - Duration of toast in ms. Can also be `null` to create a persistent toast. Defaults to 2000
*/
- toast(msg: string, variant?: ToastVariantValues, duration?: number | null): void;
+ toast(msg: string, variant?: ToastVariant, duration?: number | null): void;
/**
* Download a file from the internet.
@@ -6573,7 +6523,7 @@ export interface NS {
enums: NSEnums;
}
-export const enums = {
+declare const enums = {
toast: {
SUCCESS: "success",
WARNING: "warning",
@@ -6581,12 +6531,14 @@ export const enums = {
INFO: "info",
},
} as const;
+type ToastVariant = ValuesFrom;
+
export type NSEnums = typeof enums;
/**
* Corporation Office API
* @remarks
- * Requires the Office API upgrade from your corporation.
+ * requires the Office API upgrade from your corporation.
* @public
*/
export interface OfficeAPI {
diff --git a/src/Server/BaseServer.ts b/src/Server/BaseServer.ts
index 6ba4b96c8..6a2bcfbf7 100644
--- a/src/Server/BaseServer.ts
+++ b/src/Server/BaseServer.ts
@@ -1,6 +1,3 @@
-/**
- * Abstract Base Class for any Server object
- */
import { CodingContract } from "../CodingContracts";
import { RunningScript } from "../Script/RunningScript";
import { Script } from "../Script/Script";
@@ -28,7 +25,8 @@ interface writeResult {
overwritten: boolean;
}
-export class BaseServer {
+/** Abstract Base Class for any Server object */
+export abstract class BaseServer {
// Coding Contract files on this server
contracts: CodingContract[] = [];
@@ -150,9 +148,7 @@ export class BaseServer {
return null;
}
- /**
- * Returns boolean indicating whether the given script is running on this server
- */
+ /** Returns boolean indicating whether the given script is running on this server */
isRunning(fn: string): boolean {
for (const runningScriptObj of this.runningScripts) {
if (runningScriptObj.filename === fn) {
diff --git a/src/Server/Server.ts b/src/Server/Server.ts
index 427b879e3..976163478 100644
--- a/src/Server/Server.ts
+++ b/src/Server/Server.ts
@@ -86,9 +86,7 @@ export class Server extends BaseServer {
this.numOpenPortsRequired = params.numOpenPortsRequired != null ? params.numOpenPortsRequired : 5;
}
- /**
- * Ensures that the server's difficulty (server security) doesn't get too high
- */
+ /** Ensures that the server's difficulty (server security) doesn't get too high */
capDifficulty(): void {
if (this.hackDifficulty < this.minDifficulty) {
this.hackDifficulty = this.minDifficulty;
@@ -134,25 +132,19 @@ export class Server extends BaseServer {
this.moneyMax *= n;
}
- /**
- * Strengthens a server's security level (difficulty) by the specified amount
- */
+ /** Strengthens a server's security level (difficulty) by the specified amount */
fortify(amt: number): void {
this.hackDifficulty += amt;
this.capDifficulty();
}
- /**
- * Lowers the server's security level (difficulty) by the specified amount)
- */
+ /** Lowers the server's security level (difficulty) by the specified amount) */
weaken(amt: number): void {
this.hackDifficulty -= amt * BitNodeMultipliers.ServerWeakenRate;
this.capDifficulty();
}
- /**
- * Serialize the current object to a JSON save state
- */
+ /** Serialize the current object to a JSON save state */
toJSON(): IReviverValue {
return Generic_toJSON("Server", this);
}
diff --git a/src/Server/data/servers.ts b/src/Server/data/servers.ts
index 4c836e011..a90079f64 100644
--- a/src/Server/data/servers.ts
+++ b/src/Server/data/servers.ts
@@ -12,19 +12,13 @@ import { SpecialServers } from "./SpecialServers";
* These values will be adjusted based on Bitnode multipliers when the Server objects are built out.
*/
interface IServerMetadata {
- /**
- * When populated, the base security level of the server.
- */
+ /** When populated, the base security level of the server. */
hackDifficulty?: number | IMinMaxRange;
- /**
- * The DNS name of the server.
- */
+ /** The DNS name of the server. */
hostname: string;
- /**
- * When populated, the files will be added to the server when created.
- */
+ /** When populated, the files will be added to the server when created. */
literature?: string[];
/**
@@ -33,9 +27,7 @@ interface IServerMetadata {
*/
maxRamExponent?: number | IMinMaxRange;
- /**
- * How much money the server starts out with.
- */
+ /** How much money the server starts out with. */
moneyAvailable: number | IMinMaxRange;
/**
@@ -45,35 +37,23 @@ interface IServerMetadata {
*/
networkLayer?: number | IMinMaxRange;
- /**
- * The number of ports that must be opened before the player can execute NUKE.
- */
+ /** The number of ports that must be opened before the player can execute NUKE. */
numOpenPortsRequired: number;
- /**
- * The organization that the server belongs to.
- */
+ /** The organization that the server belongs to. */
organizationName: string;
- /**
- * The minimum hacking level before the player can run NUKE.
- */
+ /** The minimum hacking level before the player can run NUKE. */
requiredHackingSkill: number | IMinMaxRange;
- /**
- * The growth factor for the server.
- */
+ /** The growth factor for the server. */
serverGrowth?: number | IMinMaxRange;
- /**
- * A "unique" server that has special implications when the player manually hacks it.
- */
+ /** A "unique" server that has special implications when the player manually hacks it. */
specialName?: string;
}
-/**
- * The metadata for building up the servers on the network.
- */
+/** The metadata for building up the servers on the network. */
export const serverMetadata: IServerMetadata[] = [
{
hackDifficulty: 99,
diff --git a/src/Settings/SettingEnums.ts b/src/Settings/SettingEnums.ts
index 3980af98f..4a12fc9b4 100644
--- a/src/Settings/SettingEnums.ts
+++ b/src/Settings/SettingEnums.ts
@@ -1,8 +1,4 @@
-// Enums that defined allowed values for setting configuration
-
-/**
- * Allowed values for the 'OwnedAugmentationsOrder' setting
- */
+/** Allowed values for the 'OwnedAugmentationsOrder' setting */
export enum PurchaseAugmentationsOrderSetting {
Cost,
Default,
@@ -10,9 +6,7 @@ export enum PurchaseAugmentationsOrderSetting {
Purchasable,
}
-/**
- * Allowed values for the 'OwnedAugmentationsOrder' setting
- */
+/** Allowed values for the 'OwnedAugmentationsOrder' setting */
export enum OwnedAugmentationsOrderSetting {
Alphabetically,
AcquirementTime,
diff --git a/src/StockMarket/BuyingAndSelling.tsx b/src/StockMarket/BuyingAndSelling.tsx
index c3dc2739b..95d1cf571 100644
--- a/src/StockMarket/BuyingAndSelling.tsx
+++ b/src/StockMarket/BuyingAndSelling.tsx
@@ -23,9 +23,7 @@ import * as React from "react";
import { NetscriptContext } from "../Netscript/APIWrapper";
import { helpers } from "../Netscript/NetscriptHelpers";
-/**
- * Each function takes an optional config object as its last argument
- */
+/** Each function takes an optional config object as its last argument */
interface IOptions {
rerenderFn?: () => void;
suppressDialog?: boolean;
diff --git a/src/StockMarket/Order.ts b/src/StockMarket/Order.ts
index d37092116..f8fb7399f 100644
--- a/src/StockMarket/Order.ts
+++ b/src/StockMarket/Order.ts
@@ -43,16 +43,12 @@ export class Order {
this.pos = pos;
}
- /**
- * Serialize the Order to a JSON save state.
- */
+ /** Serialize the Order to a JSON save state. */
toJSON(): IReviverValue {
return Generic_toJSON("Order", this);
}
- /**
- * Initializes a Order from a JSON save state
- */
+ /** Initializes a Order from a JSON save state */
static fromJSON(value: IReviverValue): Order {
return Generic_fromJSON(Order, value.data);
}
diff --git a/src/StockMarket/Stock.ts b/src/StockMarket/Stock.ts
index 012da4eda..5d6bb200f 100644
--- a/src/StockMarket/Stock.ts
+++ b/src/StockMarket/Stock.ts
@@ -51,38 +51,24 @@ function toNumber(n: number | IMinMaxRange): number {
return value;
}
-/**
- * Represents the valuation of a company in the World Stock Exchange.
- */
+/** Represents the valuation of a company in the World Stock Exchange. */
export class Stock {
- /**
- * Bear or bull (more likely to go up or down, based on otlkMag)
- */
+ /** Bear or bull (more likely to go up or down, based on otlkMag) */
b: boolean;
- /**
- * Maximum price of a stock (per share)
- */
+ /** Maximum price of a stock (per share) */
readonly cap: number;
- /**
- * Stocks previous share price
- */
+ /** Stocks previous share price */
lastPrice: number;
- /**
- * Maximum number of shares that player can own (both long and short combined)
- */
+ /** Maximum number of shares that player can own (both long and short combined) */
readonly maxShares: number;
- /**
- * Maximum volatility
- */
+ /** Maximum volatility */
readonly mv: number;
- /**
- * Name of the company that the stock is for
- */
+ /** Name of the company that the stock is for */
readonly name: string;
/**
@@ -97,34 +83,22 @@ export class Stock {
*/
otlkMagForecast: number;
- /**
- * Average price of stocks that the player owns in the LONG position
- */
+ /** Average price of stocks that the player owns in the LONG position */
playerAvgPx: number;
- /**
- * Average price of stocks that the player owns in the SHORT position
- */
+ /** Average price of stocks that the player owns in the SHORT position */
playerAvgShortPx: number;
- /**
- * Number of shares the player owns in the LONG position
- */
+ /** Number of shares the player owns in the LONG position */
playerShares: number;
- /**
- * Number of shares the player owns in the SHORT position
- */
+ /** Number of shares the player owns in the SHORT position */
playerShortShares: number;
- /**
- * Stock's share price
- */
+ /** Stock's share price */
price: number;
- /**
- * How many shares need to be transacted in order to trigger a price movement
- */
+ /** How many shares need to be transacted in order to trigger a price movement */
readonly shareTxForMovement: number;
/**
@@ -139,9 +113,7 @@ export class Stock {
*/
readonly spreadPerc: number;
- /**
- * The stock's ticker symbol
- */
+ /** The stock's ticker symbol */
readonly symbol: string;
/**
@@ -178,9 +150,7 @@ export class Stock {
this.maxShares = Math.round((this.totalShares * outstandingSharePercentage) / 1e5) * 1e5;
}
- /**
- * Safely set the stock's second-order forecast to a new value
- */
+ /** Safely set the stock's second-order forecast to a new value */
changeForecastForecast(newff: number): void {
this.otlkMagForecast = newff;
if (this.otlkMagForecast > 100) {
@@ -190,9 +160,7 @@ export class Stock {
}
}
- /**
- * Set the stock to a new price. Also updates the stock's previous price tracker
- */
+ /** Set the stock to a new price. Also updates the stock's previous price tracker */
changePrice(newPrice: number): void {
this.lastPrice = this.price;
this.price = newPrice;
@@ -249,30 +217,22 @@ export class Stock {
this.otlkMagForecast = 50 + -1 * diff;
}
- /**
- * Returns the stock's absolute forecast, which is a number between 0-100
- */
+ /** Returns the stock's absolute forecast, which is a number between 0-100 */
getAbsoluteForecast(): number {
return this.b ? 50 + this.otlkMag : 50 - this.otlkMag;
}
- /**
- * Return the price at which YOUR stock is bought (market ask price). Accounts for spread
- */
+ /** Return the price at which YOUR stock is bought (market ask price). Accounts for spread */
getAskPrice(): number {
return this.price * (1 + this.spreadPerc / 100);
}
- /**
- * Return the price at which YOUR stock is sold (market bid price). Accounts for spread
- */
+ /** Return the price at which YOUR stock is sold (market bid price). Accounts for spread */
getBidPrice(): number {
return this.price * (1 - this.spreadPerc / 100);
}
- /**
- * Returns the chance (0-1 decimal) that a stock has of having its forecast increase
- */
+ /** Returns the chance (0-1 decimal) that a stock has of having its forecast increase */
getForecastIncreaseChance(): number {
const diff = this.otlkMagForecast - this.getAbsoluteForecast();
@@ -305,16 +265,12 @@ export class Stock {
}
}
- /**
- * Serialize the Stock to a JSON save state.
- */
+ /** Serialize the Stock to a JSON save state. */
toJSON(): IReviverValue {
return Generic_toJSON("Stock", this);
}
- /**
- * Initializes a Stock from a JSON save state
- */
+ /** Initializes a Stock from a JSON save state */
static fromJSON(value: IReviverValue): Stock {
return Generic_fromJSON(Stock, value.data);
}
diff --git a/src/StockMarket/StockMarketHelpers.ts b/src/StockMarket/StockMarketHelpers.ts
index 3a6e08a21..72bd4dbcb 100644
--- a/src/StockMarket/StockMarketHelpers.ts
+++ b/src/StockMarket/StockMarketHelpers.ts
@@ -1,6 +1,3 @@
-/**
- * Stock Market Helper Functions
- */
import { Stock } from "./Stock";
import { PositionTypes } from "./data/PositionTypes";
import { CONSTANTS } from "../Constants";
diff --git a/src/StockMarket/ui/StockMarketRoot.tsx b/src/StockMarket/ui/StockMarketRoot.tsx
index a77e213ac..8b5dae9c8 100644
--- a/src/StockMarket/ui/StockMarketRoot.tsx
+++ b/src/StockMarket/ui/StockMarketRoot.tsx
@@ -1,6 +1,3 @@
-/**
- * Root React component for the Stock Market UI
- */
import React, { useState, useEffect } from "react";
import { InfoAndPurchases } from "./InfoAndPurchases";
@@ -14,6 +11,7 @@ type IProps = {
stockMarket: IStockMarket;
};
+/** Root React component for the Stock Market UI */
export function StockMarketRoot(props: IProps): React.ReactElement {
const setRerender = useState(false)[1];
function rerender(): void {
diff --git a/src/StockMarket/ui/StockTicker.tsx b/src/StockMarket/ui/StockTicker.tsx
index 8f3abc596..fa1c456f8 100644
--- a/src/StockMarket/ui/StockTicker.tsx
+++ b/src/StockMarket/ui/StockTicker.tsx
@@ -1,6 +1,3 @@
-/**
- * React Component for a single stock ticker in the Stock Market UI
- */
import React, { useState } from "react";
import { StockTickerHeaderText } from "./StockTickerHeaderText";
@@ -46,6 +43,7 @@ type IProps = {
stock: Stock;
};
+/** React Component for a single stock ticker in the Stock Market UI */
export function StockTicker(props: IProps): React.ReactElement {
const [orderType, setOrderType] = useState(SelectorOrderType.Market);
const [position, setPosition] = useState(PositionTypes.Long);
diff --git a/src/StockMarket/ui/StockTickerOrder.tsx b/src/StockMarket/ui/StockTickerOrder.tsx
index b049a3280..ec2b13378 100644
--- a/src/StockMarket/ui/StockTickerOrder.tsx
+++ b/src/StockMarket/ui/StockTickerOrder.tsx
@@ -1,6 +1,3 @@
-/**
- * React component for displaying a single order in a stock's order book
- */
import * as React from "react";
import { Order } from "../Order";
@@ -17,6 +14,7 @@ type IProps = {
order: Order;
};
+/** React component for displaying a single order in a stock's order book */
export function StockTickerOrder(props: IProps): React.ReactElement {
function handleCancelOrderClick(): void {
cancelOrder({ order: props.order });
diff --git a/src/Terminal/DirectoryHelpers.ts b/src/Terminal/DirectoryHelpers.ts
index 067b80949..85659aa62 100644
--- a/src/Terminal/DirectoryHelpers.ts
+++ b/src/Terminal/DirectoryHelpers.ts
@@ -8,9 +8,7 @@
* found in ./DirectoryServerHelpers.ts
*/
-/**
- * Removes leading forward slash ("/") from a string.
- */
+/** Removes leading forward slash ("/") from a string. */
export function removeLeadingSlash(s: string): string {
if (s.startsWith("/")) {
return s.slice(1);
@@ -210,9 +208,7 @@ export function getFileName(path: string): string {
return t_path.slice(lastSlash + 1);
}
-/**
- * Checks if a file path refers to a file in the root directory.
- */
+/** Checks if a file path refers to a file in the root directory. */
export function isInRootDirectory(path: string): boolean {
if (!isValidFilePath(path)) {
return false;
diff --git a/src/Terminal/DirectoryServerHelpers.ts b/src/Terminal/DirectoryServerHelpers.ts
index 8dccbf6e2..9e4b01db3 100644
--- a/src/Terminal/DirectoryServerHelpers.ts
+++ b/src/Terminal/DirectoryServerHelpers.ts
@@ -52,9 +52,7 @@ export function getSubdirectories(serv: BaseServer, dir: string): string[] {
return res;
}
-/**
- * Returns true, if the server's directory itself or one of its subdirectory contains files.
- */
+/** Returns true, if the server's directory itself or one of its subdirectory contains files. */
export function containsFiles(server: BaseServer, dir: string): boolean {
const dirWithTrailingSlash = dir + (dir.slice(-1) === "/" ? "" : "/");
diff --git a/src/TextFile.ts b/src/TextFile.ts
index 948b4f1d1..a87de56f3 100644
--- a/src/TextFile.ts
+++ b/src/TextFile.ts
@@ -3,30 +3,21 @@ import { BaseServer } from "./Server/BaseServer";
import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "./utils/JSONReviver";
import { removeLeadingSlash, isInRootDirectory } from "./Terminal/DirectoryHelpers";
-/**
- * Represents a plain text file that is typically stored on a server.
- */
+/** Represents a plain text file that is typically stored on a server. */
export class TextFile {
- /**
- * The full file name.
- */
+ /** The full file name. */
fn: string;
- /**
- * The content of the file.
- */
+ /** The content of the file. */
text: string;
- /**
- * The full file name.
- */
+ //TODO: Why are we using getter/setter for fn as filename?
+ /** The full file name. */
get filename(): string {
return this.fn;
}
- /**
- * The full file name.
- */
+ /** The full file name. */
set filename(value: string) {
this.fn = value;
}
@@ -36,16 +27,12 @@ export class TextFile {
this.text = txt;
}
- /**
- * Concatenates the raw values to the end of current content.
- */
+ /** Concatenates the raw values to the end of current content. */
append(txt: string): void {
this.text += txt;
}
- /**
- * Serves the file to the user as a downloadable resource through the browser.
- */
+ /** Serves the file to the user as a downloadable resource through the browser. */
download(): void {
const file: Blob = new Blob([this.text], { type: "text/plain" });
const a: HTMLAnchorElement = document.createElement("a");
@@ -60,37 +47,27 @@ export class TextFile {
}, 0);
}
- /**
- * Retrieve the content of the file.
- */
+ /** Retrieve the content of the file. */
read(): string {
return this.text;
}
- /**
- * Shows the content to the user via the game's dialog box.
- */
+ /** Shows the content to the user via the game's dialog box. */
show(): void {
dialogBoxCreate(`${this.fn}
${this.text}`);
}
- /**
- * Serialize the current file to a JSON save state.
- */
+ /** Serialize the current file to a JSON save state. */
toJSON(): IReviverValue {
return Generic_toJSON("TextFile", this);
}
- /**
- * Replaces the current content with the text provided.
- */
+ /** Replaces the current content with the text provided. */
write(txt: string): void {
this.text = txt;
}
- /**
- * Initiatizes a TextFile from a JSON save state.
- */
+ /** Initiatizes a TextFile from a JSON save state. */
static fromJSON(value: IReviverValue): TextFile {
return Generic_fromJSON(TextFile, value.data);
}
diff --git a/src/Themes/ui/ThemeBrowser.tsx b/src/Themes/ui/ThemeBrowser.tsx
index d7d9275bb..e8cee63c7 100644
--- a/src/Themes/ui/ThemeBrowser.tsx
+++ b/src/Themes/ui/ThemeBrowser.tsx
@@ -10,7 +10,7 @@ import { StyleEditorButton } from "./StyleEditorButton";
import { ThemeEntry } from "./ThemeEntry";
import { ThemeCollaborate } from "./ThemeCollaborate";
import { Modal } from "../../ui/React/Modal";
-import { SnackbarEvents } from "../../ui/React/Snackbar";
+import { SnackbarEvents, ToastVariant } from "../../ui/React/Snackbar";
// Everything dies when the theme gets reloaded, so we'll keep the current scroll to not jump around.
let previousScrollY = 0;
@@ -49,7 +49,7 @@ export function ThemeBrowser(): React.ReactElement {
UNDO
>,
- "info",
+ ToastVariant.INFO,
30000,
);
}
diff --git a/src/Work/ClassWork.tsx b/src/Work/ClassWork.tsx
index 3690978d6..b41d2f677 100644
--- a/src/Work/ClassWork.tsx
+++ b/src/Work/ClassWork.tsx
@@ -188,16 +188,12 @@ export class ClassWork extends Work {
};
}
- /**
- * Serialize the current object to a JSON save state.
- */
+ /** Serialize the current object to a JSON save state. */
toJSON(): IReviverValue {
return Generic_toJSON("ClassWork", this);
}
- /**
- * Initiatizes a ClassWork object from a JSON save state.
- */
+ /** Initiatizes a ClassWork object from a JSON save state. */
static fromJSON(value: IReviverValue): ClassWork {
return Generic_fromJSON(ClassWork, value.data);
}
diff --git a/src/Work/CompanyWork.tsx b/src/Work/CompanyWork.tsx
index 85110951d..ae9271bd6 100644
--- a/src/Work/CompanyWork.tsx
+++ b/src/Work/CompanyWork.tsx
@@ -70,16 +70,12 @@ export class CompanyWork extends Work {
};
}
- /**
- * Serialize the current object to a JSON save state.
- */
+ /** Serialize the current object to a JSON save state. */
toJSON(): IReviverValue {
return Generic_toJSON("CompanyWork", this);
}
- /**
- * Initiatizes a CompanyWork object from a JSON save state.
- */
+ /** Initiatizes a CompanyWork object from a JSON save state. */
static fromJSON(value: IReviverValue): CompanyWork {
return Generic_fromJSON(CompanyWork, value.data);
}
diff --git a/src/Work/CreateProgramWork.ts b/src/Work/CreateProgramWork.ts
index 1a8e97070..30180f1d9 100644
--- a/src/Work/CreateProgramWork.ts
+++ b/src/Work/CreateProgramWork.ts
@@ -107,16 +107,12 @@ export class CreateProgramWork extends Work {
};
}
- /**
- * Serialize the current object to a JSON save state.
- */
+ /** Serialize the current object to a JSON save state. */
toJSON(): IReviverValue {
return Generic_toJSON("CreateProgramWork", this);
}
- /**
- * Initiatizes a CreateProgramWork object from a JSON save state.
- */
+ /** Initiatizes a CreateProgramWork object from a JSON save state. */
static fromJSON(value: IReviverValue): CreateProgramWork {
return Generic_fromJSON(CreateProgramWork, value.data);
}
diff --git a/src/Work/CrimeWork.ts b/src/Work/CrimeWork.ts
index 2ea4a0cb2..dd7b20f80 100644
--- a/src/Work/CrimeWork.ts
+++ b/src/Work/CrimeWork.ts
@@ -136,16 +136,12 @@ export class CrimeWork extends Work {
};
}
- /**
- * Serialize the current object to a JSON save state.
- */
+ /** Serialize the current object to a JSON save state. */
toJSON(): IReviverValue {
return Generic_toJSON("CrimeWork", this);
}
- /**
- * Initiatizes a CrimeWork object from a JSON save state.
- */
+ /** Initiatizes a CrimeWork object from a JSON save state. */
static fromJSON(value: IReviverValue): CrimeWork {
return Generic_fromJSON(CrimeWork, value.data);
}
diff --git a/src/Work/FactionWork.tsx b/src/Work/FactionWork.tsx
index a8464ce86..8a365e8c5 100644
--- a/src/Work/FactionWork.tsx
+++ b/src/Work/FactionWork.tsx
@@ -85,16 +85,12 @@ export class FactionWork extends Work {
};
}
- /**
- * Serialize the current object to a JSON save state.
- */
+ /** Serialize the current object to a JSON save state. */
toJSON(): IReviverValue {
return Generic_toJSON("FactionWork", this);
}
- /**
- * Initiatizes a FactionWork object from a JSON save state.
- */
+ /** Initiatizes a FactionWork object from a JSON save state. */
static fromJSON(value: IReviverValue): FactionWork {
return Generic_fromJSON(FactionWork, value.data);
}
diff --git a/src/Work/GraftingWork.tsx b/src/Work/GraftingWork.tsx
index 6b8c75dc0..498e88ee0 100644
--- a/src/Work/GraftingWork.tsx
+++ b/src/Work/GraftingWork.tsx
@@ -91,16 +91,12 @@ export class GraftingWork extends Work {
};
}
- /**
- * Serialize the current object to a JSON save state.
- */
+ /** Serialize the current object to a JSON save state. */
toJSON(): IReviverValue {
return Generic_toJSON("GraftingWork", this);
}
- /**
- * Initiatizes a GraftingWork object from a JSON save state.
- */
+ /** Initiatizes a GraftingWork object from a JSON save state. */
static fromJSON(value: IReviverValue): GraftingWork {
return Generic_fromJSON(GraftingWork, value.data);
}
diff --git a/src/engine.tsx b/src/engine.tsx
index 81380c1a6..880e66626 100644
--- a/src/engine.tsx
+++ b/src/engine.tsx
@@ -1,6 +1,3 @@
-/**
- * Game engine. Handles the main game loop.
- */
import { convertTimeMsToTimeElapsedString } from "./utils/StringHelperFunctions";
import { initAugmentations } from "./Augmentation/AugmentationHelpers";
import { AugmentationNames } from "./Augmentation/data/AugmentationNames";
@@ -46,8 +43,9 @@ import { calculateAchievements } from "./Achievements/Achievements";
import React from "react";
import { setupUncaughtPromiseHandler } from "./UncaughtPromiseHandler";
import { Button, Typography } from "@mui/material";
-import { SnackbarEvents } from "./ui/React/Snackbar";
+import { SnackbarEvents, ToastVariant } from "./ui/React/Snackbar";
+/** Game engine. Handles the main game loop. */
const Engine: {
_lastUpdate: number;
updateGame: (numCycles?: number) => void;
@@ -403,9 +401,7 @@ const Engine: {
},
};
-/**
- * Shows a toast warning that lets the player know that auto-saves are disabled, with an button to re-enable them.
- */
+/** Shows a toast warning that lets the player know that auto-saves are disabled, with an button to re-enable them. */
function warnAutosaveDisabled(): void {
// If the player has suppressed those warnings let's just exit right away.
if (Settings.SuppressAutosaveDisabledWarnings) return;
@@ -431,7 +427,7 @@ function warnAutosaveDisabled(): void {
>
);
- SnackbarEvents.emit(warningToast, "warning", 5000);
+ SnackbarEvents.emit(warningToast, ToastVariant.WARNING, 5000);
}
export { Engine };
diff --git a/src/types.ts b/src/types.ts
index 9a5388765..054accfc4 100644
--- a/src/types.ts
+++ b/src/types.ts
@@ -1,9 +1,6 @@
/** Construct a type using the values from an object. Requires object to be defined "as const" */
export type ValuesFrom = T[keyof T];
-/** Only allowed to be true if the types are equal. */
-export type TypeEquality = [T1] extends [T2] ? ([T2] extends [T1] ? true : false) : false;
-
/**
* Status object for functions that return a boolean indicating success/failure
* and an optional message
@@ -19,18 +16,12 @@ export interface IReturnStatus {
* It is up to the implementor to ensure max > min.
*/
export interface IMinMaxRange {
- /**
- * Value by which the bounds are to be divided for the final range
- */
+ /** Value by which the bounds are to be divided for the final range */
divisor?: number;
- /**
- * The maximum bound of the range.
- */
+ /** The maximum bound of the range. */
max: number;
- /**
- * The minimum bound of the range.
- */
+ /** The minimum bound of the range. */
min: number;
}
diff --git a/src/ui/React/Snackbar.tsx b/src/ui/React/Snackbar.tsx
index c851129bb..0225418f3 100644
--- a/src/ui/React/Snackbar.tsx
+++ b/src/ui/React/Snackbar.tsx
@@ -10,7 +10,12 @@ interface IProps {
children: React.ReactNode | React.ReactNode[];
}
-export type ToastVariant = AlertColor;
+export enum ToastVariant{
+ SUCCESS = "success",
+ WARNING = "warning",
+ ERROR = "error",
+ INFO = "info",
+};
const useStyles = makeStyles(() => ({
snackbar: {
diff --git a/src/ui/Router.ts b/src/ui/Router.ts
index 44422d863..9a4536746 100644
--- a/src/ui/Router.ts
+++ b/src/ui/Router.ts
@@ -45,9 +45,7 @@ export interface ScriptEditorRouteOptions {
vim: boolean;
}
-/**
- * This class keeps track of player navigation/routing within the game.
- */
+/** The router keeps track of player navigation/routing within the game. */
export interface IRouter {
// toCinematicText(): void;
// toInfiltration(): void;
diff --git a/src/utils/EventEmitter.ts b/src/utils/EventEmitter.ts
index 94cc70e13..425118c98 100644
--- a/src/utils/EventEmitter.ts
+++ b/src/utils/EventEmitter.ts
@@ -1,6 +1,3 @@
-/**
- * Generic Event Emitter class following a subscribe/publish paradigm.
- */
function uuidv4(): string {
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
const r = (Math.random() * 16) | 0,
@@ -9,6 +6,7 @@ function uuidv4(): string {
});
}
+/** Generic Event Emitter class following a subscribe/publish paradigm. */
export class EventEmitter {
subscribers: { [key: string]: (...args: [...T]) => void | undefined } = {};
diff --git a/src/utils/helpers/createProgressBarText.ts b/src/utils/helpers/createProgressBarText.ts
index 6da10f0ca..6bd5be072 100644
--- a/src/utils/helpers/createProgressBarText.ts
+++ b/src/utils/helpers/createProgressBarText.ts
@@ -1,21 +1,13 @@
-/**
- * Represents the possible configuration values that can be provided when creating the progress bar text.
- */
+/** Represents the possible configuration values that can be provided when creating the progress bar text. */
interface IProgressBarConfiguration {
- /**
- * Current progress, taken as a decimal (i.e. '0.6' to represent '60%')
- */
+ /** Current progress, taken as a decimal (i.e. '0.6' to represent '60%') */
progress?: number;
- /**
- * Total number of ticks in progress bar. Preferably a factor of 100.
- */
+ /** Total number of ticks in progress bar. Preferably a factor of 100. */
totalTicks?: number;
}
-/**
- * Represents concrete configuration values when creating the progress bar text.
- */
+/** Represents concrete configuration values when creating the progress bar text. */
interface IProgressBarConfigurationMaterialized extends IProgressBarConfiguration {
progress: number;
totalTicks: number;
diff --git a/src/utils/helpers/getTimestamp.ts b/src/utils/helpers/getTimestamp.ts
index d4cc96979..c1f989b33 100644
--- a/src/utils/helpers/getTimestamp.ts
+++ b/src/utils/helpers/getTimestamp.ts
@@ -1,6 +1,4 @@
-/**
- * Returns a MM/DD HH:MM timestamp for the current time
- */
+/** Returns a MM/DD HH:MM timestamp for the current time */
export function getTimestamp(): string {
const d: Date = new Date();
// A negative slice value takes from the end of the string rather than the beginning.
diff --git a/src/utils/helpers/keyCodes.ts b/src/utils/helpers/keyCodes.ts
index 8e52d13bd..a976ca615 100644
--- a/src/utils/helpers/keyCodes.ts
+++ b/src/utils/helpers/keyCodes.ts
@@ -1,6 +1,4 @@
-/**
- * Keyboard key codes as returned by event.key
- */
+/** Keyboard key codes as returned by event.key */
export enum KEY {
//SHIFT: 16, // Check by `&& event.shiftKey`
//CTRL: 17, // Check by `&& event.ctrlKey`
@@ -72,9 +70,7 @@ export enum KEY {
Z = "z",
}
-/**
- * Keyboard key codes as returned by event.code
- */
+/** Keyboard key codes as returned by event.code */
export enum KEYCODE {
//SHIFT: 16, // Check by `&& event.shiftKey`
//CTRL: 17, // Check by `&& event.ctrlKey`