diff --git a/src/models/inventoryModels/inventoryModel.ts b/src/models/inventoryModels/inventoryModel.ts index 1b990228..47c8da96 100644 --- a/src/models/inventoryModels/inventoryModel.ts +++ b/src/models/inventoryModels/inventoryModel.ts @@ -1414,7 +1414,7 @@ const inventorySchema = new Schema( //https://warframe.fandom.com/wiki/Heist //ProfitTaker(1-4) Example:"LocationTag": "EudicoHeists", "Jobs":Mission name - CompletedJobChains: [completedJobChainsSchema], + CompletedJobChains: { type: [completedJobChainsSchema], default: undefined }, //Night Wave Challenge SeasonChallengeHistory: [seasonChallengeHistorySchema], diff --git a/src/services/missionInventoryUpdateService.ts b/src/services/missionInventoryUpdateService.ts index ab5bdcdb..e0641adf 100644 --- a/src/services/missionInventoryUpdateService.ts +++ b/src/services/missionInventoryUpdateService.ts @@ -143,6 +143,28 @@ export const addMissionInventoryUpdates = async ( if (inventoryUpdates.RewardInfo.NemesisAbandonedRewards) { inventory.NemesisAbandonedRewards = inventoryUpdates.RewardInfo.NemesisAbandonedRewards; } + if (inventoryUpdates.MissionStatus == "GS_SUCCESS" && inventoryUpdates.RewardInfo.jobId) { + // e.g. for Profit-Taker Phase 1: + // JobTier: -6, + // jobId: '/Lotus/Types/Gameplay/Venus/Jobs/Heists/HeistProfitTakerBountyOne_-6_SolarisUnitedHub1_663a71c80000000000000025_EudicoHeists', + // This is sent multiple times, with JobStage starting at 0 and incrementing each time, but only the final upload has GS_SUCCESS. + + // eslint-disable-next-line @typescript-eslint/no-unused-vars + const [bounty, tier, hub, id, tag] = inventoryUpdates.RewardInfo.jobId.split("_"); + if (tag == "EudicoHeists") { + inventory.CompletedJobChains ??= []; + let chain = inventory.CompletedJobChains.find(x => x.LocationTag == tag); + if (!chain) { + chain = + inventory.CompletedJobChains[ + inventory.CompletedJobChains.push({ LocationTag: tag, Jobs: [] }) - 1 + ]; + } + if (!chain.Jobs.includes(bounty)) { + chain.Jobs.push(bounty); + } + } + } } for (const [key, value] of getEntriesUnsafe(inventoryUpdates)) { if (value === undefined) { diff --git a/src/types/inventoryTypes/inventoryTypes.ts b/src/types/inventoryTypes/inventoryTypes.ts index c25b7123..244e71bd 100644 --- a/src/types/inventoryTypes/inventoryTypes.ts +++ b/src/types/inventoryTypes/inventoryTypes.ts @@ -292,7 +292,7 @@ export interface IInventoryClient extends IDailyAffiliations, InventoryClientEqu RecentVendorPurchases?: IRecentVendorPurchaseClient[]; NodeIntrosCompleted: string[]; GuildId?: IOid; - CompletedJobChains: ICompletedJobChain[]; + CompletedJobChains?: ICompletedJobChain[]; SeasonChallengeHistory: ISeasonChallenge[]; EquippedInstrument?: string; InvasionChainProgress: IInvasionChainProgress[]; diff --git a/src/types/requestTypes.ts b/src/types/requestTypes.ts index 173d150d..1f00fa45 100644 --- a/src/types/requestTypes.ts +++ b/src/types/requestTypes.ts @@ -143,6 +143,13 @@ export interface IRewardInfo { PurgatoryRewardQualifications?: string; rewardSeed?: number; periodicMissionTag?: string; + + // for bounties, only EOM_AFK and node are given from above, plus: + JobTier?: string; + jobId?: string; + JobStage?: string; + Q?: boolean; // always false? + CheckpointCounter?: number; // starts at 1, is incremented with each job stage upload, and does not reset when starting a new job } export type IMissionStatus = "GS_SUCCESS" | "GS_FAILURE" | "GS_DUMPED" | "GS_QUIT" | "GS_INTERRUPTED";