feat: complete Rising Tide with buying railjack

Closes #2754
This commit is contained in:
AMelonInsideLemon 2025-10-21 04:06:41 +02:00
parent 4b3b1969da
commit 3b35b20a90
3 changed files with 23 additions and 5 deletions

View File

@ -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<IInventoryChanges> => {
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<IEquipmentClient>());
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;
};

View File

@ -120,7 +120,7 @@ export const completeQuest = async (
inventory: TInventoryDatabaseDocument,
questKey: string,
sendMessages: boolean = false
): Promise<void> => {
): Promise<void | IQuestKeyClient> => {
// 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<IQuestKeyClient>();
};
const getQuestCompletionItems = (questKey: string): ITypeCount[] | undefined => {

View File

@ -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,