Fix: Only return prices for items that exist in items.json

(cherry picked from commit c0aece0a2c9a84f71d8b5dd940c3e37a9017b6ed)
This commit is contained in:
Dev 2023-04-06 15:37:35 +01:00
parent 5e9e0736cc
commit 2cd7555bbe

View File

@ -643,7 +643,11 @@ export class RagfairOfferGenerator
{
const fleaPrices = this.databaseServer.getTables().templates.prices;
const fleaArray = Object.entries(fleaPrices).map(([tpl, price]) => ({ tpl: tpl, price: price }));
this.allowedFleaPriceItemsForBarter = fleaArray.filter(x => !this.itemHelper.isOfBaseclasses(x.tpl, this.ragfairConfig.dynamic.barter.itemTypeBlacklist));
// Only get item prices for items that also exist in items.json
const filteredItems = fleaArray.filter(x => this.itemHelper.getItem(x.tpl)[0]);
this.allowedFleaPriceItemsForBarter = filteredItems.filter(x => !this.itemHelper.isOfBaseclasses(x.tpl, this.ragfairConfig.dynamic.barter.itemTypeBlacklist));
}
return this.allowedFleaPriceItemsForBarter;