From 097be5062670859e1d221899d5818eae7877fc3c Mon Sep 17 00:00:00 2001 From: Pavel Djundik Date: Sun, 14 Jul 2024 16:13:28 +0300 Subject: [PATCH 1/2] Fix getting goo value Fixes #107 Fixes #110 --- code.user.js | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/code.user.js b/code.user.js index 5530d17..7829b91 100644 --- a/code.user.js +++ b/code.user.js @@ -522,13 +522,30 @@ SteamMarket.prototype.getGooValue = function(item, callback) { try { + var appid = item.market_fee_app; + + for (const action of item.owner_actions) { + if (!action.link || !action.link.startsWith('javascript:GetGooValue')) { + continue; + } + + var rgMatches = action.link.match( /GetGooValue\( *'?(?:[%a-z0-9]+)'? *, *'?(?:[%a-z0-9]+)'? *, *'?(?[0-9]+)'?/ ); + + if (!rgMatches) { + continue; + } + + appid = rgMatches.groups.appid; + break; + } + var sessionId = readCookie('sessionid'); $.ajax({ type: "GET", url: this.inventoryUrlBase + 'ajaxgetgoovalue/', data: { sessionid: sessionId, - appid: item.market_fee_app, + appid: appid, assetid: item.assetid, contextid: item.contextid }, @@ -1381,7 +1398,7 @@ return callback(false); } - item.goo_value_expected = parseInt(goo.goo_value); + item.goo_value_expected = parseInt(goo.goo_value, 10); market.grindIntoGoo(item, function(err, result) { From 1ad525326f8b84fb7fade3710c649859b794d375 Mon Sep 17 00:00:00 2001 From: Pavel Djundik Date: Sun, 14 Jul 2024 20:20:12 +0300 Subject: [PATCH 2/2] Simplify regex --- code.user.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code.user.js b/code.user.js index 7829b91..3e8430f 100644 --- a/code.user.js +++ b/code.user.js @@ -529,7 +529,7 @@ continue; } - var rgMatches = action.link.match( /GetGooValue\( *'?(?:[%a-z0-9]+)'? *, *'?(?:[%a-z0-9]+)'? *, *'?(?[0-9]+)'?/ ); + var rgMatches = action.link.match( /GetGooValue\( *'%contextid%', *'%assetid%', *'?(?[0-9]+)'?/ ); if (!rgMatches) { continue;