Shadam's unlag FIXED

THIS IS NOT MY SCRIPT THIS IS JUST A FIXED VERSION OF SHADAM'S (SHADMAN CONTACT ME IF YOU WANT THIS TAKEN DOWN) ORIGINAL: https://gf.qytechs.cn/en/scripts/420008-unlag

此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.gf.qytechs.cn/scripts/450802/1163153/Shadam%27s%20unlag%20FIXED.js

  1. // ==UserScript==
  2. // @name Shadam's unlag FIXED
  3. // @version 0.0
  4. // @description THIS IS NOT MY SCRIPT THIS IS JUST A FIXED VERSION OF SHADAM'S (SHADMAN CONTACT ME IF YOU WANT THIS TAKEN DOWN) ORIGINAL: https://gf.qytechs.cn/en/scripts/420008-unlag
  5. // @author Shädam
  6. // @match https://diep.io/*
  7. // @grant none
  8. // @namespace https://gf.qytechs.cn/users/719520
  9. // @run-at document-start
  10. // ==/UserScript==
  11. var int = unsafeWindow.setInterval(function() {
  12. if(unsafeWindow.input != null) {
  13. unsafeWindow.clearInterval(int);
  14. onready();
  15. }
  16. }, 100);
  17. function onready() {
  18. let ping = false;
  19. let t;
  20. let samples = new Array(500);
  21. let m;
  22. let h = 0;
  23. function getMax() {
  24. let max = 0;
  25. for(let i = 0; i < 500; ++i) {
  26. if(samples[i] != null) {
  27. if(samples[i] > max) {
  28. max = samples[i];
  29. }
  30. } else {
  31. break;
  32. }
  33. }
  34. m = max;
  35. }
  36. function sleep(time) {
  37. return new Promise(function(resolve) {
  38. setTimeout(resolve, time);
  39. });
  40. }
  41. unsafeWindow.WebSocket = class extends WebSocket {
  42. constructor(ip) {
  43. super(ip);
  44. if(ip.match(/\.hiss\.io/) != null) {
  45. samples = new Array(500);
  46. h = 0;
  47. ping = false;
  48. this.send = new Proxy(this.send, {
  49. apply: function(to, what, args) {
  50. if(args[0].length == 1) {
  51. ping = true;
  52. t = new Date().getTime();
  53. }
  54. return to.apply(what, args);
  55. }
  56. });
  57. let a = unsafeWindow.setInterval(function() {
  58. if(this.onmessage != null) {
  59. unsafeWindow.clearInterval(a);
  60. this.onmessage = new Proxy(this.onmessage, {
  61. apply: function(to, what, args) {
  62. if(new Uint8Array(args[0].data).length == 1 && ping == true) {
  63. ping = false;
  64. samples[h] = new Date().getTime() - t;
  65. h = (h + 1) % 501;
  66. getMax();
  67. }
  68. return to.apply(what, args);
  69. }
  70. });
  71. }
  72. }.bind(this), 120);
  73. }
  74. }
  75. }
  76. unsafeWindow.powSolver = new Proxy(unsafeWindow.powSolver, {
  77. apply: function(to, what, args) {
  78. const time = new Date().getTime();
  79. const f = args[2];
  80. return to.apply(what, [args[0], args[1], async function(...g) {
  81. if(args[1] == 17 && 10000 - m * 3 - new Date().getTime() + time > 0) {
  82. await sleep(10000 - m * 3 - new Date().getTime() + time);
  83. }
  84. return f(...g);
  85. }]);
  86. }
  87. });
  88. }

QingJ © 2025

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