Lucibear

Untitled

Sep 22nd, 2020
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.68 KB | None | 0 0
  1. // ==UserScript==
  2. // @name Pokeclicker
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.5
  5. // @description try to take over the world!
  6. // @author You
  7. // @match https://www.pokeclicker.com/
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13. var switches = {"click":false,
  14. "hatch":false,
  15. "dungeon":false,
  16. "gym":false,
  17. "repDungeon":false,
  18. "bomb":true
  19. };
  20. var i;
  21. var auto = {"click":null,
  22. "hatch":null,
  23. "dungeon":null,
  24. "gym":null
  25. };
  26. var dungeonCoord = {"x":0,
  27. "y":5
  28. };
  29. window.toggleClicker = function() {
  30. if (switches.click) {
  31. document.getElementById("autoClick").style.color = 'red';
  32. clearInterval(auto.click);
  33. switches.click = false;
  34. } else if (!switches.click) {
  35. document.getElementById("autoClick").style.color = 'black';
  36. auto.click = setInterval(function(){
  37. if(App.game.gameState == 2){
  38. Battle.clickAttack();
  39. }
  40. else if(App.game.gameState == 3){
  41. GymBattle.clickAttack();
  42. }
  43. },20);
  44. switches.click = true;
  45. }
  46. }
  47. function moveTile(){
  48. DungeonRunner.map.moveToCoordinates(dungeonCoord.x, dungeonCoord.y--);
  49. if(dungeonCoord.y < 0){
  50. dungeonCoord.x = ++dungeonCoord.x % 6;
  51. dungeonCoord.y = 5;
  52. }
  53. }
  54. window.toggleGym = function() {
  55. if (switches.gym) {
  56. document.getElementById("autoGym").style.color = 'red';
  57. clearInterval(auto.gym);
  58. switches.gym = false;
  59. } else if (!switches.gym) {
  60. document.getElementById("autoGym").style.color = 'black';
  61. auto.gym = setInterval(function(){
  62. if(App.game.gameState == 6 && player.town().gym()){
  63. GymRunner.startGym(player.town().gym());
  64. }
  65. },20);
  66. switches.gym = true;
  67. }
  68. }
  69. window.toggleBomb = function() {
  70. if (switches.bomb) {
  71. document.getElementById("autoBomb").style.color = 'red';
  72. switches.bomb = false;
  73. } else if (!switches.gym) {
  74. document.getElementById("autoBomb").style.color = 'black';
  75. switches.bomb = true;
  76. }
  77. }
  78. window.toggleRepDungeon = function() {
  79. if (switches.repDungeon) {
  80. document.getElementById("repDungeon").style.color = 'red';
  81. switches.repDungeon = false;
  82. } else if (!switches.gym) {
  83. document.getElementById("repDungeon").style.color = 'black';
  84. switches.repDungeon = true;
  85. }
  86. }
  87. window.toggleDungeon = function() {
  88. if (switches.dungeon) {
  89. document.getElementById("autoDungeon").style.color = 'red';
  90. clearInterval(auto.dungeon);
  91. switches.dungeon = false;
  92. } else if (!switches.dungeon) {
  93. document.getElementById("autoDungeon").style.color = 'black';
  94. auto.dungeon = setInterval(function(){
  95. if(switches.repDungeon && App.game.gameState == 6 && player.town().dungeon()){
  96. DungeonRunner.dungeon = player.town().dungeon();
  97. if(DungeonRunner.hasEnoughTokens()){
  98. DungeonRunner.initializeDungeon(player.town().dungeon());
  99. }
  100. }
  101.  
  102. else if(App.game.gameState != 4){
  103. dungeonCoord.x = 0;
  104. dungeonCoord.y = 5;
  105. return;
  106. }
  107. else if (DungeonRunner.map.currentTile().type() == 0){ //empty
  108. moveTile();
  109. }
  110. else if (DungeonRunner.map.currentTile().type() == 1){ //Enemy
  111. DungeonBattle.clickAttack();
  112. if(DungeonRunner.pokemonDefeated){
  113. moveTile();
  114. }
  115. }
  116. else if (DungeonRunner.map.currentTile().type() == 2){ //Chest
  117. DungeonRunner.openChest();
  118. moveTile();
  119. }
  120. else if (DungeonRunner.map.currentTile().type() == 3){ //Boss
  121. if(!DungeonRunner.fightingBoss()){
  122. DungeonRunner.startBossFight();
  123. }
  124. DungeonBattle.clickAttack();
  125. }
  126. },20);
  127. switches.dungeon = true;
  128. }
  129. }
  130. window.toggleBreeder = function() {
  131. if (switches.hatch) {
  132. document.getElementById("autoHatch").style.color = 'red';
  133. clearInterval(auto.hatch);
  134. switches.hatch = false;
  135. } else if (!switches.hatch) {
  136. document.getElementById("autoHatch").style.color = 'black';
  137. auto.hatch = setInterval(function(){
  138. for(let s = 0; s < App.game.breeding.eggSlots; s ++){
  139. if(App.game.breeding.eggList[s]().canHatch()){
  140. App.game.breeding.hatchPokemonEgg(s);
  141. }
  142. }
  143. for(let s = 0; s < App.game.breeding.eggSlots; s ++){
  144. if(!App.game.breeding.hasFreeEggSlot()){
  145. break;
  146. }
  147. else if(BreedingController.breedableList().length > 0){
  148. App.game.breeding.gainPokemonEgg(BreedingController.breedableList()[0]);
  149. break;
  150. }
  151. }
  152. },200);
  153. switches.hatch = true;
  154. }
  155. }
  156. window.autoFarm = setInterval(function(){
  157. let count = App.game.farming.unlockedPlotCount();
  158. for(let p = 0;p < count; p++){
  159. if(App.game.farming.plotList[p].timeLeft <= 0 && App.game.farming.plotList[p].isUnlocked){
  160. App.game.farming.harvest(p,true);
  161. App.game.farming.plant(p,FarmController.selectedBerry);
  162. }
  163. }},500);
  164. window.autoMine = setInterval(function(){
  165. if(switches.bomb && Underground.energy >= 10){
  166. Mine.bomb(10)
  167. }
  168. },500);
  169. document.querySelector("div.col.no-gutters.clickable").parentNode.parentNode.parentNode.innerHTML += ('<button id="autoClick" style="color:red" onclick="toggleClicker()">AutoClick</button>');
  170. document.querySelector("#breedingDisplay").innerHTML += ('<button id="autoHatch" style="color:red" onclick="toggleBreeder()">AutoHatch</button>');
  171. var centerbuttons = '<div id="centerbuttons" class="row" margin:"auto">' +
  172. '<button id="repDungeon" style="color:red" onclick="toggleRepDungeon()">Repeat Dungeon</button>' +
  173. '<button id="autoDungeon" style="color:red" onclick="toggleDungeon()">AutoDungeon</button>' +
  174. '<button id="autoGym" style="color:red" onclick="toggleGym()">AutoGym</button>' +
  175. '<button id="autoBomb" style="color:black" onclick="toggleBomb()">Auto Nuke the Caves</button>' +
  176. '</div>';
  177. document.querySelector("#middle-column").innerHTML += centerbuttons;
  178. // document.querySelector("#middle-column").innerHTML += ('<button id="autoDungeon" style="color:red" onclick="toggleDungeon()">AutoDungeon</button>');
  179. // document.querySelector("#middle-column").innerHTML += ('<button id="autoDungeon" style="color:red" onclick="toggleDungeon()">AutoDungeon</button>');
  180. })();
Advertisement
Add Comment
Please, Sign In to add comment