Skip to main content
The Deno 2 Release Candidate is here
Learn more
class TradeController
import { TradeController } from "https://deno.land/x/sptaki@1.2.0/controllers/mod.ts";

Constructors

new
TradeController(
logger: ILogger,
databaseServer: DatabaseServer,
eventOutputHolder: EventOutputHolder,
tradeHelper: TradeHelper,
timeUtil: TimeUtil,
randomUtil: RandomUtil,
hashUtil: HashUtil,
itemHelper: ItemHelper,
profileHelper: ProfileHelper,
traderHelper: TraderHelper,
jsonUtil: JsonUtil,
ragfairServer: RagfairServer,
httpResponse: HttpResponseUtil,
localisationService: LocalisationService,
ragfairPriceService: RagfairPriceService,
mailSendService: MailSendService,
configServer: ConfigServer,
)

Properties

protected
configServer: ConfigServer
protected
databaseServer: DatabaseServer
protected
eventOutputHolder: EventOutputHolder
protected
hashUtil: HashUtil
protected
httpResponse: HttpResponseUtil
protected
itemHelper: ItemHelper
protected
jsonUtil: JsonUtil
protected
localisationService: LocalisationService
protected
logger: ILogger
protected
mailSendService: MailSendService
protected
profileHelper: ProfileHelper
protected
ragfairConfig: IRagfairConfig
protected
ragfairPriceService: RagfairPriceService
protected
ragfairServer: RagfairServer
protected
randomUtil: RandomUtil
protected
roubleTpl: string
protected
timeUtil: TimeUtil
protected
tradeHelper: TradeHelper
protected
traderConfig: ITraderConfig
protected
traderHelper: TraderHelper

Methods

protected
buyPmcItemFromRagfair(
sessionId: string,
pmcData: IPmcData,
fleaOffer: IRagfairOffer,
requestOffer: IOfferRequest,
): void

Buy an item off the flea sold by a PMC

protected
buyTraderItemFromRagfair(
sessionId: string,
pmcData: IPmcData,
fleaOffer: IRagfairOffer,
requestOffer: IOfferRequest,
): void

Buy an item off the flea sold by a trader

protected
getPriceOfItemAndChildren(
parentItemId: string,
items: Item[],
handbookPrices: Record<string, number>,
traderDetails: ITraderBase,
): number

Looks up an items children and gets total handbook price for them

protected
mailMoneyToPlayer(
sessionId: string,
roublesToSend: number,
trader: Traders,
): void

Send the specified rouble total to player as mail

protected
playerLacksTraderLoyaltyLevelToBuyOffer(fleaOffer: IRagfairOffer, pmcData: IPmcData): boolean

Does Player have necessary trader loyalty to purchase flea offer

Handle RagFairBuyOffer event

Handle TradingConfirm event

Handle SellAllFromSavage event