Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var maxLoops = 1000;
- var loops = 0;
- var buyIt = function(type){
- var bought = false;
- Array.max = function( array ){
- return Math.max.apply( Math, array );
- };
- Array.min = function( array ){
- return Math.min.apply( Math, array );
- };
- var vals = new Array();
- $('.storeItem').not(".disabled").each(function(index){
- vals.push(parseFloat($(this).find(".storePrice").html()));
- });
- $('.storeItem').not(".disabled").each(function(index){
- if(type=="min"){
- if(parseFloat($(this).find(".storePrice").html())==Array.min(vals)){
- $(this).click();
- console.log("bought "+$(this).find(".storeItemName").html()+" for "+$(this).find(".storePrice").html());
- bought=true;
- }
- }else if(type=="max"){
- if(parseFloat($(this).find(".storePrice").html())==Array.max(vals)){
- $(this).click();
- console.log("bought "+$(this).find(".storeItemName").html()+" for "+$(this).find(".storePrice").html());
- bought=true;
- }
- }
- });
- if(!bought){
- console.log("didn't buy anything.");
- }
- if(window.maxLoops){
- loops++;
- if(loops<maxLoops){
- console.log("loop "+loops);
- setTimeout("buyIt('"+type+"')",2000);
- }else{
- console.log("finished");
- }
- }else{
- setTimeout("buyIt('"+type+"')",2000);
- }
- }
- buyIt("min");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement