diff --git a/project/src/callbacks/DialogueCallbacks.ts b/project/src/callbacks/DialogueCallbacks.ts index aef83abf..5b0e620b 100644 --- a/project/src/callbacks/DialogueCallbacks.ts +++ b/project/src/callbacks/DialogueCallbacks.ts @@ -6,6 +6,7 @@ import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData" import { IAcceptFriendRequestData, ICancelFriendRequestData, + IDeclineFriendRequestData, } from "@spt-aki/models/eft/dialog/IAcceptFriendRequestData"; import { IChatServer } from "@spt-aki/models/eft/dialog/IChatServer"; import { IClearMailMessageRequest } from "@spt-aki/models/eft/dialog/IClearMailMessageRequest"; @@ -186,7 +187,16 @@ export class DialogueCallbacks implements OnUpdate sessionID: string, ): IGetBodyResponseData { - return this.httpResponse.getBody({ status: 0, requestid: "12345", retryAfter: 600 }); + return this.httpResponse.getBody({ status: 0, requestId: "12345", retryAfter: 600 }); + } + + /** + * Handle client/friend/request/accept-all + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + public acceptAllFriendRequests(url: string, request: IEmptyRequestData, sessionID: string): INullResponseData + { + return this.httpResponse.nullResponse(); } /** @@ -202,6 +212,19 @@ export class DialogueCallbacks implements OnUpdate return this.httpResponse.getBody(true); } + /** + * Handle client/friend/request/decline + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + public declineFriendRequest( + url: string, + request: IDeclineFriendRequestData, + sessionID: string, + ): IGetBodyResponseData + { + return this.httpResponse.getBody(true); + } + /** * Handle client/friend/request/cancel */ diff --git a/project/src/controllers/ProfileController.ts b/project/src/controllers/ProfileController.ts index bed75009..4d225831 100644 --- a/project/src/controllers/ProfileController.ts +++ b/project/src/controllers/ProfileController.ts @@ -394,7 +394,19 @@ export class ProfileController */ public getFriends(info: ISearchFriendRequestData, sessionID: string): ISearchFriendResponse[] { - return [{ _id: this.hashUtil.generate(), Info: { Level: 1, Side: "Bear", Nickname: info.nickname } }]; + const profile = this.saveServer.getProfile(sessionID); + + // return some of the current player info for now + return [{ + _id: profile.characters.pmc._id, + aid: profile.characters.pmc.aid, + Info: { + Nickname: info.nickname, + Side: "Bear", + Level: 1, + MemberCategory: profile.characters.pmc.Info.MemberCategory, + }, + }]; } /** @@ -422,6 +434,7 @@ export class ProfileController { const player = this.profileHelper.getFullProfile(sessionId); const playerPmc = player.characters.pmc; + const playerScav = player.characters.scav; // return player for now return { @@ -458,8 +471,8 @@ export class ProfileController }, scavStats: { eft: { - totalInGameTime: player.characters.scav.Stats.Eft.TotalInGameTime, - overAllCounters: player.characters.scav.Stats.Eft.OverallCounters, + totalInGameTime: playerScav.Stats.Eft.TotalInGameTime, + overAllCounters: playerScav.Stats.Eft.OverallCounters, }, }, }; diff --git a/project/src/models/eft/dialog/IAcceptFriendRequestData.ts b/project/src/models/eft/dialog/IAcceptFriendRequestData.ts index d12bd838..c55826ad 100644 --- a/project/src/models/eft/dialog/IAcceptFriendRequestData.ts +++ b/project/src/models/eft/dialog/IAcceptFriendRequestData.ts @@ -6,7 +6,11 @@ export interface ICancelFriendRequestData extends IBaseFriendRequest { } +export interface IDeclineFriendRequestData extends IBaseFriendRequest +{ +} + export interface IBaseFriendRequest { - request_id: string; + profileId: string; } diff --git a/project/src/models/eft/dialog/IFriendRequestSendResponse.ts b/project/src/models/eft/dialog/IFriendRequestSendResponse.ts index d83579bb..dee3ea8d 100644 --- a/project/src/models/eft/dialog/IFriendRequestSendResponse.ts +++ b/project/src/models/eft/dialog/IFriendRequestSendResponse.ts @@ -1,6 +1,6 @@ export interface IFriendRequestSendResponse { status: number; - requestid: string; + requestId: string; retryAfter: number; } diff --git a/project/src/models/eft/profile/IGetOtherProfileResponse.ts b/project/src/models/eft/profile/IGetOtherProfileResponse.ts index d6d6e826..50d7c975 100644 --- a/project/src/models/eft/profile/IGetOtherProfileResponse.ts +++ b/project/src/models/eft/profile/IGetOtherProfileResponse.ts @@ -1,5 +1,5 @@ import { OverallCounters, Skills } from "@spt-aki/models/eft/common/tables/IBotBase"; -import { Item } from "../common/tables/IItem"; +import { Item } from "@spt-aki/models/eft/common/tables/IItem"; export interface IGetOtherProfileResponse { diff --git a/project/src/models/eft/profile/ISearchFriendResponse.ts b/project/src/models/eft/profile/ISearchFriendResponse.ts index dfb1676a..a345c280 100644 --- a/project/src/models/eft/profile/ISearchFriendResponse.ts +++ b/project/src/models/eft/profile/ISearchFriendResponse.ts @@ -1,6 +1,7 @@ export interface ISearchFriendResponse { _id: string; + aid: number; Info: Info; } @@ -9,4 +10,5 @@ export interface Info Nickname: string; Side: string; Level: number; + MemberCategory: number; } diff --git a/project/src/routers/static/DialogStaticRouter.ts b/project/src/routers/static/DialogStaticRouter.ts index a22acc6d..61ef74c9 100644 --- a/project/src/routers/static/DialogStaticRouter.ts +++ b/project/src/routers/static/DialogStaticRouter.ts @@ -115,6 +115,13 @@ export class DialogStaticRouter extends StaticRouter return this.dialogueCallbacks.sendFriendRequest(url, info, sessionID); }, ), + new RouteAction( + "/client/friend/request/accept-all", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.dialogueCallbacks.acceptAllFriendRequests(url, info, sessionID); + }, + ), new RouteAction( "/client/friend/request/accept", (url: string, info: any, sessionID: string, output: string): any => @@ -122,6 +129,13 @@ export class DialogStaticRouter extends StaticRouter return this.dialogueCallbacks.acceptFriendRequest(url, info, sessionID); }, ), + new RouteAction( + "/client/friend/request/decline", + (url: string, info: any, sessionID: string, output: string): any => + { + return this.dialogueCallbacks.declineFriendRequest(url, info, sessionID); + }, + ), new RouteAction( "/client/friend/request/cancel", (url: string, info: any, sessionID: string, output: string): any =>