From adddc11b6fa79963b4c10ffc27467b8aea76ed0a Mon Sep 17 00:00:00 2001 From: Sainan Date: Sat, 15 Mar 2025 10:25:15 -0700 Subject: [PATCH] fix: limit booster pack purchases to a max quantity of 100 (#1189) Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/1189 --- src/services/purchaseService.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/services/purchaseService.ts b/src/services/purchaseService.ts index b3d795a3..9336f0bf 100644 --- a/src/services/purchaseService.ts +++ b/src/services/purchaseService.ts @@ -370,6 +370,11 @@ const handleBoosterPackPurchase = async ( BoosterPackItems: "", 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 (const weights of pack.rarityWeightsPerRoll) { const result = getRandomWeightedRewardUc(pack.components, weights);