mirror of
https://github.com/Luzifer/automate-cookie-clicker.git
synced 2024-12-22 18:21:18 +00:00
Don't try to buy an upgrade twice
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
9141d86ea0
commit
23dc21bdfc
1 changed files with 3 additions and 3 deletions
|
@ -1,7 +1,7 @@
|
||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Automate CookieClicker
|
// @name Automate CookieClicker
|
||||||
// @namespace https://luzifer.io/
|
// @namespace https://luzifer.io/
|
||||||
// @version 0.19.1
|
// @version 0.19.2
|
||||||
// @description Automate everything!
|
// @description Automate everything!
|
||||||
// @author Knut Ahlers <knut@ahlers.me>
|
// @author Knut Ahlers <knut@ahlers.me>
|
||||||
// @source https://github.com/Luzifer/automate-cookie-clicker
|
// @source https://github.com/Luzifer/automate-cookie-clicker
|
||||||
|
@ -42,13 +42,13 @@ function executeAutoActions() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Look for upgrades being available
|
// 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) {
|
while (availableUpgrades.length > 0) {
|
||||||
let upgrade = availableUpgrades[0];
|
let upgrade = availableUpgrades[0];
|
||||||
upgrade.buy();
|
upgrade.buy();
|
||||||
note(`Purchased upgrade ${upgrade.name} for you.`);
|
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
|
// Get the top enabled purchase to be made
|
||||||
|
|
Loading…
Reference in a new issue