Pokevision Enhancer

Provides a hardcoded filter list and the ability to scan an area for pokemon

目前为 2016-07-28 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Pokevision Enhancer
  3. // @namespace https://greasyfork.org/en/users/814-bunta
  4. // @description Provides a hardcoded filter list and the ability to scan an area for pokemon
  5. // @include *pokevision.com/*
  6. // @version 1.1
  7. // @Author Bunta
  8. // @license http://creativecommons.org/licenses/by-nc-sa/3.0/us/
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12.  
  13. var scanDelay = 1000; // time between scans for each lat/long position. Should be no lower than 1000 (1s)
  14. var autoDelay = 120000; // time between scans repeating when Auto checkbox is enabled
  15. var scanOnLoad = false; // if true will perform scan as soon as page is loaded or refreshed
  16. var minLat = -36.84, maxLat = -36.87, minLon = 174.62, maxLon = 174.64; // bounds for the scan area. minLat is northmost value, minLon is westmost value. Scans adjust lat/long by 0.01
  17.  
  18. /* run below code (after setting above position variables) in console to view the bounds of your search area
  19. App.home.createMarker(1,{latitude: minLat,longitude:minLon,pokemonId:151,}); // Mew should be top left
  20. App.home.createMarker(1,{latitude: minLat,longitude:maxLon,pokemonId:25,}); // Pikachu should be top right
  21. App.home.createMarker(1,{latitude: maxLat,longitude:minLon,pokemonId:26,}); // Raichu should be bottom left
  22. App.home.createMarker(1,{latitude: maxLat,longitude:maxLon,pokemonId:150,}); // MewTwo should be bottom right
  23. */
  24.  
  25. var pokemonAlertList = { //Choose which pokemon you want to be alerted about!
  26. "Bulbasaur": false,
  27. "Ivysaur":false,
  28. "Venusaur":false,
  29. "Charmander":false,
  30. "Charmeleon":true,
  31. "Charizard":true,
  32. "Squirtle":false,
  33. "Wartortle":false,
  34. "Blastoise":true,
  35. "Caterpie":false,
  36. "Metapod":false,
  37. "Butterfree":false,
  38. "Weedle":false,
  39. "Kakuna":false,
  40. "Beedrill":false,
  41. "Pidgey":false,
  42. "Pidgeotto":false,
  43. "Pidgeot":false,
  44. "Rattata":false,
  45. "Raticate":false,
  46. "Spearow":false,
  47. "Fearow":false,
  48. "Ekans":false,
  49. "Arbok":false,
  50. "Pikachu":true,
  51. "Raichu":true,
  52. "Sandshrew":false,
  53. "Sandslash":false,
  54. "Nidoran♀":false,
  55. "Nidorina":false,
  56. "Nidoqueen":true,
  57. "Nidoran♂":false,
  58. "Nidorino":false,
  59. "Nidoking":false,
  60. "Clefairy":false,
  61. "Clefable":false,
  62. "Vulpix":false,
  63. "Ninetales":true,
  64. "Jigglypuff":false,
  65. "Wigglytuff":false,
  66. "Zubat":false,
  67. "Golbat":false,
  68. "Oddish":false,
  69. "Gloom":false,
  70. "Vileplume":true,
  71. "Paras":false,
  72. "Parasect":false,
  73. "Venonat":false,
  74. "Venomoth":false,
  75. "Diglett":false,
  76. "Dugtrio":true,
  77. "Meowth":false,
  78. "Persian":false,
  79. "Psyduck":false,
  80. "Golduck":false,
  81. "Mankey":false,
  82. "Primeape":true,
  83. "Growlithe":false,
  84. "Arcanine":false,
  85. "Poliwag":false,
  86. "Poliwhirl":false,
  87. "Poliwrath":false,
  88. "Abra":false,
  89. "Kadabra":false,
  90. "Alakazam":true,
  91. "Machop":false,
  92. "Machoke":true,
  93. "Machamp":true,
  94. "Bellsprout":false,
  95. "Weepinbell":false,
  96. "Victreebel":false,
  97. "Tentacool":false,
  98. "Tentacruel":false,
  99. "Geodude":false,
  100. "Graveler":false,
  101. "Golem":true,
  102. "Ponyta":false,
  103. "Rapidash":true,
  104. "Slowpoke":false,
  105. "Slowbro":false,
  106. "Magnemite":false,
  107. "Magneton":true,
  108. "Farfetch'd":true,
  109. "Doduo":false,
  110. "Dodrio":false,
  111. "Seel":false,
  112. "Dewgong":true,
  113. "Grimer":false,
  114. "Muk":true,
  115. "Shellder":false,
  116. "Cloyster":true,
  117. "Gastly":false,
  118. "Haunter":false,
  119. "Gengar":true,
  120. "Onix":false,
  121. "Drowzee":false,
  122. "Hypno":true,
  123. "Krabby":false,
  124. "Kingler":false,
  125. "Voltorb":false,
  126. "Electrode":false,
  127. "Exeggcute":false,
  128. "Exeggutor":true,
  129. "Cubone":false,
  130. "Marowak":true,
  131. "Hitmonlee":false,
  132. "Hitmonchan":false,
  133. "Lickitung":false,
  134. "Koffing":false,
  135. "Weezing":false,
  136. "Rhyhorn":false,
  137. "Rhydon":true,
  138. "Chansey":false,
  139. "Tangela":false,
  140. "Kangaskhan":true,
  141. "Horsea":false,
  142. "Seadra":false,
  143. "Goldeen":false,
  144. "Seaking":false,
  145. "Staryu":false,
  146. "Starmie":false,
  147. "Mr. Mime":true,
  148. "Scyther":false,
  149. "Jynx":false,
  150. "Electabuzz":false,
  151. "Magmar":false,
  152. "Pinsir":false,
  153. "Tauros":true,
  154. "Magikarp":false,
  155. "Gyarados":true,
  156. "Lapras":true,
  157. "Ditto":true,
  158. "Eevee":false,
  159. "Vaporeon":false,
  160. "Jolteon":true,
  161. "Flareon":true,
  162. "Porygon":false,
  163. "Omanyte":false,
  164. "Omastar":true,
  165. "Kabuto":false,
  166. "Kabutops":true,
  167. "Aerodactyl":false,
  168. "Snorlax":false,
  169. "Articuno":true,
  170. "Zapdos":true,
  171. "Moltres":true,
  172. "Dratini":false,
  173. "Dragonair":false,
  174. "Dragonite":true,
  175. "Mewtwo":true,
  176. "Mew":true,
  177. }
  178.  
  179. // Start with some style fixes to improve map visibility
  180. function addGlobalStyle(css) {
  181. var head, style;
  182. head = document.getElementsByTagName('head')[0];
  183. if (!head) { return; }
  184. style = document.createElement('style');
  185. style.type = 'text/css';
  186. style.innerHTML = css;
  187. head.appendChild(style);
  188. }
  189. addGlobalStyle("header { padding: 5px 0 ! important }")
  190. addGlobalStyle("body.home { padding: 40px 0px 0px 0 ! important }")
  191. $("footer").remove()
  192.  
  193. // Function to update the pokemon list to the selected pokemon above
  194. function refreshFilter() {
  195. $("button.bs-deselect-all").click()
  196. for (key in pokemonAlertList) {
  197. if (pokemonAlertList[key]) {
  198. $("ul.dropdown-menu.inner li span").filter(function(index) { return $(this).text() === key; }).click();
  199. }
  200. }
  201. }
  202.  
  203. var scanning = false;
  204.  
  205. // function to perform scanning in grid area bound by lat/long variables set above
  206. function scanLoop(lat,lon) {
  207. if (lon > maxLon) {
  208. lat -= 0.01;
  209. lon = minLon;
  210. }
  211. if (lat < maxLat) {
  212. console.log("Scanning Complete:", (new Date()).toLocaleTimeString());
  213. scanning = false;
  214. if ($("#autoRescan").prop("checked"))
  215. {
  216. console.log("Next scan will start:", (new Date((new Date()).getTime() + 120000)).toLocaleTimeString());
  217. setTimeout(function() { console.log("Initiating Scan:", (new Date()).toLocaleTimeString()); scanLoop(minLat,minLon); }, autoDelay);
  218. }
  219. return;
  220. }
  221. //console.log("scanning:",lat,lon);
  222. App.home.findNearbyPokemon(lat, lon);
  223. setTimeout(function() { scanLoop(lat,lon+0.01); }, scanDelay);
  224. }
  225.  
  226. // Add buttons to header bar
  227. $("a.header-map-locate").before('<input type="checkbox" name="autoRescan" id="autoRescan" value="Auto">Auto <button id="rescanPokes">Scan</Rescan><button id="refreshFilter">Filter</button>');
  228.  
  229. // Add click functions to buttons
  230. $("#rescanPokes").click(function() {
  231. console.log("rescanPokes");
  232. if (!scanning) {
  233. scanning = true;
  234. console.log("Initiating Scan:", (new Date()).toLocaleTimeString());
  235. scanLoop(minLat,minLon);
  236. }
  237. });
  238. $("#refreshFilter").click(function() {
  239. console.log("refreshFilter");
  240. refreshFilter();
  241. });
  242.  
  243. // Update filter and scan on page load (if enabled)
  244. $(window).load(function(){
  245. refreshFilter();
  246. if (!scanning && scanOnLoad) {
  247. scanning = true;
  248. console.log("Initiating Scan:", (new Date()).toLocaleTimeString());
  249. scanLoop(minLat,minLon);
  250. }
  251. });