Disable Game Grid

Hold the KEY: [? or /] this is one key. When the process reaches 100%, the game grid will either appear or disappear.

  1. // ==UserScript==
  2. // @name Disable Game Grid
  3. // @namespace -
  4. // @version 0.1
  5. // @description Hold the KEY: [? or /] this is one key. When the process reaches 100%, the game grid will either appear or disappear.
  6. // @author Nudo#3310
  7. // @match *://moomoo.io/*
  8. // @match *://sandbox.moomoo.io/*
  9. // @icon https://www.google.com/s2/favicons?sz=64&domain=moomoo.io
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. let errorText = "arguments bro..."
  15.  
  16. function setLS(key, value = void 0) {
  17. if (!key) return console.log(errorText)
  18.  
  19. return localStorage.setItem(key, JSON.stringify(value))
  20. }
  21.  
  22. function getLS(key) {
  23. if (!key) return console.log(errorText)
  24.  
  25. try {
  26. return JSON.parse(localStorage.getItem(key))
  27. } catch {
  28. return localStorage.getItem(key)
  29. }
  30. }
  31.  
  32. function isGUIDisabled() {
  33. if (!["allianceinput", 'chatbox', 'nameinput'].includes(document.activeElement.id.toLowerCase())) {
  34. return true
  35. }
  36.  
  37. return false
  38. }
  39.  
  40. let gameGrid = (typeof getLS("gameGrid") !== "undefined" ? getLS("gameGrid") : true)
  41.  
  42. function createElement(tag, action, node = document.body) {
  43. if (!tag || !action) return console.log(errorText)
  44.  
  45. let element = document.createElement(tag)
  46.  
  47. action(element, element.style)
  48.  
  49. node.appendChild(element)
  50. }
  51.  
  52. createElement("div", (element, style) => {
  53. element.id = "toggler-holder"
  54. style.display = "flex"
  55. style.pointerEvents = "none"
  56. style.width = "100%"
  57. style.height = "100%"
  58. style.justifyContent = "center"
  59. style.alignItems = "center"
  60. style.position = "absolute"
  61. style.top = "0px"
  62. style.zIndex = "999999999999999"
  63. })
  64.  
  65. if (document.getElementById("toggler-holder")) {
  66. document.getElementById("toggler-holder").style.display = "none"
  67.  
  68. let togglerCode = `
  69. <div class="single-chart">
  70. <svg viewBox="0 0 36 36">
  71. <path class="circle" stroke-dasharray="0, 100" d="M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831" />
  72. <text x="18" y="17.35" class="percentage">Toggler Game Grid</text>
  73. <text x="18" y="20.35" class="percentage" id="percToggle" style="fill: #adadad;">0%</text>
  74. </svg>
  75. </div>
  76. <style>
  77. .single-chart {
  78. display: flex;
  79. width: 20%;
  80. justify-content: space-around;
  81. }
  82.  
  83. .circle {
  84. fill: rgb(28 28 28 / 70%);
  85. stroke: #eee;
  86. stroke-width: .5;
  87. stroke-linecap: round;
  88. animation: progress 1s ease-out forwards;
  89. }
  90.  
  91. @keyframes progress {
  92. 0% {
  93. stroke-dasharray: 0 100;
  94. }
  95. }
  96.  
  97. .percentage {
  98. fill: #eee;
  99. font-size: 3px;
  100. text-anchor: middle;
  101. }
  102. </style>
  103. `
  104. document.getElementById("toggler-holder").innerHTML = togglerCode
  105. }
  106.  
  107. let togglerOffset = 0
  108.  
  109. function resetToggler() {
  110. keys[191] = false
  111. activeToggler = false
  112. togglerOffset = 0
  113. document.getElementById("toggler-holder").style.display = "none"
  114. document.querySelector(".circle").style.strokeDasharray = [0, 100]
  115. }
  116.  
  117. function toggleGameGrid() {
  118. document.getElementById("toggler-holder").style.display = "flex"
  119.  
  120. togglerOffset += 2
  121. activeToggler = true
  122.  
  123. document.querySelector(".circle").style.strokeDasharray = [togglerOffset, 100]
  124. document.getElementById("percToggle").innerHTML = togglerOffset + "%"
  125.  
  126. if (togglerOffset >= 100) {
  127. gameGrid = !gameGrid
  128. setLS("gameGrid", gameGrid)
  129. resetToggler()
  130. }
  131. }
  132.  
  133. let keys = []
  134. let activeToggler = false
  135. let node = document || document.getElementById("gameCanvas") || window
  136.  
  137. node.addEventListener("keydown", (event) => {
  138. if (!isGUIDisabled()) return null
  139.  
  140. keys[event.keyCode] = true
  141. })
  142.  
  143. node.addEventListener("keyup", (event) => {
  144. keys[event.keyCode] = false
  145. })
  146.  
  147. let { maxScreenWidth, maxScreenHeight } = window.config
  148. let { lineTo, moveTo, clearRect } = CanvasRenderingContext2D.prototype
  149. let gridAlpha = 0.06
  150.  
  151. CanvasRenderingContext2D.prototype.clearRect = function(x, y, width, height) {
  152. if (keys[191]) {
  153. toggleGameGrid()
  154. } else {
  155. if (activeToggler) {
  156. resetToggler()
  157. }
  158. }
  159.  
  160. return clearRect.apply(this, arguments)
  161. }
  162.  
  163. CanvasRenderingContext2D.prototype.moveTo = function(x, y) {
  164. if (!gameGrid) {
  165. if (this.globalAlpha == gridAlpha) {
  166. return void 0
  167. } else {
  168. return moveTo.call(this, x, y)
  169. }
  170. }
  171.  
  172. return moveTo.apply(this, arguments)
  173. }
  174.  
  175. CanvasRenderingContext2D.prototype.lineTo = function(x, y) {
  176. if (!gameGrid) {
  177. if (y == maxScreenHeight || x == maxScreenWidth) {
  178. if (this.globalAlpha == gridAlpha) {
  179. return void 0
  180. } else {
  181. return lineTo.call(this, x, y)
  182. }
  183. } else {
  184. return lineTo.call(this, x, y)
  185. }
  186. }
  187.  
  188. return lineTo.apply(this, arguments)
  189. }
  190. })()

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址