fix: propagate relic reward's itemCount #1030

Merged
Sainan merged 1 commits from propagate-relic-reward-count into main 2025-02-26 15:42:14 -08:00
2 changed files with 6 additions and 4 deletions

View File

@ -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<void> => {
): Promise<IRngResult> => {
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 = {

View File

@ -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 };