Skip to main content
Deno 2 is finally here 🎉️
Learn more
class TraderController
import { TraderController } from "https://deno.land/x/sptaki@1.2.0/controllers/TraderController.d.ts";

Constructors

new
TraderController(
logger: ILogger,
timeUtil: TimeUtil,
databaseServer: DatabaseServer,
traderAssortHelper: TraderAssortHelper,
profileHelper: ProfileHelper,
traderHelper: TraderHelper,
traderAssortService: TraderAssortService,
traderPurchasePersisterService: TraderPurchasePersisterService,
fenceService: FenceService,
fenceBaseAssortGenerator: FenceBaseAssortGenerator,
jsonUtil: JsonUtil,
configServer: ConfigServer,
)

Properties

protected
configServer: ConfigServer
protected
databaseServer: DatabaseServer
protected
fenceBaseAssortGenerator: FenceBaseAssortGenerator
protected
fenceService: FenceService
protected
jsonUtil: JsonUtil
protected
logger: ILogger
protected
profileHelper: ProfileHelper
protected
timeUtil: TimeUtil
protected
traderAssortHelper: TraderAssortHelper
protected
traderAssortService: TraderAssortService
protected
traderConfig: ITraderConfig
protected
traderHelper: TraderHelper
protected
traderPurchasePersisterService: TraderPurchasePersisterService

Methods

protected
sortByTraderId(traderA: ITraderBase, traderB: ITraderBase): number

Order traders by their traderId (Ttid)

getAllTraders(sessionID: string): ITraderBase[]

Handle client/trading/api/traderSettings Return an array of all traders

getAssort(sessionId: string, traderId: string): ITraderAssort

Handle client/trading/api/getTraderAssort

getTrader(sessionID: string, traderID: string): ITraderBase

Handle client/trading/api/getTrader

load(): void

Runs when onLoad event is fired Iterate over traders, ensure a pristine copy of their assorts is stored in traderAssortService Store timestamp of next assort refresh in nextResupply property of traders .base object

update(): boolean

Runs when onUpdate is fired If current time is > nextResupply(expire) time of trader, refresh traders assorts and Fence is handled slightly differently