Improved accuracy of multiple endpoints

This commit is contained in:
Dev 2024-05-15 14:10:06 +01:00
parent d608e8b690
commit 5d8d6d7185
10 changed files with 146 additions and 21 deletions

View File

@ -32,6 +32,7 @@ import { DialogueInfo } from "@spt-aki/models/eft/profile/IAkiProfile";
import { HashUtil } from "@spt-aki/utils/HashUtil"; import { HashUtil } from "@spt-aki/utils/HashUtil";
import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil";
import { TimeUtil } from "@spt-aki/utils/TimeUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil";
import { ICreateGroupMailRequest } from "@spt-aki/models/eft/dialog/ICreateGroupMailRequest";
@injectable() @injectable()
export class DialogueCallbacks implements OnUpdate export class DialogueCallbacks implements OnUpdate
@ -187,7 +188,7 @@ export class DialogueCallbacks implements OnUpdate
sessionID: string, sessionID: string,
): IGetBodyResponseData<IFriendRequestSendResponse> ): IGetBodyResponseData<IFriendRequestSendResponse>
{ {
return this.httpResponse.getBody({ status: 0, requestId: "12345", retryAfter: 600 }); return this.httpResponse.getBody(this.dialogueController.sendFriendRequest(sessionID, request));
} }
/** /**
@ -271,6 +272,15 @@ export class DialogueCallbacks implements OnUpdate
return this.httpResponse.emptyArrayResponse(); return this.httpResponse.emptyArrayResponse();
} }
public createGroupMail(
url: string,
info: ICreateGroupMailRequest,
sessionID: string
): IGetBodyResponseData<any[]>
{
throw new Error("Method not implemented.");
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
public async onUpdate(timeSinceLastRun: number): Promise<boolean> public async onUpdate(timeSinceLastRun: number): Promise<boolean>
{ {

View File

@ -1,18 +1,15 @@
import { inject, injectable } from "tsyringe"; import { inject, injectable } from "tsyringe";
import { MatchController } from "@spt-aki/controllers/MatchController"; import { MatchController } from "@spt-aki/controllers/MatchController";
import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData"; import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData";
import { IPmcData } from "@spt-aki/models/eft/common/IPmcData";
import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData";
import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData";
import { IAcceptGroupInviteRequest } from "@spt-aki/models/eft/match/IAcceptGroupInviteRequest"; import { IAcceptGroupInviteRequest } from "@spt-aki/models/eft/match/IAcceptGroupInviteRequest";
import { IAcceptGroupInviteResponse } from "@spt-aki/models/eft/match/IAcceptGroupInviteResponse"; import { IAcceptGroupInviteResponse } from "@spt-aki/models/eft/match/IAcceptGroupInviteResponse";
import { ICancelGroupInviteRequest } from "@spt-aki/models/eft/match/ICancelGroupInviteRequest"; import { ICancelGroupInviteRequest } from "@spt-aki/models/eft/match/ICancelGroupInviteRequest";
import { ICreateGroupRequestData } from "@spt-aki/models/eft/match/ICreateGroupRequestData";
import { IDeclineGroupInviteRequest } from "@spt-aki/models/eft/match/IDeclineGroupInviteRequest"; import { IDeclineGroupInviteRequest } from "@spt-aki/models/eft/match/IDeclineGroupInviteRequest";
import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData"; import { IEndOfflineRaidRequestData } from "@spt-aki/models/eft/match/IEndOfflineRaidRequestData";
import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData"; import { IGetGroupStatusRequestData } from "@spt-aki/models/eft/match/IGetGroupStatusRequestData";
import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse"; import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse";
import { IGetProfileRequestData } from "@spt-aki/models/eft/match/IGetProfileRequestData";
import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData"; import { IGetRaidConfigurationRequestData } from "@spt-aki/models/eft/match/IGetRaidConfigurationRequestData";
import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData"; import { IJoinMatchRequestData } from "@spt-aki/models/eft/match/IJoinMatchRequestData";
import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult"; import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult";
@ -24,10 +21,12 @@ import { IUpdatePingRequestData } from "@spt-aki/models/eft/match/IUpdatePingReq
import { DatabaseServer } from "@spt-aki/servers/DatabaseServer"; import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil"; import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil";
import { JsonUtil } from "@spt-aki/utils/JsonUtil"; import { JsonUtil } from "@spt-aki/utils/JsonUtil";
import { IGroupCurrentResponse } from "@spt-aki/models/eft/match/IGroupCurrentResponse";
@injectable() @injectable()
export class MatchCallbacks export class MatchCallbacks
{ {
constructor( constructor(
@inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil, @inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil,
@inject("JsonUtil") protected jsonUtil: JsonUtil, @inject("JsonUtil") protected jsonUtil: JsonUtil,
@ -57,6 +56,15 @@ export class MatchCallbacks
return this.httpResponse.nullResponse(); return this.httpResponse.nullResponse();
} }
public groupCurrent(
url: string,
info: IEmptyRequestData,
sessionID: string
): IGetBodyResponseData<IGroupCurrentResponse>
{
throw new Error("Method not implemented.");
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
public startGroupSearch(url: string, info: IEmptyRequestData, sessionID: string): INullResponseData public startGroupSearch(url: string, info: IEmptyRequestData, sessionID: string): INullResponseData
{ {
@ -81,7 +89,7 @@ export class MatchCallbacks
public acceptGroupInvite( public acceptGroupInvite(
url: string, url: string,
info: IAcceptGroupInviteRequest, info: IAcceptGroupInviteRequest,
sessionID: string, sessionId: string,
): IGetBodyResponseData<IAcceptGroupInviteResponse[]> ): IGetBodyResponseData<IAcceptGroupInviteResponse[]>
{ {
const result = []; const result = [];
@ -95,10 +103,10 @@ export class MatchCallbacks
public declineGroupInvite( public declineGroupInvite(
url: string, url: string,
info: IDeclineGroupInviteRequest, info: IDeclineGroupInviteRequest,
sessionID: string, sessionId: string,
): IGetBodyResponseData<any> ): IGetBodyResponseData<boolean>
{ {
return null; return this.httpResponse.getBody(true);
} }
/** Handle client/match/group/invite/cancel */ /** Handle client/match/group/invite/cancel */
@ -114,28 +122,36 @@ export class MatchCallbacks
/** Handle client/match/group/transfer */ /** Handle client/match/group/transfer */
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
public transferGroup(url: string, info: ITransferGroupRequest, sessionID: string): IGetBodyResponseData<boolean> public transferGroup(
url: string,
info: ITransferGroupRequest,
sessionId: string
): IGetBodyResponseData<boolean>
{ {
return this.httpResponse.getBody(true); return this.httpResponse.getBody(true);
} }
/** Handle client/match/group/invite/cancel-all */ /** Handle client/match/group/invite/cancel-all */
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
public cancelAllGroupInvite(url: string, info: IEmptyRequestData, sessionID: string): INullResponseData public cancelAllGroupInvite(
url: string,
info: IEmptyRequestData,
sessionId: string
): IGetBodyResponseData<boolean>
{ {
return this.httpResponse.nullResponse(); return this.httpResponse.getBody(true);
} }
/** @deprecated - not called on raid start/end or game start/exit */ /** @deprecated - not called on raid start/end or game start/exit */
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
public putMetrics(url: string, info: IPutMetricsRequestData, sessionID: string): INullResponseData public putMetrics(url: string, info: IPutMetricsRequestData, sessionId: string): INullResponseData
{ {
return this.httpResponse.nullResponse(); return this.httpResponse.nullResponse();
} }
// Handle client/match/available // 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<boolean> public serverAvailable(url: string, info: IEmptyRequestData, sessionId: string): IGetBodyResponseData<boolean>
{ {
const output = this.matchController.getEnabled(); const output = this.matchController.getEnabled();
@ -176,10 +192,10 @@ export class MatchCallbacks
/** Handle client/match/group/delete */ /** Handle client/match/group/delete */
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
public deleteGroup(url: string, info: any, sessionID: string): INullResponseData public deleteGroup(url: string, info: any, sessionID: string): IGetBodyResponseData<boolean>
{ {
this.matchController.deleteGroup(info); this.matchController.deleteGroup(info);
return this.httpResponse.nullResponse(); return this.httpResponse.getBody(true);
} }
// Handle client/match/group/leave // Handle client/match/group/leave
@ -191,9 +207,9 @@ export class MatchCallbacks
/** Handle client/match/group/player/remove */ /** Handle client/match/group/player/remove */
// 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): IGetBodyResponseData<boolean>
{ {
return this.httpResponse.nullResponse(); return this.httpResponse.getBody(true);
} }
/** Handle client/match/offline/end */ /** Handle client/match/offline/end */
@ -223,4 +239,24 @@ export class MatchCallbacks
{ {
return this.httpResponse.nullResponse(); return this.httpResponse.nullResponse();
} }
/** Handle client/match/group/raid/ready */
public raidReady(
url: string,
info: IEmptyRequestData,
sessionId: string
): IGetBodyResponseData<boolean>
{
return this.httpResponse.getBody(true);
}
/** Handle client/match/group/raid/not-ready */
public notRaidReady(
url: string,
info: IEmptyRequestData,
sessionId: string
): IGetBodyResponseData<boolean>
{
return this.httpResponse.getBody(true);
}
} }

