fix: limit booster pack purchases to a max quantity of 100
Some checks failed
Build / build (18) (push) Failing after 45s
Build / build (22) (push) Failing after 1m7s
Build / build (20) (pull_request) Failing after 41s
Build / build (18) (pull_request) Failing after 1m3s
Build / build (22) (pull_request) Failing after 39s
Build / build (20) (push) Failing after 3m52s

This commit is contained in:
Sainan 2025-03-15 09:30:01 +01:00
parent 0facdd1af9
commit 87726d1230

View File

@ -367,6 +367,9 @@ const handleBoosterPackPurchase = async (
BoosterPackItems: "", BoosterPackItems: "",
InventoryChanges: {} InventoryChanges: {}
}; };
if (quantity > 100) {
throw new Error("attempt to roll over 100 booster packs in a single go. possible but unlikely to be desirable for the user or the server.");
}
for (let i = 0; i != quantity; ++i) { for (let i = 0; i != quantity; ++i) {
for (const weights of pack.rarityWeightsPerRoll) { for (const weights of pack.rarityWeightsPerRoll) {
const result = getRandomWeightedRewardUc(pack.components, weights); const result = getRandomWeightedRewardUc(pack.components, weights);