puggan

CookieMonsterAuto.js

May 2nd, 2021 (edited)
508
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. window.runPuggan = (() => {
  2.     const upgradesElement = document.getElementById('upgrades');
  3.     for(const upgradeElement of upgradesElement.children) {
  4.         if(+upgradeElement.style.order === 1) {
  5.             if(!upgradeElement.classList.contains('upgrade')) continue;
  6.             const priceElement = upgradeElement.querySelector('.CMBackBlue');
  7.             if(!priceElement) continue;
  8.             if(!upgradeElement.classList.contains('enabled')) return false;
  9.             upgradeElement.click();
  10.             return upgradeElement;
  11.         }
  12.     }
  13.  
  14.     const productsElement = document.getElementById('products');
  15.     for(const productElement of productsElement.children) {
  16.         if(+productElement.style['grid-row-start'] === 2) {
  17.             if(!productElement.classList.contains('product')) continue;
  18.             if(!productElement.classList.contains('unlocked')) return false;
  19.             if(!productElement.classList.contains('enabled')) return false;
  20.  
  21.             const priceElement = productElement.querySelector('.price');
  22.             if(!priceElement) continue;
  23.  
  24.             const isBlue = priceElement.style.color !== 'rgb(0, 255, 0)';
  25.  
  26.             if(!isBlue) {
  27.                 const productId = +productElement.id.substr(7);
  28.                 const product = Game.ObjectsById[productId];
  29.                 const cost = product.bulkPrice;
  30.                 if ( cost <= 0 || Game.cookies <= cost * 10) {
  31.                     return false;
  32.                 }
  33.             }
  34.  
  35.  
  36.             productElement.click();
  37.             return productElement;
  38.         }
  39.     }
  40.  
  41.     return null;
  42. });
  43. clearInterval(puggan.auto);
  44. puggan.auto = setInterval(runPuggan, 3000);
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×