Greasy Fork 支持简体中文。

Sploop.io - KeyStroks, Hats, No grids, Better shop

random desc

  1. // ==UserScript==
  2. // @name Sploop.io - KeyStroks, Hats, No grids, Better shop
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description random desc
  6. // @author You
  7. // @match *://sploop.io/*
  8. // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. var transformhatshop = document.getElementById('hat-menu');
  13. transformhatshop.style.width = "500px";
  14. transformhatshop.style.height = "500px";
  15.  
  16. document.getElementById("homepage").style.backgroundImage = "url('https://klike.net/uploads/posts/2019-11/1574605225_2.jpg')"
  17.  
  18. document.getElementById('lostworld-io_300x250_1').remove();
  19. document.getElementById('lostworld-io_300x250_2').remove();
  20. document.getElementById('lostworld-io_970x250').remove();
  21.  
  22. var FPS,cps = 0,Mcps = 0,Hue = 0;
  23. (function() {
  24. var UPDATE_DELAY = 700;
  25. var lastUpdate = 0;
  26. var frames = 0;
  27. function updateCounter() {
  28. var now = Date.now();
  29. var elapsed = now - lastUpdate;
  30. if (elapsed < UPDATE_DELAY) {
  31. ++frames;
  32. } else {
  33. FPS = Math.round(frames / (elapsed / 1000));
  34. frames = 0;
  35. lastUpdate = now;
  36. }
  37. requestAnimationFrame(updateCounter);
  38. }
  39. lastUpdate = Date.now();
  40. requestAnimationFrame(updateCounter);
  41. })();
  42. document.addEventListener("mousedown", click, false);
  43. document.addEventListener("mouseup", endclick, false);
  44. function click(e) {
  45. if ((e.button == 0 || 1 || 2) || e.keycode == 32) {
  46. cps++
  47. setTimeout(() => {
  48. cps--
  49. }, 900);
  50. }
  51. if (e.button == 0) { document.getElementById("LeftClick").style.backgroundColor = "white";}
  52. if (e.button == 2) { document.getElementById("RightClick").style.backgroundColor = "white";}
  53. }
  54. function endclick(e) {
  55. if (e.button == 0) {document.getElementById("LeftClick").style.backgroundColor = "rgba(0, 0, 0, 0.4)";}
  56. if (e.button == 2) {document.getElementById("RightClick").style.backgroundColor = "rgba(0, 0, 0, 0.4)";}
  57. }
  58. document.addEventListener('keydown', (e)=>{
  59. if (e.keyCode == 32) {document.getElementById("SpaceBar").style.backgroundColor = "white";
  60. cps++
  61. setTimeout(() => {
  62. cps--
  63. }, 900);}
  64. if (e.keyCode == 87) {document.getElementById("keyW").style.backgroundColor = "white";}
  65. if (e.keyCode == 82) {document.getElementById("keyR").style.backgroundColor = "white";}
  66. if (e.keyCode == 70) {document.getElementById("keyF").style.backgroundColor = "white";}
  67. if (e.keyCode == 69 && document.activeElement.tagName !== "INPUT") {
  68. if ($("#keyE").css("backgroundColor") == "rgba(0, 0, 0, 0.4)") {
  69. $("#keyE").css("backgroundColor", "white");
  70. } else {
  71. $("#keyE").css("backgroundColor", "rgba(0, 0, 0, 0.4)");
  72. }
  73. }
  74. if (e.keyCode == 81) {document.getElementById("keyQ").style.backgroundColor = "white";}
  75. if (e.keyCode == 65) {document.getElementById("keyA").style.backgroundColor = "white";}
  76. if (e.keyCode == 83) {document.getElementById("keyS").style.backgroundColor = "white";}
  77. if (e.keyCode == 68) {document.getElementById("keyD").style.backgroundColor = "white";}
  78. })
  79. document.addEventListener('keyup', (e)=>{
  80. if (e.keyCode == 32) {document.getElementById("SpaceBar").style.backgroundColor = "rgba(0, 0, 0, 0.4)";}
  81. if (e.keyCode == 87) {document.getElementById("keyW").style.backgroundColor = "rgba(0, 0, 0, 0.4)";}
  82. if (e.keyCode == 82) {document.getElementById("keyR").style.backgroundColor = "rgba(0, 0, 0, 0.4)";}
  83. if (e.keyCode == 70) {document.getElementById("keyF").style.backgroundColor = "rgba(0, 0, 0, 0.4)";}
  84. if (e.keyCode == 81) {document.getElementById("keyQ").style.backgroundColor = "rgba(0, 0, 0, 0.4)";}
  85. if (e.keyCode == 65) {document.getElementById("keyA").style.backgroundColor = "rgba(0, 0, 0, 0.4)";}
  86. if (e.keyCode == 83) {document.getElementById("keyS").style.backgroundColor = "rgba(0, 0, 0, 0.4)";}
  87. if (e.keyCode == 68) {document.getElementById("keyD").style.backgroundColor = "rgba(0, 0, 0, 0.4)";}
  88. })
  89. setInterval(() => {
  90. if (cps > Mcps) Mcps = cps
  91. Hue += Math.random() * .4
  92. Show.style.color = `hsl(${Hue}, 100%, 70%)`
  93. Panel.style.color = `hsl(${Hue}, 100%, 70%)`
  94. Show.innerHTML = `${FPS}FPS<br>${cps}CPS<br>${Mcps}MCPS`
  95. }, 0);
  96. let Show = document.createElement("div");
  97. Show.id = "SHOW"
  98. document.body.prepend(Show);
  99. let Panel = document.createElement("div");
  100. Panel.innerHTML = `
  101. <div id="Panel">
  102. <div id="keyQ">Q</div>
  103. <div id="keyW">W</div>
  104. <div id="keyR">R</div>
  105. <div id="keyF">F</div>
  106. <div id="keyE">E</div>
  107. <div id="keyA">A</div>
  108. <div id="keyS">S</div>
  109. <div id="keyD">D</div>
  110. <div id="LeftClick">LMB</div>
  111. <div id="RightClick">RMB</div>
  112. <div id="SpaceBar">________</div>
  113. </div>
  114. `
  115. document.body.appendChild(Panel)
  116.  
  117. var styleItem = document.createElement("style");
  118. styleItem.type = "text/css";
  119. styleItem.appendChild(document.createTextNode(`
  120. #SHOW {
  121. font-size: 18px;
  122. position: absolute;
  123. width: 90px;
  124. height: 75px;
  125. top:30px;
  126. left:10px;
  127. z-index:1000000;
  128. display: block;
  129. text-align: center;
  130. border-radius: 20px;
  131. background-color: rgba(0, 0, 0, 0.4);
  132. box-shadow: 0 0 2px #6dd1ff,0 0 0 4px #353535, 0 0 0 5px #3e3e3e, inset 0 0 10px rgba(0, 0, 0, 1), 0 5px 20px rgba(0,0,0,.5), inset 0 0 15px rgba(0,0,0,.2);
  133. }
  134.  
  135. #Panel {
  136. position: relative;
  137. width: 150px;
  138. height: 180px;
  139. top: 120px;
  140. left: 10px;
  141. z-index: 1000000;
  142. display: block;
  143. text-align: center;
  144. }
  145.  
  146. #keyQ {
  147. position: absolute;
  148. width: 50px;
  149. height: 45px;
  150. top: 0;
  151. left: 0px;
  152. background-color: rgba(0, 0, 0, 0.4);
  153. box-shadow: 0 0 2px #6dd1ff,0 0 0 4px #353535, 0 0 0 5px #3e3e3e, inset 0 0 10px rgba(0, 0, 0, 1), 0 5px 20px rgba(0,0,0,.5), inset 0 0 15px rgba(0,0,0,.2);
  154. border-top-left-radius: 10px;
  155. border-top-right-radius: 10px;
  156. }
  157.  
  158. #keyW {
  159. position: absolute;
  160. width: 50px;
  161. height: 45px;
  162. top: 0;
  163. left: 50px;
  164. background-color: rgba(0, 0, 0, 0.4);
  165. box-shadow: 0 0 2px #6dd1ff,0 0 0 4px #353535, 0 0 0 5px #3e3e3e, inset 0 0 10px rgba(0, 0, 0, 1), 0 5px 20px rgba(0,0,0,.5), inset 0 0 15px rgba(0,0,0,.2);
  166. border-top-left-radius: 10px;
  167. border-top-right-radius: 10px;
  168. }
  169.  
  170. #keyR {
  171. position: absolute;
  172. width: 50px;
  173. height: 45px;
  174. top: 0;
  175. left: 100px;
  176. background-color: rgba(0, 0, 0, 0.4);
  177. box-shadow: 0 0 2px #6dd1ff,0 0 0 4px #353535, 0 0 0 5px #3e3e3e, inset 0 0 10px rgba(0, 0, 0, 1), 0 5px 20px rgba(0,0,0,.5), inset 0 0 15px rgba(0,0,0,.2);
  178. border-top-left-radius: 10px;
  179. border-top-right-radius: 10px;
  180. z-index: -1;
  181. }
  182.  
  183. #keyF {
  184. position: absolute;
  185. width: 50px;
  186. height: 45px;
  187. top: 45px;
  188. left: 154px;
  189. background-color: rgba(0, 0, 0, 0.4);
  190. box-shadow: 0 0 2px #6dd1ff,0 0 0 4px #353535, 0 0 0 5px #3e3e3e, inset 0 0 10px rgba(0, 0, 0, 1), 0 5px 20px rgba(0,0,0,.5), inset 0 0 15px rgba(0,0,0,.2);
  191. border-top-left-radius: 10px;
  192. border-top-right-radius: 10px;
  193. z-index: -1;
  194. }
  195.  
  196. #keyE {
  197. position: absolute;
  198. width: 50px;
  199. height: 45px;
  200. top: 0;
  201. left: 150px;
  202. background-color: rgba(0, 0, 0, 0.4);
  203. box-shadow: 0 0 2px #6dd1ff,0 0 0 4px #353535, 0 0 0 5px #3e3e3e, inset 0 0 10px rgba(0, 0, 0, 1), 0 5px 20px rgba(0,0,0,.5), inset 0 0 15px rgba(0,0,0,.2);
  204. border-top-right-radius: 10px;
  205. border-bottom-right-radius: 10px;
  206. z-index: -1;
  207. }
  208.  
  209. #keyA {
  210. position: absolute;
  211. width: 50px;
  212. height: 45px;
  213. top: 45px;
  214. left: 0;
  215. background-color: rgba(0, 0, 0, 0.4);
  216. box-shadow: 0 0 2px #6dd1ff,0 0 0 4px #353535, 0 0 0 5px #3e3e3e, inset 0 0 10px rgba(0, 0, 0, 1), 0 5px 20px rgba(0,0,0,.5), inset 0 0 15px rgba(0,0,0,.2);
  217. border-top-left-radius: 10px;
  218. }
  219.  
  220. #keyS {
  221. position: absolute;
  222. width: 50px;
  223. height: 45px;
  224. top: 45px;
  225. left: 50px;
  226. background-color: rgba(0, 0, 0, 0.4);
  227. box-shadow: 0 0 2px #6dd1ff,0 0 0 4px #353535, 0 0 0 5px #3e3e3e, inset 0 0 10px rgba(0, 0, 0, 1), 0 5px 20px rgba(0,0,0,.5), inset 0 0 15px rgba(0,0,0,.2);
  228. }
  229.  
  230. #keyD {
  231. position: absolute;
  232. width: 50px;
  233. height: 45px;
  234. top: 45px;
  235. right: 0;
  236. background-color: rgba(0, 0, 0, 0.4);
  237. box-shadow: 0 0 2px #6dd1ff,0 0 0 4px #353535, 0 0 0 5px #3e3e3e, inset 0 0 10px rgba(0, 0, 0, 1), 0 5px 20px rgba(0,0,0,.5), inset 0 0 15px rgba(0,0,0,.2);
  238. border-top-right-radius: 10px;
  239. }
  240.  
  241. #LeftClick {
  242. position: absolute;
  243. width: 75px;
  244. height: 45px;
  245. top: 90px;
  246. left: 0;
  247. background-color: rgba(0, 0, 0, 0.4);
  248. box-shadow: 0 0 2px #6dd1ff,0 0 0 4px #353535, 0 0 0 5px #3e3e3e, inset 0 0 10px rgba(0, 0, 0, 1), 0 5px 20px rgba(0,0,0,.5), inset 0 0 15px rgba(0,0,0,.2);
  249. }
  250.  
  251. #RightClick {
  252. position: absolute;
  253. width: 75px;
  254. height: 45px;
  255. top: 90px;
  256. right: 0;
  257. background-color: rgba(0, 0, 0, 0.4);
  258. box-shadow: 0 0 2px #6dd1ff,0 0 0 4px #353535, 0 0 0 5px #3e3e3e, inset 0 0 10px rgba(0, 0, 0, 1), 0 5px 20px rgba(0,0,0,.5), inset 0 0 15px rgba(0,0,0,.2);
  259. }
  260.  
  261. #SpaceBar {
  262. position: absolute;
  263. width: 150px;
  264. height: 45px;
  265. bottom: 0;
  266. left: 0;
  267. border-bottom-left-radius: 10px;
  268. border-bottom-right-radius: 10px;
  269. background-color: rgba(0, 0, 0, 0.4);
  270. box-shadow: 0 0 2px #6dd1ff,0 0 0 4px #353535, 0 0 0 5px #3e3e3e, inset 0 0 10px rgba(0, 0, 0, 1), 0 5px 20px rgba(0,0,0,.5), inset 0 0 15px rgba(0,0,0,.2);
  271. }
  272.  
  273. `))
  274. document.head.appendChild(styleItem);
  275. document.getElementById("SHOW").addEventListener('mousedown', function (e) {
  276.  
  277. let prevX = e.clientX;
  278. let prevY = e.clientY;
  279.  
  280. window.addEventListener('mousemove', mousemove);
  281. window.addEventListener('mouseup', mouseup);
  282. function mousemove(e) {
  283. let newX = prevX - e.clientX;
  284. let newY = prevY - e.clientY;
  285.  
  286.  
  287. const rect = document.getElementById("SHOW").getBoundingClientRect();
  288.  
  289. document.getElementById("SHOW").style.left = rect.left - newX + 'px';
  290. document.getElementById("SHOW").style.top = rect.top - newY + 'px';
  291.  
  292. prevX = e.clientX;
  293. prevY = e.clientY;
  294. }
  295. function mouseup() {
  296. window.removeEventListener('mousemove', mousemove);
  297. window.removeEventListener('mouseup', mouseup);
  298. }
  299. });
  300. document.getElementById("Panel").addEventListener('mousedown', function (e) {
  301.  
  302. let prevX = e.clientX;
  303. let prevY = e.clientY;
  304.  
  305. window.addEventListener('mousemove', mousemove);
  306. window.addEventListener('mouseup', mouseup);
  307. function mousemove(e) {
  308. let newX = prevX - e.clientX;
  309. let newY = prevY - e.clientY;
  310.  
  311.  
  312. const rect = document.getElementById("Panel").getBoundingClientRect();
  313.  
  314. document.getElementById("Panel").style.left = rect.left - newX + 'px';
  315. document.getElementById("Panel").style.top = rect.top - newY + 'px';
  316.  
  317. prevX = e.clientX;
  318. prevY = e.clientY;
  319. }
  320. function mouseup() {
  321. window.removeEventListener('mousemove', mousemove);
  322. window.removeEventListener('mouseup', mouseup);
  323. }
  324. });
  325.  
  326. document.getElementById('hat-menu').style.background = "rgba(0,0,0,0)"
  327. document.getElementById("hat_menu_content").style.background = "rgba(0,0,0,0)"
  328. var styleItem1 = document.createElement("style");
  329. styleItem1.type = "text/css";
  330. styleItem1.appendChild(document.createTextNode(`
  331. .green-button {
  332. background-color: rgba(0, 0, 0, 0.5);
  333. box-shadow:none;
  334. }
  335. .green-button:hover {
  336. background-color: rgba(0, 0, 0);
  337. box-shadow:none;
  338. }
  339. .menu .content .menu-item {
  340. border-bottom: none;
  341. }
  342. #hat-menu {
  343. border: none;
  344. opacity: 0.9;
  345. }
  346. .header {
  347. opacity: 0.4;
  348. }
  349. .description {
  350. opacity: 0.4;
  351. }
  352. `))
  353. document.head.appendChild(styleItem1);
  354.  
  355. setInterval(() => {
  356. if (cps > Mcps) Mcps = cps
  357. Hue += Math.random() * .4
  358. var styleItem1 = document.createElement("style");
  359. styleItem1.type = "text/css";
  360. styleItem1.appendChild(document.createTextNode(`
  361. #hat-menu .green-button {
  362. color: hsl(${Hue}, 100%, 70%);
  363. }
  364. `))
  365. })
  366.  
  367. const HATS = {
  368. BUSH_HAT: 0,
  369. BERSERKER: 1,
  370. JUNGLE_GEAR: 2,
  371. CRYSTAL_GEAR: 3,
  372. SPIKE_GEAR: 4,
  373. IMMUNITY_GEAR: 5,
  374. BOOST_HAT: 6,
  375. APPLE_HAT: 7,
  376. SCUBA_GEAR: 8,
  377. HOOD: 9,
  378. DEMOLIST: 10
  379. };
  380.  
  381. const KEYBINDS = {
  382. [HATS.BUSH_HAT]: "",
  383. [HATS.BERSERKER]: "KeyG",
  384. [HATS.JUNGLE_GEAR]: "",
  385. [HATS.CRYSTAL_GEAR]: "KeyT",
  386. [HATS.SPIKE_GEAR]: "KeyJ",
  387. [HATS.IMMUNITY_GEAR]: "Semicolon",
  388. [HATS.BOOST_HAT]: "KeyM",
  389. [HATS.APPLE_HAT]: "",
  390. [HATS.SCUBA_GEAR]: "KeyK",
  391. [HATS.HOOD]: "KeyY",
  392. [HATS.DEMOLIST]: "KeyV"
  393. };
  394.  
  395. // HAT EQUIP LOGIC GOES BELOW
  396.  
  397.  
  398.  
  399. const log = console.log;
  400. const storage = {
  401. get(key) {
  402. const value = localStorage.getItem(key);
  403. return value === null ? null : JSON.parse(value);
  404. },
  405. set(key, value) {
  406. localStorage.setItem(key, JSON.stringify(value));
  407. }
  408. };
  409.  
  410. function sleep(ms) {
  411. return new Promise(resolve => setTimeout(resolve, ms));
  412. }
  413.  
  414. function isInput() {
  415. return document.activeElement.tagName === "INPUT";
  416. }
  417.  
  418. function inGame() {
  419. const homepage = document.querySelector("#homepage");
  420. return homepage && homepage.style.display !== "flex";
  421. }
  422.  
  423. function canEquip() {
  424. return !isInput() && inGame();
  425. }
  426.  
  427. function createKeyboardEvent(type, code) {
  428. return new Proxy(new KeyboardEvent(type), {
  429. get(target, prop) {
  430. if (prop === "isTrusted") return true;
  431. if (prop === "target") return document.body;
  432. if (prop === "code") return code;
  433. return target[prop];
  434. }
  435. })
  436. }
  437.  
  438. function keypress(code) {
  439. const keydown = createKeyboardEvent("keydown", code);
  440. const keyup = createKeyboardEvent("keyup", code);
  441. window.onkeydown(keydown);
  442. window.onkeyup(keyup);
  443. }
  444.  
  445. function mouseup(target) {
  446. target.onmouseup(new Proxy(new MouseEvent("mouseup"), {
  447. get(target, prop) {
  448. if (prop === "isTrusted") return true;
  449. if (prop === "target") return target;
  450. return target[prop];
  451. }
  452. }));
  453. }
  454.  
  455. let equipToggle = false;
  456. async function equipHat(index) {
  457. if (!canEquip() || equipToggle) return;
  458. equipToggle = true;
  459.  
  460. const hatActionButton = document.querySelectorAll(".hat_action_button")[index];
  461. if (!hatActionButton) throw new Error("Failed to find hat with index: " + index);
  462.  
  463. const keybinds = storage.get("keybinds");
  464. const OpenShopKey = keybinds && keybinds[18] || "KeyN";
  465.  
  466. keypress(OpenShopKey);
  467. await sleep(150);
  468. if (hatActionButton.textContent === "BUY") {
  469. mouseup(hatActionButton);
  470. }
  471. mouseup(hatActionButton);
  472. await sleep(150);
  473. keypress(OpenShopKey);
  474.  
  475. await sleep(1500);
  476. equipToggle = false;
  477. }
  478.  
  479. window.addEventListener("keydown", function(event) {
  480. if (event.repeat) return;
  481.  
  482. for (const key in KEYBINDS) {
  483. if (event.code === KEYBINDS[key]) {
  484. equipHat(key);
  485. break;
  486. }
  487. }
  488. })
  489.  
  490. const grids = document.querySelector("#grid-toggle");
  491. setInterval(() => {
  492. if (grids.checked){grids.click();}
  493. }, 0);