2024-05-07 23:57:08 -04:00
|
|
|
import { inject, injectable } from "tsyringe";
|
2024-05-21 17:59:04 +00:00
|
|
|
import { BuildController } from "@spt/controllers/BuildController";
|
|
|
|
import { ISetMagazineRequest } from "@spt/models/eft/builds/ISetMagazineRequest";
|
|
|
|
import { IEmptyRequestData } from "@spt/models/eft/common/IEmptyRequestData";
|
|
|
|
import { IGetBodyResponseData } from "@spt/models/eft/httpResponse/IGetBodyResponseData";
|
|
|
|
import { INullResponseData } from "@spt/models/eft/httpResponse/INullResponseData";
|
|
|
|
import { IPresetBuildActionRequestData } from "@spt/models/eft/presetBuild/IPresetBuildActionRequestData";
|
|
|
|
import { IRemoveBuildRequestData } from "@spt/models/eft/presetBuild/IRemoveBuildRequestData";
|
|
|
|
import { IUserBuilds } from "@spt/models/eft/profile/ISptProfile";
|
|
|
|
import { HttpResponseUtil } from "@spt/utils/HttpResponseUtil";
|
2023-12-27 15:05:07 +00:00
|
|
|
|
|
|
|
@injectable()
|
|
|
|
export class BuildsCallbacks
|
|
|
|
{
|
|
|
|
constructor(
|
|
|
|
@inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil,
|
2023-12-27 20:19:17 +00:00
|
|
|
@inject("BuildController") protected buildController: BuildController,
|
2023-12-27 15:05:07 +00:00
|
|
|
)
|
|
|
|
{}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handle client/builds/list
|
|
|
|
*/
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
2023-12-27 20:19:17 +00:00
|
|
|
public getBuilds(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IUserBuilds>
|
2023-12-27 15:05:07 +00:00
|
|
|
{
|
2023-12-27 20:19:17 +00:00
|
|
|
return this.httpResponse.getBody(this.buildController.getUserBuilds(sessionID));
|
2023-12-27 15:05:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handle client/builds/magazine/save
|
|
|
|
*/
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
2023-12-28 12:19:52 +00:00
|
|
|
public createMagazineTemplate(url: string, request: ISetMagazineRequest, sessionID: string): INullResponseData
|
2023-12-27 15:05:07 +00:00
|
|
|
{
|
2024-02-02 13:54:07 -05:00
|
|
|
this.buildController.createMagazineTemplate(sessionID, request);
|
2023-12-28 12:02:37 +00:00
|
|
|
|
2023-12-28 12:19:52 +00:00
|
|
|
return this.httpResponse.nullResponse();
|
2023-12-27 15:05:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handle client/builds/weapon/save
|
|
|
|
*/
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
2024-01-06 11:11:04 +00:00
|
|
|
public setWeapon(url: string, info: IPresetBuildActionRequestData, sessionID: string): INullResponseData
|
2023-12-27 15:05:07 +00:00
|
|
|
{
|
2024-01-06 11:11:04 +00:00
|
|
|
this.buildController.saveWeaponBuild(sessionID, info);
|
|
|
|
|
|
|
|
return this.httpResponse.nullResponse();
|
2023-12-27 15:05:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handle client/builds/equipment/save
|
|
|
|
*/
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
2024-01-06 11:11:04 +00:00
|
|
|
public setEquipment(url: string, info: IPresetBuildActionRequestData, sessionID: string): INullResponseData
|
2023-12-27 15:05:07 +00:00
|
|
|
{
|
2024-01-06 11:11:04 +00:00
|
|
|
this.buildController.saveEquipmentBuild(sessionID, info);
|
|
|
|
|
|
|
|
return this.httpResponse.nullResponse();
|
2023-12-27 15:05:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handle client/builds/delete
|
|
|
|
*/
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
2024-01-06 11:11:04 +00:00
|
|
|
public deleteBuild(url: string, info: IRemoveBuildRequestData, sessionID: string): INullResponseData
|
2023-12-27 15:05:07 +00:00
|
|
|
{
|
2024-01-06 11:11:04 +00:00
|
|
|
this.buildController.removeBuild(sessionID, info);
|
|
|
|
|
|
|
|
return this.httpResponse.nullResponse();
|
2023-12-27 15:05:07 +00:00
|
|
|
}
|
2023-12-27 20:22:53 +00:00
|
|
|
}
|