mirror of
https://github.com/Luzifer/automate-cookie-clicker.git
synced 2024-11-08 14:00:12 +00:00
Fix: Don't endless loop
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
59cfc9f695
commit
1cd1089add
1 changed files with 2 additions and 2 deletions
|
@ -1,7 +1,7 @@
|
||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Automate CookieClicker
|
// @name Automate CookieClicker
|
||||||
// @namespace https://luzifer.io/
|
// @namespace https://luzifer.io/
|
||||||
// @version 0.21.0
|
// @version 0.21.1
|
||||||
// @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
|
||||||
|
@ -56,7 +56,7 @@ function executeAutoActions() {
|
||||||
while (availableProducts.length > 0 && Game.buyMode === 1) { // buyMode 1 = buy, -1 = sell
|
while (availableProducts.length > 0 && Game.buyMode === 1) { // buyMode 1 = buy, -1 = sell
|
||||||
let product = availableProducts[availableProducts.length - 1];
|
let product = availableProducts[availableProducts.length - 1];
|
||||||
|
|
||||||
for (let buyAmount = purchaseSteps - product.amount; buyAmount > 0; buyAmount--) {
|
for (let buyAmount = purchaseSteps; buyAmount > 0; buyAmount--) {
|
||||||
if (product.getSumPrice(buyAmount) <= Game.cookies) {
|
if (product.getSumPrice(buyAmount) <= Game.cookies) {
|
||||||
product.buy(buyAmount);
|
product.buy(buyAmount);
|
||||||
note(`Purchased ${buyAmount} ${buyAmount === 1 ? product.name : product.plural} for you.`);
|
note(`Purchased ${buyAmount} ${buyAmount === 1 ? product.name : product.plural} for you.`);
|
||||||
|
|
Loading…
Reference in a new issue