Fix items with a condition property not being correctly classified by ragfair code

This commit is contained in:
Dev 2023-12-18 11:18:13 +00:00
parent ffcc6ae71f
commit 6b82663ee1

View File

@ -597,8 +597,7 @@ export class RagfairOfferHelper
return false;
}
if (
(item.upd.MedKit || item.upd.Repairable)
if (this.isConditionItem(item)
&& !this.itemQualityInRange(item, searchRequest.conditionFrom, searchRequest.conditionTo)
)
{
@ -668,6 +667,20 @@ export class RagfairOfferHelper
return true;
}
/**
* Does the passed in item have a condition property
* @param item Item to check
* @returns True if has condition
*/
protected isConditionItem(item: Item): boolean
{
// thanks typescript, undefined assertion is not returnable since it
// tries to return a multitype object
return (item.upd.MedKit || item.upd.Repairable || item.upd.Resource || item.upd.FoodDrink || item.upd.Key || item.upd.RepairKit)
? true
: false;
}
/**
* Is items quality value within desired range
* @param item Item to check quality of