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.
This commit is contained in:
Snarling
2022-10-04 06:40:10 -04:00
parent 50f14b4f58
commit aa80cf6451
109 changed files with 400 additions and 1096 deletions
+2 -6
View File
@@ -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);
}
@@ -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";
@@ -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);
}
}
@@ -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";
+11 -33
View File
@@ -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);
}
+1 -3
View File
@@ -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);
}
@@ -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,
@@ -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);
}
@@ -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);
}
@@ -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);
}
@@ -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);
}
@@ -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);
}
@@ -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);
}
@@ -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);
}
@@ -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);
}
@@ -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);
}
@@ -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);
}