Skip to content

Commit cb7a142

Browse files
authored
Bazaar Auto Price - prevent prices below $2
Fixes a rare issue that sets the price to negatives when the current lowest item is below $5. Deliberately $2 instead of $1, as $1 is reserved for black-friday sales and won't sell quick (like the purpose of this script)
1 parent febe604 commit cb7a142

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

userscripts/Bazaar Auto Price (Torn PDA).js

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ async function lmp(itemID) {
3939
const prices = await torn_api(`market.${itemID}.bazaar`)
4040
if (prices.error) { APIERROR = true; return 'API key error' }
4141
const lowest_market_price = prices['bazaar'][0].cost
42-
return lowest_market_price - 5
42+
return Math.max(lowest_market_price - 5, 2)
4343
}
4444

4545
// HACK to simulate input value change
@@ -125,4 +125,4 @@ var waitForElementsAndRun = setInterval(() => {
125125
// wrapper not found
126126
}
127127
}
128-
}, 300);
128+
}, 300);

0 commit comments

Comments
 (0)