Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong appid when requesting goo value for sale items #107

Closed
xPaw opened this issue Jan 4, 2019 · 2 comments · Fixed by #206
Closed

Wrong appid when requesting goo value for sale items #107

xPaw opened this issue Jan 4, 2019 · 2 comments · Fixed by #206

Comments

@xPaw
Copy link
Contributor

xPaw commented Jan 4, 2019

For example items like Cozy Cottage - The Witcher 3

Data looks like this:

		"market_hash_name": "991980-Cozy Cottage - The Witcher 3",
		"market_fee_app": 292030,
		"owner_actions": [{
			"link": "javascript:GetGooValue( '%contextid%', '%assetid%', 991980, 51, 0 )",
			"name": "Turn into Gems..."
		}],

The script requests appid 292030 but Steam code uses 991980 id by parsing it from GetGooValue string above. Because the script uses wrong appid, these items do not get turned into goo with message Cozy Cottage - The Witcher 3 not turned into gems due to missing gems value.

@Lucki
Copy link

Lucki commented Jan 7, 2019

https://www.reddit.com/r/Steam/comments/a9exyu/steam_economy_enhancer_cant_convert_cozy/ecvtqop

--- a	2019-01-07 16:27:43.422575399 +0100
+++ b	2019-01-07 16:29:00.762276644 +0100
@@ -1213,16 +1213,22 @@
                     var digits = getNumberOfDigits(totalNumberOfQueuedItems);
                     var padLeft = padLeftZero('' + totalNumberOfProcessedQueueItems, digits) + ' / ' + totalNumberOfQueuedItems;
 
-                    if (err != ERROR_SUCCESS) {
-                        logConsole('Failed to get gems value for ' + itemName);
-                        logDOM(padLeft + ' - ' + itemName + ' not turned into gems due to missing gems value.');
+                    // https://www.reddit.com/r/Steam/comments/a9exyu/steam_economy_enhancer_cant_convert_cozy/ecvtqop
+                    // Fix for Winter Sale 2018
+                    if (!itemName.includes(":cozy") && !itemName.includes("Cozy Cottage")) {
+                        if (err != ERROR_SUCCESS) {
+                            logConsole('Failed to get gems value for ' + itemName);
+                            logDOM(padLeft + ' - ' + itemName + ' not turned into gems due to missing gems value.');
 
-                        $('#' + item.appid + '_' + item.contextid + '_' + itemId).css('background', COLOR_ERROR);
-                        return callback(false);
+                            $('#' + item.appid + '_' + item.contextid + '_' + itemId).css('background', COLOR_ERROR);
+                            return callback(false);
+                        }
+                        
+                        item.goo_value_expected = parseInt(goo.goo_value);
+                    } else {
+                        item.goo_value_expected = 100;
                     }
 
-                    item.goo_value_expected = parseInt(goo.goo_value);
-
                     market.grindIntoGoo(item,
                         function(err, result) {
                             if (err != ERROR_SUCCESS) {

https://github.com/Nuklon/Steam-Economy-Enhancer/blob/master/code.user.js#L1216-L1224

@sffxzzp
Copy link

sffxzzp commented Dec 27, 2019

I rewrite "SteamMarket.prototype.getGooValue" part using "/auction/ajaxgetgoovalueforitemtype/" instead of current "/my/ajaxgetgoovalue/".
It works fine, at least on my browser. And not only works for the "cozy" items.

SteamMarket.prototype.getGooValue = function(item, callback) {
    try {
        for (var i = 0; i < item.owner_actions.length; i++) {
            var action = item.owner_actions[i];
            if ( !action.link || !action.name ) {
                continue;
            }
            if (action.link.match(/^javascript:GetGooValue/)) {
                var item_data = action.link.split(',');
                var appid = item_data[2].trim();
                var item_type = item_data[3].trim();
                var border_color = item_data[4].trim();
                $.ajax({
                    type: "GET",
                    url: window.location.protocol+'//steamcommunity.com/auction/ajaxgetgoovalueforitemtype/',
                    data: {
                        appid: appid,
                        item_type: item_type,
                        border_color: border_color
                    },
                    success: function(data) {
                        callback(ERROR_SUCCESS, data);
                    },
                    error: function(data) {
                        return callback(ERROR_FAILED, data);
                    },
                    crossDomain: true,
                    xhrFields: {
                        withCredentials: true
                    },
                    dataType: 'json'
                });
            }
        }
    } catch (e) {
        return callback(ERROR_FAILED);
    }
    //http://steamcommunity.com/auction/ajaxgetgoovalueforitemtype/?appid=582980&item_type=18&border_color=0
    // OR
    //http://steamcommunity.com/my/ajaxgetgoovalue/?sessionid=xyz&appid=535690&assetid=4830605461&contextid=6
    //sessionid=xyz
    //appid = 535690
    //assetid = 4830605461
    //contextid = 6
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants