Skip to content

Commit 6562d05

Browse files
author
Chomp
committed
Fixed configureZombies() incorrectly handling location ids
1 parent 016fc2a commit 6562d05

File tree

2 files changed

+25
-6
lines changed

2 files changed

+25
-6
lines changed

project/src/services/ProfileFixerService.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -287,17 +287,17 @@ export class ProfileFixerService {
287287
}
288288

289289
// For started or successful quests, check for unlocks in the `Started` rewards
290-
if (profileQuest.status == QuestStatus.Started || profileQuest.status == QuestStatus.Success) {
290+
if (profileQuest.status === QuestStatus.Started || profileQuest.status === QuestStatus.Success) {
291291
const productionRewards = quest.rewards.Started?.filter(
292-
(reward) => reward.type == QuestRewardType.PRODUCTIONS_SCHEME,
292+
(reward) => reward.type === QuestRewardType.PRODUCTIONS_SCHEME,
293293
);
294294
productionRewards?.forEach((reward) => this.verifyQuestProductionUnlock(pmcProfile, reward, quest));
295295
}
296296

297297
// For successful quests, check for unlocks in the `Success` rewards
298298
if (profileQuest.status == QuestStatus.Success) {
299299
const productionRewards = quest.rewards.Success?.filter(
300-
(reward) => reward.type == QuestRewardType.PRODUCTIONS_SCHEME,
300+
(reward) => reward.type === QuestRewardType.PRODUCTIONS_SCHEME,
301301
);
302302
productionRewards?.forEach((reward) => this.verifyQuestProductionUnlock(pmcProfile, reward, quest));
303303
}

project/src/services/SeasonalEventService.ts

+22-3
Original file line numberDiff line numberDiff line change
@@ -501,10 +501,29 @@ export class SeasonalEventService {
501501
this.databaseService.getLocation(locationId).base.waves = [];
502502
}
503503

504-
const activeMaps = Object.keys(zombieSettings.mapInfectionAmount).filter(
505-
(locationId) => zombieSettings.mapInfectionAmount[locationId] > 0,
504+
const locationsWithActiveInfection = this.getLocationsWithZombies(zombieSettings.mapInfectionAmount);
505+
this.addEventBossesToMaps("halloweenzombies", locationsWithActiveInfection);
506+
}
507+
508+
/**
509+
* Get location ids of maps with an infection above 0
510+
* @param locationInfections Dict of locations with their infection percentage
511+
* @returns Array of location ids
512+
*/
513+
protected getLocationsWithZombies(locationInfections: Record<string, number>): string[] {
514+
const result: string[] = [];
515+
516+
// Get only the locations with an infection above 0
517+
const infectionKeys = Object.keys(locationInfections).filter(
518+
(locationId) => locationInfections[locationId] > 0,
506519
);
507-
this.addEventBossesToMaps("halloweenzombies", activeMaps);
520+
521+
// Convert the infected location id into its generic location id
522+
for (const locationkey of infectionKeys) {
523+
result.push(...this.getLocationFromInfectedLocation(locationkey));
524+
}
525+
526+
return result;
508527
}
509528

510529
/**

0 commit comments

Comments
 (0)