Basic implementation for viewing other profiles

This commit is contained in:
Dev 2023-12-30 16:41:20 +00:00
parent 29995cccd8
commit a194569946
4 changed files with 48 additions and 3 deletions

View File

@ -8,6 +8,8 @@ import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullRespons
import { IGetMiniProfileRequestData } from "@spt-aki/models/eft/launcher/IGetMiniProfileRequestData"; import { IGetMiniProfileRequestData } from "@spt-aki/models/eft/launcher/IGetMiniProfileRequestData";
import { GetProfileStatusResponseData } from "@spt-aki/models/eft/profile/GetProfileStatusResponseData"; import { GetProfileStatusResponseData } from "@spt-aki/models/eft/profile/GetProfileStatusResponseData";
import { ICreateProfileResponse } from "@spt-aki/models/eft/profile/ICreateProfileResponse"; import { ICreateProfileResponse } from "@spt-aki/models/eft/profile/ICreateProfileResponse";
import { IGetOtherProfileRequest } from "@spt-aki/models/eft/profile/IGetOtherProfileRequest";
import { IGetOtherProfileResponse } from "@spt-aki/models/eft/profile/IGetOtherProfileResponse";
import { IGetProfileSettingsRequest } from "@spt-aki/models/eft/profile/IGetProfileSettingsRequest"; import { IGetProfileSettingsRequest } from "@spt-aki/models/eft/profile/IGetProfileSettingsRequest";
import { IProfileChangeNicknameRequestData } from "@spt-aki/models/eft/profile/IProfileChangeNicknameRequestData"; import { IProfileChangeNicknameRequestData } from "@spt-aki/models/eft/profile/IProfileChangeNicknameRequestData";
import { IProfileChangeVoiceRequestData } from "@spt-aki/models/eft/profile/IProfileChangeVoiceRequestData"; import { IProfileChangeVoiceRequestData } from "@spt-aki/models/eft/profile/IProfileChangeVoiceRequestData";
@ -147,11 +149,11 @@ export class ProfileCallbacks
*/ */
public getOtherProfile( public getOtherProfile(
url: string, url: string,
info: IEmptyRequestData, request: IGetOtherProfileRequest,
sessionID: string, sessionID: string,
): any ): IGetBodyResponseData<IGetOtherProfileResponse>
{ {
throw new Error("Not implemented"); return this.httpResponse.getBody(this.profileController.getOtherProfile(sessionID, request));
} }
/** /**

View File

@ -13,6 +13,8 @@ import { IMiniProfile } from "@spt-aki/models/eft/launcher/IMiniProfile";
import { GetProfileStatusResponseData } from "@spt-aki/models/eft/profile/GetProfileStatusResponseData"; import { GetProfileStatusResponseData } from "@spt-aki/models/eft/profile/GetProfileStatusResponseData";
import { IAkiProfile, Inraid, Vitality } from "@spt-aki/models/eft/profile/IAkiProfile"; import { IAkiProfile, Inraid, Vitality } from "@spt-aki/models/eft/profile/IAkiProfile";
import { ICompletedAchievementsResponse } from "@spt-aki/models/eft/profile/ICompletedAchievementsResponse"; import { ICompletedAchievementsResponse } from "@spt-aki/models/eft/profile/ICompletedAchievementsResponse";
import { IGetOtherProfileRequest } from "@spt-aki/models/eft/profile/IGetOtherProfileRequest";
import { IGetOtherProfileResponse } from "@spt-aki/models/eft/profile/IGetOtherProfileResponse";
import { IProfileChangeNicknameRequestData } from "@spt-aki/models/eft/profile/IProfileChangeNicknameRequestData"; import { IProfileChangeNicknameRequestData } from "@spt-aki/models/eft/profile/IProfileChangeNicknameRequestData";
import { IProfileChangeVoiceRequestData } from "@spt-aki/models/eft/profile/IProfileChangeVoiceRequestData"; import { IProfileChangeVoiceRequestData } from "@spt-aki/models/eft/profile/IProfileChangeVoiceRequestData";
import { IProfileCreateRequestData } from "@spt-aki/models/eft/profile/IProfileCreateRequestData"; import { IProfileCreateRequestData } from "@spt-aki/models/eft/profile/IProfileCreateRequestData";
@ -394,4 +396,24 @@ export class ProfileController
return {elements: profile.achievements}; return {elements: profile.achievements};
} }
public getOtherProfile(sessionId: string, request: IGetOtherProfileRequest): IGetOtherProfileResponse
{
const player = this.profileHelper.getFullProfile(sessionId);
const playerPmc = player.characters.pmc;
// return player for now
return {
id: playerPmc._id,
aid: playerPmc.aid,
info: playerPmc.Info,
customization: playerPmc.Customization,
skills: playerPmc.Skills,
equipment: playerPmc.Inventory,
achievements: playerPmc.Achievements,
favoriteItems: playerPmc.Inventory.favoriteItems,
pmcStats: playerPmc.Stats,
scavStats: player.characters.scav.Stats
};
}
} }

View File

@ -0,0 +1,4 @@
export interface IGetOtherProfileRequest
{
accountId: string;
}

View File

@ -0,0 +1,17 @@
import { Customization, Inventory, Skills, Stats } from "@spt-aki/models/eft/common/tables/IBotBase"
import { Info } from "types/models/eft/common/tables/IBotBase"
export interface IGetOtherProfileResponse
{
id: string
aid: number
info: Info
customization: Customization
skills: Skills
equipment: Inventory
achievements: Record<string, number>
favoriteItems: string[]
pmcStats: Stats
scavStats: Stats
}