Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. window.setInterval(
  2. function () {
  3. var findMin = function (arr, id) {
  4. var minPrice = Number.POSITIVE_INFINITY;
  5. arr.forEach(function (obj) {
  6. if (obj[id] < minPrice && obj[id] > 0) {
  7. minPrice = obj[id];
  8. }
  9. });
  10. return minPrice;
  11. }
  12. var clickCheck = function(id) {
  13. var thing = $(id);
  14. if (thing) { thing.click(); }
  15. }
  16. var minObjectPrice = findMin(Game.ObjectsById, 'bulkPrice');
  17. var minUpgradePrice = findMin(Game.UpgradesInStore, 'basePrice');
  18. window.debug.minObjectPrice = minObjectPrice;
  19. window.debug.minUpgradePrice = minUpgradePrice;
  20. var proximityThreshold = 0.1;
  21.  
  22. if (minUpgradePrice * (1 - proximityThreshold) < minObjectPrice) {
  23. clickCheck('.crate.upgrade.enabled:not(.selector)');
  24. } else {
  25. clickCheck('.product.unlocked.enabled');
  26. }
  27.  
  28. clickCheck('#goldenCookie');
  29. clickCheck('#bigCookie');
  30.  
  31.  
  32. }
  33. , 0);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement