From d9c49b9bc5dfe9052cf3e0ad095ec0aeba0cd512 Mon Sep 17 00:00:00 2001 From: Andrii Lavrenko Date: Tue, 8 Oct 2024 21:35:05 +0300 Subject: [PATCH 1/3] ignore listing price settings --- code.user.js | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/code.user.js b/code.user.js index 0e65810..4b544ec 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,17 +1298,23 @@ 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 padLeft = `${padLeftZero(`${totalNumberOfProcessedQueueItems}`, digits)} / ${totalNumberOfQueuedItems}`; + + if (getSettingWithDefault(SETTING_PRICE_MIN_LIST_PRICE) * 100 >= market.getPriceIncludingFees(task.sellPrice)) { + logDOM(`${padLeft} - ${itemName} 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 || ''; @@ -3807,6 +3815,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:  @@ -3859,6 +3871,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()); From 574aff04800d9c5729f199be7ae38856612818ae Mon Sep 17 00:00:00 2001 From: Andrii Lavrenko Date: Sat, 21 Dec 2024 10:05:23 +0200 Subject: [PATCH 2/3] Update code.user.js Co-authored-by: Nuklon --- code.user.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code.user.js b/code.user.js index 4b544ec..55af87a 100644 --- a/code.user.js +++ b/code.user.js @@ -1299,6 +1299,7 @@ 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; @@ -1308,9 +1309,9 @@ logDOM(`${padLeft} - ${itemName} 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, From b4054f36e591b91db35acfe49a122a8e6eb8bfea Mon Sep 17 00:00:00 2001 From: Andrii Lavrenko Date: Sat, 21 Dec 2024 10:45:43 +0200 Subject: [PATCH 3/3] small updates --- code.user.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/code.user.js b/code.user.js index 262aa53..dfb9552 100644 --- a/code.user.js +++ b/code.user.js @@ -1303,10 +1303,11 @@ 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} - ${itemName} is not listed due to ignoring price settings.`); + 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; @@ -1322,8 +1323,7 @@ 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; @@ -1336,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); @@ -1348,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();