Lucibear

Untitled

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