Greasy Fork is available in English.

Leader Arrow and Minimap Arrow

change their colors and track their position

  1. // ==UserScript==
  2. // @name Leader Arrow and Minimap Arrow
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.0.2
  5. // @description change their colors and track their position
  6. // @author h3llside
  7. // @match https://diep.io/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=diep.io
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. let leader_arrow = {ctx: null, xm: null, ym: null, xl: null, yl: null, color: "green"};
  14. let minimap_arrow = {ctx: null, xm: null, ym: null, xl: null, yl: null, color: "purple"};
  15.  
  16. let container = [];
  17. let last_length = -1;
  18. let ingamescreen = document.getElementById("in-game-screen");
  19. let crx = CanvasRenderingContext2D.prototype;
  20. let minimap_calls = 0;
  21.  
  22. function proxyMoveToAndLineTo(methodName) {
  23. return new Proxy(crx[methodName], {
  24. apply(f, _this, args) {
  25. if (_this.fillStyle === '#000000' && _this.globalAlpha != 0) {
  26. if(methodName === "moveTo"){
  27. switch (_this.strokeStyle){
  28. case "#172631":
  29. minimap_calls = 0;
  30. leader_arrow.ctx = _this.ctx;
  31. leader_arrow.xm = args[0];
  32. leader_arrow.ym = args[1];
  33. _this.fillStyle = leader_arrow.color
  34. _this.globalAlpha = 1;
  35. window.l_arrow = leader_arrow;
  36. break
  37. case "#000000":
  38. if(args[0] > canvas.width/1.5 && args[1] > canvas.height/1.5){
  39. minimap_calls += 1;
  40. if(minimap_calls > 10){
  41. leader_arrow.xm = null;
  42. leader_arrow.ym = null;
  43. }
  44. minimap_arrow.ctx = _this.ctx;
  45. minimap_arrow.xm = args[0];
  46. minimap_arrow.ym = args[1];
  47. _this.fillStyle = minimap_arrow.color
  48. window.m_arrow = minimap_arrow;
  49. }
  50. break
  51. }
  52. }else if(methodName === "lineTo"){
  53. switch (_this.strokeStyle){
  54. case "#172631":
  55. minimap_calls = 0;
  56. leader_arrow.ctx = _this.ctx;
  57. leader_arrow.xl = args[0];
  58. leader_arrow.yl = args[1];
  59. _this.fillStyle = leader_arrow.color
  60. _this.globalAlpha = 1;
  61. window.l_arrow = leader_arrow;
  62. break
  63. case "#000000":
  64. if(args[0] > canvas.width/1.5 && args[1] > canvas.height/1.5){
  65. minimap_calls += 1;
  66. if(minimap_calls > 10){
  67. leader_arrow.xl = null;
  68. leader_arrow.yl = null;
  69. }
  70. minimap_arrow.ctx = _this.ctx;
  71. minimap_arrow.xl = args[0];
  72. minimap_arrow.yl = args[1];
  73. _this.fillStyle = minimap_arrow.color
  74. window.m_arrow = minimap_arrow;
  75. }
  76. break
  77. }
  78. }
  79. container.push(Math.floor(args[0]));
  80. }
  81.  
  82. return f.apply(_this, args);
  83. }
  84. });
  85. }
  86.  
  87. function check_when_update(){
  88. if(ingamescreen.classList.contains("screen") && ingamescreen.classList.contains("active")){
  89. console.log(minimap_calls);
  90. let current_length = container.length;
  91. if(current_length === last_length){
  92. container = [];
  93. last_length = -1;
  94. //crx.moveTo = proxyMoveToAndLineTo('moveTo');
  95. crx.lineTo = proxyMoveToAndLineTo('lineTo');
  96. }else if(last_length < current_length){
  97. last_length = current_length;
  98. }
  99. }
  100. }
  101. setInterval(check_when_update, 100);