Geoguessr Resolver Hack (Updated!)

Features: Automatically score 5000 Points | Score randomly between 4500 and 5000 points | Open in Google Maps | See enemy guess Distance

当前为 2023-06-05 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Geoguessr Resolver Hack (Updated!)
  3. // @namespace http://tampermonkey.net/
  4. // @version 9.1
  5. // @description Features: Automatically score 5000 Points | Score randomly between 4500 and 5000 points | Open in Google Maps | See enemy guess Distance
  6. // @author 0x978
  7. // @match https://www.geoguessr.com/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=geoguessr.com
  9. // @grant none
  10. // ==/UserScript==
  11. window.alert = function(message) { // Devs tried to overwrite alert to detect script. I had already stopped using alert, but i'd rather they didn't override this anyway.
  12. nativeAlert(message)
  13. };
  14.  
  15. const originalFetch = window.fetch;
  16. window.fetch = function (url, options) {
  17. console.log('Intercepted fetch:', url, options);
  18. if(url === "https://www.geoguessr.com/api/v4/cd0d1298-a3aa-4bd0-be09-ccf513ad14b1"){ // devs using this endpoint for Anticheat. Block all calls to it.
  19. return
  20. }
  21. return originalFetch.call(this, url, options);
  22. };
  23. async function v(e, r){
  24. let q = await fetch(`https://nominatim.openstreetmap.org/reverse?lat=${e}&lon=${r}&format=json`)
  25. return await q.json();
  26. }
  27. function qq() {
  28. let [p,m] = oi()
  29. v(p,m).then(x => {
  30. console.log(x)
  31. alert(`
  32. Country: ${x.address.country}
  33. County: ${x.address.county}
  34. City: ${x.address.city}
  35. Road: ${x.address.road}
  36. State: ${x.address.state}
  37. Postcode: ${x.address.postcode}
  38. Village/Suburb: ${(x.address.village||x.address.suburb)}
  39. Postal Address: ${x.display_name}
  40. `) } );
  41. }
  42. function km(h){
  43. let [qqw,th] = oi()
  44. if(document.getElementsByClassName("guess-map__canvas-container")[0] === undefined){mn([qqw,th]);return;}
  45. if(h){qqw += (Math.random() / 2);th += (Math.random() / 2);}
  46. let wc = document.getElementsByClassName("guess-map__canvas-container")[0]
  47. let vvr = Object.keys(wc)
  48. let er = vvr.find(b => b.startsWith("__reactFiber$"))
  49. let fp = wc[er].return.memoizedProps.onMarkerLocationChanged
  50. LILILI = false
  51. ed()
  52. vevd({lat:qqw,lng:th})
  53. fp({lat:qqw,lng:th})
  54. vod()
  55. }
  56.  
  57. function mn([e,g]){
  58. let f = document.getElementsByClassName("region-map_map__7jxcD")[0]
  59. let lllk = Object.keys(f)
  60. let u = lllk.find(key => key.startsWith("__reactFiber$"))
  61. let fg = f[u].return.memoizedProps.onRegionSelected
  62. v(e,g).then(cx => {let countryCode = cx.address.country_code
  63. fg(countryCode)})
  64. }
  65. function oi(){
  66. let ww = document.getElementsByClassName("styles_root__3xbKq")[0]
  67. let e = Object.keys(ww)
  68. let u = e.find(key => key.startsWith("__reactFiber$"))
  69. let w = ww[u]
  70. let qwqa = w.return.memoizedProps.panorama.position
  71. return([qwqa.lat(),qwqa.lng()])
  72. }
  73. function vn(){
  74. let [xz,bt] = oi()
  75. if(!xz||!bt){return;}
  76. window.open(`https://www.google.com/maps/place/${xz},${bt}`);
  77. }
  78. function hr(){
  79. const ecc = wer()
  80. if(ecc === null){return;}
  81. const lll = Math.round(ecc / 1000)
  82. const th = Math.round(lll * 0.621371)
  83. return [lll,th]
  84. }
  85. function wer(){
  86. const jjh = document.getElementsByClassName("game_layout__TO_jf")[0]
  87. if(!jjh){return null}
  88. const hhj = Object.keys(jjh)
  89. const hjh = hhj.find(key => key.startsWith("__reactFiber$"))
  90. const jhjh = jjh[hjh]
  91. const jhj = jhjh.return.memoizedProps.gameState.teams
  92. const jjjh = mnbv(jhj,veec())
  93. const hhjh = jjjh.players[0].guesses
  94. const jhgj = hhjh[hhjh.length-1]
  95. if(!ILILILLI(jhjh.return.memoizedProps.gameState,hhjh)){
  96. return null;
  97. }
  98. return jhgj.distance
  99. }
  100. function veec(){
  101. const vece = document.getElementsByClassName("user-nick_root__DUfvc")[0]
  102. const vcee = Object.keys(vece)
  103. const ecve = vcee.find(key => key.startsWith("__reactFiber$"))
  104. const ceev = vece[ecve]
  105. const eevc = ceev.return.memoizedProps.userId
  106. return eevc
  107. }
  108. function mnbv(mnmm, mnnb){
  109. const mn = mnmm[0].players[0].playerId
  110. if(mn !== mnnb){
  111. return mnmm[0]
  112. }
  113. else{
  114. return mnmm[1]
  115. }
  116. }
  117. function ILILILLI(ilil, lilil){
  118. const li = ilil.currentRoundNumber
  119. const il = lilil ? lilil.length : 0;
  120. return li === il
  121. }
  122. function ufsfj(h){
  123. const w = oi()
  124. const gf = w[0] * (Math.PI / 180)
  125. const fg = w[1] * (Math.PI / 180)
  126. const y = document.getElementsByClassName("guess-map__canvas-container")[0]
  127. const c = Object.keys(y)
  128. const x = c.find(key => key.startsWith("__reactFiber$"))
  129. const t = y[x]
  130. const b = h ?? t.return.memoizedProps.markers[0]
  131. if(!w || !b){
  132. return null
  133. }
  134. const ik = b.lat * (Math.PI / 180)
  135. const ki = b.lng * (Math.PI / 180)
  136. return Math.acos(Math.sin(gf)*Math.sin(ik) + Math.cos(gf) * Math.cos(ik) * Math.cos(ki - fg)) * 6371
  137. }
  138. function ed(r){
  139. let ii = Math.round(ufsfj(r))
  140. if(ii === null){
  141. return
  142. }
  143. let x = hr()
  144. let g = x ? `${ii} km || Enemy: ${x[0]} km` :`${ii} km (${Math.round(ii * 0.621371)} miles)`
  145. frf(g)
  146. //alert(`Your marker is ${distance} km (${Math.round(distance * 0.621371)} miles) away from the correct guess`)
  147. }
  148. function frf(e){
  149. let x = Array.from(document.getElementsByClassName("button_wrapper__NkcHZ"))
  150. if(!x){
  151. console.log("ERROR: Failed to calculate distance, unable to locate button.")
  152. return null}
  153. x[x.length-1].innerText = e
  154. }
  155.  
  156. function vevd(){
  157. const ILILI = (e) => {
  158. if (e.keyCode === 32) {
  159. const ILIII = ufsfj()
  160. if((ILIII < 1 || isNaN(ILIII)) && !LILILI){
  161. e.stopImmediatePropagation();
  162. adjdf()
  163. document.removeEventListener("keyup", ILILI);
  164. LILILI = true
  165. }
  166. }
  167. };
  168. document.addEventListener("keyup", ILILI);
  169. setTimeout(() => {
  170. const xexex = ufsfj()
  171. if((xexex < 1 || isNaN(xexex)) && !LILILI){
  172. let xexe = document.getElementsByClassName("button_button__CnARx button_variantPrimary__xc8Hp")[0][Object.keys(document.getElementsByClassName("button_button__CnARx button_variantPrimary__xc8Hp")[0])[1]].onClick
  173. document.getElementsByClassName("button_button__CnARx button_variantPrimary__xc8Hp")[0][Object.keys(document.getElementsByClassName("button_button__CnARx button_variantPrimary__xc8Hp")[0])[1]].onClick = ( () => {
  174. LILILI = true
  175. adjdf()
  176. document.getElementsByClassName("button_button__CnARx button_variantPrimary__xc8Hp")[0][Object.keys(document.getElementsByClassName("button_button__CnARx button_variantPrimary__xc8Hp")[0])[1]].onClick = (() => xexe())
  177. })
  178. }
  179. },500)
  180. }
  181.  
  182. function adjdf(){
  183. alert(`Geoguessr Resolver has prevented you from making a perfect guess.
  184. Making perfect guesses will very likely result in a ban from competitive.
  185. Press "guess" again to proceed anyway.`)
  186. }
  187.  
  188. function vod(){
  189. document.getElementsByClassName("guess-map__canvas-container")[0].onpointermove = (() =>{
  190. ed()
  191. })
  192. }
  193.  
  194. let h = (e) => {
  195. if(e.keyCode === 49){km(true)}
  196. if(e.keyCode === 50){km(false)}
  197. if(e.keyCode === 51){qq()}
  198. if(e.keyCode === 52){vn()}
  199. if(e.keyCode === 53){hr()}
  200. if(e.keyCode === 54){ed()}
  201. }
  202. document.addEventListener("keydown", h);
  203. let LILILI = false
  204.  
  205. document.getElementsByClassName("header_logo__vV0HK")[0].innerText = `
  206. Geoguessr Resolver Loaded Successfully
  207. Controls (UPDATED!):
  208. '1': Place marker on a "safe" guess (4500 - 5000)
  209. '2': Place marker on a "perfect" guess (5000)
  210. '3': Get a description of the correct location.
  211. '4': Open location in Google Maps (In a new tab)
  212. After pressing '1' or '2' Your guess distance and Enemy Guess distance
  213. is automatically calculated when ever you place a marker on the map`