diff --git a/src/controllers/api/getVoidProjectionRewardsController.ts b/src/controllers/api/getVoidProjectionRewardsController.ts index 46e960e0..46210be5 100644 --- a/src/controllers/api/getVoidProjectionRewardsController.ts +++ b/src/controllers/api/getVoidProjectionRewardsController.ts @@ -11,7 +11,11 @@ export const getVoidProjectionRewardsController: RequestHandler = async (req, re if (data.ParticipantInfo.QualifiesForReward && !data.ParticipantInfo.HaveRewardResponse) { const inventory = await getInventory(accountId); - await crackRelic(inventory, data.ParticipantInfo); + const reward = await crackRelic(inventory, data.ParticipantInfo); + if (!inventory.MissionRelicRewards || inventory.MissionRelicRewards.length >= data.CurrentWave) { + inventory.MissionRelicRewards = []; + } + inventory.MissionRelicRewards.push({ ItemType: reward.type, ItemCount: reward.itemCount }); await inventory.save(); } diff --git a/src/helpers/relicHelper.ts b/src/helpers/relicHelper.ts index 964e43e2..04b315f7 100644 --- a/src/helpers/relicHelper.ts +++ b/src/helpers/relicHelper.ts @@ -54,6 +54,9 @@ export const crackRelic = async ( (await handleStoreItemAcquisition(reward.type, inventory, reward.itemCount)).InventoryChanges ); + // Client has picked its own reward (for lack of choice) + participant.ChosenRewardOwner = participant.AccountId; + return reward; }; diff --git a/src/models/inventoryModels/inventoryModel.ts b/src/models/inventoryModels/inventoryModel.ts index d727a100..58c57b93 100644 --- a/src/models/inventoryModels/inventoryModel.ts +++ b/src/models/inventoryModels/inventoryModel.ts @@ -1473,6 +1473,9 @@ const inventorySchema = new Schema( SubscribedToEmailsPersonalized: { type: Number, default: 0 }, RewardSeed: BigInt, + // Temporary data so we can show all relic rewards from an endless mission at EOM + MissionRelicRewards: { type: [typeCountSchema], default: undefined }, + //Credit RegularCredits: { type: Number, default: 0 }, //Platinum @@ -1841,6 +1844,7 @@ inventorySchema.set("toJSON", { delete returnedObject._id; delete returnedObject.__v; delete returnedObject.accountOwnerId; + delete returnedObject.MissionRelicRewards; const inventoryDatabase = returnedObject as Partial; const inventoryResponse = returnedObject as IInventoryClient; diff --git a/src/services/missionInventoryUpdateService.ts b/src/services/missionInventoryUpdateService.ts index 22fe76c5..a99784e9 100644 --- a/src/services/missionInventoryUpdateService.ts +++ b/src/services/missionInventoryUpdateService.ts @@ -1334,13 +1334,21 @@ export const addMissionRewards = async ( rngRewardCredits: inventoryChanges.RegularCredits ?? 0 }); - if ( - voidTearWave && - voidTearWave.Participants[0].QualifiesForReward && - !voidTearWave.Participants[0].HaveRewardResponse - ) { - const reward = await crackRelic(inventory, voidTearWave.Participants[0], inventoryChanges); - MissionRewards.push({ StoreItem: reward.type, ItemCount: reward.itemCount }); + if (voidTearWave && voidTearWave.Participants[0].QualifiesForReward) { + if (!voidTearWave.Participants[0].HaveRewardResponse) { + // non-endless fissure; giving reward now + const reward = await crackRelic(inventory, voidTearWave.Participants[0], inventoryChanges); + MissionRewards.push({ StoreItem: reward.type, ItemCount: reward.itemCount }); + } else if (inventory.MissionRelicRewards) { + // endless fissure; already gave reward(s) but should still show in EOM screen + for (const reward of inventory.MissionRelicRewards) { + MissionRewards.push({ + StoreItem: reward.ItemType, + ItemCount: reward.ItemCount + }); + } + inventory.MissionRelicRewards = undefined; + } } if (strippedItems) { diff --git a/src/types/inventoryTypes/inventoryTypes.ts b/src/types/inventoryTypes/inventoryTypes.ts index 5dea2533..83d00c1d 100644 --- a/src/types/inventoryTypes/inventoryTypes.ts +++ b/src/types/inventoryTypes/inventoryTypes.ts @@ -147,6 +147,7 @@ export interface IInventoryDatabase LastInventorySync?: Types.ObjectId; EndlessXP?: IEndlessXpProgressDatabase[]; PersonalGoalProgress?: IGoalProgressDatabase[]; + MissionRelicRewards?: ITypeCount[]; } export interface IQuestKeyDatabase {