fix: handle mk1 armaments being salvaged #1730
@ -12,6 +12,7 @@ import { getJSONfromString } from "@/src/helpers/stringHelpers";
 | 
				
			|||||||
import { IInventoryChanges } from "@/src/types/purchaseTypes";
 | 
					import { IInventoryChanges } from "@/src/types/purchaseTypes";
 | 
				
			||||||
import { getRandomInt } from "@/src/services/rngService";
 | 
					import { getRandomInt } from "@/src/services/rngService";
 | 
				
			||||||
import { IFingerprintStat } from "@/src/helpers/rivenHelper";
 | 
					import { IFingerprintStat } from "@/src/helpers/rivenHelper";
 | 
				
			||||||
 | 
					import { IEquipmentDatabase } from "@/src/types/inventoryTypes/commonInventoryTypes";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const crewShipIdentifySalvageController: RequestHandler = async (req, res) => {
 | 
					export const crewShipIdentifySalvageController: RequestHandler = async (req, res) => {
 | 
				
			||||||
    const accountId = await getAccountIdForRequest(req);
 | 
					    const accountId = await getAccountIdForRequest(req);
 | 
				
			||||||
@ -42,7 +43,9 @@ export const crewShipIdentifySalvageController: RequestHandler = async (req, res
 | 
				
			|||||||
        );
 | 
					        );
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        const meta = ExportRailjackWeapons[payload.ItemType];
 | 
					        const meta = ExportRailjackWeapons[payload.ItemType];
 | 
				
			||||||
        const upgradeType = meta.defaultUpgrades![0].ItemType;
 | 
					        let defaultOverwrites: Partial<IEquipmentDatabase> | undefined;
 | 
				
			||||||
 | 
					        if (meta.defaultUpgrades?.[0]) {
 | 
				
			||||||
 | 
					            const upgradeType = meta.defaultUpgrades[0].ItemType;
 | 
				
			||||||
            const upgradeMeta = ExportUpgrades[upgradeType];
 | 
					            const upgradeMeta = ExportUpgrades[upgradeType];
 | 
				
			||||||
            const buffs: IFingerprintStat[] = [];
 | 
					            const buffs: IFingerprintStat[] = [];
 | 
				
			||||||
            for (const buff of upgradeMeta.upgradeEntries!) {
 | 
					            for (const buff of upgradeMeta.upgradeEntries!) {
 | 
				
			||||||
@ -51,13 +54,22 @@ export const crewShipIdentifySalvageController: RequestHandler = async (req, res
 | 
				
			|||||||
                    Value: Math.trunc(Math.random() * 0x40000000)
 | 
					                    Value: Math.trunc(Math.random() * 0x40000000)
 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        addEquipment(inventory, "CrewShipSalvagedWeapons", payload.ItemType, undefined, inventoryChanges, {
 | 
					            defaultOverwrites = {
 | 
				
			||||||
                UpgradeType: upgradeType,
 | 
					                UpgradeType: upgradeType,
 | 
				
			||||||
                UpgradeFingerprint: JSON.stringify({
 | 
					                UpgradeFingerprint: JSON.stringify({
 | 
				
			||||||
                    compat: payload.ItemType,
 | 
					                    compat: payload.ItemType,
 | 
				
			||||||
                    buffs
 | 
					                    buffs
 | 
				
			||||||
                } satisfies IInnateDamageFingerprint)
 | 
					                } satisfies IInnateDamageFingerprint)
 | 
				
			||||||
        });
 | 
					            };
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        addEquipment(
 | 
				
			||||||
 | 
					            inventory,
 | 
				
			||||||
 | 
					            "CrewShipSalvagedWeapons",
 | 
				
			||||||
 | 
					            payload.ItemType,
 | 
				
			||||||
 | 
					            undefined,
 | 
				
			||||||
 | 
					            inventoryChanges,
 | 
				
			||||||
 | 
					            defaultOverwrites
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    inventoryChanges.CrewShipRawSalvage = [
 | 
					    inventoryChanges.CrewShipRawSalvage = [
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user