View File

@ -15,6 +15,8 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer";
import { SaveServer } from "@spt-aki/servers/SaveServer"; import { SaveServer } from "@spt-aki/servers/SaveServer";
import { MailSendService } from "@spt-aki/services/MailSendService"; import { MailSendService } from "@spt-aki/services/MailSendService";
import { TimeUtil } from "@spt-aki/utils/TimeUtil"; import { TimeUtil } from "@spt-aki/utils/TimeUtil";
import { IFriendRequestData } from "@spt-aki/models/eft/dialog/IFriendRequestData";
import { IFriendRequestSendResponse } from "@spt-aki/models/eft/dialog/IFriendRequestSendResponse";
@injectable() @injectable()
export class DialogueController export class DialogueController
@ -449,4 +451,14 @@ export class DialogueController
{ {
return this.timeUtil.getTimestamp() > message.dt + message.maxStorageTime; return this.timeUtil.getTimestamp() > message.dt + message.maxStorageTime;
} }
/** Handle client/friend/request/send */
public sendFriendRequest(
sessionID: string,
request: IFriendRequestData
): IFriendRequestSendResponse
{
return { status: 0, requestId: "12345", retryAfter: 600 }
}
} }

View File

@ -0,0 +1,5 @@
export interface ICreateGroupMailRequest
{
Name: string;
Users: string[];
}

