Server/project/src/callbacks/TradeCallbacks.ts

38 lines
1.6 KiB
TypeScript
Raw Normal View History

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