Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Pokeclicker
- // @namespace http://tampermonkey.net/
- // @version 0.8
- // @description try to take over the world!
- // @author You
- // @match https://www.pokeclicker.com/
- // @grant none
- // @run-at document-start
- // ==/UserScript==
- (function() {
- 'use strict';
- var switches = {
- "Click":true,
- "Hatch":true,
- "Dungeon":true,
- "Gym":false,
- "Repeat":false,
- "Bomb":true,
- "Items":false
- };
- var toggles = {
- "speedBall":false
- }
- var dungeonCoord = {
- "x":0,
- "y":5
- };
- var targetEggs = 16;
- function replaceStart(){
- {
- if (!App.debug) {
- Object.freeze(GameConstants);
- }
- Preload.load(App.debug).then(() => {
- ko.options.deferUpdates = true;
- console.log(`[${GameConstants.formatDate(new Date())}] %cLoading Game Data..`, 'color:#8e44ad;font-weight:900;');
- // Needs to be loaded first so save data can be updated (specifically "player" data)
- const update = new Update();
- UndergroundItem.initialize();
- player = Save.load();
- Preload.hideSplashScreen();
- App.game = new Game(update, new Breeding(), new Pokeballs(), new Wallet(), new KeyItems(), new BadgeCase(), new OakItems([20, 50, 100]), new Party(), new Shards(), new Farming(), new LogBook(), new RedeemableCodes(), new Statistics(), new Quests(), new SpecialEvents(), new Discord());
- for(let i = 0; i < (targetEggs - 4);i++){
- App.game.breeding.defaults.eggList.push(ko.observable(new Egg()));
- }
- console.log(`[${GameConstants.formatDate(new Date())}] %cGame loaded`, 'color:#8e44ad;font-weight:900;');
- Notifier.notify({ message: 'Game loaded', type: GameConstants.NotificationOption.info });
- GameController.bindToolTips();
- GameController.addKeyListeners();
- PokedexHelper.populateTypeFilters();
- PokedexHelper.updateList();
- App.game.initialize();
- ko.applyBindings(App.game);
- GameController.applyRouteBindings();
- Preload.hideSplashScreen();
- App.game.start();
- });
- }
- }
- function setButtons(){
- for(let key of Object.keys(switches)){
- if (!switches[key]) {
- document.getElementById("auto" + key).style.color = 'red';
- switches[key] = false;
- } else if (switches[key]) {
- document.getElementById("auto" + key).style.color = 'black';
- switches[key] = true;
- }
- }
- }
- function autoClicker(){
- if(!switches.Click){return;}
- if(App.game.gameState == 2){
- Battle.clickAttack();
- }
- else if(App.game.gameState == 3){
- GymBattle.clickAttack();
- }
- }
- function moveTile(){
- if(DungeonBattle.catching()){
- return;
- }
- //dungeonCoord = DungeonRunner.map.playerPosition();
- //console.log("moving to " + dungeonCoord.x + "," + dungeonCoord.y);
- DungeonRunner.map.moveToCoordinates(dungeonCoord.x, dungeonCoord.y);
- if(dungeonCoord.y <= 0){
- dungeonCoord.x = ++dungeonCoord.x % DungeonRunner.map.size;
- dungeonCoord.y = DungeonRunner.map.size-1;
- }
- else{
- dungeonCoord.y--;
- }
- }
- function autoGym(){
- if(!switches.Gym){return;}
- if(App.game.gameState == 6 && player.town().gym()){
- GymRunner.startGym(player.town().gym());
- }
- }
- function autoDungeon(){
- if(!switches.Dungeon){return;}
- if(switches.Repeat && App.game.gameState == 6 && player.town().dungeon()){
- DungeonRunner.dungeon = player.town().dungeon();
- if(DungeonRunner.hasEnoughTokens()){
- DungeonRunner.initializeDungeon(player.town().dungeon());
- dungeonCoord = {x:0,y:DungeonRunner.map.size-1};
- // dungeonCoord.x = Math.floor(DungeonRunner.map.size/2);
- // dungeonCoord.y = DungeonRunner.map.size-1;
- }
- }
- else if(App.game.gameState != 4){
- // dungeonCoord.x = Math.floor(DungeonRunner.map.size/2);
- // dungeonCoord.y = DungeonRunner.map.size-1;
- return;
- }
- else if (DungeonRunner.map.currentTile().type() == 0){ //empty
- moveTile();
- }
- else if (DungeonRunner.map.currentTile().type() == 1){ //Enemy
- DungeonBattle.clickAttack();
- if(DungeonRunner.pokemonDefeated){
- moveTile();
- }
- }
- else if (DungeonRunner.map.currentTile().type() == 2){ //Chest
- DungeonRunner.openChest();
- moveTile();
- }
- else if (DungeonRunner.map.currentTile().type() == 3){ //Boss
- if(!DungeonRunner.fightingBoss()){
- DungeonRunner.startBossFight();
- dungeonCoord = {x:0,y:DungeonRunner.map.size-1};
- }
- DungeonBattle.clickAttack();
- }
- }
- var eggList = [
- "Dragon_egg",
- "Electric_egg",
- "Fighting_egg",
- "Fire_egg",
- "Grass_egg",
- "Mystery_egg",
- "Water_egg"
- ]
- var battleItems = [
- "xAttack",
- "xClick",
- "Lucky_egg",
- "Token_collector",
- "Item_magnet",
- "Lucky_incense"
- ]
- function useEggs(itemList){
- for(let egg of itemList){
- if(player.itemList[egg]() > 0 && !ItemList[egg].getCaughtStatus()){
- ItemHandler.useItem(egg);
- return;
- }
- }
- }
- function autoBreeder() {
- if(!switches.Hatch){return;}
- for(let s = 0; s < App.game.breeding.eggSlots; s ++){
- if(App.game.breeding.eggList[s]().canHatch()){
- App.game.breeding.hatchPokemonEgg(s);
- }
- }
- if(App.game.breeding.hasFreeEggSlot()){
- useEggs(eggList);
- }
- let ind = 0;
- while(App.game.breeding.hasFreeEggSlot() && BreedingController.breedableList().length > ind){
- App.game.breeding.gainPokemonEgg(BreedingController.breedableList()[ind]);
- ind++;
- }
- }
- function autoFarm(){
- let count = App.game.farming.unlockedPlotCount();
- for(let p = 0;p < count; p++){
- if(App.game.farming.plotList[p].timeLeft <= 0 && App.game.farming.plotList[p].isUnlocked){
- App.game.farming.harvest(p,true);
- App.game.farming.plant(p,FarmController.selectedBerry);
- }
- }
- }
- function autoMine(){
- if(switches.Bomb && Underground.energy >= Underground.getMaxEnergy() - Underground.getEnergyGain()){
- Mine.bomb(10)
- }
- }
- function autoItems(){
- if(!switches.Items){return;}
- for(let item of battleItems){
- if(player.itemList[item]() > 0){
- ItemHandler.useItem(item);
- }
- }
- }
- window.toggleSetting = function(settingName){
- if (switches[settingName]) {
- document.getElementById("auto" + settingName).style.color = 'red';
- switches[settingName] = false;
- } else if (!switches[settingName]) {
- document.getElementById("auto" + settingName).style.color = 'black';
- switches[settingName] = true;
- }
- }
- window.speedBall = function(){
- if (toggles.speedBall) {
- document.getElementById("speedBall").style.color = 'red';
- toggles.speedBall = false;
- App.game.pokeballs.pokeballCatchTime = [1250, 1000, 750, 500];
- } else if (!toggles.speedBall) {
- document.getElementById("speedBall").style.color = 'black';
- toggles.speedBall = true;
- App.game.pokeballs.pokeballCatchTime = [125, 100, 75, 50]
- }
- }
- var delay = 0;
- function automate(){
- delay = ++delay % 100;
- if(delay % 50 == 0){
- autoMine();
- autoFarm();
- }
- if(delay % 50 == 0){
- autoBreeder();
- }
- if(delay % 2 == 0){
- autoClicker();
- autoDungeon()
- }
- autoGym();;
- autoItems();
- }
- function addInterface(){
- window.window.$("#battleContainer").append('<button id="autoClick" style="color:red" onclick="toggleSetting(\'Click\')">AutoClick</button>');
- window.window.$("#breedingDisplay").append('<button id="autoHatch" style="color:red" onclick="toggleSetting(\'Hatch\')">AutoHatch</button>');
- var centerbuttons = '<div id="centerbuttons" class="row" margin:"auto">' +
- '<button id="autoRepeat" style="color:red" onclick="toggleSetting(\'Repeat\')">Repeat Dungeon</button>' +
- '<button id="autoDungeon" style="color:red" onclick="toggleSetting(\'Dungeon\',\'autoDungeon\')">Auto Dungeon</button>' +
- '<button id="autoGym" style="color:red" onclick="toggleSetting(\'Gym\')">Auto Gym</button>' +
- '<button id="autoBomb" style="color:black" onclick="toggleSetting(\'Bomb\')">Auto Bomb</button>' +
- '<button id="autoItems" style="color:black" onclick="toggleSetting(\'Items\')">Auto Items</button>' +
- '<button id="speedBall" style="color:red" onclick="speedBall()">SpeedBall(cheaty)</button>' +
- '</div>';
- window.window.$("#middle-column").append(centerbuttons);
- setButtons();
- setInterval(automate,10);
- }
- window.checkLoad = function(){
- if(App && App.start != replaceStart){
- App.start= replaceStart;
- }
- if(!App.game || !App.game.farming){
- return;
- }
- clearInterval(cl);
- window.window.$("#battleContainer").append('<button id="autoClick" style="color:red" onclick="toggleSetting(\'Click\')">AutoClick</button>');
- window.window.$("#breedingDisplay").append(
- '<button id="autoHatch" style="color:red" onclick="toggleSetting(\'Hatch\')">AutoHatch</button>');
- var centerbuttons = '<div id="centerbuttons" class="row" margin:"auto">' +
- '<button id="autoRepeat" style="color:red" onclick="toggleSetting(\'Repeat\')">Repeat Dungeon</button>' +
- '<button id="autoDungeon" style="color:red" onclick="toggleSetting(\'Dungeon\',\'autoDungeon\')">Auto Dungeon</button>' +
- '<button id="autoGym" style="color:red" onclick="toggleSetting(\'Gym\')">Auto Gym</button>' +
- '<button id="autoBomb" style="color:black" onclick="toggleSetting(\'Bomb\')">Auto Bomb</button>' +
- '<button id="autoItems" style="color:black" onclick="toggleSetting(\'Items\')">Auto Items</button>' +
- '<button id="speedBall" style="color:red" onclick="speedBall()">SpeedBall(cheaty)</button>' +
- '</div>';
- window.window.$("#middle-column").append(centerbuttons);
- Array.from(document.getElementsByClassName('eggSlot')).forEach(e => e.className = "col-3 col-md-3 p-0 eggSlot")
- setButtons();
- setInterval(automate,10);
- }
- window.cl = setInterval(checkLoad,10);
- // document.querySelector("#middle-column").innerHTML += ('<button id="autoDungeon" style="color:red" onclick="toggleDungeon()">AutoDungeon</button>');
- // document.querySelector("#middle-column").innerHTML += ('<button id="autoDungeon" style="color:red" onclick="toggleDungeon()">AutoDungeon</button>');
- })();
Advertisement
Add Comment
Please, Sign In to add comment