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

Handle RagfairCallback events

Constructors

new
RagfairController(
logger: ILogger,
timeUtil: TimeUtil,
httpResponse: HttpResponseUtil,
eventOutputHolder: EventOutputHolder,
ragfairServer: RagfairServer,
ragfairPriceService: RagfairPriceService,
databaseServer: DatabaseServer,
itemHelper: ItemHelper,
saveServer: SaveServer,
ragfairSellHelper: RagfairSellHelper,
ragfairTaxService: RagfairTaxService,
ragfairSortHelper: RagfairSortHelper,
ragfairOfferHelper: RagfairOfferHelper,
profileHelper: ProfileHelper,
paymentService: PaymentService,
handbookHelper: HandbookHelper,
paymentHelper: PaymentHelper,
inventoryHelper: InventoryHelper,
traderHelper: TraderHelper,
ragfairHelper: RagfairHelper,
ragfairOfferService: RagfairOfferService,
ragfairRequiredItemsService: RagfairRequiredItemsService,
ragfairOfferGenerator: RagfairOfferGenerator,
localisationService: LocalisationService,
configServer: ConfigServer,
)

Properties

protected
configServer: ConfigServer
protected
databaseServer: DatabaseServer
protected
eventOutputHolder: EventOutputHolder
protected
handbookHelper: HandbookHelper
protected
httpResponse: HttpResponseUtil
protected
inventoryHelper: InventoryHelper
protected
itemHelper: ItemHelper
protected
localisationService: LocalisationService
protected
logger: ILogger
protected
paymentHelper: PaymentHelper
protected
paymentService: PaymentService
protected
profileHelper: ProfileHelper
protected
ragfairConfig: IRagfairConfig
protected
ragfairHelper: RagfairHelper
protected
ragfairOfferGenerator: RagfairOfferGenerator
protected
ragfairOfferHelper: RagfairOfferHelper
protected
ragfairOfferService: RagfairOfferService
protected
ragfairPriceService: RagfairPriceService
protected
ragfairRequiredItemsService: RagfairRequiredItemsService
protected
ragfairSellHelper: RagfairSellHelper
protected
ragfairServer: RagfairServer
protected
ragfairSortHelper: RagfairSortHelper
protected
ragfairTaxService: RagfairTaxService
protected
saveServer: SaveServer
protected
timeUtil: TimeUtil
protected
traderHelper: TraderHelper

Methods

protected
addIndexValueToOffers(offers: IRagfairOffer[]): void

Add index to all offers passed in (0-indexed)

protected
calculateRequirementsPriceInRub(requirements: Requirement[]): number

Get the handbook price in roubles for the items being listed

protected
chargePlayerTaxFee(
sessionID: string,
rootItem: Item,
pmcData: IPmcData,
requirementsPriceInRub: number,
itemStackCount: number,
offerRequest: IAddOfferRequestData,
): boolean

Charge player a listing fee for using flea, pulls charge from data previously sent by client

protected
createBuyTradeRequestObject(currency: string, value: number): IProcessBuyTradeRequestData

Create a basic trader request object with price and currency type

protected
getItemsToListOnFleaFromInventory(pmcData: IPmcData, itemIdsFromFleaOfferRequest: string[]): { items: Item[] | null; errorMessage: string | null; }

Using item ids from flea offer request, find corresponding items from player inventory and return as array

protected
getOffersForSearchType(
searchRequest: ISearchRequestData,
itemsToAdd: string[],
traderAssorts: Record<string, ITraderAssort>,
pmcProfile: IPmcData,
): IRagfairOffer[]

Get offers for the client based on type of search being performed

protected
getSpecificCategories(
pmcProfile: IPmcData,
searchRequest: ISearchRequestData,
offers: IRagfairOffer[],
): Record<string, number>

Get categories for the type of search being performed, linked/required/all

protected
isLinkedSearch(info: ISearchRequestData): boolean

Is the flea search being performed a 'linked' search type

protected
isRequiredSearch(info: ISearchRequestData): boolean

Is the flea search being performed a 'required' search type

protected
isValidPlayerOfferRequest(offerRequest: IAddOfferRequestData, errorMessage: string): boolean

Is the item to be listed on the flea valid

protected
setTraderOfferPurchaseLimits(offer: IRagfairOffer, fullProfile: IAkiProfile): void

Update a trader flea offer with buy restrictions stored in the traders assort

protected
setTraderOfferStackSize(offer: IRagfairOffer): void

Adjust ragfair offer stack count to match same value as traders assort stack count

addPlayerOffer(
pmcData: IPmcData,
offerRequest: IAddOfferRequestData,
sessionID: string,
): IItemEventRouterResponse

List item(s) on flea for sale

createPlayerOffer(
sessionId: string,
requirements: Requirement[],
items: Item[],
sellInOnePiece: boolean,
): IRagfairOffer

Extend a ragfair offers listing time

getAllFleaPrices(): Record<string, number>

Called when creating an offer on flea, fills values in top right corner

Handle client/ragfair/offer/findbyid Occurs when searching for #x on flea

getOffers(sessionID: string, searchRequest: ISearchRequestData): IGetOffersResult

Handles client/ragfair/find Returns flea offers that match required search parameters

getStaticPrices(): Record<string, number>

User requested removal of the offer, actually reduces the time to 71 seconds, allowing for the possibility of extending the auction before it's end time

update(): void

Check all profiles and sell player offers / send player money for listing if it sold