// ==UserScript==
// @name Steam Community Market Bot
// @namespace //benio.me
// @version 1.1
// @description Instant buy. Sell and buy bot
// @match http://steamcommunity.com/market/*
// @copyright //benio.me
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js
// ==/UserScript==
Math.decimal = function(n, k){
var factor = Math.pow(10, k+1);
n = Math.round(Math.round(n*factor)/10);
return n/(factor/10);
}
jQuery.support.cors = true;
jQuery(document).ready(function($){
/*$('.market_listing_price').each(function(){
$(this).html($.trim($(this).html().replace(' ', '').replace(',', '.').replace('€', ' €')));
});
$('.market_listing_right_cell.market_listing_their_price').each(function(){
var total=Math.decimal($.trim($(this).find('.market_listing_price.market_listing_price_with_fee').html()).slice(0, -2).replace(' ', '').replace(',', '.'), 2);
var subtotal=Math.decimal($.trim($(this).find('.market_listing_price.market_listing_price_without_fee').html()).slice(0, -2).replace(' ', '').replace(',', '.'), 2);
var fee=Math.decimal(total-subtotal, 2);
$(this).find('.market_listing_price.market_listing_price_without_fee').each(function(){
$(this).css({
'display': 'inline',
'color': 'grey'
})
.insertBefore($(this).prev())
.after('
')
.after($('').addClass('market_listing_price').html(fee+' €').css({
'display': 'inline',
'color': 'silver'
}))
.after('
');
});
});*/
// Instant Buy
$('a.item_market_action_button.item_market_action_button_green')
.click(function(){
var listingid=$(this).attr('href').split("'")[3];
/*$.ajax({
type: "POST",
url: 'http://steamcommunity.com/market/buylisting/' + listingid,
crossDomain: true,
dataType: "xml",
data: {
'sessionid': "1"+g_sessionID,
'currency': g_rgWalletInfo['wallet_currency'],
'subtotal': g_rgListingInfo[listingid]['converted_price'],
'fee': g_rgListingInfo[listingid]['converted_fee'],
'total': g_rgListingInfo[listingid]['converted_price'] + g_rgListingInfo[listingid]['converted_fee']
}
}).done(function(){
location.reload();
}).fail(function(event, jqXHR, ajaxSettings, thrownError){
console.log('event: '+event+', jqXHR: '+jqXHR+', ajaxSettings: '+ajaxSettings+', thrownError: '+thrownError);
});*/
new Ajax.Request( 'http://steamcommunity.com/market/buylisting/' + listingid, {
method: 'post',
parameters: {
'sessionid': g_sessionID,
'currency': g_rgWalletInfo['wallet_currency'],
'subtotal': g_rgListingInfo[listingid]['converted_price'],
'fee': g_rgListingInfo[listingid]['converted_fee'],
'total': g_rgListingInfo[listingid]['converted_price'] + g_rgListingInfo[listingid]['converted_fee']
},
onSuccess: function( transport ) { location.reload(); },
onFailure: function( transport ) { location.reload(); }
});
return false;
})
// Auto Buy
var refresh=0;
if(location.href=='http://steamcommunity.com/market/listings/753/Steam%20Trading%20Card%20Beta'){
refresh=Math.random()*6000+1000;
for(listingid in g_rgListingInfo){
var total=g_rgListingInfo[listingid]['converted_price'] + g_rgListingInfo[listingid]['converted_fee'];
if(total<=12){
new Ajax.Request( 'http://steamcommunity.com/market/buylisting/' + listingid, {
method: 'post',
parameters: {
'sessionid': g_sessionID,
'currency': g_rgWalletInfo['wallet_currency'],
'subtotal': g_rgListingInfo[listingid]['converted_price'],
'fee': g_rgListingInfo[listingid]['converted_fee'],
'total': total
},
onSuccess: function( transport ) {
var lista=$('#listing_'+listingid+' a.item_market_action_button.item_market_action_button_green').attr('href').split("'");
var contextid=lista[5];
var assetid=lista[7];
new Ajax.Request( 'http://steamcommunity.com/market/sellitem/', {
method: 'post',
parameters: {
'sessionid': g_sessionID,
'appid': g_rgListingInfo[listingid]['publisher_fee_app'],
'contextid': contextid,
'assetid': assetid,
'amount': 1,
'price': 14
},
onSuccess: function( transport ) { location.reload(); },
onFailure: function( transport ) { location.reload(); }
});
},
onFailure: function( transport ) { location.reload(); }
});
refresh=0;
break;
}
}
}
// Auto Recheck
if(refresh){
window.setTimeout(function(){location.reload()}, refresh);
}
});