Removed unnecessary use of ProfileSnapshotService

This commit is contained in:
Dev 2024-10-01 10:57:59 +01:00
parent 9b3d18ded5
commit 6301411a86
2 changed files with 0 additions and 48 deletions

View File

@ -16,7 +16,6 @@ import { ConfigServer } from "@spt/servers/ConfigServer";
import { SaveServer } from "@spt/servers/SaveServer"; import { SaveServer } from "@spt/servers/SaveServer";
import { LocationLifecycleService } from "@spt/services/LocationLifecycleService"; import { LocationLifecycleService } from "@spt/services/LocationLifecycleService";
import { MatchLocationService } from "@spt/services/MatchLocationService"; import { MatchLocationService } from "@spt/services/MatchLocationService";
import { ProfileSnapshotService } from "@spt/services/ProfileSnapshotService";
import { ICloner } from "@spt/utils/cloners/ICloner"; import { ICloner } from "@spt/utils/cloners/ICloner";
import { inject, injectable } from "tsyringe"; import { inject, injectable } from "tsyringe";
@ -30,7 +29,6 @@ export class MatchController {
@inject("SaveServer") protected saveServer: SaveServer, @inject("SaveServer") protected saveServer: SaveServer,
@inject("MatchLocationService") protected matchLocationService: MatchLocationService, @inject("MatchLocationService") protected matchLocationService: MatchLocationService,
@inject("ConfigServer") protected configServer: ConfigServer, @inject("ConfigServer") protected configServer: ConfigServer,
@inject("ProfileSnapshotService") protected profileSnapshotService: ProfileSnapshotService,
@inject("ApplicationContext") protected applicationContext: ApplicationContext, @inject("ApplicationContext") protected applicationContext: ApplicationContext,
@inject("LocationLifecycleService") protected locationLifecycleService: LocationLifecycleService, @inject("LocationLifecycleService") protected locationLifecycleService: LocationLifecycleService,
@inject("PrimaryCloner") protected cloner: ICloner, @inject("PrimaryCloner") protected cloner: ICloner,
@ -96,7 +94,6 @@ export class MatchController {
// Store the profile as-is for later use on the post-raid exp screen // Store the profile as-is for later use on the post-raid exp screen
const currentProfile = this.saveServer.getProfile(sessionID); const currentProfile = this.saveServer.getProfile(sessionID);
this.profileSnapshotService.storeProfileSnapshot(sessionID, currentProfile);
} }
/** /**

View File

@ -14,7 +14,6 @@ import { ConfigServer } from "@spt/servers/ConfigServer";
import { SaveServer } from "@spt/servers/SaveServer"; import { SaveServer } from "@spt/servers/SaveServer";
import { DatabaseService } from "@spt/services/DatabaseService"; import { DatabaseService } from "@spt/services/DatabaseService";
import { LocalisationService } from "@spt/services/LocalisationService"; import { LocalisationService } from "@spt/services/LocalisationService";
import { ProfileSnapshotService } from "@spt/services/ProfileSnapshotService";
import { HashUtil } from "@spt/utils/HashUtil"; import { HashUtil } from "@spt/utils/HashUtil";
import { TimeUtil } from "@spt/utils/TimeUtil"; import { TimeUtil } from "@spt/utils/TimeUtil";
import { Watermark } from "@spt/utils/Watermark"; import { Watermark } from "@spt/utils/Watermark";
@ -33,7 +32,6 @@ export class ProfileHelper {
@inject("SaveServer") protected saveServer: SaveServer, @inject("SaveServer") protected saveServer: SaveServer,
@inject("DatabaseService") protected databaseService: DatabaseService, @inject("DatabaseService") protected databaseService: DatabaseService,
@inject("ItemHelper") protected itemHelper: ItemHelper, @inject("ItemHelper") protected itemHelper: ItemHelper,
@inject("ProfileSnapshotService") protected profileSnapshotService: ProfileSnapshotService,
@inject("LocalisationService") protected localisationService: LocalisationService, @inject("LocalisationService") protected localisationService: LocalisationService,
@inject("ConfigServer") protected configServer: ConfigServer, @inject("ConfigServer") protected configServer: ConfigServer,
@inject("PrimaryCloner") protected cloner: ICloner, @inject("PrimaryCloner") protected cloner: ICloner,
@ -85,16 +83,6 @@ export class ProfileHelper {
// Sanitize any data the client can not receive // Sanitize any data the client can not receive
this.sanitizeProfileForClient(fullProfileClone); this.sanitizeProfileForClient(fullProfileClone);
// Edge-case, true post raid
if (this.profileSnapshotService.hasProfileSnapshot(sessionId)) {
return this.postRaidXpWorkaroundFix(
sessionId,
fullProfileClone.characters.pmc,
fullProfileClone.characters.scav,
output,
);
}
// PMC must be at array index 0, scav at 1 // PMC must be at array index 0, scav at 1
output.push(fullProfileClone.characters.pmc); output.push(fullProfileClone.characters.pmc);
output.push(fullProfileClone.characters.scav); output.push(fullProfileClone.characters.scav);
@ -102,39 +90,6 @@ export class ProfileHelper {
return output; return output;
} }
/**
* Fix xp doubling on post-raid xp reward screen by sending a 'dummy' profile to the post-raid screen
* Server saves the post-raid changes prior to the xp screen getting the profile, this results in the xp screen using
* the now updated profile values as a base, meaning it shows x2 xp gained
* Instead, clone the post-raid profile (so we dont alter its values), apply the pre-raid xp values to the cloned objects and return
* Delete snapshot of pre-raid profile prior to returning profile data
* @param sessionId Session id
* @param output pmc and scav profiles array
* @param pmcProfile post-raid pmc profile
* @param scavProfile post-raid scav profile
* @returns Updated profile array
*/
protected postRaidXpWorkaroundFix(
sessionId: string,
clonedPmc: IPmcData,
clonedScav: IPmcData,
output: IPmcData[],
): IPmcData[] {
const profileSnapshot = this.profileSnapshotService.getProfileSnapshot(sessionId);
clonedPmc.Info.Level = profileSnapshot.characters.pmc.Info.Level;
clonedPmc.Info.Experience = profileSnapshot.characters.pmc.Info.Experience;
clonedScav.Info.Level = profileSnapshot.characters.scav.Info.Level;
clonedScav.Info.Experience = profileSnapshot.characters.scav.Info.Experience;
this.profileSnapshotService.clearProfileSnapshot(sessionId);
output.push(clonedPmc);
output.push(clonedScav);
return output;
}
/** /**
* Sanitize any information from the profile that the client does not expect to receive * Sanitize any information from the profile that the client does not expect to receive
* @param clonedProfile A clone of the full player profile * @param clonedProfile A clone of the full player profile