View File

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

View File

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

View File

@ -1,6 +1,6 @@
export interface IJoinMatchRequestData export interface IJoinMatchRequestData
{ {
groupid: string groupId: string
servers: Server[] servers: Server[]
} }

View File

@ -27,4 +27,7 @@ export enum NotificationType
TRADER_SUPPLY = "TraderSupply", TRADER_SUPPLY = "TraderSupply",
TRADER_STANDING = "TraderStanding", TRADER_STANDING = "TraderStanding",
UNLOCK_TRADER = "UnlockTrader", UNLOCK_TRADER = "UnlockTrader",
GROUP_MATCH_RAID_NOT_READY = "groupMatchRaidNotReady",
GROUP_MATCH_RAID_READY = "groupMatchRaidReady"
} }

View File

@ -9,6 +9,7 @@ import { IGetMailDialogViewResponseData } from "@spt-aki/models/eft/dialog/IGetM
import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData"; import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData";
import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData"; import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData";
import { DialogueInfo } from "@spt-aki/models/eft/profile/IAkiProfile"; import { DialogueInfo } from "@spt-aki/models/eft/profile/IAkiProfile";
import { ICreateGroupMailRequest } from "@spt-aki/models/eft/dialog/ICreateGroupMailRequest";
@injectable() @injectable()
export class DialogStaticRouter extends StaticRouter export class DialogStaticRouter extends StaticRouter
@ -160,6 +161,18 @@ export class DialogStaticRouter extends StaticRouter
return this.dialogueCallbacks.clearMail(url, info, sessionID); return this.dialogueCallbacks.clearMail(url, info, sessionID);
}, },
), ),
new RouteAction(
"/client/mail/dialog/group/create",
async (
url: string,
info: ICreateGroupMailRequest,
sessionID: string,
output: string,
): Promise<IGetBodyResponseData<any[]>> =>
{
return this.dialogueCallbacks.createGroupMail(url, info, sessionID);
},
),
new RouteAction( new RouteAction(
"/client/friend/list", "/client/friend/list",
async ( async (

View File

@ -7,6 +7,7 @@ import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullRespons
import { IAcceptGroupInviteResponse } from "@spt-aki/models/eft/match/IAcceptGroupInviteResponse"; import { IAcceptGroupInviteResponse } from "@spt-aki/models/eft/match/IAcceptGroupInviteResponse";
import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse"; import { IGetGroupStatusResponse } from "@spt-aki/models/eft/match/IGetGroupStatusResponse";
import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult"; import { IJoinMatchResult } from "@spt-aki/models/eft/match/IJoinMatchResult";
import { IGroupCurrentResponse } from "@spt-aki/models/eft/match/IGroupCurrentResponse";
@injectable() @injectable()
export class MatchStaticRouter extends StaticRouter export class MatchStaticRouter extends StaticRouter
@ -54,7 +55,7 @@ export class MatchStaticRouter extends StaticRouter
), ),
new RouteAction( new RouteAction(
"/client/match/group/delete", "/client/match/group/delete",
async (url: string, info: any, sessionID: string, output: string): Promise<INullResponseData> => async (url: string, info: any, sessionID: string, output: string): Promise<IGetBodyResponseData<boolean>> =>
{ {
return this.matchCallbacks.deleteGroup(url, info, sessionID); return this.matchCallbacks.deleteGroup(url, info, sessionID);
}, },
@ -102,6 +103,13 @@ export class MatchStaticRouter extends StaticRouter
return this.matchCallbacks.exitToMenu(url, info, sessionID); return this.matchCallbacks.exitToMenu(url, info, sessionID);
}, },
), ),
new RouteAction(
"/client/match/group/current",
async (url: string, info: IEmptyRequestData, sessionID: string, output: string): Promise<IGetBodyResponseData<IGroupCurrentResponse>> =>
{
return this.matchCallbacks.groupCurrent(url, info, sessionID);
},
),
new RouteAction( new RouteAction(
"/client/match/group/looking/start", "/client/match/group/looking/start",
async (url: string, info: any, sessionID: string, output: string): Promise<INullResponseData> => async (url: string, info: any, sessionID: string, output: string): Promise<INullResponseData> =>
@ -166,7 +174,7 @@ export class MatchStaticRouter extends StaticRouter
info: IEmptyRequestData, info: IEmptyRequestData,
sessionID: string, sessionID: string,
output: string, output: string,
): Promise<INullResponseData> => ): Promise<IGetBodyResponseData<boolean>> =>
{ {
return this.matchCallbacks.cancelAllGroupInvite(url, info, sessionID); return this.matchCallbacks.cancelAllGroupInvite(url, info, sessionID);
}, },
@ -183,6 +191,30 @@ export class MatchStaticRouter extends StaticRouter
return this.matchCallbacks.transferGroup(url, info, sessionID); return this.matchCallbacks.transferGroup(url, info, sessionID);
}, },
), ),
new RouteAction(
"/client/match/group/raid/ready",
async (
url: string,
info: any,
sessionID: string,
output: string,
): Promise<IGetBodyResponseData<boolean>> =>
{
return this.matchCallbacks.raidReady(url, info, sessionID);
},
),
new RouteAction(
"/client/match/group/raid/not-ready",
async (
url: string,
info: any,
sessionID: string,
output: string,
): Promise<IGetBodyResponseData<boolean>> =>
{
return this.matchCallbacks.notRaidReady(url, info, sessionID);
},
),
new RouteAction( new RouteAction(
"/client/match/offline/end", "/client/match/offline/end",
async (url: string, info: any, sessionID: string, output: string): Promise<INullResponseData> => async (url: string, info: any, sessionID: string, output: string): Promise<INullResponseData> =>
@ -226,7 +258,7 @@ export class MatchStaticRouter extends StaticRouter
), ),
new RouteAction( new RouteAction(
"/client/match/group/player/remove", "/client/match/group/player/remove",
async (url: string, info: any, sessionID: string, output: string): Promise<INullResponseData> => async (url: string, info: any, sessionID: string, output: string): Promise<IGetBodyResponseData<boolean>> =>
{ {
return this.matchCallbacks.removePlayerFromGroup(url, info, sessionID); return this.matchCallbacks.removePlayerFromGroup(url, info, sessionID);
}, },