fix: additional checks in bounty rewards #1626

Merged
Sainan merged 1 commits from AMelonInsideLemon/SpaceNinjaServer:check-locationTag into main 2025-04-15 06:10:26 -07:00

View File

@ -922,7 +922,7 @@ function getRandomMissionDrops(RewardInfo: IRewardInfo, tierOverride: number | u
if (syndicateEntry.Tag === "EntratiSyndicate") {
const vault = syndicateEntry.Jobs.find(j => j.locationTag === locationTag);
if (vault) job = vault;
if (vault && locationTag) job = vault;
// if (
// [
// "DeimosRuinsExterminateBounty",
@ -997,8 +997,10 @@ function getRandomMissionDrops(RewardInfo: IRewardInfo, tierOverride: number | u
(RewardInfo.JobStage === job.xpAmounts.length - 1 || job.isVault) &&
!isEndlessJob
) {
rewardManifests.push(job.rewards);
rotations.push(ExportRewards[job.rewards].length - 1);
if (ExportRewards[job.rewards]) {
rewardManifests.push(job.rewards);
Review

Sorry, this line just confuses the fuck out of me. Why are you doing rewardManifests.push(job.rewards); when just a few lines earlier you have rewardManifests = [job.rewards]; ? Surely this is not intentional?

Sorry, this line just confuses the fuck out of me. Why are you doing `rewardManifests.push(job.rewards);` when just a few lines earlier you have `rewardManifests = [job.rewards];` ? Surely this is not intentional?

When player doesn't fail any bonus objective Q stays true, and if this is last JobStage then we should give additional reward for that JobStage. That why there is push

When player doesn't fail any bonus objective `Q` stays true, and if this is last `JobStage` then we should give `additional` reward for that `JobStage`. That why there is push
rotations.push(ExportRewards[job.rewards].length - 1);
}
}
}
}
@ -1053,17 +1055,20 @@ function getRandomMissionDrops(RewardInfo: IRewardInfo, tierOverride: number | u
if (rewardManifests.length != 0) {
logger.debug(`generating random mission rewards`, { rewardManifests, rotations });
}
rewardManifests
.map(name => ExportRewards[name])
.forEach(table => {
for (const rotation of rotations) {
const rotationRewards = table[rotation];
const drop = getRandomRewardByChance(rotationRewards);
if (drop) {
drops.push({ StoreItem: drop.type, ItemCount: drop.itemCount });
}
rewardManifests.forEach(name => {
const table = ExportRewards[name];
if (!table) {
logger.error(`unknown droptable: ${name}`);
return;
}
for (const rotation of rotations) {
const rotationRewards = table[rotation];
const drop = getRandomRewardByChance(rotationRewards);
if (drop) {
drops.push({ StoreItem: drop.type, ItemCount: drop.itemCount });
}
});
}
});
if (region.cacheRewardManifest && RewardInfo.EnemyCachesFound) {
const deck = ExportRewards[region.cacheRewardManifest];