From 046c7d9cabec03a5db2eb0d9b1ca8f03533b5adf Mon Sep 17 00:00:00 2001 From: AMelonInsideLemon <166175391+AMelonInsideLemon@users.noreply.github.com> Date: Sat, 25 Oct 2025 10:05:41 +0200 Subject: [PATCH] avoid unnecessary cucling rewardManifests.forEach --- src/services/missionInventoryUpdateService.ts | 38 ++++++++++--------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/src/services/missionInventoryUpdateService.ts b/src/services/missionInventoryUpdateService.ts index e106cda5..cb9622ba 100644 --- a/src/services/missionInventoryUpdateService.ts +++ b/src/services/missionInventoryUpdateService.ts @@ -2082,7 +2082,11 @@ function getRandomMissionDrops( tableIndex = 2; } if (jobType.startsWith("/Lotus/Types/Gameplay/NokkoColony/Jobs/NokkoJob")) { - if (RewardInfo.JobStage === job.xpAmounts.length - 1) rotations = [0, 1, 2]; + if (RewardInfo.JobStage === job.xpAmounts.length - 1) { + rotations = [0, 1, 2]; + } else { + rewardManifests = []; + } } else { rotations = [tableIndex]; } @@ -2183,24 +2187,22 @@ function getRandomMissionDrops( logger.warn(`RewardSeed mismatch:`, { client: RewardInfo.rewardSeed, database: inventory.RewardSeed }); } } - if (rotations.length > 1) { - const rng = new SRng(BigInt(RewardInfo.rewardSeed ?? generateRewardSeed()) ^ 0xffffffffffffffffn); - rewardManifests.forEach(name => { - const table = ExportRewards[name]; - // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition - if (!table) { - logger.error(`unknown droptable: ${name}`); - return; + const rng = new SRng(BigInt(RewardInfo.rewardSeed ?? generateRewardSeed()) ^ 0xffffffffffffffffn); + rewardManifests.forEach(name => { + const table = ExportRewards[name]; + // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition + if (!table) { + logger.error(`unknown droptable: ${name}`); + return; + } + for (const rotation of rotations) { + const rotationRewards = table[rotation]; + const drop = getRandomRewardByChance(rotationRewards, rng); + if (drop) { + drops.push({ StoreItem: drop.type, ItemCount: drop.itemCount }); } - for (const rotation of rotations) { - const rotationRewards = table[rotation]; - const drop = getRandomRewardByChance(rotationRewards, rng); - if (drop) { - drops.push({ StoreItem: drop.type, ItemCount: drop.itemCount }); - } - } - }); - } + } + }); // Railjack Abandoned Cache Rewards, Rotation A (Mandatory Objectives) if (RewardInfo.POICompletions) {