2023-03-03 15:23:46 +00:00
|
|
|
import { inject, injectable } from "tsyringe";
|
|
|
|
|
2023-10-19 17:21:17 +00:00
|
|
|
import { InventoryController } from "@spt-aki/controllers/InventoryController";
|
|
|
|
import { IPmcData } from "@spt-aki/models/eft/common/IPmcData";
|
|
|
|
import { IInventoryBindRequestData } from "@spt-aki/models/eft/inventory/IInventoryBindRequestData";
|
|
|
|
import { IInventoryCreateMarkerRequestData } from "@spt-aki/models/eft/inventory/IInventoryCreateMarkerRequestData";
|
|
|
|
import { IInventoryDeleteMarkerRequestData } from "@spt-aki/models/eft/inventory/IInventoryDeleteMarkerRequestData";
|
|
|
|
import { IInventoryEditMarkerRequestData } from "@spt-aki/models/eft/inventory/IInventoryEditMarkerRequestData";
|
|
|
|
import { IInventoryExamineRequestData } from "@spt-aki/models/eft/inventory/IInventoryExamineRequestData";
|
|
|
|
import { IInventoryFoldRequestData } from "@spt-aki/models/eft/inventory/IInventoryFoldRequestData";
|
|
|
|
import { IInventoryMergeRequestData } from "@spt-aki/models/eft/inventory/IInventoryMergeRequestData";
|
|
|
|
import { IInventoryMoveRequestData } from "@spt-aki/models/eft/inventory/IInventoryMoveRequestData";
|
|
|
|
import { IInventoryReadEncyclopediaRequestData } from "@spt-aki/models/eft/inventory/IInventoryReadEncyclopediaRequestData";
|
|
|
|
import { IInventoryRemoveRequestData } from "@spt-aki/models/eft/inventory/IInventoryRemoveRequestData";
|
|
|
|
import { IInventorySortRequestData } from "@spt-aki/models/eft/inventory/IInventorySortRequestData";
|
|
|
|
import { IInventorySplitRequestData } from "@spt-aki/models/eft/inventory/IInventorySplitRequestData";
|
|
|
|
import { IInventorySwapRequestData } from "@spt-aki/models/eft/inventory/IInventorySwapRequestData";
|
|
|
|
import { IInventoryTagRequestData } from "@spt-aki/models/eft/inventory/IInventoryTagRequestData";
|
|
|
|
import { IInventoryToggleRequestData } from "@spt-aki/models/eft/inventory/IInventoryToggleRequestData";
|
|
|
|
import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData";
|
|
|
|
import { IOpenRandomLootContainerRequestData } from "@spt-aki/models/eft/inventory/IOpenRandomLootContainerRequestData";
|
2023-12-07 20:16:04 +00:00
|
|
|
import { IRedeemProfileRequestData } from "@spt-aki/models/eft/inventory/IRedeemProfileRequestData";
|
2023-12-29 20:22:50 +00:00
|
|
|
import { ISetFavoriteItems } from "@spt-aki/models/eft/inventory/ISetFavoriteItems";
|
2023-10-19 17:21:17 +00:00
|
|
|
import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse";
|
2023-03-03 15:23:46 +00:00
|
|
|
|
|
|
|
@injectable()
|
|
|
|
export class InventoryCallbacks
|
|
|
|
{
|
2023-11-16 21:42:06 +00:00
|
|
|
constructor(@inject("InventoryController") protected inventoryController: InventoryController)
|
|
|
|
{}
|
2023-03-03 15:23:46 +00:00
|
|
|
|
2023-10-10 11:03:20 +00:00
|
|
|
/** Handle Move event */
|
2023-03-03 15:23:46 +00:00
|
|
|
public moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse
|
|
|
|
{
|
|
|
|
return this.inventoryController.moveItem(pmcData, body, sessionID);
|
|
|
|
}
|
|
|
|
|
2023-10-10 11:03:20 +00:00
|
|
|
/** Handle Remove event */
|
2023-03-03 15:23:46 +00:00
|
|
|
public removeItem(pmcData: IPmcData, body: IInventoryRemoveRequestData, sessionID: string): IItemEventRouterResponse
|
|
|
|
{
|
|
|
|
return this.inventoryController.discardItem(pmcData, body, sessionID);
|
|
|
|
}
|
|
|
|
|
2023-10-10 11:03:20 +00:00
|
|
|
/** Handle Split event */
|
2023-03-03 15:23:46 +00:00
|
|
|
public splitItem(pmcData: IPmcData, body: IInventorySplitRequestData, sessionID: string): IItemEventRouterResponse
|
|
|
|
{
|
|
|
|
return this.inventoryController.splitItem(pmcData, body, sessionID);
|
|
|
|
}
|
|
|
|
|
|
|
|
public mergeItem(pmcData: IPmcData, body: IInventoryMergeRequestData, sessionID: string): IItemEventRouterResponse
|
|
|
|
{
|
|
|
|
return this.inventoryController.mergeItem(pmcData, body, sessionID);
|
|
|
|
}
|
|
|
|
|
2023-11-16 21:42:06 +00:00
|
|
|
public transferItem(
|
|
|
|
pmcData: IPmcData,
|
|
|
|
body: IInventoryTransferRequestData,
|
|
|
|
sessionID: string,
|
|
|
|
): IItemEventRouterResponse
|
2023-03-03 15:23:46 +00:00
|
|
|
{
|
|
|
|
return this.inventoryController.transferItem(pmcData, body, sessionID);
|
|
|
|
}
|
|
|
|
|
2023-07-15 14:49:25 +01:00
|
|
|
/** Handle Swap */
|
2023-03-03 15:23:46 +00:00
|
|
|
// TODO: how is this triggered
|
|
|
|
public swapItem(pmcData: IPmcData, body: IInventorySwapRequestData, sessionID: string): IItemEventRouterResponse
|
|
|
|
{
|
|
|
|
return this.inventoryController.swapItem(pmcData, body, sessionID);
|
|
|
|
}
|
|
|
|
|
|
|
|
public foldItem(pmcData: IPmcData, body: IInventoryFoldRequestData, sessionID: string): IItemEventRouterResponse
|
|
|
|
{
|
|
|
|
return this.inventoryController.foldItem(pmcData, body, sessionID);
|
|
|
|
}
|
|
|
|
|
|
|
|
public toggleItem(pmcData: IPmcData, body: IInventoryToggleRequestData, sessionID: string): IItemEventRouterResponse
|
|
|
|
{
|
|
|
|
return this.inventoryController.toggleItem(pmcData, body, sessionID);
|
|
|
|
}
|
|
|
|
|
|
|
|
public tagItem(pmcData: IPmcData, body: IInventoryTagRequestData, sessionID: string): IItemEventRouterResponse
|
|
|
|
{
|
|
|
|
return this.inventoryController.tagItem(pmcData, body, sessionID);
|
|
|
|
}
|
|
|
|
|
|
|
|
public bindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse
|
|
|
|
{
|
|
|
|
return this.inventoryController.bindItem(pmcData, body, sessionID);
|
|
|
|
}
|
|
|
|
|
2023-11-12 10:10:34 +00:00
|
|
|
public unbindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse
|
|
|
|
{
|
|
|
|
return this.inventoryController.unbindItem(pmcData, body, sessionID);
|
|
|
|
}
|
|
|
|
|
2023-11-16 21:42:06 +00:00
|
|
|
public examineItem(
|
|
|
|
pmcData: IPmcData,
|
|
|
|
body: IInventoryExamineRequestData,
|
|
|
|
sessionID: string,
|
|
|
|
): IItemEventRouterResponse
|
2023-03-03 15:23:46 +00:00
|
|
|
{
|
|
|
|
return this.inventoryController.examineItem(pmcData, body, sessionID);
|
|
|
|
}
|
|
|
|
|
2023-07-15 14:49:25 +01:00
|
|
|
/** Handle ReadEncyclopedia */
|
2023-11-16 21:42:06 +00:00
|
|
|
public readEncyclopedia(
|
|
|
|
pmcData: IPmcData,
|
|
|
|
body: IInventoryReadEncyclopediaRequestData,
|
|
|
|
sessionID: string,
|
|
|
|
): IItemEventRouterResponse
|
2023-03-03 15:23:46 +00:00
|
|
|
{
|
|
|
|
return this.inventoryController.readEncyclopedia(pmcData, body, sessionID);
|
|
|
|
}
|
|
|
|
|
2023-07-15 14:49:25 +01:00
|
|
|
/** Handle ApplyInventoryChanges */
|
2023-11-16 21:42:06 +00:00
|
|
|
public sortInventory(
|
|
|
|
pmcData: IPmcData,
|
|
|
|
body: IInventorySortRequestData,
|
|
|
|
sessionID: string,
|
|
|
|
): IItemEventRouterResponse
|
2023-03-03 15:23:46 +00:00
|
|
|
{
|
|
|
|
return this.inventoryController.sortInventory(pmcData, body, sessionID);
|
|
|
|
}
|
|
|
|
|
2023-11-16 21:42:06 +00:00
|
|
|
public createMapMarker(
|
|
|
|
pmcData: IPmcData,
|
|
|
|
body: IInventoryCreateMarkerRequestData,
|
|
|
|
sessionID: string,
|
|
|
|
): IItemEventRouterResponse
|
2023-03-03 15:23:46 +00:00
|
|
|
{
|
|
|
|
return this.inventoryController.createMapMarker(pmcData, body, sessionID);
|
|
|
|
}
|
|
|
|
|
2023-11-16 21:42:06 +00:00
|
|
|
public deleteMapMarker(
|
|
|
|
pmcData: IPmcData,
|
|
|
|
body: IInventoryDeleteMarkerRequestData,
|
|
|
|
sessionID: string,
|
|
|
|
): IItemEventRouterResponse
|
2023-03-03 15:23:46 +00:00
|
|
|
{
|
|
|
|
return this.inventoryController.deleteMapMarker(pmcData, body, sessionID);
|
|
|
|
}
|
|
|
|
|
2023-11-16 21:42:06 +00:00
|
|
|
public editMapMarker(
|
|
|
|
pmcData: IPmcData,
|
|
|
|
body: IInventoryEditMarkerRequestData,
|
|
|
|
sessionID: string,
|
|
|
|
): IItemEventRouterResponse
|
2023-03-03 15:23:46 +00:00
|
|
|
{
|
|
|
|
return this.inventoryController.editMapMarker(pmcData, body, sessionID);
|
|
|
|
}
|
|
|
|
|
2023-07-15 14:49:25 +01:00
|
|
|
/** Handle OpenRandomLootContainer */
|
2023-11-16 21:42:06 +00:00
|
|
|
public openRandomLootContainer(
|
|
|
|
pmcData: IPmcData,
|
|
|
|
body: IOpenRandomLootContainerRequestData,
|
|
|
|
sessionID: string,
|
|
|
|
): IItemEventRouterResponse
|
2023-03-03 15:23:46 +00:00
|
|
|
{
|
|
|
|
return this.inventoryController.openRandomLootContainer(pmcData, body, sessionID);
|
|
|
|
}
|
2023-12-07 20:16:04 +00:00
|
|
|
|
|
|
|
public redeemProfileReward(pmcData: IPmcData,
|
|
|
|
body: IRedeemProfileRequestData,
|
|
|
|
sessionId: string
|
|
|
|
): IItemEventRouterResponse
|
|
|
|
{
|
|
|
|
return this.inventoryController.redeemProfileReward(pmcData, body, sessionId)
|
|
|
|
}
|
2023-12-29 20:22:50 +00:00
|
|
|
|
|
|
|
public setFavoriteItem(pmcData: IPmcData,
|
|
|
|
body: ISetFavoriteItems,
|
|
|
|
sessionId: string): IItemEventRouterResponse
|
|
|
|
{
|
|
|
|
return this.inventoryController.setFavoriteItem(pmcData, body, sessionId);
|
|
|
|
}
|
2023-11-16 21:42:06 +00:00
|
|
|
}
|