Greasy Fork is available in English.

MooMoo.io Key Rebinder

F -> Hold Trap/Boost Pad / V -> Hold Spike / N -> Hold Windmill

Instali tiun ĉi skripton?
Author's suggested script

You may also like MooMoo.io Custom Store.

Instali tiun ĉi skripton
  1. // ==UserScript==
  2. // @name MooMoo.io Key Rebinder
  3. // @description F -> Hold Trap/Boost Pad / V -> Hold Spike / N -> Hold Windmill
  4. // @author KOOKY WARRIOR
  5. // @match *://*.moomoo.io/*
  6. // @icon https://moomoo.io/img/favicon.png?v=1
  7. // @require https://cdnjs.cloudflare.com/ajax/libs/msgpack-lite/0.1.26/msgpack.min.js
  8. // @require https://update.greasyfork.org/scripts/478839/MooMooio%20Packet%20Code.js
  9. // @run-at document-start
  10. // @grant unsafeWindow
  11. // @license MIT
  12. // @version 0.7.2
  13. // @namespace https://greasyfork.org/users/999838
  14. // ==/UserScript==
  15.  
  16. ;(async () => {
  17. unsafeWindow.keyRebinder = true
  18.  
  19. let items = [],
  20. weapons = [],
  21. inGame = false,
  22. keys = {},
  23. init = false,
  24. ws = await new Promise(async (resolve) => {
  25. let { send } = WebSocket.prototype
  26.  
  27. WebSocket.prototype.send = function (...x) {
  28. send.apply(this, x)
  29. this.send = send
  30. this.iosend = function (...datas) {
  31. const [packet, data] = datas
  32. this.send(msgpack.encode([packet, data]))
  33. }
  34. if (!init) {
  35. init = true
  36. this.addEventListener("message", (e) => {
  37. if (!e.origin.includes("moomoo.io") && !unsafeWindow.privateServer) return
  38. const [packet, data] = msgpack.decode(new Uint8Array(e.data))
  39. switch (packet) {
  40. case PACKETCODE.RECEIVE.setupGame:
  41. inGame = true
  42. items = [0, 3, 6, 10]
  43. weapons = [0]
  44. break
  45. case PACKETCODE.RECEIVE.killPlayer:
  46. inGame = false
  47. break
  48. case PACKETCODE.RECEIVE.updateItems:
  49. if (data[0]) {
  50. if (data[1]) weapons = data[0]
  51. else items = data[0]
  52. }
  53. break
  54. }
  55. })
  56. }
  57. resolve(this)
  58. }
  59. })
  60.  
  61. var observer = new MutationObserver((mutations) => {
  62. mutations.forEach((mutationRecord) => {
  63. if (document.getElementById("allianceMenu").style.display == "block" || document.getElementById("chatHolder").style.display == "block") {
  64. keys = {}
  65. }
  66. })
  67. })
  68. observer.observe(document.getElementById("allianceMenu"), {
  69. attributes: true,
  70. attributeFilter: ["style"]
  71. })
  72. observer.observe(document.getElementById("chatHolder"), {
  73. attributes: true,
  74. attributeFilter: ["style"]
  75. })
  76.  
  77. unsafeWindow.addEventListener("keydown", (event) => {
  78. if (
  79. inGame &&
  80. !keys[event.code] &&
  81. document.getElementById("allianceMenu").style.display != "block" &&
  82. document.getElementById("chatHolder").style.display != "block"
  83. ) {
  84. keys[event.code] = true
  85. if (event.code == "KeyF" && items[4]) {
  86. ws.iosend(PACKETCODE.SEND.selectToBuild, [items[4], null])
  87. } else if (event.code == "KeyV") {
  88. ws.iosend(PACKETCODE.SEND.selectToBuild, [items[2], null])
  89. } else if (event.code == "KeyN") {
  90. ws.iosend(PACKETCODE.SEND.selectToBuild, [items[3], null])
  91. }
  92. }
  93. })
  94.  
  95. unsafeWindow.addEventListener("keyup", (event) => {
  96. if (
  97. inGame &&
  98. keys[event.code] &&
  99. document.getElementById("allianceMenu").style.display != "block" &&
  100. document.getElementById("chatHolder").style.display != "block"
  101. ) {
  102. keys[event.code] = false
  103. }
  104. })
  105. })()