2023-03-03 16:23:46 +01:00
|
|
|
import { inject, injectable } from "tsyringe";
|
|
|
|
|
2023-10-19 19:21:17 +02:00
|
|
|
import { TradeController } from "@spt-aki/controllers/TradeController";
|
|
|
|
import { IPmcData } from "@spt-aki/models/eft/common/IPmcData";
|
|
|
|
import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse";
|
|
|
|
import { IProcessBaseTradeRequestData } from "@spt-aki/models/eft/trade/IProcessBaseTradeRequestData";
|
|
|
|
import { IProcessRagfairTradeRequestData } from "@spt-aki/models/eft/trade/IProcessRagfairTradeRequestData";
|
|
|
|
import { ISellScavItemsToFenceRequestData } from "@spt-aki/models/eft/trade/ISellScavItemsToFenceRequestData";
|
2023-03-03 16:23:46 +01:00
|
|
|
|
|
|
|
@injectable()
|
|
|
|
export class TradeCallbacks
|
|
|
|
{
|
2023-11-16 02:35:05 +01:00
|
|
|
constructor(@inject("TradeController") protected tradeController: TradeController)
|
|
|
|
{}
|
2023-03-03 16:23:46 +01:00
|
|
|
|
|
|
|
/**
|
2023-07-15 15:49:25 +02:00
|
|
|
* Handle client/game/profile/items/moving TradingConfirm event
|
2023-03-03 16:23:46 +01:00
|
|
|
*/
|
2023-11-16 02:35:05 +01:00
|
|
|
public processTrade(
|
|
|
|
pmcData: IPmcData,
|
|
|
|
body: IProcessBaseTradeRequestData,
|
|
|
|
sessionID: string,
|
|
|
|
): IItemEventRouterResponse
|
2023-03-03 16:23:46 +01:00
|
|
|
{
|
|
|
|
// body can be IProcessBuyTradeRequestData or IProcessSellTradeRequestData
|
|
|
|
return this.tradeController.confirmTrading(pmcData, body, sessionID);
|
|
|
|
}
|
|
|
|
|
2023-07-15 15:49:25 +02:00
|
|
|
/** Handle RagFairBuyOffer event */
|
2023-11-16 02:35:05 +01:00
|
|
|
public processRagfairTrade(
|
|
|
|
pmcData: IPmcData,
|
|
|
|
body: IProcessRagfairTradeRequestData,
|
|
|
|
sessionID: string,
|
|
|
|
): IItemEventRouterResponse
|
2023-03-03 16:23:46 +01:00
|
|
|
{
|
|
|
|
return this.tradeController.confirmRagfairTrading(pmcData, body, sessionID);
|
|
|
|
}
|
2023-10-10 13:03:20 +02:00
|
|
|
|
|
|
|
/** Handle SellAllFromSavage event */
|
2023-11-16 02:35:05 +01:00
|
|
|
public sellAllFromSavage(
|
|
|
|
pmcData: IPmcData,
|
|
|
|
body: ISellScavItemsToFenceRequestData,
|
|
|
|
sessionID: string,
|
|
|
|
): IItemEventRouterResponse
|
2023-10-10 13:03:20 +02:00
|
|
|
{
|
|
|
|
return this.tradeController.sellScavItemsToFence(pmcData, body, sessionID);
|
|
|
|
}
|
2023-11-16 02:35:05 +01:00
|
|
|
}
|