fix: handle mk1 armaments being salvaged
All checks were successful
Build / build (push) Successful in 1m29s
Build / build (pull_request) Successful in 1m31s

This commit is contained in:
Sainan 2025-04-18 22:59:56 +02:00
parent 8b0ba0b84a
commit 410756f3aa

View File

@ -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,22 +43,33 @@ 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;
const upgradeMeta = ExportUpgrades[upgradeType]; if (meta.defaultUpgrades?.[0]) {
const buffs: IFingerprintStat[] = []; const upgradeType = meta.defaultUpgrades[0].ItemType;
for (const buff of upgradeMeta.upgradeEntries!) { const upgradeMeta = ExportUpgrades[upgradeType];
buffs.push({ const buffs: IFingerprintStat[] = [];
Tag: buff.tag, for (const buff of upgradeMeta.upgradeEntries!) {
Value: Math.trunc(Math.random() * 0x40000000) buffs.push({
}); Tag: buff.tag,
Value: Math.trunc(Math.random() * 0x40000000)
});
}
defaultOverwrites = {
UpgradeType: upgradeType,
UpgradeFingerprint: JSON.stringify({
compat: payload.ItemType,
buffs
} satisfies IInnateDamageFingerprint)
};
} }
addEquipment(inventory, "CrewShipSalvagedWeapons", payload.ItemType, undefined, inventoryChanges, { addEquipment(
UpgradeType: upgradeType, inventory,
UpgradeFingerprint: JSON.stringify({ "CrewShipSalvagedWeapons",
compat: payload.ItemType, payload.ItemType,
buffs undefined,
} satisfies IInnateDamageFingerprint) inventoryChanges,
}); defaultOverwrites
);
} }
inventoryChanges.CrewShipRawSalvage = [ inventoryChanges.CrewShipRawSalvage = [