2023-03-03 15:23:46 +00:00
|
|
|
import { inject, injectable } from "tsyringe";
|
2024-05-21 17:59:04 +00:00
|
|
|
import { GameCallbacks } from "@spt/callbacks/GameCallbacks";
|
|
|
|
import { RouteAction, StaticRouter } from "@spt/di/Router";
|
|
|
|
import { ICheckVersionResponse } from "@spt/models/eft/game/ICheckVersionResponse";
|
|
|
|
import { ICurrentGroupResponse } from "@spt/models/eft/game/ICurrentGroupResponse";
|
|
|
|
import { IGameConfigResponse } from "@spt/models/eft/game/IGameConfigResponse";
|
|
|
|
import { IGameKeepAliveResponse } from "@spt/models/eft/game/IGameKeepAliveResponse";
|
|
|
|
import { IGameLogoutResponseData } from "@spt/models/eft/game/IGameLogoutResponseData";
|
|
|
|
import { IGameModeResponse } from "@spt/models/eft/game/IGameModeResponse";
|
|
|
|
import { IGameStartResponse } from "@spt/models/eft/game/IGameStartResponse";
|
|
|
|
import { IGetRaidTimeResponse } from "@spt/models/eft/game/IGetRaidTimeResponse";
|
|
|
|
import { ISendReportRequest } from "@spt/models/eft/game/ISendReportRequest";
|
|
|
|
import { IServerDetails } from "@spt/models/eft/game/IServerDetails";
|
|
|
|
import { IGetBodyResponseData } from "@spt/models/eft/httpResponse/IGetBodyResponseData";
|
|
|
|
import { INullResponseData } from "@spt/models/eft/httpResponse/INullResponseData";
|
2023-03-03 15:23:46 +00:00
|
|
|
|
|
|
|
@injectable()
|
2023-11-13 11:12:17 -05:00
|
|
|
export class GameStaticRouter extends StaticRouter
|
2023-03-03 15:23:46 +00:00
|
|
|
{
|
2023-11-13 12:31:52 -05:00
|
|
|
constructor(@inject("GameCallbacks") protected gameCallbacks: GameCallbacks)
|
2023-03-03 15:23:46 +00:00
|
|
|
{
|
2023-11-13 12:31:52 -05:00
|
|
|
super([
|
2024-04-28 13:45:36 +00:00
|
|
|
new RouteAction(
|
|
|
|
"/client/game/config",
|
|
|
|
async (
|
|
|
|
url: string,
|
|
|
|
info: any,
|
|
|
|
sessionID: string,
|
|
|
|
output: string,
|
|
|
|
): Promise<IGetBodyResponseData<IGameConfigResponse>> =>
|
|
|
|
{
|
|
|
|
return this.gameCallbacks.getGameConfig(url, info, sessionID);
|
|
|
|
},
|
|
|
|
),
|
|
|
|
new RouteAction(
|
|
|
|
"/client/game/mode",
|
|
|
|
async (
|
|
|
|
url: string,
|
|
|
|
info: any,
|
|
|
|
sessionID: string,
|
|
|
|
output: string,
|
|
|
|
): Promise<IGetBodyResponseData<IGameModeResponse>> =>
|
|
|
|
{
|
|
|
|
return this.gameCallbacks.getGameMode(url, info, sessionID);
|
|
|
|
},
|
|
|
|
),
|
|
|
|
new RouteAction(
|
|
|
|
"/client/server/list",
|
|
|
|
async (
|
|
|
|
url: string,
|
|
|
|
info: any,
|
|
|
|
sessionID: string,
|
|
|
|
output: string,
|
|
|
|
): Promise<IGetBodyResponseData<IServerDetails[]>> =>
|
|
|
|
{
|
|
|
|
return this.gameCallbacks.getServer(url, info, sessionID);
|
|
|
|
},
|
|
|
|
),
|
2023-11-13 12:31:52 -05:00
|
|
|
new RouteAction(
|
|
|
|
"/client/match/group/current",
|
2024-04-28 13:45:36 +00:00
|
|
|
async (
|
|
|
|
url: string,
|
|
|
|
info: any,
|
|
|
|
sessionID: string,
|
|
|
|
output: string,
|
|
|
|
): Promise<IGetBodyResponseData<ICurrentGroupResponse>> =>
|
2023-11-13 12:31:52 -05:00
|
|
|
{
|
|
|
|
return this.gameCallbacks.getCurrentGroup(url, info, sessionID);
|
|
|
|
},
|
|
|
|
),
|
|
|
|
new RouteAction(
|
|
|
|
"/client/game/version/validate",
|
2024-04-28 13:45:36 +00:00
|
|
|
async (url: string, info: any, sessionID: string, output: string): Promise<INullResponseData> =>
|
2023-11-13 12:31:52 -05:00
|
|
|
{
|
|
|
|
return this.gameCallbacks.versionValidate(url, info, sessionID);
|
|
|
|
},
|
|
|
|
),
|
2024-04-28 13:45:36 +00:00
|
|
|
new RouteAction(
|
|
|
|
"/client/game/start",
|
|
|
|
async (
|
|
|
|
url: string,
|
|
|
|
info: any,
|
|
|
|
sessionID: string,
|
|
|
|
output: string,
|
|
|
|
): Promise<IGetBodyResponseData<IGameStartResponse>> =>
|
|
|
|
{
|
|
|
|
return this.gameCallbacks.gameStart(url, info, sessionID);
|
|
|
|
},
|
|
|
|
),
|
|
|
|
new RouteAction(
|
|
|
|
"/client/game/logout",
|
|
|
|
async (
|
|
|
|
url: string,
|
|
|
|
info: any,
|
|
|
|
sessionID: string,
|
|
|
|
output: string,
|
|
|
|
): Promise<IGetBodyResponseData<IGameLogoutResponseData>> =>
|
|
|
|
{
|
|
|
|
return this.gameCallbacks.gameLogout(url, info, sessionID);
|
|
|
|
},
|
|
|
|
),
|
|
|
|
new RouteAction(
|
|
|
|
"/client/checkVersion",
|
|
|
|
async (
|
|
|
|
url: string,
|
|
|
|
info: any,
|
|
|
|
sessionID: string,
|
|
|
|
output: string,
|
|
|
|
): Promise<IGetBodyResponseData<ICheckVersionResponse>> =>
|
|
|
|
{
|
|
|
|
return this.gameCallbacks.validateGameVersion(url, info, sessionID);
|
|
|
|
},
|
|
|
|
),
|
2023-11-13 12:31:52 -05:00
|
|
|
new RouteAction(
|
|
|
|
"/client/game/keepalive",
|
2024-04-28 13:45:36 +00:00
|
|
|
async (
|
|
|
|
url: string,
|
|
|
|
info: any,
|
|
|
|
sessionID: string,
|
|
|
|
output: string,
|
|
|
|
): Promise<IGetBodyResponseData<IGameKeepAliveResponse>> =>
|
2023-11-13 12:31:52 -05:00
|
|
|
{
|
|
|
|
return this.gameCallbacks.gameKeepalive(url, info, sessionID);
|
|
|
|
},
|
|
|
|
),
|
|
|
|
new RouteAction(
|
|
|
|
"/singleplayer/settings/version",
|
2024-04-28 13:45:36 +00:00
|
|
|
async (url: string, info: any, sessionID: string, output: string): Promise<string> =>
|
2023-11-13 12:31:52 -05:00
|
|
|
{
|
|
|
|
return this.gameCallbacks.getVersion(url, info, sessionID);
|
|
|
|
},
|
|
|
|
),
|
|
|
|
new RouteAction(
|
|
|
|
"/client/reports/lobby/send",
|
2024-04-28 13:45:36 +00:00
|
|
|
async (url: string, info: any, sessionID: string, output: string): Promise<INullResponseData> =>
|
2023-11-13 12:31:52 -05:00
|
|
|
{
|
|
|
|
return this.gameCallbacks.reportNickname(url, info, sessionID);
|
|
|
|
},
|
|
|
|
),
|
2024-05-15 15:43:19 +01:00
|
|
|
new RouteAction(
|
|
|
|
"/client/report/send",
|
2024-05-15 19:43:39 +01:00
|
|
|
async (
|
|
|
|
url: string,
|
|
|
|
info: ISendReportRequest,
|
|
|
|
sessionID: string,
|
|
|
|
output: string,
|
|
|
|
): Promise<INullResponseData> =>
|
2024-05-15 15:43:19 +01:00
|
|
|
{
|
|
|
|
return null;
|
|
|
|
},
|
|
|
|
),
|
2023-11-26 21:11:03 +00:00
|
|
|
new RouteAction(
|
|
|
|
"/singleplayer/settings/getRaidTime",
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
2024-04-28 13:45:36 +00:00
|
|
|
async (url: string, info: any, sessionID: string, output: string): Promise<IGetRaidTimeResponse> =>
|
2023-11-26 21:11:03 +00:00
|
|
|
{
|
|
|
|
return this.gameCallbacks.getRaidTime(url, info, sessionID);
|
|
|
|
},
|
2024-02-02 13:54:07 -05:00
|
|
|
),
|
2023-11-13 12:31:52 -05:00
|
|
|
]);
|
2023-03-03 15:23:46 +00:00
|
|
|
}
|
2023-11-13 11:12:17 -05:00
|
|
|
}
|