您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Auto click several stuff
当前为
// ==UserScript== // @name MoshMages' Auto Cookie Clicker // @version 1.6 // @description Auto click several stuff // @author [email protected] // @match http://orteil.dashnet.org/cookieclicker/* // @grant none // @namespace https://gist.github.com/moshmage/792ac013a8fb0b23d39f491261ebdb90 // ==/UserScript== (() => { const options = { enable: false, autoBuyBuildings: true, autoBuyUpgrades: true, autoClickShimmers: true, avoidWrathCookie: false, disableBuyIfBuffs: true, autoClickWrinklers: true, randomUpgradeChance: .01, randomBuildingChance: .99, tickSpeedMs: 50, clickCookie: true, } const bigCookie = document.querySelector(`#bigCookie`); const centerSection = document.querySelector(`#centerArea`); const game = document.querySelector(`#game`); const _Game = window.Game || {shimmers: [], wrinklers: [], buffs: []}; const origChoose = window.choose || ((arr) => {}); window.choose = (arr) => { origChoose(arr.filter(buff => ![`ruin`, `clot`].some(t => buff.search(t) > -1))); } const killWrinkle = (wrinkle) => wrinkle.hp-- && wrinkle.hp > 0 && killWrinkle(wrinkle); const tickAction = () => { if (!options.enable) return; if (options.clickCookie) bigCookie.click() const buyThing = (selector) => { const things = document.querySelectorAll(selector); if (things.length) things[things.length - 1].click(); } if (options.autoClickShimmers) _Game.shimmers.forEach(shimmer => (!options.avoidWrathCookie || options.avoidWrathCookie && !shimmer.wrath) && shimmer.pop()); if (options.autoClickWrinklers) { _Game .wrinklers .filter(({close, phase, hp}) => phase && close === 1 && hp) .forEach(killWrinkle); } const buffs = document.querySelectorAll(`#buffs *`).length; if (!options.disableBuyIfBuffs || options.disableBuyIfBuffs && !buffs) { if (options.autoBuyUpgrades && Math.random() >= options.randomUpgradeChance) buyThing(`#upgrades .enabled`); if (options.autoBuyBuildings && Math.random() >= options.randomBuildingChance) buyThing(`#products .enabled`); } setTimeout(() => tickAction(), options.tickSpeedMs); } const onoff = (pointer) => pointer && `ON` || `OFF`; const makeListingOption = (name, desc, id, key, cb) => { const listing = document.createElement(`div`); listing.classList.add(`listing`); const option = document.createElement(`a`); option.classList.add(`option`); option.setAttribute(`id`, id); option.textContent = `${name} ${onoff(options[key])}`; option.addEventListener(`click`, (ev) => { options[key] = !options[key]; option.textContent = `${name} ${onoff(options[key])}`; localStorage.setItem(`acmoptions`, JSON.stringify(options)); if (cb) cb(ev, key); }); const label = document.createElement(`label`); label.textContent = desc && `(${desc})` || ``; listing.appendChild(option); if (desc) listing.appendChild(label); return listing; } const makeSlider = (name, min, max, increment, key) => { const listing = document.createElement(`div`); listing.classList.add(`listing`); const slider = document.createElement(`div`); slider.classList.add(`sliderBox`); const label = document.createElement(`div`); label.style.float = `left`; label.textContent = name; const value = document.createElement(`div`); value.style.float = `right`; value.textContent = options[key]; const option = document.createElement(`input`); option.setAttribute(`type`, `range`); option.setAttribute(`min`, min); option.setAttribute(`max`, max); option.setAttribute(`step`, increment); option.style.clear = `both`; option.value = options[key]; option.addEventListener(`change`, (ev) => { options[key] = +ev.target.value; localStorage.setItem(`acmoptions`, JSON.stringify(options)); value.textContent = options[key]; }); slider.appendChild(label); slider.appendChild(value); slider.appendChild(option); listing.appendChild(slider); return listing; } const makeTitle = (title) => { const element = document.createElement(`div`) element.classList.add(`title`); element.textContent = title; return element; } const buildUI = () => { Object.assign(options, JSON.parse(localStorage.getItem(`acmoptions`) || `{}`)); const modMenu = document.createElement(`div`); modMenu.setAttribute(`id`, `mod-menu`); const closeModMenu = document.createElement(`div`); closeModMenu.classList.add(`close`, `menuClose`, `modClose`); closeModMenu.textContent = `x`; modMenu.appendChild(closeModMenu); const section = document.createElement(`div`); section.classList.add(`section`) section.textContent = `Mods`; modMenu.appendChild(section); const subsection = document.createElement(`div`); subsection.classList.add(`subsection`); subsection.appendChild(makeTitle(`Auto click Madness`)); const startTickAction = () => { if (options.enable) tickAction(); } subsection.appendChild(makeListingOption(`Auto click`, `enable/disable auto click abilities`, `enable-madness`, `enable`, function() { startTickAction() })) subsection.appendChild(makeTitle(`Clicks`)); subsection.appendChild(makeListingOption(`Click cookie`, `click the big cookie`, `enable-cookie-click`, `clickCookie`)); subsection.appendChild(makeSlider(`Tick speed (ms)`, 50, 1000, 10, `tickSpeedMs`)); subsection.appendChild(makeTitle(`Upgrades`)); subsection.appendChild(makeListingOption(`Buy upgrades`, `higher number = lower chances`, `auto-upgrade`, `autoBuyUpgrades`)); subsection.appendChild(makeSlider(`Chance`, 0, .999, .001, `randomUpgradeChance`)); subsection.appendChild(makeTitle(`Products`)); subsection.appendChild(makeListingOption(`Buy products`, `higher number = lower chances`, `auto-build`, `autoBuyBuildings`)); subsection.appendChild(makeSlider(`Chance`, 0, .999, .001, `randomBuildingChance`)); subsection.appendChild(makeTitle(`Shimmers and Buffs`)) subsection.appendChild(makeListingOption(`Click shimmers`, ``, `auto-shimmer`, `autoClickShimmers`)); subsection.appendChild(makeListingOption(`Avoid wrath cookies`, ``, `auto-shimmer`, `avoidWrathCookie`)); subsection.appendChild(makeListingOption(`Wait for buff end`, ``, `auto-buff-wait`, `disableBuyIfBuffs`)); subsection.appendChild(makeListingOption(`Kill wrinklers`, ``, `auto-wrinkler`, `autoClickWrinklers`)); modMenu.appendChild(subsection); modMenu.style.display = `none`; modMenu.style.position = `absolute`; modMenu.style.zIndex = `1`; modMenu.style.left = `0`; modMenu.style.right = `0`; modMenu.style.top = `0`; modMenu.style.bottom = `0`; const modMenuOption = document.createElement(`div`); modMenuOption.classList.add(`roundedPanel`); modMenuOption.setAttribute(`id`, `ascendNumber`); modMenuOption.style.display = `block`; modMenuOption.style.left = `6rem`; modMenuOption.style.top = `4.5rem`; modMenuOption.style.right = `auto`; modMenuOption.style.zIndex = `1000`; modMenuOption.style.cursor = `pointer`; modMenuOption.textContent = `Mod`; const _openModMenu = () => { const close = centerSection.querySelector(`.close:not(.modClose)`); if (close) close.click(); game.classList.add(`onMenu`); modMenu.style.display = `block`; } const _closeModMenu = () => { game.classList.remove(`onMenu`); modMenu.style.display = `none`; } modMenuOption.addEventListener(`click`, () => { if (modMenu.style.display === `block`) _closeModMenu(); else _openModMenu(); }); closeModMenu.addEventListener(`click`, _closeModMenu); const comments = document.querySelector(`#comments`); comments.appendChild(modMenuOption); comments .querySelectorAll(`.button`) .forEach(el => el.addEventListener(`click`, () => modMenu.style.display = `none`)); centerSection.appendChild(modMenu); modMenuOption.click(); if (options.enable) tickAction(); } setTimeout(buildUI, 500); })();