Skip to content

Commit

Permalink
Should resolve issue of some items being priced at 0.
Browse files Browse the repository at this point in the history
Was occuring because the autobot cache of prices.tf pricelist sometimes contains items that are unpriced and I neglected to check for such a scenario.

Now when unpriced items (from the fallback source) are detected, the items price will not be updated until a valid price can be attained.
  • Loading branch information
jack-richards authored Oct 5, 2024
1 parent abeb773 commit 473f47c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions bptf-autopricer.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,11 @@ const calculateAndEmitPrices = async () => {
if (!item) {
continue;
}
// If item is priced at 0, we skip it. Autobot cache of the prices.tf pricelist can sometimes have items set as such.
if (item.buy.keys === 0 && item.buy.metal === 0 ||
item.sell.keys === 0 && item.sell.metal === 0) {
throw new Error("Autobot cache of prices.tf pricelist has marked item with price of 0.");
}
// Save item to pricelist. Pricelist.json is mainly used by the pricing API.
Methods.addToPricelist(item, PRICELIST_PATH);
// Instead of emitting item here, we store it in a array, so we can emit all items at once.
Expand Down

0 comments on commit 473f47c

Please sign in to comment.