Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Pokeclicker
- // @namespace http://tampermonkey.net/
- // @version 0.7
- // @description try to take over the world!
- // @author You
- // @match https://www.pokeclicker.com/
- // @grant none
- // ==/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
- };
- 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);
- break;
- }
- }
- }
- 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);
- }
- }
- for(let s = 0; s < App.game.breeding.eggSlots; s ++){
- if(!App.game.breeding.hasFreeEggSlot()){
- break;
- }
- else{
- useEggs(eggList);
- if(BreedingController.breedableList().length > 0 && App.game.breeding.hasFreeEggSlot()){
- App.game.breeding.gainPokemonEgg(BreedingController.breedableList()[0]);
- break;
- }
- }
- }
- }
- 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 >= 10){
- 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 % 20 == 0){
- autoBreeder();
- }
- autoGym();
- autoClicker();
- autoDungeon();
- 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.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);
- 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