2023-03-03 16:23:46 +01:00
|
|
|
import { inject, injectable } from "tsyringe";
|
2024-05-21 19:59:04 +02:00
|
|
|
import { MatchController } from "@spt/controllers/MatchController";
|
|
|
|
import { IEmptyRequestData } from "@spt/models/eft/common/IEmptyRequestData";
|
|
|
|
import { IGetBodyResponseData } from "@spt/models/eft/httpResponse/IGetBodyResponseData";
|
|
|
|
import { INullResponseData } from "@spt/models/eft/httpResponse/INullResponseData";
|
2024-07-04 22:01:37 +02:00
|
|
|
import { IEndLocalRaidRequestData } from "@spt/models/eft/match/IEndLocalRaidRequestData";
|
2024-05-21 19:59:04 +02:00
|
|
|
import { IEndOfflineRaidRequestData } from "@spt/models/eft/match/IEndOfflineRaidRequestData";
|
|
|
|
import { IGetRaidConfigurationRequestData } from "@spt/models/eft/match/IGetRaidConfigurationRequestData";
|
|
|
|
import { IGroupCharacter } from "@spt/models/eft/match/IGroupCharacter";
|
|
|
|
import { IMatchGroupCurrentResponse } from "@spt/models/eft/match/IMatchGroupCurrentResponse";
|
|
|
|
import { IMatchGroupInviteSendRequest } from "@spt/models/eft/match/IMatchGroupInviteSendRequest";
|
|
|
|
import { IMatchGroupPlayerRemoveRequest } from "@spt/models/eft/match/IMatchGroupPlayerRemoveRequest";
|
|
|
|
import { IMatchGroupStartGameRequest } from "@spt/models/eft/match/IMatchGroupStartGameRequest";
|
|
|
|
import { IMatchGroupStatusRequest } from "@spt/models/eft/match/IMatchGroupStatusRequest";
|
|
|
|
import { IMatchGroupStatusResponse } from "@spt/models/eft/match/IMatchGroupStatusResponse";
|
|
|
|
import { IMatchGroupTransferRequest } from "@spt/models/eft/match/IMatchGroupTransferRequest";
|
|
|
|
import { IProfileStatusResponse } from "@spt/models/eft/match/IProfileStatusResponse";
|
|
|
|
import { IPutMetricsRequestData } from "@spt/models/eft/match/IPutMetricsRequestData";
|
|
|
|
import { IRequestIdRequest } from "@spt/models/eft/match/IRequestIdRequest";
|
2024-07-04 22:01:37 +02:00
|
|
|
import { IStartLocalRaidRequestData } from "@spt/models/eft/match/IStartLocalRaidRequestData";
|
|
|
|
import { IStartLocalRaidResponseData } from "@spt/models/eft/match/IStartLocalRaidResponseData";
|
2024-05-21 19:59:04 +02:00
|
|
|
import { IUpdatePingRequestData } from "@spt/models/eft/match/IUpdatePingRequestData";
|
2024-05-28 23:24:52 +02:00
|
|
|
import { DatabaseService } from "@spt/services/DatabaseService";
|
2024-05-21 19:59:04 +02:00
|
|
|
import { HttpResponseUtil } from "@spt/utils/HttpResponseUtil";
|
|
|
|
import { JsonUtil } from "@spt/utils/JsonUtil";
|
2023-03-03 16:23:46 +01:00
|
|
|
|
|
|
|
@injectable()
|
|
|
|
export class MatchCallbacks
|
|
|
|
{
|
|
|
|
constructor(
|
|
|
|
@inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil,
|
|
|
|
@inject("JsonUtil") protected jsonUtil: JsonUtil,
|
|
|
|
@inject("MatchController") protected matchController: MatchController,
|
2024-05-28 23:24:52 +02:00
|
|
|
@inject("DatabaseService") protected databaseService: DatabaseService,
|
2023-03-03 16:23:46 +01:00
|
|
|
)
|
2023-11-16 22:42:06 +01:00
|
|
|
{}
|
2023-03-03 16:23:46 +01:00
|
|
|
|
2023-07-15 15:49:25 +02:00
|
|
|
/** Handle client/match/updatePing */
|
2023-03-03 16:23:46 +01:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
|
|
public updatePing(url: string, info: IUpdatePingRequestData, sessionID: string): INullResponseData
|
|
|
|
{
|
|
|
|
return this.httpResponse.nullResponse();
|
|
|
|
}
|
|
|
|
|
2023-05-20 19:37:39 +02:00
|
|
|
// Handle client/match/exit
|
2023-03-03 16:23:46 +01:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
|
|
public exitMatch(url: string, info: IEmptyRequestData, sessionID: string): INullResponseData
|
|
|
|
{
|
|
|
|
return this.httpResponse.nullResponse();
|
|
|
|
}
|
|
|
|
|
2023-07-15 15:49:25 +02:00
|
|
|
/** Handle client/match/group/exit_from_menu */
|
2023-03-03 16:23:46 +01:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
|
|
public exitToMenu(url: string, info: IEmptyRequestData, sessionID: string): INullResponseData
|
|
|
|
{
|
|
|
|
return this.httpResponse.nullResponse();
|
|
|
|
}
|
|
|
|
|
2024-05-15 15:10:06 +02:00
|
|
|
public groupCurrent(
|
|
|
|
url: string,
|
|
|
|
info: IEmptyRequestData,
|
2024-05-15 20:43:39 +02:00
|
|
|
sessionID: string,
|
2024-05-16 00:40:32 +02:00
|
|
|
): IGetBodyResponseData<IMatchGroupCurrentResponse>
|
2024-05-15 15:10:06 +02:00
|
|
|
{
|
2024-05-16 12:10:04 +02:00
|
|
|
return this.httpResponse.getBody({ squad: [] });
|
2024-05-15 15:10:06 +02:00
|
|
|
}
|
|
|
|
|
2023-03-03 16:23:46 +01:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
|
|
public startGroupSearch(url: string, info: IEmptyRequestData, sessionID: string): INullResponseData
|
|
|
|
{
|
|
|
|
return this.httpResponse.nullResponse();
|
|
|
|
}
|
|
|
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
|
|
public stopGroupSearch(url: string, info: IEmptyRequestData, sessionID: string): INullResponseData
|
|
|
|
{
|
|
|
|
return this.httpResponse.nullResponse();
|
|
|
|
}
|
|
|
|
|
2023-07-15 15:49:25 +02:00
|
|
|
/** Handle client/match/group/invite/send */
|
2023-03-03 16:23:46 +01:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
2024-05-16 00:40:32 +02:00
|
|
|
public sendGroupInvite(
|
|
|
|
url: string,
|
|
|
|
info: IMatchGroupInviteSendRequest,
|
|
|
|
sessionID: string,
|
|
|
|
): IGetBodyResponseData<string>
|
2023-03-03 16:23:46 +01:00
|
|
|
{
|
2023-03-07 23:25:23 +01:00
|
|
|
return this.httpResponse.getBody("2427943f23698ay9f2863735");
|
2023-03-03 16:23:46 +01:00
|
|
|
}
|
|
|
|
|
2023-03-07 23:25:23 +01:00
|
|
|
/** Handle client/match/group/invite/accept */
|
2023-03-03 16:23:46 +01:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
2023-11-16 22:42:06 +01:00
|
|
|
public acceptGroupInvite(
|
|
|
|
url: string,
|
2024-05-16 00:40:32 +02:00
|
|
|
info: IRequestIdRequest,
|
2024-05-15 15:10:06 +02:00
|
|
|
sessionId: string,
|
2024-05-16 00:40:32 +02:00
|
|
|
): IGetBodyResponseData<IGroupCharacter[]>
|
2023-03-03 16:23:46 +01:00
|
|
|
{
|
2023-03-07 23:25:23 +01:00
|
|
|
const result = [];
|
2024-05-27 18:05:16 +02:00
|
|
|
// eslint-disable-next-line strict-null-checks/all
|
2023-03-07 23:25:23 +01:00
|
|
|
result.push({});
|
|
|
|
|
|
|
|
return this.httpResponse.getBody(result);
|
2023-03-03 16:23:46 +01:00
|
|
|
}
|
|
|
|
|
2024-03-09 17:57:47 +01:00
|
|
|
/** Handle client/match/group/invite/decline */
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
2024-05-17 21:32:41 +02:00
|
|
|
public declineGroupInvite(url: string, info: IRequestIdRequest, sessionId: string): IGetBodyResponseData<boolean>
|
2024-03-09 17:57:47 +01:00
|
|
|
{
|
2024-05-15 15:10:06 +02:00
|
|
|
return this.httpResponse.getBody(true);
|
2024-03-09 17:57:47 +01:00
|
|
|
}
|
|
|
|
|
2023-03-07 23:25:23 +01:00
|
|
|
/** Handle client/match/group/invite/cancel */
|
2023-03-03 16:23:46 +01:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
2024-05-17 21:32:41 +02:00
|
|
|
public cancelGroupInvite(url: string, info: IRequestIdRequest, sessionID: string): IGetBodyResponseData<boolean>
|
2023-03-03 16:23:46 +01:00
|
|
|
{
|
2023-03-07 23:25:23 +01:00
|
|
|
return this.httpResponse.getBody(true);
|
2023-03-03 16:23:46 +01:00
|
|
|
}
|
2024-05-08 05:57:08 +02:00
|
|
|
|
2023-05-20 19:37:39 +02:00
|
|
|
/** Handle client/match/group/transfer */
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
2024-05-15 15:10:06 +02:00
|
|
|
public transferGroup(
|
|
|
|
url: string,
|
2024-05-16 00:40:32 +02:00
|
|
|
info: IMatchGroupTransferRequest,
|
2024-05-15 20:43:39 +02:00
|
|
|
sessionId: string,
|
2024-05-15 15:10:06 +02:00
|
|
|
): IGetBodyResponseData<boolean>
|
2023-05-20 19:37:39 +02:00
|
|
|
{
|
|
|
|
return this.httpResponse.getBody(true);
|
|
|
|
}
|
2023-03-03 16:23:46 +01:00
|
|
|
|
2023-07-15 15:49:25 +02:00
|
|
|
/** Handle client/match/group/invite/cancel-all */
|
2023-03-07 13:56:44 +01:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
2024-05-15 15:10:06 +02:00
|
|
|
public cancelAllGroupInvite(
|
|
|
|
url: string,
|
|
|
|
info: IEmptyRequestData,
|
2024-05-15 20:43:39 +02:00
|
|
|
sessionId: string,
|
2024-05-15 15:10:06 +02:00
|
|
|
): IGetBodyResponseData<boolean>
|
2023-03-07 13:56:44 +01:00
|
|
|
{
|
2024-05-15 15:10:06 +02:00
|
|
|
return this.httpResponse.getBody(true);
|
2023-03-07 13:56:44 +01:00
|
|
|
}
|
|
|
|
|
2023-03-03 16:23:46 +01:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
2024-07-05 14:32:46 +02:00
|
|
|
public putMetrics(url: string, request: IPutMetricsRequestData, sessionId: string): INullResponseData
|
2023-03-03 16:23:46 +01:00
|
|
|
{
|
|
|
|
return this.httpResponse.nullResponse();
|
|
|
|
}
|
|
|
|
|
2023-05-20 19:37:39 +02:00
|
|
|
// Handle client/match/available
|
2023-03-03 16:23:46 +01:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
2024-05-15 15:10:06 +02:00
|
|
|
public serverAvailable(url: string, info: IEmptyRequestData, sessionId: string): IGetBodyResponseData<boolean>
|
2023-03-03 16:23:46 +01:00
|
|
|
{
|
|
|
|
const output = this.matchController.getEnabled();
|
|
|
|
|
|
|
|
return this.httpResponse.getBody(output);
|
|
|
|
}
|
|
|
|
|
2023-07-15 15:49:25 +02:00
|
|
|
/** Handle match/group/start_game */
|
2023-11-16 22:42:06 +01:00
|
|
|
public joinMatch(
|
|
|
|
url: string,
|
2024-05-16 00:40:32 +02:00
|
|
|
info: IMatchGroupStartGameRequest,
|
2023-11-16 22:42:06 +01:00
|
|
|
sessionID: string,
|
2024-05-16 00:40:32 +02:00
|
|
|
): IGetBodyResponseData<IProfileStatusResponse>
|
2023-03-03 16:23:46 +01:00
|
|
|
{
|
|
|
|
return this.httpResponse.getBody(this.matchController.joinMatch(info, sessionID));
|
|
|
|
}
|
|
|
|
|
2023-07-15 15:49:25 +02:00
|
|
|
/** Handle client/getMetricsConfig */
|
2023-03-03 16:23:46 +01:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
|
|
public getMetrics(url: string, info: any, sessionID: string): IGetBodyResponseData<string>
|
|
|
|
{
|
2024-05-28 23:24:52 +02:00
|
|
|
return this.httpResponse.getBody(this.jsonUtil.serialize(this.databaseService.getMatch().metrics));
|
2023-03-03 16:23:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2024-03-26 16:44:11 +01:00
|
|
|
* Called periodically while in a group
|
2023-03-03 16:23:46 +01:00
|
|
|
* Handle client/match/group/status
|
2023-11-16 22:42:06 +01:00
|
|
|
* @returns
|
2023-03-03 16:23:46 +01:00
|
|
|
*/
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
2024-02-02 19:54:07 +01:00
|
|
|
public getGroupStatus(
|
|
|
|
url: string,
|
2024-05-16 00:40:32 +02:00
|
|
|
info: IMatchGroupStatusRequest,
|
2024-02-02 19:54:07 +01:00
|
|
|
sessionID: string,
|
2024-05-16 00:40:32 +02:00
|
|
|
): IGetBodyResponseData<IMatchGroupStatusResponse>
|
2023-03-03 16:23:46 +01:00
|
|
|
{
|
|
|
|
return this.httpResponse.getBody(this.matchController.getGroupStatus(info));
|
|
|
|
}
|
|
|
|
|
2023-07-15 15:49:25 +02:00
|
|
|
/** Handle client/match/group/delete */
|
2023-03-03 16:23:46 +01:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
2024-05-16 00:40:32 +02:00
|
|
|
public deleteGroup(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<boolean>
|
2023-03-03 16:23:46 +01:00
|
|
|
{
|
|
|
|
this.matchController.deleteGroup(info);
|
2024-05-15 15:10:06 +02:00
|
|
|
return this.httpResponse.getBody(true);
|
2023-03-03 16:23:46 +01:00
|
|
|
}
|
|
|
|
|
2023-05-20 19:37:39 +02:00
|
|
|
// Handle client/match/group/leave
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
|
|
public leaveGroup(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<boolean>
|
|
|
|
{
|
|
|
|
return this.httpResponse.getBody(true);
|
|
|
|
}
|
|
|
|
|
2023-07-15 15:49:25 +02:00
|
|
|
/** Handle client/match/group/player/remove */
|
2023-03-07 23:25:23 +01:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
2024-05-15 20:43:39 +02:00
|
|
|
public removePlayerFromGroup(
|
|
|
|
url: string,
|
2024-05-16 00:40:32 +02:00
|
|
|
info: IMatchGroupPlayerRemoveRequest,
|
2024-05-15 20:43:39 +02:00
|
|
|
sessionID: string,
|
|
|
|
): IGetBodyResponseData<boolean>
|
2023-03-07 23:25:23 +01:00
|
|
|
{
|
2024-05-15 15:10:06 +02:00
|
|
|
return this.httpResponse.getBody(true);
|
2023-03-07 23:25:23 +01:00
|
|
|
}
|
|
|
|
|
2024-07-04 22:01:37 +02:00
|
|
|
/** Handle client/match/local/start */
|
|
|
|
public startLocalRaid(
|
|
|
|
url: string,
|
|
|
|
info: IStartLocalRaidRequestData,
|
|
|
|
sessionID: string,
|
|
|
|
): IGetBodyResponseData<IStartLocalRaidResponseData>
|
|
|
|
{
|
|
|
|
return this.httpResponse.getBody(this.matchController.startLocalRaid(sessionID, info));
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Handle client/match/local/end */
|
|
|
|
public endLocalRaid(
|
|
|
|
url: string,
|
|
|
|
info: IEndLocalRaidRequestData,
|
|
|
|
sessionID: string,
|
|
|
|
): INullResponseData
|
|
|
|
{
|
|
|
|
this.matchController.endLocalRaid(sessionID, info);
|
|
|
|
return this.httpResponse.nullResponse();
|
|
|
|
}
|
|
|
|
|
2023-07-15 15:49:25 +02:00
|
|
|
/** Handle client/match/offline/end */
|
2024-07-05 20:02:02 +02:00
|
|
|
public endOfflineRaid(
|
|
|
|
url: string,
|
|
|
|
info: IEndOfflineRaidRequestData,
|
|
|
|
sessionID: string,
|
|
|
|
): INullResponseData
|
2023-03-03 16:23:46 +01:00
|
|
|
{
|
|
|
|
this.matchController.endOfflineRaid(info, sessionID);
|
|
|
|
return this.httpResponse.nullResponse();
|
|
|
|
}
|
|
|
|
|
2023-07-15 15:49:25 +02:00
|
|
|
/** Handle client/raid/configuration */
|
2023-11-16 22:42:06 +01:00
|
|
|
public getRaidConfiguration(
|
|
|
|
url: string,
|
|
|
|
info: IGetRaidConfigurationRequestData,
|
|
|
|
sessionID: string,
|
|
|
|
): INullResponseData
|
2023-03-03 16:23:46 +01:00
|
|
|
{
|
|
|
|
this.matchController.startOfflineRaid(info, sessionID);
|
|
|
|
return this.httpResponse.nullResponse();
|
|
|
|
}
|
2023-12-27 16:05:07 +01:00
|
|
|
|
|
|
|
/** Handle client/raid/configuration-by-profile */
|
|
|
|
public getConfigurationByProfile(
|
|
|
|
url: string,
|
|
|
|
info: IGetRaidConfigurationRequestData,
|
|
|
|
sessionID: string,
|
|
|
|
): INullResponseData
|
|
|
|
{
|
|
|
|
return this.httpResponse.nullResponse();
|
|
|
|
}
|
2024-05-15 15:10:06 +02:00
|
|
|
|
|
|
|
/** Handle client/match/group/raid/ready */
|
2024-05-17 21:32:41 +02:00
|
|
|
public raidReady(url: string, info: IEmptyRequestData, sessionId: string): IGetBodyResponseData<boolean>
|
2024-05-15 15:10:06 +02:00
|
|
|
{
|
|
|
|
return this.httpResponse.getBody(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Handle client/match/group/raid/not-ready */
|
2024-05-17 21:32:41 +02:00
|
|
|
public notRaidReady(url: string, info: IEmptyRequestData, sessionId: string): IGetBodyResponseData<boolean>
|
2024-05-15 15:10:06 +02:00
|
|
|
{
|
|
|
|
return this.httpResponse.getBody(true);
|
|
|
|
}
|
2023-03-03 16:23:46 +01:00
|
|
|
}
|