fix: only roll unique rewards for peely pix booster packs (#1306)
Reviewed-on: #1306
This commit is contained in:
parent
19bfffaa7c
commit
db8bff20fe
@ -415,24 +415,24 @@ const handleBoosterPackPurchase = async (
|
|||||||
"attempt to roll over 100 booster packs in a single go. possible but unlikely to be desirable for the user or the server."
|
"attempt to roll over 100 booster packs in a single go. possible but unlikely to be desirable for the user or the server."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (typeName == "/Lotus/Types/BoosterPacks/1999StickersPackEchoesArchimedeaFixed") {
|
for (let i = 0; i != quantity; ++i) {
|
||||||
for (const result of pack.components) {
|
const disallowedItems = new Set();
|
||||||
purchaseResponse.BoosterPackItems += toStoreItem(result.Item) + ',{"lvl":0};';
|
for (let roll = 0; roll != pack.rarityWeightsPerRoll.length; ) {
|
||||||
combineInventoryChanges(purchaseResponse.InventoryChanges, await addItem(inventory, result.Item, 1));
|
const weights = pack.rarityWeightsPerRoll[roll];
|
||||||
}
|
const result = getRandomWeightedRewardUc(pack.components, weights);
|
||||||
} else {
|
if (result) {
|
||||||
for (let i = 0; i != quantity; ++i) {
|
logger.debug(`booster pack rolled`, result);
|
||||||
for (const weights of pack.rarityWeightsPerRoll) {
|
if (disallowedItems.has(result.Item)) {
|
||||||
const result = getRandomWeightedRewardUc(pack.components, weights);
|
logger.debug(`oops, can't use that one; trying again`);
|
||||||
if (result) {
|
continue;
|
||||||
logger.debug(`booster pack rolled`, result);
|
|
||||||
purchaseResponse.BoosterPackItems += toStoreItem(result.Item) + ',{"lvl":0};';
|
|
||||||
combineInventoryChanges(
|
|
||||||
purchaseResponse.InventoryChanges,
|
|
||||||
await addItem(inventory, result.Item, 1)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
if (!pack.canGiveDuplicates) {
|
||||||
|
disallowedItems.add(result.Item);
|
||||||
|
}
|
||||||
|
purchaseResponse.BoosterPackItems += toStoreItem(result.Item) + ',{"lvl":0};';
|
||||||
|
combineInventoryChanges(purchaseResponse.InventoryChanges, await addItem(inventory, result.Item, 1));
|
||||||
}
|
}
|
||||||
|
++roll;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return purchaseResponse;
|
return purchaseResponse;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user