2023-03-03 16:23:46 +01:00
|
|
|
import { inject, injectable } from "tsyringe";
|
|
|
|
|
2023-10-19 19:21:17 +02:00
|
|
|
import { PresetBuildController } from "@spt-aki/controllers/PresetBuildController";
|
|
|
|
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 { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse";
|
|
|
|
import { IPresetBuildActionRequestData } from "@spt-aki/models/eft/presetBuild/IPresetBuildActionRequestData";
|
|
|
|
import { IRemoveBuildRequestData } from "@spt-aki/models/eft/presetBuild/IRemoveBuildRequestData";
|
|
|
|
import { IUserBuilds } from "@spt-aki/models/eft/profile/IAkiProfile";
|
|
|
|
import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil";
|
2023-03-03 16:23:46 +01:00
|
|
|
|
|
|
|
@injectable()
|
|
|
|
export class PresetBuildCallbacks
|
|
|
|
{
|
|
|
|
constructor(
|
|
|
|
@inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil,
|
2023-11-16 22:42:06 +01:00
|
|
|
@inject("PresetBuildController") protected presetBuildController: PresetBuildController,
|
|
|
|
)
|
|
|
|
{}
|
2023-03-03 16:23:46 +01:00
|
|
|
|
2023-07-15 15:49:25 +02:00
|
|
|
/** Handle client/handbook/builds/my/list */
|
2023-11-16 22:42:06 +01:00
|
|
|
public getHandbookUserlist(
|
|
|
|
url: string,
|
|
|
|
info: IEmptyRequestData,
|
|
|
|
sessionID: string,
|
|
|
|
): IGetBodyResponseData<IUserBuilds>
|
2023-03-03 16:23:46 +01:00
|
|
|
{
|
|
|
|
return this.httpResponse.getBody(this.presetBuildController.getUserBuilds(sessionID));
|
|
|
|
}
|
|
|
|
|
2023-10-10 13:03:20 +02:00
|
|
|
/** Handle SaveWeaponBuild event */
|
2023-11-16 22:42:06 +01:00
|
|
|
public saveWeaponBuild(
|
|
|
|
pmcData: IPmcData,
|
|
|
|
body: IPresetBuildActionRequestData,
|
|
|
|
sessionID: string,
|
|
|
|
): IItemEventRouterResponse
|
2023-03-03 16:23:46 +01:00
|
|
|
{
|
2023-10-10 13:03:20 +02:00
|
|
|
return this.presetBuildController.saveWeaponBuild(pmcData, body, sessionID);
|
2023-03-03 16:23:46 +01:00
|
|
|
}
|
|
|
|
|
2023-10-10 13:03:20 +02:00
|
|
|
/** Handle removeBuild event*/
|
|
|
|
public removeBuild(pmcData: IPmcData, body: IRemoveBuildRequestData, sessionID: string): IItemEventRouterResponse
|
2023-03-03 16:23:46 +01:00
|
|
|
{
|
|
|
|
return this.presetBuildController.removeBuild(pmcData, body, sessionID);
|
|
|
|
}
|
2023-10-10 13:03:20 +02:00
|
|
|
|
|
|
|
/** Handle RemoveWeaponBuild event*/
|
2023-11-16 22:42:06 +01:00
|
|
|
public removeWeaponBuild(
|
|
|
|
pmcData: IPmcData,
|
|
|
|
body: IPresetBuildActionRequestData,
|
|
|
|
sessionID: string,
|
|
|
|
): IItemEventRouterResponse
|
2023-10-10 13:03:20 +02:00
|
|
|
{
|
|
|
|
return this.presetBuildController.removeWeaponBuild(pmcData, body, sessionID);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Handle SaveEquipmentBuild event */
|
2023-11-16 22:42:06 +01:00
|
|
|
public saveEquipmentBuild(
|
|
|
|
pmcData: IPmcData,
|
|
|
|
body: IPresetBuildActionRequestData,
|
|
|
|
sessionID: string,
|
|
|
|
): IItemEventRouterResponse
|
2023-10-10 13:03:20 +02:00
|
|
|
{
|
|
|
|
return this.presetBuildController.saveEquipmentBuild(pmcData, body, sessionID);
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Handle RemoveEquipmentBuild event*/
|
2023-11-16 22:42:06 +01:00
|
|
|
public removeEquipmentBuild(
|
|
|
|
pmcData: IPmcData,
|
|
|
|
body: IPresetBuildActionRequestData,
|
|
|
|
sessionID: string,
|
|
|
|
): IItemEventRouterResponse
|
2023-10-10 13:03:20 +02:00
|
|
|
{
|
|
|
|
return this.presetBuildController.removeEquipmentBuild(pmcData, body, sessionID);
|
|
|
|
}
|
2023-11-16 22:42:06 +01:00
|
|
|
}
|