Sploop.io Hat Hotkeys

Allows to equip hats by pressing keys!

安装此脚本?
作者推荐脚本

您可能也喜欢Dsync Client [Sploop.io]

安装此脚本
  1. // ==UserScript==
  2. // @name Sploop.io Hat Hotkeys
  3. // @author Murka
  4. // @description Allows to equip hats by pressing keys!
  5. // @icon https://sploop.io/img/ui/favicon.png
  6. // @version 0.2
  7. // @match *://sploop.io/*
  8. // @run-at document-start
  9. // @grant none
  10. // @license MIT
  11. // @namespace https://gf.qytechs.cn/users/919633
  12. // ==/UserScript==
  13. /* jshint esversion:8 */
  14.  
  15. /*
  16. Author: Murka
  17. Github: https://github.com/Murka007
  18. Discord: https://discord.gg/sG9cyfGPj5
  19. Greasyfork: https://gf.qytechs.cn/en/users/919633
  20. */
  21.  
  22. (function() {
  23. "use strict";
  24.  
  25. const HATS = {
  26. BUSH_HAT: 0,
  27. BERSERKER: 1,
  28. JUNGLE_GEAR: 2,
  29. CRYSTAL_GEAR: 3,
  30. SPIKE_GEAR: 4,
  31. IMMUNITY_GEAR: 5,
  32. BOOST_HAT: 6,
  33. APPLE_HAT: 7,
  34. SCUBA_GEAR: 8,
  35. HOOD: 9,
  36. DEMOLIST: 10
  37. };
  38.  
  39. // Change your keybinds if you need to, get list of the key codes here: https://keycode.info
  40. // Please use `event.code` to change keybind
  41. // If you don't need a keybind, leave the field empty ""
  42.  
  43. const KEYBINDS = {
  44. [HATS.BUSH_HAT]: "",
  45. [HATS.BERSERKER]: "KeyB",
  46. [HATS.JUNGLE_GEAR]: "",
  47. [HATS.CRYSTAL_GEAR]: "KeyG",
  48. [HATS.SPIKE_GEAR]: "KeyT",
  49. [HATS.IMMUNITY_GEAR]: "KeyV",
  50. [HATS.BOOST_HAT]: "KeyM",
  51. [HATS.APPLE_HAT]: "",
  52. [HATS.SCUBA_GEAR]: "",
  53. [HATS.HOOD]: "KeyU",
  54. [HATS.DEMOLIST]: "KeyZ"
  55. };
  56.  
  57. // HAT EQUIP LOGIC GOES BELOW
  58.  
  59.  
  60.  
  61. const log = console.log;
  62. const storage = {
  63. get(key) {
  64. const value = localStorage.getItem(key);
  65. return value === null ? null : JSON.parse(value);
  66. },
  67. set(key, value) {
  68. localStorage.setItem(key, JSON.stringify(value));
  69. }
  70. };
  71.  
  72. function sleep(ms) {
  73. return new Promise(resolve => setTimeout(resolve, ms));
  74. }
  75.  
  76. function isInput() {
  77. return document.activeElement.tagName === "INPUT";
  78. }
  79.  
  80. function inGame() {
  81. const homepage = document.querySelector("#homepage");
  82. return homepage && homepage.style.display !== "flex";
  83. }
  84.  
  85. function canEquip() {
  86. return !isInput() && inGame();
  87. }
  88.  
  89. function createKeyboardEvent(type, code) {
  90. return new Proxy(new KeyboardEvent(type), {
  91. get(target, prop) {
  92. if (prop === "isTrusted") return true;
  93. if (prop === "target") return document.body;
  94. if (prop === "code") return code;
  95. return target[prop];
  96. }
  97. })
  98. }
  99.  
  100. function keypress(code) {
  101. const keydown = createKeyboardEvent("keydown", code);
  102. const keyup = createKeyboardEvent("keyup", code);
  103. window.onkeydown(keydown);
  104. window.onkeyup(keyup);
  105. }
  106.  
  107. function mouseup(target) {
  108. target.onmouseup(new Proxy(new MouseEvent("mouseup"), {
  109. get(target, prop) {
  110. if (prop === "isTrusted") return true;
  111. if (prop === "target") return target;
  112. return target[prop];
  113. }
  114. }));
  115. }
  116.  
  117. let equipToggle = false;
  118. async function equipHat(index) {
  119. if (!canEquip() || equipToggle) return;
  120. equipToggle = true;
  121.  
  122. const hatActionButton = document.querySelectorAll(".hat_action_button")[index];
  123. if (!hatActionButton) throw new Error("Failed to find hat with index: " + index);
  124.  
  125. const keybinds = storage.get("keybinds");
  126. const OpenShopKey = keybinds && keybinds[18] || "KeyN";
  127.  
  128. keypress(OpenShopKey);
  129. await sleep(150);
  130. if (hatActionButton.textContent === "BUY") {
  131. mouseup(hatActionButton);
  132. }
  133. mouseup(hatActionButton);
  134. await sleep(150);
  135. keypress(OpenShopKey);
  136.  
  137. await sleep(1500);
  138. equipToggle = false;
  139. }
  140.  
  141. window.addEventListener("keydown", function(event) {
  142. if (event.repeat) return;
  143.  
  144. for (const key in KEYBINDS) {
  145. if (event.code === KEYBINDS[key]) {
  146. equipHat(key);
  147. break;
  148. }
  149. }
  150. })
  151.  
  152. })();

QingJ © 2025

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