fix: limit booster pack purchases to a max quantity of 100 (#1189)
Some checks failed
Build Docker image / docker (push) Waiting to run
Build / build (20) (push) Has been cancelled
Build / build (18) (push) Has been cancelled
Build / build (22) (push) Has been cancelled

Reviewed-on: #1189
This commit is contained in:
Sainan 2025-03-15 10:25:15 -07:00
parent 2d6e096fde
commit adddc11b6f

View File

@ -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);