Skip to main content

new Game.shimmer

// stop previous hack if present
if(typeof hack != 'undefined'){hack.stop();}

// define our hack "class"
var hack = {
  /**
   * start all "non-breaking" hacks
   */
  start: function() {
    this.startCookie();
    this.startShimmer();
    // this.startCheating();
  },

  /**
   * stop all hacks
   */
  stop: function() {
    this.stopCookie();
    this.stopShimmer();
    this.stopCheating();
  },

  /**
   * golden cookies / reindeer click hack
   */
  startShimmer: function() {
    this.stopShimmer();
    this.shimmersInterval = setInterval(function(){
      var shimmers = document.getElementsByClassName('shimmer');
      for(var shimmer of shimmers){
        shimmer.click();
      }
    }, 1000);
  },
  stopShimmer: function() {
    if(this.shimmersInterval){
      clearInterval(this.shimmersInterval);
    }
  },

  /**
   * cookie click hack
   */
  startCookie: function() {
    this.stopCookie();
    this.cookieInterval = setInterval(function(){
      document.getElementById('bigCookie').click()
    }, 0.05);
  },
  stopCookie: function() {
    if(this.cookieInterval){
      clearInterval(this.cookieInterval);
    }
  },

  /**
   * WARNING : This one will break the fun of the game by spawning a lot of golden cookies and reindeers...
   * Use at your own risk !
   */
  startCheating: function() {
    this.stopCheating();
    this.dontCareInterval = setInterval(function(){
      if(typeof Game != 'undefined'){
        new Game.shimmer('reindeer');
        new Game.shimmer('golden');
      }
    }, 1000);
  },
  stopCheating: function() {
    if(this.dontCareInterval){
      clearInterval(this.dontCareInterval);
    }
  },
};

// auto start all hacks
hack.start();