fix: only roll unique rewards for peely pix booster packs
All checks were successful
Build / build (22) (pull_request) Successful in 1m21s
Build / build (20) (push) Successful in 49s
Build / build (18) (push) Successful in 1m12s
Build / build (22) (push) Successful in 1m21s
Build / build (18) (pull_request) Successful in 49s
Build / build (20) (pull_request) Successful in 1m10s

This commit is contained in:
Sainan 2025-03-23 16:59:59 +01:00
parent c3d7ae33c2
commit 9a20c1259e
3 changed files with 21 additions and 21 deletions

8
package-lock.json generated
View File

@ -18,7 +18,7 @@
"mongoose": "^8.11.0", "mongoose": "^8.11.0",
"morgan": "^1.10.0", "morgan": "^1.10.0",
"typescript": ">=5.5 <5.6.0", "typescript": ">=5.5 <5.6.0",
"warframe-public-export-plus": "^0.5.47", "warframe-public-export-plus": "^0.5.48",
"warframe-riven-info": "^0.1.2", "warframe-riven-info": "^0.1.2",
"winston": "^3.17.0", "winston": "^3.17.0",
"winston-daily-rotate-file": "^5.0.0" "winston-daily-rotate-file": "^5.0.0"
@ -4013,9 +4013,9 @@
} }
}, },
"node_modules/warframe-public-export-plus": { "node_modules/warframe-public-export-plus": {
"version": "0.5.47", "version": "0.5.48",
"resolved": "https://registry.npmjs.org/warframe-public-export-plus/-/warframe-public-export-plus-0.5.47.tgz", "resolved": "https://registry.npmjs.org/warframe-public-export-plus/-/warframe-public-export-plus-0.5.48.tgz",
"integrity": "sha512-ZJK3VT1PdSPwZlhIzUVBlydwK4DM0sOmeCiixVMgOM8XuOPJ8OHfQUoLKydtw5rxCsowzFPbx5b3KBke5C4akQ==" "integrity": "sha512-vJitVYnaViQo43xAkL/h3MJ/6wS7YknKEYhYs+N/GrsspYLMPGf9KSuR19tprB2g9KVGS5o67t0v5K8p0RTQCQ=="
}, },
"node_modules/warframe-riven-info": { "node_modules/warframe-riven-info": {
"version": "0.1.2", "version": "0.1.2",

View File

@ -23,7 +23,7 @@
"mongoose": "^8.11.0", "mongoose": "^8.11.0",
"morgan": "^1.10.0", "morgan": "^1.10.0",
"typescript": ">=5.5 <5.6.0", "typescript": ">=5.5 <5.6.0",
"warframe-public-export-plus": "^0.5.47", "warframe-public-export-plus": "^0.5.48",
"warframe-riven-info": "^0.1.2", "warframe-riven-info": "^0.1.2",
"winston": "^3.17.0", "winston": "^3.17.0",
"winston-daily-rotate-file": "^5.0.0" "winston-daily-rotate-file": "^5.0.0"

View File

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