fix: only roll unique rewards for peely pix booster packs #1306
							
								
								
									
										8
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										8
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							@ -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",
 | 
				
			||||||
 | 
				
			|||||||
@ -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"
 | 
				
			||||||
 | 
				
			|||||||
@ -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 (const result of pack.components) {
 | 
					 | 
				
			||||||
            purchaseResponse.BoosterPackItems += toStoreItem(result.Item) + ',{"lvl":0};';
 | 
					 | 
				
			||||||
            combineInventoryChanges(purchaseResponse.InventoryChanges, await addItem(inventory, result.Item, 1));
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    } else {
 | 
					 | 
				
			||||||
    for (let i = 0; i != quantity; ++i) {
 | 
					    for (let i = 0; i != quantity; ++i) {
 | 
				
			||||||
            for (const weights of pack.rarityWeightsPerRoll) {
 | 
					        const disallowedItems = new Set();
 | 
				
			||||||
 | 
					        for (let roll = 0; roll != pack.rarityWeightsPerRoll.length; ) {
 | 
				
			||||||
 | 
					            const weights = pack.rarityWeightsPerRoll[roll];
 | 
				
			||||||
            const result = getRandomWeightedRewardUc(pack.components, weights);
 | 
					            const result = getRandomWeightedRewardUc(pack.components, weights);
 | 
				
			||||||
            if (result) {
 | 
					            if (result) {
 | 
				
			||||||
                logger.debug(`booster pack rolled`, result);
 | 
					                logger.debug(`booster pack rolled`, result);
 | 
				
			||||||
 | 
					                if (disallowedItems.has(result.Item)) {
 | 
				
			||||||
 | 
					                    logger.debug(`oops, can't use that one; trying again`);
 | 
				
			||||||
 | 
					                    continue;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                if (!pack.canGiveDuplicates) {
 | 
				
			||||||
 | 
					                    disallowedItems.add(result.Item);
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
                purchaseResponse.BoosterPackItems += toStoreItem(result.Item) + ',{"lvl":0};';
 | 
					                purchaseResponse.BoosterPackItems += toStoreItem(result.Item) + ',{"lvl":0};';
 | 
				
			||||||
                    combineInventoryChanges(
 | 
					                combineInventoryChanges(purchaseResponse.InventoryChanges, await addItem(inventory, result.Item, 1));
 | 
				
			||||||
                        purchaseResponse.InventoryChanges,
 | 
					 | 
				
			||||||
                        await addItem(inventory, result.Item, 1)
 | 
					 | 
				
			||||||
                    );
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					            ++roll;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    return purchaseResponse;
 | 
					    return purchaseResponse;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user