Implement flea required searching
This commit is contained in:
parent
ef958a115d
commit
5136d69050
@ -184,6 +184,11 @@ export class RagfairController
|
||||
return this.ragfairOfferHelper.getOffersForBuild(searchRequest, itemsToAdd, traderAssorts, pmcProfile);
|
||||
}
|
||||
|
||||
if (searchRequest.neededSearchId?.length > 0)
|
||||
{
|
||||
return this.ragfairOfferHelper.getOffersThatRequireItem(searchRequest);
|
||||
}
|
||||
|
||||
// Searching for general items
|
||||
return this.ragfairOfferHelper.getValidOffers(searchRequest, itemsToAdd, traderAssorts, pmcProfile);
|
||||
}
|
||||
|
@ -87,6 +87,13 @@ export class RagfairOfferHelper
|
||||
);
|
||||
}
|
||||
|
||||
public getOffersThatRequireItem(searchRequest: ISearchRequestData): IRagfairOffer[]
|
||||
{
|
||||
return this.ragfairOfferService.getOffers().filter((offer) =>
|
||||
this.isDisplayableOfferThatNeedsItem(searchRequest, offer)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get offers from flea/traders specifically when building weapon preset
|
||||
* @param searchRequest Search request data
|
||||
@ -673,6 +680,19 @@ export class RagfairOfferHelper
|
||||
return true;
|
||||
}
|
||||
|
||||
public isDisplayableOfferThatNeedsItem(
|
||||
searchRequest: ISearchRequestData,
|
||||
offer: IRagfairOffer,
|
||||
): boolean
|
||||
{
|
||||
if (offer.requirements.some(requirement => requirement._tpl === searchRequest.neededSearchId))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Does the passed in item have a condition property
|
||||
* @param item Item to check
|
||||
|
Loading…
Reference in New Issue
Block a user