chore: fix wording of error when an item goes negative
All checks were successful
Build / build (pull_request) Successful in 2m7s

It would say "subtracting -1" instead of "adding -1" or "subtracting 1"
This commit is contained in:
2025-11-19 15:02:49 +01:00
parent cca9d56d11
commit 4af5b2c343

View File

@@ -1850,7 +1850,9 @@ export const addMiscItems = (inventory: TInventoryDatabaseDocument, itemsArray:
if (MiscItems[itemIndex].ItemCount == 0) {
MiscItems.splice(itemIndex, 1);
} else if (MiscItems[itemIndex].ItemCount < 0) {
throw new Error(`inventory.MiscItems has a negative count for ${ItemType} after subtracting ${ItemCount}`);
throw new Error(
`inventory.MiscItems has a negative count for ${ItemType} after subtracting ${ItemCount * -1}`
);
}
});
};
@@ -1873,7 +1875,7 @@ const applyArrayChanges = (
arr.splice(itemIndex, 1);
} else if (arr[itemIndex].ItemCount < 0) {
throw new Error(
`inventory.${key} has a negative count for ${change.ItemType} after subtracting ${change.ItemCount}`
`inventory.${key} has a negative count for ${change.ItemType} after subtracting ${change.ItemCount * -1}`
);
}
}
@@ -1922,7 +1924,7 @@ export const addMods = (inventory: TInventoryDatabaseDocument, itemsArray: IRawU
RawUpgrades.splice(itemIndex, 1);
} else if (RawUpgrades[itemIndex].ItemCount < 0) {
throw new Error(
`inventory.RawUpgrades has a negative count for ${ItemType} after subtracting ${ItemCount}`
`inventory.RawUpgrades has a negative count for ${ItemType} after subtracting ${ItemCount * -1}`
);
}
});
@@ -1939,7 +1941,7 @@ export const addFusionTreasures = (inventory: TInventoryDatabaseDocument, itemsA
FusionTreasures.splice(itemIndex, 1);
} else if (FusionTreasures[itemIndex].ItemCount <= 0) {
throw new Error(
`inventory.FusionTreasures has a negative count for ${ItemType} after subtracting ${ItemCount}`
`inventory.FusionTreasures has a negative count for ${ItemType} after subtracting ${ItemCount * -1}`
);
}
} else {