From 3b35b20a90b3e6dd4fa18769d6ad650c14c1c69d Mon Sep 17 00:00:00 2001 From: AMelonInsideLemon <166175391+AMelonInsideLemon@users.noreply.github.com> Date: Tue, 21 Oct 2025 04:06:41 +0200 Subject: [PATCH] feat: complete Rising Tide with buying railjack Closes #2754 --- src/services/inventoryService.ts | 20 +++++++++++++++++--- src/services/questService.ts | 4 +++- src/types/purchaseTypes.ts | 4 +++- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/services/inventoryService.ts b/src/services/inventoryService.ts index f3b2159c..39a38825 100644 --- a/src/services/inventoryService.ts +++ b/src/services/inventoryService.ts @@ -389,7 +389,7 @@ export const addItem = async ( }; } else if (ExportResources[typeName].productCategory == "CrewShips") { return { - ...addCrewShip(inventory, typeName), + ...(await addCrewShip(inventory, typeName)), // fix to unlock railjack modding, item bellow supposed to be obtained from archwing quest // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition ...(!inventory.CrewShipHarnesses?.length @@ -1544,17 +1544,31 @@ export const addCrewShipSalvagedWeaponSkin = ( return inventoryChanges; }; -const addCrewShip = ( +const addCrewShip = async ( inventory: TInventoryDatabaseDocument, typeName: string, inventoryChanges: IInventoryChanges = {} -): IInventoryChanges => { +): Promise => { if (inventory.CrewShips.length != 0) { logger.warn("refusing to add CrewShip because account already has one"); } else { const index = inventory.CrewShips.push({ ItemType: typeName }) - 1; inventoryChanges.CrewShips ??= []; inventoryChanges.CrewShips.push(inventory.CrewShips[index].toJSON()); + const railjackQuest = inventory.QuestKeys.find( + qk => qk.ItemType === "/Lotus/Types/Keys/RailJackBuildQuest/RailjackBuildQuestKeyChain" + ); + if (!railjackQuest || !railjackQuest.Completed) { + const questChanges = await completeQuest( + inventory, + "/Lotus/Types/Keys/RailJackBuildQuest/RailjackBuildQuestKeyChain", + false + ); + if (questChanges) { + inventoryChanges.QuestKeys ??= []; + inventoryChanges.QuestKeys.push(questChanges); + } + } } return inventoryChanges; }; diff --git a/src/services/questService.ts b/src/services/questService.ts index eea76b6a..8a7a532e 100644 --- a/src/services/questService.ts +++ b/src/services/questService.ts @@ -120,7 +120,7 @@ export const completeQuest = async ( inventory: TInventoryDatabaseDocument, questKey: string, sendMessages: boolean = false -): Promise => { +): Promise => { // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition const chainStages = ExportKeys[questKey]?.chainStages; @@ -176,6 +176,8 @@ export const completeQuest = async ( existingQuestKey.CompletionDate = new Date(); await handleQuestCompletion(inventory, questKey, undefined, run > 0); } + + return existingQuestKey.toJSON(); }; const getQuestCompletionItems = (questKey: string): ITypeCount[] | undefined => { diff --git a/src/types/purchaseTypes.ts b/src/types/purchaseTypes.ts index e6d5ba1e..4b1542c2 100644 --- a/src/types/purchaseTypes.ts +++ b/src/types/purchaseTypes.ts @@ -9,7 +9,8 @@ import type { TEquipmentKey, ICrewMemberClient, IKubrowPetPrintClient, - IUpgradeClient + IUpgradeClient, + IQuestKeyClient } from "./inventoryTypes/inventoryTypes.ts"; export enum PurchaseSource { @@ -83,6 +84,7 @@ export type IInventoryChanges = { CrewMembers?: ICrewMemberClient[]; KubrowPetPrints?: IKubrowPetPrintClient[]; Upgrades?: IUpgradeClient[]; // TOVERIFY + QuestKeys?: IQuestKeyClient[]; } & Record< Exclude< string,