mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-28 20:07:04 +02:00
Fix save corruptions from invalid types
This commit is contained in:
@@ -12,6 +12,7 @@ import { CONSTANTS } from "../Constants";
|
||||
import { AugmentationNames } from "../Augmentation/data/AugmentationNames";
|
||||
import { calculateFactionExp, calculateFactionRep } from "./Formulas";
|
||||
import { FactionWorkType } from "../utils/enums";
|
||||
import { findEnumMember } from "../utils/helpers/enum";
|
||||
|
||||
interface FactionWorkParams {
|
||||
singularity: boolean;
|
||||
@@ -93,7 +94,8 @@ export class FactionWork extends Work {
|
||||
/** Initializes a FactionWork object from a JSON save state. */
|
||||
static fromJSON(value: IReviverValue): FactionWork {
|
||||
const factionWork = Generic_fromJSON(FactionWork, value.data);
|
||||
factionWork.factionWorkType = factionWork.factionWorkType.toLowerCase() as FactionWorkType;
|
||||
factionWork.factionWorkType =
|
||||
findEnumMember(FactionWorkType, factionWork.factionWorkType) ?? FactionWorkType.hacking;
|
||||
return factionWork;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user