Skip to content

Commit

Permalink
Improved obtainPrestige
Browse files Browse the repository at this point in the history
  • Loading branch information
Chomp committed Feb 3, 2025
1 parent c44e90b commit 99dcade
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 13 deletions.
39 changes: 29 additions & 10 deletions project/src/controllers/PrestigeController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,22 @@ export class PrestigeController {
* Handle /client/prestige/obtain
*/
public async obtainPrestige(sessionId: string, request: IObtainPrestigeRequest[]): Promise<void> {
// Going to prestige 1

// transfer
// 5% of skills should be transfered over
// 5% of mastering should be transfered over
// earned achievements should be transfered over
// profile stats should be transfered over
// prestige progress should be transfered over

// reset
// trader standing
// task progress
// character level
// stash
// hideout progress

const prePrestigeProfileClone = this.cloner.clone(this.profileHelper.getFullProfile(sessionId));
const prePrestigePmc = prePrestigeProfileClone.characters.pmc;
const createRequest: IProfileCreateRequestData = {
Expand All @@ -88,11 +104,10 @@ export class PrestigeController {
}

// Skill copy
// TODO - Find what skills should be prestiged over
const commonSKillsToCopy = prePrestigePmc.Skills.Common;
for (const skillToCopy of commonSKillsToCopy) {
// Set progress to max level 20
skillToCopy.Progress = Math.min(skillToCopy.Progress, 2000);
// Set progress 5% of what it was
skillToCopy.Progress = skillToCopy.Progress * 0.05;
const existingSkill = newProfile.characters.pmc.Skills.Common.find((skill) => skill.Id === skillToCopy.Id);
if (existingSkill) {
existingSkill.Progress = skillToCopy.Progress;
Expand All @@ -103,8 +118,8 @@ export class PrestigeController {

const masteringSkillsToCopy = prePrestigePmc.Skills.Mastering;
for (const skillToCopy of masteringSkillsToCopy) {
// Set progress to max level 20
skillToCopy.Progress = Math.min(skillToCopy.Progress, 2000);
// Set progress 5% of what it was
skillToCopy.Progress = skillToCopy.Progress * 0.05;
const existingSkill = newProfile.characters.pmc.Skills.Mastering.find(
(skill) => skill.Id === skillToCopy.Id,
);
Expand All @@ -116,6 +131,15 @@ export class PrestigeController {
}

const indexOfPrestigeObtained = Math.min(createRequest.sptForcePrestigeLevel - 1, 1); // Index starts at 0

// Add existing completed achievements and new one for prestige
newProfile.characters.pmc.Achievements = prePrestigeProfileClone.characters.pmc.Achievements; // this *should* only contain completed ones

// Add "Prestigious" achievement
if (!newProfile.characters.pmc.Achievements["676091c0f457869a94017a23"]) {
newProfile.characters.pmc.Achievements["676091c0f457869a94017a23"] = this.timeUtil.getTimestamp();
}

// Assumes Prestige data is in descending order
const currentPrestigeData = this.databaseService.getTemplates().prestige.elements[indexOfPrestigeObtained];
const prestigeRewards = this.databaseService
Expand Down Expand Up @@ -151,11 +175,6 @@ export class PrestigeController {
);
}

// Add "Prestigious" achievement
if (!newProfile.achievements["676091c0f457869a94017a23"]) {
newProfile.achievements["676091c0f457869a94017a23"] = this.timeUtil.getTimestamp();
}

// Force save of above changes to disk
await this.saveServer.saveProfile(sessionId);
}
Expand Down
2 changes: 0 additions & 2 deletions project/src/models/eft/profile/ISptProfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ export interface ISptProfile {
insurance: IInsurance[];
/** Assort purchases made by player since last trader refresh */
traderPurchases?: Record<string, Record<string, ITraderPurchaseData>>;
/** Achievements earned by player */
achievements: Record<string, number>;
/** List of friend profile IDs */
friends: string[];
customisationUnlocks: ICustomisationStorage[];
Expand Down
1 change: 0 additions & 1 deletion project/src/services/CreateProfileService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ export class CreateProfileService {
inraid: {} as IInraid,
insurance: [],
traderPurchases: {},
achievements: {},
friends: [],
customisationUnlocks: [],
};
Expand Down

0 comments on commit 99dcade

Please sign in to comment.