Skip to content

Commit

Permalink
Merge branch 'Nuklon:master' into ignore-listing-price
Browse files Browse the repository at this point in the history
  • Loading branch information
SeRi0uS007 authored Dec 21, 2024
2 parents 574aff0 + 6b8582f commit 91adb13
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions code.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// @namespace https://github.com/Nuklon
// @author Nuklon
// @license MIT
// @version 7.1.1
// @version 7.1.2
// @description Enhances the Steam Inventory and Steam Market.
// @match https://steamcommunity.com/id/*/inventory*
// @match https://steamcommunity.com/profiles/*/inventory*
Expand Down Expand Up @@ -510,7 +510,7 @@
appid: item.appid,
contextid: item.contextid,
assetid: item.assetid || item.id,
amount: 1,
amount: item.amount,
price: price
},
responseType: 'json'
Expand Down Expand Up @@ -1322,11 +1322,12 @@
const callback = () => setTimeout(() => next(), getRandomInt(1000, 1500));

if (success) {
logDOM(`${padLeft} - ${itemName} listed for ${formatPrice(market.getPriceIncludingFees(task.sellPrice))}, you will receive ${formatPrice(task.sellPrice)}.`);
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)}.`);
$(`#${task.item.appid}_${task.item.contextid}_${itemId}`).css('background', COLOR_SUCCESS);

totalPriceWithoutFeesOnMarket += task.sellPrice;
totalPriceWithFeesOnMarket += market.getPriceIncludingFees(task.sellPrice);
totalPriceWithoutFeesOnMarket += task.sellPrice * task.item.amount;
totalPriceWithFeesOnMarket += market.getPriceIncludingFees(task.sellPrice) * task.item.amount;

updateTotals();
callback()
Expand Down Expand Up @@ -3057,17 +3058,19 @@

let totalPriceBuyer = 0;
let totalPriceSeller = 0;
let totalAmount = 0;
// Add the listings to the queue to be checked for the price.
for (let i = 0; i < marketLists.length; i++) {
for (let j = 0; j < marketLists[i].items.length; j++) {
const listingid = replaceNonNumbers(marketLists[i].items[j].values().market_listing_item_name);
const assetInfo = getAssetInfoFromListingId(listingid);

totalAmount += assetInfo.amount
if (!isNaN(assetInfo.priceBuyer)) {
totalPriceBuyer += assetInfo.priceBuyer;
totalPriceBuyer += assetInfo.priceBuyer * assetInfo.amount;
}
if (!isNaN(assetInfo.priceSeller)) {
totalPriceSeller += assetInfo.priceSeller;
totalPriceSeller += assetInfo.priceSeller * assetInfo.amount;
}

marketListingsQueue.push({
Expand All @@ -3080,7 +3083,8 @@
}
}

$('#my_market_selllistings_number').append(`<span id="my_market_sellistings_total_price">, ${formatPrice(totalPriceBuyer)}${formatPrice(totalPriceSeller)}</span>`);
$('#my_market_selllistings_number').append(`<span id="my_market_sellistings_total_amount"> [${totalAmount}]</span>`)
.append(`<span id="my_market_sellistings_total_price">, ${formatPrice(totalPriceBuyer)}${formatPrice(totalPriceSeller)}</span>`);
}


Expand All @@ -3103,10 +3107,12 @@
const appid = replaceNonNumbers(itemIds[2]);
const contextid = replaceNonNumbers(itemIds[3]);
const assetid = replaceNonNumbers(itemIds[4]);
const amount = Number(unsafeWindow.g_rgAssets[appid][contextid][assetid].amount);
return {
appid,
contextid,
assetid,
amount,
priceBuyer,
priceSeller
};
Expand Down Expand Up @@ -3762,7 +3768,7 @@


// This only works with a new trade offer.
if (location.pathname !== '/tradeoffer/new/') {
if (location.pathname !== '/tradeoffer/new/' && location.pathname !== '/tradeoffer/new') {
return;
}

Expand Down

0 comments on commit 91adb13

Please sign in to comment.