Advertisement
Guest User

Untitled

a guest
Apr 7th, 2020
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Cheater = {best : {value: 0.0, t: "null", obj: null} };
  2.  
  3. Cheater.UpdateWhoToBuy = function () {
  4.   var best = {value: 0.0, t: "null", obj: null};
  5.  
  6.   Game.Objects["Cursor"].getFree(+60);
  7.   Game.CalculateGains();
  8.   var original_cps = Game.cookiesPs;
  9.  
  10.   for (var me in Game.Upgrades) {
  11.     if (typeof Game.Upgrades[me] === "undefined" || !Game.Upgrades[me].unlocked || Game.Upgrades[me].bought) continue;
  12.     var price = Game.Upgrades[me].getPrice();
  13.     Game.Upgrades[me].earn();
  14.     Game.CalculateGains();
  15.     var value = ( Game.cookiesPs - original_cps ) / price;
  16.     Game.Upgrades[me].unearn();
  17.  
  18.     if ( value  >  best.value ) {
  19.       best = {value: value, t: "upgrade", obj: me};
  20.     }
  21.   }
  22.  
  23.   Game.Objects["Cursor"].getFree(-60);
  24.   Game.CalculateGains();
  25.   original_cps = Game.cookiesPs;
  26.  
  27.   for (var me in Game.Objects) {
  28.     if (typeof Game.Objects[me] === "undefined") continue;
  29.     var price = Game.Objects[me].getPrice(1);
  30.     Game.Objects[me].getFree(+1);
  31.     Game.CalculateGains();
  32.     var value = ( Game.cookiesPs - original_cps ) / price;
  33.     Game.Objects[me].getFree(-1);
  34.  
  35.     if (value > best.value) {
  36.       best = {value: value, t: "object", obj: me};
  37.     }
  38.   }
  39.  
  40.   Game.CalculateGains(); // refresh gain
  41.   this.best = best;
  42. };
  43.  
  44.  
  45. Cheater.DoOnePass = function () {
  46.   this.UpdateWhoToBuy();
  47.   var changed = false;
  48.  
  49.   if (this.best.t === "upgrade") {
  50.     if (Game.Upgrades[this.best.obj].canBuy()) {
  51.         Game.Upgrades[this.best.obj].buy(true);
  52.         changed = true;
  53.     }
  54.   } else if(this.best.t === "object") {
  55.     if (Game.Objects[this.best.obj].getPrice() <= Game.cookies) {
  56.        Game.Objects[this.best.obj].buy();
  57.        changed = true;
  58.     }
  59.   }
  60.  
  61.   if (changed) {
  62.       this.UpdateWhoToBuy();
  63.   }
  64. }
  65.  
  66. Cheater.Loop = function() {
  67.   Cheater.DoOnePass();
  68.   setTimeout(function() { Cheater.Loop(); }, 100);
  69. }
  70.  
  71. Cheater.DoAutoClicking = function() {
  72.   Game.ClickCookie();
  73.   setTimeout(function() { Cheater.DoAutoClicking(); }, 167);
  74. }
  75.  
  76. Cheater.Start = function() {
  77.   Cheater.Loop();
  78.   Cheater.DoAutoClicking();
  79. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement