fix: propagate relic reward's itemCount (#1030)
Preemptive fix for a visual bug after completing a non-endless fissure. Reviewed-on: OpenWF/SpaceNinjaServer#1030
This commit is contained in:
		
							parent
							
								
									58ec63f7b9
								
							
						
					
					
						commit
						08f4137d71
					
				@ -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 = {
 | 
			
		||||
 | 
			
		||||
@ -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 };
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user