From 08f4137d712cf264d1bdc3cb3902563cbe77551d Mon Sep 17 00:00:00 2001 From: Sainan Date: Wed, 26 Feb 2025 15:42:13 -0800 Subject: [PATCH] fix: propagate relic reward's itemCount (#1030) Preemptive fix for a visual bug after completing a non-endless fissure. Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/1030 --- src/helpers/relicHelper.ts | 6 ++++-- src/services/missionInventoryUpdateService.ts | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/helpers/relicHelper.ts b/src/helpers/relicHelper.ts index 6e28aef0..a78c99ec 100644 --- a/src/helpers/relicHelper.ts +++ b/src/helpers/relicHelper.ts @@ -1,7 +1,7 @@ import { TInventoryDatabaseDocument } from "@/src/models/inventoryModels/inventoryModel"; import { IVoidTearParticipantInfo } from "@/src/types/requestTypes"; import { ExportRelics, ExportRewards, TRarity } from "warframe-public-export-plus"; -import { getRandomWeightedReward2 } from "@/src/services/rngService"; +import { getRandomWeightedReward2, IRngResult } from "@/src/services/rngService"; import { logger } from "@/src/utils/logger"; import { addMiscItems } from "@/src/services/inventoryService"; import { handleStoreItemAcquisition } from "@/src/services/purchaseService"; @@ -9,7 +9,7 @@ import { handleStoreItemAcquisition } from "@/src/services/purchaseService"; export const crackRelic = async ( inventory: TInventoryDatabaseDocument, participant: IVoidTearParticipantInfo -): Promise => { +): Promise => { const relic = ExportRelics[participant.VoidProjection]; const weights = refinementToWeights[relic.quality]; logger.debug(`opening a relic of quality ${relic.quality}; rarity weights are`, weights); @@ -30,6 +30,8 @@ export const crackRelic = async ( // Give reward await handleStoreItemAcquisition(reward.type, inventory, reward.itemCount); + + return reward; }; const refinementToWeights = { diff --git a/src/services/missionInventoryUpdateService.ts b/src/services/missionInventoryUpdateService.ts index 774a5db0..87cf5ae6 100644 --- a/src/services/missionInventoryUpdateService.ts +++ b/src/services/missionInventoryUpdateService.ts @@ -320,8 +320,8 @@ export const addMissionRewards = async ( voidTearWave.Participants[0].QualifiesForReward && !voidTearWave.Participants[0].HaveRewardResponse ) { - await crackRelic(inventory, voidTearWave.Participants[0]); - MissionRewards.push({ StoreItem: voidTearWave.Participants[0].Reward, ItemCount: 1 }); + const reward = await crackRelic(inventory, voidTearWave.Participants[0]); + MissionRewards.push({ StoreItem: reward.type, ItemCount: reward.itemCount }); } return { inventoryChanges, MissionRewards, credits };