Add endpoint stubs and improve request/response objects
This commit is contained in:
parent
08f2bdb27e
commit
17afc9e460
@ -3,6 +3,7 @@ import { inject, injectable } from "tsyringe";
|
|||||||
import { DialogueController } from "../controllers/DialogueController";
|
import { DialogueController } from "../controllers/DialogueController";
|
||||||
import { OnUpdate } from "../di/OnUpdate";
|
import { OnUpdate } from "../di/OnUpdate";
|
||||||
import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData";
|
import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData";
|
||||||
|
import { IAcceptFriendRequestData } from "../models/eft/dialog/IAcceptFriendRequestData";
|
||||||
import { IChatServer } from "../models/eft/dialog/IChatServer";
|
import { IChatServer } from "../models/eft/dialog/IChatServer";
|
||||||
import { IClearMailMessageRequest } from "../models/eft/dialog/IClearMailMessageRequest";
|
import { IClearMailMessageRequest } from "../models/eft/dialog/IClearMailMessageRequest";
|
||||||
import { IDeleteFriendRequest } from "../models/eft/dialog/IDeleteFriendRequest";
|
import { IDeleteFriendRequest } from "../models/eft/dialog/IDeleteFriendRequest";
|
||||||
@ -151,6 +152,12 @@ export class DialogueCallbacks implements OnUpdate
|
|||||||
return this.httpResponse.getBody({status: 0, requestid: "12345", retryAfter: 600});
|
return this.httpResponse.getBody({status: 0, requestid: "12345", retryAfter: 600});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
|
public acceptFriendRequest(url: string, request: IAcceptFriendRequestData, sessionID: string): IGetBodyResponseData<boolean>
|
||||||
|
{
|
||||||
|
return this.httpResponse.getBody(true);
|
||||||
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
public deleteFriend(url: string, request: IDeleteFriendRequest, sessionID: string): INullResponseData
|
public deleteFriend(url: string, request: IDeleteFriendRequest, sessionID: string): INullResponseData
|
||||||
{
|
{
|
||||||
|
@ -82,6 +82,7 @@ class GameCallbacks
|
|||||||
return this.httpResponse.getBody(this.gameController.getServer());
|
return this.httpResponse.getBody(this.gameController.getServer());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Handle client/match/group/current
|
||||||
public getCurrentGroup(url: string, info: IEmptyRequestData, sessionID: string): any
|
public getCurrentGroup(url: string, info: IEmptyRequestData, sessionID: string): any
|
||||||
{
|
{
|
||||||
return this.httpResponse.getBody(this.gameController.getCurrentGroup(sessionID));
|
return this.httpResponse.getBody(this.gameController.getCurrentGroup(sessionID));
|
||||||
|
@ -20,6 +20,7 @@ import { IJoinMatchResult } from "../models/eft/match/IJoinMatchResult";
|
|||||||
import { IPutMetricsRequestData } from "../models/eft/match/IPutMetricsRequestData";
|
import { IPutMetricsRequestData } from "../models/eft/match/IPutMetricsRequestData";
|
||||||
import { IRemovePlayerFromGroupRequest } from "../models/eft/match/IRemovePlayerFromGroupRequest";
|
import { IRemovePlayerFromGroupRequest } from "../models/eft/match/IRemovePlayerFromGroupRequest";
|
||||||
import { ISendGroupInviteRequest } from "../models/eft/match/ISendGroupInviteRequest";
|
import { ISendGroupInviteRequest } from "../models/eft/match/ISendGroupInviteRequest";
|
||||||
|
import { ITransferGroupRequest } from "../models/eft/match/ITransferGroupRequest";
|
||||||
import { IUpdatePingRequestData } from "../models/eft/match/IUpdatePingRequestData";
|
import { IUpdatePingRequestData } from "../models/eft/match/IUpdatePingRequestData";
|
||||||
import { DatabaseServer } from "../servers/DatabaseServer";
|
import { DatabaseServer } from "../servers/DatabaseServer";
|
||||||
import { HttpResponseUtil } from "../utils/HttpResponseUtil";
|
import { HttpResponseUtil } from "../utils/HttpResponseUtil";
|
||||||
@ -42,6 +43,7 @@ export class MatchCallbacks
|
|||||||
return this.httpResponse.nullResponse();
|
return this.httpResponse.nullResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Handle client/match/exit
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
public exitMatch(url: string, info: IEmptyRequestData, sessionID: string): INullResponseData
|
public exitMatch(url: string, info: IEmptyRequestData, sessionID: string): INullResponseData
|
||||||
{
|
{
|
||||||
@ -88,6 +90,12 @@ export class MatchCallbacks
|
|||||||
{
|
{
|
||||||
return this.httpResponse.getBody(true);
|
return this.httpResponse.getBody(true);
|
||||||
}
|
}
|
||||||
|
/** Handle client/match/group/transfer */
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
|
public transferGroup(url: string, info: ITransferGroupRequest, sessionID: string): IGetBodyResponseData<boolean>
|
||||||
|
{
|
||||||
|
return this.httpResponse.getBody(true);
|
||||||
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
public cancelAllGroupInvite(url: string, info: any, sessionID: string): INullResponseData
|
public cancelAllGroupInvite(url: string, info: any, sessionID: string): INullResponseData
|
||||||
@ -107,8 +115,9 @@ export class MatchCallbacks
|
|||||||
return this.httpResponse.getBody(this.matchController.getProfile(info));
|
return this.httpResponse.getBody(this.matchController.getProfile(info));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Handle client/match/available
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
public serverAvailable(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<any> | IGetBodyResponseData<true>
|
public serverAvailable(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<boolean>
|
||||||
{
|
{
|
||||||
const output = this.matchController.getEnabled();
|
const output = this.matchController.getEnabled();
|
||||||
|
|
||||||
@ -120,7 +129,8 @@ export class MatchCallbacks
|
|||||||
return this.httpResponse.getBody(output);
|
return this.httpResponse.getBody(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
public joinMatch(url: string, info: IJoinMatchRequestData, sessionID: string): IGetBodyResponseData<IJoinMatchResult[]>
|
// Handle match/group/start_game
|
||||||
|
public joinMatch(url: string, info: IJoinMatchRequestData, sessionID: string): IGetBodyResponseData<IJoinMatchResult>
|
||||||
{
|
{
|
||||||
return this.httpResponse.getBody(this.matchController.joinMatch(info, sessionID));
|
return this.httpResponse.getBody(this.matchController.joinMatch(info, sessionID));
|
||||||
}
|
}
|
||||||
@ -153,6 +163,13 @@ export class MatchCallbacks
|
|||||||
return this.httpResponse.nullResponse();
|
return this.httpResponse.nullResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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);
|
||||||
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// 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): INullResponseData
|
||||||
{
|
{
|
||||||
|
@ -10,6 +10,7 @@ import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData";
|
|||||||
import { IPmcData } from "../models/eft/common/IPmcData";
|
import { IPmcData } from "../models/eft/common/IPmcData";
|
||||||
import { BodyPartHealth } from "../models/eft/common/tables/IBotBase";
|
import { BodyPartHealth } from "../models/eft/common/tables/IBotBase";
|
||||||
import { ICheckVersionResponse } from "../models/eft/game/ICheckVersionResponse";
|
import { ICheckVersionResponse } from "../models/eft/game/ICheckVersionResponse";
|
||||||
|
import { ICurrentGroupResponse } from "../models/eft/game/ICurrentGroupResponse";
|
||||||
import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse";
|
import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse";
|
||||||
import { IServerDetails } from "../models/eft/game/IServerDetails";
|
import { IServerDetails } from "../models/eft/game/IServerDetails";
|
||||||
import { IAkiProfile } from "../models/eft/profile/IAkiProfile";
|
import { IAkiProfile } from "../models/eft/profile/IAkiProfile";
|
||||||
@ -498,11 +499,11 @@ export class GameController
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public getCurrentGroup(sessionId: any): any
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
|
public getCurrentGroup(sessionId: string): ICurrentGroupResponse
|
||||||
{
|
{
|
||||||
return {
|
return {
|
||||||
squad: [],
|
squad: []
|
||||||
raidSettings: {}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,54 +82,39 @@ export class MatchController
|
|||||||
this.matchLocationService.deleteGroup(info);
|
this.matchLocationService.deleteGroup(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
public joinMatch(info: IJoinMatchRequestData, sessionID: string): IJoinMatchResult[]
|
public joinMatch(info: IJoinMatchRequestData, sessionId: string): IJoinMatchResult
|
||||||
{
|
{
|
||||||
const match = this.getMatch(info.location);
|
const output: IJoinMatchResult = {
|
||||||
const output: IJoinMatchResult[] = [];
|
maxPveCountExceeded: false,
|
||||||
|
profiles: []
|
||||||
// --- LOOP (DO THIS FOR EVERY PLAYER IN GROUP)
|
};
|
||||||
// get player profile
|
|
||||||
const account = this.saveServer.getProfile(sessionID).info;
|
|
||||||
const profileID = info.savage
|
|
||||||
? `scav${account.id}`
|
|
||||||
: `pmc${account.id}`;
|
|
||||||
|
|
||||||
// get list of players joining into the match
|
// get list of players joining into the match
|
||||||
output.push({
|
output.profiles.push({
|
||||||
"profileid": profileID,
|
"profileid": "TODO",
|
||||||
"status": "busy",
|
profileToken: "TODO",
|
||||||
|
"status": "MatchWait",
|
||||||
"sid": "",
|
"sid": "",
|
||||||
"ip": match.ip,
|
"ip": "",
|
||||||
"port": match.port,
|
"port": 0,
|
||||||
"version": "live",
|
"version": "live",
|
||||||
"location": info.location,
|
"location": "TODO get location",
|
||||||
raidMode: "Online",
|
raidMode: "Online",
|
||||||
"mode": "deathmatch",
|
"mode": "deathmatch",
|
||||||
"shortid": match.id,
|
"shortid": null,
|
||||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||||
additional_info: undefined
|
additional_info: null
|
||||||
});
|
});
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
||||||
protected getMatch(location: string): any
|
|
||||||
{
|
|
||||||
return {
|
|
||||||
"id": "TEST",
|
|
||||||
"ip": "127.0.0.1",
|
|
||||||
"port": 9909
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
public getGroupStatus(info: IGetGroupStatusRequestData): any
|
public getGroupStatus(info: IGetGroupStatusRequestData): any
|
||||||
{
|
{
|
||||||
return {
|
return {
|
||||||
"players": [],
|
"players": [],
|
||||||
"invite": [],
|
maxPveCountExceeded: false
|
||||||
"group": []
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -328,7 +328,7 @@ export interface LastPlayerStateInfo
|
|||||||
Nickname: string
|
Nickname: string
|
||||||
Side: string
|
Side: string
|
||||||
Level: number
|
Level: number
|
||||||
MemberCategory: string
|
MemberCategory: MemberCategory
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface BackendCounter
|
export interface BackendCounter
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
export interface IAcceptFriendRequestData
|
||||||
|
{
|
||||||
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||||
|
request_id: string
|
||||||
|
}
|
23
project/src/models/eft/game/ICurrentGroupResponse.ts
Normal file
23
project/src/models/eft/game/ICurrentGroupResponse.ts
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
import { MemberCategory } from "../../../models/enums/MemberCategory";
|
||||||
|
|
||||||
|
export interface ICurrentGroupResponse
|
||||||
|
{
|
||||||
|
squad: any[]
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ICurrentGroupSquadMember
|
||||||
|
{
|
||||||
|
_id: string
|
||||||
|
aid: string
|
||||||
|
info: ICurrentGroupMemberInfo
|
||||||
|
isLeader: boolean
|
||||||
|
isReady: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ICurrentGroupMemberInfo
|
||||||
|
{
|
||||||
|
Nickname: string
|
||||||
|
Side: string
|
||||||
|
Level: string
|
||||||
|
MemberCategory: MemberCategory
|
||||||
|
}
|
@ -7,5 +7,5 @@ export interface IGetGroupStatusRequestData
|
|||||||
dt: string
|
dt: string
|
||||||
keyId: string
|
keyId: string
|
||||||
raidMode: RaidMode
|
raidMode: RaidMode
|
||||||
startInGroup: boolean
|
spawnPlace: string
|
||||||
}
|
}
|
@ -1,10 +1,7 @@
|
|||||||
export interface IJoinMatchRequestData
|
export interface IJoinMatchRequestData
|
||||||
{
|
{
|
||||||
location: string
|
groupid: string
|
||||||
savage: boolean
|
|
||||||
dt: string
|
|
||||||
servers: Server[]
|
servers: Server[]
|
||||||
keyId: string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Server
|
export interface Server
|
||||||
|
@ -1,6 +1,13 @@
|
|||||||
export interface IJoinMatchResult
|
export interface IJoinMatchResult
|
||||||
|
{
|
||||||
|
maxPveCountExceeded: boolean
|
||||||
|
profiles: IJoinMatchPlayerProfile[]
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IJoinMatchPlayerProfile
|
||||||
{
|
{
|
||||||
profileid: string
|
profileid: string
|
||||||
|
profileToken: string
|
||||||
status: string
|
status: string
|
||||||
sid: string
|
sid: string
|
||||||
ip: string
|
ip: string
|
||||||
|
4
project/src/models/eft/match/ITransferGroupRequest.ts
Normal file
4
project/src/models/eft/match/ITransferGroupRequest.ts
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
export interface ITransferGroupRequest
|
||||||
|
{
|
||||||
|
aidToChange: string
|
||||||
|
}
|
@ -133,7 +133,7 @@ export interface IUpdatableChatMember
|
|||||||
Nickname: string
|
Nickname: string
|
||||||
Side: string
|
Side: string
|
||||||
Level: number
|
Level: number
|
||||||
MemberCategory: string
|
MemberCategory: MemberCategory
|
||||||
Ignored: boolean
|
Ignored: boolean
|
||||||
Banned: boolean
|
Banned: boolean
|
||||||
}
|
}
|
||||||
|
@ -140,6 +140,14 @@ export class DialogStaticRouter extends StaticRouter
|
|||||||
return this.dialogueCallbacks.sendFriendRequest(url, info, sessionID);
|
return this.dialogueCallbacks.sendFriendRequest(url, info, sessionID);
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
|
new RouteAction(
|
||||||
|
"/client/friend/request/accept",
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
|
(url: string, info: any, sessionID: string, output: string): any =>
|
||||||
|
{
|
||||||
|
return this.dialogueCallbacks.acceptFriendRequest(url, info, sessionID);
|
||||||
|
}
|
||||||
|
),
|
||||||
new RouteAction(
|
new RouteAction(
|
||||||
"/client/friend/delete",
|
"/client/friend/delete",
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
|
@ -68,6 +68,14 @@ export class MatchStaticRouter extends StaticRouter
|
|||||||
return this. matchCallbacks.deleteGroup(url, info, sessionID);
|
return this. matchCallbacks.deleteGroup(url, info, sessionID);
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
|
new RouteAction(
|
||||||
|
"/client/match/group/leave",
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
|
(url: string, info: any, sessionID: string, output: string): any =>
|
||||||
|
{
|
||||||
|
return this. matchCallbacks.leaveGroup(url, info, sessionID);
|
||||||
|
}
|
||||||
|
),
|
||||||
new RouteAction(
|
new RouteAction(
|
||||||
"/client/match/group/status",
|
"/client/match/group/status",
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
@ -140,6 +148,14 @@ export class MatchStaticRouter extends StaticRouter
|
|||||||
return this.matchCallbacks.cancelAllGroupInvite(url, info, sessionID);
|
return this.matchCallbacks.cancelAllGroupInvite(url, info, sessionID);
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
|
new RouteAction(
|
||||||
|
"/client/match/group/transfer",
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
|
(url: string, info: any, sessionID: string, output: string): any =>
|
||||||
|
{
|
||||||
|
return this.matchCallbacks.transferGroup(url, info, sessionID);
|
||||||
|
}
|
||||||
|
),
|
||||||
new RouteAction(
|
new RouteAction(
|
||||||
"/client/match/offline/end",
|
"/client/match/offline/end",
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
|
Loading…
Reference in New Issue
Block a user