diff --git a/project/src/callbacks/DialogueCallbacks.ts b/project/src/callbacks/DialogueCallbacks.ts index a24afde5..ba81f431 100644 --- a/project/src/callbacks/DialogueCallbacks.ts +++ b/project/src/callbacks/DialogueCallbacks.ts @@ -32,6 +32,7 @@ import { DialogueInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; +import { ICreateGroupMailRequest } from "@spt-aki/models/eft/dialog/ICreateGroupMailRequest"; @injectable() export class DialogueCallbacks implements OnUpdate @@ -187,7 +188,7 @@ export class DialogueCallbacks implements OnUpdate sessionID: string, ): IGetBodyResponseData { - return this.httpResponse.getBody({ status: 0, requestId: "12345", retryAfter: 600 }); + return this.httpResponse.getBody(this.dialogueController.sendFriendRequest(sessionID, request)); } /** @@ -271,6 +272,15 @@ export class DialogueCallbacks implements OnUpdate return this.httpResponse.emptyArrayResponse(); } + public createGroupMail( + url: string, + info: ICreateGroupMailRequest, + sessionID: string + ): IGetBodyResponseData + { + throw new Error("Method not implemented."); + } + // eslint-disable-next-line @typescript-eslint/no-unused-vars public async onUpdate(timeSinceLastRun: number): Promise { diff --git a/project/src/callbacks/MatchCallbacks.ts b/project/src/callbacks/MatchCallbacks.ts index 8016b5d2..9f2f4413 100644 --- a/project/src/callbacks/MatchCallbacks.ts +++ b/project/src/callbacks/MatchCallbacks.ts @@ -1,18 +1,15 @@ import { inject, injectable } from "tsyringe"; import { MatchController } from "@spt-aki/controllers/MatchController"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; -import { IPmcData } from "@spt-aki/models/eft/common/IPmcData"; import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; import { IAcceptGroupInviteRequest } from "@spt-aki/models/eft/match/IAcceptGroupInviteRequest"; import { IAcceptGroupInviteResponse } from "@spt-aki/models/eft/match/IAcceptGroupInviteResponse"; import { ICancelGroupInviteRequest } from "@spt-aki/models/eft/match/ICancelGroupInviteRequest"; -import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData"; import { IDeclineGroupInviteRequest } from "@spt-aki/models/eft/match/IDeclineGroupInviteRequest"; 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"; import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult"; @@ -24,10 +21,12 @@ import { IUpdatePingRequestData } from "@spt-aki/models/eft/match/IUpdatePingReq import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; +import { IGroupCurrentResponse } from "@spt-aki/models/eft/match/IGroupCurrentResponse"; @injectable() export class MatchCallbacks { + constructor( @inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil, @inject("JsonUtil") protected jsonUtil: JsonUtil, @@ -57,6 +56,15 @@ export class MatchCallbacks return this.httpResponse.nullResponse(); } + public groupCurrent( + url: string, + info: IEmptyRequestData, + sessionID: string + ): IGetBodyResponseData + { + throw new Error("Method not implemented."); + } + // eslint-disable-next-line @typescript-eslint/no-unused-vars public startGroupSearch(url: string, info: IEmptyRequestData, sessionID: string): INullResponseData { @@ -81,7 +89,7 @@ export class MatchCallbacks public acceptGroupInvite( url: string, info: IAcceptGroupInviteRequest, - sessionID: string, + sessionId: string, ): IGetBodyResponseData { const result = []; @@ -95,10 +103,10 @@ export class MatchCallbacks public declineGroupInvite( url: string, info: IDeclineGroupInviteRequest, - sessionID: string, - ): IGetBodyResponseData + sessionId: string, + ): IGetBodyResponseData { - return null; + return this.httpResponse.getBody(true); } /** Handle client/match/group/invite/cancel */ @@ -114,28 +122,36 @@ export class MatchCallbacks /** Handle client/match/group/transfer */ // eslint-disable-next-line @typescript-eslint/no-unused-vars - public transferGroup(url: string, info: ITransferGroupRequest, sessionID: string): IGetBodyResponseData + public transferGroup( + url: string, + info: ITransferGroupRequest, + sessionId: string + ): IGetBodyResponseData { return this.httpResponse.getBody(true); } /** Handle client/match/group/invite/cancel-all */ // eslint-disable-next-line @typescript-eslint/no-unused-vars - public cancelAllGroupInvite(url: string, info: IEmptyRequestData, sessionID: string): INullResponseData + public cancelAllGroupInvite( + url: string, + info: IEmptyRequestData, + sessionId: string + ): IGetBodyResponseData { - return this.httpResponse.nullResponse(); + return this.httpResponse.getBody(true); } /** @deprecated - not called on raid start/end or game start/exit */ // eslint-disable-next-line @typescript-eslint/no-unused-vars - public putMetrics(url: string, info: IPutMetricsRequestData, sessionID: string): INullResponseData + public putMetrics(url: string, info: IPutMetricsRequestData, sessionId: string): INullResponseData { return this.httpResponse.nullResponse(); } // Handle client/match/available // eslint-disable-next-line @typescript-eslint/no-unused-vars - public serverAvailable(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData + public serverAvailable(url: string, info: IEmptyRequestData, sessionId: string): IGetBodyResponseData { const output = this.matchController.getEnabled(); @@ -176,10 +192,10 @@ export class MatchCallbacks /** Handle client/match/group/delete */ // eslint-disable-next-line @typescript-eslint/no-unused-vars - public deleteGroup(url: string, info: any, sessionID: string): INullResponseData + public deleteGroup(url: string, info: any, sessionID: string): IGetBodyResponseData { this.matchController.deleteGroup(info); - return this.httpResponse.nullResponse(); + return this.httpResponse.getBody(true); } // Handle client/match/group/leave @@ -191,9 +207,9 @@ export class MatchCallbacks /** Handle client/match/group/player/remove */ // eslint-disable-next-line @typescript-eslint/no-unused-vars - public removePlayerFromGroup(url: string, info: IRemovePlayerFromGroupRequest, sessionID: string): INullResponseData + public removePlayerFromGroup(url: string, info: IRemovePlayerFromGroupRequest, sessionID: string): IGetBodyResponseData { - return this.httpResponse.nullResponse(); + return this.httpResponse.getBody(true); } /** Handle client/match/offline/end */ @@ -223,4 +239,24 @@ export class MatchCallbacks { return this.httpResponse.nullResponse(); } + + /** Handle client/match/group/raid/ready */ + public raidReady( + url: string, + info: IEmptyRequestData, + sessionId: string + ): IGetBodyResponseData + { + return this.httpResponse.getBody(true); + } + + /** Handle client/match/group/raid/not-ready */ + public notRaidReady( + url: string, + info: IEmptyRequestData, + sessionId: string + ): IGetBodyResponseData + { + return this.httpResponse.getBody(true); + } } diff --git a/project/src/controllers/DialogueController.ts b/project/src/controllers/DialogueController.ts index 346f855f..c8dcea15 100644 --- a/project/src/controllers/DialogueController.ts +++ b/project/src/controllers/DialogueController.ts @@ -15,6 +15,8 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { SaveServer } from "@spt-aki/servers/SaveServer"; import { MailSendService } from "@spt-aki/services/MailSendService"; import { TimeUtil } from "@spt-aki/utils/TimeUtil"; +import { IFriendRequestData } from "@spt-aki/models/eft/dialog/IFriendRequestData"; +import { IFriendRequestSendResponse } from "@spt-aki/models/eft/dialog/IFriendRequestSendResponse"; @injectable() export class DialogueController @@ -449,4 +451,14 @@ export class DialogueController { return this.timeUtil.getTimestamp() > message.dt + message.maxStorageTime; } + + /** Handle client/friend/request/send */ + public sendFriendRequest( + sessionID: string, + request: IFriendRequestData + + ): IFriendRequestSendResponse + { + return { status: 0, requestId: "12345", retryAfter: 600 } + } } diff --git a/project/src/models/eft/dialog/ICreateGroupMailRequest.ts b/project/src/models/eft/dialog/ICreateGroupMailRequest.ts new file mode 100644 index 00000000..2da59678 --- /dev/null +++ b/project/src/models/eft/dialog/ICreateGroupMailRequest.ts @@ -0,0 +1,5 @@ +export interface ICreateGroupMailRequest +{ + Name: string; + Users: string[]; +} diff --git a/project/src/models/eft/match/IDeclineGroupInviteRequest.ts b/project/src/models/eft/match/IDeclineGroupInviteRequest.ts index 8114fd20..718641e0 100644 --- a/project/src/models/eft/match/IDeclineGroupInviteRequest.ts +++ b/project/src/models/eft/match/IDeclineGroupInviteRequest.ts @@ -1,3 +1,4 @@ export interface IDeclineGroupInviteRequest { + requestId: string; } diff --git a/project/src/models/eft/match/IGroupCurrentResponse.ts b/project/src/models/eft/match/IGroupCurrentResponse.ts new file mode 100644 index 00000000..266ac492 --- /dev/null +++ b/project/src/models/eft/match/IGroupCurrentResponse.ts @@ -0,0 +1,13 @@ +export interface IGroupCurrentResponse +{ + squad: ISquadMember[] +} + +export interface ISquadMember +{ + _id: string + aid: number + Info: any + isLeader: boolean + isReady: boolean +} diff --git a/project/src/models/eft/match/IJoinMatchRequestData.ts b/project/src/models/eft/match/IJoinMatchRequestData.ts index 7ce7ed73..d06fb6ce 100644 --- a/project/src/models/eft/match/IJoinMatchRequestData.ts +++ b/project/src/models/eft/match/IJoinMatchRequestData.ts @@ -1,6 +1,6 @@ export interface IJoinMatchRequestData { - groupid: string + groupId: string servers: Server[] } diff --git a/project/src/models/eft/notifier/INotifier.ts b/project/src/models/eft/notifier/INotifier.ts index 7d66ff95..386e8968 100644 --- a/project/src/models/eft/notifier/INotifier.ts +++ b/project/src/models/eft/notifier/INotifier.ts @@ -27,4 +27,7 @@ export enum NotificationType TRADER_SUPPLY = "TraderSupply", TRADER_STANDING = "TraderStanding", UNLOCK_TRADER = "UnlockTrader", + GROUP_MATCH_RAID_NOT_READY = "groupMatchRaidNotReady", + GROUP_MATCH_RAID_READY = "groupMatchRaidReady" + } diff --git a/project/src/routers/static/DialogStaticRouter.ts b/project/src/routers/static/DialogStaticRouter.ts index 23230592..6e0ffe0a 100644 --- a/project/src/routers/static/DialogStaticRouter.ts +++ b/project/src/routers/static/DialogStaticRouter.ts @@ -9,6 +9,7 @@ import { IGetMailDialogViewResponseData } from "@spt-aki/models/eft/dialog/IGetM import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; import { DialogueInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; +import { ICreateGroupMailRequest } from "@spt-aki/models/eft/dialog/ICreateGroupMailRequest"; @injectable() export class DialogStaticRouter extends StaticRouter @@ -160,6 +161,18 @@ export class DialogStaticRouter extends StaticRouter return this.dialogueCallbacks.clearMail(url, info, sessionID); }, ), + new RouteAction( + "/client/mail/dialog/group/create", + async ( + url: string, + info: ICreateGroupMailRequest, + sessionID: string, + output: string, + ): Promise> => + { + return this.dialogueCallbacks.createGroupMail(url, info, sessionID); + }, + ), new RouteAction( "/client/friend/list", async ( diff --git a/project/src/routers/static/MatchStaticRouter.ts b/project/src/routers/static/MatchStaticRouter.ts index 63223310..965df4df 100644 --- a/project/src/routers/static/MatchStaticRouter.ts +++ b/project/src/routers/static/MatchStaticRouter.ts @@ -7,6 +7,7 @@ import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullRespons import { IAcceptGroupInviteResponse } from "@spt-aki/models/eft/match/IAcceptGroupInviteResponse"; import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse"; import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult"; +import { IGroupCurrentResponse } from "@spt-aki/models/eft/match/IGroupCurrentResponse"; @injectable() export class MatchStaticRouter extends StaticRouter @@ -54,7 +55,7 @@ export class MatchStaticRouter extends StaticRouter ), new RouteAction( "/client/match/group/delete", - async (url: string, info: any, sessionID: string, output: string): Promise => + async (url: string, info: any, sessionID: string, output: string): Promise> => { return this.matchCallbacks.deleteGroup(url, info, sessionID); }, @@ -102,6 +103,13 @@ export class MatchStaticRouter extends StaticRouter return this.matchCallbacks.exitToMenu(url, info, sessionID); }, ), + new RouteAction( + "/client/match/group/current", + async (url: string, info: IEmptyRequestData, sessionID: string, output: string): Promise> => + { + return this.matchCallbacks.groupCurrent(url, info, sessionID); + }, + ), new RouteAction( "/client/match/group/looking/start", async (url: string, info: any, sessionID: string, output: string): Promise => @@ -166,7 +174,7 @@ export class MatchStaticRouter extends StaticRouter info: IEmptyRequestData, sessionID: string, output: string, - ): Promise => + ): Promise> => { return this.matchCallbacks.cancelAllGroupInvite(url, info, sessionID); }, @@ -183,6 +191,30 @@ export class MatchStaticRouter extends StaticRouter return this.matchCallbacks.transferGroup(url, info, sessionID); }, ), + new RouteAction( + "/client/match/group/raid/ready", + async ( + url: string, + info: any, + sessionID: string, + output: string, + ): Promise> => + { + return this.matchCallbacks.raidReady(url, info, sessionID); + }, + ), + new RouteAction( + "/client/match/group/raid/not-ready", + async ( + url: string, + info: any, + sessionID: string, + output: string, + ): Promise> => + { + return this.matchCallbacks.notRaidReady(url, info, sessionID); + }, + ), new RouteAction( "/client/match/offline/end", async (url: string, info: any, sessionID: string, output: string): Promise => @@ -226,7 +258,7 @@ export class MatchStaticRouter extends StaticRouter ), new RouteAction( "/client/match/group/player/remove", - async (url: string, info: any, sessionID: string, output: string): Promise => + async (url: string, info: any, sessionID: string, output: string): Promise> => { return this.matchCallbacks.removePlayerFromGroup(url, info, sessionID); },