From d4726e46f104b43476fda08b490c3643748e61be Mon Sep 17 00:00:00 2001 From: awes12 <48301725+awes12@users.noreply.github.com> Date: Mon, 10 Jul 2023 18:31:43 -0400 Subject: [PATCH] Update gameClient.js to fix the Cookie Storm problem. There is a classic async problem here. The setTimeout just tries to repop the golden cookie in 500 ms, but it doesn't take into account that the cookie might have already been popped within that time (by the autoclicker), which ends up meaning that you try to pop the cookie twice (which has a lot of bad side effects). I fixed this by just making sure that the cookie hasn't been popped yet before popping it in the async function. --- src/js/modules/gameClient.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/js/modules/gameClient.js b/src/js/modules/gameClient.js index cb5594d..571acdd 100644 --- a/src/js/modules/gameClient.js +++ b/src/js/modules/gameClient.js @@ -73,7 +73,9 @@ var gameClient = function (WatchJS, Game, pageMessagingClient) { if (goldenCookie.l.style.opacity == 0) { // wait for goldenCookie first update setTimeout(function(){ - clickGoldenCookie(goldenCookie); + if(Game.shimmers.includes(goldenCookie)){ + clickGoldenCookie(goldenCookie); + } }, 500); } else { goldenCookie.pop();