Skip to content

Commit

Permalink
ignore listing price settings
Browse files Browse the repository at this point in the history
  • Loading branch information
SeRi0uS007 committed Oct 8, 2024
1 parent c84abed commit d9c49b9
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions code.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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,
Expand Down Expand Up @@ -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 || '';

Expand Down Expand Up @@ -3807,6 +3815,10 @@
Don't check market listings with prices of and below: 
<input type="number" step="0.01" id="${SETTING_PRICE_MIN_CHECK_PRICE}" value=${getSettingWithDefault(SETTING_PRICE_MIN_CHECK_PRICE)}>
</div>
<div style="margin-top:6px;">
Don't list market listings with prices of and below:&nbsp;
<input type="number" step="0.01" id="${SETTING_PRICE_MIN_LIST_PRICE}" value=${getSettingWithDefault(SETTING_PRICE_MIN_LIST_PRICE)}>
</div>
<div style="margin-top:24px">
Show price labels in inventory:&nbsp;
<input type="checkbox" id="${SETTING_INVENTORY_PRICE_LABELS}" ${getSettingWithDefault(SETTING_INVENTORY_PRICE_LABELS) == 1 ? 'checked' : ''}>
Expand Down Expand Up @@ -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());
Expand Down

0 comments on commit d9c49b9

Please sign in to comment.