Advertisement
munsking

dripbot

Mar 5th, 2014
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var maxLoops = 1000;
  2. var loops = 0;
  3. var buyIt = function(type){
  4.     var bought = false;
  5.     Array.max = function( array ){
  6.         return Math.max.apply( Math, array );
  7.     };
  8.  
  9.     Array.min = function( array ){
  10.         return Math.min.apply( Math, array );
  11.     };
  12.  
  13.     var vals = new Array();
  14.     $('.storeItem').not(".disabled").each(function(index){
  15.         vals.push(parseFloat($(this).find(".storePrice").html()));
  16.     });
  17.  
  18.     $('.storeItem').not(".disabled").each(function(index){
  19.         if(type=="min"){
  20.             if(parseFloat($(this).find(".storePrice").html())==Array.min(vals)){
  21.                 $(this).click();
  22.                 console.log("bought "+$(this).find(".storeItemName").html()+" for "+$(this).find(".storePrice").html());
  23.                 bought=true;
  24.             }
  25.         }else if(type=="max"){
  26.             if(parseFloat($(this).find(".storePrice").html())==Array.max(vals)){
  27.                 $(this).click();
  28.                 console.log("bought "+$(this).find(".storeItemName").html()+" for "+$(this).find(".storePrice").html());
  29.                 bought=true;
  30.             }
  31.         }
  32.     });
  33.     if(!bought){
  34.         console.log("didn't buy anything.");
  35.     }
  36.     if(window.maxLoops){
  37.         loops++;
  38.         if(loops<maxLoops){
  39.             console.log("loop "+loops);
  40.             setTimeout("buyIt('"+type+"')",2000);
  41.         }else{
  42.             console.log("finished");
  43.         }
  44.     }else{
  45.         setTimeout("buyIt('"+type+"')",2000);
  46.     }
  47. }
  48. buyIt("min");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement