From d64cde21bf8c7e1ab020046618e6535b3a425e34 Mon Sep 17 00:00:00 2001 From: TetrisGG Date: Fri, 17 Jan 2025 09:55:09 +0100 Subject: [PATCH] Fixes Prestige rewards not persisting through Prestige Whenever we prestige we have to add all previous prestige rewards to the fresh profile, not only the current one. Fixes #1090 --- project/src/controllers/PrestigeController.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/project/src/controllers/PrestigeController.ts b/project/src/controllers/PrestigeController.ts index 092ceabe..2af385d7 100644 --- a/project/src/controllers/PrestigeController.ts +++ b/project/src/controllers/PrestigeController.ts @@ -116,12 +116,16 @@ export class PrestigeController { const indexOfPrestigeObtained = Math.min(createRequest.sptForcePrestigeLevel - 1, 1); // Index starts at 0 // Assumes Prestige data is in descending order - const matchingPrestigeData = this.databaseService.getTemplates().prestige.elements[indexOfPrestigeObtained]; + const currentPrestigeData = this.databaseService.getTemplates().prestige.elements[indexOfPrestigeObtained]; + const prestigeRewards = this.databaseService + .getTemplates() + .prestige.elements.slice(0, indexOfPrestigeObtained + 1) + .flatMap((prestige) => prestige.rewards); - this.addPrestigeRewardsToProfile(sessionId, newProfile, matchingPrestigeData.rewards); + this.addPrestigeRewardsToProfile(sessionId, newProfile, prestigeRewards); // Flag profile as having achieved this prestige level - newProfile.characters.pmc.Prestige[matchingPrestigeData.id] = this.timeUtil.getTimestamp(); + newProfile.characters.pmc.Prestige[currentPrestigeData.id] = this.timeUtil.getTimestamp(); // Copy transferred items for (const transferRequest of request) {