Shape Aimbot

Q to enable boxes, r to enable lines and t to enable aimbot

当前为 2023-09-21 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Shape Aimbot
// @namespace    http://tampermonkey.net/
// @version      1
// @description  Q to enable boxes, r to enable lines and t to enable aimbot
// @author       Mi300
// @match        https://diep.io/*
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @license      MIT
// @grant        none
// ==/UserScript==
setTimeout(function(){
const canvas = document.getElementById ('canvas');
const context = canvas.getContext ('2d');
let mouse = [0, 0]
let shapes = {};
function clearShapes() {
shapes = {
  squares: [],
  triangles: [],
  pentagons: [],
}
}
clearShapes();
let shapeData = {
  triangles: {
    sides: 3,
    colour: '',
  },
  squares: {
    sides: 4,
    colour: '',
  },
  pentagons: {
    sides: 5,
    colour: '',
  },
}
let debugOptions = {
  lines: true,
  shapeInfo: true,
  aim: false,
}
const names = {
  squares: 'square',
  triangles: 'triangle',
  pentagons: 'pentagon',
}
function hookContext(method, callback, target = CanvasRenderingContext2D) {
  target.prototype[method] = new Proxy (target.prototype[method], {
    apply (method, thisArg, args) {
      callback(thisArg, args);
      return Reflect.apply (method, thisArg, args);
    }
  });
}
document.addEventListener('keydown', function(e) {
  if (e.key === 't') {
    debugOptions.aim = !debugOptions.aim;
  }
  if (e.key === 'r') {
    debugOptions.lines = !debugOptions.lines;
  }
  if (e.key === 'q') {
    debugOptions.shapeInfo = !debugOptions.shapeInfo;
  }
});


function hookShapes(shape, callback) {
  let calls = 0;
  let vertices = shapeData[shape].sides;
  let points = [];


 const onClose = (colour) => {
   callback(getCentre(points), colour)
 }
  hookContext('beginPath', function(thisArg, args){
    calls = 1;
    points = [];
  });
  hookContext('moveTo', function(thisArg, args){
    if (calls == 1) {
      calls+=1;
      points.push(args)
    } else {
      calls = 0;
    }
  });
  hookContext('lineTo', function(thisArg, args){
    if (calls >= 2 && calls <= vertices) {
      calls+=1;
      points.push(args)
    } else {
      calls = 0;
    }
  });
  hookContext('fill', function(thisArg, args){
    if(calls === vertices + 1) {

      onClose(thisArg.fillStyle);
    } else {
      calls = 0;
    }
  });
}
function getCentre (vertices) {
  let centre = [0, 0];
  vertices.forEach (vertex => {
    centre [0] += vertex[0]
    centre [1] += vertex[1]
  });
  centre[0] /= vertices.length;
  centre[1] /= vertices.length;
  return centre;
}
document.addEventListener('mousemove', function() {
  if (!debugOptions.aim) {
    return;
  }
  input.mouse(...mouse)
});
  hookShapes('squares', function(a, c){
    if (['#999999', '#000000', '#00b2e1', '#fcc376'].includes(c)) {
      return;
    }
    console.log (c)
    shapes.squares.push(a)
  });

  hookShapes('triangles', function(a, c){
    if (['#999999', '#000000', '#00b2e1', '#fcc376'].includes(c)) {
      return;
    }
    shapes.triangles.push(a)
  });
  hookShapes('pentagons', function(a, c){
    if (['#999999', '#000000', '#00b2e1', '#fcc376'].includes(c)) {
      return;
    }
    shapes.pentagons.push(a)
  });

function getDist(t1, t2){
  const distX = t1[0] - t2[0];
  const distY = t1[1] - t2[1];

  return [Math.hypot(distX, distY), distX, distY];
 };
function getClosest (entities) {
  let acc = [0, 0]
  for (let i = 0; i < entities.length; i ++) {
    const accumulator = getDist (acc, [canvas.width / 2, canvas.height / 2])[0];
    const current = getDist (entities[i], [canvas.width / 2, canvas.height / 2])[0];

    if (current < accumulator) acc = entities[i];
  }
  return acc;
}
function aim() {
  const target = getClosest
  (
    shapes.pentagons.length>0
    ?shapes.pentagons
    :shapes.triangles.length>0
    ?shapes.triangles
    :shapes.squares
  )
  if (!debugOptions.aim) {
    return;
  }
  mouse = target;
  input.mouse(...target)
}
function drawDebug() {

  if (debugOptions.lines) {
    const everyshape = [].concat(
      shapes.squares,
      shapes.triangles,
      shapes.pentagons,
    )
    everyshape.forEach(function(shape){
      context.beginPath();
      context.lineWidth = 0.5;
      context.strokeStyle == 'black';
      context.moveTo(canvas.width / 2, canvas.height / 2);
      context.lineTo(...shape)

      context.stroke()
      context.closePath()
    });
  }
  if (debugOptions.shapeInfo) {
    for (let key in shapes) {
      const type = shapeData[key];

      context.strokeStyle = 'red';
      context.lineWidth = 2;
      shapes[key].forEach(function(shape){
        const size = 75;
        context.beginPath();
        context.strokeRect(shape[0] - size / 2, shape[1] - size / 2, size, size);
        context.closePath();
      });
    }
    for (let key in shapes) {
      const type = shapeData[key];
      shapes[key].forEach(function(shape){
        const size = 75;
        context.beginPath();
        context.lineWidth = 2;
        context.font = "bold 23px serif";
        context.strokeStyle = '#000000';
        context.fillStyle = 'red';
        context.strokeText(names[key], shape[0] - 25, shape[1] + size / 2.5)
        context.fillText(names[key], shape[0] - 25, shape[1] + size / 2.5)
        context.closePath();
      });
    }
  }
}

function mainloop() {
  window.requestAnimationFrame(mainloop);
  drawDebug();
  aim();
  clearShapes();
}
mainloop();
},2500);