// ==UserScript==
// @name Steam Community Market Bot
// @namespace //benio.me
// @version 2.0
// @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==
/* USAGE WARNING
*
* Note, using this Steam Community Market Bot violates Valve`s Steam Market usage rules.
* Bot, as of jQuery UserScript child, simulates very active steam community market user,
* avoiding Bot typicall activity, making it`s usage just a time safe and leaving a risk.
*/
//////////////////////////////////////////
// //
// Steam Community Market Bot //
// //
// @author Paweł Benetkiewicz //
// @homepage //benio.me //
// //
//////////////////////////////////////////
/*
@desc convert price to decimal format
@param float n number to convert
@param int k digits after dot
@return float prize in decimal format
*/
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($){
// Change prices format
/*$('.market_listing_price').each(function(){
$(this).html($.trim($(this).html().replace(' ', '').replace(',', '.').replace('€', ' €')));
});
// Show clean prices and fees
$('.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];
// buys an item and reloads site
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;
})
// settings start
var shopping_limit=450; // soft limit of shoppings (to safe some maney at account)
var item_price_limit=75; // highest price of item we can afford to buy
// sites rotator // Steam items name identifiers behind the /753/
var items=new Array(
// Portal 2
'Chell',
'Destruction',
'Finale',
'GlaDOS',
'Intro%20%28Trading%20Card%29',
'The%20Lab',
'Mannequin',
'Underground',
// Dota 2
'Bounty%20Hunter',
'Phantom%20Lancer',
'Razor',
'Riki',
'Tidehunter%20%28Trading%20Card%29',
'Tiny',
'Tusk',
'Vengeful%20Spirit%20%28Trading%20Card%29'
);
// settings end
// Auto Buy
if(g_rgWalletInfo['wallet_balance']>=shopping_limit){
// we redresh site if no good offerts
var refresh=0;
// limit checking for Steam (753) items only
if(location.href.substr(0,46)=='http://steamcommunity.com/market/listings/753/'){
// random refresh time
refresh=Math.random()*6000+4000;
// get 2 first offer`s prices
var prices=new Array(2), i=0;
for(listingid in g_rgListingInfo){
if(g_rgListingInfo[listingid]['converted_price']){
prices[i]=listingid;
if(++i>=2)break;
}
}
// check if there are at least 2 offers and the we can stand for buy item
if(i==2 && g_rgListingInfo[prices[0]]['converted_price'] <= item_price_limit){
if(
g_rgListingInfo[prices[0]]['converted_price']
+ g_rgListingInfo[prices[0]]['converted_fee'] + 1
< g_rgListingInfo[prices[1]]['converted_price']
// netto price of 2nd cheapest offer must be less than brutto price of the cheapest offer plus minimum one to get profit
){
// finally price to pay for item
var total=g_rgListingInfo[prices[0]]['converted_price'] + g_rgListingInfo[prices[0]]['converted_fee'];
// Buy item
new Ajax.Request( 'http://steamcommunity.com/market/buylisting/' + prices[0], {
method: 'post',
parameters: {
'sessionid': g_sessionID,
'currency': g_rgWalletInfo['wallet_currency'],
'subtotal': g_rgListingInfo[prices[0]]['converted_price'],
'fee': g_rgListingInfo[prices[0]]['converted_fee'],
'total': total
},
onSuccess: function( transport ) {
// retrieve additional info
var lista=$('#listing_'+prices[0]+' a.item_market_action_button.item_market_action_button_green').attr('href').split("'");
var contextid=lista[5];
var assetid=lista[7];
// Sell item at price minimum less than 2nd cheapest offer, so we have high chance to sell item, having the cheapiest price` offer
new Ajax.Request( 'http://steamcommunity.com/market/sellitem/', {
method: 'post',
parameters: {
'sessionid': g_sessionID,
'appid': 753,
'contextid': contextid,
'assetid': assetid,
'amount': 1,
'price': g_rgListingInfo[prices[1]]['converted_price']-1
},
// refresh site after making a new offer, even if error occured, we set up limit earlier
onSuccess: function( transport ) { document.location.href='http://steamcommunity.com/market/listings/753/'+items[((Math.random()*items.length)|0)]; },
onFailure: function( transport ) { document.location.href='http://steamcommunity.com/market/listings/753/'+items[((Math.random()*items.length)|0)]; }
});
},
// refresh site on failure, fe. if somebody bought item before us
onFailure: function( transport ) { document.location.href='http://steamcommunity.com/market/listings/753/'+items[((Math.random()*items.length)|0)]; }
});
// we shall wait for Ajax response, dont refresh site automatically
refresh=0;
}
}
}
// Auto Recheck
if(refresh){
// we load another site if no good offers available to get profit
window.setTimeout(function(){ document.location.href='http://steamcommunity.com/market/listings/753/'+items[((Math.random()*items.length)|0)]; }, refresh);
}
}
});