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 { OnUpdate } from "../di/OnUpdate";
|
||||
import { IEmptyRequestData } from "../models/eft/common/IEmptyRequestData";
|
||||
import { IAcceptFriendRequestData } from "../models/eft/dialog/IAcceptFriendRequestData";
|
||||
import { IChatServer } from "../models/eft/dialog/IChatServer";
|
||||
import { IClearMailMessageRequest } from "../models/eft/dialog/IClearMailMessageRequest";
|
||||
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});
|
||||
}
|
||||
|
||||
// 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
|
||||
public deleteFriend(url: string, request: IDeleteFriendRequest, sessionID: string): INullResponseData
|
||||
{
|
||||
|
@ -82,6 +82,7 @@ class GameCallbacks
|
||||
return this.httpResponse.getBody(this.gameController.getServer());
|
||||
}
|
||||
|
||||
// Handle client/match/group/current
|
||||
public getCurrentGroup(url: string, info: IEmptyRequestData, sessionID: string): any
|
||||
{
|
||||
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 { IRemovePlayerFromGroupRequest } from "../models/eft/match/IRemovePlayerFromGroupRequest";
|
||||
import { ISendGroupInviteRequest } from "../models/eft/match/ISendGroupInviteRequest";
|
||||
import { ITransferGroupRequest } from "../models/eft/match/ITransferGroupRequest";
|
||||
import { IUpdatePingRequestData } from "../models/eft/match/IUpdatePingRequestData";
|
||||
import { DatabaseServer } from "../servers/DatabaseServer";
|
||||
import { HttpResponseUtil } from "../utils/HttpResponseUtil";
|
||||
@ -42,6 +43,7 @@ export class MatchCallbacks
|
||||
return this.httpResponse.nullResponse();
|
||||
}
|
||||
|
||||
// Handle client/match/exit
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public exitMatch(url: string, info: IEmptyRequestData, sessionID: string): INullResponseData
|
||||
{
|
||||
@ -88,6 +90,12 @@ export class MatchCallbacks
|
||||
{
|
||||
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
|
||||
public cancelAllGroupInvite(url: string, info: any, sessionID: string): INullResponseData
|
||||
@ -107,8 +115,9 @@ export class MatchCallbacks
|
||||
return this.httpResponse.getBody(this.matchController.getProfile(info));
|
||||
}
|
||||
|
||||
// Handle client/match/available
|
||||
// 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();
|
||||
|
||||
@ -120,7 +129,8 @@ export class MatchCallbacks
|
||||
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));
|
||||
}
|
||||
@ -153,6 +163,13 @@ export class MatchCallbacks
|
||||
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
|
||||
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 { BodyPartHealth } from "../models/eft/common/tables/IBotBase";
|
||||
import { ICheckVersionResponse } from "../models/eft/game/ICheckVersionResponse";
|
||||
import { ICurrentGroupResponse } from "../models/eft/game/ICurrentGroupResponse";
|
||||
import { IGameConfigResponse } from "../models/eft/game/IGameConfigResponse";
|
||||
import { IServerDetails } from "../models/eft/game/IServerDetails";
|
||||
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 {
|
||||
squad: [],
|
||||
raidSettings: {}
|
||||
squad: []
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -82,54 +82,39 @@ export class MatchController
|
||||
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[] = [];
|
||||
|
||||
// --- 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}`;
|
||||
const output: IJoinMatchResult = {
|
||||
maxPveCountExceeded: false,
|
||||
profiles: []
|
||||
};
|
||||
|
||||
// get list of players joining into the match
|
||||
output.push({
|
||||
"profileid": profileID,
|
||||
"status": "busy",
|
||||
output.profiles.push({
|
||||
"profileid": "TODO",
|
||||
profileToken: "TODO",
|
||||
"status": "MatchWait",
|
||||
"sid": "",
|
||||
"ip": match.ip,
|
||||
"port": match.port,
|
||||
"ip": "",
|
||||
"port": 0,
|
||||
"version": "live",
|
||||
"location": info.location,
|
||||
"location": "TODO get location",
|
||||
raidMode: "Online",
|
||||
"mode": "deathmatch",
|
||||
"shortid": match.id,
|
||||
"shortid": null,
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
additional_info: undefined
|
||||
additional_info: null
|
||||
});
|
||||
|
||||
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
|
||||
public getGroupStatus(info: IGetGroupStatusRequestData): any
|
||||
{
|
||||
return {
|
||||
"players": [],
|
||||
"invite": [],
|
||||
"group": []
|
||||
maxPveCountExceeded: false
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -328,7 +328,7 @@ export interface LastPlayerStateInfo
|
||||
Nickname: string
|
||||
Side: string
|
||||
Level: number
|
||||
MemberCategory: string
|
||||
MemberCategory: MemberCategory
|
||||
}
|
||||
|
||||
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
|
||||
keyId: string
|
||||
raidMode: RaidMode
|
||||
startInGroup: boolean
|
||||
spawnPlace: string
|
||||
}
|
@ -1,10 +1,7 @@
|
||||
export interface IJoinMatchRequestData
|
||||
{
|
||||
location: string
|
||||
savage: boolean
|
||||
dt: string
|
||||
groupid: string
|
||||
servers: Server[]
|
||||
keyId: string
|
||||
}
|
||||
|
||||
export interface Server
|
||||
|
@ -1,6 +1,13 @@
|
||||
export interface IJoinMatchResult
|
||||
{
|
||||
maxPveCountExceeded: boolean
|
||||
profiles: IJoinMatchPlayerProfile[]
|
||||
}
|
||||
|
||||
export interface IJoinMatchPlayerProfile
|
||||
{
|
||||
profileid: string
|
||||
profileToken: string
|
||||
status: string
|
||||
sid: 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
|
||||
Side: string
|
||||
Level: number
|
||||
MemberCategory: string
|
||||
MemberCategory: MemberCategory
|
||||
Ignored: boolean
|
||||
Banned: boolean
|
||||
}
|
||||
|
@ -140,6 +140,14 @@ export class DialogStaticRouter extends StaticRouter
|
||||
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(
|
||||
"/client/friend/delete",
|
||||
// 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);
|
||||
}
|
||||
),
|
||||
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(
|
||||
"/client/match/group/status",
|
||||
// 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);
|
||||
}
|
||||
),
|
||||
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(
|
||||
"/client/match/offline/end",
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
|
Loading…
Reference in New Issue
Block a user