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

Help with storing limited item purchases from traders in profile to persist them over server restarts

Constructors

new
TraderPurchasePersisterService(
logger: ILogger,
timeUtil: TimeUtil,
randomUtil: RandomUtil,
profileHelper: ProfileHelper,
localisationService: LocalisationService,
configServer: ConfigServer,
)

Properties

protected
configServer: ConfigServer
protected
localisationService: LocalisationService
protected
logger: ILogger
protected
profileHelper: ProfileHelper
protected
randomUtil: RandomUtil
protected
timeUtil: TimeUtil
protected
traderConfig: ITraderConfig

Methods

getProfileTraderPurchase(
sessionId: string,
traderId: string,
assortId: string,
): TraderPurchaseData

Get a purchase made from a trader for requested profile before the last trader reset

getProfileTraderPurchases(sessionId: string, traderId: string): Record<string, TraderPurchaseData>

Get the purchases made from a trader for this profile before the last trader reset

removeStalePurchasesFromProfiles(traderId: string): void

Iterate over all server profiles and remove specific trader purchase data that has passed the trader refesh time

resetTraderPurchasesStoredInProfile(traderId: string): void

Remove all trader purchase records from all profiles that exist