Skip to content

Commit

Permalink
Fixes Prestige rewards not persisting through Prestige
Browse files Browse the repository at this point in the history
Whenever we prestige we have to add all previous prestige rewards to the fresh profile, not only the current one.
Fixes #1090
  • Loading branch information
tetrisdev committed Jan 17, 2025
1 parent 743a78c commit d64cde2
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions project/src/controllers/PrestigeController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit d64cde2

Please sign in to comment.