// ==UserScript==
// @name Cookie Clicker Cheat
// @namespace http://tampermonkey.net/
// @version 0.2
// @description A cookie clicker cheat that doesn't give you the cheater achievement!
// @author vxi
// @license GPLv3
// @match https://orteil.dashnet.org/cookieclicker/
// @icon https://www.google.com/s2/favicons?domain=dashnet.org
// @grant none
// ==/UserScript==
/*
Hi, since you're looking at the source code of this:
If you know a lot about the game and wanna help me make this better then contact me on Discord (vxi#1337)
*/
var unsafeWindow = window.wrappedJSObject;
let Game = unsafeWindow["Game"]
/* disabling this for now, really just a useless visual thing
window.onload=function()
{
if (!Game.ready)
{
if (top!=self) Game.ErrorFrame();
else
{
console.log('[=== '+choose([
'Cheat achievement bypassed!',
'Lol, I just had to overwrite these too',
])+' ===]');
Game.Load();
}
}
};
*/
let injectionCheck = setInterval(() => {
if (Object.keys(Game).length > 200) {
InjectMods()
clearInterval(injectionCheck)
}
}, 1500);
function mlog(text, sv) {
if(!sv) {
let css = "border: 2px solid green;background-color:green;padding: 0px 3px;border-radius: 6px;";
console.log("%cvcm", css, text);
} else {
let css = "border: 2px solid darkred;background-color:darkred;padding: 0px 3px;border-radius: 6px;";
console.log("%cvcm", css, text);
}
}
function Protection () {
Game.Win= function(what)
{
if (what == "Cheated cookies taste awful") return;
if (typeof what==='string')
{
if (Game.Achievements[what])
{
if (Game.Achievements[what].won==0)
{
var name=Game.Achievements[what].shortName?Game.Achievements[what].shortName:Game.Achievements[what].name;
Game.Achievements[what].won=1;
if (Game.prefs.popups) Game.Popup('Achievement unlocked :<br>'+name);
else Game.Notify('Achievement unlocked','<div class="title" style="font-size:18px;margin-top:-2px;">'+name+'</div>',Game.Achievements[what].icon);
if (Game.CountsAsAchievementOwned(Game.Achievements[what].pool)) Game.AchievementsOwned++;
Game.recalculateGains=1;
}
}
}
else {for (var i in what) {Game.Win(what[i]);}}
}
// end win overwrite
if (Game.Achievements["Cheated cookies taste awful"].won = 1) {
Game.Achievements["Cheated cookies taste awful"].won = 0 // remove previous cheat achievement if exists
}
let protectionInterval = setInterval(() => {
if (Game.cookiesEarned < Game.cookies) {
Game.cookiesEarned = Game.cookies; // make sure values add up just incase someone stops using script so they dont get cheat achievement (untested)
}
}, 5000)
mlog(`bypass injected (1/3)`)
}
function InternalMods() {
// COOKIE EDITING
Game.mEditCookies = function (amount) {
if (amount < 0) return;
if (typeof amount === "number") {
Game.cookiesEarned = amount;
Game.cookies = amount;
Game.Notify(`Cookies modified!`,"",false, true)
}
}
Game.EditCookiesPrompt = function () {
let amount = prompt("What would you like your new cookie amount to be?")
if (amount == null) return;
if (isNaN(Number(amount))) return;
Game.mEditCookies(Number(amount));
}
// COOKIE ADDING
Game.mAddCookies = function (amount) {
Game.cookiesEarned += amount;
Game.cookies += amount;
Game.Notify(`Cookies added!`,"",false, true)
}
Game.AddCookiesPrompt = function () {
let amount = prompt("How many cookies would you like to add to your current total?")
if (amount == null) return;
if(isNaN(Number(amount))) return;
Game.mAddCookies(Number(amount))
}
// ACHIEVEMENTS
Game.achieve = function (what) {
if (what == "give") {
Object.keys(Game.Achievements).forEach(achievement=>{
if (Game.Achievements[achievement].name == "Cheated cookies taste awful") return;
Game.Achievements[achievement].won = 1;
});
Game.WriteSave()
Game.Notify(`All achievements unlocked!`,"",false, true)
} else if (what == "take") {
Object.keys(Game.Achievements).forEach(achievement=>{
if (Game.Achievements[achievement].name == "Cheated cookies taste awful") return;
Game.Achievements[achievement].won = 0;
});
Game.Notify(`All achievements removed!`,"",false, true)
Game.WriteSave()
} else {
return;
}
}
// SEASONS
Game.mChangeSeason = function(season) {
if (season == "christmas") {
Game.baseSeason = "christmas"
Game.season = "christmas"
} else if (season == "valentines") {
Game.baseSeason = "valentines"
Game.season = "valentines"
} else if (season == "fools") {
Game.baseSeason = "fools"
Game.season = "fools"
} else if (season == "halloween") {
Game.baseSeason = "halloween"
Game.season = "halloween"
} else if (season == "easter") {
Game.baseSeason = "easter"
Game.season = "easter"
} else if (season == "none") {
Game.baseSeason = ""
Game.season = ""
Game.Notify(`Season changed to normal`,"",false, true)
return;
} else {
return;
}
Game.Notify(`Season changed to ${season}`,"",false, true)
}
// WRINKLERS
Game.mWrinklers = function () {
Game.LoadWrinklers(1, 10, 10, 10) // pretty sure this doesn't trigger cheat achievement
}
Game.mLumps = function (total) {
if (Game.lumpsTotal==-1){Game.lumpsTotal=0;Game.lumps=0;}
Game.lumps+=total;
Game.lumpsTotal+=total;
}
mlog(`cheat functions injected (2/3)`)
}
function VisualMods() {
Game.updateLog = `
<div class="section">Cheats
<div class="subsection">
<div class="title">Main Options :</div>
<div class="listing"><a class="option" onclick="PlaySound('snd/tick.mp3');Game.EditCookiesPrompt()">Change Cookies</a><label>This sets your cookie amount</label></div><br>
<div class="listing"><a class="option" onclick="PlaySound('snd/tick.mp3');Game.AddCookiesPrompt()">Add Cookies</a><label>This adds cookies to your current amount</label></div><br>
<div class="listing"><a class="option" onclick="Game.achieve('give');PlaySound('snd/tick.mp3');">Give Achievements</a><label>Gives every game achievements (except cheat one)</label></div><br>
<div class="listing"><a class="option" onclick="Game.achieve('take');PlaySound('snd/tick.mp3');">Take Achievements</a><label>Removes unlocked game achievements (should award actual achievements back)</label></div><br>
<div class="listing"><a class="option" onclick="Game.mWrinklers();PlaySound('snd/tick.mp3');">10 Wrinklers</a><label>Adds 10 shiny wrinklers</label></div><br>
<div class="listing"><a class="option" onclick="Game.mLumps(100);PlaySound('snd/tick.mp3');">100 Lumps</a><label>Adds 100 lumps to your current value</label></div><br>
</div>
<div class="subsection">
<div class="title">Seasons</div>
<div class="listing"><a class="option" onclick="Game.mChangeSeason('none');PlaySound('snd/tick.mp3');">Normal</a></div>
<div class="listing"><a class="option" onclick="Game.mChangeSeason('christmas');PlaySound('snd/tick.mp3');">Christmas</a></div>
<div class="listing"><a class="option" onclick="Game.mChangeSeason('valentines');PlaySound('snd/tick.mp3');">Valentines</a></div>
<div class="listing"><a class="option" onclick="Game.mChangeSeason('fools');PlaySound('snd/tick.mp3');">April Fools</a></div>
<div class="listing"><a class="option" onclick="Game.mChangeSeason('halloween');PlaySound('snd/tick.mp3');">Halloween</a></div>
<div class="listing"><a class="option" onclick="Game.mChangeSeason('easter');PlaySound('snd/tick.mp3');">Easter</a></div><br>
<div class="listing"><label>Please note that changing seasons can come with it's own bugs, use at your own risk!</label></div>
</div>
<div class="subsection">
<div class="title">Cheat Info</div>
<div class="listing">I made this because I was bored so here's some info:</listing><br><br>
<div class="listing">This completely overwrites achievement functions so you can safely cheat without getting the cheater achievement.</listing><br><br>
<div class="listing">You <i>should</i> be able to turn this cheat off whenever and still not have the cheater achievement (can't guarantee that if you use dev console with this)</listing><br><br>
<div class="listing">I plan on adding almost all dev console features to the cheat and making them 100% safe to use whenever and turn off whenever eventually, but I'll need someone who knows the game to contact me and help (I don't really know much about the game)</listing><br>
<div class="listing">If you would like to help, contact me on Discord: vxi#1337</listing><br>
</div>
` + Game.updateLog;
mlog(`visuals injected (3/3)`)
}
function InjectMods() {
Protection()
InternalMods()
VisualMods()
mlog("Finished loading! You can find the options in the in-game Info menu")
Game.Notify("vxi's cookie mod", "cheat successfully loaded, you can find the options in the Info tab", "", false, true)
}