diff --git a/project/src/controllers/RagfairController.ts b/project/src/controllers/RagfairController.ts index 03ee1229..6afd6e23 100644 --- a/project/src/controllers/RagfairController.ts +++ b/project/src/controllers/RagfairController.ts @@ -84,6 +84,13 @@ export class RagfairController this.ragfairConfig = this.configServer.getConfig(ConfigTypes.RAGFAIR); } + /** + * Handles client/ragfair/find + * Returns flea offers that match required search parameters + * @param sessionID Player id + * @param searchRequest Search request data + * @returns IGetOffersResult + */ public getOffers(sessionID: string, searchRequest: ISearchRequestData): IGetOffersResult { const profile = this.profileHelper.getFullProfile(sessionID); @@ -144,7 +151,8 @@ export class RagfairController } /** - * Handle client/ragfair/offer/findbyid + * Handle client/ragfair/offer/findbyid + * Occurs when searching for `#x` on flea * @param sessionId Player id * @param request Request data * @returns IRagfairOffer @@ -160,7 +168,7 @@ export class RagfairController /** * Get offers for the client based on type of search being performed * @param searchRequest Client search request data - * @param itemsToAdd comes from ragfairHelper.filterCategories() + * @param itemsToAdd Comes from ragfairHelper.filterCategories() * @param traderAssorts Trader assorts * @param pmcProfile Player profile * @returns array of offers @@ -190,7 +198,7 @@ export class RagfairController /** * Get categories for the type of search being performed, linked/required/all * @param searchRequest Client search request data - * @param offers ragfair offers to get categories for + * @param offers Ragfair offers to get categories for * @returns record with templates + counts */ protected getSpecificCategories( @@ -239,7 +247,7 @@ export class RagfairController /** * Update a trader flea offer with buy restrictions stored in the traders assort - * @param offer flea offer to update + * @param offer Flea offer to update * @param fullProfile Players full profile */ protected setTraderOfferPurchaseLimits(offer: IRagfairOffer, fullProfile: IAkiProfile): void @@ -264,7 +272,7 @@ export class RagfairController /** * Adjust ragfair offer stack count to match same value as traders assort stack count - * @param offer Flea offer to adjust + * @param offer Flea offer to adjust stack size of */ protected setTraderOfferStackSize(offer: IRagfairOffer): void { @@ -287,11 +295,21 @@ export class RagfairController firstItem.upd.StackObjectsCount = assortPurchased.upd.StackObjectsCount; } + /** + * Is the flea search being performed a 'linked' search type + * @param info Search request + * @returns True if it is a 'linked' search type + */ protected isLinkedSearch(info: ISearchRequestData): boolean { return info.linkedSearchId !== ""; } + /** + * Is the flea search being performed a 'required' search type + * @param info Search request + * @returns True if it is a 'required' search type + */ protected isRequiredSearch(info: ISearchRequestData): boolean { return info.neededSearchId !== ""; @@ -443,6 +461,7 @@ export class RagfairController } } + // Add offer to players profile + add to client response fullProfile.characters.pmc.RagfairInfo.offers.push(offer); output.profileChanges[sessionID].ragFairOffers.push(offer);