Fix durability filtering on flea not working for helmets / armors
Updated `getItemQualityModifierForOfferItems()` to return root items quality modifer when its a weapon Fixed `getItemQualityModifierForOfferItems()` assuming quality started at 1
This commit is contained in:
parent
da6244e1ac
commit
bba30d616b
@ -163,12 +163,13 @@ export class FenceBaseAssortGenerator
|
||||
|
||||
// Calculate preset price (root item + child items)
|
||||
const price = this.handbookHelper.getTemplatePriceForItems(itemAndChildren);
|
||||
const itemQualityModifier = this.itemHelper.getItemQualityModifierForOfferItems(itemAndChildren);
|
||||
|
||||
// Multiply weapon+mods rouble price by quality modifier
|
||||
baseFenceAssort.barter_scheme[itemAndChildren[0]._id] = [[]];
|
||||
baseFenceAssort.barter_scheme[itemAndChildren[0]._id][0][0] = {
|
||||
_tpl: Money.ROUBLES,
|
||||
count: Math.round(price * this.itemHelper.getItemQualityModifierForOfferItems(itemAndChildren)),
|
||||
count: Math.round(price * itemQualityModifier),
|
||||
};
|
||||
|
||||
baseFenceAssort.loyal_level_items[itemAndChildren[0]._id] = 1;
|
||||
|
@ -304,7 +304,12 @@ export class ItemHelper
|
||||
*/
|
||||
public getItemQualityModifierForOfferItems(items: Item[]): number
|
||||
{
|
||||
let qualityModifier = 1;
|
||||
if (this.isOfBaseclass(items[0]._tpl, BaseClasses.WEAPON))
|
||||
{
|
||||
return this.getItemQualityModifier(items[0]);
|
||||
}
|
||||
|
||||
let qualityModifier = 0;
|
||||
for (const item of items)
|
||||
{
|
||||
qualityModifier += this.getItemQualityModifier(item);
|
||||
@ -370,9 +375,11 @@ export class ItemHelper
|
||||
// make item non-zero but still very low
|
||||
result = 0.01;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
return result;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -612,9 +612,9 @@ export class RagfairOfferHelper
|
||||
return false;
|
||||
}
|
||||
|
||||
if (offer.items.length === 1 || this.itemHelper.isOfBaseclass(offerRootItem._tpl, BaseClasses.WEAPON))
|
||||
if (offer.items.length === 1)
|
||||
{
|
||||
// Single item or weapon
|
||||
// Single item
|
||||
if (
|
||||
this.isConditionItem(offerRootItem)
|
||||
&& !this.itemQualityInRange(offerRootItem, searchRequest.conditionFrom, searchRequest.conditionTo)
|
||||
|
Loading…
Reference in New Issue
Block a user