Diep.io Region Decoder

press L and region shows

  1. // ==UserScript==
  2. // @name Diep.io Region Decoder
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0
  5. // @description press L and region shows
  6. // @author el bismut
  7. // @match https://diep.io/
  8. // @icon https://www.google.com/s2/favicons?domain=diep.io
  9. // @grant none
  10. // @license none
  11. // ==/UserScript==
  12. //original content
  13.  
  14. var region = '';
  15. var link = '';
  16. function serverConnectHook(server) {
  17. region = server.split("lobby.")[1].split(".hiss")[0];
  18. }
  19. window.WebSocket = new Proxy(WebSocket, {construct(t, args) {serverConnectHook(args[0]); return Reflect.construct(t, args)}});
  20. CanvasRenderingContext2D.prototype.fillText = new Proxy(CanvasRenderingContext2D.prototype.fillText, {
  21. apply(fillText, ctx, [text, x, y, ...blah]) {
  22. if(text.includes("ms") && text.includes(".")) {
  23. const lengthBefore = ctx.measureText(text).width;
  24. text = text.split(" ms")[0] + "ms " + region;
  25. ctx.textAlign = 'right';
  26. x += lengthBefore;
  27. }
  28. fillText.call(ctx, text, x, y, ...blah);
  29. }
  30. });
  31. CanvasRenderingContext2D.prototype.strokeText = new Proxy(CanvasRenderingContext2D.prototype.strokeText, {
  32. apply(strokeText, ctx, [text, x, y, ...blah]) {
  33. if(text.includes("ms") && text.includes(".")) {
  34. const lengthBefore = ctx.measureText(text).width;
  35. text = text.split(" ms")[0] + "ms " + region;
  36. ctx.textAlign = 'right';
  37. x += lengthBefore;
  38. }
  39. strokeText.call(ctx, text, x, y, ...blah);
  40. }
  41. });