From 23dc21bdfc4ca74caa0eac2a101d7e5a8e2af776 Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Sat, 21 Apr 2018 14:08:04 +0200 Subject: [PATCH] Don't try to buy an upgrade twice Signed-off-by: Knut Ahlers --- autocookieclicker.user.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/autocookieclicker.user.js b/autocookieclicker.user.js index 5439973..22e6d15 100644 --- a/autocookieclicker.user.js +++ b/autocookieclicker.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name Automate CookieClicker // @namespace https://luzifer.io/ -// @version 0.19.1 +// @version 0.19.2 // @description Automate everything! // @author Knut Ahlers // @source https://github.com/Luzifer/automate-cookie-clicker @@ -42,13 +42,13 @@ function executeAutoActions() { } // Look for upgrades being available - let availableUpgrades = Game.UpgradesInStore.filter(obj => obj.canBuy() && !blockingUpgrades.includes(obj.id)); + let availableUpgrades = Game.UpgradesInStore.filter(obj => obj.canBuy() && !obj.bought && !blockingUpgrades.includes(obj.id)); while (availableUpgrades.length > 0) { let upgrade = availableUpgrades[0]; upgrade.buy(); note(`Purchased upgrade ${upgrade.name} for you.`); - availableUpgrades = Game.UpgradesInStore.filter(obj => obj.canBuy() && !blockingUpgrades.includes(obj.id)); + availableUpgrades = Game.UpgradesInStore.filter(obj => obj.canBuy() && !obj.bought && !blockingUpgrades.includes(obj.id)); } // Get the top enabled purchase to be made