Server/project/src/routers/static/MatchStaticRouter.ts

180 lines
7.7 KiB
TypeScript
Raw Normal View History

2023-03-03 15:23:46 +00:00
import { inject, injectable } from "tsyringe";
import { MatchCallbacks } from "@spt-aki/callbacks/MatchCallbacks";
import { RouteAction, StaticRouter } from "@spt-aki/di/Router";
2023-03-03 15:23:46 +00:00
@injectable()
2023-11-13 11:12:17 -05:00
export class MatchStaticRouter extends StaticRouter
2023-03-03 15:23:46 +00:00
{
constructor(
2023-11-13 11:12:17 -05:00
@inject("MatchCallbacks") protected matchCallbacks: MatchCallbacks,
)
2023-03-03 15:23:46 +00:00
{
super(
[
new RouteAction(
2023-11-13 11:12:17 -05:00
"/raid/profile/list",
(url: string, info: any, sessionID: string, output: string): any =>
2023-03-03 15:23:46 +00:00
{
return this.matchCallbacks.getProfile(url, info, sessionID);
2023-11-13 11:12:17 -05:00
},
2023-03-03 15:23:46 +00:00
),
new RouteAction(
2023-11-13 11:12:17 -05:00
"/client/match/available",
(url: string, info: any, sessionID: string, output: string): any =>
2023-03-03 15:23:46 +00:00
{
return this.matchCallbacks.serverAvailable(url, info, sessionID);
2023-11-13 11:12:17 -05:00
},
2023-03-03 15:23:46 +00:00
),
new RouteAction(
2023-11-13 11:12:17 -05:00
"/client/match/updatePing",
(url: string, info: any, sessionID: string, output: string): any =>
2023-03-03 15:23:46 +00:00
{
return this.matchCallbacks.updatePing(url, info, sessionID);
2023-11-13 11:12:17 -05:00
},
2023-03-03 15:23:46 +00:00
),
new RouteAction(
"/client/match/join",
2023-11-13 11:12:17 -05:00
(url: string, info: any, sessionID: string, output: string): any =>
2023-03-03 15:23:46 +00:00
{
return this.matchCallbacks.joinMatch(url, info, sessionID);
2023-11-13 11:12:17 -05:00
},
2023-03-03 15:23:46 +00:00
),
new RouteAction(
2023-11-13 11:12:17 -05:00
"/client/match/exit",
(url: string, info: any, sessionID: string, output: string): any =>
2023-03-03 15:23:46 +00:00
{
return this.matchCallbacks.exitMatch(url, info, sessionID);
2023-11-13 11:12:17 -05:00
},
2023-03-03 15:23:46 +00:00
),
new RouteAction(
2023-11-13 11:12:17 -05:00
"/client/match/group/create",
(url: string, info: any, sessionID: string, output: string): any =>
2023-03-03 15:23:46 +00:00
{
return this.matchCallbacks.createGroup(url, info, sessionID);
2023-11-13 11:12:17 -05:00
},
2023-03-03 15:23:46 +00:00
),
new RouteAction(
"/client/match/group/delete",
2023-11-13 11:12:17 -05:00
(url: string, info: any, sessionID: string, output: string): any =>
2023-03-03 15:23:46 +00:00
{
2023-11-13 11:12:17 -05:00
return this.matchCallbacks.deleteGroup(url, info, sessionID);
},
2023-03-03 15:23:46 +00:00
),
new RouteAction(
"/client/match/group/leave",
2023-11-13 11:12:17 -05:00
(url: string, info: any, sessionID: string, output: string): any =>
{
2023-11-13 11:12:17 -05:00
return this.matchCallbacks.leaveGroup(url, info, sessionID);
},
),
2023-03-03 15:23:46 +00:00
new RouteAction(
"/client/match/group/status",
2023-11-13 11:12:17 -05:00
(url: string, info: any, sessionID: string, output: string): any =>
2023-03-03 15:23:46 +00:00
{
return this.matchCallbacks.getGroupStatus(url, info, sessionID);
2023-11-13 11:12:17 -05:00
},
2023-03-03 15:23:46 +00:00
),
new RouteAction(
"/client/match/group/start_game",
2023-11-13 11:12:17 -05:00
(url: string, info: any, sessionID: string, output: string): any =>
2023-03-03 15:23:46 +00:00
{
return this.matchCallbacks.joinMatch(url, info, sessionID);
2023-11-13 11:12:17 -05:00
},
2023-03-03 15:23:46 +00:00
),
new RouteAction(
"/client/match/group/exit_from_menu",
2023-11-13 11:12:17 -05:00
(url: string, info: any, sessionID: string, output: string): any =>
2023-03-03 15:23:46 +00:00
{
return this.matchCallbacks.exitToMenu(url, info, sessionID);
2023-11-13 11:12:17 -05:00
},
2023-03-03 15:23:46 +00:00
),
new RouteAction(
"/client/match/group/looking/start",
2023-11-13 11:12:17 -05:00
(url: string, info: any, sessionID: string, output: string): any =>
2023-03-03 15:23:46 +00:00
{
return this.matchCallbacks.startGroupSearch(url, info, sessionID);
2023-11-13 11:12:17 -05:00
},
2023-03-03 15:23:46 +00:00
),
new RouteAction(
"/client/match/group/looking/stop",
2023-11-13 11:12:17 -05:00
(url: string, info: any, sessionID: string, output: string): any =>
2023-03-03 15:23:46 +00:00
{
return this.matchCallbacks.stopGroupSearch(url, info, sessionID);
2023-11-13 11:12:17 -05:00
},
2023-03-03 15:23:46 +00:00
),
new RouteAction(
"/client/match/group/invite/send",
2023-11-13 11:12:17 -05:00
(url: string, info: any, sessionID: string, output: string): any =>
2023-03-03 15:23:46 +00:00
{
return this.matchCallbacks.sendGroupInvite(url, info, sessionID);
2023-11-13 11:12:17 -05:00
},
2023-03-03 15:23:46 +00:00
),
new RouteAction(
"/client/match/group/invite/accept",
2023-11-13 11:12:17 -05:00
(url: string, info: any, sessionID: string, output: string): any =>
2023-03-03 15:23:46 +00:00
{
return this.matchCallbacks.acceptGroupInvite(url, info, sessionID);
2023-11-13 11:12:17 -05:00
},
2023-03-03 15:23:46 +00:00
),
new RouteAction(
"/client/match/group/invite/cancel",
2023-11-13 11:12:17 -05:00
(url: string, info: any, sessionID: string, output: string): any =>
2023-03-03 15:23:46 +00:00
{
return this.matchCallbacks.cancelGroupInvite(url, info, sessionID);
2023-11-13 11:12:17 -05:00
},
2023-03-03 15:23:46 +00:00
),
new RouteAction(
"/client/match/group/invite/cancel-all",
2023-11-13 11:12:17 -05:00
(url: string, info: any, sessionID: string, output: string): any =>
{
return this.matchCallbacks.cancelAllGroupInvite(url, info, sessionID);
2023-11-13 11:12:17 -05:00
},
),
new RouteAction(
"/client/match/group/transfer",
2023-11-13 11:12:17 -05:00
(url: string, info: any, sessionID: string, output: string): any =>
{
return this.matchCallbacks.transferGroup(url, info, sessionID);
2023-11-13 11:12:17 -05:00
},
),
2023-03-03 15:23:46 +00:00
new RouteAction(
"/client/match/offline/end",
2023-11-13 11:12:17 -05:00
(url: string, info: any, sessionID: string, output: string): any =>
2023-03-03 15:23:46 +00:00
{
return this.matchCallbacks.endOfflineRaid(url, info, sessionID);
2023-11-13 11:12:17 -05:00
},
2023-03-03 15:23:46 +00:00
),
new RouteAction(
"/client/putMetrics",
2023-11-13 11:12:17 -05:00
(url: string, info: any, sessionID: string, output: string): any =>
2023-03-03 15:23:46 +00:00
{
return this.matchCallbacks.putMetrics(url, info, sessionID);
2023-11-13 11:12:17 -05:00
},
2023-03-03 15:23:46 +00:00
),
new RouteAction(
"/client/getMetricsConfig",
2023-11-13 11:12:17 -05:00
(url: string, info: any, sessionID: string, output: string): any =>
2023-03-03 15:23:46 +00:00
{
return this.matchCallbacks.getMetrics(url, info, sessionID);
2023-11-13 11:12:17 -05:00
},
2023-03-03 15:23:46 +00:00
),
new RouteAction(
"/client/raid/configuration",
2023-11-13 11:12:17 -05:00
(url: string, info: any, sessionID: string, output: string): any =>
2023-03-03 15:23:46 +00:00
{
return this.matchCallbacks.getRaidConfiguration(url, info, sessionID);
2023-11-13 11:12:17 -05:00
},
),
new RouteAction(
"/client/match/group/player/remove",
2023-11-13 11:12:17 -05:00
(url: string, info: any, sessionID: string, output: string): any =>
{
return this.matchCallbacks.removePlayerFromGroup(url, info, sessionID);
2023-11-13 11:12:17 -05:00
},
),
],
2023-03-03 15:23:46 +00:00
);
}
2023-11-13 11:12:17 -05:00
}