diff --git a/code.user.js b/code.user.js index 8763b1a..dfb9552 100644 --- a/code.user.js +++ b/code.user.js @@ -196,6 +196,7 @@ const SETTING_MAX_MISC_PRICE = 'SETTING_MAX_MISC_PRICE'; const SETTING_PRICE_OFFSET = 'SETTING_PRICE_OFFSET'; const SETTING_PRICE_MIN_CHECK_PRICE = 'SETTING_PRICE_MIN_CHECK_PRICE'; + const SETTING_PRICE_MIN_LIST_PRICE = 'SETTING_PRICE_MIN_LIST_PRICE'; const SETTING_PRICE_ALGORITHM = 'SETTING_PRICE_ALGORITHM'; const SETTING_PRICE_IGNORE_LOWEST_Q = 'SETTING_PRICE_IGNORE_LOWEST_Q'; const SETTING_PRICE_HISTORY_HOURS = 'SETTING_PRICE_HISTORY_HOURS'; @@ -215,6 +216,7 @@ SETTING_MAX_MISC_PRICE: 10, SETTING_PRICE_OFFSET: 0.00, SETTING_PRICE_MIN_CHECK_PRICE: 0.00, + SETTING_PRICE_MIN_LIST_PRICE: 0.03, SETTING_PRICE_ALGORITHM: 1, SETTING_PRICE_IGNORE_LOWEST_Q: 1, SETTING_PRICE_HISTORY_HOURS: 12, @@ -1296,25 +1298,32 @@ const sellQueue = async.queue( (task, next) => { + totalNumberOfProcessedQueueItems++; + + const digits = getNumberOfDigits(totalNumberOfQueuedItems); + const itemId = task.item.assetid || task.item.id; + const itemName = task.item.name || task.item.description.name; + const itemNameWithAmount = task.item.amount == 1 ? itemName : `${task.item.amount}x ${itemName}`; + const padLeft = `${padLeftZero(`${totalNumberOfProcessedQueueItems}`, digits)} / ${totalNumberOfQueuedItems}`; + + if (getSettingWithDefault(SETTING_PRICE_MIN_LIST_PRICE) * 100 >= market.getPriceIncludingFees(task.sellPrice)) { + logDOM(`${padLeft} - ${itemNameWithAmount} is not listed due to ignoring price settings.`); + $(`#${task.item.appid}_${task.item.contextid}_${itemId}`).css('background', COLOR_PRICE_NOT_CHECKED); + next(); + return; + } + market.sellItem( task.item, task.sellPrice, (error, data) => { - totalNumberOfProcessedQueueItems++; - - const digits = getNumberOfDigits(totalNumberOfQueuedItems); - const itemId = task.item.assetid || task.item.id; - const itemName = task.item.name || task.item.description.name; - const padLeft = `${padLeftZero(`${totalNumberOfProcessedQueueItems}`, digits)} / ${totalNumberOfQueuedItems}`; - const success = Boolean(data?.success); const message = data?.message || ''; const callback = () => setTimeout(() => next(), getRandomInt(1000, 1500)); if (success) { - const amount = task.item.amount == 1 ? '' : `${task.item.amount}x `; - logDOM(`${padLeft} - ${amount}${itemName} listed for ${formatPrice(market.getPriceIncludingFees(task.sellPrice) * task.item.amount)}, you will receive ${formatPrice(task.sellPrice * task.item.amount)}.`); + logDOM(`${padLeft} - ${itemNameWithAmount} listed for ${formatPrice(market.getPriceIncludingFees(task.sellPrice) * task.item.amount)}, you will receive ${formatPrice(task.sellPrice * task.item.amount)}.`); $(`#${task.item.appid}_${task.item.contextid}_${itemId}`).css('background', COLOR_SUCCESS); totalPriceWithoutFeesOnMarket += task.sellPrice * task.item.amount; @@ -1327,7 +1336,7 @@ } if (message && isRetryMessage(message)) { - logDOM(`${padLeft} - ${itemName} retrying listing because: ${message.charAt(0).toLowerCase()}${message.slice(1)}`); + logDOM(`${padLeft} - ${itemNameWithAmount} retrying listing because: ${message.charAt(0).toLowerCase()}${message.slice(1)}`); totalNumberOfProcessedQueueItems--; sellQueue.unshift(task); @@ -1339,7 +1348,7 @@ return; } - logDOM(`${padLeft} - ${itemName} not added to market${message ? ` because: ${message.charAt(0).toLowerCase()}${message.slice(1)}` : '.'}`); + logDOM(`${padLeft} - ${itemNameWithAmount} not added to market${message ? ` because: ${message.charAt(0).toLowerCase()}${message.slice(1)}` : '.'}`); $(`#${task.item.appid}_${task.item.contextid}_${itemId}`).css('background', COLOR_ERROR); callback(); @@ -3813,6 +3822,10 @@ Don't check market listings with prices of and below:  +
+ Don't list market listings with prices of and below:  + +
Show price labels in inventory:  @@ -3865,6 +3878,7 @@ setSetting(SETTING_MAX_MISC_PRICE, $(`#${SETTING_MAX_MISC_PRICE}`, price_options).val()); setSetting(SETTING_PRICE_OFFSET, $(`#${SETTING_PRICE_OFFSET}`, price_options).val()); setSetting(SETTING_PRICE_MIN_CHECK_PRICE, $(`#${SETTING_PRICE_MIN_CHECK_PRICE}`, price_options).val()); + setSetting(SETTING_PRICE_MIN_LIST_PRICE, $(`#${SETTING_PRICE_MIN_LIST_PRICE}`, price_options).val()) setSetting(SETTING_PRICE_ALGORITHM, $(`#${SETTING_PRICE_ALGORITHM}`, price_options).val()); setSetting(SETTING_PRICE_IGNORE_LOWEST_Q, $(`#${SETTING_PRICE_IGNORE_LOWEST_Q}`, price_options).prop('checked') ? 1 : 0); setSetting(SETTING_PRICE_HISTORY_HOURS, $(`#${SETTING_PRICE_HISTORY_HOURS}`, price_options).val());