cookieMonsterClicker

clicker bot for coockieclicker game

当前为 2021-09-09 提交的版本,查看 最新版本

// ==UserScript==
// @name         cookieMonsterClicker
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  clicker bot for coockieclicker game
// @author       iampopovich
// @match        https://orteil.dashnet.org/cookieclicker/
// @grant        none
// ==/UserScript==

function cookieWorker(){
    let cookie = null;
    let products = null;
    let searchForElements = setInterval(function() {
        cookie = document.getElementById('bigCookie');
        products = document.getElementById('products');
        if (cookie && products) {
            clearInterval(searchForElements);
            const event = new MouseEvent('mouseover', {
                'view': window,
                'bubbles': true,
                'cancelable': true
            });
            cookie.dispatchEvent(event);
        }},10000);

    setInterval(function(){clickCookie(cookie)},150);
    setInterval(function(){productBuyer(products)},60000);
    }

function clickCookie(cookie){cookie.click();}

function productBuyer(products){
    let productList = products.querySelectorAll('div[class~=product]');
    for(let i=productList.length-1; i>=0; i--){productList[i].click()};
}

function buyFarm(product){}

function buyMine(product){}

function buyGrandma(product){}

cookieWorker();