feat: complete Rising Tide with buying railjack
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				Build / build (pull_request) Successful in 4m36s
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	Build / build (pull_request) Successful in 4m36s
				
			Closes #2754
This commit is contained in:
		
							parent
							
								
									4b3b1969da
								
							
						
					
					
						commit
						3b35b20a90
					
				@ -389,7 +389,7 @@ export const addItem = async (
 | 
				
			|||||||
            };
 | 
					            };
 | 
				
			||||||
        } else if (ExportResources[typeName].productCategory == "CrewShips") {
 | 
					        } else if (ExportResources[typeName].productCategory == "CrewShips") {
 | 
				
			||||||
            return {
 | 
					            return {
 | 
				
			||||||
                ...addCrewShip(inventory, typeName),
 | 
					                ...(await addCrewShip(inventory, typeName)),
 | 
				
			||||||
                // fix to unlock railjack modding, item bellow supposed to be obtained from archwing quest
 | 
					                // fix to unlock railjack modding, item bellow supposed to be obtained from archwing quest
 | 
				
			||||||
                // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
 | 
					                // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
 | 
				
			||||||
                ...(!inventory.CrewShipHarnesses?.length
 | 
					                ...(!inventory.CrewShipHarnesses?.length
 | 
				
			||||||
@ -1544,17 +1544,31 @@ export const addCrewShipSalvagedWeaponSkin = (
 | 
				
			|||||||
    return inventoryChanges;
 | 
					    return inventoryChanges;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const addCrewShip = (
 | 
					const addCrewShip = async (
 | 
				
			||||||
    inventory: TInventoryDatabaseDocument,
 | 
					    inventory: TInventoryDatabaseDocument,
 | 
				
			||||||
    typeName: string,
 | 
					    typeName: string,
 | 
				
			||||||
    inventoryChanges: IInventoryChanges = {}
 | 
					    inventoryChanges: IInventoryChanges = {}
 | 
				
			||||||
): IInventoryChanges => {
 | 
					): Promise<IInventoryChanges> => {
 | 
				
			||||||
    if (inventory.CrewShips.length != 0) {
 | 
					    if (inventory.CrewShips.length != 0) {
 | 
				
			||||||
        logger.warn("refusing to add CrewShip because account already has one");
 | 
					        logger.warn("refusing to add CrewShip because account already has one");
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        const index = inventory.CrewShips.push({ ItemType: typeName }) - 1;
 | 
					        const index = inventory.CrewShips.push({ ItemType: typeName }) - 1;
 | 
				
			||||||
        inventoryChanges.CrewShips ??= [];
 | 
					        inventoryChanges.CrewShips ??= [];
 | 
				
			||||||
        inventoryChanges.CrewShips.push(inventory.CrewShips[index].toJSON<IEquipmentClient>());
 | 
					        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;
 | 
					    return inventoryChanges;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
				
			|||||||
@ -120,7 +120,7 @@ export const completeQuest = async (
 | 
				
			|||||||
    inventory: TInventoryDatabaseDocument,
 | 
					    inventory: TInventoryDatabaseDocument,
 | 
				
			||||||
    questKey: string,
 | 
					    questKey: string,
 | 
				
			||||||
    sendMessages: boolean = false
 | 
					    sendMessages: boolean = false
 | 
				
			||||||
): Promise<void> => {
 | 
					): Promise<void | IQuestKeyClient> => {
 | 
				
			||||||
    // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
 | 
					    // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
 | 
				
			||||||
    const chainStages = ExportKeys[questKey]?.chainStages;
 | 
					    const chainStages = ExportKeys[questKey]?.chainStages;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -176,6 +176,8 @@ export const completeQuest = async (
 | 
				
			|||||||
        existingQuestKey.CompletionDate = new Date();
 | 
					        existingQuestKey.CompletionDate = new Date();
 | 
				
			||||||
        await handleQuestCompletion(inventory, questKey, undefined, run > 0);
 | 
					        await handleQuestCompletion(inventory, questKey, undefined, run > 0);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return existingQuestKey.toJSON<IQuestKeyClient>();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const getQuestCompletionItems = (questKey: string): ITypeCount[] | undefined => {
 | 
					const getQuestCompletionItems = (questKey: string): ITypeCount[] | undefined => {
 | 
				
			||||||
 | 
				
			|||||||
@ -9,7 +9,8 @@ import type {
 | 
				
			|||||||
    TEquipmentKey,
 | 
					    TEquipmentKey,
 | 
				
			||||||
    ICrewMemberClient,
 | 
					    ICrewMemberClient,
 | 
				
			||||||
    IKubrowPetPrintClient,
 | 
					    IKubrowPetPrintClient,
 | 
				
			||||||
    IUpgradeClient
 | 
					    IUpgradeClient,
 | 
				
			||||||
 | 
					    IQuestKeyClient
 | 
				
			||||||
} from "./inventoryTypes/inventoryTypes.ts";
 | 
					} from "./inventoryTypes/inventoryTypes.ts";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export enum PurchaseSource {
 | 
					export enum PurchaseSource {
 | 
				
			||||||
@ -83,6 +84,7 @@ export type IInventoryChanges = {
 | 
				
			|||||||
    CrewMembers?: ICrewMemberClient[];
 | 
					    CrewMembers?: ICrewMemberClient[];
 | 
				
			||||||
    KubrowPetPrints?: IKubrowPetPrintClient[];
 | 
					    KubrowPetPrints?: IKubrowPetPrintClient[];
 | 
				
			||||||
    Upgrades?: IUpgradeClient[]; // TOVERIFY
 | 
					    Upgrades?: IUpgradeClient[]; // TOVERIFY
 | 
				
			||||||
 | 
					    QuestKeys?: IQuestKeyClient[];
 | 
				
			||||||
} & Record<
 | 
					} & Record<
 | 
				
			||||||
        Exclude<
 | 
					        Exclude<
 | 
				
			||||||
            string,
 | 
					            string,
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user