Add missing types for handled match routes

This commit is contained in:
TheSparta 2024-05-15 23:40:32 +01:00
parent 2696a2dff2
commit 9d127cbb6c
33 changed files with 210 additions and 238 deletions

View File

@ -3,21 +3,19 @@ import { MatchController } from "@spt-aki/controllers/MatchController";
import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData";
import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData";
import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData";
import { IAcceptGroupInviteRequest } from "@spt-aki/models/eft/match/IAcceptGroupInviteRequest";
import { IAcceptGroupInviteResponse } from "@spt-aki/models/eft/match/IAcceptGroupInviteResponse";
import { ICancelGroupInviteRequest } from "@spt-aki/models/eft/match/ICancelGroupInviteRequest";
import { IDeclineGroupInviteRequest } from "@spt-aki/models/eft/match/IDeclineGroupInviteRequest";
import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData";
import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData";
import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse";
import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData";
import { IGroupCurrentResponse } from "@spt-aki/models/eft/match/IGroupCurrentResponse";
import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData";
import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult";
import { IGroupCharacter } from "@spt-aki/models/eft/match/IGroupCharacter";
import { IMatchGroupCurrentResponse } from "@spt-aki/models/eft/match/IMatchGroupCurrentResponse";
import { IMatchGroupInviteSendRequest } from "@spt-aki/models/eft/match/IMatchGroupInviteSendRequest";
import { IMatchGroupPlayerRemoveRequest } from "@spt-aki/models/eft/match/IMatchGroupPlayerRemoveRequest";
import { IMatchGroupStartGameRequest } from "@spt-aki/models/eft/match/IMatchGroupStartGameRequest";
import { IMatchGroupStatusRequest } from "@spt-aki/models/eft/match/IMatchGroupStatusRequest";
import { IMatchGroupStatusResponse } from "@spt-aki/models/eft/match/IMatchGroupStatusResponse";
import { IMatchGroupTransferRequest } from "@spt-aki/models/eft/match/IMatchGroupTransferRequest";
import { IProfileStatusResponse } from "@spt-aki/models/eft/match/IProfileStatusResponse";
import { IPutMetricsRequestData } from "@spt-aki/models/eft/match/IPutMetricsRequestData";
import { IRemovePlayerFromGroupRequest } from "@spt-aki/models/eft/match/IRemovePlayerFromGroupRequest";
import { ISendGroupInviteRequest } from "@spt-aki/models/eft/match/ISendGroupInviteRequest";
import { ITransferGroupRequest } from "@spt-aki/models/eft/match/ITransferGroupRequest";
import { IRequestIdRequest } from "@spt-aki/models/eft/match/IRequestIdRequest";
import { IUpdatePingRequestData } from "@spt-aki/models/eft/match/IUpdatePingRequestData";
import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil";
@ -59,7 +57,7 @@ export class MatchCallbacks
url: string,
info: IEmptyRequestData,
sessionID: string,
): IGetBodyResponseData<IGroupCurrentResponse>
): IGetBodyResponseData<IMatchGroupCurrentResponse>
{
throw new Error("Method not implemented.");
}
@ -78,7 +76,11 @@ export class MatchCallbacks
/** Handle client/match/group/invite/send */
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public sendGroupInvite(url: string, info: ISendGroupInviteRequest, sessionID: string): IGetBodyResponseData<string>
public sendGroupInvite(
url: string,
info: IMatchGroupInviteSendRequest,
sessionID: string,
): IGetBodyResponseData<string>
{
return this.httpResponse.getBody("2427943f23698ay9f2863735");
}
@ -87,9 +89,9 @@ export class MatchCallbacks
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public acceptGroupInvite(
url: string,
info: IAcceptGroupInviteRequest,
info: IRequestIdRequest,
sessionId: string,
): IGetBodyResponseData<IAcceptGroupInviteResponse[]>
): IGetBodyResponseData<IGroupCharacter[]>
{
const result = [];
result.push({});
@ -101,7 +103,7 @@ export class MatchCallbacks
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public declineGroupInvite(
url: string,
info: IDeclineGroupInviteRequest,
info: IRequestIdRequest,
sessionId: string,
): IGetBodyResponseData<boolean>
{
@ -112,7 +114,7 @@ export class MatchCallbacks
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public cancelGroupInvite(
url: string,
info: ICancelGroupInviteRequest,
info: IRequestIdRequest,
sessionID: string,
): IGetBodyResponseData<boolean>
{
@ -123,7 +125,7 @@ export class MatchCallbacks
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public transferGroup(
url: string,
info: ITransferGroupRequest,
info: IMatchGroupTransferRequest,
sessionId: string,
): IGetBodyResponseData<boolean>
{
@ -160,9 +162,9 @@ export class MatchCallbacks
/** Handle match/group/start_game */
public joinMatch(
url: string,
info: IJoinMatchRequestData,
info: IMatchGroupStartGameRequest,
sessionID: string,
): IGetBodyResponseData<IJoinMatchResult>
): IGetBodyResponseData<IProfileStatusResponse>
{
return this.httpResponse.getBody(this.matchController.joinMatch(info, sessionID));
}
@ -182,16 +184,16 @@ export class MatchCallbacks
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public getGroupStatus(
url: string,
info: IGetGroupStatusRequestData,
info: IMatchGroupStatusRequest,
sessionID: string,
): IGetBodyResponseData<IGetGroupStatusResponse>
): IGetBodyResponseData<IMatchGroupStatusResponse>
{
return this.httpResponse.getBody(this.matchController.getGroupStatus(info));
}
/** Handle client/match/group/delete */
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public deleteGroup(url: string, info: any, sessionID: string): IGetBodyResponseData<boolean>
public deleteGroup(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<boolean>
{
this.matchController.deleteGroup(info);
return this.httpResponse.getBody(true);
@ -208,7 +210,7 @@ export class MatchCallbacks
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public removePlayerFromGroup(
url: string,
info: IRemovePlayerFromGroupRequest,
info: IMatchGroupPlayerRemoveRequest,
sessionID: string,
): IGetBodyResponseData<boolean>
{

View File

@ -7,11 +7,11 @@ import { TraderHelper } from "@spt-aki/helpers/TraderHelper";
import { IPmcData } from "@spt-aki/models/eft/common/IPmcData";
import { Item } from "@spt-aki/models/eft/common/tables/IItem";
import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData";
import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData";
import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse";
import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData";
import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData";
import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult";
import { IMatchGroupStartGameRequest } from "@spt-aki/models/eft/match/IMatchGroupStartGameRequest";
import { IMatchGroupStatusRequest } from "@spt-aki/models/eft/match/IMatchGroupStatusRequest";
import { IMatchGroupStatusResponse } from "@spt-aki/models/eft/match/IMatchGroupStatusResponse";
import { IProfileStatusResponse } from "@spt-aki/models/eft/match/IProfileStatusResponse";
import { ConfigTypes } from "@spt-aki/models/enums/ConfigTypes";
import { MessageType } from "@spt-aki/models/enums/MessageType";
import { Traders } from "@spt-aki/models/enums/Traders";
@ -76,9 +76,9 @@ export class MatchController
/** Handle match/group/start_game */
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public joinMatch(info: IJoinMatchRequestData, sessionId: string): IJoinMatchResult
public joinMatch(info: IMatchGroupStartGameRequest, sessionId: string): IProfileStatusResponse
{
const output: IJoinMatchResult = { maxPveCountExceeded: false, profiles: [] };
const output: IProfileStatusResponse = { maxPveCountExceeded: false, profiles: [] };
// get list of players joining into the match
output.profiles.push({
@ -92,7 +92,7 @@ export class MatchController
location: "TODO get location",
raidMode: "Online",
mode: "deathmatch",
shortid: null,
shortId: null,
// eslint-disable-next-line @typescript-eslint/naming-convention
additional_info: null,
});
@ -102,7 +102,7 @@ export class MatchController
/** Handle client/match/group/status */
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public getGroupStatus(info: IGetGroupStatusRequestData): IGetGroupStatusResponse
public getGroupStatus(info: IMatchGroupStatusRequest): IMatchGroupStatusResponse
{
return { players: [], maxPveCountExceeded: false };
}

View File

@ -1,4 +0,0 @@
export interface IAcceptGroupInviteRequest
{
requestId: string
}

View File

@ -1,19 +0,0 @@
export interface IAcceptGroupInviteResponse
{
_id: string
aid: number
Info: PlayerInviteInfo
isLeader: boolean
isReady: boolean
}
export interface PlayerInviteInfo
{
Nickname: string
Side: string
Level: number
MemberCategory: number
GameVersion: string
SavageLockTime: number
SavageNickname: string
}

View File

@ -1,4 +0,0 @@
export interface ICancelGroupInviteRequest
{
requestId: string
}

View File

@ -1,8 +0,0 @@
import { RaidMode } from "@spt-aki/models/enums/RaidMode";
export interface ICreateGroupRequestData
{
location: string
raidMode: RaidMode
startInGroup: boolean
}

View File

@ -1,4 +0,0 @@
export interface IDeclineGroupInviteRequest
{
requestId: string;
}

View File

@ -1,25 +0,0 @@
import { MemberCategory } from "@spt-aki/models/enums/MemberCategory";
export interface IGetGroupStatusResponse
{
players: IPlayer[]
maxPveCountExceeded: boolean
}
export interface IPlayer
{
aid: string
_id: string
lookingGroup: boolean
IsLeader: boolean
IsReady: boolean
Info: ICurrentGroupMemberInfo
}
export interface ICurrentGroupMemberInfo
{
Nickname: string
Side: string
Level: string
MemberCategory: MemberCategory
}

View File

@ -1,4 +0,0 @@
export interface IGetProfileRequestData
{
profileId: string
}

View File

@ -1,71 +1,8 @@
export interface IGetRaidConfigurationRequestData
import { IRaidSettings } from "@spt-aki/models/eft/match/IRaidSettings";
export interface IGetRaidConfigurationRequestData extends IRaidSettings
{
keyId: string
side: string
location: string
timeVariant: string
raidMode: string
metabolismDisabled: boolean
playersSpawnPlace: string
timeAndWeatherSettings: TimeAndWeatherSettings
botSettings: BotSettings
wavesSettings: WavesSettings
CanShowGroupPreview: boolean
MaxGroupCount: number
}
// {
// keyId: "",
// side: "Pmc",
// location: "factory4_day",
// timeVariant: "CURR", or "PAST"
// raidMode: "Local",
// metabolismDisabled: false,
// playersSpawnPlace: "SamePlace",
// timeAndWeatherSettings: {
// isRandomTime: false,
// isRandomWeather: false,
// cloudinessType: "Clear",
// rainType: "NoRain",
// windType: "Light",
// fogType: "NoFog",
// timeFlowType: "x1",
// hourOfDay: -1
// },
// botSettings: {
// isScavWars: false,
// botAmount: "AsOnline"
// },
// wavesSettings: {
// botAmount: "AsOnline",
// botDifficulty: "AsOnline",
// isBosses: true,
// isTaggedAndCursed: false
// }
// }
export interface TimeAndWeatherSettings
{
isRandomTime: boolean
isRandomWeather: boolean
cloudinessType: string
rainType: string
windType: string
fogType: string
timeFlowType: string
hourOfDay: number
}
export interface BotSettings
{
isScavWars: boolean
botAmount: string
}
export interface WavesSettings
{
botAmount: string
botDifficulty: string
isBosses: boolean
isTaggedAndCursed: boolean
}

View File

@ -0,0 +1,41 @@
import { Item } from "@spt-aki/models/eft/common/tables/IItem";
import { MemberCategory } from "@spt-aki/models/enums/MemberCategory";
export interface IGroupCharacter
{
_id: string
aid: number
Info: {
Nickname: string
Side: string
Level: number
MemberCategory: MemberCategory
GameVersion?: string
SavageLockTime?: number
SavageNickname?: string
hasCoopExtension?: boolean
}
PlayerVisualRepresentation?: {
Info: {
Side: string
Level: number
Nickname: string
MemberCategory: MemberCategory
GameVersion: string
}
Customization: {
Head: string
Body: string
Feet: string
Hands: string
}
Equipment: {
Id: string
Items: Item[]
}
}
isLeader: boolean
isReady?: boolean
region?: string
lookingGroup?: boolean
}

View File

@ -1,13 +0,0 @@
export interface IGroupCurrentResponse
{
squad: ISquadMember[]
}
export interface ISquadMember
{
_id: string
aid: number
Info: any
isLeader: boolean
isReady: boolean
}

View File

@ -1,12 +0,0 @@
export interface IJoinMatchRequestData
{
groupId: string
servers: Server[]
}
export interface Server
{
ping: number
ip: string
port: string
}

View File

@ -1,21 +0,0 @@
export interface IJoinMatchResult
{
maxPveCountExceeded: boolean
profiles: IJoinMatchPlayerProfile[]
}
export interface IJoinMatchPlayerProfile
{
profileid: string
profileToken: string
status: string
sid: string
ip: string
port: number
version: string
location: string
raidMode: string
mode: string
shortid: string
additional_info: any[]
}

View File

@ -0,0 +1,6 @@
import { IGroupCharacter } from "@spt-aki/models/eft/match/IGroupCharacter";
export interface IMatchGroupCurrentResponse
{
squad: IGroupCharacter[]
}

View File

@ -0,0 +1,5 @@
export interface IMatchGroupInviteSendRequest
{
to: string
inLobby: boolean
}

View File

@ -0,0 +1,4 @@
export interface IMatchGroupPlayerRemoveRequest
{
aidToKick: string
}

View File

@ -0,0 +1,7 @@
import { IServer } from "@spt-aki/models/eft/match/IServer";
export interface IMatchGroupStartGameRequest
{
groupId: string
servers: IServer[]
}

View File

@ -1,6 +1,6 @@
import { RaidMode } from "@spt-aki/models/enums/RaidMode";
export interface IGetGroupStatusRequestData
export interface IMatchGroupStatusRequest
{
location: string
savage: boolean

View File

@ -0,0 +1,7 @@
import { IGroupCharacter } from "@spt-aki/models/eft/match/IGroupCharacter";
export interface IMatchGroupStatusResponse
{
players: IGroupCharacter[]
maxPveCountExceeded: boolean
}

View File

@ -0,0 +1,4 @@
export interface IMatchGroupTransferRequest
{
aidToChange: string
}

View File

@ -0,0 +1,4 @@
export interface IProfileStatusRequest
{
groupId: number
}

View File

@ -0,0 +1,7 @@
import { ISessionStatus } from "@spt-aki/models/eft/match/ISessionStatus";
export interface IProfileStatusResponse
{
maxPveCountExceeded: boolean
profiles: ISessionStatus[]
}

View File

@ -0,0 +1,50 @@
import { DateTime } from "@spt-aki/models/enums/DateTime";
import { PlayersSpawnPlace } from "@spt-aki/models/enums/PlayersSpawnPlace";
import { RaidMode } from "@spt-aki/models/enums/RaidMode";
import { BotAmount } from "@spt-aki/models/enums/RaidSettings/BotAmount";
import { BotDifficulty } from "@spt-aki/models/enums/RaidSettings/BotDifficulty";
import { CloudinessType } from "@spt-aki/models/enums/RaidSettings/TimeAndWeather/CloudinessType";
import { FogType } from "@spt-aki/models/enums/RaidSettings/TimeAndWeather/FogType";
import { RainType } from "@spt-aki/models/enums/RaidSettings/TimeAndWeather/RainType";
import { TimeFlowType } from "@spt-aki/models/enums/RaidSettings/TimeAndWeather/TimeFlowType";
import { WindSpeed } from "@spt-aki/models/enums/RaidSettings/TimeAndWeather/WindSpeed";
import { SideType } from "@spt-aki/models/enums/SideType";
export interface IRaidSettings
{
location: string
timeVariant: DateTime
raidMode: RaidMode
metabolismDisabled: boolean
playersSpawnPlace: PlayersSpawnPlace
timeAndWeatherSettings: TimeAndWeatherSettings
botSettings: BotSettings
wavesSettings: WavesSettings
side: SideType
}
export interface TimeAndWeatherSettings
{
isRandomTime: boolean
isRandomWeather: boolean
cloudinessType: CloudinessType
rainType: RainType
fogType: FogType
windType: WindSpeed
timeFlowType: TimeFlowType
hourOfDay: number
}
export interface BotSettings
{
isScavWars: boolean
botAmount: BotAmount
}
export interface WavesSettings
{
botAmount: BotAmount
botDifficulty: BotDifficulty
isBosses: boolean
isTaggedAndCursed: boolean
}

View File

@ -1,4 +0,0 @@
export interface IRemovePlayerFromGroupRequest
{
aidToKick: string
}

View File

@ -0,0 +1,4 @@
export interface IRequestIdRequest
{
requestId: string
}

View File

@ -1,5 +0,0 @@
export interface ISendGroupInviteRequest
{
to: string
inLobby: boolean
}

View File

@ -0,0 +1,6 @@
export interface IServer
{
ping: number
ip: string
port: number
}

View File

@ -0,0 +1,16 @@
export interface ISessionStatus
{
profileid: string
profileToken: string
status: string
ip: string
port: number
sid: string
version?: string
location?: string
raidMode?: string
mode?: string
shortId?: string
// eslint-disable-next-line @typescript-eslint/naming-convention
additional_info?: any[]
}

View File

@ -1,4 +0,0 @@
export interface ITransferGroupRequest
{
aidToChange: string
}

View File

@ -45,5 +45,5 @@ export enum NotificationType
FRIEND_LIST_NEW_REQUEST = "friendListNewRequest",
FRIEND_LIST_REMOVED_FROM_FRIEND_LIST = "youAreRemovedFromFriendList",
YOU_ARE_ADDED_TO_IGNORE_LIST = "YouWereAddedToIgnoreList",
YOU_ARE_REMOVED_FROM_IGNORE_LIST = "youAreRemoveFromIgnoreList"
YOU_ARE_REMOVED_FROM_IGNORE_LIST = "youAreRemoveFromIgnoreList",
}

View File

@ -4,10 +4,10 @@ import { RouteAction, StaticRouter } from "@spt-aki/di/Router";
import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData";
import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData";
import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData";
import { IAcceptGroupInviteResponse } from "@spt-aki/models/eft/match/IAcceptGroupInviteResponse";
import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse";
import { IGroupCurrentResponse } from "@spt-aki/models/eft/match/IGroupCurrentResponse";
import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult";
import { IGroupCharacter } from "@spt-aki/models/eft/match/IGroupCharacter";
import { IMatchGroupCurrentResponse } from "@spt-aki/models/eft/match/IMatchGroupCurrentResponse";
import { IMatchGroupStatusResponse } from "@spt-aki/models/eft/match/IMatchGroupStatusResponse";
import { IProfileStatusResponse } from "@spt-aki/models/eft/match/IProfileStatusResponse";
@injectable()
export class MatchStaticRouter extends StaticRouter
@ -41,7 +41,7 @@ export class MatchStaticRouter extends StaticRouter
info: any,
sessionID: string,
output: string,
): Promise<IGetBodyResponseData<IJoinMatchResult>> =>
): Promise<IGetBodyResponseData<IProfileStatusResponse>> =>
{
return this.matchCallbacks.joinMatch(url, info, sessionID);
},
@ -84,7 +84,7 @@ export class MatchStaticRouter extends StaticRouter
info: any,
sessionID: string,
output: string,
): Promise<IGetBodyResponseData<IGetGroupStatusResponse>> =>
): Promise<IGetBodyResponseData<IMatchGroupStatusResponse>> =>
{
return this.matchCallbacks.getGroupStatus(url, info, sessionID);
},
@ -96,7 +96,7 @@ export class MatchStaticRouter extends StaticRouter
info: any,
sessionID: string,
output: string,
): Promise<IGetBodyResponseData<IJoinMatchResult>> =>
): Promise<IGetBodyResponseData<IProfileStatusResponse>> =>
{
return this.matchCallbacks.joinMatch(url, info, sessionID);
},
@ -115,7 +115,7 @@ export class MatchStaticRouter extends StaticRouter
info: IEmptyRequestData,
sessionID: string,
output: string,
): Promise<IGetBodyResponseData<IGroupCurrentResponse>> =>
): Promise<IGetBodyResponseData<IMatchGroupCurrentResponse>> =>
{
return this.matchCallbacks.groupCurrent(url, info, sessionID);
},
@ -153,7 +153,7 @@ export class MatchStaticRouter extends StaticRouter
info: any,
sessionID: string,
output: string,
): Promise<IGetBodyResponseData<IAcceptGroupInviteResponse[]>> =>
): Promise<IGetBodyResponseData<IGroupCharacter[]>> =>
{
return this.matchCallbacks.acceptGroupInvite(url, info, sessionID);
},

View File

@ -1,5 +1,4 @@
import { inject, injectable } from "tsyringe";
import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData";
import { SaveServer } from "@spt-aki/servers/SaveServer";
import { TimeUtil } from "@spt-aki/utils/TimeUtil";