fix: endo pickups #359
@ -54,7 +54,19 @@ const combineRewardAndLootInventory = (
 | 
				
			|||||||
    const missionCredits = lootInventory.RegularCredits || 0;
 | 
					    const missionCredits = lootInventory.RegularCredits || 0;
 | 
				
			||||||
    const creditsBonus = rewardInventory.RegularCredits || 0;
 | 
					    const creditsBonus = rewardInventory.RegularCredits || 0;
 | 
				
			||||||
    const totalCredits = missionCredits + creditsBonus;
 | 
					    const totalCredits = missionCredits + creditsBonus;
 | 
				
			||||||
    const FusionPoints = (lootInventory.FusionPoints || 0) + (rewardInventory.FusionPoints || 0);
 | 
					    let FusionPoints = rewardInventory.FusionPoints || 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Discharge Endo picked up during the mission
 | 
				
			||||||
 | 
					    if (lootInventory.FusionBundles) {
 | 
				
			||||||
 | 
					        for (const fusionBundle of lootInventory.FusionBundles) {
 | 
				
			||||||
 | 
					            if (fusionBundle.ItemType in fusionBundles) {
 | 
				
			||||||
 | 
					                FusionPoints += fusionBundles[fusionBundle.ItemType] * fusionBundle.ItemCount;
 | 
				
			||||||
 | 
					            } else {
 | 
				
			||||||
 | 
					                logger.error(`unknown fusion bundle: ${fusionBundle.ItemType}`);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        lootInventory.FusionBundles = undefined;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    lootInventory.RegularCredits = totalCredits;
 | 
					    lootInventory.RegularCredits = totalCredits;
 | 
				
			||||||
    lootInventory.FusionPoints = FusionPoints;
 | 
					    lootInventory.FusionPoints = FusionPoints;
 | 
				
			||||||
@ -121,8 +133,9 @@ const creditBundles: Record<string, number> = {
 | 
				
			|||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const fusionBundles: Record<string, number> = {
 | 
					const fusionBundles: Record<string, number> = {
 | 
				
			||||||
    "/Lotus/StoreItems/Upgrades/Mods/FusionBundles/UncommonFusionBundle": 50,
 | 
					    "/Lotus/Upgrades/Mods/FusionBundles/CommonFusionBundle": 15,
 | 
				
			||||||
    "/Lotus/StoreItems/Upgrades/Mods/FusionBundles/RareFusionBundle": 80
 | 
					    "/Lotus/Upgrades/Mods/FusionBundles/UncommonFusionBundle": 50,
 | 
				
			||||||
 | 
					    "/Lotus/Upgrades/Mods/FusionBundles/RareFusionBundle": 80
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const formatRewardsToInventoryType = (
 | 
					const formatRewardsToInventoryType = (
 | 
				
			||||||
@ -134,12 +147,12 @@ const formatRewardsToInventoryType = (
 | 
				
			|||||||
        if (reward.type in creditBundles) {
 | 
					        if (reward.type in creditBundles) {
 | 
				
			||||||
            InventoryChanges.RegularCredits ??= 0;
 | 
					            InventoryChanges.RegularCredits ??= 0;
 | 
				
			||||||
            InventoryChanges.RegularCredits += creditBundles[reward.type] * reward.itemCount;
 | 
					            InventoryChanges.RegularCredits += creditBundles[reward.type] * reward.itemCount;
 | 
				
			||||||
        } else if (reward.type in fusionBundles) {
 | 
					 | 
				
			||||||
            InventoryChanges.FusionPoints ??= 0;
 | 
					 | 
				
			||||||
            InventoryChanges.FusionPoints += fusionBundles[reward.type] * reward.itemCount;
 | 
					 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            const type = reward.type.replace("/Lotus/StoreItems/", "/Lotus/");
 | 
					            const type = reward.type.replace("/Lotus/StoreItems/", "/Lotus/");
 | 
				
			||||||
            if (type in ExportUpgrades) {
 | 
					            if (type in fusionBundles) {
 | 
				
			||||||
 | 
					                InventoryChanges.FusionPoints ??= 0;
 | 
				
			||||||
 | 
					                InventoryChanges.FusionPoints += fusionBundles[type] * reward.itemCount;
 | 
				
			||||||
 | 
					            } else if (type in ExportUpgrades) {
 | 
				
			||||||
                addRewardResponse(InventoryChanges, MissionRewards, type, reward.itemCount, "RawUpgrades");
 | 
					                addRewardResponse(InventoryChanges, MissionRewards, type, reward.itemCount, "RawUpgrades");
 | 
				
			||||||
            } else if (type in ExportGear) {
 | 
					            } else if (type in ExportGear) {
 | 
				
			||||||
                addRewardResponse(InventoryChanges, MissionRewards, type, reward.itemCount, "Consumables");
 | 
					                addRewardResponse(InventoryChanges, MissionRewards, type, reward.itemCount, "Consumables");
 | 
				
			||||||
 | 
				
			|||||||
@ -7,6 +7,7 @@ import {
 | 
				
			|||||||
    ICrewShipSalvagedWeaponSkin,
 | 
					    ICrewShipSalvagedWeaponSkin,
 | 
				
			||||||
    IEvolutionProgress,
 | 
					    IEvolutionProgress,
 | 
				
			||||||
    IMiscItem,
 | 
					    IMiscItem,
 | 
				
			||||||
 | 
					    ITypeCount,
 | 
				
			||||||
    IMission,
 | 
					    IMission,
 | 
				
			||||||
    IRawUpgrade,
 | 
					    IRawUpgrade,
 | 
				
			||||||
    ISeasonChallenge
 | 
					    ISeasonChallenge
 | 
				
			||||||
@ -45,6 +46,7 @@ export interface IMissionInventoryUpdateRequest {
 | 
				
			|||||||
    Pistols?: IEquipmentClient[];
 | 
					    Pistols?: IEquipmentClient[];
 | 
				
			||||||
    Suits?: IEquipmentClient[];
 | 
					    Suits?: IEquipmentClient[];
 | 
				
			||||||
    Melee?: IEquipmentClient[];
 | 
					    Melee?: IEquipmentClient[];
 | 
				
			||||||
 | 
					    FusionBundles?: ITypeCount[];
 | 
				
			||||||
    RawUpgrades?: IRawUpgrade[];
 | 
					    RawUpgrades?: IRawUpgrade[];
 | 
				
			||||||
    MiscItems?: IMiscItem[];
 | 
					    MiscItems?: IMiscItem[];
 | 
				
			||||||
    Consumables?: IConsumable[];
 | 
					    Consumables?: IConsumable[];
 | 
				
			||||||
@ -52,9 +54,10 @@ export interface IMissionInventoryUpdateRequest {
 | 
				
			|||||||
    RegularCredits?: number;
 | 
					    RegularCredits?: number;
 | 
				
			||||||
    ChallengeProgress?: IChallengeProgress[];
 | 
					    ChallengeProgress?: IChallengeProgress[];
 | 
				
			||||||
    RewardInfo?: IMissionInventoryUpdateRequestRewardInfo;
 | 
					    RewardInfo?: IMissionInventoryUpdateRequestRewardInfo;
 | 
				
			||||||
    FusionPoints?: number;
 | 
					 | 
				
			||||||
    Missions?: IMission;
 | 
					    Missions?: IMission;
 | 
				
			||||||
    EvolutionProgress?: IEvolutionProgress[];
 | 
					    EvolutionProgress?: IEvolutionProgress[];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    FusionPoints?: number; // Not a part of the request, but we put it in this struct as an intermediate storage.
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export interface IMissionInventoryUpdateRequestRewardInfo {
 | 
					export interface IMissionInventoryUpdateRequestRewardInfo {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user