ENUMS: Initial Enum Helper rework + Reorganization (#596)

This commit is contained in:
Snarling
2023-06-12 00:34:20 -04:00
committed by GitHub
parent 6ed8ea9796
commit 6732549196
224 changed files with 2126 additions and 2171 deletions

View File

@@ -1,23 +1,23 @@
import { ClassType, LocationName, UniversityClassType } from "@enums";
import { Generic_fromJSON, Generic_toJSON, IReviverValue, constructorsForReviver } from "../../../utils/JSONReviver";
import { applySleeveGains, Work, WorkType } from "./Work";
import { Classes, ClassType } from "../../../Work/ClassWork";
import { LocationName } from "../../../Enums";
import { applySleeveGains, SleeveWorkClass, SleeveWorkType } from "./Work";
import { Classes } from "../../../Work/ClassWork";
import { calculateClassEarnings } from "../../../Work/Formulas";
import { Sleeve } from "../Sleeve";
import { scaleWorkStats, WorkStats } from "../../../Work/WorkStats";
import { GymType, UniversityClassType } from "../../../Enums";
import { checkEnum } from "../../../utils/helpers/enum";
import { Locations } from "../../../Locations/Locations";
import { isMember } from "../../../utils/EnumHelper";
export const isSleeveClassWork = (w: Work | null): w is SleeveClassWork => w !== null && w.type === WorkType.CLASS;
export const isSleeveClassWork = (w: SleeveWorkClass | null): w is SleeveClassWork =>
w !== null && w.type === SleeveWorkType.CLASS;
interface ClassWorkParams {
classType: ClassType;
location: LocationName;
}
export class SleeveClassWork extends Work {
type: WorkType.CLASS = WorkType.CLASS;
export class SleeveClassWork extends SleeveWorkClass {
type: SleeveWorkType.CLASS = SleeveWorkType.CLASS;
classType: ClassType;
location: LocationName;
@@ -32,7 +32,7 @@ export class SleeveClassWork extends Work {
}
isGym(): boolean {
return checkEnum(GymType, this.classType);
return isMember("GymType", this.classType);
}
process(sleeve: Sleeve, cycles: number) {
@@ -42,7 +42,7 @@ export class SleeveClassWork extends Work {
APICopy() {
return {
type: WorkType.CLASS as "CLASS",
type: SleeveWorkType.CLASS as "CLASS",
classType: this.classType,
location: this.location,
};