From 87726d1230b88044d3c59e8561363b61a8f83cb4 Mon Sep 17 00:00:00 2001 From: Sainan Date: Sat, 15 Mar 2025 09:30:01 +0100 Subject: [PATCH 1/2] fix: limit booster pack purchases to a max quantity of 100 --- src/services/purchaseService.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/services/purchaseService.ts b/src/services/purchaseService.ts index d960c629..cf92b775 100644 --- a/src/services/purchaseService.ts +++ b/src/services/purchaseService.ts @@ -367,6 +367,9 @@ 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); -- 2.47.2 From aeea2a105883e3897e7dac436ebf2bcf2a446bef Mon Sep 17 00:00:00 2001 From: Sainan Date: Sat, 15 Mar 2025 09:32:28 +0100 Subject: [PATCH 2/2] prettier --- src/services/purchaseService.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/services/purchaseService.ts b/src/services/purchaseService.ts index cf92b775..02a9276f 100644 --- a/src/services/purchaseService.ts +++ b/src/services/purchaseService.ts @@ -368,7 +368,9 @@ const handleBoosterPackPurchase = async ( 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."); + 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) { -- 2.47.2