From 6930267d8bc1be601c2c342b4dc39dd4cc3fd64b Mon Sep 17 00:00:00 2001 From: Dev Date: Wed, 20 Dec 2023 00:17:27 +0000 Subject: [PATCH] Add various missing types --- project/src/callbacks/MatchCallbacks.ts | 4 ++- project/src/callbacks/ProfileCallbacks.ts | 8 +++--- project/src/controllers/MatchController.ts | 3 ++- project/src/controllers/ProfileController.ts | 7 +++++- .../models/eft/game/ICurrentGroupResponse.ts | 2 +- .../eft/match/IGetGroupStatusResponse.ts | 25 +++++++++++++++++++ .../eft/profile/ICreateProfileResponse.ts | 4 +++ 7 files changed, 46 insertions(+), 7 deletions(-) create mode 100644 project/src/models/eft/match/IGetGroupStatusResponse.ts create mode 100644 project/src/models/eft/profile/ICreateProfileResponse.ts diff --git a/project/src/callbacks/MatchCallbacks.ts b/project/src/callbacks/MatchCallbacks.ts index 7fa0af09..70e6de33 100644 --- a/project/src/callbacks/MatchCallbacks.ts +++ b/project/src/callbacks/MatchCallbacks.ts @@ -11,6 +11,7 @@ import { ICancelGroupInviteRequest } from "@spt-aki/models/eft/match/ICancelGrou import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData"; import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData"; +import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse"; import { IGetProfileRequestData } from "@spt-aki/models/eft/match/IGetProfileRequestData"; import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData"; import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData"; @@ -159,12 +160,13 @@ export class MatchCallbacks * @returns */ // eslint-disable-next-line @typescript-eslint/no-unused-vars - public getGroupStatus(url: string, info: IGetGroupStatusRequestData, sessionID: string): IGetBodyResponseData + public getGroupStatus(url: string, info: IGetGroupStatusRequestData, sessionID: string): IGetBodyResponseData { return this.httpResponse.getBody(this.matchController.getGroupStatus(info)); } /** Handle client/match/group/create */ + // TODO: may have been removed from client public createGroup(url: string, info: ICreateGroupRequestData, sessionID: string): IGetBodyResponseData { return this.httpResponse.getBody(this.matchController.createGroup(sessionID, info)); diff --git a/project/src/callbacks/ProfileCallbacks.ts b/project/src/callbacks/ProfileCallbacks.ts index eec0519c..82de7627 100644 --- a/project/src/callbacks/ProfileCallbacks.ts +++ b/project/src/callbacks/ProfileCallbacks.ts @@ -7,6 +7,7 @@ import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyR import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; import { IGetMiniProfileRequestData } from "@spt-aki/models/eft/launcher/IGetMiniProfileRequestData"; import { GetProfileStatusResponseData } from "@spt-aki/models/eft/profile/GetProfileStatusResponseData"; +import { ICreateProfileResponse } from "@spt-aki/models/eft/profile/ICreateProfileResponse"; import { IGetProfileSettingsRequest } from "@spt-aki/models/eft/profile/IGetProfileSettingsRequest"; import { IProfileChangeNicknameRequestData } from "@spt-aki/models/eft/profile/IProfileChangeNicknameRequestData"; import { IProfileChangeVoiceRequestData } from "@spt-aki/models/eft/profile/IProfileChangeVoiceRequestData"; @@ -31,10 +32,11 @@ export class ProfileCallbacks /** * Handle client/game/profile/create */ - public createProfile(url: string, info: IProfileCreateRequestData, sessionID: string): IGetBodyResponseData + public createProfile(url: string, info: IProfileCreateRequestData, sessionID: string): IGetBodyResponseData { - this.profileController.createProfile(info, sessionID); - return this.httpResponse.getBody({ uid: `pmc${sessionID}` }); + const id = this.profileController.createProfile(info, sessionID); + + return this.httpResponse.getBody({ uid: id }); } /** diff --git a/project/src/controllers/MatchController.ts b/project/src/controllers/MatchController.ts index 7b3bd2f0..10f2d544 100644 --- a/project/src/controllers/MatchController.ts +++ b/project/src/controllers/MatchController.ts @@ -10,6 +10,7 @@ import { Item } from "@spt-aki/models/eft/common/tables/IItem"; import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData"; import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData"; +import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse"; import { IGetProfileRequestData } from "@spt-aki/models/eft/match/IGetProfileRequestData"; import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData"; import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData"; @@ -126,7 +127,7 @@ export class MatchController /** Handle client/match/group/status */ // eslint-disable-next-line @typescript-eslint/no-unused-vars - public getGroupStatus(info: IGetGroupStatusRequestData): any + public getGroupStatus(info: IGetGroupStatusRequestData): IGetGroupStatusResponse { return { players: [], maxPveCountExceeded: false }; } diff --git a/project/src/controllers/ProfileController.ts b/project/src/controllers/ProfileController.ts index c9307bda..b2975fd0 100644 --- a/project/src/controllers/ProfileController.ts +++ b/project/src/controllers/ProfileController.ts @@ -118,8 +118,11 @@ export class ProfileController /** * Handle client/game/profile/create + * @param info Client reqeust object + * @param sessionID Player id + * @returns Profiles _id value */ - public createProfile(info: IProfileCreateRequestData, sessionID: string): void + public createProfile(info: IProfileCreateRequestData, sessionID: string): string { const account = this.saveServer.getProfile(sessionID).info; const profile: TemplateSide = @@ -212,6 +215,8 @@ export class ProfileController // Completed account creation this.saveServer.getProfile(sessionID).info.wipe = false; this.saveServer.saveProfile(sessionID); + + return pmcData._id; } /** diff --git a/project/src/models/eft/game/ICurrentGroupResponse.ts b/project/src/models/eft/game/ICurrentGroupResponse.ts index 3b39739e..3100bb95 100644 --- a/project/src/models/eft/game/ICurrentGroupResponse.ts +++ b/project/src/models/eft/game/ICurrentGroupResponse.ts @@ -2,7 +2,7 @@ import { MemberCategory } from "@spt-aki/models/enums/MemberCategory"; export interface ICurrentGroupResponse { - squad: any[]; + squad: ICurrentGroupSquadMember[]; } export interface ICurrentGroupSquadMember diff --git a/project/src/models/eft/match/IGetGroupStatusResponse.ts b/project/src/models/eft/match/IGetGroupStatusResponse.ts new file mode 100644 index 00000000..bafb44f7 --- /dev/null +++ b/project/src/models/eft/match/IGetGroupStatusResponse.ts @@ -0,0 +1,25 @@ +import { MemberCategory } from "@spt-aki/models/enums/MemberCategory" + +export interface IGetGroupStatusResponse +{ + players: IPlayer[] + maxPveCountExceeded: boolean +} + +export interface IPlayer +{ + aid: string + _id: string + lookingGroup: boolean + IsLeader: boolean + IsReady: boolean + Info: ICurrentGroupMemberInfo +} + +export interface ICurrentGroupMemberInfo +{ + Nickname: string; + Side: string; + Level: string; + MemberCategory: MemberCategory; +} \ No newline at end of file diff --git a/project/src/models/eft/profile/ICreateProfileResponse.ts b/project/src/models/eft/profile/ICreateProfileResponse.ts new file mode 100644 index 00000000..c1fb76b9 --- /dev/null +++ b/project/src/models/eft/profile/ICreateProfileResponse.ts @@ -0,0 +1,4 @@ +export interface ICreateProfileResponse +{ + uid: string +} \ No newline at end of file