mirror of
https://github.com/Luzifer/automate-cookie-clicker.git
synced 2024-11-08 14:00:12 +00:00
Do not try to buy when there is nothing to buy
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
f489079569
commit
447bc7d2d1
1 changed files with 12 additions and 10 deletions
|
@ -1,7 +1,7 @@
|
|||
// ==UserScript==
|
||||
// @name Automate CookieClicker
|
||||
// @namespace https://luzifer.io/
|
||||
// @version 0.5.1
|
||||
// @version 0.5.2
|
||||
// @description Automate everything!
|
||||
// @author Knut Ahlers <knut@ahlers.me>
|
||||
// @match http://orteil.dashnet.org/cookieclicker/
|
||||
|
@ -28,15 +28,17 @@ function autoPurchaseUpgrades() {
|
|||
}
|
||||
|
||||
// Get the top enabled purchase to be made
|
||||
let topPurchase = $('.product.unlocked.enabled').last();
|
||||
let topPurchaseCount = 0;
|
||||
if (topPurchase.find('.owned').text() != "") {
|
||||
topPurchaseCount = parseInt(topPurchase.find('.owned').text());
|
||||
}
|
||||
if (topPurchaseCount < 50) {
|
||||
debug("Auto-Buying: " + topPurchase.find('.title:first').text());
|
||||
topPurchase.click();
|
||||
toastr.info('Purchased ' + topPurchase.find('.title:first').text() + ' for you.');
|
||||
if ($('.product.unlocked.enabled').length > 0) {
|
||||
let topPurchase = $('.product.unlocked.enabled').last();
|
||||
let topPurchaseCount = 0;
|
||||
if (topPurchase.find('.owned').text() != "") {
|
||||
topPurchaseCount = parseInt(topPurchase.find('.owned').text());
|
||||
}
|
||||
if (topPurchaseCount < 50) {
|
||||
debug("Auto-Buying: " + topPurchase.find('.title:first').text());
|
||||
topPurchase.click();
|
||||
toastr.info('Purchased ' + topPurchase.find('.title:first').text() + ' for you.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue