Ensure unique ID for attached upgrades in U7-U8
Some checks failed
Build / build (pull_request) Failing after 27s
Some checks failed
Build / build (pull_request) Failing after 27s
This commit is contained in:
@@ -107,10 +107,11 @@ export const upgradesController: RequestHandler = async (req, res) => {
|
||||
// Handle swapping mod to a different slot
|
||||
arr[arr.indexOf(upgrade.ItemId.$id)] = "";
|
||||
}
|
||||
arr[upgrade.Slot - 1] = upgrade.ItemId.$id;
|
||||
// We need to convert RawUpgrade into Upgrade once it's attached
|
||||
const rawUpgrade = inventory.RawUpgrades.find(x => x.ItemType == upgrade.ItemType);
|
||||
if (rawUpgrade) {
|
||||
const newId = new Types.ObjectId().toString();
|
||||
arr[upgrade.Slot - 1] = newId;
|
||||
addMods(inventory, [
|
||||
{
|
||||
ItemType: upgrade.ItemType,
|
||||
@@ -120,8 +121,10 @@ export const upgradesController: RequestHandler = async (req, res) => {
|
||||
inventory.Upgrades.push({
|
||||
UpgradeFingerprint: `{"lvl":0}`,
|
||||
ItemType: upgrade.ItemType,
|
||||
_id: upgrade.ItemId.$id
|
||||
_id: newId
|
||||
});
|
||||
} else {
|
||||
arr[upgrade.Slot - 1] = upgrade.ItemId.$id;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user