From 2fea0d17defecbe17ee60966d4df43aa3f3fc444 Mon Sep 17 00:00:00 2001 From: Dev Date: Sat, 8 Jun 2024 09:15:59 +0100 Subject: [PATCH] Fixed altering `SelectedMemberCategory` in settings page not saving --- project/src/callbacks/ProfileCallbacks.ts | 1 + project/src/controllers/ProfileController.ts | 15 +++++++++++++++ .../eft/profile/IGetProfileSettingsRequest.ts | 2 ++ 3 files changed, 18 insertions(+) diff --git a/project/src/callbacks/ProfileCallbacks.ts b/project/src/callbacks/ProfileCallbacks.ts index c009abfb..bb021f34 100644 --- a/project/src/callbacks/ProfileCallbacks.ts +++ b/project/src/callbacks/ProfileCallbacks.ts @@ -169,6 +169,7 @@ export class ProfileCallbacks sessionId: string, ): IGetBodyResponseData { + this.profileController.setChosenProfileIcon(sessionId, info); return this.httpResponse.emptyResponse(); } diff --git a/project/src/controllers/ProfileController.ts b/project/src/controllers/ProfileController.ts index 9123bf2d..c8351e76 100644 --- a/project/src/controllers/ProfileController.ts +++ b/project/src/controllers/ProfileController.ts @@ -12,6 +12,7 @@ import { IMiniProfile } from "@spt/models/eft/launcher/IMiniProfile"; import { GetProfileStatusResponseData } from "@spt/models/eft/profile/GetProfileStatusResponseData"; import { IGetOtherProfileRequest } from "@spt/models/eft/profile/IGetOtherProfileRequest"; import { IGetOtherProfileResponse } from "@spt/models/eft/profile/IGetOtherProfileResponse"; +import { IGetProfileSettingsRequest } from "@spt/models/eft/profile/IGetProfileSettingsRequest"; import { IProfileChangeNicknameRequestData } from "@spt/models/eft/profile/IProfileChangeNicknameRequestData"; import { IProfileChangeVoiceRequestData } from "@spt/models/eft/profile/IProfileChangeVoiceRequestData"; import { IProfileCreateRequestData } from "@spt/models/eft/profile/IProfileCreateRequestData"; @@ -485,4 +486,18 @@ export class ProfileController }, }; } + + /** + * Handle client/profile/settings + */ + public setChosenProfileIcon(sessionId: string, request: IGetProfileSettingsRequest): void + { + const profileToUpdate = this.profileHelper.getPmcProfile(sessionId); + if (!profileToUpdate) + { + return; + } + + profileToUpdate.Info.SelectedMemberCategory = request.memberCategory; + } } diff --git a/project/src/models/eft/profile/IGetProfileSettingsRequest.ts b/project/src/models/eft/profile/IGetProfileSettingsRequest.ts index b029776d..892f24b3 100644 --- a/project/src/models/eft/profile/IGetProfileSettingsRequest.ts +++ b/project/src/models/eft/profile/IGetProfileSettingsRequest.ts @@ -1,4 +1,6 @@ export interface IGetProfileSettingsRequest { + /** Chosen value for profile.Info.SelectedMemberCategory */ + memberCategory: number squadInviteRestriction: boolean }