feat: add /client/game/mode handling (!308)
add `/client/game/mode` endpoint handling. gets into main menu Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/308 Co-authored-by: kiobu <kiobu@sdf.org> Co-committed-by: kiobu <kiobu@sdf.org>
This commit is contained in:
parent
7f56cee388
commit
001def56a5
@ -9,6 +9,8 @@ import { IGameConfigResponse } from "@spt-aki/models/eft/game/IGameConfigRespons
|
|||||||
import { IGameEmptyCrcRequestData } from "@spt-aki/models/eft/game/IGameEmptyCrcRequestData";
|
import { IGameEmptyCrcRequestData } from "@spt-aki/models/eft/game/IGameEmptyCrcRequestData";
|
||||||
import { IGameKeepAliveResponse } from "@spt-aki/models/eft/game/IGameKeepAliveResponse";
|
import { IGameKeepAliveResponse } from "@spt-aki/models/eft/game/IGameKeepAliveResponse";
|
||||||
import { IGameLogoutResponseData } from "@spt-aki/models/eft/game/IGameLogoutResponseData";
|
import { IGameLogoutResponseData } from "@spt-aki/models/eft/game/IGameLogoutResponseData";
|
||||||
|
import { IGameModeRequestData } from "@spt-aki/models/eft/game/IGameModeRequestData";
|
||||||
|
import { IGameModeResponse } from "@spt-aki/models/eft/game/IGameModeResponse";
|
||||||
import { IGameStartResponse } from "@spt-aki/models/eft/game/IGameStartResponse";
|
import { IGameStartResponse } from "@spt-aki/models/eft/game/IGameStartResponse";
|
||||||
import { IGetRaidTimeRequest } from "@spt-aki/models/eft/game/IGetRaidTimeRequest";
|
import { IGetRaidTimeRequest } from "@spt-aki/models/eft/game/IGetRaidTimeRequest";
|
||||||
import { IGetRaidTimeResponse } from "@spt-aki/models/eft/game/IGetRaidTimeResponse";
|
import { IGetRaidTimeResponse } from "@spt-aki/models/eft/game/IGetRaidTimeResponse";
|
||||||
@ -91,6 +93,19 @@ export class GameCallbacks implements OnLoad
|
|||||||
return this.httpResponse.getBody(this.gameController.getGameConfig(sessionID));
|
return this.httpResponse.getBody(this.gameController.getGameConfig(sessionID));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle client/game/mode
|
||||||
|
* @returns IGameModeResponse
|
||||||
|
*/
|
||||||
|
public getGameMode(
|
||||||
|
url: string,
|
||||||
|
info: IGameModeRequestData,
|
||||||
|
sessionID: string,
|
||||||
|
): IGetBodyResponseData<IGameModeResponse>
|
||||||
|
{
|
||||||
|
return this.httpResponse.getBody(this.gameController.getGameMode(sessionID, info));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle client/server/list
|
* Handle client/server/list
|
||||||
*/
|
*/
|
||||||
|
@ -15,6 +15,8 @@ import { ICheckVersionResponse } from "@spt-aki/models/eft/game/ICheckVersionRes
|
|||||||
import { ICurrentGroupResponse } from "@spt-aki/models/eft/game/ICurrentGroupResponse";
|
import { ICurrentGroupResponse } from "@spt-aki/models/eft/game/ICurrentGroupResponse";
|
||||||
import { IGameConfigResponse } from "@spt-aki/models/eft/game/IGameConfigResponse";
|
import { IGameConfigResponse } from "@spt-aki/models/eft/game/IGameConfigResponse";
|
||||||
import { IGameKeepAliveResponse } from "@spt-aki/models/eft/game/IGameKeepAliveResponse";
|
import { IGameKeepAliveResponse } from "@spt-aki/models/eft/game/IGameKeepAliveResponse";
|
||||||
|
import { IGameModeRequestData } from "@spt-aki/models/eft/game/IGameModeRequestData";
|
||||||
|
import { ESessionMode } from "@spt-aki/models/eft/game/IGameModeResponse";
|
||||||
import { IGetRaidTimeRequest } from "@spt-aki/models/eft/game/IGetRaidTimeRequest";
|
import { IGetRaidTimeRequest } from "@spt-aki/models/eft/game/IGetRaidTimeRequest";
|
||||||
import { IGetRaidTimeResponse } from "@spt-aki/models/eft/game/IGetRaidTimeResponse";
|
import { IGetRaidTimeResponse } from "@spt-aki/models/eft/game/IGetRaidTimeResponse";
|
||||||
import { IServerDetails } from "@spt-aki/models/eft/game/IServerDetails";
|
import { IServerDetails } from "@spt-aki/models/eft/game/IServerDetails";
|
||||||
@ -479,6 +481,14 @@ export class GameController
|
|||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle client/game/mode
|
||||||
|
*/
|
||||||
|
public getGameMode(sessionID: string, info: IGameModeRequestData): any
|
||||||
|
{
|
||||||
|
return { gameMode: ESessionMode.REGULAR, backendUrl: this.httpServerHelper.getBackendUrl() };
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle client/server/list
|
* Handle client/server/list
|
||||||
*/
|
*/
|
||||||
|
4
project/src/models/eft/game/IGameModeRequestData.ts
Normal file
4
project/src/models/eft/game/IGameModeRequestData.ts
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
export interface IGameModeRequestData
|
||||||
|
{
|
||||||
|
sessionMode: string | null;
|
||||||
|
}
|
11
project/src/models/eft/game/IGameModeResponse.ts
Normal file
11
project/src/models/eft/game/IGameModeResponse.ts
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
export enum ESessionMode
|
||||||
|
{
|
||||||
|
REGULAR = "regular",
|
||||||
|
PVE = "pve",
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IGameModeResponse
|
||||||
|
{
|
||||||
|
gameMode: ESessionMode;
|
||||||
|
backendUrl: string;
|
||||||
|
}
|
@ -13,6 +13,10 @@ export class GameStaticRouter extends StaticRouter
|
|||||||
{
|
{
|
||||||
return this.gameCallbacks.getGameConfig(url, info, sessionID);
|
return this.gameCallbacks.getGameConfig(url, info, sessionID);
|
||||||
}),
|
}),
|
||||||
|
new RouteAction("/client/game/mode", (url: string, info: any, sessionID: string, output: string): any =>
|
||||||
|
{
|
||||||
|
return this.gameCallbacks.getGameMode(url, info, sessionID);
|
||||||
|
}),
|
||||||
new RouteAction("/client/server/list", (url: string, info: any, sessionID: string, output: string): any =>
|
new RouteAction("/client/server/list", (url: string, info: any, sessionID: string, output: string): any =>
|
||||||
{
|
{
|
||||||
return this.gameCallbacks.getServer(url, info, sessionID);
|
return this.gameCallbacks.getServer(url, info, sessionID);
|
||||||
|
Loading…
Reference in New Issue
Block a user