avoid unnecessary cucling rewardManifests.forEach

This commit is contained in:
AMelonInsideLemon 2025-10-25 10:05:41 +02:00
parent a5403ef1c0
commit 046c7d9cab

View File

@ -2082,7 +2082,11 @@ function getRandomMissionDrops(
tableIndex = 2; tableIndex = 2;
} }
if (jobType.startsWith("/Lotus/Types/Gameplay/NokkoColony/Jobs/NokkoJob")) { 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 { } else {
rotations = [tableIndex]; rotations = [tableIndex];
} }
@ -2183,24 +2187,22 @@ function getRandomMissionDrops(
logger.warn(`RewardSeed mismatch:`, { client: RewardInfo.rewardSeed, database: inventory.RewardSeed }); logger.warn(`RewardSeed mismatch:`, { client: RewardInfo.rewardSeed, database: inventory.RewardSeed });
} }
} }
if (rotations.length > 1) { const rng = new SRng(BigInt(RewardInfo.rewardSeed ?? generateRewardSeed()) ^ 0xffffffffffffffffn);
const rng = new SRng(BigInt(RewardInfo.rewardSeed ?? generateRewardSeed()) ^ 0xffffffffffffffffn); rewardManifests.forEach(name => {
rewardManifests.forEach(name => { const table = ExportRewards[name];
const table = ExportRewards[name]; // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition if (!table) {
if (!table) { logger.error(`unknown droptable: ${name}`);
logger.error(`unknown droptable: ${name}`); return;
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) // Railjack Abandoned Cache Rewards, Rotation A (Mandatory Objectives)
if (RewardInfo.POICompletions) { if (RewardInfo.POICompletions) {