Lucibear

Untitled

Sep 23rd, 2020
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.83 KB | None | 0 0
  1. // ==UserScript==
  2. // @name Pokeclicker
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.7
  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 = {
  14. "Click":true,
  15. "Hatch":true,
  16. "Dungeon":true,
  17. "Gym":false,
  18. "Repeat":false,
  19. "Bomb":true,
  20. "Items":false
  21. };
  22. var toggles = {
  23. "speedBall":false
  24. }
  25. var dungeonCoord = {
  26. "x":0,
  27. "y":5
  28. };
  29. function setButtons(){
  30. for(let key of Object.keys(switches)){
  31. if (!switches[key]) {
  32. document.getElementById("auto" + key).style.color = 'red';
  33. switches[key] = false;
  34. } else if (switches[key]) {
  35. document.getElementById("auto" + key).style.color = 'black';
  36. switches[key] = true;
  37. }
  38. }
  39. }
  40. function autoClicker(){
  41. if(!switches.Click){return;}
  42. if(App.game.gameState == 2){
  43. Battle.clickAttack();
  44. }
  45. else if(App.game.gameState == 3){
  46. GymBattle.clickAttack();
  47. }
  48. }
  49. function moveTile(){
  50. if(DungeonBattle.catching()){
  51. return;
  52. }
  53. //dungeonCoord = DungeonRunner.map.playerPosition();
  54.  
  55. //console.log("moving to " + dungeonCoord.x + "," + dungeonCoord.y);
  56. DungeonRunner.map.moveToCoordinates(dungeonCoord.x, dungeonCoord.y);
  57. if(dungeonCoord.y <= 0){
  58. dungeonCoord.x = ++dungeonCoord.x % DungeonRunner.map.size;
  59. dungeonCoord.y = DungeonRunner.map.size-1;
  60. }
  61. else{
  62. dungeonCoord.y--;
  63. }
  64. }
  65. function autoGym(){
  66. if(!switches.Gym){return;}
  67. if(App.game.gameState == 6 && player.town().gym()){
  68. GymRunner.startGym(player.town().gym());
  69. }
  70. }
  71. function autoDungeon(){
  72. if(!switches.Dungeon){return;}
  73. if(switches.Repeat && App.game.gameState == 6 && player.town().dungeon()){
  74. DungeonRunner.dungeon = player.town().dungeon();
  75. if(DungeonRunner.hasEnoughTokens()){
  76. DungeonRunner.initializeDungeon(player.town().dungeon());
  77. dungeonCoord = {x:0,y:DungeonRunner.map.size-1};
  78. // dungeonCoord.x = Math.floor(DungeonRunner.map.size/2);
  79. // dungeonCoord.y = DungeonRunner.map.size-1;
  80. }
  81. }
  82.  
  83. else if(App.game.gameState != 4){
  84. // dungeonCoord.x = Math.floor(DungeonRunner.map.size/2);
  85. // dungeonCoord.y = DungeonRunner.map.size-1;
  86. return;
  87. }
  88. else if (DungeonRunner.map.currentTile().type() == 0){ //empty
  89. moveTile();
  90. }
  91. else if (DungeonRunner.map.currentTile().type() == 1){ //Enemy
  92. DungeonBattle.clickAttack();
  93. if(DungeonRunner.pokemonDefeated){
  94. moveTile();
  95. }
  96. }
  97. else if (DungeonRunner.map.currentTile().type() == 2){ //Chest
  98. DungeonRunner.openChest();
  99. moveTile();
  100. }
  101. else if (DungeonRunner.map.currentTile().type() == 3){ //Boss
  102. if(!DungeonRunner.fightingBoss()){
  103. DungeonRunner.startBossFight();
  104. dungeonCoord = {x:0,y:DungeonRunner.map.size-1};
  105. }
  106. DungeonBattle.clickAttack();
  107. }
  108. }
  109. var eggList = [
  110. "Dragon_egg",
  111. "Electric_egg",
  112. "Fighting_egg",
  113. "Fire_egg",
  114. "Grass_egg",
  115. "Mystery_egg",
  116. "Water_egg"
  117. ]
  118. var battleItems = [
  119. "xAttack",
  120. "xClick",
  121. "Lucky_egg",
  122. "Token_collector",
  123. "Item_magnet",
  124. "Lucky_incense"
  125. ]
  126. function useEggs(itemList){
  127. for(let egg of itemList){
  128. if(player.itemList[egg]() > 0 && !ItemList[egg].getCaughtStatus()){
  129. ItemHandler.useItem(egg);
  130. break;
  131. }
  132. }
  133. }
  134. function autoBreeder() {
  135. if(!switches.Hatch){return;}
  136. for(let s = 0; s < App.game.breeding.eggSlots; s ++){
  137. if(App.game.breeding.eggList[s]().canHatch()){
  138. App.game.breeding.hatchPokemonEgg(s);
  139. }
  140. }
  141. for(let s = 0; s < App.game.breeding.eggSlots; s ++){
  142. if(!App.game.breeding.hasFreeEggSlot()){
  143. break;
  144. }
  145. else{
  146. useEggs(eggList);
  147. if(BreedingController.breedableList().length > 0 && App.game.breeding.hasFreeEggSlot()){
  148. App.game.breeding.gainPokemonEgg(BreedingController.breedableList()[0]);
  149. break;
  150. }
  151. }
  152. }
  153. }
  154. function autoFarm(){
  155. let count = App.game.farming.unlockedPlotCount();
  156. for(let p = 0;p < count; p++){
  157. if(App.game.farming.plotList[p].timeLeft <= 0 && App.game.farming.plotList[p].isUnlocked){
  158. App.game.farming.harvest(p,true);
  159. App.game.farming.plant(p,FarmController.selectedBerry);
  160. }
  161. }
  162. }
  163. function autoMine(){
  164. if(switches.Bomb && Underground.energy >= 10){
  165. Mine.bomb(10)
  166. }
  167. }
  168. function autoItems(){
  169. if(!switches.Items){return;}
  170. for(let item of battleItems){
  171. if(player.itemList[item]() > 0){
  172. ItemHandler.useItem(item);
  173. }
  174. }
  175. }
  176. window.toggleSetting = function(settingName){
  177. if (switches[settingName]) {
  178. document.getElementById("auto" + settingName).style.color = 'red';
  179. switches[settingName] = false;
  180. } else if (!switches[settingName]) {
  181. document.getElementById("auto" + settingName).style.color = 'black';
  182. switches[settingName] = true;
  183. }
  184. }
  185. window.speedBall = function(){
  186. if (toggles.speedBall) {
  187. document.getElementById("speedBall").style.color = 'red';
  188. toggles.speedBall = false;
  189. App.game.pokeballs.pokeballCatchTime = [1250, 1000, 750, 500];
  190. } else if (!toggles.speedBall) {
  191. document.getElementById("speedBall").style.color = 'black';
  192. toggles.speedBall = true;
  193. App.game.pokeballs.pokeballCatchTime = [125, 100, 75, 50]
  194. }
  195. }
  196. var delay = 0;
  197. function automate(){
  198. delay = ++delay % 100;
  199. if(delay % 50 == 0){
  200. autoMine();
  201. autoFarm();
  202. }
  203. if(delay % 20 == 0){
  204. autoBreeder();
  205. }
  206. autoGym();
  207. autoClicker();
  208. autoDungeon();
  209. autoItems();
  210. }
  211. function addInterface(){
  212. window.window.$("#battleContainer").append('<button id="autoClick" style="color:red" onclick="toggleSetting(\'Click\')">AutoClick</button>');
  213. window.window.$("#breedingDisplay").append('<button id="autoHatch" style="color:red" onclick="toggleSetting(\'Hatch\')">AutoHatch</button>');
  214. var centerbuttons = '<div id="centerbuttons" class="row" margin:"auto">' +
  215. '<button id="autoRepeat" style="color:red" onclick="toggleSetting(\'Repeat\')">Repeat Dungeon</button>' +
  216. '<button id="autoDungeon" style="color:red" onclick="toggleSetting(\'Dungeon\',\'autoDungeon\')">Auto Dungeon</button>' +
  217. '<button id="autoGym" style="color:red" onclick="toggleSetting(\'Gym\')">Auto Gym</button>' +
  218. '<button id="autoBomb" style="color:black" onclick="toggleSetting(\'Bomb\')">Auto Bomb</button>' +
  219. '<button id="autoItems" style="color:black" onclick="toggleSetting(\'Items\')">Auto Items</button>' +
  220. '<button id="speedBall" style="color:red" onclick="speedBall()">SpeedBall(cheaty)</button>' +
  221. '</div>';
  222. window.window.$("#middle-column").append(centerbuttons);
  223.  
  224. setButtons();
  225. setInterval(automate,10);
  226. }
  227. window.checkLoad = function(){
  228. if(!App.game || !App.game.farming){
  229. return;
  230. }
  231. clearInterval(cl);
  232.  
  233. window.window.$("#battleContainer").append('<button id="autoClick" style="color:red" onclick="toggleSetting(\'Click\')">AutoClick</button>');
  234. window.window.$("#breedingDisplay").append('<button id="autoHatch" style="color:red" onclick="toggleSetting(\'Hatch\')">AutoHatch</button>');
  235. var centerbuttons = '<div id="centerbuttons" class="row" margin:"auto">' +
  236. '<button id="autoRepeat" style="color:red" onclick="toggleSetting(\'Repeat\')">Repeat Dungeon</button>' +
  237. '<button id="autoDungeon" style="color:red" onclick="toggleSetting(\'Dungeon\',\'autoDungeon\')">Auto Dungeon</button>' +
  238. '<button id="autoGym" style="color:red" onclick="toggleSetting(\'Gym\')">Auto Gym</button>' +
  239. '<button id="autoBomb" style="color:black" onclick="toggleSetting(\'Bomb\')">Auto Bomb</button>' +
  240. '<button id="autoItems" style="color:black" onclick="toggleSetting(\'Items\')">Auto Items</button>' +
  241. '<button id="speedBall" style="color:red" onclick="speedBall()">SpeedBall(cheaty)</button>' +
  242. '</div>';
  243. window.window.$("#middle-column").append(centerbuttons);
  244.  
  245. setButtons();
  246. setInterval(automate,10);
  247. }
  248.  
  249. window.cl = setInterval(checkLoad,10);
  250.  
  251. // document.querySelector("#middle-column").innerHTML += ('<button id="autoDungeon" style="color:red" onclick="toggleDungeon()">AutoDungeon</button>');
  252. // document.querySelector("#middle-column").innerHTML += ('<button id="autoDungeon" style="color:red" onclick="toggleDungeon()">AutoDungeon</button>');
  253. })();
Advertisement
Add Comment
Please, Sign In to add comment