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

Constructors

new
RagfairOfferHelper(
logger: ILogger,
timeUtil: TimeUtil,
hashUtil: HashUtil,
eventOutputHolder: EventOutputHolder,
databaseServer: DatabaseServer,
traderHelper: TraderHelper,
saveServer: SaveServer,
itemHelper: ItemHelper,
paymentHelper: PaymentHelper,
presetHelper: PresetHelper,
profileHelper: ProfileHelper,
ragfairServerHelper: RagfairServerHelper,
ragfairSortHelper: RagfairSortHelper,
ragfairHelper: RagfairHelper,
ragfairOfferService: RagfairOfferService,
ragfairRequiredItemsService: RagfairRequiredItemsService,
localeService: LocaleService,
localisationService: LocalisationService,
mailSendService: MailSendService,
configServer: ConfigServer,
)

Properties

protected
configServer: ConfigServer
protected
databaseServer: DatabaseServer
protected
eventOutputHolder: EventOutputHolder
protected
hashUtil: HashUtil
protected
itemHelper: ItemHelper
protected
localeService: LocaleService
protected
localisationService: LocalisationService
protected
logger: ILogger
protected
mailSendService: MailSendService
protected
paymentHelper: PaymentHelper
protected
presetHelper: PresetHelper
protected
profileHelper: ProfileHelper
protected
questConfig: IQuestConfig
protected
ragfairConfig: IRagfairConfig
protected
ragfairHelper: RagfairHelper
protected
ragfairOfferService: RagfairOfferService
protected
ragfairRequiredItemsService: RagfairRequiredItemsService
protected
ragfairServerHelper: RagfairServerHelper
protected
ragfairSortHelper: RagfairSortHelper
protected
saveServer: SaveServer
protected
timeUtil: TimeUtil
protected
traderHelper: TraderHelper

Methods

protected
completeOffer(
sessionID: string,
boughtAmount: number,
): IItemEventRouterResponse

Complete the selling of players' offer

protected
deleteOfferById(sessionID: string, offerId: string): void

Delete an offer from a desired profile and from ragfair offers

protected
getLocalisedOfferSoldMessage(itemTpl: string, boughtAmount: number): string

Get a localised message for when players offer has sold on flea

protected
getLoyaltyLockedOffers(offers: IRagfairOffer[], pmcProfile: IPmcData): string[]

Get an array of flea offers that are inaccessible to player due to their inadequate loyalty level

protected
getProfileOffers(sessionID: string): IRagfairOffer[]

Return all offers a player has listed on a desired profile

protected
isConditionItem(item: Item): boolean

Does the passed in item have a condition property

protected
itemQualityInRange(
item: Item,
min: number,
max: number,
): boolean

Is items quality value within desired range

protected
passesSearchFilterCriteria(
searchRequest: ISearchRequestData,
pmcData: IPmcData,
): boolean

Check an offer passes the various search criteria the player requested

protected
traderBuyRestrictionReached(offer: IRagfairOffer): boolean

Check if trader offers' BuyRestrictionMax value has been reached

protected
traderOfferLockedBehindLoyaltyLevel(offer: IRagfairOffer, pmcProfile: IPmcData): boolean

Check if offer is from trader standing the player does not have

protected
traderOutOfStock(offer: IRagfairOffer): boolean

Has a traders offer ran out of stock to sell to player

getOffersForBuild(
searchRequest: ISearchRequestData,
itemsToAdd: string[],
traderAssorts: Record<string, ITraderAssort>,
pmcData: IPmcData,
): IRagfairOffer[]

Get offers from flea/traders specifically when building weapon preset

Get matching offers that require the desired item and filter out offers from non traders if player is below ragfair unlock level

getValidOffers(
searchRequest: ISearchRequestData,
itemsToAdd: string[],
traderAssorts: Record<string, ITraderAssort>,
pmcData: IPmcData,
): IRagfairOffer[]

Passthrough to ragfairOfferService.getOffers(), get flea offers a player should see

increaseProfileRagfairRating(profile: IAkiProfile, amountToIncrementBy: number): void

Add amount to players ragfair rating

isDisplayableOffer(
searchRequest: ISearchRequestData,
itemsToAdd: string[],
traderAssorts: Record<string, ITraderAssort>,
pmcProfile: IPmcData,
): boolean

Should a ragfair offer be visible to the player

isItemFunctional(offerRootItem: Item, offer: IRagfairOffer): boolean

Check that the passed in offer item is functional

processOffersOnProfile(sessionID: string): boolean

Process all player-listed flea offers for a desired profile

traderOfferItemQuestLocked(offer: IRagfairOffer, traderAssorts: Record<string, ITraderAssort>): boolean

Check if offer item is quest locked for current player by looking at sptQuestLocked property in traders barter_scheme

Static Properties

protected
goodSoldTemplate: string