mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-30 21:07:04 +02:00
MISC: A bunch of enums stuff. (#212)
* Some game enums moved to utils/enums. Others can eventually be moved there as well. * findEnumMember function for performing fuzzy matching of player input with enum members, without needing separate fuzzy functions for every enum. * Also used findEnumMember for safely loading save games (allows case changes in enum values) * Changed capitalization on some enums. * BREAKING: removed classGains work formulas function * Split ClassType enum into UniversityClassType and GymType. * Added universityGains and gymGains work formulas functions * Provided the new split enums to the player on ns.enums.
This commit is contained in:
@@ -11,7 +11,7 @@ import { Reputation } from "../ui/React/Reputation";
|
||||
import { CONSTANTS } from "../Constants";
|
||||
import { AugmentationNames } from "../Augmentation/data/AugmentationNames";
|
||||
import { calculateFactionExp, calculateFactionRep } from "./Formulas";
|
||||
import { FactionWorkType } from "./data/FactionWorkType";
|
||||
import { FactionWorkType } from "../utils/enums";
|
||||
|
||||
interface FactionWorkParams {
|
||||
singularity: boolean;
|
||||
@@ -27,7 +27,7 @@ export class FactionWork extends Work {
|
||||
|
||||
constructor(params?: FactionWorkParams) {
|
||||
super(WorkType.FACTION, params?.singularity ?? true);
|
||||
this.factionWorkType = params?.factionWorkType ?? FactionWorkType.HACKING;
|
||||
this.factionWorkType = params?.factionWorkType ?? FactionWorkType.hacking;
|
||||
this.factionName = params?.faction ?? FactionNames.Sector12;
|
||||
}
|
||||
|
||||
@@ -92,7 +92,9 @@ export class FactionWork extends Work {
|
||||
|
||||
/** Initializes a FactionWork object from a JSON save state. */
|
||||
static fromJSON(value: IReviverValue): FactionWork {
|
||||
return Generic_fromJSON(FactionWork, value.data);
|
||||
const factionWork = Generic_fromJSON(FactionWork, value.data);
|
||||
factionWork.factionWorkType = factionWork.factionWorkType.toLowerCase() as FactionWorkType;
|
||||
return factionWork;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user