Anda di halaman 1dari 5

// ==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.m
in.js
// ==/UserScript==

/* USAGE WARNING
*
* Note, using this Steam Community Market Bot violates Valve`s Steam Market usa
ge rules.
* Bot, as of jQuery UserScript child, simulates very active steam community mar
ket user,
* avoiding Bot typicall activity, making it`s usage just a time safe and leavin
g a risk.
*/

//////////////////////////////////////////
//
//
//
Steam Community Market Bot
//
//
//
@author
Pawe Benetkiewicz
//
@homepage
//benio.me
//
//
//////////////////////////////////////////

//
//
//

/*
@desc
@param
@param
@return

convert price to decimal format


float n
number to convert
int
k
digits after dot
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.mar
ket_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').e
ach(function(){
$(this).css({
'display': 'inline',
'color': 'grey'
})
.insertBefore($(this).prev())
.after('<br>')
.after($('<span>').addClass('market_listing_price').html(fee+' &euro
;').css({
'display': 'inline',
'color': 'silver'
}))
.after('<br>');
});
});*/
// 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/' + l
istingid, {
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_r
gListingInfo[listingid]['converted_fee']
},
onSuccess: function( transport ) { location.reload(); },
onFailure: function( transport ) { location.reload(); }
});
return false;
})
// settings start
var shopping_limit=450;
maney at account)
var item_price_limit=75;

// soft limit of shoppings (to safe some


// 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/listing
s/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_pri
ce_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 brutt


o 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/buylisti
ng/' + prices[0], {
method: 'post',
parameters: {
'sessionid': g_sessionID,

'currency': g_rgWalletInfo['wallet_currency'],
'subtotal': g_rgListingInfo[prices[0]]['converted_pr
ice'],
'fee': g_rgListingInfo[prices[0]]['converted_fee'],
'total': total
},
onSuccess: function( transport ) {
// retrieve additional info
var lista=$('#listing_'+prices[0]+' a.item_market_ac
tion_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]]['convert
ed_price']-1
},
// refresh site after making a new offer, even i
f error occured, we set up limit earlier
onSuccess: function( transport ) { document.loca
tion.href='http://steamcommunity.com/market/listings/753/'+items[((Math.random()
*items.length)|0)]; },
onFailure: function( transport ) { docum
ent.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.hre
f='http://steamcommunity.com/market/listings/753/'+items[((Math.random()*items.l
ength)|0)]; }
});
// we shall wait for Ajax response, dont refresh site automa
tically
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://steamco
mmunity.com/market/listings/753/'+items[((Math.random()*items.length)|0)]; }, re
fresh);
}
}

});

Anda mungkin juga menyukai