From 88322a23a7978abb7582eb05fd64a67a4e513070 Mon Sep 17 00:00:00 2001 From: catloversg <152669316+catloversg@users.noreply.github.com> Date: Wed, 27 Nov 2024 16:23:20 +0700 Subject: [PATCH] BUGFIX: Cannot load Bladeburner tasks of Sleeves from pre-v2.6.1 (#1800) --- .../Sleeve/Work/SleeveBladeburnerWork.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/PersonObjects/Sleeve/Work/SleeveBladeburnerWork.ts b/src/PersonObjects/Sleeve/Work/SleeveBladeburnerWork.ts index 355f5a6d4..ab66a9aca 100644 --- a/src/PersonObjects/Sleeve/Work/SleeveBladeburnerWork.ts +++ b/src/PersonObjects/Sleeve/Work/SleeveBladeburnerWork.ts @@ -100,8 +100,20 @@ export class SleeveBladeburnerWork extends SleeveWorkClass { /** Initializes a BladeburnerWork object from a JSON save state. */ static fromJSON(value: IReviverValue): SleeveBladeburnerWork { objectAssert(value.data); - const actionId = loadActionIdentifier(value.data?.actionId); - if (!actionId) return invalidWork(); + let actionId = loadActionIdentifier(value.data?.actionId); + if (!actionId) { + /** + * In pre-v2.6.1 versions, "name" and "type" of actionId are saved directly in "actionName" and "actionType", not + * in the actionId object. + */ + if (!value.data["actionName"]) { + return invalidWork(); + } + actionId = loadActionIdentifier({ name: value.data["actionName"], type: value.data["actionType"] }); + if (!actionId) { + return invalidWork(); + } + } value.data.actionId = actionId; return Generic_fromJSON(SleeveBladeburnerWork, value.data, SleeveBladeburnerWork.savedKeys); }