Just a cookie clicker hack.
当前为
// ==UserScript==
// @name Cookie Clicker hack
// @namespace https://greasyfork.org/ru/scripts/392425-cookie-clicker-hack
// @version 1.2
// @description Just a cookie clicker hack.
// @author hasha2982
// @match *://orteil.dashnet.org/cookieclicker/*
// @match *://orteil.dashnet.org/cookieclicker/
// @grant none
// ==/UserScript==
// NOTE: Don't works in IE!
console.log('[== Starting hack... ==]');
var ans = '';
var confirmans = false;
var forCookies = {
iter: 0,
ctr: 0
}
const hinfo = {
version: '1.2',
changes: 'Added Autoclicker!'
}
var ac = {
sure: false,
click: function() {
document.getElementById('bigCookie').click();
},
timer: null, // used for clearTimeout in ac.termtimer()
termtimer: function() {
if (ac.timer === null) {
console.log('false ac.termtimer() call');
console.log(ac);
} else {
clearTimeout(ac.timer);
}
},
warning: false
}
document.onkeydown = function(e){
e = e || window.event;
var key = e.which || e.keyCode;
if(key===72){
hackMenu();
} else if (key === 67) {
ac.termtimer();
}
}; // thx StackOverflow
var hmenuText = 'Welcome to hasha2982\'s Cookie Clicker hack v.' + hinfo.version + '!\nPlease select an option below:\n1) Earn free cookies\n2) Spawn golden cookies\n3) Autoclicker (tested on Cookie Clicker v.2.022)';
function hackMenu() {
// if (event.code = 'KeyH') {
ans = prompt(hmenuText);
if (ans == '1') {
ans = prompt('How many cookies do you want to earn?');
if (ans === "" || ans === null) {
alert('Cancelled.');
} else {
Game.cookies += Number(ans);
Game.cookiesEarned += Number(ans);
}
} else if (ans == '2') {
ans = prompt('How many cookies do you want to spawn?');
if (!(ans === "" || ans === null) && Number(ans) > 0) {
forCookies.iter = Number(ans);
for (; forCookies.ctr < forCookies.iter; forCookies.ctr++) {
var newShimmer=new Game.shimmer("golden");
console.log(`Golden cookie spawned.\nIteration ${forCookies.ctr} is finished.\nIterations remaining: ${forCookies.iter - forCookies.ctr}`);
}
forCookies.iter = 0;
forCookies.ctr = 0;
} else {
alert('Cancelled.');
}
}
else if (ans == '3') {
ans = prompt('Enter delay between clicks in ms. (1000 ms. = 1 s.)\n(press \'c\' to disable autoclicker)');
if (ans === null || ans === "" || ans === '0' || Number(ans) < 1) {
alert('Cancelled.');
} else if (Number(ans) <= 100) {
confirmans = confirm('Delay lower than 100ms. can cause lags.\nAre you sure?');
if (confirmans === true) {
ac.sure = true;
console.log(`ac.sure is set to true\n`); console.log(ac);
}
// if (ac.sure === true) { // here it goes
ac.timer = setInterval(ac.click, Number(ans));
// }
} else {
ac.timer = setInterval(ac.click, Number(ans));
}
}
else if (ans === null || ans === "") {
console.log('Prevented \'Function not found\' message');
}
else {
alert('Function not found.');
}
// }
}
console.log('[== Hack is started. ==]\nVersion: v.' + hinfo.version);