Server/project/src/callbacks/InventoryCallbacks.ts

177 lines
7.2 KiB
TypeScript
Raw Normal View History

2023-03-03 15:23:46 +00:00
import { inject, injectable } from "tsyringe";
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";
import { IRedeemProfileRequestData } from "@spt-aki/models/eft/inventory/IRedeemProfileRequestData";
import { ISetFavoriteItems } from "@spt-aki/models/eft/inventory/ISetFavoriteItems";
import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse";
2023-03-03 15:23:46 +00:00
@injectable()
export class InventoryCallbacks
{
constructor(@inject("InventoryController") protected inventoryController: InventoryController)
{}
2023-03-03 15:23:46 +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);
}
/** 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);
}
/** 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);
}
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);
}
public unbindItem(pmcData: IPmcData, body: IInventoryBindRequestData, sessionID: string): IItemEventRouterResponse
{
return this.inventoryController.unbindItem(pmcData, body, sessionID);
}
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 */
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 */
public sortInventory(
pmcData: IPmcData,
body: IInventorySortRequestData,
sessionID: string,
): IItemEventRouterResponse
2023-03-03 15:23:46 +00:00
{
return this.inventoryController.sortInventory(pmcData, body, sessionID);
}
public createMapMarker(
pmcData: IPmcData,
body: IInventoryCreateMarkerRequestData,
sessionID: string,
): IItemEventRouterResponse
2023-03-03 15:23:46 +00:00
{
return this.inventoryController.createMapMarker(pmcData, body, sessionID);
}
public deleteMapMarker(
pmcData: IPmcData,
body: IInventoryDeleteMarkerRequestData,
sessionID: string,
): IItemEventRouterResponse
2023-03-03 15:23:46 +00:00
{
return this.inventoryController.deleteMapMarker(pmcData, body, sessionID);
}
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 */
public openRandomLootContainer(
pmcData: IPmcData,
body: IOpenRandomLootContainerRequestData,
sessionID: string,
): IItemEventRouterResponse
2023-03-03 15:23:46 +00:00
{
return this.inventoryController.openRandomLootContainer(pmcData, body, sessionID);
}
public redeemProfileReward(pmcData: IPmcData,
body: IRedeemProfileRequestData,
sessionId: string
): IItemEventRouterResponse
{
return this.inventoryController.redeemProfileReward(pmcData, body, sessionId)
}
public setFavoriteItem(pmcData: IPmcData,
body: ISetFavoriteItems,
sessionId: string): IItemEventRouterResponse
{
return this.inventoryController.setFavoriteItem(pmcData, body, sessionId);
}
}