Server/project/src/callbacks/InraidCallbacks.ts

84 lines
2.5 KiB
TypeScript
Raw Normal View History

2023-03-03 16:23:46 +01:00
import { inject, injectable } from "tsyringe";
import { InraidController } from "@spt-aki/controllers/InraidController";
import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData";
import { IRegisterPlayerRequestData } from "@spt-aki/models/eft/inRaid/IRegisterPlayerRequestData";
import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData";
import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil";
2023-03-03 16:23:46 +01:00
/**
* Handle client requests
*/
@injectable()
export class InraidCallbacks
{
constructor(
@inject("InraidController") protected inraidController: InraidController,
2023-11-16 02:35:05 +01:00
@inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil,
2023-03-03 16:23:46 +01:00
)
2023-11-16 02:35:05 +01:00
{}
2023-03-03 16:23:46 +01:00
/**
* Handle client/location/getLocalloot
2023-07-15 15:49:25 +02:00
* Store active map in profile + applicationContext
2023-11-16 02:35:05 +01:00
* @param url
2023-03-03 16:23:46 +01:00
* @param info register player request
* @param sessionID Session id
* @returns Null http response
*/
public registerPlayer(url: string, info: IRegisterPlayerRequestData, sessionID: string): INullResponseData
{
this.inraidController.addPlayer(sessionID, info);
return this.httpResponse.nullResponse();
}
/**
* Handle raid/profile/save
2023-11-16 02:35:05 +01:00
* @param url
2023-03-03 16:23:46 +01:00
* @param info Save progress request
* @param sessionID Session id
* @returns Null http response
*/
public saveProgress(url: string, info: ISaveProgressRequestData, sessionID: string): INullResponseData
{
this.inraidController.savePostRaidProgress(info, sessionID);
return this.httpResponse.nullResponse();
}
/**
* Handle singleplayer/settings/raid/endstate
2023-11-16 02:35:05 +01:00
* @returns
2023-03-03 16:23:46 +01:00
*/
public getRaidEndState(): string
{
return this.httpResponse.noBody(this.inraidController.getInraidConfig().MIAOnRaidEnd);
}
/**
* Handle singleplayer/settings/raid/menu
* @returns JSON as string
*/
public getRaidMenuSettings(): string
{
return this.httpResponse.noBody(this.inraidController.getInraidConfig().raidMenuSettings);
}
/**
* Handle singleplayer/settings/weapon/durability
2023-11-16 02:35:05 +01:00
* @returns
2023-03-03 16:23:46 +01:00
*/
public getWeaponDurability(): string
{
return this.httpResponse.noBody(this.inraidController.getInraidConfig().save.durability);
}
/**
* Handle singleplayer/airdrop/config
* @returns JSON as string
*/
public getAirdropConfig(): string
{
return this.httpResponse.noBody(this.inraidController.getAirdropConfig());
}
2023-11-16 02:35:05 +01:00
}